Re: animation and erasing

From: Donald Dietrick <dietrick@bbn.com>
Date: Fri Jan 04 2002 - 12:23:29 EST

Hi George,

I wanted to think about this a little before jumping in on it. It's a
good question.

On Friday, December 28, 2001, at 05:07 PM, George Uecker wrote:

> Hi all,
>
> I am currently using OpenMap as the basis for a radar maintenance
> (non-tactical) display application. I'm using a specialized
> LocationLayer to display radar contacts and track gates. Each layer
> has its own specialized LocationHandler that receives data from the
> radar processor box via the network.
>
> Contacts are displayed as tiny color-coded OMRect objects. Track gates
> (bounded regions) are just specialized OMPoly objects. I have modified
> my version of the LocationLayer to call update() instead of repaint()
> so that new data is drawn without clearing the screen. Each
> LocationHandler uses a Swing timer to update the screen about 30 times
> per second. It looks pretty cool in spite of the inevitable pauses for
> garbage collection, etc.

I'm not sure how you are drawing new data without clearing the screen.
Are you saving a copy of the Graphics object that was provided in the
last paint() method?

> The user has the ability to clear the screen manually when it becomes
> saturated with contacts, but ideally I would like to set a limit on the
> number of scans to be displayed at any one time. Then I will actively
> erase any contacts older than that limit. Similarly, only the most
> recent track gates are valid, so gates from the previous scan need to
> be erased to avoid cluttering the display.
>
> Here's my question: how do I erase an OMGraphic without repainting the
> entire screen and without disturbing the underlying political map
> layer(s)? This display is much too dynamic to be repainted continually.

I've had an idea about having a BackgroundLayer that works like a
BufferedMapBean, maintaining an image buffer for a set of layers
underneath the action, and greatly reducing the amount of work needed
for rendering the other layers. I haven't written anything yet.

> I have tried bypassing the paint() mechanism and rendering the
> OMGraphics manually in XOR mode, which works but has two main
> drawbacks. Namely, I can't control colors in XOR mode, and any parts of
> two OMGraphics that overlap will negate each other, resulting in a
> blank spot.
>
> I have considered repainting using a small clipping region around each
> OMGraphic, but I assume that would also disturb the underlying layers?

Only if the other layers are changing their graphics outside the
clipping area. If they aren't changing, then it shouldn't be an issue.

> I understand that the way this is often done in X-windows is to declare
> two sets of bitplanes. The static background (map) is drawn into the
> underlay planes and the dynamic drawing is done in the overlay planes.
> Just wondering if anybody has any suggestions for how to achieve the
> same effect in Java within the framework of OpenMap...

I played around with the different panes in a window when I was writing
the drawing tool. While it worked as well as the XOR mode that is used
now, it was hard to get the extents of the other panes (like the glass
pane) to be limited to render stuff only over the MapBean within its
border.

There is this Sun tutorial that may provide more help with using panes:

http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

It looks like there should be a way to set the MapBean to be able to use
a JFrame's LayeredPane to really increase performance for animation.

...

Jeez louise. It looks like a JLayeredPane could be integrated into the
MapBean and handle this pretty well
(http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/
LayeredPaneDemo.java). This should definitely be played with, to see
how well or if the java double buffering would automatically speed up
general repaints, by individually buffering different layers in the
JLayeredPane. There may be some mouse event management that needs to be
taken care of, and some other things that would need to be changed in
the MapBean to manage the size of the LayeredPane and the distribution
of the layers into the different levels. Hmmm....

Well, I hope this helps,

Don

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Fri Jan 4 12:20:42 2002

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