Re: [OpenMap Users] Too many re-draws (again)

From: Don Dietrick <>
Date: Fri, 7 Oct 2005 17:08:10 -0400

Hi Michael,

On Oct 7, 2005, at 6:35 AM, Dr. Michael Paus wrote:

> Hi all,
> I am currently struggeling with an OpenMap application with lots of
> layers
> which shows a very bad overall performance in the sense that after a
> projection change all layers are repainted but in such an
> uncoordinated
> way that many layers have to be painted several times until the
> application fianlly comes to a rest. I have seen complaints about this
> effect from other users before but I still have not found any solution
> proposal.

What kind of layers are you using, and how many OMGraphics are being
drawn on them. Any information about their behavior, in terms of how
much work they need to do to react to projection changes? Do you
know if any of your layers are doing work in their paint() method,
other than just rendering their map objects?

> I would like to do some of the following things:

Just as a general observation, you could achieve these goals by
modifying the MapBean's MapBeanRepaintPolicy object. The
StandardMapBeanRepaintPolicy just forwards Layer.repaint() requests
on to the Swing queue. You can substitute a different policy in the
MapBean if you like.

There are a couple of caveats with your requirements below:

> - Do not redraw until all layers are ready with their prepare().

There is no contract that guarantees that a Layer will have a prepare
() method. The () method is an OMGraphicHandlerMethod, so you
should make sure all of your layers have one before you assume that
it is there.

Also, there is no contract that binds a Layer to only call repaint()
when it's ready to react to a projection change. Layers are free to
call repaint() on themselves when they feel that they have updates on
the map. This may not apply to your layers.

> - Paint all layers in the correct order so that no layer has to be
> painted twice.

Using a BufferedImageRenderPolicy on an OMGraphicHandlerLayer will
cause it to paint it's OMGraphics in a buffer, making repaints
faster. You can set the repaint policy in the properties for a layer.

> - Do some more optimizations, e.g. if a raster layer covers the
> whole window
> there is no point in preparing and painting any layer below it.

There's no real way to ask a Layer if it's a raster layer, in a
general sense, and there's not really a way to ask it if it covers
all layers below it. There could be transparency issues that may
make this a difficult condition to measure in a general way. You
could write some layers that work with the MapBeanRepaintPolicy to
handle these optimizations for you.

Hope this helps,


Don Dietrick,
BBN Technologies, Cambridge, MA

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Oct 07 2005 - 17:10:31 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT