Search in sources :

Example 1 with NodingValidator

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

the class GeometryNoder method node.

/**
 * Nodes the linework of a set of Geometrys using SnapRounding.
 *
 * @param geometries a Collection of Geometrys of any type
 * @return a List of LineStrings representing the noded linework of the input
 */
public List<LineString> node(final Collection<? extends Geometry> geometries) {
    // get geometry factory
    final Geometry geom0 = geometries.iterator().next();
    this.geomFact = geom0.getGeometryFactory();
    final Collection<LineString> lines = extractLines(geometries);
    final List<NodedSegmentString> segStrings = toSegmentStrings(lines);
    // Noder sr = new SimpleSnapRounder(pm);
    final Noder sr = new MCIndexSnapRounder(this.scale);
    sr.computeNodes(segStrings);
    final Collection<NodedSegmentString> nodedLines = sr.getNodedSubstrings();
    // TODO: improve this to check for full snap-rounded correctness
    if (this.isValidityChecked) {
        final NodingValidator nv = new NodingValidator(nodedLines);
        nv.checkValid();
    }
    return toLineStrings(nodedLines);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) NodedSegmentString(com.revolsys.geometry.noding.NodedSegmentString) LineString(com.revolsys.geometry.model.LineString) NodingValidator(com.revolsys.geometry.noding.NodingValidator) Noder(com.revolsys.geometry.noding.Noder)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)1 LineString (com.revolsys.geometry.model.LineString)1 NodedSegmentString (com.revolsys.geometry.noding.NodedSegmentString)1 Noder (com.revolsys.geometry.noding.Noder)1 NodingValidator (com.revolsys.geometry.noding.NodingValidator)1