Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Tiled Rendering and Mapgraphics Again

I agree I need to listen to layer.refresh() "events" but I don't believe there are any events fired with layer.refresh() is called. Maybe I'm missing something.


Jody Garnett wrote:
On Thu, Mar 5, 2009 at 11:01 AM, Emily Gouge <egouge@xxxxxxxxxxxxxxx> wrote:

Hey Jody,

What I have done is update the Mapgraphic Renderer to render the entire
viewport onto a single image.  This image is then stored on the layer
blackboard and used when rendering tiles.  When the tile comes along to
render the mapgraphic the image is taken off the blackboard and the part
that matches the tiles bounds are clipped and drawn.


Yeah cool - I like that approach - nice work. If we are smart when we define
MapGraphic2 we may be able to define a smaller image (along with the screen
location the image should be drawn in).

We may also find it useful to split up ScreenGraphic from MapGraphic (and
have screen graphic always work in screen coords; and MapGraphic work in
some data coords (we could default to DefaultGeoGraphicCRS.WGS84 to make
examples easy to write).

In anycase I like the approach you describe.

In order to make this work; when the mapgraphic context is created a
viewport listener is added to the map so when the viewport bounds change the
image cached on the layer's blackboard is cleared.


Smart. You could also consider using the MapGraphicRenderer - because it is
a Renderer it has lifecycle methods (ie is stateful) and you can add/remove
your viewport listener there.

The issues with the styling is not that layer.refresh() is not being called
but rather that this doesn't cause my "cached" mapgraphic image on the
blackboard to be cleared.


I see so we have one step remaining to do ... when the MapGraphicRenderer
 gets a layer refresh event it needs to clear this image. It is the Renderer
that would have this responsibility rather than the MapGraphic
implementations themselves.

That is the next step right? Am I missing something?


A simple solution would be do not cache this image; but I can't imagine
that would be very good performance wise as it would be rendering the image
multiple times.


Agreed.

I could add another listener that listeners for style events and clears the
cache.


Apparently I am not missing something; you have the same idea - I would
listen to layer.refresh events rather than style events. Style change events
trigger a layer refresh event do they not?

Or maybe I could store information about the styles with my cached image
and if they have changed then refresh the cached mapgraphic.


The style blackboard provides the notification; many of the style objects
are just simple data structures (and thus hard to watch change).

Cheers,
Jody



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

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


Back to the top