Search in sources :

Example 1 with OffsetCurveSetBuilder

use of com.revolsys.geometry.operation.buffer.OffsetCurveSetBuilder 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;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) LineString(com.revolsys.geometry.model.LineString) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) SegmentString(com.revolsys.geometry.noding.SegmentString) OffsetCurveSetBuilder(com.revolsys.geometry.operation.buffer.OffsetCurveSetBuilder)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 LineString (com.revolsys.geometry.model.LineString)1 SegmentString (com.revolsys.geometry.noding.SegmentString)1 OffsetCurveSetBuilder (com.revolsys.geometry.operation.buffer.OffsetCurveSetBuilder)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1