Package org.openstreetmap.josm.actions
Class CombineWayAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.CombineWayAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action,Destroyable
Combines multiple ways into one.
- Since:
- 213
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsFields 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 TypeMethodDescriptionvoidactionPerformed(ActionEvent event) private static booleanCheck whether user is about to combine ways with unknown parents.combineWaysWorker(Collection<Way> ways) Combine multiple ways into one.protected static booleanprotected static voiddetectReversedWays(Collection<Way> ways, List<Node> path, List<Way> reversedWays, List<Way> unreversedWays) protected static WaygetTargetWay(Collection<Way> combinedWays) UseMultipolygon.joinWays(Collection)to join ways.tryJoin(Collection<Way> ways) 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.protected static voidMethods 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
-
Field Details
-
PROP_REVERSE_WAY
-
-
Constructor Details
-
CombineWayAction
public CombineWayAction()Constructs a newCombineWayAction.
-
-
Method Details
-
confirmChangeDirectionOfWays
-
warnCombiningImpossible
-
getTargetWay
-
combineWaysWorker
Combine multiple ways into one.- Parameters:
ways- the way to combine to one way- Returns:
- null if ways cannot be combined. Otherwise returns the combined ways and the commands to combine
- Throws:
UserCancelException- if the user cancelled a dialog.
-
detectReversedWays
protected static void detectReversedWays(Collection<Way> ways, List<Node> path, List<Way> reversedWays, List<Way> unreversedWays) -
tryJoin
-
joinWithMultipolygonCode
UseMultipolygon.joinWays(Collection)to join ways.- Parameters:
ways- the ways- Returns:
- List of nodes of the combined ways or null if ways could not be combined to a single way. Result may contain overlapping segments.
-
actionPerformed
-
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:
-
checkAndConfirmCombineOutlyingWays
Check whether user is about to combine ways with unknown parents. Request confirmation if he is.- Parameters:
ways- the primitives to operate on- Returns:
- true, if operating on outlying primitives is OK; false, otherwise
-