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


Java BufferParameters类代码示例

本文整理汇总了Java中com.vividsolutions.jts.operation.buffer.BufferParameters的典型用法代码示例。如果您正苦于以下问题:Java BufferParameters类的具体用法?Java BufferParameters怎么用?Java BufferParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BufferParameters类属于com.vividsolutions.jts.operation.buffer包,在下文中一共展示了BufferParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
@Override
public Geometry call() {
		bufferedGeom =PolygonOp.removeInteriorRing(bufferedGeom);
	    if(!bufferedGeom.isValid()){
	    	bufferedGeom=JTSUtil.repair(bufferedGeom);
	    	//System.out.println(Arrays.toString(bufferedGeom.getCoordinates()));
	    	/*PrecisionModel pm=new PrecisionModel(PrecisionModel.FLOATING_SINGLE);
		    GeometryFactory gf = new GeometryFactory(pm);
		    Coordinate[]cc=new Coordinate[bufferedGeom.getCoordinates().length+1];
		    for(int i=0;i<bufferedGeom.getCoordinates().length;i++){
		    	cc[i]=bufferedGeom.getCoordinates()[i];
		    }
		    cc[cc.length-1]=cc[0];
	    	bufferedGeom=gf.createPolygon(cc);*/
	    }
           bufferedGeom =BufferOp.bufferOp(bufferedGeom,bufferingDistance,BufferParameters.CAP_SQUARE,BufferParameters.DEFAULT_QUADRANT_SEGMENTS);


	return bufferedGeom;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:21,代码来源:MaskVectorLayer.java

示例2: buffer

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public IGeometry buffer(IGeometry geom, double distance, int nSegments,
    int cap, int join) {
  try {
    Geometry jtsGeom = JtsGeOxygene.makeJtsGeom(geom);
    BufferParameters bufferParam = new BufferParameters(nSegments, cap, join,
        BufferParameters.DEFAULT_MITRE_LIMIT);
    Geometry jtsBuffer = BufferOp.bufferOp(jtsGeom, distance, bufferParam);
    return JtsGeOxygene.makeGeOxygeneGeom(jtsBuffer);
  } catch (Exception e) {
    JtsAlgorithms.logger.error(I18N.getString("JtsAlgorithms.BufferError")); //$NON-NLS-1$
    if (JtsAlgorithms.logger.isDebugEnabled()) {
      JtsAlgorithms.logger.debug(I18N
          .getString("JtsAlgorithms.BufferDistance") + distance); //$NON-NLS-1$
      JtsAlgorithms.logger.debug(I18N
          .getString("JtsAlgorithms.BufferSegments") + nSegments); //$NON-NLS-1$
      JtsAlgorithms.logger.debug(I18N.getString("JtsAlgorithms.Cap") + cap); //$NON-NLS-1$
      JtsAlgorithms.logger
          .debug(I18N.getString("JtsAlgorithms.Geometry") + ((geom != null) ? geom.toString() : I18N.getString("JtsAlgorithms.NullGeometry"))); //$NON-NLS-1$ //$NON-NLS-2$
      JtsAlgorithms.logger.debug(e.getMessage());
    }
    e.printStackTrace();
    return null;
  }
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:25,代码来源:JtsAlgorithms.java

示例3: cap

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public static ILineString cap(ILineString line, double distance, boolean start) {
  double d = Math.abs(distance);
  try {
    // removing duplicate coordinates from the input linestring.
    LineString lineString = JtsAlgorithms
        .getLineStringWithoutDuplicates((LineString) JtsGeOxygene
            .makeJtsGeom(line));
    Geometry buffer = lineString.buffer(d, 4, BufferParameters.CAP_ROUND);
    Polygon polygon = null;
    if (!(buffer instanceof Polygon)) {
      JtsAlgorithms.logger.error("Can't compute offsetcurve of " + //$NON-NLS-1$
          buffer.getGeometryType());
      return null;
    }
    polygon = (Polygon) buffer;
    // build the offset curve for the exterior ring
    GM_LineString r = JtsAlgorithms.getCapFromRing(polygon.getExteriorRing(),
        lineString, d, start);
    return r;
  } catch (Exception e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:25,代码来源:JtsAlgorithms.java

示例4: 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

示例5: addRoughOffsetCurves

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
private void addRoughOffsetCurves(Collection offsetCurves, Geometry sourceCurve, BufferParameters parameters, Double offsetDistance) {

        OffsetCurveBuilder builder = new OffsetCurveBuilder(
                sourceCurve.getFactory().getPrecisionModel(), parameters);

        for (int i = 0; i < sourceCurve.getNumGeometries(); i++) {
            if (sourceCurve.getGeometryN(i) instanceof LineString) {
                LineString lineString = (LineString) sourceCurve.getGeometryN(i);
                Coordinate[] cc = lineString.getCoordinates();
                if (lineString.isClosed()) {
                    offsetCurves.add(lineString.getFactory().createLineString(
                            builder.getRingCurve(cc,
                            offsetDistance > 0 ? Position.LEFT : Position.RIGHT,
                            Math.abs(offsetDistance))));
                } else {
                    offsetCurves.add(lineString.getFactory().createLineString(
                            builder.getOffsetCurve(cc, offsetDistance)));
                }
            }
        }
    }
 
开发者ID:geobeyond,项目名称:fluxomajic,代码行数:22,代码来源:FluxoFilterFunction.java

示例6: 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

示例7: buffer

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public static IGeometry buffer(IGeometry geom, int quad, int cap, int join,
    double mitre, double distance) {
  BufferBuilder bb = new BufferBuilder(
      new BufferParameters(quad, cap, join, mitre));
  IGeometry geom_ = null;
  try {
    geom_ = AdapterFactory.toGM_Object(bb.buffer(
        AdapterFactory.toGeometry(new GeometryFactory(), geom), distance));
  } catch (Exception e) {
    e.printStackTrace();
  }
  return geom_;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:14,代码来源:CommonAlgorithms.java

示例8: buffer

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public Shape buffer(Shape shape, Double distance, Map<String, Object> params) {
  Geometry geometry = toGeometry(shape);
  BufferParameters parameters = new BufferParameters();
  if (params != null) {
    bindParameters(parameters, params);
  }

  BufferOp ops = new BufferOp(geometry, parameters);
  return toShape(ops.getResultGeometry(distance));
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:11,代码来源:OShapeBuilder.java

示例9: 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

示例10: bindJoin

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
private void bindJoin(BufferParameters parameters, Map<String, Object> params) {
  String join = (String) params.get("join");
  if (join != null) {
    Integer style = OShapeBuilder.join.get(join);
    if (style != null) {
      parameters.setJoinStyle(style);
    }
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:10,代码来源:OShapeBuilder.java

示例11: bindMitre

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
private void bindMitre(BufferParameters parameters, Map<String, Object> params) {
  Number mitre = (Number) params.get("mitre");

  if (mitre != null) {
    parameters.setMitreLimit(mitre.doubleValue());
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:8,代码来源:OShapeBuilder.java

示例12: 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());
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:8,代码来源:OShapeBuilder.java

示例13: getClippedTracesWithinBufferOf

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public List<GpsTracePart> getClippedTracesWithinBufferOf(StreetSegment s) {
	List<GpsTracePart> partList = new ArrayList<GpsTracePart>();

	try {
		double bufferDis = Double.valueOf(p.getProperty("streetBufferDistance"));
		
		int bufferCap;
		
		if (p.getProperty("bufferCap").equals("CAP_FLAT")){
			bufferCap = BufferParameters.CAP_FLAT;
		}else{
			bufferCap = BufferParameters.CAP_ROUND;
		}
	
		Geometry buffer = s.getGeom().buffer(bufferDis, 5, bufferCap);
		buffer.setSRID(4326);
		pst.setBytes(1, wkbWriter.write(buffer));

		pst.setBytes(2, wkbWriter.write(buffer));
		pst.setInt(3, s.getId());
		pst.setBytes(4, wkbWriter.write(buffer));

		ResultSet rs1 = pst.executeQuery();
		while (rs1.next()) {
			
			int gpsId = rs1.getInt(p.getProperty("t_PpGpxIdCol"));
			int trkId = rs1.getInt(p.getProperty("t_PpGpxTrkIdCol"));
			int partId = rs1.getInt(p.getProperty("t_PpGpxPartIdCol"));
			MultiLineString geom = Util.parseJson(rs1.getString(p.getProperty("t_PpGpxGeomCol")));
			MultiLineString geomSmoothed = Util.parseJson(rs1.getString(p.getProperty("t_PpGpxGeomColSmoothed")));
			partList.add(new GpsTracePart(gpsId, trkId, partId, geom, geomSmoothed));

		}

	} catch (SQLException e) {
		e.printStackTrace();
	}

	return partList;
}
 
开发者ID:GIScience,项目名称:osmgpxinclinecalculator,代码行数:41,代码来源:GPSDataSource.java

示例14: operand

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
@operator (
		value = "clean",
		category = { IOperatorCategory.SPATIAL, IOperatorCategory.SP_TRANSFORMATIONS },
		concept = { IConcept.GEOMETRY, IConcept.SPATIAL_COMPUTATION, IConcept.SPATIAL_TRANSFORMATION })
@doc (
		value = "A geometry corresponding to the cleaning of the operand (geometry, agent, point)",
		comment = "The cleaning corresponds to a buffer with a distance of 0.0",
		examples = { @example (
				value = "clean(self)",
				equals = "returns the geometry resulting from the cleaning of the geometry of the agent applying the operator.",
				test = false) })
public static IShape clean(final IScope scope, final IShape g) {

	if (g == null || g.getInnerGeometry() == null) { return g; }
	if (g.getInnerGeometry() instanceof Polygon) { return new GamaShape(g, g.getInnerGeometry().buffer(0.0,
			BufferParameters.DEFAULT_QUADRANT_SEGMENTS, BufferParameters.CAP_FLAT)); }
	if (g.getInnerGeometry() instanceof MultiPolygon) {
		final MultiPolygon mp = (MultiPolygon) g.getInnerGeometry();
		final int nb = mp.getNumGeometries();
		final Polygon[] polys = new Polygon[nb];
		for (int i = 0; i < nb; i++) {
			polys[i] = (Polygon) mp.getGeometryN(i).buffer(0.0, BufferParameters.DEFAULT_QUADRANT_SEGMENTS,
					BufferParameters.CAP_FLAT);
		}
		return new GamaShape(g, GeometryUtils.GEOMETRY_FACTORY.createMultiPolygon(polys));
	}
	return g.copy(scope);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:29,代码来源:Spatial.java

示例15: getCapAsInt

import com.vividsolutions.jts.operation.buffer.BufferParameters; //导入依赖的package包/类
public int getCapAsInt(){
int cap = -1;
      if(bufferCap.equals(bufferCaps[0]))
      	cap = BufferParameters.CAP_FLAT;
      if(bufferCap.equals(bufferCaps[1]))
      	cap = BufferParameters.CAP_ROUND;
      if(bufferCap.equals(bufferCaps[2]))
      	cap = BufferParameters.CAP_SQUARE;
      return cap;
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:11,代码来源:SpatialAnalysisMeta.java


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