Search in sources :

Example 1 with HalfEdge

use of com.revolsys.geometry.edgegraph.HalfEdge in project com.revolsys.open by revolsys.

the class LineDissolver method process.

private void process(final HalfEdge e) {
    HalfEdge eNode = e.prevNode();
    // if edge is in a ring, just process this edge
    if (eNode == null) {
        eNode = e;
    }
    stackEdges(eNode);
    // extract lines from node edges in stack
    buildLines();
}
Also used : HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge) MarkHalfEdge(com.revolsys.geometry.edgegraph.MarkHalfEdge)

Example 2 with HalfEdge

use of com.revolsys.geometry.edgegraph.HalfEdge in project com.revolsys.open by revolsys.

the class LineDissolver method buildLines.

/**
 * For each edge in stack
 * (which must originate at a node)
 * extracts the line it initiates.
 */
private void buildLines() {
    while (!this.nodeEdgeStack.empty()) {
        final HalfEdge e = (HalfEdge) this.nodeEdgeStack.pop();
        if (MarkHalfEdge.isMarked(e)) {
            continue;
        }
        buildLine(e);
    }
}
Also used : HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge) MarkHalfEdge(com.revolsys.geometry.edgegraph.MarkHalfEdge)

Example 3 with HalfEdge

use of com.revolsys.geometry.edgegraph.HalfEdge in project com.revolsys.open by revolsys.

the class LineDissolver method buildRing.

private void buildRing(final HalfEdge eStartRing) {
    final PointList line = new PointList();
    HalfEdge e = eStartRing;
    line.add(e.orig().newPoint(), false);
    // scan along the path until a node is found (if one exists)
    while (e.sym().degree() == 2) {
        final HalfEdge eNext = e.next();
        // check if edges form a ring - if so, we're done
        if (eNext == eStartRing) {
            break;
        }
        // add point to line, and move to next edge
        line.add(eNext.orig().newPoint(), false);
        e = eNext;
    }
    // add final node
    line.add(e.dest().newPoint(), false);
    // store the scanned line
    addLine(line);
}
Also used : PointList(com.revolsys.geometry.model.PointList) HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge) MarkHalfEdge(com.revolsys.geometry.edgegraph.MarkHalfEdge)

Example 4 with HalfEdge

use of com.revolsys.geometry.edgegraph.HalfEdge in project com.revolsys.open by revolsys.

the class EdgeGraphTest method checkEdgeRing.

private void checkEdgeRing(final EdgeGraph graph, final Point p, final Point[] dest) {
    final HalfEdge e = graph.findEdge(p, dest[0]);
    HalfEdge onext = e;
    int i = 0;
    do {
        assertTrue(onext.dest().equals(2, dest[i++]));
        onext = onext.oNext();
    } while (onext != e);
}
Also used : HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge) Point(com.revolsys.geometry.model.Point)

Example 5 with HalfEdge

use of com.revolsys.geometry.edgegraph.HalfEdge in project com.revolsys.open by revolsys.

the class EdgeGraphTest method checkEdge.

private void checkEdge(final EdgeGraph graph, final Point p0, final Point p1) {
    final HalfEdge e = graph.findEdge(p0, p1);
    assertNotNull(e);
}
Also used : HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge)

Aggregations

HalfEdge (com.revolsys.geometry.edgegraph.HalfEdge)6 MarkHalfEdge (com.revolsys.geometry.edgegraph.MarkHalfEdge)4 Point (com.revolsys.geometry.model.Point)1 PointList (com.revolsys.geometry.model.PointList)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1