Re: [OpenMap Users] blinking/flicker reduction

From: Don Dietrick <dietrick@bbn.com>
Date: Wed Nov 06 2002 - 10:03:07 EST

Hi Kim,

On Tuesday, November 5, 2002, at 09:05 PM, Hamilton, Kimberly D. wrote:

> Hello,
> I have a layer that shows an aircraft flying over the map, and the
> layer
> asks the MapBean to constantly recenter at the aircraft (at intervals
> on the
> order of a second). A colleague asked what I could do to reduce the
> "blinking" effect (I'm not sure if this qualifies as flicker) that
> occurs
> when the Geopolitical layer is drawn -- in other words, the quick
> visible
> alternation between the Geopolitical layer and the blue background
> behind
> it.
>
> I've attempted double-buffering of the Geopolitical layer, which seems
> to
> have a more pronounced blinking than the normal version. Then I
> noticed
> that the BufferedMapBean paints all layers to a buffer, which would
> help
> explain why I can't improve performance through additional double
> buffering.
> Is this correct?

Yes.

> I also tried to find out if there's a way to cause the screen not to
> erased
> or cleared before drawing the new Geopolitical layer (just
> overwriting), in
> the hope that this would reduce the blinking delay, but I'm not sure
> how to
> do this. I read that overriding the update(graphics) method that is
> inherited from JComponent can achieve this, but I only saw this in
> reference
> to applets. I tried overriding the update method in various places
> and it
> never got called by anything.

The problem is not that the map is being cleared right away. The
MapBean doesn't clear itself, it just renders its children when they
ask to be redrawn via the repaint() method. This is probably what's
happening: the MapBean is getting a new projection and passing it on
to the layers - they react to the new projection and call repaint() on
themselves. Your top layer is probably ready before the political
boundary layer, and when the MapBean paints all the layers the
political layer isn't ready yet and draws nothing - so you get the
background (blue) and your top layer. When the political boundary is
ready, it calls repaint(), too and then you get all the layers painted
again.

You might be able to get rid of this effect by not calling repaint() on
your top layer when a new projection is received on it and just assume
that another layer will take care of calling repaint() on itself. You
would still call repaint on your layer if something else changed on it,
but just not as a result of a projectionChanged() call.

> Perhaps everything that can be done to reduce the delay has been done
> and
> this flicker is simply a delay resulting from copying the buffered
> image to
> the screen?

No, the buffer repaint it pretty fast - the delay is the time to
regather and reproject the political layer. You might want to try
using the BufferedShapeLayer or the EsriPlugIn to show the political
data, as they read in the entire shape file once and reuse the
graphics. The ShapeLayer re-reads the graphics from the file every
time, and limits how much memory is used for the map to as low as it
can get away with. If you use the other two things, the delay would be
reduced to just the time to reproject (generate).

Hope this helps,

Don

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Nov 6 10:06:12 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT