public class CreateMultipolygonAction extends JosmAction
Modifier and Type | Class and Description |
---|---|
private static class |
CreateMultipolygonAction.CreateUpdateMultipolygonTask |
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private static java.util.List<java.lang.String> |
DEFAULT_LINEAR_TAGS |
private boolean |
update |
sc
Constructor and Description |
---|
CreateMultipolygonAction(boolean update)
Constructs a new
CreateMultipolygonAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
private static void |
addMembers(MultipolygonBuilder.JoinedPolygon polygon,
Relation rel,
java.lang.String role) |
private static MultipolygonBuilder |
analyzeWays(java.util.Collection<Way> selectedWays,
boolean showNotif)
This method analyzes ways and creates multipolygon.
|
static Pair<SequenceCommand,Relation> |
createMultipolygonCommand(java.util.Collection<Way> selectedWays,
Relation selectedMultipolygonRelation)
|
static Pair<Relation,Relation> |
createMultipolygonRelation(java.util.Collection<Way> selectedWays,
boolean showNotif)
|
private static Relation |
createRelation(MultipolygonBuilder pol,
Relation clone)
Builds a relation from polygon ways.
|
private static java.lang.String |
getName(boolean update) |
private static Relation |
getSelectedMultipolygonRelation() |
private static Relation |
getSelectedMultipolygonRelation(java.util.Collection<Way> selectedWays,
java.util.Collection<Relation> selectedRelations) |
static 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
|
protected void |
updateEnabledState()
Enable this action only if something is selected
|
protected void |
updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Enable this action only if something is selected
|
static Pair<Relation,Relation> |
updateMultipolygonRelation(java.util.Collection<Way> selectedWays,
Relation selectedMultipolygonRelation)
|
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, waitFuture
private final boolean update
private static final java.util.List<java.lang.String> DEFAULT_LINEAR_TAGS
public CreateMultipolygonAction(boolean update)
CreateMultipolygonAction
.update
- true
if the multipolygon must be updated, false
if it must be createdprivate static java.lang.String getName(boolean update)
public void actionPerformed(java.awt.event.ActionEvent e)
private static Relation getSelectedMultipolygonRelation()
private static Relation getSelectedMultipolygonRelation(java.util.Collection<Way> selectedWays, java.util.Collection<Relation> selectedRelations)
public static Pair<Relation,Relation> updateMultipolygonRelation(java.util.Collection<Way> selectedWays, Relation selectedMultipolygonRelation)
Pair
of the old multipolygon Relation
(or null) and the newly created/modified multipolygon Relation
.selectedWays
- selected waysselectedMultipolygonRelation
- selected multipolygon relationpublic static Pair<Relation,Relation> createMultipolygonRelation(java.util.Collection<Way> selectedWays, boolean showNotif)
selectedWays
- selected waysshowNotif
- if true
, shows a notification if an error occurspublic static Pair<SequenceCommand,Relation> createMultipolygonCommand(java.util.Collection<Way> selectedWays, Relation selectedMultipolygonRelation)
selectedWays
- selected waysselectedMultipolygonRelation
- selected multipolygon relationprotected void updateEnabledState()
updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
updateEnabledState
in class JosmAction
selection
- the current selection, gets tested for emptynessJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
private static MultipolygonBuilder analyzeWays(java.util.Collection<Way> selectedWays, boolean showNotif)
selectedWays
- list of selected waysshowNotif
- if true
, shows a notification if an error occursnull
, if there was a problem with the ways.private static Relation createRelation(MultipolygonBuilder pol, Relation clone)
pol
- data storage class containing polygon informationclone
- relation to clone, can be nullprivate static void addMembers(MultipolygonBuilder.JoinedPolygon polygon, Relation rel, java.lang.String role)
public static java.util.List<Command> removeTagsFromWaysIfNeeded(Relation relation)
relation
- the multipolygon style relation to process