public abstract class MapMode extends JosmAction implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, Preferences.PreferenceChangedListener
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
protected boolean |
alt |
protected boolean |
ctrl |
protected java.awt.Cursor |
cursor |
protected boolean |
shift |
sc
Constructor and Description |
---|
MapMode(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
MapFrame mapFrame,
java.awt.Cursor cursor)
Constructor for mapmodes with a menu (no shortcut will be registered)
|
MapMode(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
Shortcut shortcut,
MapFrame mapFrame,
java.awt.Cursor cursor)
Constructor for mapmodes without a menu
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Call selectMapMode(this) on the parent mapFrame.
|
void |
enterMode()
Makes this map mode active.
|
void |
exitMode()
Makes this map mode inactive.
|
java.lang.String |
getModeHelpText() |
boolean |
layerIsSupported(Layer l)
Determines if layer
l is supported by this map mode. |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
preferenceChanged(Preferences.PreferenceChangeEvent e)
Trigerred when a preference entry value changes.
|
protected void |
readPreferences() |
protected void |
requestFocusInMapView() |
protected void |
updateKeyModifiers(java.awt.event.InputEvent e) |
protected void |
updateKeyModifiers(int modifiers) |
protected void |
updateKeyModifiers(java.awt.event.MouseEvent e) |
protected void |
updateStatusLine() |
destroy, getCurrentDataSet, getEditLayer, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, waitFuture
protected final java.awt.Cursor cursor
protected boolean ctrl
protected boolean alt
protected boolean shift
public MapMode(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, MapFrame mapFrame, java.awt.Cursor cursor)
name
- the action's texticonName
- icon filename in mapmode
directorytooltip
- 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.mapFrame
- unused but kept for plugin compatibility. Can be null
cursor
- cursor displayed when map mode is activepublic MapMode(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, MapFrame mapFrame, java.awt.Cursor cursor)
name
- the action's texticonName
- icon filename in mapmode
directorytooltip
- a longer description of the action that will be displayed in the tooltip.mapFrame
- unused but kept for plugin compatibility. Can be null
cursor
- cursor displayed when map mode is activepublic void enterMode()
public void exitMode()
protected void updateStatusLine()
public java.lang.String getModeHelpText()
protected void readPreferences()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public boolean layerIsSupported(Layer l)
l
is supported by this map mode.
By default, all tools will work with all layers.
Can be overwritten to require a special type of layerl
- layertrue
if the layer is supported by this map modeprotected void updateKeyModifiers(java.awt.event.InputEvent e)
protected void updateKeyModifiers(java.awt.event.MouseEvent e)
protected void updateKeyModifiers(int modifiers)
protected void requestFocusInMapView()
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void preferenceChanged(Preferences.PreferenceChangeEvent e)
Preferences.PreferenceChangedListener
preferenceChanged
in interface Preferences.PreferenceChangedListener
e
- the preference change event