use of com.revolsys.geometry.noding.Noder in project com.revolsys.open by revolsys.
the class NodingFunctions method MCIndexNoding.
public static Geometry MCIndexNoding(final Geometry geom) {
final List segs = newNodedSegmentStrings(geom);
final Noder noder = new MCIndexNoder(new IntersectionAdder(new RobustLineIntersector()));
noder.computeNodes(segs);
final Collection nodedSegStrings = noder.getNodedSubstrings();
return fromSegmentStrings(nodedSegStrings);
}
use of com.revolsys.geometry.noding.Noder in project com.revolsys.open by revolsys.
the class NodingFunctions method scaledNoding.
/**
* Runs a ScaledNoder on input.
* Input vertices should be rounded to precision model.
*
* @param geom
* @param scaleFactor
* @return the noded geometry
*/
public static Geometry scaledNoding(final Geometry geom, final double scaleFactor) {
final List segs = newSegmentStrings(geom);
final Noder noder = new ScaledNoder(new MCIndexSnapRounder(1.0), scaleFactor);
noder.computeNodes(segs);
final Collection nodedSegStrings = noder.getNodedSubstrings();
return fromSegmentStrings(nodedSegStrings);
}
use of com.revolsys.geometry.noding.Noder 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);
}
use of com.revolsys.geometry.noding.Noder in project com.revolsys.open by revolsys.
the class Buffer method bufferFixedPrecision.
private static Geometry bufferFixedPrecision(final GeometryFactory precisionModel, final Geometry geometry, final double distance, final BufferParameters parameters) {
final MCIndexSnapRounder rounder = new MCIndexSnapRounder(1.0);
final double scale = precisionModel.getScaleXY();
final Noder noder = new ScaledNoder(rounder, scale);
return buffer(noder, precisionModel, geometry, distance, parameters);
}
use of com.revolsys.geometry.noding.Noder in project com.revolsys.open by revolsys.
the class NodingFunctions method MCIndexNodingWithPrecision.
public static Geometry MCIndexNodingWithPrecision(final Geometry geom, final double scaleFactor) {
final List segs = newNodedSegmentStrings(geom);
final LineIntersector li = new RobustLineIntersector(scaleFactor);
final Noder noder = new MCIndexNoder(new IntersectionAdder(li));
noder.computeNodes(segs);
final Collection nodedSegStrings = noder.getNodedSubstrings();
return fromSegmentStrings(nodedSegStrings);
}
Aggregations