Package org.openstreetmap.josm.actions
Class CreateCircleAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.CreateCircleAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action,Destroyable
- Create a new circle from two selected nodes or a way with 2 nodes which represent the diameter of the circle.
- Create a new circle from three selected nodes--or a way with 3 nodes.
- Useful for roundabouts
Notes:
* If a way is selected, it is changed. If nodes are selected a new way is created.
So if you've got a way with nodes it makes a difference between running this on the way or the nodes!
* The existing nodes are retained, and additional nodes are inserted regularly
to achieve the desired number of nodes (`createcircle.nodecount`).
BTW: Someone might want to implement projection corrections for this...
- Since:
- 996
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classClass designed to create a couple between a node and its angle relative to the center of the circle.Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
scFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static int[]distributeNodes(CreateCircleAction.PolarNode[] angles, int nodesCount) Distributes nodes according to the algorithm of election with largest remainder.private static voidprivate static voidorderNodesByTrafficHand(List<Node> nodes) Order nodes according to left/right hand traffic.orderNodesByWay(List<Node> nodes, Way way) Order nodes according to way direction.static voidRun the action on the given dataset.protected voidOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.protected voidupdateEnabledState(Collection<? extends OsmPrimitive> selection) Override in subclasses to update the enabled state of the action if the collection of selected primitives changes.Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
CreateCircleAction
public CreateCircleAction()Constructs a newCreateCircleAction.
-
-
Method Details
-
distributeNodes
Distributes nodes according to the algorithm of election with largest remainder.- Parameters:
angles- Array of PolarNode ordered by increasing anglesnodesCount- Number of nodes to be distributed- Returns:
- Array of number of nodes to put in each arc
-
actionPerformed
-
runOn
Run the action on the given dataset.- Parameters:
ds- dataset- Since:
- 14542
-
orderNodesByTrafficHand
Order nodes according to left/right hand traffic.- Parameters:
nodes- Nodes list to be ordered.- Returns:
- Modified nodes list ordered according hand traffic.
-
orderNodesByWay
Order nodes according to way direction.- Parameters:
nodes- Nodes list to be ordered.way- Way used to determine direction.- Returns:
- Modified nodes list with same direction as way.
-
notifyNodesNotOnCircle
-
notifyNodesOutsideWorld
-
updateEnabledState
Description copied from class:JosmActionOverride 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. SeeJosmAction.updateEnabledState(Collection)to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledStatein classJosmAction- See Also:
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action if the collection of selected primitives changes. This method is called with the new selection.- Overrides:
updateEnabledStatein classJosmAction- Parameters:
selection- the collection of selected primitives; may be empty, but not null- See Also:
-