WPF, Rendering, caching and design - advice needed

Topics: SharpMap v2.0
Nov 25, 2007 at 3:01 PM
Edited Nov 26, 2007 at 6:33 AM
Hi all,
As I hope to start working soon on improving the WPF rendering / presentation modules, and making them a bit more mature components, I would like to siscuss some cache-related design issues.
Any other remarks, ideas, whatever..., about the my WPF initial implementation will also be very welcomed.

There are two basic variants I can see, with respect to rendering caching implementation. They can be done separately, or combined (assuming there's no help from the core SharpMap):

1. Have the rendering layer do the caching at the geometry level.


  • Nicely decoupled from the presentation layer, hence can be replaced without affecting the presentation.
  • Same cached geometries can be reused by different views.


Caching policy doesn't have too much "application specific" knowledge in order to manage scavenging, or to optimize retrieval time e.g. the rendering layer isn't usually aware of "layers", thus removing a layer from a map cannot immediately revoke all its cached geometries. Also, rendering is done many times layer by layer, which could be utilized to build an efficient cache retrieval strategy.
Possible solution is to make the renderer "layer aware", but sounds to me as quite bad and too coupled design.

2. Do the caching at the presenter layer.

There are actually two sub-alternatives, different in the entity being cached – a rendered feature or a rendered (and translated to WPF Drawing) geometry. Each has its own obvious merits which I won't delve into here.
The pros and cons here are basically opposite to option 1.
So what do people think?
Nov 28, 2007 at 2:07 PM
Hi blackrussian!

The first question is, what really should be cached to acheave the most possible performance improvement. As i can think, the first opinion is only a substep of the second.

The second question is the possible memory consumption in regard to overall system performance which can be dramatically decreased if we use some big system objects like bitmaps. In my opinion WPF can give us some very helpful advantages over GDI/GDI+ because we don't need to render the whole bitmap and store only WPF-Objects in the scene managed by WPF Rendering Layer. In this case we use the rendering performance and possibilities of WPF subsystem; then if they ok we are also on the winning side. The next advantage is probably WPF can done zooming and panning fully decoupled from our own cache logic. WWill say: caching of rendered (and translated to WPF Drawing) geometry is probably build in on top of WPF system.

The most interested things is probably the building of tiling strategie for big maps.