public class UnGlueAction extends JosmAction
| Modifier and Type | Class and Description |
|---|---|
private static class |
UnGlueAction.ExistingBothNewChoice
Provides toggle buttons to allow the user choose the existing node, the new nodes, or all of them.
|
(package private) static class |
UnGlueAction.PropertiesMembershipDialog
A dialog allowing the user decide whether the tags/memberships of the existing node should afterwards be at
the existing node, the new nodes, or all of them.
|
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter| Modifier and Type | Field and Description |
|---|---|
private Node |
selectedNode |
private Set<Node> |
selectedNodes |
private Way |
selectedWay |
scchangeSupport, enabledACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON| Constructor and Description |
|---|
UnGlueAction()
Create a new UnGlueAction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent e)
Called when the action is executed.
|
protected boolean |
checkAndConfirmOutlyingUnglue() |
private boolean |
checkForUnglueNode(Collection<? extends OsmPrimitive> selection)
Checks if selection is suitable for ungluing.
|
private boolean |
checkSelectionOneNodeAtMostOneWay(Collection<? extends OsmPrimitive> selection)
Checks if the selection consists of something we can work with.
|
private boolean |
checkSelectionOneWayAnyNodes(Collection<? extends OsmPrimitive> selection)
Checks if the selection consists of something we can work with.
|
private static void |
execCommands(List<Command> cmds,
List<Node> newNodes)
Add commands to undo-redo system.
|
private static void |
fixRelations(Node originalNode,
Collection<Command> cmds,
List<Node> newNodes,
boolean removeOldMember)
put all newNodes into the same relation(s) that originalNode is in
|
private static Way |
modifyWay(Node originalNode,
Way w,
List<Command> cmds,
List<Node> newNodes)
dupe the given node of the given way
assume that originalNode is in the way
the new node will be put into the parameter newNodes.
the add-node command will be put into the parameter cmds.
the changed way will be returned and must be put into cmds by the caller!
|
private void |
unglueOneNodeAtMostOneWay(ActionEvent e)
Assumes there is one tagged Node stored in selectedNode that it will try to unglue.
|
private void |
unglueOneWayAnyNodes()
dupe all nodes that are selected, and put the copies on the selected way
|
private boolean |
unglueSelfCrossingWay()
Duplicates a node used several times by the same way.
|
private void |
unglueWays()
dupe a single node into as many nodes as there are ways using it, OR
dupe a single node once, and put the copy on the selected way
|
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(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, setTooltipaddPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledprivate transient Node selectedNode
private transient Way selectedWay
private transient Set<Node> selectedNodes
public UnGlueAction()
public void actionPerformed(ActionEvent e)
private void unglueOneNodeAtMostOneWay(ActionEvent e)
e - event that trigerred the actionprivate boolean checkForUnglueNode(Collection<? extends OsmPrimitive> selection)
selection - The selection to check againsttrue if selection is suitableprivate boolean checkSelectionOneNodeAtMostOneWay(Collection<? extends OsmPrimitive> selection)
selection - selected primitivesprivate boolean checkSelectionOneWayAnyNodes(Collection<? extends OsmPrimitive> selection)
selection - selected primitivesprivate static Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes)
originalNode - original node to duplicatew - parent waycmds - List of commands that will contain the new "add node" commandnewNodes - List of nodes that will contain the new nodeprivate static void fixRelations(Node originalNode, Collection<Command> cmds, List<Node> newNodes, boolean removeOldMember)
originalNode - original node to duplicatecmds - List of commands that will contain the new "change relation" commandsnewNodes - List of nodes that contain the new noderemoveOldMember - whether the membership of the "old node" should be removedprivate void unglueWays()
private static void execCommands(List<Command> cmds, List<Node> newNodes)
cmds - Commands to executenewNodes - New created nodes by this set of commandprivate boolean unglueSelfCrossingWay()
private void unglueOneWayAnyNodes()
protected 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(Collection<? extends OsmPrimitive> selection)
JosmActionupdateEnabledState in class JosmActionselection - the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState(),
JosmAction.initEnabledState()protected boolean checkAndConfirmOutlyingUnglue()