public class SplitWayAction extends JosmAction
| Modifier and Type | Class and Description |
|---|---|
static class |
SplitWayAction.SplitWayResult
Represents the result of a
SplitWayAction |
sc| Constructor and Description |
|---|
SplitWayAction()
Create a new SplitWayAction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Called when the action is executed.
|
static java.util.List<java.util.List<Node>> |
buildSplitChunks(Way wayToSplit,
java.util.List<Node> splitPoints)
Splits the nodes of
wayToSplit into a list of node sequences
which are separated at the nodes in splitPoints. |
private java.util.List<Way> |
getApplicableWays(java.util.List<Way> selectedWays,
java.util.List<Node> selectedNodes) |
static SplitWayAction.SplitWayResult |
split(OsmDataLayer layer,
Way way,
java.util.List<Node> atNodes,
java.util.Collection<? extends OsmPrimitive> selection)
Splits the way
way at the nodes in atNodes and replies
the result of this process in an instance of SplitWayAction.SplitWayResult. |
static SplitWayAction.SplitWayResult |
splitWay(OsmDataLayer layer,
Way way,
java.util.List<java.util.List<Node>> wayChunks,
java.util.Collection<? extends OsmPrimitive> selection)
Splits the way
way into chunks of wayChunks and replies
the result of this process in an instance of SplitWayAction.SplitWayResult. |
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.
|
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltippublic SplitWayAction()
public void actionPerformed(java.awt.event.ActionEvent e)
private java.util.List<Way> getApplicableWays(java.util.List<Way> selectedWays, java.util.List<Node> selectedNodes)
public static java.util.List<java.util.List<Node>> buildSplitChunks(Way wayToSplit, java.util.List<Node> splitPoints)
wayToSplit into a list of node sequences
which are separated at the nodes in splitPoints.
This method displays warning messages if wayToSplit and/or
splitPoints aren't consistent.
Returns null, if building the split chunks fails.wayToSplit - the way to split. Must not be null.splitPoints - the nodes where the way is split. Must not be null.public static SplitWayAction.SplitWayResult splitWay(OsmDataLayer layer, Way way, java.util.List<java.util.List<Node>> wayChunks, java.util.Collection<? extends OsmPrimitive> selection)
way into chunks of wayChunks and replies
the result of this process in an instance of SplitWayAction.SplitWayResult.
Note that changes are not applied to the data yet. You have to
submit the command in SplitWayAction.SplitWayResult.getCommand() first,
i.e. Main.main.undoredo.add(result.getCommand()).layer - the layer which the way belongs to. Must not be null.way - the way to split. Must not be null.wayChunks - the list of way chunks into the way is split. Must not be null.selection - The list of currently selected primitivespublic static SplitWayAction.SplitWayResult split(OsmDataLayer layer, Way way, java.util.List<Node> atNodes, java.util.Collection<? extends OsmPrimitive> selection)
way at the nodes in atNodes and replies
the result of this process in an instance of SplitWayAction.SplitWayResult.
Note that changes are not applied to the data yet. You have to
submit the command in SplitWayAction.SplitWayResult.getCommand() first,
i.e. Main.main.undoredo.add(result.getCommand()).
Replies null if the way couldn't be split at the given nodes.layer - the layer which the way belongs to. Must not be null.way - the way to split. Must not be null.atNodes - the list of nodes where the way is split. Must not be null.selection - The list of currently selected primitivesprotected void updateEnabledState()
JosmActionJosmAction.updateEnabledState(Collection) to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState in class JosmActionJosmAction.updateEnabledState(Collection),
JosmAction.initEnabledState()protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
JosmActionupdateEnabledState in class JosmActionselection - the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState(),
JosmAction.initEnabledState()