checkHolesNotNested method
Tests that no hole is nested inside another hole. This routine assumes that the holes are disjoint. To ensure this, holes have previously been tested to ensure that:
- they do not partially overlap
(checked by
checkRelateConsistency
) - they are not identical
(checked by
checkRelateConsistency
)
Implementation
void checkHolesNotNested(Polygon p, GeometryGraph graph) {
IndexedNestedRingTester nestedTester = new IndexedNestedRingTester(graph);
//SimpleNestedRingTester nestedTester = new SimpleNestedRingTester(arg[0]);
//SweeplineNestedRingTester nestedTester = new SweeplineNestedRingTester(arg[0]);
for (int i = 0; i < p.getNumInteriorRing(); i++) {
LinearRing innerHole = p.getInteriorRingN(i);
if (innerHole.isEmpty()) continue;
nestedTester.add(innerHole);
}
bool isNonNested = nestedTester.isNonNested();
if (!isNonNested) {
validErr = new TopologyValidationError.withCoordinate(
TopologyValidationError.NESTED_HOLES, nestedTester.getNestedPoint());
}
}