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


Java GeometryDescriptor.getType方法代码示例

本文整理汇总了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));
    }
 
开发者ID:skp703,项目名称:RainInterpolator,代码行数:24,代码来源:ParseShapefiles.java

示例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;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:35,代码来源:SLDEditorBufferedImageLegendGraphicBuilder.java


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