use of com.revolsys.geometry.noding.MCIndexNoder 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.MCIndexNoder 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.MCIndexNoder in project com.revolsys.open by revolsys.
the class SimpleSnapRounder method findInteriorIntersections.
/**
* Computes all interior intersections in the collection of {@link SegmentString}s,
* and returns their {@link Coordinates}s.
*
* Does NOT node the segStrings.
*
* @return a list of Point for the intersections
*/
private List findInteriorIntersections(final Collection segStrings, final LineIntersector li) {
final InteriorIntersectionFinderAdder intFinderAdder = new InteriorIntersectionFinderAdder(li);
final SinglePassNoder noder = new MCIndexNoder();
noder.setSegmentIntersector(intFinderAdder);
noder.computeNodes(segStrings);
return intFinderAdder.getInteriorIntersections();
}
use of com.revolsys.geometry.noding.MCIndexNoder in project com.revolsys.open by revolsys.
the class MCIndexSnapRounder method computeNodes.
@Override
public void computeNodes(final Collection<NodedSegmentString> inputSegmentStrings) {
this.nodedSegStrings = inputSegmentStrings;
this.noder = new MCIndexNoder();
this.pointSnapper = new MCIndexPointSnapper(this.noder.getIndex());
snapRound(inputSegmentStrings, this.li);
// testing purposes only - remove in final version
// checkCorrectness(inputSegmentStrings);
}
use of com.revolsys.geometry.noding.MCIndexNoder 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