/** * Check all nodes to see if their labels are consistent. If any are not, return false * * @return <code>true</code> if the edge area labels are consistent at this node */ private boolean isNodeEdgeAreaLabelsConsistent() { for (Iterator nodeIt = nodeGraph.getNodeIterator(); nodeIt.hasNext(); ) { RelateNode node = (RelateNode) nodeIt.next(); if (!node.getEdges().isAreaLabelsConsistent(geomGraph)) { invalidPoint = (Coordinate) node.getCoordinate().clone(); return false; } } return true; }
/** * Checks for two duplicate rings in an area. Duplicate rings are rings that are topologically * equal (that is, which have the same sequence of points up to point order). If the area is * topologically consistent (determined by calling the <code>isNodeConsistentArea</code>, * duplicate rings can be found by checking for EdgeBundles which contain more than one EdgeEnd. * (This is because topologically consistent areas cannot have two rings sharing the same line * segment, unless the rings are equal). The start point of one of the equal rings will be placed * in invalidPoint. * * @return true if this area Geometry is topologically consistent but has two duplicate rings */ public boolean hasDuplicateRings() { for (Iterator nodeIt = nodeGraph.getNodeIterator(); nodeIt.hasNext(); ) { RelateNode node = (RelateNode) nodeIt.next(); for (Iterator i = node.getEdges().iterator(); i.hasNext(); ) { EdgeEndBundle eeb = (EdgeEndBundle) i.next(); if (eeb.getEdgeEnds().size() > 1) { invalidPoint = eeb.getEdge().getCoordinate(0); return true; } } } return false; }
/** * Check all nodes to see if their labels are consistent with area topology. * * @return <code>true</code> if this area has a consistent node labelling */ public boolean isNodeConsistentArea() { /** * To fully check validity, it is necessary to compute ALL intersections, including * self-intersections within a single edge. */ SegmentIntersector intersector = geomGraph.computeSelfNodes(li, true); if (intersector.hasProperIntersection()) { invalidPoint = intersector.getProperIntersectionPoint(); return false; } nodeGraph.build(geomGraph); return isNodeEdgeAreaLabelsConsistent(); }