Class ParallelWayAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.mapmode.MapMode
org.openstreetmap.josm.actions.mapmode.ParallelWayAction
- All Implemented Interfaces:
ActionListener,MouseListener,MouseMotionListener,Serializable,Cloneable,EventListener,Action,ModifierExListener,PreferenceChangedListener,Destroyable
MapMode for making parallel ways.
All calculations are done in projected coordinates.
TODO:
== Functionality ==
- Use selected nodes as split points for the selected ways.
The ways containing the selected nodes will be split and only the "inner" parts will be copied
- Enter exact offset
- Improve snapping
- Visual cues could be better
- (long term) Parallelize and adjust offsets of existing ways
- The mode, flags, and modifiers might be updated more than necessary.
Not a performance problem, but better if they where more centralized
- Extract generic MapMode services into a super class and/or utility class
- Maybe better to simply draw our own source way highlighting?
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA property that holds the keyboard modifiers.(package private) static enum(package private) static enumprivate final classNested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> private static final CachingProperty<Double>private static final CachingProperty<Boolean>private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> private booleanprivate static final CachingProperty<BasicStroke>private EastNorthprivate EastNorthprivate ParallelWays.ClosestPointthe source segment the current offset relates to (the one closest to the mouse)private static final CachingProperty<Integer>private static final CachingProperty<Color>private ParallelWayAction.Modeprivate booleanprivate booleanprivate Pointprivate longprivate final MapViewprivate static final CachingProperty<BasicStroke>private ParallelWaysprivate static final CachingProperty<BasicStroke>private WaySegmentprivate static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> private booleanprivate static final CachingProperty<Boolean>private static final CachingProperty<Double>private static final CachingProperty<Double>private static final CachingProperty<Double>private static final CachingProperty<Double>private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> private static final CachingProperty<Double>private final ParallelWayAction.ParallelWayLayerprivate static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> Fields inherited from class org.openstreetmap.josm.actions.mapmode.MapMode
alt, ctrl, cursor, meta, platformMenuShortcutKeyMask, shiftFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddSourceWay(Way w) private voidvoidMakes 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.private booleaninitParallelWays(Point p, boolean copyTags) private booleanbooleanDetermines if layerlis supported by this map mode.private booleanprivate booleanvoidmodifiersExChanged(int modifiers) Called when the extended modifiers are changedvoidvoidvoidprivate static Stringprivate voidprivate static voidremoveWayHighlighting(Collection<Way> ways) private voidprivate booleanprivate voidprivate voidprivate voidprivate voidprivate booleanupdateModifiersState(int modifiers) Methods inherited from class org.openstreetmap.josm.actions.mapmode.MapMode
actionPerformed, isEditableDataLayer, isPanning, mouseClicked, mouseEntered, mouseExited, mouseMoved, preferenceChanged, readPreferences, requestFocusInMapView, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers, updateKeyModifiersEx, updateStatusLineMethods 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
-
HELPER_LINE_STROKE
-
REF_LINE_STROKE
-
SNAP_THRESHOLD
-
SNAP_DEFAULT
-
COPY_TAGS_DEFAULT
-
INITIAL_MOVE_DELAY
-
SNAP_DISTANCE_METRIC
-
SNAP_DISTANCE_IMPERIAL
-
SNAP_DISTANCE_CHINESE
-
SNAP_DISTANCE_NAUTICAL
-
ARC_STEP_DEGREES
-
PREVIEW_STROKE
-
MAIN_COLOR
-
SNAP_MODIFIER_COMBO
-
COPY_TAGS_MODIFIER_COMBO
private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> COPY_TAGS_MODIFIER_COMBO -
ADD_TO_SELECTION_MODIFIER_COMBO
private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> ADD_TO_SELECTION_MODIFIER_COMBO -
TOGGLE_SELECTED_MODIFIER_COMBO
private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> TOGGLE_SELECTED_MODIFIER_COMBO -
SET_SELECTED_MODIFIER_COMBO
private static final CachingProperty<Map<ParallelWayAction.Modifier,Boolean>> SET_SELECTED_MODIFIER_COMBO -
mode
-
copyTags
-
snap
-
mv
-
mousePressedPos
-
mouseIsDown
-
mousePressedTime
-
mouseHasBeenDragged
-
referenceSegment
-
pWays
-
sourceWays
-
helperLineStart
-
helperLineEnd
-
helperSegment
the source segment the current offset relates to (the one closest to the mouse) -
temporaryLayer
-
-
Constructor Details
-
ParallelWayAction
Constructs a newParallelWayAction.- Parameters:
mapFrame- Map frame
-
-
Method Details
-
enterMode
Description copied from class:MapModeMakes this map mode active. -
exitMode
Description copied from class:MapModeMakes this map mode inactive. -
getModeHelpText
Description copied from class:MapModeReturns a short translated help message describing how this map mode can be used, to be displayed in status line.- Overrides:
getModeHelpTextin classMapMode- Returns:
- a short translated help message describing how this map mode can be used
-
layerIsSupported
Description copied from class:MapModeDetermines 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- Overrides:
layerIsSupportedin classMapMode- Parameters:
l- layer- Returns:
trueif the layer is supported by this map mode
-
modifiersExChanged
Description copied from interface:ModifierExListenerCalled when the extended modifiers are changed- Specified by:
modifiersExChangedin interfaceModifierExListener- Parameters:
modifiers- The new extended modifiers
-
updateModifiersState
-
updateCursor
-
setMode
-
sanityCheck
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMapMode
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classMapMode
-
removeWayHighlighting
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classMapMode
-
matchesCurrentModifiers
private boolean matchesCurrentModifiers(CachingProperty<Map<ParallelWayAction.Modifier, Boolean>> spec) -
matchesCurrentModifiers
-
isModifiersValidForDragMode
-
updateFlagsOnlyChangeableOnPress
-
updateFlagsChangeableAlways
-
addSourceWay
-
removeSourceWay
-
clearSourceWays
-
resetMouseTrackingState
-
initParallelWays
-
prefKey
-