Package org.opengis.feature.type

Examples of org.opengis.feature.type.GeometryDescriptor


     *
     * @see org.locationtech.udig.project.internal.command.MapCommand#run()
     */
    public void run( IProgressMonitor monitor ) throws Exception {
        SimpleFeatureType schema = editLayer.get(monitor).getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        if (xpath.equals(DEFAULT)){
            xpath = geometryDescriptor.getName().getLocalPart();
        }
        Geometry geometry = (Geometry) value;
        if( geometry.getUserData() == null ){
            CoordinateReferenceSystem crs = geometryDescriptor.getCoordinateReferenceSystem();
            if( crs != null ){
                String srsName = CRS.toSRS(crs);
                geometry.setUserData(srsName);
            }
        }
View Full Code Here


     * Maps the default geometry attribute regardless of whether they are the same type.
     */
    @SuppressWarnings("unchecked")
    private static void mapGeometryAttributes( SimpleFeatureType sourceSchema, SimpleFeatureType targetSchema, Map<String, String> queryAttributes ) {
        // Now we'll match the geometry on type only. I don't care if it has the same type name.
        GeometryDescriptor defaultGeometry = targetSchema.getGeometryDescriptor();
        if( defaultGeometry==null ){
            return;
        }
        else if (!queryAttributes.containsKey(defaultGeometry.getName())) {
            // first check source's default geom and see if it matches
            Class<?> binding = sourceSchema.getGeometryDescriptor().getType().getBinding();
      if (defaultGeometry.getType().getBinding().isAssignableFrom(
                    binding)) {
                queryAttributes.put(defaultGeometry.getName().getLocalPart(), sourceSchema.getGeometryDescriptor()
                        .getName().getLocalPart());
            } else {
                // we have to look through all the source attributes looking for a geometry that
                // matches.
                boolean found = false;
                for( int i = 0; i < sourceSchema.getAttributeCount(); i++ ) {
                    AttributeDescriptor source = sourceSchema.getDescriptor(i);
                    if (defaultGeometry.getType().getBinding().isAssignableFrom(source.getType().getBinding())) {
                        queryAttributes.put(defaultGeometry.getName().getLocalPart(), source.getName().getLocalPart());
                        found = true;
                        break;
                    }
                }
                // ok so we're going to have to do some transformations. Match default geometries
                // then.
                if (!found) {
                    queryAttributes.put(defaultGeometry.getName().getLocalPart(), sourceSchema
                            .getGeometryDescriptor().getName().getLocalPart());
                }
            }
        }
    }
View Full Code Here

                throws IOException {

        FeatureStore<SimpleFeatureType, SimpleFeature> store = layer.getResource(
                FeatureStore.class, new NullProgressMonitor());

        GeometryDescriptor geomAttr = store.getSchema().getGeometryDescriptor();
        Class< ? extends Geometry> expectedClass = (Class< ? extends Geometry>) geomAttr.getType()
                .getBinding();

        Geometry adaptedGeom = GeometryUtil.adapt(newGeometry, expectedClass);

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
View Full Code Here

        SimpleFeatureType schema = layer.getSchema();

        // check if layer is polygon
        if (schema != null) {
            GeometryDescriptor geomDescriptor = schema.getGeometryDescriptor();
            if (geomDescriptor != null) {
                Class< ? extends Geometry> binding = (Class< ? extends Geometry>) geomDescriptor
                        .getType().getBinding();
                switch( Geometries.getForBinding(binding) ) {
                case MULTIPOLYGON:
                case POLYGON:
                    isPolygon = true;
View Full Code Here

        if (featureSource == null) {
            return null;
        }
       
        SimpleFeatureType schema = featureSource.getSchema();
        GeometryDescriptor geom = schema.getGeometryDescriptor();
        if (geom == null) {
            return null;
        }

        Style style = styleBuilder.createStyle();
View Full Code Here

            SimpleFeature feature=iter.next();
            Coordinate c=map.getViewportModel().pixelToWorld(i*10,0);
            FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
      Set<Identifier> ids = new HashSet<Identifier>();
      ids.add(filterFactory.featureId(feature.getID()));
      GeometryDescriptor defaultGeometry = feature.getFeatureType().getGeometryDescriptor();
      resource.modifyFeatures(defaultGeometry, fac.createPoint(c),
                    filterFactory.id(ids));
        }
        ((EditManager)map.getEditManager()).commitTransaction();

View Full Code Here

        final ILayer layer = (ILayer) target;
        SimpleFeatureSource source = (SimpleFeatureSource) layer.getResource(FeatureSource.class, new NullProgressMonitor());

        SimpleFeatureType schema = source.getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        IViewportModel viewportModel = ApplicationGIS.getActiveMap().getViewportModel();
        ReferencedEnvelope bounds = viewportModel.getBounds();
        CoordinateReferenceSystem dataCrs = schema.getCoordinateReferenceSystem();
       
        ReferencedEnvelope newBounds = bounds.transform(dataCrs, true);
       
        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, newBounds);
        SelectionCommandFactory cmdFactory = SelectionCommandFactory.getInstance();
        UndoableMapCommand selectCommand = cmdFactory.createSelectCommand(layer, bboxFilter);
       
        IToolContext toolContext = ApplicationGIS.createContext(ApplicationGIS.getActiveMap());
View Full Code Here

        Style style = builder.createStyle();

        SelectionStyleContent ssc = new SelectionStyleContent();
        if (schema == null)
            return null;
        GeometryDescriptor geom = schema.getGeometryDescriptor();
        if (isLine(geom)) {
            ssc.getDefaultRule(style).setSymbolizers(createLineSymbolizers(ssc));
        } else if (isPoint(geom)) {
            int size = queryPointSize(style);
            PointSymbolizer sym = ssc.createPointSymbolizer(getSelectionColor(), size);
View Full Code Here

                        for( Rule rule : rules ) {

                            BufferedImage awtIcon = null;
                            if (layer.hasResource(FeatureSource.class) && rule != null) {
                                SimpleFeatureType type = layer.getSchema();
                                GeometryDescriptor geom = type.getGeometryDescriptor();
                                if (geom != null) {
                                    Class geom_type = geom.getType().getBinding();
                                    if (geom_type == Point.class || geom_type == MultiPoint.class) {
                                        awtIcon = point(rule, boxWidth, boxHeight);
                                    } else if (geom_type == LineString.class
                                            || geom_type == MultiLineString.class) {
                                        awtIcon = line(rule, boxWidth, boxHeight);
View Full Code Here

            Rule rule = getRule(sld);

            BufferedImage swtIcon = null;
            if (layer.hasResource(FeatureSource.class) && rule != null) {
                SimpleFeatureType type = layer.getSchema();
                GeometryDescriptor geom = type.getGeometryDescriptor();
                if (geom != null) {
                    Class geom_type = geom.getType().getBinding();
                    if (geom_type == Point.class || geom_type == MultiPoint.class) {
                        swtIcon = point(rule, boxWidth, boxHeight);
                    } else if (geom_type == LineString.class || geom_type == MultiLineString.class) {
                        swtIcon = line(rule, boxWidth, boxHeight);
                    } else if (geom_type == Polygon.class || geom_type == MultiPolygon.class) {
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.GeometryDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.