本文整理汇总了Java中com.vividsolutions.jts.operation.buffer.BufferParameters.setEndCapStyle方法的典型用法代码示例。如果您正苦于以下问题:Java BufferParameters.setEndCapStyle方法的具体用法?Java BufferParameters.setEndCapStyle怎么用?Java BufferParameters.setEndCapStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.operation.buffer.BufferParameters
的用法示例。
在下文中一共展示了BufferParameters.setEndCapStyle方法的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: bindCap
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
private void bindCap(BufferParameters parameters, Map<String, Object> params) {
String endCap = (String) params.get("endCap");
if (endCap != null) {
Integer style = capStyles.get(endCap);
if (style != null) {
parameters.setEndCapStyle(style);
}
}
}
示例4: executeAnalysis
import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入方法依赖的package包/类
public Geometry executeAnalysis(int analysis, Object[] outputRow) throws KettleException{
Geometry result = null;
Object o = data.one[data.referenceIndex];
if(o != null && (!meta.isAlgoDual() || data.two!=null)){
Geometry geom = (Geometry) o;
switch (analysis){
case 0:
result = geom.union(checkGeometry(data.two[data.compareIndex]));
break;
case 1:
result = geom.intersection(checkGeometry(data.two[data.compareIndex]));
break;
case 2:
try{
double dist = Double.parseDouble(meta.getDistField());
BufferParameters bufParams = new BufferParameters();
if(meta.getSide().equals(Messages.getString("SpatialAnalysisMeta.Side.Right")))
bufParams.setSingleSided(true);
if(meta.getSide().equals(Messages.getString("SpatialAnalysisMeta.Side.Left"))){
bufParams.setSingleSided(true);
dist *= -1;
}
bufParams.setEndCapStyle(meta.getCapAsInt());
bufParams.setJoinStyle(meta.getJoinAsInt());
bufParams.setMitreLimit(BufferParameters.DEFAULT_MITRE_LIMIT);
result = BufferOp.bufferOp(geom, dist, bufParams);
}catch(Exception e){
throw new KettleException(Messages.getString("SpatialAnalysis.Exception.WrongParameterType1") + Messages.getString("SpatialAnalysisDialog.DistField.Label") + Messages.getString("SpatialAnalysis.Exception.WrongParameterType2"));
}
break;
case 3:
result = geom.symDifference(checkGeometry(data.two[data.compareIndex]));
break;
case 4:
result = geom.getInteriorPoint();
break;
case 5:
result = geom.getEnvelope();
break;
case 6:
result = geom.getCentroid();
break;
case 7:
result = geom.getBoundary();
break;
case 8:
result = geom.difference(checkGeometry(data.two[data.compareIndex]));
break;
case 9:
result = geom.convexHull();
break;
case 10:
result = geom.reverse();
break;
case 11:
int length = geom.getNumGeometries();
if(length > 1){
for(int i = 0 ; i < geom.getNumGeometries() - 1; i++){
putRow(data.outputRowMeta, RowDataUtil.addValueData(outputRow, data.outputIndex, geom.getGeometryN(i)));
}
}
result = geom.getGeometryN(length - 1);
break;
default:
break;
}
}
return result.isEmpty() ? null : result;
}