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


Java FeatureType.getSuper方法代码示例

本文整理汇总了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;
}
 
开发者ID:foursquare,项目名称:shapefile-geo,代码行数:46,代码来源:ShapefileUtils.java

示例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;
}
 
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:15,代码来源:SimpleFeatureTypeImpl.java


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