You should pass around the FeatureSource (ie that is what communicates
events - and you can make queries against it etc...).

Your VectorDataNode should have the feature source (and the query even if
it is Query.ALL to get all the content) - it can use
featureSource.addFeatureListener(FeatureListener listener) to be told about
any changes.

--
Jody Garnett

On 31 January 2017 at 11:30, Marco Peters <marco.pet...@brockmann-consult.de
> wrote:

> Finally, I found some time to look into this again.
>
>
>
> The features are coming from somewhere. Either from a file, from a server
> or created manually by the user. And even if read from a file users can
> manipulate them.
>
>
>
> At the certain source code location, I get a 
> FeatureCollection<SimpleFeatureType,
> SimpleFeature> collection as parameter and want to listen for changes on
> it.
>
> Here is the code for GeoTools 2.7.4:
>
> https://github.com/senbox-org/snap-engine/blob/
> 85c77bae7fb59a63abc475d9cae0321c4f30f886/snap-core/src/main/
> java/org/esa/snap/core/datamodel/VectorDataNode.java#L101-L117
>
> This worked pretty well.
>
>
>
> And this is the code what I have now tried. I think it looks a bit
> confused:
>
> https://github.com/senbox-org/snap-engine/blob/
> 25d1e21a294ee16506d69475386d64b053a83027/snap-core/src/main/
> java/org/esa/snap/core/datamodel/VectorDataNode.java#L103-L113
>
>
>
> Maybe I should do it totally different? Maybe not passing around a
> FeatureCollection but a FeatureStore?
>
>
>
> Thanks
>
>   Marco
>
>
>
>
>
>
>
>
>
> *Von:* Jody Garnett [mailto:jody.garn...@gmail.com]
> *Gesendet:* Donnerstag, 26. Januar 2017 20:05
>
> *An:* Marco Peters <marco.pet...@brockmann-consult.de>
> *Cc:* GeoTools Users <geotools-gt2-users@lists.sourceforge.net>
> *Betreff:* Re: [Geotools-gt2-users] Lost functionality in FeatureEvent?
>
>
>
> You should be able to listen to the FeatureSource for changes; that is
> where the edits are happening (sometimes for several threads at once
> etc...).
>
>
>
> You are correct that CollectionFeatureSource is very simple and more for
> staging static data for display. I guess I am surprised, it feels like you
> are staging this data in memory ... for interactive feedback on a map?
>
>
>
> Can we roll back -  where did you get your data from? Did you copy it out
> of something into a DefaultFeatureCollection?
>
>
>
>
> --
>
> Jody Garnett
>
>
>
> On 25 January 2017 at 07:07, Marco Peters <marco.peters@brockmann-
> consult.de> wrote:
>
> Thanks Jody. Now I have a follow up question.
>
> How can I follow changes in a FeatureCollection.
>
> I can’t add a listener, also not if I wrap it in a DefaultFeatureCollection.
>
> I can put it in a CollectionFeatureSource and add a FeatureListener but 
> CollectionFeatureSource does not fire any event.
>
>
>
> I searched the documentation and the source code repository but haven’t found 
> a solution for it.
>
> But I’m sure it is somewhere. At least, I want to believe…
>
>
>
> Marco
>
>
>
>
>
> *Von:* Jody Garnett [mailto:jody.garn...@gmail.com]
> *Gesendet:* Freitag, 20. Januar 2017 23:55
> *An:* Marco Peters <marco.pet...@brockmann-consult.de>
> *Cc:* GeoTools Users <geotools-gt2-users@lists.sourceforge.net>
> *Betreff:* Re: [Geotools-gt2-users] Lost functionality in FeatureEvent?
>
>
>
> Excellent Marco; and that filter should be an Id filter with a list of
> modified feature ids.
>
>
>
> One reason for this change (which is quite annoying / subtle) is that some
> datastores (like WFS) do not assign a final FeatureID until after commit is
> called. In the WFS client case it needs to send the Transaction request to
> the WFS, get the result back, parse the feature ids out of the result, and
> let you know about them in an event.
>
>
> --
>
> Jody Garnett
>
>
>
> On 20 January 2017 at 03:58, Marco Peters <marco.peters@brockmann-
> consult.de> wrote:
>
> Seems I found the answer myself.
>
> FeatureEvent.getFilter() returns a filter to get the changed features from
> the source.
>
>
>
>
>
> *Von:* Marco Peters [mailto:marco.pet...@brockmann-consult.de]
> *Gesendet:* Donnerstag, 19. Januar 2017 17:18
> *An:* geotools-gt2-users@lists.sourceforge.net
> *Betreff:* [Geotools-gt2-users] Lost functionality in FeatureEvent?
>
>
>
> Currently I try to update my GeoTools dependencies from 2.7.4 to 16.1.
> Yes, I know I’m late.
>
> However, I noticed a possible loss of functionality. As CollectionEvent is
> replaced FeatureEvent I have no chance anymore to find out which features
> have been removed or added. In CollectionEvent they were available by
> getFeatures(). My question, is there another way of obtaining these
> features?
>
>
>
> By the way, is there may be a changelog which summarises the API changes
> from version to version? This would be helpful now.
>
>
>
> Ciao
>
>   Marco
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to