本文整理汇总了Java中org.geotools.feature.simple.SimpleFeatureBuilder.copy方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleFeatureBuilder.copy方法的具体用法?Java SimpleFeatureBuilder.copy怎么用?Java SimpleFeatureBuilder.copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.feature.simple.SimpleFeatureBuilder
的用法示例。
在下文中一共展示了SimpleFeatureBuilder.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: feature2Dxf
import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
/**
* Write a {@link SimpleFeature} to dxf string.
*
* @param featureMate the feature to convert.
* @param layerName the layer name in case none is in the attributes.
* @param elevationAttrName the attribute defining elevation or <code>null</code>.
* @param suffix <code>true</code> if suffix is needed.
* @param force2CoordsToLine if <code>true</code>, lines that are composed of just 2 coordinates
* will be handled as LINE instead of the default which is POLYLINE.
* @return the string representation.
*/
public static String feature2Dxf( FeatureMate featureMate, String layerName, String elevationAttrName, boolean suffix,
boolean force2CoordsToLine ) {
Geometry g = featureMate.getGeometry();
if (EGeometryType.isPoint(g)) {
return point2Dxf(featureMate, layerName, elevationAttrName);
} else if (EGeometryType.isLine(g)) {
return lineString2Dxf(featureMate, layerName, elevationAttrName, force2CoordsToLine);
} else if (EGeometryType.isPolygon(g)) {
return polygon2Dxf(featureMate, layerName, elevationAttrName, suffix);
} else if (g instanceof GeometryCollection) {
StringBuilder sb = new StringBuilder();
for( int i = 0; i < g.getNumGeometries(); i++ ) {
SimpleFeature ff = SimpleFeatureBuilder.copy(featureMate.getFeature());
ff.setDefaultGeometry(g.getGeometryN(i));
FeatureMate fm = new FeatureMate(ff);
sb.append(feature2Dxf(fm, layerName, elevationAttrName, suffix, force2CoordsToLine));
}
return sb.toString();
} else {
return null;
}
}
示例2: cloneFeatureCollection
import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
public static FeatureCollection cloneFeatureCollection(FeatureCollection collection) throws IllegalAttributeException{
FeatureCollection clonedFeatureCollection = new TempFeatureCollection(collection.getID(), (SimpleFeatureType) collection.getSchema());
//clonedFeatureCollection.setDefaultGeometry(collection.getDefaultGeometry());
Iterator iter = collection.iterator();
while(iter.hasNext()) {
SimpleFeature defaultFeature = (SimpleFeature) iter.next();
SimpleFeature clonedFeature = SimpleFeatureBuilder.copy(defaultFeature);
;
clonedFeatureCollection.add(clonedFeature);
}
return clonedFeatureCollection;
}