Package org.opengis.feature.simple

Examples of org.opengis.feature.simple.SimpleFeatureType


             * ITabbedFeaturePanelPageContributor.
             */
            newContributor = contributor;
        }

        SimpleFeatureType selectionSchema = newContributor.getSchema();
        if (selectionSchema == null) {
            return;
        }
        if (selectionSchema.equals(currentSchema)) {
            // selection has the same contributor id as current, so leave
            // existing registry.
            return;
        }

View Full Code Here


     */
    protected boolean doCheckState() {
        EditFeature feature = getFeature();
        if (feature == null)
            return true; // cannot check right now
        SimpleFeatureType schema = feature.getFeatureType();
        AttributeDescriptor descriptor = schema.getDescriptor(getAttributeName());
        if (descriptor == null) {
            // the schema changed on us! help ...
            return false;
        }
        String text = textField.getText();
View Full Code Here

    /*
     * (non-Javadoc) Method declared on AttributeField.
     */
    protected void doLoadDefault() {
        if (textField != null) {
            SimpleFeatureType schema = getFeature().getFeatureType();
            AttributeDescriptor descriptor = schema.getDescriptor(getAttributeName());
            Object value = descriptor.getDefaultValue();

            String text = Converters.convert(value, String.class);
            textField.setText(text);
        }
View Full Code Here

                FeatureStore.class, null);
        transform();
        if (store.getTransaction() == Transaction.AUTO_COMMIT) {
            throw new Exception("Error transaction has not been started"); //$NON-NLS-1$
        }
        final SimpleFeatureType type = store.getSchema();

        // Object[] attrs = new Object[type.getAttributeCount()];
        // for( int i = 0; i < attrs.length; i++ ) {
        // attrs[i] = toDefaultValue(type.getDescriptor(i));
        // }
        //       
        // final SimpleFeature newFeature = SimpleFeatureBuilder.build(type, attrs, "newFeature"
        // + new Random().nextInt());

        String proposedFid = "newFeature"+"newFeature" + new Random().nextInt();
        final SimpleFeature newFeature = SimpleFeatureBuilder.template(type, proposedFid );

        Class geomType = type.getGeometryDescriptor().getType().getBinding();
        Geometry geom = GeometryBuilder.create().safeCreateGeometry(geomType, coordinates);
        newFeature.setDefaultGeometry(geom);
        fid = newFeature.getID();

        SimpleFeature feature = new AdaptableFeature(newFeature, editLayer);
View Full Code Here

    for(int i = 0; i < xpath.length; i++){
        feature2.setAttribute(xpath[i],value[i]);
    }
       
        List<AttributeDescriptor> attributeList = new ArrayList<AttributeDescriptor>();
        SimpleFeatureType schema = layer.getSchema();
        for( String name : xpath ){
            attributeList.add( schema.getDescriptor( name ));
        }
        AttributeDescriptor[] array = attributeList.toArray( new AttributeDescriptor[attributeList.size()]);
        resource.modifyFeatures(array, value, fidFilter);
    }
View Full Code Here

        FeatureStore<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureStore.class, null);
       
        // need another for loop
       
        List<AttributeDescriptor> attributeList = new ArrayList<AttributeDescriptor>();
        SimpleFeatureType schema = layer.getSchema();
        for( String name : xpath ){
            attributeList.add( schema.getDescriptor( name ));
        }
        AttributeDescriptor[] array = attributeList.toArray( new AttributeDescriptor[attributeList.size()]);
       
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Id id = filterFactory.id(
View Full Code Here

            build.setName(typename+i);
            build.setNamespaceURI( "http://udig.refractions.net");
            build.setAbstract(false);
            build.add(Messages.NewServiceConnectionFactory_defaultGeom,com.vividsolutions.jts.geom.Geometry.class);
           
            SimpleFeatureType schema = build.buildFeatureType();
           
            ds.createSchema( schema ); //$NON-NLS-1$
        } catch (Exception e) {
            CatalogUIPlugin.log("Error creating MemoryDatastore or feature type", e); //$NON-NLS-1$
            return null;
View Full Code Here

        if (editFeature == null || editLayer == null){
            noChange=true;
            return;
        }
        old=SimpleFeatureBuilder.copy(editFeature);
        SimpleFeatureType featureType = editFeature.getFeatureType();
        FilterFactory factory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        FeatureStore<SimpleFeatureType, SimpleFeature> store = editLayer.getResource(FeatureStore.class, null);
        Filter filter = factory.id(FeatureUtils.stringToId(factory, editFeature.getID()));
        FeatureCollection<SimpleFeatureType, SimpleFeature>  results = store.getFeatures(filter);

        FeatureIterator<SimpleFeature> reader = results.features();
        try {
            if (reader.hasNext()) {
                try {
                    store.modifyFeatures(featureType.getAttributeDescriptors().toArray(new AttributeDescriptor[0]), editFeature
                            .getAttributes().toArray(), filter);
                } catch (Exception e) {
                    ProjectPlugin.log("",e); //$NON-NLS-1$
                    noChange=true;
                }
View Full Code Here

        FeatureStore<SimpleFeatureType, SimpleFeature> store = editLayer.getResource(FeatureStore.class, null);
        if( added ){
            store.removeFeatures(filter);
            getMap().getEditManagerInternal().setEditFeature(null,null);
        }else{
            SimpleFeatureType featureType = old.getFeatureType();
            store.modifyFeatures(featureType.getAttributeDescriptors().toArray(new AttributeDescriptor[0]), old
                    .getAttributes().toArray(), filter);           
        }
        monitor.done();
    }
View Full Code Here

                return super.features(typeName);
            }
        };
       
        final TestMemoryDataStore ds = new TestMemoryDataStore();
        final SimpleFeatureType ft = DataUtilities.createType("IssuesFeatureType"//$NON-NLS-1$
                "*"+BOUNDS+":MultiPolygon," + //$NON-NLS-1$ //$NON-NLS-2$
                EXTENSION_ID_ATTR+":String,"+ //$NON-NLS-1$
                ISSUE_ID_ATTR+":String,"+ //$NON-NLS-1$
                GROUP_ID_ATTR+":String,"+ //$NON-NLS-1$
                RESOLUTION_ATTR+":String,"+ //$NON-NLS-1$
                PRIORITY_ATTR+":String,"+ //$NON-NLS-1$
                DESCRIPTION_ATTR+":String,"+ //$NON-NLS-1$
                ISSUE_MEMENTO_DATA_ATTR+":String,"+ //$NON-NLS-1$
                VIEW_MEMENTO_DATA_ATTR+":String"); //$NON-NLS-1$
       
        ds.createSchema(ft);
       
        IListStrategy strategy=new AbstractDatastoreStrategy(){
       
            @Override
            public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatures() throws IOException {
                return new AdaptorFeatureCollection("type", ft){

                    @Override
                    protected void closeIterator( Iterator close ) {
                    }

                    @SuppressWarnings("unchecked")
                    @Override
                    protected Iterator openIterator() {
                        try {
                            ArrayList<SimpleFeature> features = new ArrayList<SimpleFeature>(ds.features(ft.getName().getLocalPart()).values());
                            Collections.sort(features, new Comparator<SimpleFeature>(){

                                public int compare( SimpleFeature o1, SimpleFeature o2 ) {
                                    return ((String)o1.getAttribute(ISSUE_ID_ATTR)).compareTo((String)o2.getAttribute(ISSUE_ID_ATTR));
                                }
                               
                            });
                            final Iterator<SimpleFeature> iter=features.iterator();
                            return new Iterator(){

                                public boolean hasNext() {
                                    return iter.hasNext();
                                }

                                public Object next() {
                                    return iter.next();
                                }

                                public void remove() {
                                    throw new UnsupportedOperationException();
                                }
                               
                            };
                        } catch (IOException e) {
                            throw (RuntimeException) new RuntimeException( ).initCause( e );
                        }

                    }

                    @Override
                    public int size() {
                        try {
                            return ds.features(ft.getName().getLocalPart()).size();
                        } catch (IOException e) {
                            throw (RuntimeException) new RuntimeException( ).initCause( e );
                        }
                    }
                   
                };
            }
           
            protected FeatureStore<SimpleFeatureType, SimpleFeature> getFeatureStore() throws IOException {
                return (FeatureStore<SimpleFeatureType, SimpleFeature>) ds.getFeatureSource(ft.getName().getLocalPart());
            }

            public String getExtensionID() {
                return ""; //$NON-NLS-1$
            }
View Full Code Here

TOP

Related Classes of org.opengis.feature.simple.SimpleFeatureType

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.