当前位置: 首页>>代码示例>>Java>>正文


Java BufferParameters.setEndCapStyle方法代码示例

本文整理汇总了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);
}
 
开发者ID:geops,项目名称:trafimage-geoserver-transformations,代码行数:23,代码来源:CurveBuilder.java

示例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);
}
 
开发者ID:geobeyond,项目名称:fluxomajic,代码行数:36,代码来源:FluxoFilterFunction.java

示例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);
    }
  }

}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:12,代码来源:OShapeBuilder.java

示例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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:70,代码来源:SpatialAnalysis.java


注:本文中的com.vividsolutions.jts.operation.buffer.BufferParameters.setEndCapStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。