Class SplitMode
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.mapmode.MapMode
org.openstreetmap.josm.actions.mapmode.SplitMode
- All Implemented Interfaces:
ActionListener,MouseListener,MouseMotionListener,Serializable,Cloneable,EventListener,Action,PreferenceChangedListener,Destroyable
Map mode for splitting ways.
- Since:
- 18759
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsModifier and TypeFieldDescription(package private) HighlightHelperHelper to keep track of highlighted primitives(package private) static final CachingProperty<Boolean>Don't consider disabled ways(package private) static final CachingProperty<Boolean>Prioritized selected ways over others when splittingFields 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 voidaddHoverHighlightListener(Component c, Collection<OsmPrimitive> prims) Add a mouse listener to the componentcwhich highlightsprimswhen the mouse pointer is hovering over the componentprivate voidaddNodeAndSplit(MapView mv, Point mousePos, Way way) Add a node to a way and then split itprivate static StringcreateLabelText(OsmPrimitive primitive) Create the text for aOsmPrimitivelabel, including its keysprivate static StringcreateLabelText(OsmPrimitive primitive, boolean includeKeys) Create the text for aOsmPrimitivelabelprivate JPopupMenucreatePopup(Node n, Collection<Way> applicableWays) Create a new split way selection popupvoidMakes this map mode active.voidexitMode()Makes this map mode inactive.getApplicableWays(Node n, Collection<Way> preferredWays) Get a list of potential ways to be split for a given nodeReturns a short translated help message describing how this map mode can be used, to be displayed in status line.private static Optional<OsmPrimitive>booleanDetermines if layerlis supported by this map mode.voidvoidprivate booleanRemoves all existing highlights.private booleanDetermine objects to highlight and update highlightMethods inherited from class org.openstreetmap.josm.actions.mapmode.MapMode
actionPerformed, isEditableDataLayer, isPanning, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseReleased, 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
-
PREFER_SELECTED_WAYS
Prioritized selected ways over others when splitting -
IGNORE_DISABLED_WAYS
Don't consider disabled ways -
highlight
Helper to keep track of highlighted primitives
-
-
Constructor Details
-
SplitMode
public SplitMode()Construct a new SplitMode object
-
-
Method Details
-
enterMode
Description copied from class:MapModeMakes this map mode active. -
exitMode
Description copied from class:MapModeMakes this map mode inactive. -
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
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMapMode
-
addNodeAndSplit
Add a node to a way and then split it- Parameters:
mv- The current mapviewmousePos- The mouse positionway- The nearest way
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classMapMode
-
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
-
getPrimitiveAtPoint
-
getApplicableWays
Get a list of potential ways to be split for a given node- Parameters:
n- The node at which ways should be splitpreferredWays- List of ways that should be prioritized over others. If one or more potential preferred ways are found, other ways are disregarded.- Returns:
- List of potential ways to be split
-
createPopup
Create a new split way selection popup- Parameters:
n- Node at which ways should be splitapplicableWays- Potential split ways to select from- Returns:
- A new popup object
-
updateUserFeedback
Determine objects to highlight and update highlight- Parameters:
e-MouseEventthat triggered the update- Returns:
- true if repaint is required
-
removeHighlighting
Removes all existing highlights.- Returns:
- true if a repaint is required
-
addHoverHighlightListener
Add a mouse listener to the componentcwhich highlightsprimswhen the mouse pointer is hovering over the component- Parameters:
c- The component to add the hover mouse listener toprims- The primitives to highlight when the component is hovered
-
createLabelText
Create the text for aOsmPrimitivelabel, including its keys- Parameters:
primitive- TheOsmPrimitiveto describe- Returns:
- Text describing the
OsmPrimitive
-
createLabelText
Create the text for aOsmPrimitivelabel- Parameters:
primitive- TheOsmPrimitiveto describeincludeKeys- Include keys in description- Returns:
- Text describing the
OsmPrimitive
-