Class MapMode
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.mapmode.MapMode
- All Implemented Interfaces:
ActionListener,MouseListener,MouseMotionListener,Serializable,Cloneable,EventListener,Action,PreferenceChangedListener,Destroyable
- Direct Known Subclasses:
AddNoteAction,DeleteAction,DrawAction,ExtrudeAction,ImageryAdjustAction,ImproveWayAccuracyAction,ParallelWayAction,PlayHeadDragMode,SelectAction,SelectLassoAction,SplitMode,ZoomAction
public abstract class MapMode
extends JosmAction
implements MouseListener, MouseMotionListener, PreferenceChangedListener
A class implementing MapMode is able to be selected as an mode for map editing.
As example scrolling the map is a MapMode, connecting Nodes to new Ways is another.
MapModes should register/deregister all necessary listeners on the map's view control.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected final Cursorprotected booleantrueif the meta key was pressed (the "Windows" key or the Mac "Command" key)protected booleantrueif the platform specific menu key was pressed ("ctrl" on Linux/Windows, "cmd" on Mac)protected booleanFields inherited from class org.openstreetmap.josm.actions.JosmAction
scFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for mapmodes with a menu (no shortcut will be registered)protectedConstructor for mapmodes without a menu -
Method Summary
Modifier and TypeMethodDescriptionvoidCall selectMapMode(this) on the parent mapFrame.voidMakes this map mode active.voidexitMode()Makes this map mode inactive.Returns a short translated help message describing how this map mode can be used, to be displayed in status line.protected booleanDetermines if the given layer is a data layer that can be modified.protected static booleanDetermines if the user is currently panning the map.booleanDetermines if layerlis supported by this map mode.private static intmapOldModifiers(int modifiers) Map old (pre jdk 1.4) modifiers to extended modifiers (only for Ctrl, Alt, Shift).voidvoidvoidvoidvoidvoidvoidvoidTriggered when a preference entry value changes.protected voidprotected voidprotected voidUpdate internal ctrl, alt, shift mask from given action event.protected voidUpdate internal ctrl, alt, shift mask from given input event.protected voidUpdate internal ctrl, alt, shift mask from given mouse event.protected voidupdateKeyModifiersEx(int modifiers) Update internal ctrl, alt, shift, meta mask from given extended modifiers mask.protected voidMethods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
cursor
-
ctrl
-
alt
-
shift
-
meta
trueif the meta key was pressed (the "Windows" key or the Mac "Command" key)- Since:
- 18456
-
platformMenuShortcutKeyMask
trueif the platform specific menu key was pressed ("ctrl" on Linux/Windows, "cmd" on Mac)- Since:
- 18456
- See Also:
-
-
Constructor Details
-
MapMode
Constructor for mapmodes without a menu- Parameters:
name- the action's texticonName- icon filename inmapmodedirectorytooltip- a longer description of the action that will be displayed in the tooltip.shortcut- a ready-created shortcut object or null if you don't want a shortcut.cursor- cursor displayed when map mode is active- Since:
- 11713
-
MapMode
Constructor for mapmodes with a menu (no shortcut will be registered)- Parameters:
name- the action's texticonName- icon filename inmapmodedirectorytooltip- a longer description of the action that will be displayed in the tooltip.cursor- cursor displayed when map mode is active- Since:
- 11713
-
-
Method Details
-
enterMode
Makes this map mode active. -
exitMode
Makes this map mode inactive. -
updateStatusLine
-
getModeHelpText
Returns a short translated help message describing how this map mode can be used, to be displayed in status line.- Returns:
- a short translated help message describing how this map mode can be used
-
readPreferences
-
actionPerformed
Call selectMapMode(this) on the parent mapFrame.- Specified by:
actionPerformedin interfaceActionListener
-
layerIsSupported
Determines if layerlis supported by this map mode. By default, all tools will work with all layers. Can be overwritten to require a special type of layer- Parameters:
l- layer- Returns:
trueif the layer is supported by this map mode
-
updateKeyModifiers
Update internal ctrl, alt, shift mask from given input event.- Parameters:
e- input event
-
updateKeyModifiers
Update internal ctrl, alt, shift mask from given mouse event.- Parameters:
e- mouse event
-
updateKeyModifiers
Update internal ctrl, alt, shift mask from given action event.- Parameters:
e- action event- Since:
- 12526
-
updateKeyModifiersEx
Update internal ctrl, alt, shift, meta mask from given extended modifiers mask.- Parameters:
modifiers- event extended modifiers mask- Since:
- 12517
-
mapOldModifiers
Map old (pre jdk 1.4) modifiers to extended modifiers (only for Ctrl, Alt, Shift).- Parameters:
modifiers- old modifiers- Returns:
- extended modifiers
-
requestFocusInMapView
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
preferenceChanged
Description copied from interface:PreferenceChangedListenerTriggered when a preference entry value changes.- Specified by:
preferenceChangedin interfacePreferenceChangedListener- Parameters:
e- the preference change event
-
isEditableDataLayer
Determines if the given layer is a data layer that can be modified. Useful forlayerIsSupported(Layer)implementations.- Parameters:
l- layer- Returns:
trueif the given layer is a data layer that can be modified- Since:
- 13434
-
isPanning
Determines if the user is currently panning the map.- Returns:
trueif a pan is in progress- Since:
- 19701
-