本文整理汇总了Java中org.opengis.feature.type.GeometryDescriptor.getType方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryDescriptor.getType方法的具体用法?Java GeometryDescriptor.getType怎么用?Java GeometryDescriptor.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.feature.type.GeometryDescriptor
的用法示例。
在下文中一共展示了GeometryDescriptor.getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDescription
import org.opengis.feature.type.GeometryDescriptor; //导入方法依赖的package包/类
public static ShapeFileDesc findDescription(File file) throws IOException {
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureType schema = store.getSchema();
GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
GeometryType type = geometryDescriptor.getType();
CoordinateReferenceSystem coordinateReferenceSystem = geometryDescriptor.getCoordinateReferenceSystem();
List<AttributeDescriptor> attributeDescriptors = schema.getAttributeDescriptors();
List<String> labels = new ArrayList();
for (AttributeDescriptor a : attributeDescriptors) {
labels.add(a.getLocalName());
//labels
System.out.println(a.getLocalName());
}
//projection system
// System.out.println(coordinateReferenceSystem.getCoordinateSystem().getName().toString());
//type
System.out.println(parseGeometry(type));
double w = store.getFeatureSource().getBounds().getWidth();
double h = store.getFeatureSource().getBounds().getHeight();
return new ShapeFileDesc(coordinateReferenceSystem == null ? null : coordinateReferenceSystem.getCoordinateSystem().getName().toString(),
parseGeometry(type), labels, Math.sqrt(w * w + h * h));
}
示例2: cloneWithDimensionality
import org.opengis.feature.type.GeometryDescriptor; //导入方法依赖的package包/类
/**
* Clones the given schema, changing the geometry attribute to match the given dimensionality.
*
* @param schema schema to clone
* @param dimensionality dimensionality for the geometry 1= points, 2= lines, 3= polygons
*
*/
private FeatureType cloneWithDimensionality(FeatureType schema, int dimensionality) {
SimpleFeatureType simpleFt = (SimpleFeatureType) schema;
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName(schema.getName());
builder.setCRS(schema.getCoordinateReferenceSystem());
for (AttributeDescriptor desc : simpleFt.getAttributeDescriptors()) {
if (isMixedGeometry(desc)) {
GeometryDescriptor geomDescriptor = (GeometryDescriptor) desc;
GeometryType geomType = geomDescriptor.getType();
Class<?> geometryClass = getGeometryForDimensionality(dimensionality);
GeometryType gt = new GeometryTypeImpl(geomType.getName(), geometryClass,
geomType.getCoordinateReferenceSystem(), geomType.isIdentified(),
geomType.isAbstract(), geomType.getRestrictions(), geomType.getSuper(),
geomType.getDescription());
builder.add(new GeometryDescriptorImpl(gt, geomDescriptor.getName(),
geomDescriptor.getMinOccurs(), geomDescriptor.getMaxOccurs(),
geomDescriptor.isNillable(), geomDescriptor.getDefaultValue()));
} else {
builder.add(desc);
}
}
schema = builder.buildFeatureType();
return schema;
}