本文整理汇总了Java中org.opengis.feature.type.FeatureType.getSuper方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureType.getSuper方法的具体用法?Java FeatureType.getSuper怎么用?Java FeatureType.getSuper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.feature.type.FeatureType
的用法示例。
在下文中一共展示了FeatureType.getSuper方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: featureStore
import org.opengis.feature.type.FeatureType; //导入方法依赖的package包/类
/**
* Creates a new Feature Store for writing features
* @param originalSource the original feature source, used for bounds and geometry descriptor information
* @param path the location where the store will be saved
* @param attributeTypes a map of attribute information (name, type) to create the schema
* @return an empty store for writing features
* @throws IOException if the file cannot be created
*/
public static AbstractDataStore featureStore(
FeatureSource originalSource,
String path,
Map<String,Class<?>> attributeTypes
) throws IOException {
// Create store
DataStoreFactorySpi storeFactory = new ShapefileDataStoreFactory();
File file = new java.io.File(path);
HashMap<String, Serializable> createFlags = new HashMap<String, Serializable>();
createFlags.put("url", file.toURI().toURL());
ShapefileDataStore saveStore = (ShapefileDataStore)storeFactory.createNewDataStore(createFlags);
// Set flags and descriptors
saveStore.setStringCharset(Charset.forName("UTF-8"));
FeatureType oldSchema = originalSource.getSchema();
final List<AttributeDescriptor> descriptorList = new java.util.ArrayList<AttributeDescriptor>();
descriptorList.add(oldSchema.getGeometryDescriptor());
// Set attributes
for (Map.Entry<String, Class<?>> entry: attributeTypes.entrySet()) {
AttributeTypeBuilder keyTB = new AttributeTypeBuilder();
keyTB.setName(entry.getKey());
keyTB.setBinding(entry.getValue());
keyTB.setNillable(true);
AttributeDescriptor desc = keyTB.buildDescriptor(entry.getKey());
descriptorList.add(desc);
}
// Finalize schema
SimpleFeatureTypeImpl newSchema = new SimpleFeatureTypeImpl(
new NameImpl(file.getName()),
descriptorList,
oldSchema.getGeometryDescriptor(),
oldSchema.isAbstract(),
oldSchema.getRestrictions(),
oldSchema.getSuper(),
null);
saveStore.createSchema(newSchema);
return saveStore;
}
示例2: getAncestors
import org.opengis.feature.type.FeatureType; //导入方法依赖的package包/类
/**
* Walks up the type hierarchy of the feature returning all super types of the specified feature
* type. The search terminates when a non-FeatureType or null is found. The original featureType
* is not included as an ancestor, only its strict ancestors.
*/
public static List<FeatureType> getAncestors(FeatureType featureType) {
List<FeatureType> ancestors = new ArrayList<FeatureType>();
while (featureType.getSuper() instanceof FeatureType) {
FeatureType superType = (FeatureType) featureType.getSuper();
ancestors.add(superType);
featureType = superType;
}
return ancestors;
}