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:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,Destroyable
public class CombineWayAction extends JosmAction
Combines multiple ways into one.- Since:
- 213
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
Fields Modifier and Type Field Description private static BooleanProperty
PROP_REVERSE_WAY
-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Constructor Description CombineWayAction()
Constructs a newCombineWayAction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
private static boolean
checkAndConfirmCombineOutlyingWays(java.util.Collection<Way> ways)
Check whether user is about to combine ways with unknown parents.static Pair<Way,Command>
combineWaysWorker(java.util.Collection<Way> ways)
Combine multiple ways into one.protected static boolean
confirmChangeDirectionOfWays()
protected static void
detectReversedWays(java.util.Collection<Way> ways, java.util.List<Node> path, java.util.List<Way> reversedWays, java.util.List<Way> unreversedWays)
protected static Way
getTargetWay(java.util.Collection<Way> combinedWays)
private static java.util.List<Node>
joinWithMultipolygonCode(java.util.Collection<Way> ways)
UseMultipolygon.joinWays(Collection)
to join ways.protected static java.util.List<Node>
tryJoin(java.util.Collection<Way> ways)
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.protected static void
warnCombiningImpossible()
-
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, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
PROP_REVERSE_WAY
private static final BooleanProperty PROP_REVERSE_WAY
-
-
Constructor Detail
-
CombineWayAction
public CombineWayAction()
Constructs a newCombineWayAction
.
-
-
Method Detail
-
confirmChangeDirectionOfWays
protected static boolean confirmChangeDirectionOfWays()
-
warnCombiningImpossible
protected static void warnCombiningImpossible()
-
getTargetWay
protected static Way getTargetWay(java.util.Collection<Way> combinedWays)
-
combineWaysWorker
public static Pair<Way,Command> combineWaysWorker(java.util.Collection<Way> ways) throws UserCancelException
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(java.util.Collection<Way> ways, java.util.List<Node> path, java.util.List<Way> reversedWays, java.util.List<Way> unreversedWays)
-
joinWithMultipolygonCode
private static java.util.List<Node> joinWithMultipolygonCode(java.util.Collection<Way> ways)
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
public void actionPerformed(java.awt.event.ActionEvent event)
-
updateEnabledState
protected void updateEnabledState()
Description copied from class:JosmAction
Override 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:
updateEnabledState
in classJosmAction
- See Also:
JosmAction.updateEnabledState(Collection)
,JosmAction.initEnabledState()
,JosmAction.listenToLayerChange()
-
updateEnabledState
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Description copied from class:JosmAction
Override 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:
updateEnabledState
in classJosmAction
- Parameters:
selection
- the collection of selected primitives; may be empty, but not null- See Also:
JosmAction.updateEnabledState()
,JosmAction.initEnabledState()
,JosmAction.listenToSelectionChange()
-
checkAndConfirmCombineOutlyingWays
private static boolean checkAndConfirmCombineOutlyingWays(java.util.Collection<Way> ways)
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
-
-