|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.SplitWayAction
public class SplitWayAction
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.
Nested Class Summary | |
---|---|
static class |
SplitWayAction.SplitWayResult
Represents the result of a SplitWayAction |
Field Summary |
---|
Fields inherited from class org.openstreetmap.josm.actions.JosmAction |
---|
sc |
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields 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 | |
---|---|
SplitWayAction()
Create a new SplitWayAction. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.openstreetmap.josm.actions.JosmAction |
---|
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SplitWayAction()
Method Detail |
---|
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 primitives
public 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 primitives
protected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.
updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
JosmAction
updateEnabledState
in class JosmAction
selection
- the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |