|
||||||||||
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.MergeNodesAction
public class MergeNodesAction
Merges a collection of nodes into one node. The "surviving" node will be the one with the lowest positive id. (I.e. it was uploaded to the server and is the oldest one.) However we use the location of the node that was selected *last*. The "surviving" node will be moved to that location if it is different from the last selected node.
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 | |
---|---|
MergeNodesAction()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
|
static void |
doMergeNodes(OsmDataLayer layer,
java.util.Collection<Node> nodes,
Node targetLocationNode)
|
protected static java.util.List<Command> |
fixParentWays(java.util.Collection<Node> nodesToDelete,
Node targetNode)
Fixes the parent ways referring to one of the nodes. |
static Command |
mergeNodes(OsmDataLayer layer,
java.util.Collection<Node> nodes,
Node targetLocationNode)
|
static Command |
mergeNodes(OsmDataLayer layer,
java.util.Collection<Node> nodes,
Node targetNode,
Node targetLocationNode)
Merges the nodes in nodes onto one of the nodes. |
static Node |
selectTargetLocationNode(java.util.List<Node> candidates)
Select the location of the target node after merge. |
static Node |
selectTargetNode(java.util.Collection<Node> candidates)
Find which node to merge into (i.e. |
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 MergeNodesAction()
Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent event)
public static Node selectTargetLocationNode(java.util.List<Node> candidates)
candidates
- the collection of candidate nodes
public static Node selectTargetNode(java.util.Collection<Node> candidates)
candidates
- the collection of candidate nodes
protected static java.util.List<Command> fixParentWays(java.util.Collection<Node> nodesToDelete, Node targetNode)
nodesToDelete
- the collection of nodes to be deletedtargetNode
- the target node the other nodes are merged to
public static void doMergeNodes(OsmDataLayer layer, java.util.Collection<Node> nodes, Node targetLocationNode)
public static Command mergeNodes(OsmDataLayer layer, java.util.Collection<Node> nodes, Node targetLocationNode)
public static Command mergeNodes(OsmDataLayer layer, java.util.Collection<Node> nodes, Node targetNode, Node targetLocationNode)
nodes
onto one of the nodes. Uses the dataset
managed by layer
as reference.
layer
- layer the reference data layer. Must not be null.nodes
- the collection of nodes. Ignored if null.targetNode
- the target node the collection of nodes is merged to. Must not be null.targetLocationNode
- this node's location will be used for the targetNode.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 |