public class UnGlueAction extends JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private Node |
selectedNode |
private java.util.Set<Node> |
selectedNodes |
private Way |
selectedWay |
sc
Constructor and Description |
---|
UnGlueAction()
Create a new UnGlueAction.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Called when the action is executed.
|
protected void |
checkAndConfirmOutlyingUnglue() |
private boolean |
checkForUnglueNode(java.util.Collection<? extends OsmPrimitive> selection)
Checks if selection is suitable for ungluing.
|
private boolean |
checkSelectionOneNodeAtMostOneWay(java.util.Collection<? extends OsmPrimitive> selection)
Checks if the selection consists of something we can work with.
|
private boolean |
checkSelectionOneWayAnyNodes(java.util.Collection<? extends OsmPrimitive> selection)
Checks if the selection consists of something we can work with.
|
private void |
cleanup() |
private void |
execCommands(java.util.List<Command> cmds,
java.util.List<Node> newNodes)
Add commands to undo-redo system.
|
private static Way |
modifyWay(Node originalNode,
Way w,
java.util.List<Command> cmds,
java.util.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!
|
protected void |
notifyWayPartOfRelation(java.util.Collection<Way> ways) |
protected void |
unglue(java.awt.event.ActionEvent e) |
private void |
unglueOneNodeAtMostOneWay(java.awt.event.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
|
(package private) static void |
update(PropertiesMembershipChoiceDialog dialog,
Node existingNode,
java.util.List<Node> newNodes,
java.util.Collection<Command> cmds) |
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.
|
private static void |
updateMemberships(PropertiesMembershipChoiceDialog.ExistingBothNew memberships,
Node originalNode,
java.util.List<Node> newNodes,
java.util.Collection<Command> cmds)
put all newNodes into the same relation(s) that originalNode is in
|
private static void |
updateProperties(PropertiesMembershipChoiceDialog.ExistingBothNew tags,
Node existingNode,
java.lang.Iterable<Node> newNodes,
java.util.Collection<Command> cmds) |
checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
private transient Node selectedNode
private transient Way selectedWay
private transient java.util.Set<Node> selectedNodes
public UnGlueAction()
public void actionPerformed(java.awt.event.ActionEvent e)
protected void unglue(java.awt.event.ActionEvent e) throws UserCancelException
UserCancelException
private void cleanup()
static void update(PropertiesMembershipChoiceDialog dialog, Node existingNode, java.util.List<Node> newNodes, java.util.Collection<Command> cmds)
private static void updateProperties(PropertiesMembershipChoiceDialog.ExistingBothNew tags, Node existingNode, java.lang.Iterable<Node> newNodes, java.util.Collection<Command> cmds)
private void unglueOneNodeAtMostOneWay(java.awt.event.ActionEvent e)
e
- event that triggered the actionprivate boolean checkForUnglueNode(java.util.Collection<? extends OsmPrimitive> selection)
selection
- The selection to check againsttrue
if selection is suitableprivate boolean checkSelectionOneNodeAtMostOneWay(java.util.Collection<? extends OsmPrimitive> selection)
selection
- selected primitivesprivate boolean checkSelectionOneWayAnyNodes(java.util.Collection<? extends OsmPrimitive> selection)
selection
- selected primitivesprivate static Way modifyWay(Node originalNode, Way w, java.util.List<Command> cmds, java.util.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 updateMemberships(PropertiesMembershipChoiceDialog.ExistingBothNew memberships, Node originalNode, java.util.List<Node> newNodes, java.util.Collection<Command> cmds)
memberships
- where the memberships should be placesoriginalNode
- original node to duplicatecmds
- List of commands that will contain the new "change relation" commandsnewNodes
- List of nodes that contain the new nodeprivate void unglueWays()
private void execCommands(java.util.List<Command> cmds, java.util.List<Node> newNodes)
cmds
- Commands to executenewNodes
- New created nodes by this set of commandprivate boolean unglueSelfCrossingWay()
private void unglueOneWayAnyNodes()
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()
,
JosmAction.listenToLayerChange()
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()
,
JosmAction.listenToSelectionChange()
protected void checkAndConfirmOutlyingUnglue() throws UserCancelException
UserCancelException
protected void notifyWayPartOfRelation(java.util.Collection<Way> ways)