It seems there is a necessity to create a kind of diagram (UML -based or
something else) where the communication between different interfaces and
their relationships are shown.

The main entities would be:

IService
IGeoResource
IMap
ILayer

DataStore
FeatureStore/FeatureSource
FeatureType
Feature

I try to outline some relationships between entities.

IMap (has 0..* ILayer)
        -ILayer
        -ILayer
        ...

ILayer (has 0..* IGeoResource) 
        -IGeoResource
        -IGeoResource
        ...

Usually ILayer contains only 1 IGeoResource such as ShpGeoResourceImpl.


IGeoResource is an abstraction - generally the proxy for geographical
resources (feature store, WMS layer... ). Real geographical
resources/features/whatever are usually behind this interface. IGeoResource
is a just wrapper over them for using inside of UDIG's Project model API.


IService (has 0..* IGeoResource)
        -IGeoResource
        -IGeoResource
        ...

IService is also abstraction. Consider IService as a host for
IGeoResource's. But the Catalog is a host for IService's.

ILayer is a layer on your map inside of UDIG. While WMSGeoResource , for
example, represents the layer of WMS connection/configuration.

IGeoResource is a primary thing related to ILayer. But it doesn't contain
any information, think about IGeoResource as a proxy to real source of
geographical information. The real container of information/features is a
DataStore. 

Here is main difference: IGeoResource is a kind of "layer" in the DataStore.
ILayer is a layer in User Interface and on the IMap. The real data is inside
of DataStore.

So , if you want to create a feature on the map.. let's look into the
workflow for shapefiles (pseudo - code)


Example  (with ShapefileDataStore).

if you want to create new features, you need to create a "container" for
them - appropriate datastore. Container needs to know what is the type of
features - let's create FeatureType where we describe attribute types, etc.

ShapefileDataStore.createSchema (FeatureType ) creates empty datastore with
specified FeatureType.

Then we get FeatureStore interface and add new features (they must conform
to the underlying FeatureType - i.e. schema of the datastore).

When features are added to the ShapefileDataStore, so forget about this
object - you just know the URL to the new shapefile (which you specified
when had been created ShapefileDataStore).

This URL is the only thing that IServiceFactory (ServiceFactoryImpl) needs
to create IService and IGeoResource (ShpServiceImpl and ShpGeoResourceImpl
actually).


Look into my examples how IServiceFactory creates List<IService>. From this
list you can get IGeoResource's and continue..


The problem that seems to confuse you.. IServiceFactory does work through
URL or Map<String, Serializable> parameters.. In case of shapefile the URL
is enough.. In other cases you should create map of parameters that the
appropriate IServiceExtention uses to create IService.

IServiceFactory  and IServiceExtention  framework avoids manual passing
reference of the existing DataStore as a parameter. It works through URL or
Map<String, Serializable> parameters. Usually creating DataStore and
manipulating features task is the standalone task. When the DataStore is
created, it must be described in a such way (through URL or Map<String,
Serializable>) that the appropriate IServiceExtention recognizes this
description to instantiate the appropriate IService object.


In case of MemoryDataStore there is no way to create instance of
MemoryDataStore and then create IService for it.  Here the approach is to
create directly MemoryServiceImpl and then to resolve MemoryDataStore (it
will be empty in the beginning - without FeatureType and features) and
create schema for it (FeatureType) and get IGeoResource..

If you want to create MemoryServiceImpl through IServiceFactory, look into
what parameters must be in Map<String, Serializable> in this method: 
        MemoryServiceImpl.createService(URL id, Map<String, Serializable>
params).

Then create such Map with parameters and pass in into IServiceFactory.


Hope, I described thingz in a right way, in spite of English is not my
native language :)

Just ask if something is not clear.

regards, Vitali.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:udig-devel-
> [EMAIL PROTECTED] On Behalf Of Adrian Custer
> Sent: Wednesday, March 01, 2006 2:11 AM
> To: User-friendly Desktop Internet GIS
> Subject: Re: [udig-devel] adding a feature to the current map
> 
> Hello all,
> 
> 
> Thanks for your help and pointers and what not. I'm still fundamentally
> missing the point of what's going on between having created a Feature
> and wanting to get that feature into a form that can be displayed by
> uDig. If someone could spell out generically what needs to happen, i.e.
> what the Iservices and friends actually are, that would certainly help
> me.
> 
> 
> Jesse, how and where in the code below does uDig learn about the
> underlying geometry? You create a featureType, and use that featureType
> to get an IGeoResource. Where does the actual feature get pulled into
> the data model? Right now, in neither your code nor in Vitali's, does
> uDig ever get a pointer to the actual feature. I've tried a few things
> like manually adding it to the datastore but those things don't work.
> 
> 
> On Tue, 2006-02-28 at 09:18 -0800, Jesse Eichar wrote:
> > DefaultFeatureTypeFactory ftFactory = new DefaultFeatureTypeFactory();
> > AttributeType at = AttributeTypeFactory.newAttributeType("geom",
> >     Polygon.class);
> > ftFactory.addType(at);
> > ftFactory.setName("myFeatureType");
> > FeatureType dbFeatureType = ftFactory.getFeatureType();
> > IGeoResource
> resourceĂŠtalogPlugin.getDefault().getLocalCatalog.createTempResource(
> dbFeatureType );
> > CreateMapCommand command=new CreateMapCommand( "New Map",
> Collections.singletonList(resource), null );
> > ApplicationGIS.getActiveProject( ).sendASync( command );
> >
> 
> thanks,
> adrian
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to