Search in sources :

Example 6 with NodedSegmentString

use of com.revolsys.geometry.noding.NodedSegmentString in project com.revolsys.open by revolsys.

the class SimpleSnapRounder method computeSnaps.

/**
 * Computes nodes introduced as a result of snapping segments to snap points (hot pixels)
 * @param li
 */
private void computeSnaps(final Collection segStrings, final Collection snapPts) {
    for (final Iterator i0 = segStrings.iterator(); i0.hasNext(); ) {
        final NodedSegmentString ss = (NodedSegmentString) i0.next();
        computeSnaps(ss, snapPts);
    }
}
Also used : NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) Iterator(java.util.Iterator)

Example 7 with NodedSegmentString

use of com.revolsys.geometry.noding.NodedSegmentString in project com.revolsys.open by revolsys.

the class Buffer method computeNodedEdges.

private static void computeNodedEdges(final Noder noder, final EdgeList edges, final List<NodedSegmentString> segments) {
    noder.computeNodes(segments);
    final Collection<NodedSegmentString> nodedSegments = noder.getNodedSubstrings();
    for (final SegmentString segment : nodedSegments) {
        final int vertexCount = segment.size();
        if (vertexCount > 2 || vertexCount == 2 && !segment.equalsVertex2d(0, 1)) {
            final Label oldLabel = (Label) segment.getData();
            final Label label = new Label(oldLabel);
            final LineString points = segment.getLineString();
            final Edge edge = new Edge(points, label);
            insertUniqueEdge(edges, edge);
        }
    }
}
Also used : NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) LineString(com.revolsys.geometry.model.LineString) Label(com.revolsys.geometry.geomgraph.Label) SegmentString(com.revolsys.geometry.noding.SegmentString) NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) Edge(com.revolsys.geometry.geomgraph.Edge) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Point(com.revolsys.geometry.model.Point)

Example 8 with NodedSegmentString

use of com.revolsys.geometry.noding.NodedSegmentString in project com.revolsys.open by revolsys.

the class NodingFunctions method newNodedSegmentStrings.

private static List<NodedSegmentString> newNodedSegmentStrings(final Geometry geom) {
    final List<NodedSegmentString> segs = new ArrayList<>();
    final List<LineString> lines = geom.getGeometries(LineString.class);
    for (final LineString line : lines) {
        segs.add(new NodedSegmentString(line, null));
    }
    return segs;
}
Also used : NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) LineString(com.revolsys.geometry.model.LineString) ArrayList(java.util.ArrayList)

Aggregations

NodedSegmentString (com.revolsys.geometry.noding.NodedSegmentString)8 LineString (com.revolsys.geometry.model.LineString)3 DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)2 Edge (com.revolsys.geometry.geomgraph.Edge)2 Label (com.revolsys.geometry.geomgraph.Label)2 Geometry (com.revolsys.geometry.model.Geometry)2 Iterator (java.util.Iterator)2 PointOnGeometryLocator (com.revolsys.geometry.algorithm.locate.PointOnGeometryLocator)1 EdgeList (com.revolsys.geometry.geomgraph.EdgeList)1 PlanarGraph (com.revolsys.geometry.geomgraph.PlanarGraph)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Point (com.revolsys.geometry.model.Point)1 Polygon (com.revolsys.geometry.model.Polygon)1 Noder (com.revolsys.geometry.noding.Noder)1 NodingValidator (com.revolsys.geometry.noding.NodingValidator)1 SegmentString (com.revolsys.geometry.noding.SegmentString)1 OverlayNodeFactory (com.revolsys.geometry.operation.overlay.OverlayNodeFactory)1 PolygonBuilder (com.revolsys.geometry.operation.overlay.PolygonBuilder)1 ArrayList (java.util.ArrayList)1