Thanks for the quick reply Andrea.
I just took a look at the Layer API and I don't see any means to have the
layer repaint. Do you know the API that cause this to happen?
From: andrea.aime@... [mailto:andrea.aime@...] On Behalf Of
Sent: Thursday, August 22, 2013 11:03 AM
To: David Purdy
Subject: Re: [Geotools-gt2-users] Geotools 8.0 to 9.4 difference with
SimpleFeatureCollection and Map refresh
On Thu, Aug 22, 2013 at 4:28 PM, David Purdy <david.purdy@...>
I updated my Geotools version from 8.0 to 9.4 and had to change the way I
was displaying points on a map. My application allows a user to plot points
to the map continuously. In Geotools 8.0, if user chooses to do this, I
create a Layer:
pointCollection = new SimpleFeatureCollection();
Style style = SLD.createPointStyle("circle", selectedColor, selectedColor,
Layer layer = new FeatureLayer(pointCollection, style);
When a new point comes in the code adds the Point to the "pointCollection"
above and the map would automatically get refreshed (would see the map
flicker with the update). Since the upgrade to Geotools 9.4, I needed to
change the use of SimpleFeatureCollection to a DefaultFeatureCollection.
When the new Point gets added to that collection the map does not get
refreshed. So, the point does not appear on the screen until the user
interacts with the map (like zoom in, zoom out, resize window, etc). Is
this an expected behavior? Is there some other refresh capability that I am
missing? Is there another Collection I should be using?
I believe that functionality was based on the feature collection events,
which were dropped because
only in memory collections actually implemented them (after several years
they were introduced).
So with the current code you should force the layer to repaint as you modify
the collection contents,
I guess you can have either your own implementation that throws events and
your custom code
that catches them and forces the GUI to repaint
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
Ing. Andrea Aime
Via Poggio alle Viti 1187
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549