Quantcast

enable edit tool on layer from own datastore

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

enable edit tool on layer from own datastore

obindel1
This post has NOT been accepted by the mailing list yet.
i want to use the geometry edit tool to edit layer from my own datastore, but it always says that i cant edit this layer..choose another one.

how can i make them editable ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable edit tool on layer from own datastore

obindel1
This post has NOT been accepted by the mailing list yet.
thanks for the hints but i still dont got it: in my DataStore, i have

getFeatureSource(String typeName)

there i return my FeatureStore Object (which extends AbstractFeatureStore)

further in my GeoResourceImpl i got:

    public <T> boolean canResolve( Class<T> adaptee ) {
        if (adaptee == null) {
            return false;
        }
        return (adaptee.isAssignableFrom(IGeoResourceInfo.class) || adaptee.isAssignableFrom(FeatureStore.class)
                || adaptee.isAssignableFrom(FeatureSource.class)
                || adaptee.isAssignableFrom(SimpleFeatureSource.class)
                || adaptee.isAssignableFrom(IService.class) || adaptee
                .isAssignableFrom(Style.class)) || super.canResolve(adaptee);
    }

and:

public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor ) throws IOException {
        if (adaptee == null)
            return null;
.......
if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            FeatureSource<SimpleFeatureType, SimpleFeature> fs = parent.getDS().getFeatureSource(type);
                return adaptee.cast(fs);
        }

whats wrong ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable edit tool on layer from own datastore

obindel1
This post has NOT been accepted by the mailing list yet.
resolve() returns adaptee.cast(fs) for  LayerResource, there rawresource is MyFeatureStore.

here is MyFeatureStore btw:(my goal für now was just to get the edit tools enabled, later i would implement write operations ,MyDatastore works very well for reading the resources)
i am really stuck on this for days....


public class MyFeatureStore extends AbstractFeatureStore  {
        MyDatastore store;
        String typeName;
    SimpleFeatureType featureType;

        public MyFeatureStore (MyDatastore myDatastore, String typeName) {
                store = myDatastore;
                this.typeName = typeName;
        try {
                        featureType = store.getSchema( typeName );
                } catch (IOException e) {
                       
                        e.printStackTrace();
                }
        }

        @Override
        public DataStore getDataStore() {
                return store;
        }

        @Override
        public void addFeatureListener(FeatureListener arg0) {
                // TODO Auto-generated method stub
               
        }

        @Override
        public SimpleFeatureType getSchema() {
                return featureType;
        }

        @Override
        public void removeFeatureListener(FeatureListener arg0) {
                // TODO Auto-generated method stub
               
        }


}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable edit tool on layer from own datastore

obindel1
This post has NOT been accepted by the mailing list yet.
  if (fs instanceof SimpleFeatureStore) {
                return adaptee.cast(fs);
            }


this is true and it returns the casted object. i looked also trough the code of the ShapefileDatastore (which is editable) and it looks similar to mine. do you have got another idea or even a small hint where the problem could be ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable edit tool on layer from own datastore

obindel1
This post has NOT been accepted by the mailing list yet.
got it !
i used the wrong Geometry classes in the FeatureBuilder in my Datastore

i used org.opengis.geometry.primitive.Point.class
instead of
com.vividsolutions.jts.geom.Point.class

the wrong class can be displayed, but the edit tools are looking for the vividsolutions classes.
Loading...