public final class DistributeAction extends JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
sc
Constructor and Description |
---|
DistributeAction()
Constructs a new
DistributeAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Perform action.
|
private static java.lang.Boolean |
checkDistributeNodes(java.util.Collection<Way> ways,
java.util.Collection<Node> nodes)
Test if nodes oriented algorithm applies to the selection.
|
private static boolean |
checkDistributeWay(java.util.Collection<Way> ways,
java.util.Collection<Node> nodes)
Test if one way, no self-crossing, is selected with at most two of its nodes.
|
private static java.util.Collection<Command> |
distributeNodes(java.util.Collection<Node> nodes)
Distribute nodes when only nodes are selected.
|
private static java.util.Collection<Command> |
distributeWay(java.util.Collection<Way> ways,
java.util.Collection<Node> nodes)
Distribute nodes contained by a way, keeping nodes order.
|
private static java.util.Set<Node> |
removeNodesWithoutCoordinates(java.util.Collection<Node> col)
Remove nodes without knowned coordinates from a collection.
|
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.
|
destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setTooltip, updateEnabledStateOnCurrentSelection, waitFuture
public DistributeAction()
DistributeAction
.public void actionPerformed(java.awt.event.ActionEvent e)
private static boolean checkDistributeWay(java.util.Collection<Way> ways, java.util.Collection<Node> nodes)
ways
- Selected waysnodes
- Selected nodesprivate static java.util.Collection<Command> distributeWay(java.util.Collection<Way> ways, java.util.Collection<Node> nodes)
ways
- Selected ways, must be collection of size 1.nodes
- Selected nodes, at most two nodes.private static java.lang.Boolean checkDistributeNodes(java.util.Collection<Way> ways, java.util.Collection<Node> nodes)
ways
- Selected waysnodes
- Selected nodesprivate static java.util.Collection<Command> distributeNodes(java.util.Collection<Node> nodes)
nodes
- nodes to distributejava.lang.IllegalArgumentException
- if nodes is emptyprivate static java.util.Set<Node> removeNodesWithoutCoordinates(java.util.Collection<Node> col)
col
- Collection of nodes to checkprotected 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()