org.openstreetmap.josm.actions
Class CreateMultipolygonAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.CreateMultipolygonAction
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Destroyable
public class CreateMultipolygonAction
- extends JosmAction
Create multipolygon from selected ways automatically.
New relation with type=multipolygon is created
If one or more of ways is already in relation with type=multipolygon or the
way is not closed, then error is reported and no relation is created
The "inner" and "outer" roles are guessed automatically. First, bbox is
calculated for each way. then the largest area is assumed to be outside and
the rest inside. In cases with one "outside" area and several cut-ins, the
guess should be always good ... In more complex (multiple outer areas) or
buggy (inner and outer ways intersect) scenarios the result is likely to be
wrong.
- See Also:
- Serialized Form
Fields inherited from class org.openstreetmap.josm.actions.JosmAction |
sc |
Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
Fields 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 |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_LINEAR_TAGS
public static final java.util.List<java.lang.String> DEFAULT_LINEAR_TAGS
CreateMultipolygonAction
public CreateMultipolygonAction()
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- The action button has been clicked
- Parameters:
e
- Action Event
updateEnabledState
protected void updateEnabledState()
- Enable this action only if something is selected
- Overrides:
updateEnabledState
in class JosmAction
- See Also:
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
updateEnabledState
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
- Enable this action only if something is selected
- Overrides:
updateEnabledState
in class JosmAction
- Parameters:
selection
- the collection of selected primitives; may be empty, but not null- See Also:
JosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
analyzeWays
private MultipolygonCreate analyzeWays(java.util.Collection<Way> selectedWays)
- This method analyzes ways and creates multipolygon.
- Parameters:
selectedWays
-
- Returns:
- null, if there was a problem with the ways.
createRelation
private Relation createRelation(MultipolygonCreate pol)
- Builds a relation from polygon ways.
- Parameters:
pol
-
- Returns:
removeTagsFromWaysIfNeeded
private java.util.List<Command> removeTagsFromWaysIfNeeded(Relation relation)
- This method removes tags/value pairs from inner and outer ways and put them on relation if necessary
Function was extended in reltoolbox plugin by Zverikk and copied back to the core
- Parameters:
relation
-
JOSM