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: [email protected] [mailto:[email protected]] On Behalf Of
Andrea Aime
Sent: Thursday, August 22, 2013 11:03 AM
To: David Purdy
Cc: [email protected]
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 <[email protected]>
wrote:

Hi All,

 

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,
1.0f, 3.0f);

Layer layer = new FeatureLayer(pointCollection, style);

map.layers().add(layerIndex, layer);

 

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

 

Cheers

Andrea

 

-- 

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

==

 

Ing. Andrea Aime 

@geowolf

Technical Lead

 

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054  Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39  339 8844549

 

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

 

-------------------------------------------------------

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to