public class ImproveWayAccuracyAction extends MapMode implements SelectionChangedListener, ModifierListener
Modifier and Type | Class and Description |
---|---|
private static class |
ImproveWayAccuracyAction.State |
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private static CachingProperty<java.awt.BasicStroke> |
ADD_NODE_STROKE |
private Node |
candidateNode |
private WaySegment |
candidateSegment |
private java.awt.Cursor |
cursorImprove |
private java.awt.Cursor |
cursorImproveAdd |
private java.awt.Cursor |
cursorImproveAddLock |
private java.awt.Cursor |
cursorImproveDelete |
private java.awt.Cursor |
cursorImproveLock |
private java.awt.Cursor |
cursorSelect |
private java.awt.Cursor |
cursorSelectHover |
private static CachingProperty<java.awt.BasicStroke> |
DELETE_NODE_STROKE |
private static CachingProperty<java.lang.Integer> |
DOT_SIZE |
private boolean |
dragging |
private java.awt.Color |
guideColor |
private java.awt.Point |
mousePos |
private static CachingProperty<java.awt.BasicStroke> |
MOVE_NODE_INTERSECTING_STROKE |
private static CachingProperty<java.awt.BasicStroke> |
MOVE_NODE_STROKE |
private MapView |
mv |
protected java.lang.String |
oldModeHelpText |
private static CachingProperty<java.awt.BasicStroke> |
SELECT_TARGET_WAY_STROKE |
private boolean |
selectionChangedBlocked |
private static long |
serialVersionUID |
private ImproveWayAccuracyAction.State |
state |
private Way |
targetWay |
private AbstractMapViewPaintable |
temporaryLayer |
sc
Constructor and Description |
---|
ImproveWayAccuracyAction(MapFrame mapFrame)
Constructs a new
ImproveWayAccuracyAction . |
Modifier and Type | Method and Description |
---|---|
protected void |
drawIntersectingWayHelperLines(MapView mv,
MapViewPath b) |
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 |
modifiersChanged(int modifiers) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds bbox)
Redraws temporary layer.
|
protected void |
readPreferences() |
void |
selectionChanged(java.util.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, preferenceChanged, requestFocusInMapView, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers
destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, waitFuture
private ImproveWayAccuracyAction.State state
private static final long serialVersionUID
private transient Node candidateNode
private transient WaySegment candidateSegment
private java.awt.Point mousePos
private boolean dragging
private final java.awt.Cursor cursorSelect
private final java.awt.Cursor cursorSelectHover
private final java.awt.Cursor cursorImprove
private final java.awt.Cursor cursorImproveAdd
private final java.awt.Cursor cursorImproveDelete
private final java.awt.Cursor cursorImproveAddLock
private final java.awt.Cursor cursorImproveLock
private java.awt.Color guideColor
private static final CachingProperty<java.awt.BasicStroke> SELECT_TARGET_WAY_STROKE
private static final CachingProperty<java.awt.BasicStroke> MOVE_NODE_STROKE
private static final CachingProperty<java.awt.BasicStroke> MOVE_NODE_INTERSECTING_STROKE
private static final CachingProperty<java.awt.BasicStroke> ADD_NODE_STROKE
private static final CachingProperty<java.awt.BasicStroke> DELETE_NODE_STROKE
private static final CachingProperty<java.lang.Integer> DOT_SIZE
private boolean selectionChangedBlocked
protected java.lang.String oldModeHelpText
private final transient AbstractMapViewPaintable temporaryLayer
public ImproveWayAccuracyAction(MapFrame mapFrame)
ImproveWayAccuracyAction
.mapFrame
- Map framepublic void enterMode()
MapMode
protected void readPreferences()
readPreferences
in class MapMode
public void exitMode()
MapMode
protected void updateStatusLine()
updateStatusLine
in class MapMode
public java.lang.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()
,
JosmAction.listenToLayerChange()
public void paint(java.awt.Graphics2D g, MapView mv, Bounds bbox)
g
- The graphicsmv
- The map viewbbox
- The bounding boxprotected void drawIntersectingWayHelperLines(MapView mv, MapViewPath b)
public void modifiersChanged(int modifiers)
modifiersChanged
in interface ModifierListener
public void selectionChanged(java.util.Collection<? extends OsmPrimitive> newSelection)
SelectionChangedListener
selectionChanged
in interface SelectionChangedListener
newSelection
- The new selection.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class MapMode
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class MapMode
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class MapMode
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.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()