/** * Creates a set of parameters with the * given parameter values. * * @param quadrantSegments the number of quadrant segments to use * @param endCapStyle the end cap style to use * @param joinStyle the join style to use * @param mitreLimit the mitre limit to use */ public BufferParameters(int quadrantSegments, int endCapStyle, int joinStyle, double mitreLimit) { setQuadrantSegments(quadrantSegments); setEndCapStyle(endCapStyle); setJoinStyle(joinStyle); setMitreLimit(mitreLimit); }
RenderingHints.VALUE_TEXT_ANTIALIAS_ON); BufferParameters bufParams = new BufferParameters(); bufParams.setSingleSided(true); bufParams.setJoinStyle(BufferParameters.JOIN_BEVEL);
private void computePointCurve(Coordinate pt, OffsetSegmentGenerator segGen) { switch (bufParams.getEndCapStyle()) { case BufferParameters.CAP_ROUND: segGen.createCircle(pt); break; case BufferParameters.CAP_SQUARE: segGen.createSquare(pt); break; // otherwise curve is empty (e.g. for a butt cap); } }
/** * Creates a set of parameters with the * given quadrantSegments and endCapStyle values. * * @param quadrantSegments the number of quadrant segments to use * @param endCapStyle the end cap style to use */ public BufferParameters(int quadrantSegments, int endCapStyle) { setQuadrantSegments(quadrantSegments); setEndCapStyle(endCapStyle); }
/** * Sets the number of segments used to approximate a angle fillet * * @param quadrantSegments the number of segments in a fillet for a quadrant */ public void setQuadrantSegments(int quadrantSegments) { bufParams.setQuadrantSegments(quadrantSegments); }
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 BufferExpressionFeatureIterator(SimpleFeatureIterator delegate, SimpleFeatureType schema, Expression distance, DistanceUnit distanceUnit, int quadrantSegments) { this.delegate = delegate; this.bufParams.setQuadrantSegments(quadrantSegments); this.bufParams.setSingleSided(true); this.distance = distance; this.distanceUnit = distanceUnit; this.targetUnit = UnitConverter.getLengthUnit(schema.getCoordinateReferenceSystem()); this.builder = new SimpleFeatureBuilder(schema); this.typeName = schema.getTypeName(); }
/** * Return an offset line at a given distance and side from an input geometry * without buffer parameters * @param geometry the geometry * @param offset the distance * @return */ public static Geometry offsetCurve(Geometry geometry, double offset) { return computeOffsetCurve(geometry, offset, new BufferParameters()); }
/** * Specifies the end cap style of the generated buffer. * The styles supported are {@link #CAP_ROUND}, {@link #CAP_BUTT}, and {@link #CAP_SQUARE}. * The default is CAP_ROUND. * * @param endCapStyle the end cap style to specify */ public void setEndCapStyle(int endCapStyle) { bufParams.setEndCapStyle(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); } }
public OffsetSegmentGenerator(PrecisionModel precisionModel, BufferParameters bufParams, double distance) { this.precisionModel = precisionModel; this.bufParams = bufParams; // compute intersections in full precision, to provide accuracy // the points are rounded as they are inserted into the curve line li = new RobustLineIntersector(); filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments(); /** * Non-round joins cause issues with short closing segments, so don't use * them. In any case, non-round joins only really make sense for relatively * small buffer distances. */ if (bufParams.getQuadrantSegments() >= 8 && bufParams.getJoinStyle() == BufferParameters.JOIN_ROUND) closingSegLengthFactor = MAX_CLOSING_SEG_LEN_FACTOR; init(distance); }
if (bufParams.getJoinStyle() == BufferParameters.JOIN_BEVEL || bufParams.getJoinStyle() == BufferParameters.JOIN_MITRE) { if (addStartPoint) segList.addPt(offset0.p1); segList.addPt(offset1.p0);
: intPt.distance(p) / Math.abs(distance); if (mitreRatio > bufParams.getMitreLimit()) isMitreWithinLimit = false; addLimitedMitreJoin(offset0, offset1, distance, bufParams.getMitreLimit());
/** * Creates a set of parameters with the * given quadrantSegments and endCapStyle values. * * @param quadrantSegments the number of quadrant segments to use * @param endCapStyle the end cap style to use */ public BufferParameters(int quadrantSegments, int endCapStyle) { setQuadrantSegments(quadrantSegments); setEndCapStyle(endCapStyle); }
/** * Creates a set of parameters with the * given quadrantSegments value. * * @param quadrantSegments the number of quadrant segments to use */ public BufferParameters(int quadrantSegments) { setQuadrantSegments(quadrantSegments); }
/** * Compute a single side buffer with default parameters * @param geometry * @param distance * @return */ public static Geometry singleSideBuffer(Geometry geometry, double distance){ if(geometry==null){ return null; } return computeSingleSideBuffer(geometry, distance, new BufferParameters()); }
/** * Specifies the end cap style of the generated buffer. * The styles supported are {@link BufferParameters#CAP_ROUND}, {@link BufferParameters##CAP_BUTT}, and {@link BufferParameters##CAP_SQUARE}. * The default is CAP_ROUND. * * @param endCapStyle the end cap style to specify */ public void setEndCapStyle(int endCapStyle) { bufParams.setEndCapStyle(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); } }
public OffsetSegmentGenerator(PrecisionModel precisionModel, BufferParameters bufParams, double distance) { this.precisionModel = precisionModel; this.bufParams = bufParams; // compute intersections in full precision, to provide accuracy // the points are rounded as they are inserted into the curve line li = new RobustLineIntersector(); filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments(); /** * Non-round joins cause issues with short closing segments, so don't use * them. In any case, non-round joins only really make sense for relatively * small buffer distances. */ if (bufParams.getQuadrantSegments() >= 8 && bufParams.getJoinStyle() == BufferParameters.JOIN_ROUND) closingSegLengthFactor = MAX_CLOSING_SEG_LEN_FACTOR; init(distance); }
if (bufParams.getJoinStyle() == BufferParameters.JOIN_MITRE) { addMitreJoin(s1, offset0, offset1, distance); else if (bufParams.getJoinStyle() == BufferParameters.JOIN_BEVEL){ addBevelJoin(offset0, offset1);