public final class AlignInLineAction extends JosmAction
Case 1: 1 or 2 ways selected and no nodes selected: align nodes of ways taking care of intersection. Case 2: Single node selected and no ways selected: align this node relative to all referrer ways (2 at most). Case 3: Single node and ways selected: align this node relative to selected ways. Case 4.1: Only nodes selected, part of a non-closed way: align these nodes on the line passing through the extremity nodes (most distant in the way sequence). See https://josm.openstreetmap.de/ticket/9605#comment:3 Case 4.2: Only nodes selected, part of a closed way: align these nodes on the line passing through the most distant nodes. Case 4.3: Only nodes selected, part of multiple ways: align these nodes on the line passing through the most distant nodes.
| 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 3 or more nodes are selected.
|
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 Node[] |
nodeFurthestAppart(java.util.List<Node> nodes)
Return the two nodes the most distant from the provided list.
|
private Node[] |
nodePairFurthestApart(java.util.List<Node> nodes)
Return 2 nodes making up the line along which provided nodes must be aligned.
|
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, setTooltippublic AlignInLineAction()
AlignInLineAction.private Node[] nodePairFurthestApart(java.util.List<Node> nodes)
nodes - Nodes to be aligned.private Node[] nodeFurthestAppart(java.util.List<Node> nodes)
nodes - List of nodes to analyze.public void actionPerformed(java.awt.event.ActionEvent e)
private Command alignOnlyNodes(java.util.List<Node> nodes) throws AlignInLineAction.InvalidSelection
nodes - Nodes to be aligned.AlignInLineAction.InvalidSelection - If the nodes have same coordinates.private Command alignMultiWay(java.util.Collection<Way> ways) throws AlignInLineAction.InvalidSelection
ways - Collection of way to alignAlignInLineAction.InvalidSelectionprivate 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.InvalidSelectionprivate Command alignSingleNode(Node node, java.util.List<AlignInLineAction.Line> lines) throws AlignInLineAction.InvalidSelection
node - Node to be alignedlines - Lines to align node onAlignInLineAction.InvalidSelectionprotected void updateEnabledState()
JosmActionJosmAction.updateEnabledState(Collection) to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState in class JosmActionJosmAction.updateEnabledState(Collection),
JosmAction.initEnabledState()protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
JosmActionupdateEnabledState in class JosmActionselection - the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState(),
JosmAction.initEnabledState()