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


Java BufferParameters.CAP_FLAT属性代码示例

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


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

示例1: getClippedTracesWithinBufferOf

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,代码行数:40,代码来源:GPSDataSource.java

示例2: getCapAsInt

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,代码行数:10,代码来源:SpatialAnalysisMeta.java

示例3: process

@Execute
public void process() throws Exception {
    checkNull(inMap);

    int joinStyle;
    if (pJoinstyle.equals(JOIN_MITRE)) {
        joinStyle = BufferParameters.JOIN_MITRE;
    } else if (pJoinstyle.equals(JOIN_BEVEL)) {
        joinStyle = BufferParameters.JOIN_BEVEL;
    } else {
        joinStyle = BufferParameters.JOIN_ROUND;
    }
    int endCapStyle;
    if (pCapstyle.equals(CAP_FLAT)) {
        endCapStyle = BufferParameters.CAP_FLAT;
    } else if (pCapstyle.equals(CAP_SQUARE)) {
        endCapStyle = BufferParameters.CAP_SQUARE;
    } else {
        endCapStyle = BufferParameters.CAP_ROUND;
    }

    FeatureGeometrySubstitutor fgs = new FeatureGeometrySubstitutor(inMap.getSchema(), MultiPolygon.class);

    DefaultFeatureCollection outMaptmp = new DefaultFeatureCollection("new", fgs.getNewFeatureType());

    GeometryFactory gf = GeometryUtilities.gf();

    List<SimpleFeature> featuresList = FeatureUtilities.featureCollectionToList(inMap);
    pm.beginTask("Buffering geometries...", featuresList.size());
    for( SimpleFeature feature : featuresList ) {
        Geometry geometry = (Geometry) feature.getDefaultGeometry();

        BufferParameters bP = new BufferParameters(quadrantSegments, endCapStyle, joinStyle, mitreLimit);
        Geometry bufferedGeom = BufferOp.bufferOp(geometry, pBuffer, bP);
        List<Polygon> polygons = new ArrayList<Polygon>(bufferedGeom.getNumGeometries());
        for( int i = 0; i < bufferedGeom.getNumGeometries(); i++ ) {
            Geometry geometryN = bufferedGeom.getGeometryN(i);
            if (geometryN instanceof Polygon) {
                polygons.add((Polygon) geometryN);
            } else {
                pm.errorMessage("Ignored non polygonal geometry in: " + geometryN.toText());
            }
        }
        MultiPolygon multiPolygon = gf.createMultiPolygon(polygons.toArray(GeometryUtilities.TYPE_POLYGON));
        SimpleFeature newFeature = fgs.substituteGeometry(feature, multiPolygon);
        outMaptmp.add(newFeature);
        pm.worked(1);
    }
    pm.done();

    outMap = outMaptmp;

}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:53,代码来源:OmsBuffer.java

示例4: Settings

public Settings(BufferPanel panel, BufferConfig config)
{
	this.config = config;

	setLayout(new GridBagLayout());

	setFloatable(false);

	String as[] = { TEXT_DRAW_INPUT };
	GridBagConstraints c = new GridBagConstraints();
	c.anchor = GridBagConstraints.WEST;
	c.fill = GridBagConstraints.VERTICAL;

	buttons = new JToggleButton[as.length];
	for (int i = 0; i < as.length; i++) {
		buttons[i] = new JToggleButton(as[i]);
		buttons[i].addItemListener(this);
		add(buttons[i], c);
	}

	buttons[0].setSelected(config.isDrawInput());

	capSelector = new KeyValueComboBox<>(new String[] { "flat", "round",
			"square" }, new Integer[] { BufferParameters.CAP_FLAT,
			BufferParameters.CAP_ROUND, BufferParameters.CAP_SQUARE },
			config.getCapStyle());

	joinSelector = new KeyValueComboBox<>(new String[] { "bevel", "mitre",
			"round" }, new Integer[] { BufferParameters.JOIN_BEVEL,
			BufferParameters.JOIN_MITRE, BufferParameters.JOIN_ROUND },
			config.getJoinStyle());

	capSelector.setMinPreferredWidth(100);
	joinSelector.setMinPreferredWidth(100);

	ZoomInput zoomInput = new ZoomInput(panel);

	add(capSelector, c);
	add(joinSelector, c);
	add(zoomInput, c);

	c.weightx = 1.0;
	JPanel spacer = new JPanel();
	spacer.setMinimumSize(new Dimension(0, 0));
	spacer.setPreferredSize(new Dimension(0, 0));
	add(spacer, c);

	capSelector.addActionListener(this);
	joinSelector.addActionListener(this);
}
 
开发者ID:sebkur,项目名称:live-cg,代码行数:50,代码来源:Settings.java


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