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:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,Destroyable
public class SplitWayAction extends JosmAction
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SplitWayAction.SegmentListCellRenderer
(package private) static class
SplitWayAction.SegmentToKeepSelectionDialog
A 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
sc
-
-
Constructor Summary
Constructors Constructor Description SplitWayAction()
Create a new SplitWayAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
Called when the action is executed.(package private) static void
doSplitWay(Way way, Way wayToKeep, java.util.List<Way> newWays, java.util.List<OsmPrimitive> newSelection)
static void
doSplitWayShowSegmentSelection(Way splitWay, java.util.List<Node> splitNodes, java.util.List<OsmPrimitive> selection)
Perform way splitting after presenting the user with a choice which way segment history should be preserved (in expert mode)(package private) static java.util.List<Way>
getApplicableWays(java.util.List<Way> selectedWays, java.util.List<Node> selectedNodes)
Determine which ways to split.static void
runOn(DataSet ds)
Run the action on the given dataset.protected void
updateEnabledState()
Override in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.protected void
updateEnabledState(java.util.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, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
SplitWayAction
public SplitWayAction()
Create a new SplitWayAction.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
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
public static void runOn(DataSet ds)
Run the action on the given dataset.- Parameters:
ds
- dataset- Since:
- 14542
-
doSplitWayShowSegmentSelection
public static void doSplitWayShowSegmentSelection(Way splitWay, java.util.List<Node> splitNodes, java.util.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
static java.util.List<Way> getApplicableWays(java.util.List<Way> selectedWays, java.util.List<Node> selectedNodes)
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
static void doSplitWay(Way way, Way wayToKeep, java.util.List<Way> newWays, java.util.List<OsmPrimitive> newSelection)
-
updateEnabledState
protected void updateEnabledState()
Description copied from class:JosmAction
Override 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:
updateEnabledState
in classJosmAction
- See Also:
JosmAction.updateEnabledState(Collection)
,JosmAction.initEnabledState()
,JosmAction.listenToLayerChange()
-
updateEnabledState
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Description copied from class:JosmAction
Override 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:
updateEnabledState
in classJosmAction
- Parameters:
selection
- the collection of selected primitives; may be empty, but not null- See Also:
JosmAction.updateEnabledState()
,JosmAction.initEnabledState()
,JosmAction.listenToSelectionChange()
-
-