isNonNested method
Implementation
bool isNonNested() {
buildIndex();
for (int i = 0; i < rings.length; i++) {
LinearRing innerRing = rings[i] as LinearRing;
List<Coordinate> innerRingPts = innerRing.getCoordinates();
List results = index!.query(innerRing.getEnvelopeInternal());
//System.out.println(results.size());
for (int j = 0; j < results.length; j++) {
LinearRing searchRing = results[j] as LinearRing;
List<Coordinate> searchRingPts = searchRing.getCoordinates();
if (innerRing == searchRing) continue;
if (!innerRing
.getEnvelopeInternal()
.intersectsEnvelope(searchRing.getEnvelopeInternal())) continue;
Coordinate? innerRingPt =
IsValidOp.findPtNotNode(innerRingPts, searchRing, graph);
/**
* If no non-node pts can be found, this means
* that the searchRing touches ALL of the innerRing vertices.
* This indicates an invalid polygon, since either
* the two holes create a disconnected interior,
* or they touch in an infinite number of points
* (i.e. along a line segment).
* Both of these cases are caught by other tests,
* so it is safe to simply skip this situation here.
*/
if (innerRingPt == null) continue;
bool isInside = PointLocation.isInRing(innerRingPt, searchRingPts);
if (isInside) {
nestedPt = innerRingPt;
return false;
}
}
}
return true;
}