public class MergeNodesAction extends JosmAction
sc
changeSupport, enabled
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 and Description |
---|
MergeNodesAction()
Constructs a new
MergeNodesAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent event) |
static void |
doMergeNodes(OsmDataLayer layer,
Collection<Node> nodes,
Node targetLocationNode)
Merges the nodes in
nodes at the specified node's location. |
protected static List<Command> |
fixParentWays(Collection<Node> nodesToDelete,
Node targetNode)
Fixes the parent ways referring to one of the nodes.
|
static Command |
mergeNodes(OsmDataLayer layer,
Collection<Node> nodes,
Node targetLocationNode)
Merges the nodes in
nodes at the specified node's location. |
static Command |
mergeNodes(OsmDataLayer layer,
Collection<Node> nodes,
Node targetNode,
Node targetLocationNode)
Merges the nodes in
nodes onto one of the nodes. |
static Node |
selectTargetLocationNode(List<Node> candidates)
Select the location of the target node after merge.
|
static Node |
selectTargetNode(Collection<Node> candidates)
Find which node to merge into (i.e. which one will be left)
|
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e. when a layer is removed or added.
|
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, setTooltip
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public MergeNodesAction()
MergeNodesAction
.public void actionPerformed(ActionEvent event)
public static Node selectTargetLocationNode(List<Node> candidates)
candidates
- the collection of candidate nodespublic static Node selectTargetNode(Collection<Node> candidates)
candidates
- the collection of candidate nodesprotected static List<Command> fixParentWays(Collection<Node> nodesToDelete, Node targetNode)
nodesToDelete
- the collection of nodes to be deletedtargetNode
- the target node the other nodes are merged topublic static void doMergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetLocationNode)
nodes
at the specified node's location. Uses the dataset
managed by layer
as reference.layer
- layer the reference data layer. Must not be nullnodes
- the collection of nodes. Ignored if nulltargetLocationNode
- this node's location will be used for the target nodeIllegalArgumentException
- thrown if layer
is nullpublic static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetLocationNode)
nodes
at the specified node's location. 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.targetLocationNode
- this node's location will be used for the targetNode.null
if there is nothing to doIllegalArgumentException
- thrown if layer
is nullpublic static Command mergeNodes(OsmDataLayer layer, 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.null
if there is nothing to doIllegalArgumentException
- thrown if layer is nullprotected 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(Collection<? extends OsmPrimitive> selection)
JosmAction
updateEnabledState
in class JosmAction
selection
- the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()