[josm-dev] Painting (was: how does the transition to tested work ?)

Sebastian Klein bastikln at googlemail.com
Tue Mar 9 17:21:52 GMT 2010


Dirk Stöcker wrote:
> A class to display a subset of the database in an own widget would be
> very helpful! There are multiple places in JOSM were we could use 
> that. With lots of reworking done regarding data storage maybe it is
> possible to do that now. And best would be if selection does also 
> work for this.

Maybe a rework of the painting code could make it faster, as well. 
Currently for each "rubber-band" line a full repaint of the entire map 
is done. There is no caching, it just draws each object of each layer 
for every mouse move event.

Consequently the drawing is quite slow if you are in a crowded area. 
However this goes away if you zoom in enough.

Ironically we do unnecessary double buffering: It does not make a 
difference if you remove that offscreen buffer code in MapView.paint, 
except it is faster. (Apparently Swing does it's own double buffering 
unless you turn it off with setDoubleBuffered(false). This is on 
Linux/gnome, might be different for Windows and Mac.)

I think we should cache all static data (osm objects, gpx layers, photo 
layer, ...) in a static cache that has to be marked as "dirty" if a 
repaint is needed. (E.g. when an object was deleted or layer visibility 
was toggled)

Then the rest can be drawn on top like it is done now.


Repainting is especially annoying when zooming and panning in a large 
dataset. For zooming there is not much we can do about it, but for 
panning it might be possible to reuse parts of the buffer by translating 
it accordingly.

__

Sebastian




More information about the josm-dev mailing list