On 13-Mar-06, at 3:45 AM, Adrian Custer wrote:

Hey all,

Thanks to you all for putting up with my rants and thanks to those who
answered. I now have a very primitive way to buffer a point layer in its
native coordinate space. Cool and thanks.


Questions:
1) What's the correct way to create a memoryDataSTore? Right now I'm
using:

MemoryServiceImpl service = new MemoryServiceImpl(MemoryService.URL);
// This uses the MemoryServiceImpl to get a dataStore. The MSImpl 
// creates an empty dataStore and registers it with the Catalog.
AnotherMemoryDataStore dataStore =
        service.resolve(AnotherMemoryDataStore.class,
        new NullProgressMonitor());
dataStore.createSchema(myBufferFT);
dataStore.addFeature(myBufferF);

but eclipse complains that I'm using a 'discouraged' method to access
the MemoryServiceImpl and AnotherMemoryDataStore. Not sure the right
strategy to follow for this.

The catalog API has a method for creating "temporary georesources" such as a memoryDatastore.   

The method is something like:
CatalogPlugin.getDefault().getLocalCatalog().createTemporaryResource( featureType );

this method will return a IGeoResource that backs onto a MemoryDatastore.  Once you have the georesource you can do the normal things such as get a FeatureStore from the IGeoResource  and add features to the layer using the feature store...  Remember that FeatureStores obtained from a IGeoResource uses AUTOCOMMIT, not a transaction like layers.  

2) What's the elegant/correct way to bail out of an operation if I get
to a point where something doesn't resolve or some other assertion
fails?

Make sure you close all you resources (file handlers, readers/writers etc... ) and return.  The framework doesn't really care as long as you clean up after yourself.  You can use the enablement element of the  the operation extension declaration to ensure that the operation will only be enabled for certain resources.
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to