public class ImproveWayAccuracyAction extends MapMode implements MapViewPaintable, SelectionChangedListener, ModifierListener
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ImproveWayAccuracyAction.State |
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private Stroke |
addNodeStroke |
private Node |
candidateNode |
private WaySegment |
candidateSegment |
private Cursor |
cursorImprove |
private Cursor |
cursorImproveAdd |
private Cursor |
cursorImproveAddLock |
private Cursor |
cursorImproveDelete |
private Cursor |
cursorImproveLock |
private Cursor |
cursorSelect |
private Cursor |
cursorSelectHover |
private Stroke |
deleteNodeStroke |
private int |
dotSize |
private boolean |
dragging |
private Color |
guideColor |
private Point |
mousePos |
private Stroke |
moveNodeStroke |
private MapView |
mv |
protected String |
oldModeHelpText |
private boolean |
selectionChangedBlocked |
private Stroke |
selectTargetWayStroke |
private static long |
serialVersionUID |
private ImproveWayAccuracyAction.State |
state |
private Way |
targetWay |
sc
changeSupport, enabled
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 and Description |
---|
ImproveWayAccuracyAction(MapFrame mapFrame)
Constructs a new
ImproveWayAccuracyAction . |
Modifier and Type | Method and Description |
---|---|
void |
enterMode()
Makes this map mode active.
|
void |
exitMode()
Makes this map mode inactive.
|
String |
getModeHelpText() |
boolean |
layerIsSupported(Layer l)
Determines if layer
l is supported by this map mode. |
void |
modifiersChanged(int modifiers) |
void |
mouseDragged(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
paint(Graphics2D g,
MapView mv,
Bounds bbox)
Redraws temporary layer.
|
private void |
readPreferences() |
void |
selectionChanged(Collection<? extends OsmPrimitive> newSelection)
Informs the listener that the selection in the dataset has changed.
|
void |
startImproving(Way targetWay)
Switches to Improving state
|
void |
startSelecting()
Switches to Selecting state
|
private void |
updateCursor()
Sets new cursor depending on state, mouse position
|
void |
updateCursorDependentObjectsIfNeeded()
Updates these objects under cursor: targetWay, candidateNode,
candidateSegment
|
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e.
|
private void |
updateStateByCurrentSelection()
Updates the state according to the current selection.
|
protected void |
updateStatusLine() |
actionPerformed, mouseClicked, mouseEntered, mousePressed, requestFocusInMapView, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
private ImproveWayAccuracyAction.State state
private static final long serialVersionUID
private transient Node candidateNode
private transient WaySegment candidateSegment
private boolean dragging
private final Cursor cursorSelect
private final Cursor cursorSelectHover
private final Cursor cursorImprove
private final Cursor cursorImproveAdd
private final Cursor cursorImproveDelete
private final Cursor cursorImproveAddLock
private final Cursor cursorImproveLock
private Color guideColor
private transient Stroke selectTargetWayStroke
private transient Stroke moveNodeStroke
private transient Stroke addNodeStroke
private transient Stroke deleteNodeStroke
private int dotSize
private boolean selectionChangedBlocked
protected String oldModeHelpText
public ImproveWayAccuracyAction(MapFrame mapFrame)
ImproveWayAccuracyAction
.mapFrame
- Map framepublic void enterMode()
MapMode
private void readPreferences()
public void exitMode()
MapMode
protected void updateStatusLine()
updateStatusLine
in class MapMode
public String getModeHelpText()
getModeHelpText
in class MapMode
public boolean layerIsSupported(Layer l)
MapMode
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 layerlayerIsSupported
in class MapMode
l
- layertrue
if the layer is supported by this map modeprotected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
public void paint(Graphics2D g, MapView mv, Bounds bbox)
paint
in interface MapViewPaintable
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.bbox
- Bounding boxpublic void modifiersChanged(int modifiers)
modifiersChanged
in interface ModifierListener
public void selectionChanged(Collection<? extends OsmPrimitive> newSelection)
SelectionChangedListener
selectionChanged
in interface SelectionChangedListener
newSelection
- The new selection.public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class MapMode
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class MapMode
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class MapMode
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
mouseExited
in class MapMode
private void updateCursor()
public void updateCursorDependentObjectsIfNeeded()
public void startSelecting()
public void startImproving(Way targetWay)
targetWay
- Way that is going to be improvedprivate void updateStateByCurrentSelection()