Search in sources :

Example 6 with Edge

use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.

the class RightmostEdgeFinder method getRightmostSideOfSegment.

private int getRightmostSideOfSegment(final DirectedEdge de, final int i) {
    final Edge edge = de.getEdge();
    if (i < 0 || i + 1 >= edge.getVertexCount()) {
        return -1;
    }
    final Point p1 = edge.getPoint(i);
    final Point p2 = edge.getPoint(i + 1);
    if (p1.getY() == p2.getY()) {
        // indicates edge is parallel to x-axis
        return -1;
    }
    int pos = Position.LEFT;
    if (p1.getY() < p2.getY()) {
        pos = Position.RIGHT;
    }
    return pos;
}
Also used : Point(com.revolsys.geometry.model.Point) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Edge(com.revolsys.geometry.geomgraph.Edge) Point(com.revolsys.geometry.model.Point)

Example 7 with Edge

use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.

the class RightmostEdgeFinder method checkForRightmostCoordinate.

private void checkForRightmostCoordinate(final DirectedEdge de) {
    final Edge edge = de.getEdge();
    for (int i = 0; i < edge.getVertexCount() - 1; i++) {
        // only check vertices which are the start or end point of a
        // non-horizontal segment
        // <FIX> MD 19 Sep 03 - NO! we can test all vertices, since the rightmost
        // must have a non-horiz segment adjacent to it
        final int i1 = i;
        final Point point = edge.getPoint(i1);
        if (this.minCoord == null || point.getX() > this.minCoord.getX()) {
            this.minDe = de;
            this.minIndex = i;
            this.minCoord = point;
        }
    // }
    }
}
Also used : Point(com.revolsys.geometry.model.Point) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Edge(com.revolsys.geometry.geomgraph.Edge) Point(com.revolsys.geometry.model.Point)

Example 8 with Edge

use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.

the class OverlayOp method replaceCollapsedEdges.

/**
 * If edges which have undergone dimensional collapse are found,
 * replace them with a new edge which is a L edge
 */
private void replaceCollapsedEdges() {
    final List<Edge> newEdges = new ArrayList<>();
    for (final Iterator<Edge> it = this.edgeList.iterator(); it.hasNext(); ) {
        final Edge e = it.next();
        if (e.isCollapsed()) {
            it.remove();
            newEdges.add(e.getCollapsedEdge());
        }
    }
    this.edgeList.addAll(newEdges);
}
Also used : ArrayList(java.util.ArrayList) Edge(com.revolsys.geometry.geomgraph.Edge) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge)

Example 9 with Edge

use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.

the class RelateComputer method updateIM.

/**
 * update the IM with the sum of the IMs for each component
 */
private void updateIM(final IntersectionMatrix im) {
    // Debug.println(im);
    for (final Iterator ei = this.isolatedEdges.iterator(); ei.hasNext(); ) {
        final Edge e = (Edge) ei.next();
        e.updateIM(im);
    // Debug.println(im);
    }
    for (final Object element : this.nodes) {
        final RelateNode node = (RelateNode) element;
        node.updateIM(im);
        // Debug.println(im);
        node.updateIMFromEdges(im);
    // Debug.println(im);
    // node.print(System.out);
    }
}
Also used : Iterator(java.util.Iterator) Edge(com.revolsys.geometry.geomgraph.Edge)

Example 10 with Edge

use of com.revolsys.geometry.geomgraph.Edge in project com.revolsys.open by revolsys.

the class RelateComputer method labelIsolatedEdges.

/**
 * Processes isolated edges by computing their labelling and adding them
 * to the isolated edges list.
 * Isolated edges are guaranteed not to touch the boundary of the target (since if they
 * did, they would have caused an intersection to be computed and hence would
 * not be isolated)
 */
private void labelIsolatedEdges(final int thisIndex, final int targetIndex) {
    for (final Iterator ei = this.arg[thisIndex].getEdgeIterator(); ei.hasNext(); ) {
        final Edge e = (Edge) ei.next();
        if (e.isIsolated()) {
            labelIsolatedEdge(e, targetIndex, this.arg[targetIndex].getGeometry());
            this.isolatedEdges.add(e);
        }
    }
}
Also used : Iterator(java.util.Iterator) Edge(com.revolsys.geometry.geomgraph.Edge)

Aggregations

Edge (com.revolsys.geometry.geomgraph.Edge)23 DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)15 Point (com.revolsys.geometry.model.Point)10 Label (com.revolsys.geometry.geomgraph.Label)6 LineString (com.revolsys.geometry.model.LineString)4 Iterator (java.util.Iterator)4 Depth (com.revolsys.geometry.geomgraph.Depth)2 EdgeIntersection (com.revolsys.geometry.geomgraph.EdgeIntersection)2 EdgeIntersectionList (com.revolsys.geometry.geomgraph.EdgeIntersectionList)2 Location (com.revolsys.geometry.model.Location)2 NodedSegmentString (com.revolsys.geometry.noding.NodedSegmentString)2 ArrayList (java.util.ArrayList)2 DirectedEdgeStar (com.revolsys.geometry.geomgraph.DirectedEdgeStar)1 EdgeList (com.revolsys.geometry.geomgraph.EdgeList)1 Node (com.revolsys.geometry.geomgraph.Node)1 PlanarGraph (com.revolsys.geometry.geomgraph.PlanarGraph)1 EdgeSetIntersector (com.revolsys.geometry.geomgraph.index.EdgeSetIntersector)1 SegmentIntersector (com.revolsys.geometry.geomgraph.index.SegmentIntersector)1 SimpleMCSweepLineIntersector (com.revolsys.geometry.geomgraph.index.SimpleMCSweepLineIntersector)1 Geometry (com.revolsys.geometry.model.Geometry)1