public final class CreateCircleAction extends JosmAction
Modifier and Type | Class and Description |
---|---|
private static class |
CreateCircleAction.PolarNode
Class designed to create a couple between a node and its angle relative to the center of the circle.
|
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
sc
Constructor and Description |
---|
CreateCircleAction()
Constructs a new
CreateCircleAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
private static int[] |
distributeNodes(CreateCircleAction.PolarNode[] angles,
int nodesCount)
Distributes nodes according to the algorithm of election with largest remainder.
|
private static void |
notifyNodesNotOnCircle() |
private static void |
notifyNodesOutsideWorld() |
private static java.util.List<Node> |
orderNodesByTrafficHand(java.util.List<Node> nodes)
Order nodes according to left/right hand traffic.
|
private static java.util.List<Node> |
orderNodesByWay(java.util.List<Node> nodes,
Way way)
Order nodes according to way direction.
|
static void |
runOn(DataSet ds)
Run the action on the given dataset.
|
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.
|
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
public CreateCircleAction()
CreateCircleAction
.private static int[] distributeNodes(CreateCircleAction.PolarNode[] angles, int nodesCount)
angles
- Array of PolarNode ordered by increasing anglesnodesCount
- Number of nodes to be distributedpublic void actionPerformed(java.awt.event.ActionEvent e)
public static void runOn(DataSet ds)
ds
- datasetprivate static java.util.List<Node> orderNodesByTrafficHand(java.util.List<Node> nodes)
nodes
- Nodes list to be ordered.private static java.util.List<Node> orderNodesByWay(java.util.List<Node> nodes, Way way)
nodes
- Nodes list to be ordered.way
- Way used to determine direction.private static void notifyNodesNotOnCircle()
private static void notifyNodesOutsideWorld()
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()
,
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()