本文整理汇总了Java中com.vividsolutions.jts.operation.buffer.BufferParameters.setQuadrantSegments方法的典型用法代码示例。如果您正苦于以下问题:Java BufferParameters.setQuadrantSegments方法的具体用法?Java BufferParameters.setQuadrantSegments怎么用?Java BufferParameters.setQuadrantSegments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.operation.buffer.BufferParameters
的用法示例。
在下文中一共展示了BufferParameters.setQuadrantSegments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CurveBuilder
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
public CurveBuilder() {
BufferParameters bufferParameters = new BufferParameters();
bufferParameters.setEndCapStyle(BufferParameters.CAP_FLAT);
bufferParameters.setJoinStyle(BufferParameters.JOIN_ROUND);
/*
* Sets the number of line segments used to approximate an angle fillet.
*
* If quadSegs >= 1, joins are round, and quadSegs indicates the number of segments to use to approximate a quarter-circle.
* If quadSegs = 0, joins are bevelled (flat)
* If quadSegs < 0, joins are mitred, and the value of qs indicates the mitre ration limit as
* mitreLimit = |quadSegs|
*
* For round joins, quadSegs determines the maximum error in the approximation to the true buffer curve.
* The default value of 8 gives less than 2% max error in the buffer distance. For a max error of < 1%,
* use QS = 12. For a max error of < 0.1%, use QS = 18. The error is always less than the buffer distance
* (in other words, the computed buffer curve is always inside the true curve).
*/
bufferParameters.setQuadrantSegments(18);
this.curveBuilder = new OffsetCurveBuilder(new PrecisionModel(), bufferParameters);
}
示例2: bufferWithParams
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
/**
* Returns a buffered geometry with old shapes in the center of new ones. If
* the buffer is issued at single side then a negative offset renders the
* shape on the left while a positive offset on the right
*/
public static Geometry bufferWithParams(Geometry geometry, Double offset, Boolean singleSided, Integer quadrantSegments, Integer capStyle, Integer joinStyle, Double mitreLimit) {
double d = 0.0D;
if (offset != null) {
d = offset.doubleValue();
}
Boolean ss = false;
if (singleSided != null) {
ss = singleSided;
}
BufferParameters bufferparameters = new BufferParameters();
//Custom code to be able to draw only on the side of the offset curve
bufferparameters.setSingleSided(ss);
if (quadrantSegments != null) {
bufferparameters.setQuadrantSegments(quadrantSegments.intValue());
}
if (capStyle != null) {
bufferparameters.setEndCapStyle(capStyle.intValue());
}
if (joinStyle != null) {
bufferparameters.setJoinStyle(joinStyle.intValue());
}
if (mitreLimit != null) {
bufferparameters.setMitreLimit(mitreLimit.doubleValue());
}
return BufferOp.bufferOp(geometry, d, bufferparameters);
}
示例3: bindQuad
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
private void bindQuad(BufferParameters parameters, Map<String, Object> params) {
Number quadSegs = (Number) params.get("quadSegs");
if (quadSegs != null) {
parameters.setQuadrantSegments(quadSegs.intValue());
}
}
示例4: addCleanOffsetCurves
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
private void addCleanOffsetCurves(Collection offsetCurves, Geometry sourceCurve, BufferParameters parameters, Double offsetDistance, Integer qS) {
parameters.setSingleSided(true);
parameters.setQuadrantSegments(qS);
Geometry sidedBuffer = new BufferOp(sourceCurve, parameters)
.getResultGeometry(offsetDistance)
.getBoundary();
Collection offsetSegments = new ArrayList();
// Segments located entirely under this distance are excluded
double lowerBound = Math.abs(offsetDistance) * Math.sin(Math.PI / (4 * qS));
// Segments located entirely over this distance are included
// note that the theoretical approximation made with quadrantSegments
// is offset*cos(PI/(4*quadrantSegments) but offset*cos(PI/(2*quadrantSegments)
// is used to make sure to include segments located on the boundary
double upperBound = Math.abs(offsetDistance) * Math.cos(Math.PI / (2 * qS));
for (int i = 0; i < sidedBuffer.getNumGeometries(); i++) {
Coordinate[] cc = sidedBuffer.getGeometryN(i).getCoordinates();
PointPairDistance ppd = new PointPairDistance();
DistanceToPoint.computeDistance(sourceCurve, cc[0], ppd);
double dj = ppd.getDistance();
for (int j = 1; j < cc.length; j++) {
double di = dj;
ppd = new PointPairDistance();
DistanceToPoint.computeDistance(sourceCurve, cc[j], ppd);
dj = ppd.getDistance();
// segment along or touching the source geometry : eclude it
if (Math.max(di, dj) < lowerBound || di == 0 || dj == 0) {
continue;
} // segment along the buffer boundary : include it
else if (Math.min(di, dj) > upperBound) {
LineString segment = sourceCurve.getFactory().createLineString(
new Coordinate[]{cc[j - 1], cc[j]});
offsetSegments.add(segment);
} // segment entirely located inside the buffer : exclude it
else if (Math.min(di, dj) > lowerBound && Math.max(di, dj) < upperBound) {
continue;
} // segment with a end at the offset distance and the other
// located within the buffer : divide it
else {
// One of the coordinates is closed to but not on the source
// curve and the other is more or less closed to offset distance
divide(offsetSegments, sourceCurve, cc[j - 1], cc[j], di, dj, lowerBound, upperBound);
}
}
}
offsetCurves.addAll(merge(offsetSegments));
}