public final class AlignInLineAction extends JosmAction
Modifier and Type | Class and Description |
---|---|
private static class |
AlignInLineAction.InvalidSelection
InvalidSelection exception has to be raised when action can't be perform
|
private class |
AlignInLineAction.Line
Class that represent a line
|
sc
Constructor and Description |
---|
AlignInLineAction()
Constructs a new
AlignInLineAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Operation depends on the selected objects:
|
private Command |
alignMultiWay(java.util.Collection<Way> ways)
Align way in case of multiple way #6819
|
private Command |
alignOnlyNodes(java.util.List<Node> nodes)
Align nodes in case that only nodes are selected
The general algorithm here is to find the two selected nodes
that are furthest apart, and then to align all other selected
nodes onto the straight line between these nodes.
|
private Command |
alignSingleNode(Node node,
java.util.List<AlignInLineAction.Line> lines)
Align a single node relative to a set of lines #9081
|
private java.util.List<AlignInLineAction.Line> |
getInvolvedLines(Node node,
java.util.List<Way> refWays)
Get lines useful to do alignment of a single node
|
private void |
nodePairFurthestApart(java.util.List<Node> nodes,
Node[] resultOut)
Compute 2 anchor points to align a set of nodes.
|
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, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip
public AlignInLineAction()
AlignInLineAction
.private void nodePairFurthestApart(java.util.List<Node> nodes, Node[] resultOut)
nodes
- Nodes to be alignedresultOut
- Array of size >= 2public void actionPerformed(java.awt.event.ActionEvent e)
private Command alignOnlyNodes(java.util.List<Node> nodes) throws AlignInLineAction.InvalidSelection
nodes
- Nodes to be alignedAlignInLineAction.InvalidSelection
private Command alignMultiWay(java.util.Collection<Way> ways) throws AlignInLineAction.InvalidSelection
ways
- Collection of way to alignAlignInLineAction.InvalidSelection
private java.util.List<AlignInLineAction.Line> getInvolvedLines(Node node, java.util.List<Way> refWays) throws AlignInLineAction.InvalidSelection
node
- Node to be alignedrefWays
- Ways where useful lines will be searchedAlignInLineAction.InvalidSelection
private Command alignSingleNode(Node node, java.util.List<AlignInLineAction.Line> lines) throws AlignInLineAction.InvalidSelection
node
- Node to be alignedlines
- Lines to align node onAlignInLineAction.InvalidSelection
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()