Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] New IService?

I just did something similar for a commercial project (the shapefiles were included with the plugin). So your approach is known to work :-) Basically make a new IService (it need not resolve to a DataStore); and for each member use a ShapefileDataStore to aquire the FeatureSource / FeatureStore as needed. No code well *know* that these are shapefiles; they will just show up as normal data.

In a plugin I'm writing, I have a set of standard shapefiles. The location of these files can change (the user has to set some preferences to tell the plugin where to look) but the set of files is fixed by the plugin - the list may change with future plugin versions. These files will be used by an "Add standard layers to map..." type command, but I'd like also to put them in the catalog for searching and selection - without adding the full path to the individual shapefiles (it might keep changing).

Making any sense?

Anyway, looking through the wiki my first idea was to create a new IService. This could find the folder location from preferences and hard-code the list of filenames. Then it should be able to return a list of the actual shapefiles. Does this look like the right way to go?

If it is - I have some questions...
- Is there an easy way to wrap a shapefile as an IGeoResource to return from the IService?
Just do it :-) You can use the existing ShpGeoResource implementation as an example.
- How do I make this IService available to the local catalog?
There is a service extension to declare you have an IService at all; you can also define a plugin activator that adds your service to the catalog. The map graphics plugin uses this trick to always be in the catalog.
Thanks for any help.
No worries; if you do this as a community module we can use it as an example for the next person :-)
Jody


Back to the top