Package org.openstreetmap.josm.actions
Class SplitWayAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.SplitWayAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action,Destroyable
Splits a way into multiple ways (all identical except for their node list).
Ways are just split at the selected nodes. The nodes remain in their
original order. Selected nodes at the end of a way are ignored.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static classA dialog to query which way segment should reuse the history of the way to split.Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
Fields 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 TypeMethodDescriptionvoidCalled when the action is executed.(package private) static voiddoSplitWay(Way way, Way wayToKeep, List<Way> newWays, List<OsmPrimitive> newSelection) static voiddoSplitWayShowSegmentSelection(Way splitWay, List<Node> splitNodes, List<OsmPrimitive> selection) Perform way splitting after presenting the user with a choice which way segment history should be preserved (in expert mode)getApplicableWays(List<Way> selectedWays, List<Node> selectedNodes) Determine which ways to split.static voidRun the action on the given dataset.protected voidOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.protected voidupdateEnabledState(Collection<? extends OsmPrimitive> selection) Override in subclasses to update the enabled state of the action if the collection of selected primitives changes.Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
SplitWayAction
public SplitWayAction()Create a new SplitWayAction.
-
-
Method Details
-
actionPerformed
Called when the action is executed. This method performs an expensive check whether the selection clearly defines one of the split actions outlined above, and if yes, calls the splitWay method. -
runOn
Run the action on the given dataset.- Parameters:
ds- dataset- Since:
- 14542
-
doSplitWayShowSegmentSelection
public static void doSplitWayShowSegmentSelection(Way splitWay, List<Node> splitNodes, List<OsmPrimitive> selection) Perform way splitting after presenting the user with a choice which way segment history should be preserved (in expert mode)- Parameters:
splitWay- The way to splitsplitNodes- The nodes at which the way should be splitselection- (Optional) selection which should be updated- Since:
- 18759
-
getApplicableWays
Determine which ways to split.- Parameters:
selectedWays- List of user selected ways.selectedNodes- List of user selected nodes.- Returns:
- List of ways to split
-
doSplitWay
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e. when a layer is removed or added. SeeJosmAction.updateEnabledState(Collection)to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledStatein classJosmAction- See Also:
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action if the collection of selected primitives changes. This method is called with the new selection.- Overrides:
updateEnabledStatein classJosmAction- Parameters:
selection- the collection of selected primitives; may be empty, but not null- See Also:
-