public class MultipolygonTest extends Test
Modifier and Type | Class and Description |
---|---|
private static class |
MultipolygonTest.ExtPolygonIntersection |
private static class |
MultipolygonTest.PolygonLevel
Helper class for calculation of nesting levels
|
private static class |
MultipolygonTest.PolygonLevelFinder
Find nesting levels of polygons.
|
Test.TagTest
Modifier and Type | Field and Description |
---|---|
static int |
CROSSING_WAYS
Intersection between multipolygon ways
|
static int |
EQUAL_RINGS
Multipolygon ring is equal to another ring
|
private static int |
FOUND_INSIDE |
private static int |
FOUND_OUTSIDE |
static int |
INNER_STYLE_MISMATCH
With the currently used mappaint style the style for inner way equals the multipolygon style
|
static int |
INNER_WAY_OUTSIDE
Multipolygon inner way is outside
|
static int |
NO_STYLE
No area style for multipolygon
|
static int |
NO_STYLE_POLYGON
Multipolygon relation should be tagged with area tags and not the outer way(s)
|
static int |
NON_CLOSED_WAY
Multipolygon is not closed
|
static int |
OUTER_STYLE
Area style on outer way
|
static int |
OUTER_STYLE_MISMATCH
Style for outer way mismatches / With the currently used mappaint style(s) the style for outer way mismatches the area style
|
static int |
REPEATED_MEMBER_DIFF_ROLE
Multipolygon member repeated (same primitive, different role)
|
static int |
REPEATED_MEMBER_SAME_ROLE
Multipolygon member repeated (same primitive, same role
|
static int |
RINGS_SHARE_NODES
Multipolygon rings share nodes
|
static int |
WRONG_MEMBER_ROLE
No useful role for multipolygon member
|
static int |
WRONG_MEMBER_TYPE
Non-Way in multipolygon
|
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, startTime, testBeforeUpload
Constructor and Description |
---|
MultipolygonTest()
Constructs a new
MultipolygonTest . |
Modifier and Type | Method and Description |
---|---|
private void |
addRepeatedMemberError(Relation r,
java.util.List<OsmPrimitive> repeatedMembers,
int errorCode,
java.lang.String msg) |
private void |
checkGeometryAndRoles(Relation r,
Multipolygon polygon)
Various geometry-related checks:
NON_CLOSED_WAY : Multipolygon is not closed
INNER_WAY_OUTSIDE : Multipolygon inner way is outside
CROSSING_WAYS : Intersection between multipolygon ways
|
private static boolean |
checkIfNodeIsInsidePolygon(Node n,
Multipolygon.PolyData p)
Check if a node is inside the polygon according to the insideness rules of Shape.
|
private boolean |
checkMembersAndRoles(Relation r,
java.util.List<TestError> tmpErrors)
Check for:
WRONG_MEMBER_ROLE : No useful role for multipolygon member
WRONG_MEMBER_TYPE : Non-Way in multipolygon
|
private static MultipolygonTest.ExtPolygonIntersection |
checkOverlapAtSharedNodes(java.util.Set<Node> shared,
Multipolygon.PolyData pd1,
Multipolygon.PolyData pd2) |
private void |
checkPolygonForSelfIntersection(Relation r,
Multipolygon.PolyData pd)
Check if a polygon ring is self-intersecting when the ring was build from multiple ways.
|
private void |
checkPolygonsForSharedNodes(Relation r,
Multipolygon.PolyData pd1,
Multipolygon.PolyData pd2,
java.util.Set<Node> allSharedNodes) |
private static boolean |
checkProblemMap(java.util.Map<Multipolygon.PolyData,java.util.List<Multipolygon.PolyData>> problemPolyMap,
Multipolygon.PolyData pd1,
Multipolygon.PolyData pd2)
Check if map contains combination of two given polygons.
|
private boolean |
checkRepeatedWayMembers(Relation r)
Check for:
REPEATED_MEMBER_DIFF_ROLE : Multipolygon member(s) repeated with different role
REPEATED_MEMBER_SAME_ROLE : Multipolygon member(s) repeated with same role
|
private void |
checkRoles(Relation r,
java.util.List<Multipolygon.PolyData> allPolygons,
java.util.Map<java.lang.Long,RelationMember> wayMap,
java.util.Set<Node> sharedNodes)
Calculate the nesting levels of the polygon rings and check if calculated role matches
|
private void |
checkStyleConsistency(Relation r,
Multipolygon polygon)
Various style-related checks:
NO_STYLE_POLYGON : Multipolygon relation should be tagged with area tags and not the outer way
INNER_STYLE_MISMATCH : With the currently used mappaint style the style for inner way equals the multipolygon style
OUTER_STYLE_MISMATCH : Style for outer way mismatches
OUTER_STYLE : Area style on outer way
|
private static java.util.Collection<? extends OsmPrimitive> |
combineRelAndPrimitives(Relation r,
java.util.Collection<? extends OsmPrimitive> primitives) |
private static void |
findIntersectingWay(Way w,
java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments,
java.util.Map<java.util.List<Way>,java.util.List<WaySegment>> crossingWays,
boolean findSharedWaySegments)
Find ways which are crossing without sharing a node.
|
private java.util.Map<Multipolygon.PolyData,java.util.List<Multipolygon.PolyData>> |
findIntersectingWays(Relation r,
java.util.List<Multipolygon.PolyData> innerPolygons,
java.util.List<Multipolygon.PolyData> outerPolygons)
Determine multipolygon ways which are intersecting (crossing without a common node) or sharing one or more way segments.
|
private static void |
findIntersectionNodes(Relation r,
java.util.Set<Node> sharedNodes,
java.util.Set<Way> intersectionWays)
Detect intersections of multipolygon ways at nodes.
|
Command |
fixError(TestError testError)
Fixes the error with the appropriate command
|
private static boolean |
hasIntersectionWay(Multipolygon.PolyData pd,
java.util.Set<Way> intersectionWays)
Simple check if given ring contains way that is known to intersect.
|
boolean |
isFixable(TestError testError)
Returns true if the given error can be fixed automatically
|
void |
visit(Relation r)
Visiting call for relations.
|
addGui, clear, compareTo, deletePrimitivesIfNeeded, endTest, equals, getErrors, getName, hashCode, initialize, isBuilding, isCanceled, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit, visit, visit
public static final int WRONG_MEMBER_TYPE
public static final int WRONG_MEMBER_ROLE
public static final int NON_CLOSED_WAY
public static final int INNER_WAY_OUTSIDE
public static final int CROSSING_WAYS
public static final int OUTER_STYLE_MISMATCH
public static final int INNER_STYLE_MISMATCH
public static final int NO_STYLE
public static final int NO_STYLE_POLYGON
public static final int OUTER_STYLE
public static final int REPEATED_MEMBER_SAME_ROLE
public static final int REPEATED_MEMBER_DIFF_ROLE
public static final int EQUAL_RINGS
public static final int RINGS_SHARE_NODES
private static final int FOUND_INSIDE
private static final int FOUND_OUTSIDE
public MultipolygonTest()
MultipolygonTest
.public void visit(Relation r)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
visit
in class Test
r
- The relation to inspect.private void checkStyleConsistency(Relation r, Multipolygon polygon)
NO_STYLE_POLYGON
: Multipolygon relation should be tagged with area tags and not the outer wayINNER_STYLE_MISMATCH
: With the currently used mappaint style the style for inner way equals the multipolygon styleOUTER_STYLE_MISMATCH
: Style for outer way mismatchesOUTER_STYLE
: Area style on outer wayr
- relationpolygon
- multipolygonprivate void checkGeometryAndRoles(Relation r, Multipolygon polygon)
NON_CLOSED_WAY
: Multipolygon is not closedINNER_WAY_OUTSIDE
: Multipolygon inner way is outsideCROSSING_WAYS
: Intersection between multipolygon waysr
- relationpolygon
- multipolygonprivate static boolean hasIntersectionWay(Multipolygon.PolyData pd, java.util.Set<Way> intersectionWays)
pd
- the ringintersectionWays
- the known intersection waysprivate void checkPolygonForSelfIntersection(Relation r, Multipolygon.PolyData pd)
SelfIntersectingWay
.r
- the relationpd
- the ringprivate static void findIntersectionNodes(Relation r, java.util.Set<Node> sharedNodes, java.util.Set<Way> intersectionWays)
r
- the relationsharedNodes
- We be filled with shared nodesintersectionWays
- We be filled with ways that have a shared nodeprivate void checkPolygonsForSharedNodes(Relation r, Multipolygon.PolyData pd1, Multipolygon.PolyData pd2, java.util.Set<Node> allSharedNodes)
private static MultipolygonTest.ExtPolygonIntersection checkOverlapAtSharedNodes(java.util.Set<Node> shared, Multipolygon.PolyData pd1, Multipolygon.PolyData pd2)
private void checkRoles(Relation r, java.util.List<Multipolygon.PolyData> allPolygons, java.util.Map<java.lang.Long,RelationMember> wayMap, java.util.Set<Node> sharedNodes)
r
- relation (for error reporting)allPolygons
- list of polygon ringswayMap
- maps way ids to relation memberssharedNodes
- all nodes shared by multiple ways of this multipolygonprivate static boolean checkIfNodeIsInsidePolygon(Node n, Multipolygon.PolyData p)
n
- the nodep
- the polygonprivate java.util.Map<Multipolygon.PolyData,java.util.List<Multipolygon.PolyData>> findIntersectingWays(Relation r, java.util.List<Multipolygon.PolyData> innerPolygons, java.util.List<Multipolygon.PolyData> outerPolygons)
CrossingWays
r
- the relation (for error reporting)innerPolygons
- list of inner polygonsouterPolygons
- list of outer polygonsprivate static void findIntersectingWay(Way w, java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, java.util.Map<java.util.List<Way>,java.util.List<WaySegment>> crossingWays, boolean findSharedWaySegments)
w
- way that is member of the relationcellSegments
- map with already collected way segmentscrossingWays
- list to collect crossing waysfindSharedWaySegments
- true: find shared way segments instead of crossingsprivate static boolean checkProblemMap(java.util.Map<Multipolygon.PolyData,java.util.List<Multipolygon.PolyData>> problemPolyMap, Multipolygon.PolyData pd1, Multipolygon.PolyData pd2)
problemPolyMap
- the mappd1
- 1st polygonpd2
- 2nd polygonprivate boolean checkMembersAndRoles(Relation r, java.util.List<TestError> tmpErrors)
WRONG_MEMBER_ROLE
: No useful role for multipolygon memberWRONG_MEMBER_TYPE
: Non-Way in multipolygonr
- relationtmpErrors
- list that will contain found errorsprivate static java.util.Collection<? extends OsmPrimitive> combineRelAndPrimitives(Relation r, java.util.Collection<? extends OsmPrimitive> primitives)
private boolean checkRepeatedWayMembers(Relation r)
REPEATED_MEMBER_DIFF_ROLE
: Multipolygon member(s) repeated with different roleREPEATED_MEMBER_SAME_ROLE
: Multipolygon member(s) repeated with same roler
- relationprivate void addRepeatedMemberError(Relation r, java.util.List<OsmPrimitive> repeatedMembers, int errorCode, java.lang.String msg)
public Command fixError(TestError testError)
Test