[udig-devel] change new feature

Jesse Eichar jeichar at refractions.net
Mon Dec 17 21:01:40 PST 2007


Wait a minute....  You're on Trunk...  Wow brave man :).  I completely  
missed that until now.  You probably know by now but Geotools trunk  
(and therefore uDig trunk) have gone through some major change with  
regards to filters and features.  So I'm not surprised there are bugs.

I'm having problems reproducing the issue.  I'm working on a  
Shapefile, so maybe that is my problem.  I've attached a plugin with 2  
operations the first adds a couple of features via the  
AddFeatureCommand.  and the second is called modify and it prints out  
what it gets from the AddFeaturecommand.getNewFeature.  It is really  
stupid code but it is my understanding of what you are reporting.  If  
you can try it out or maybe change it so it produces your bug I'd  
really appreciate it.





Jesse



On 5-Nov-07, at 10:32 AM, Piebe de Vries wrote:

> Since nobody reacted, I just give my own answer:
>
> The bug can be found in AddFeatureCommand.getNewFeature
> If I understand this method rightly, it should return the latest new  
> feature. I put in some system.out messages and as you can see it  
> will return the first new feature and not the latest:
>
> looking for fid = newbsbb:redlining_effectzones.9223372036854775798  
> in:
> fid = newbsbb:redlining_effectzones.9223372036854775807
> fid = newbsbb:redlining_effectzones.9223372036854775806
> fid = newbsbb:redlining_effectzones.9223372036854775805
> fid = newbsbb:redlining_effectzones.9223372036854775804
> fid = newbsbb:redlining_effectzones.9223372036854775803
> fid = newbsbb:redlining_effectzones.9223372036854775802
> fid = newbsbb:redlining_effectzones.9223372036854775801
> fid = newbsbb:redlining_effectzones.9223372036854775800
> fid = newbsbb:redlining_effectzones.9223372036854775799
> fid = newbsbb:redlining_effectzones.9223372036854775798
> returning = newbsbb:redlining_effectzones.9223372036854775807
>
> I think the following two lines are supposed to only return one  
> feature with featureId=fid ?
>
> FilterFactory filterFactory =  
> CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
> FeatureCollection features = resource.getFeatures(filterFactory.id(
>                     FeatureUtils.stringToId(filterFactory, fid)));
>
> apparently this is not working, the whole list with features above  
> was returned. I do not know whether this is specific for the WFS  
> layer I am using or the case in general.
>
> Anyway I quickly coded my own filter and things started to work like  
> they should.
>
> cheers,
>  Piebe
>
>
>
>
>
>
>
>
>
>
>
>
>
> Piebe de Vries wrote:
>>
>> I tried two approaches to programatically adjust a feature that has  
>> been newly added by the user.
>> listening as IEditManagerListener to the editmanager
>> and by the editFeatureChanged event
>> I suppose both do more or less the same. Both do not work for me.
>>
>> The first feature added by the user is no problem, I can adjust  
>> some of its values. If the user commits directly after adding the  
>> first feature, the second added feature is no problem either.  
>> However if the user does not commit before adding the second  
>> feature, the events do fire properly but the they contain the first  
>> added feature and not the latest added one. As a result the program  
>> is adjusting the wrong feature.
>>
>> I suppose this is a bug? If not can somebody explain me how to get  
>> the latest added feature. And if it is a bug, is there a way around  
>> for the moment? ( I tried to programmatically commit the feature  
>> after I receive this event, this works but the feature is no longer  
>> visible until the user does an action that refreshes the display)
>>
>> thanks,
>> Piebe
>>
>>
>>
>
>
> -- 
> ---------------------------	----------------------------
>   Piebe de Vries		  piebe.de.vries at geodan.nl
>   Geodan IT b.v.		  Tel: +31 (0)73 - 6925 151
>   President Kennedylaan 1	  Fax: +31 (0)73 - 5711 333
>   1079 MB Amsterdam (NL)	  http://www.geodan.nl
> ---------------------------	----------------------------
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

-------------- next part --------------
Skipped content of type multipart/mixed


More information about the udig-devel mailing list