use of com.revolsys.geometry.noding.IntersectionAdder in project com.revolsys.open by revolsys.
the class Buffer method buffer.
/**
* Comutes the buffer for a geometry for a given buffer distance
* and accuracy of approximation.
*
* @param g the geometry to buffer
* @param distance the buffer distance
* @param parameters the buffer parameters to use
* @return the buffer of the input geometry
*/
@SuppressWarnings("unchecked")
public static <G extends Geometry> G buffer(final Geometry geometry, final double distance, final BufferParameters parameters) {
final GeometryFactory geometryFactory = geometry.getGeometryFactory();
try {
final MCIndexNoder noder = new MCIndexNoder();
final LineIntersector li = new RobustLineIntersector(geometryFactory.getScaleXY());
noder.setSegmentIntersector(new IntersectionAdder(li));
return (G) buffer(noder, geometryFactory, geometry, distance, parameters);
} catch (final RuntimeException e) {
if (geometryFactory.isFloating()) {
return (G) bufferReducedPrecision(geometry, distance, parameters);
} else {
return (G) bufferFixedPrecision(geometryFactory, geometry, distance, parameters);
}
}
}
use of com.revolsys.geometry.noding.IntersectionAdder 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.IntersectionAdder 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