Java 类com.vividsolutions.jts.geomgraph.EdgeEnd 实例源码

项目:Earth    文件:EdgeEndBuilder.java   
/**
     * Create a StubEdge for the edge after the intersection eiCurr.
     * The next intersection is provided
     * in case it is the endpoint for the stub edge.
     * Otherwise, the next point from the parent edge will be the endpoint.
     * <br>
     * eiCurr will always be an EdgeIntersection, but eiNext may be null.
     */
    void createEdgeEndForNext(
            Edge edge,
            List l,
            EdgeIntersection eiCurr,
            EdgeIntersection eiNext) {

        int iNext = eiCurr.segmentIndex + 1;
        // if there is no next edge there is nothing to do
        if (iNext >= edge.getNumPoints() && eiNext == null) {
            return;
        }

        Coordinate pNext = edge.getCoordinate(iNext);

        // if the next intersection is in the same segment as the current, use it as the endpoint
        if (eiNext != null && eiNext.segmentIndex == eiCurr.segmentIndex) {
            pNext = eiNext.coord;
        }

        EdgeEnd e = new EdgeEnd(edge, eiCurr.coord, pNext, new Label(edge.getLabel()));
//Debug.println(e);
        l.add(e);
    }
项目:Earth    文件:EdgeEndBundle.java   
/**
 * This computes the overall edge label for the set of
 * edges in this EdgeStubBundle.  It essentially merges
 * the ON and side labels for each edge.  These labels must be compatible
 */
@Override
public void computeLabel(BoundaryNodeRule boundaryNodeRule) {
    // create the label.  If any of the edges belong to areas,
    // the label must be an area label
    boolean isArea = false;
    for (Iterator it = this.iterator(); it.hasNext(); ) {
        EdgeEnd e = (EdgeEnd) it.next();
        if (e.getLabel().isArea()) {
            isArea = true;
        }
    }
    if (isArea) {
        this.label = new Label(Location.NONE, Location.NONE, Location.NONE);
    } else {
        this.label = new Label(Location.NONE);
    }

    // compute the On label, and the side labels if present
    for (int i = 0; i < 2; i++) {
        this.computeLabelOn(i, boundaryNodeRule);
        if (isArea) {
            this.computeLabelSides(i);
        }
    }
}
项目:Earth    文件:EdgeEndBundleStar.java   
/**
 * Insert a EdgeEnd in order in the list.
 * If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is
 * added to the bundle.  Otherwise, a new EdgeEndBundle is created
 * to contain the EdgeEnd.
 * <br>
 */
@Override
public void insert(EdgeEnd e) {
    EdgeEndBundle eb = (EdgeEndBundle) this.edgeMap.get(e);
    if (eb == null) {
        eb = new EdgeEndBundle(e);
        this.insertEdgeEnd(e, eb);
    } else {
        eb.insert(e);
    }
}
项目:Earth    文件:EdgeEndBuilder.java   
/**
     * Create a EdgeStub for the edge before the intersection eiCurr.
     * The previous intersection is provided
     * in case it is the endpoint for the stub edge.
     * Otherwise, the previous point from the parent edge will be the endpoint.
     * <br>
     * eiCurr will always be an EdgeIntersection, but eiPrev may be null.
     */
    void createEdgeEndForPrev(
            Edge edge,
            List l,
            EdgeIntersection eiCurr,
            EdgeIntersection eiPrev) {

        int iPrev = eiCurr.segmentIndex;
        if (eiCurr.dist == 0.0) {
            // if at the start of the edge there is no previous edge
            if (iPrev == 0) {
                return;
            }
            iPrev--;
        }
        Coordinate pPrev = edge.getCoordinate(iPrev);
        // if prev intersection is past the previous vertex, use it instead
        if (eiPrev != null && eiPrev.segmentIndex >= iPrev) {
            pPrev = eiPrev.coord;
        }

        Label label = new Label(edge.getLabel());
        // since edgeStub is oriented opposite to it's parent edge, have to flip sides for edge label
        label.flip();
        EdgeEnd e = new EdgeEnd(edge, eiCurr.coord, pPrev, label);
//e.print(System.out);  System.out.println();
        l.add(e);
    }
项目:Earth    文件:EdgeEndBundle.java   
public EdgeEndBundle(BoundaryNodeRule boundaryNodeRule, EdgeEnd e) {
    super(e.getEdge(), e.getCoordinate(), e.getDirectedCoordinate(), new Label(e.getLabel()));
    this.insert(e);
/*
if (boundaryNodeRule != null)
  this.boundaryNodeRule = boundaryNodeRule;
else
  boundaryNodeRule = BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE;
*/
}
项目:Earth    文件:EdgeEndBundle.java   
/**
 * To compute the summary label for a side, the algorithm is:
 * FOR all edges
 * IF any edge's location is INTERIOR for the side, side location = INTERIOR
 * ELSE IF there is at least one EXTERIOR attribute, side location = EXTERIOR
 * ELSE  side location = NULL
 * <br>
 * Note that it is possible for two sides to have apparently contradictory information
 * i.e. one edge side may indicate that it is in the interior of a geometry, while
 * another edge side may indicate the exterior of the same geometry.  This is
 * not an incompatibility - GeometryCollections may contain two Polygons that touch
 * along an edge.  This is the reason for Interior-primacy rule above - it
 * results in the summary label having the Geometry interior on <b>both</b> sides.
 */
private void computeLabelSide(int geomIndex, int side) {
    for (Iterator it = this.iterator(); it.hasNext(); ) {
        EdgeEnd e = (EdgeEnd) it.next();
        if (e.getLabel().isArea()) {
            int loc = e.getLabel().getLocation(geomIndex, side);
            if (loc == Location.INTERIOR) {
                this.label.setLocation(geomIndex, side, Location.INTERIOR);
                return;
            } else if (loc == Location.EXTERIOR) {
                this.label.setLocation(geomIndex, side, Location.EXTERIOR);
            }
        }
    }
}
项目:Earth    文件:EdgeEndBundle.java   
@Override
public void print(PrintStream out) {
    out.println("EdgeEndBundle--> Label: " + this.label);
    for (Iterator it = this.iterator(); it.hasNext(); ) {
        EdgeEnd ee = (EdgeEnd) it.next();
        ee.print(out);
        out.println();
    }
}
项目:jts    文件:EdgeEndBundleStar.java   
/**
 * Insert a EdgeEnd in order in the list.
 * If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is
 * added to the bundle.  Otherwise, a new EdgeEndBundle is created
 * to contain the EdgeEnd.
 * <br>
 */
public void insert(EdgeEnd e) {
    EdgeEndBundle eb = (EdgeEndBundle) edgeMap.get(e);
    if (eb == null) {
        eb = new EdgeEndBundle(e);
        insertEdgeEnd(e, eb);
    } else {
        eb.insert(e);
    }
}
项目:Earth    文件:RelateComputer.java   
private void insertEdgeEnds(List ee) {
    for (Object anEe : ee) {
        EdgeEnd e = (EdgeEnd) anEe;
        this.nodes.add(e);
    }
}
项目:Earth    文件:RelateNodeGraph.java   
public void insertEdgeEnds(List ee) {
    for (Object anEe : ee) {
        EdgeEnd e = (EdgeEnd) anEe;
        this.nodes.add(e);
    }
}
项目:Earth    文件:EdgeEndBundle.java   
public EdgeEndBundle(EdgeEnd e) {
    this(null, e);
}
项目:Earth    文件:EdgeEndBundle.java   
public void insert(EdgeEnd e) {
    // Assert: start point is the same
    // Assert: direction is the same
    this.edgeEnds.add(e);
}