use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.
the class IsValidOp method checkNoSelfIntersectingRings.
/**
* Check that there is no ring which self-intersects (except of course at its endpoints).
* This is required by OGC topology rules (but not by other models
* such as ESRI SDE, which allow inverted shells and exverted holes).
*
* @param graph the topology graph of the geometry
*/
private boolean checkNoSelfIntersectingRings(final GeometryGraph graph) {
boolean valid = true;
for (final Edge edge : graph.edges()) {
final EdgeIntersectionList edgeIntersectionList = edge.getEdgeIntersectionList();
valid &= checkNoSelfIntersectingRing(edgeIntersectionList);
if (isErrorReturn()) {
return false;
}
}
return valid;
}
use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.
the class IsValidOp method findPtNotNode.
/**
* Find a point from the list of testCoords
* that is NOT a node in the edge for the list of searchCoords
*
* @return the point found, or <code>null</code> if none found
*/
public static Point findPtNotNode(final LineString testLine, final LinearRing searchRing, final GeometryGraph graph) {
// find edge corresponding to searchRing.
final Edge searchEdge = graph.findEdge(searchRing);
// find a point in the testCoords which is not a node of the searchRing
final EdgeIntersectionList eiList = searchEdge.getEdgeIntersectionList();
// somewhat inefficient - is there a better way? (Use a node map, for
// instance?)
final int vertexCount = testLine.getVertexCount();
for (int vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
final double x = testLine.getX(vertexIndex);
final double y = testLine.getY(vertexIndex);
if (!eiList.isIntersection(x, y)) {
return new PointDoubleXY(x, y);
}
}
return null;
}
use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.
the class ConnectedInteriorTester method visitInteriorRing.
private void visitInteriorRing(final LineString ring, final PlanarGraph graph) {
final Point pt0 = ring.getVertex(0).newPoint2D();
/**
* Find first point in coord list different to initial point.
* Need special check since the first point may be repeated.
*/
final Point pt1 = findDifferentPoint(ring, pt0);
final Edge e = graph.findEdgeInSameDirection(pt0, pt1);
final DirectedEdge de = (DirectedEdge) graph.findEdgeEnd(e);
if (de != null) {
DirectedEdge intDe = null;
final Label label = de.getLabel();
if (label.getLocation(0, Position.RIGHT) == Location.INTERIOR) {
intDe = de;
} else if (de.getSym().getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
intDe = de.getSym();
}
Assert.isTrue(intDe != null, "unable to find dirEdge with Interior on RHS");
visitLinkedDirectedEdges(intDe);
}
}
use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.
the class EdgeSetNoder method getNodedEdges.
public List getNodedEdges() {
final EdgeSetIntersector esi = new SimpleMCSweepLineIntersector();
final SegmentIntersector si = new SegmentIntersector(this.li, true, false);
esi.computeIntersections(this.inputEdges, si, true);
// Debug.println("has proper int = " + si.hasProperIntersection());
final List splitEdges = new ArrayList();
for (final Iterator i = this.inputEdges.iterator(); i.hasNext(); ) {
final Edge e = (Edge) i.next();
e.getEdgeIntersectionList().addSplitEdges(splitEdges);
}
return splitEdges;
}
use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.
the class LineBuilder method findCoveredLineEdges.
/**
* Find and mark L edges which are "covered" by the result area (if any).
* L edges at nodes which also have A edges can be checked by checking
* their depth at that node.
* L edges at nodes which do not have A edges can be checked by doing a
* point-in-polygon test with the previously computed result areas.
*/
private void findCoveredLineEdges() {
// first set covered for all L edges at nodes which have A edges too
for (final Object element : this.op.getGraph().getNodes()) {
final Node node = (Node) element;
// node.print(System.out);
((DirectedEdgeStar) node.getEdges()).findCoveredLineEdges();
}
/**
* For all L edges which weren't handled by the above,
* use a point-in-poly test to determine whether they are covered
*/
for (final Object element : this.op.getGraph().getEdgeEnds()) {
final DirectedEdge de = (DirectedEdge) element;
final Edge e = de.getEdge();
if (de.isLineEdge() && !e.isCoveredSet()) {
final boolean isCovered = this.op.isCoveredByA(de.getX1(), de.getY1());
e.setCovered(isCovered);
}
}
}
Aggregations