Class Multipolygon
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon
-
public class Multipolygon extends Object
Multipolygon data used to represent complex areas, see wiki.- Since:
- 2788
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Multipolygon.JoinedWay
Class representing a string of ways.private static class
Multipolygon.MultipolygonRoleMatcher
Kind of strategy object which is responsible for deciding whether a given member role indicates that the member belongs to an outer or an inner polygon.static class
Multipolygon.PolyData
The polygon data for a multipolygon part.
-
Field Summary
Fields Modifier and Type Field Description private List<Multipolygon.PolyData>
combinedPolygons
private boolean
incomplete
private List<Way>
innerWays
private List<Node>
openEnds
private List<Way>
outerWays
static String
PREF_KEY_INNER_ROLE_PREFIXES
preference key for collection of role prefixes which indicate that the respective member belongs to an inner polygon.static String
PREF_KEY_INNER_ROLES
preference key for a collection of roles which indicate that the respective member belongs to an inner polygon.static String
PREF_KEY_OUTER_ROLE_PREFIXES
preference key for collection of role prefixes which indicate that the respective member belongs to an outer polygon.static String
PREF_KEY_OUTER_ROLES
preference key for a collection of roles which indicate that the respective member belongs to an outer polygon.private static Multipolygon.MultipolygonRoleMatcher
roleMatcher
-
Constructor Summary
Constructors Constructor Description Multipolygon(Relation r)
Constructs a newMultipolygon
from a relation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addInnerToOuters(List<Multipolygon.PolyData> innerPolygons, List<Multipolygon.PolyData> outerPolygons)
private void
createPolygons(List<Way> ways, List<Multipolygon.PolyData> result)
Multipolygon.PolyData
findOuterPolygon(Multipolygon.PolyData inner, List<Multipolygon.PolyData> outerPolygons)
Find a matching outer polygon for the inner oneList<Multipolygon.PolyData>
getCombinedPolygons()
Replies the list of combined polygons.List<Multipolygon.PolyData>
getInnerPolygons()
Replies the list of inner polygons.List<Way>
getInnerWays()
Replies the list of inner ways.private static Multipolygon.MultipolygonRoleMatcher
getMultipolygonRoleMatcher()
List<Node>
getOpenEnds()
Returns the start and end node of non-closed rings.List<Multipolygon.PolyData>
getOuterPolygons()
Replies the list of outer polygons.List<Way>
getOuterWays()
Replies the list of outer ways.boolean
isIncomplete()
Determines if this multipolygon is incomplete.static Collection<Multipolygon.JoinedWay>
joinWays(Collection<Way> waysToJoin)
Attempt to combine the ways in the list if they share common end nodesprivate void
load(Relation r)
-
-
-
Field Detail
-
PREF_KEY_OUTER_ROLES
public static final String PREF_KEY_OUTER_ROLES
preference key for a collection of roles which indicate that the respective member belongs to an outer polygon. Default isouter
.- See Also:
- Constant Field Values
-
PREF_KEY_OUTER_ROLE_PREFIXES
public static final String PREF_KEY_OUTER_ROLE_PREFIXES
preference key for collection of role prefixes which indicate that the respective member belongs to an outer polygon. Default is empty.- See Also:
- Constant Field Values
-
PREF_KEY_INNER_ROLES
public static final String PREF_KEY_INNER_ROLES
preference key for a collection of roles which indicate that the respective member belongs to an inner polygon. Default isinner
.- See Also:
- Constant Field Values
-
PREF_KEY_INNER_ROLE_PREFIXES
public static final String PREF_KEY_INNER_ROLE_PREFIXES
preference key for collection of role prefixes which indicate that the respective member belongs to an inner polygon. Default is empty.- See Also:
- Constant Field Values
-
roleMatcher
private static Multipolygon.MultipolygonRoleMatcher roleMatcher
-
combinedPolygons
private final List<Multipolygon.PolyData> combinedPolygons
-
incomplete
private boolean incomplete
-
-
Constructor Detail
-
Multipolygon
public Multipolygon(Relation r)
Constructs a newMultipolygon
from a relation.- Parameters:
r
- relation
-
-
Method Detail
-
getMultipolygonRoleMatcher
private static Multipolygon.MultipolygonRoleMatcher getMultipolygonRoleMatcher()
-
isIncomplete
public final boolean isIncomplete()
Determines if this multipolygon is incomplete.- Returns:
true
if this multipolygon is incomplete
-
createPolygons
private void createPolygons(List<Way> ways, List<Multipolygon.PolyData> result)
-
joinWays
public static Collection<Multipolygon.JoinedWay> joinWays(Collection<Way> waysToJoin)
Attempt to combine the ways in the list if they share common end nodes- Parameters:
waysToJoin
- The ways to join- Returns:
- A collection of
Multipolygon.JoinedWay
objects indicating the possible join of those ways
-
findOuterPolygon
public Multipolygon.PolyData findOuterPolygon(Multipolygon.PolyData inner, List<Multipolygon.PolyData> outerPolygons)
Find a matching outer polygon for the inner one- Parameters:
inner
- The inner polygon to search the outer forouterPolygons
- The possible outer polygons- Returns:
- The outer polygon that was found or
null
if none was found.
-
addInnerToOuters
private void addInnerToOuters(List<Multipolygon.PolyData> innerPolygons, List<Multipolygon.PolyData> outerPolygons)
-
getOuterWays
public List<Way> getOuterWays()
Replies the list of outer ways.- Returns:
- the list of outer ways
-
getInnerWays
public List<Way> getInnerWays()
Replies the list of inner ways.- Returns:
- the list of inner ways
-
getCombinedPolygons
public List<Multipolygon.PolyData> getCombinedPolygons()
Replies the list of combined polygons.- Returns:
- the list of combined polygons
-
getInnerPolygons
public List<Multipolygon.PolyData> getInnerPolygons()
Replies the list of inner polygons.- Returns:
- the list of inner polygons
-
getOuterPolygons
public List<Multipolygon.PolyData> getOuterPolygons()
Replies the list of outer polygons.- Returns:
- the list of outer polygons
-
getOpenEnds
public List<Node> getOpenEnds()
Returns the start and end node of non-closed rings.- Returns:
- the start and end node of non-closed rings.
-
-