Search in sources :

Example 1 with Label

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

the class LineBuilder method collectLineEdge.

/**
 * Collect line edges which are in the result.
 * Line edges are in the result if they are not part of
 * an area boundary, if they are in the result of the overlay operation,
 * and if they are not covered by a result area.
 *
 * @param de the directed edge to test
 * @param opCode the overlap operation
 * @param edges the list of included line edges
 */
private void collectLineEdge(final DirectedEdge de, final int opCode, final List<Edge> edges) {
    final Label label = de.getLabel();
    final Edge e = de.getEdge();
    // include L edges which are in the result
    if (de.isLineEdge()) {
        if (!de.isVisited() && OverlayOp.isResultOfOp(label, opCode) && !e.isCovered()) {
            // Debug.println("de: " + de.getLabel());
            // Debug.println("edge: " + e.getLabel());
            edges.add(e);
            de.setVisitedEdge(true);
        }
    }
}
Also used : Label(com.revolsys.geometry.geomgraph.Label) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Edge(com.revolsys.geometry.geomgraph.Edge)

Example 2 with Label

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

the class OverlayOp method updateNodeLabelling.

private void updateNodeLabelling() {
    // because it is a point in one of the input geometries)
    for (final Node node : this.graph.getNodes()) {
        final Label label = ((DirectedEdgeStar) node.getEdges()).getLabel();
        node.getLabel().merge(label);
    }
}
Also used : DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node) Label(com.revolsys.geometry.geomgraph.Label)

Example 3 with Label

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

the class OverlayOp method labelIncompleteNode.

/**
 * Label an isolated node with its relationship to the target geometry.
 */
private void labelIncompleteNode(final Node node, final int targetIndex) {
    final Geometry geometry = this.arg[targetIndex].getGeometry();
    final double x = node.getX();
    final double y = node.getY();
    final Location location = this.ptLocator.locate(geometry, x, y);
    final Label label = node.getLabel();
    label.setLocation(targetIndex, location);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Label(com.revolsys.geometry.geomgraph.Label) Location(com.revolsys.geometry.model.Location)

Example 4 with Label

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

the class OverlayOp method labelIncompleteNodes.

/**
 * Incomplete nodes are nodes whose labels are incomplete.
 * (e.g. the location for one Geometry is null).
 * These are either isolated nodes,
 * or nodes which have edges from only a single Geometry incident on them.
 *
 * Isolated nodes are found because nodes in one graph which don't intersect
 * nodes in the other are not completely labelled by the initial process
 * of adding nodes to the nodeList.
 * To complete the labelling we need to check for nodes that lie in the
 * interior of edges, and in the interior of areas.
 * <p>
 * When each node labelling is completed, the labelling of the incident
 * edges is updated, to complete their labelling as well.
 */
private void labelIncompleteNodes() {
    for (final Node n : this.graph.getNodes()) {
        final Label label = n.getLabel();
        if (n.isIsolated()) {
            if (label.isNull(0)) {
                labelIncompleteNode(n, 0);
            } else {
                labelIncompleteNode(n, 1);
            }
        }
        // now update the labelling for the DirectedEdges incident on this node
        ((DirectedEdgeStar) n.getEdges()).updateLabelling(label);
    }
}
Also used : DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node) Label(com.revolsys.geometry.geomgraph.Label)

Example 5 with Label

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

the class OffsetCurveSetBuilder method addCurve.

/**
 * Creates a {@link SegmentString} for a coordinate list which is a raw offset curve,
 * and adds it to the list of buffer curves.
 * The SegmentString is tagged with a Label giving the topology of the curve.
 * The curve may be oriented in either direction.
 * If the curve is oriented CW, the locations will be:
 * <br>Left: Location.EXTERIOR
 * <br>Right: Location.INTERIOR
 */
private void addCurve(final LineString points, final Location leftLoc, final Location rightLoc) {
    if (points != null && points.getVertexCount() >= 2) {
        final Label label = new Label(0, Location.BOUNDARY, leftLoc, rightLoc);
        final NodedSegmentString segment = new NodedSegmentString(points, label);
        this.curveList.add(segment);
    }
}
Also used : NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) Label(com.revolsys.geometry.geomgraph.Label)

Aggregations

Label (com.revolsys.geometry.geomgraph.Label)14 DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)6 Edge (com.revolsys.geometry.geomgraph.Edge)6 Point (com.revolsys.geometry.model.Point)6 Node (com.revolsys.geometry.geomgraph.Node)3 Depth (com.revolsys.geometry.geomgraph.Depth)2 DirectedEdgeStar (com.revolsys.geometry.geomgraph.DirectedEdgeStar)2 EdgeEnd (com.revolsys.geometry.geomgraph.EdgeEnd)2 NodedSegmentString (com.revolsys.geometry.noding.NodedSegmentString)2 Geometry (com.revolsys.geometry.model.Geometry)1 LineString (com.revolsys.geometry.model.LineString)1 Location (com.revolsys.geometry.model.Location)1 SegmentString (com.revolsys.geometry.noding.SegmentString)1