From: Paul Spencer <spencer@dm...> - 2002-10-04 21:33:08
I have discovered another weakness in the current implementation of
display lists. It shouldn't affect anyone at Atlantis (yet :)) but it
When any ogrfs tool is drawn at an offset (i.e. label), the offset is
specified in pixels. gvshapeslayer converts the current point (in
geographic coordinates) to pixel coordinates, applies the offset and
converts back to determine where to draw the tool. This works (or
worked) fine when the locations were calculated on every draw. However,
when using the current display list implementation, the offset gets
bigger or smaller as you zoom in/out, which is not the desired effect.
Note this only affects you if you use offsets, not if you display at
the exact location of the point.
That's the problem. I see some possible solutions, perhaps there are
some I haven't considered. Feedback on my or other solutions would be
1. discard the display lists. This is undesirable since display lists
should result in at least some performance benefit on most platforms.
2. invalidate the display list if a zoom happens. This is undesirable
since the benefit of the display list would be lost.
3. draw some things outside of the display list. This would involve a
post-draw cache that would get executed separately from the display list.
4. break down the rendering into many smaller display lists and don't
put things with offsets in a display list.
5. it is not possible to change a display list once created. However,
it is possible to nest display lists. We could nest display lists for
labels and symbols, and re-create them if a zoom happens. As long as
you use the same name (number) then it works as if you had a mutable
display list (at least, according to my book ;) )
I think the best solution would be to implement option 5 above. This
might involve some juggling, but essentially a flag would be set when
the view-state-changed signal is emitted. When the layer is re-drawn,
it would detect that the view-state-changed flag was set and would
re-draw any symbols or labels that were in their own display lists.
Then the display list for the layer could be executed as a whole.
Applications and Software Development
DM Solutions Group