[udig-devel] AbstractFeatureStore vs. UdigFeatureStore

Jesse Eichar jeichar at refractions.net
Thu Jul 19 10:35:20 PDT 2007


Hi,

Something is funny here because the mapEditor shouldn't have to be  
open for the layer to have a map.  Indeed as soon as the layer is  
added to the map it has a map.  I'll admit that there is some  
dependencies.  For example a layer isn't usable without a map.  There  
is a construct called Layer interceptors that run when a layer is  
created but I don't see how that could cause a problem...

Are you sure that you are not editing a layer before adding it to a map?

Jesse


On Jul 19, 2007, at 5:19 AM, tony.roth at GMX.de wrote:

> After switching to SDK 1.1RC10 I got an odd nullpointer exception  
> at removing features of a feature store.
>
> I use a temporary / memory based layer which is wrapped by a class  
> called LayerContainer. This class has some convenience methods for  
> changing the (SLD) style and for adding / removing objects like  
> this one:
>
> private void removeAllContent(){
>   FeatureStore fs = layer.getGeoRessource().resolve 
> (FeatureStore.class,null);
>   fs.removeFeaures(Filter.NONE);
> }
>
> Using SDK1.1RC8 the object "fs" is an AbstractFeatureStore. Using  
> SDK1.1RC10 it is an UDIGFeatureStore which calls the method  
> "setTransactionInternal" in every method which changes the set of  
> features. In setTransactionInternal this line fails in my application:
>
> Transaction transaction = ((EditManager)) layer.getMap 
> ().getEditManager()).getTransaction();
>
> layer.getMap() returns null
> getMap() invokes getMapInternal() invokes getContextModel() which  
> returns the eContainer (type: InternalObject) which is null
>
> I can only guess what happens: The the layer is manipulated  
> (adding / removing features) before the map is opened in a  
> MapEditor the first time. This is done since the user can "add  
> objects to map" in a perspective which has no visible map / no  
> MapEditor. The class LayerContainer is notified via eventmanagement  
> and adds / removes features. Under 1.1RC8 this doesn't matter since  
> another FeatureStore is used.
> (The map object is created before the layer is instanced.)
>
>
> what can I do?
>
> tony roth
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20070719/36579ee1/attachment-0001.html


More information about the udig-devel mailing list