On Wednesday, 16 February 2011 at 10:50 PM, Francisco Javier García González wrote:
Hello all,
I am using uDig 1.2 .0 and we have a layer that
shows a raster image (png) from a url.
Okay.
The point is that every time we make a zoom
or scroll we remove the layer from layers and we create another with the new georesource
but that is gradually increasing the memory until it consumes all.
Oh wow; you need to look at the rendering api. Make a custom renderer for your resource; that will request the correct png for the current zoom/scale etc.
We tried to create and assign georesources directly to the layer with layer.setGeoResource(IGeoResource),
but the layer displays the old resource.
You would also need to kick the rendering system a bit so it notices that you have changed things. For feature store there is a listener that will trigger the rendering system to look at the resource again and draw if needed. For your magic resource we will need to figure out another way.
On the one
hand, how can I go removing memory? and the
other, is there to do something
else to replace the georesource only with layer.setGeoResource?
Memory management is done as per java; I would use a profiler to see what is holding on to memory in order to make plans.
This is the point where I would love you to contact Camp2Camp or Axios and take the training course to look into renderers in detail (see http://udig.refractions.net/users/ for contact info). Perhaps they could arrange a one day course to cover the disk to screen materials for you?
The source code for the training course is is version control (http://udig.refractions.net/confluence/display/DEV/2+Training+Materials); and I would ask that you review the code for csv georesrouce, csv renderer and style.
Jody