/** * Computes a buffer area around this geometry having the given width. The * buffer of a Geometry is the Minkowski sum or difference of the geometry * with a disc of radius <code>abs(distance)</code>. * <p> * Mathematically-exact buffer area boundaries can contain circular arcs. * To represent these arcs using linear geometry they must be approximated with line segments. * The buffer geometry is constructed using 8 segments per quadrant to approximate * the circular arcs. * The end cap style is <code>CAP_ROUND</code>. * <p> * The buffer operation always returns a polygonal result. The negative or * zero-distance buffer of lines and points is always an empty {@link Polygon}. * This is also the result for the buffers of degenerate (zero-area) polygons. * * @param distance * the width of the buffer (may be positive, negative or 0) * @return a polygonal geometry representing the buffer region (which may be * empty) * * @throws TopologyException * if a robustness error occurs * * @see #buffer(double, int) * @see #buffer(double, int, int) */ public Geometry buffer(double distance) { return BufferOp.bufferOp(this, distance); }
return BufferOp.bufferOp(this, distance, quadrantSegments);
return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle);
/** * Calculate the ring buffer * * @param geom * @param bufferSize * @param bufferParameters * @return * @throws SQLException */ public static Geometry runBuffer(final Geometry geom, final double bufferSize, final BufferParameters bufferParameters) throws SQLException { return BufferOp.bufferOp(geom, bufferSize, bufferParameters); } }
/** * Calculate the ring buffer * * @param geom * @param bufferSize * @param bufferParameters * @return * @throws SQLException */ public static Geometry runBuffer(final Geometry geom, final double bufferSize, final BufferParameters bufferParameters) throws SQLException { return BufferOp.bufferOp(geom, bufferSize, bufferParameters); } }
/** * Computes a buffer area around this geometry having the given width. The * buffer of a Geometry is the Minkowski sum or difference of the geometry * with a disc of radius <code>abs(distance)</code>. * <p> * Mathematically-exact buffer area boundaries can contain circular arcs. * To represent these arcs using linear geometry they must be approximated with line segments. * The buffer geometry is constructed using 8 segments per quadrant to approximate * the circular arcs. * The end cap style is <code>CAP_ROUND</code>. * <p> * The buffer operation always returns a polygonal result. The negative or * zero-distance buffer of lines and points is always an empty {@link Polygon}. * This is also the result for the buffers of degenerate (zero-area) polygons. * * @param distance * the width of the buffer (may be positive, negative or 0) * @return a polygonal geometry representing the buffer region (which may be * empty) * * @throws TopologyException * if a robustness error occurs * * @see #buffer(double, int) * @see #buffer(double, int, int) */ public Geometry buffer(double distance) { return BufferOp.bufferOp(this, distance); }
return BufferOp.bufferOp(this, distance, quadrantSegments);
return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle);
/** * Compute the buffer * @param geometry * @param distance * @param bufferParameters * @return */ private static Geometry computeSingleSideBuffer(Geometry geometry, double distance, BufferParameters bufferParameters){ bufferParameters.setSingleSided(true); return BufferOp.bufferOp(geometry, distance, bufferParameters); } }
/** * Compute the buffer * @param geometry * @param distance * @param bufferParameters * @return */ private static Geometry computeSingleSideBuffer(Geometry geometry, double distance, BufferParameters bufferParameters){ bufferParameters.setSingleSided(true); return BufferOp.bufferOp(geometry, distance, bufferParameters); } }
final Geometry createBuffer(List<Geometry> lineStrings, double bufferSize, boolean excludeTermini) { BufferParameters bufferParameters = new BufferParameters(); if (excludeTermini) { bufferParameters.setEndCapStyle(BufferParameters.CAP_FLAT); } else { bufferParameters.setEndCapStyle(BufferParameters.CAP_ROUND); } Geometry union = null; for (Geometry lineString : lineStrings) { Geometry buffer = BufferOp.bufferOp(lineString, bufferSize, bufferParameters); if (union == null) { union = buffer; } else { union = union.union(buffer); } } return union; }
public boolean hasNext() { while (next == null && delegate.hasNext()) { SimpleFeature source = delegate.next(); Double eval = distance.evaluate(source, Double.class); if (eval != null) { next = builder.buildFeature(buildID(typeName, ++count)); // transfer attributes transferAttribute(source, next); // envelope to polygon geometry Geometry geometry = (Geometry) source.getDefaultGeometry(); double converted = UnitConverter .convertDistance(eval, distanceUnit, targetUnit); next.setDefaultGeometry(BufferOp.bufferOp(geometry, converted, bufParams)); next.setAttribute(BUFFER_FIELD, eval); builder.reset(); } } return next != null; }