use of com.revolsys.geometry.geomgraph.GeometryGraph in project com.revolsys.open by revolsys.
the class IsValidOp method checkValidPolygon.
/**
* Checks the validity of a polygon.
* Sets the validErr flag.
*/
private boolean checkValidPolygon(final Polygon g) {
boolean valid = true;
valid &= checkClosedRings(g);
if (isErrorReturn()) {
return false;
}
try {
final GeometryGraph graph = new GeometryGraph(0, g);
valid &= checkTooFewPoints(graph);
if (isErrorReturn()) {
return false;
}
valid &= checkConsistentArea(graph);
if (isErrorReturn()) {
return false;
}
if (!this.isSelfTouchingRingFormingHoleValid) {
valid &= checkNoSelfIntersectingRings(graph);
if (isErrorReturn()) {
return false;
}
}
valid &= checkHolesInShell(g, graph);
if (isErrorReturn()) {
return false;
}
// SLOWcheckHolesNotNested(g);
valid &= checkHolesNotNested(g, graph);
if (isErrorReturn()) {
return false;
}
valid &= checkConnectedInteriors(graph);
return valid;
} catch (final IllegalArgumentException e) {
return false;
}
}
use of com.revolsys.geometry.geomgraph.GeometryGraph in project com.revolsys.open by revolsys.
the class IsValidOp method checkValidLinearRing.
/**
* Checks validity of a LinearRing.
*/
private boolean checkValidLinearRing(final LinearRing ring) {
boolean valid = true;
if (checkTooFewVertices(ring, 4)) {
valid &= checkClosedRing(ring);
if (isErrorReturn()) {
return false;
}
final GeometryGraph graph = new GeometryGraph(0, ring);
final LineIntersector li = new RobustLineIntersector();
graph.computeSelfNodes(li, true);
valid &= checkNoSelfIntersectingRings(graph);
return valid;
}
return false;
}
use of com.revolsys.geometry.geomgraph.GeometryGraph in project com.revolsys.open by revolsys.
the class IsValidOp method checkValidMultiPolygon.
private boolean checkValidMultiPolygon(final Polygonal polygonal) {
boolean valid = true;
for (final Polygon polygon : polygonal.polygons()) {
valid &= checkClosedRings(polygon);
if (isErrorReturn()) {
return false;
}
}
final GeometryGraph graph = new GeometryGraph(0, polygonal);
valid &= checkTooFewPoints(graph);
if (isErrorReturn()) {
return false;
}
valid &= checkConsistentArea(graph);
if (isErrorReturn()) {
return false;
}
if (!this.isSelfTouchingRingFormingHoleValid) {
valid &= checkNoSelfIntersectingRings(graph);
if (isErrorReturn()) {
return false;
}
}
for (final Polygon polygon : polygonal.getPolygons()) {
valid &= checkHolesInShell(polygon, graph);
if (isErrorReturn()) {
return false;
}
}
for (final Polygon polygon : polygonal.getPolygons()) {
valid &= checkHolesNotNested(polygon, graph);
if (isErrorReturn()) {
return false;
}
}
valid &= checkShellsNotNested(polygonal, graph);
if (isErrorReturn()) {
return false;
}
valid &= checkConnectedInteriors(graph);
return valid;
}
Aggregations