use of com.revolsys.geometry.noding.SegmentString in project com.revolsys.open by revolsys.
the class BufferFunctions method buildCurveSet.
private static Geometry buildCurveSet(final Geometry geometry, final double dist, final BufferParameters bufParams) {
// --- now construct curve
final GeometryFactory precisionModel = geometry.getGeometryFactory();
final OffsetCurveSetBuilder curveBuilder = new OffsetCurveSetBuilder(geometry, dist, precisionModel, bufParams);
final List curves = curveBuilder.getCurves();
final List<LineString> lines = new ArrayList<>();
for (final Iterator i = curves.iterator(); i.hasNext(); ) {
final SegmentString ss = (SegmentString) i.next();
final LineString points = ss.getLineString();
lines.add(geometry.getGeometryFactory().lineString(points));
}
final Geometry curve = geometry.getGeometryFactory().geometry(lines);
return curve;
}
use of com.revolsys.geometry.noding.SegmentString in project com.revolsys.open by revolsys.
the class NodingFunctions method newSegmentStrings.
private static List<SegmentString> newSegmentStrings(final Geometry geom) {
final List<SegmentString> segs = new ArrayList<>();
final List<LineString> lines = geom.getGeometries(LineString.class);
for (final LineString line : lines) {
segs.add(new BasicSegmentString(line, null));
}
return segs;
}
use of com.revolsys.geometry.noding.SegmentString in project com.revolsys.open by revolsys.
the class NodingFunctions method fromSegmentStrings.
private static Geometry fromSegmentStrings(final Collection segStrings) {
final LineString[] lines = new LineString[segStrings.size()];
int index = 0;
for (final Iterator i = segStrings.iterator(); i.hasNext(); ) {
final SegmentString ss = (SegmentString) i.next();
final LineString line = FunctionsUtil.getFactoryOrDefault(null).lineString(ss.getLineString());
lines[index++] = line;
}
return FunctionsUtil.getFactoryOrDefault(null).lineal(lines);
}
use of com.revolsys.geometry.noding.SegmentString 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);
}
}
}
use of com.revolsys.geometry.noding.SegmentString in project com.revolsys.open by revolsys.
the class MCIndexedPointInAreaLocator method addLine.
private void addLine(final LineString points) {
final SegmentString segStr = new BasicSegmentString(points, null);
final List<MonotoneChain> chains = MonotoneChainBuilder.getChains(segStr.getLineString(), segStr);
for (final MonotoneChain chain : chains) {
this.index.insertItem(chain);
}
}
Aggregations