Hi All,

I have been developing an Eclipse RCP application based on uDig plugins. I have discovered a bug in the way ExternalGraphic images are loaded by the StreamingRenderer when rendering a layer with more than approx. 150 features and lots of SLD rules.

Now, clarification time:
  • The layer is a WFS layer
  • It's data source has about 200 features in it at the moment, although the issue appears randomly as the numbers increase from 0
  • The SLD has around 8 rules in it, each one displaying a different icon of 25x25 depending on filtering of attributes of each feature
  • Each time the application is run the map is rendered with different outcomes:
    • One of the icons may not load (meaning that multiple features of the same type do not render)
    • Multiple icons may not display (meaning that multiple features of the same type do not render)
    • One of the icons may be loaded for two or more other icons (meaning that every feature can be rendered, but with the wrong icon)
My findings:
  • org.geotools.renderer.style.SLDStyleFactory contains a static instace of org.geotools.renderer.style.ImageLoader
  • That image loader is used to load ExternalGraphic images from SLDStyleFactory.getImage(ExternalGraphic, int)
  • ImageLoader caches loaded images and will return an existing instance if it has already been loaded
  • If it has not been loaded, it will then spawn a new Thread with itself as the Runnable
  • The thread then loads the image with the help of a static instance of a java.awt.MediaTracker
  • Sometimes when the get method is called multiple times it is likely that the cache gets set with a null value for the url key and that is always returned, even though the logging shows that the image loaded correctly
  • Loading images from http:// (remote server) or file:// urls makes no difference to the problem (ie, latency/loading time isn't a factor)
  • Making the ImageLoader.get(URL, boolean) method synchronized fixes all the image loading problems

Adding the "synchronized" to the method certainly works, but I am not clear on the performance impact this may have if the number of features is very large. It does not seem to affect our application significantly enough to notice, based on several hundred features. It would pay for someone to put some thought around what other components use this mechanism for loading images, as I have not got as deep as how the render actually works.

As this is based on uDig 1.1.x plugins, this problem exists in the 2.2.x branch. I don't know whether it has been resolved in the latest code.

I have attached a log file which shows the Level.FINEST output for the logger used by ImageLoader class. In this case only 2 out of 3 (or 4) images loaded correctly. The rest of the time the get() method returns null for the features of that type.

If you would like me to create a bug report for this I can; if someone who has commit on the project would prefer to do this they might be able to provide a deeper analysis of the problem. If someone does create a bug report can they please forward me the link so that I can show our client the status of things, otherwise I will raise one.

Thanks,
Mark
-- 
Mark Presling
Argonaut Ltd
PO Box 5630
Level 1, 85 The Terrace
Wellington
New Zealand
Mobile: 021-549540
Email: [EMAIL PROTECTED]
Phone: 04-4723047


--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.
begin:vcard
fn:Mark Presling
n:Presling;Mark
org:Argonaut
adr:85 The Terrace;;Level 1;Wellington;;;New Zealand
email;internet:[EMAIL PROTECTED]
title:Consultant
tel;work:(04) 4723047
tel;cell:(021) 549540
url:http://www.argonautltd.co.nz
version:2.1
end:vcard

Reply via email to