Re: Expensive OMGraphicHandlerLayer.repaint();

From: George Uecker <george.uecker@dot21rts.com>
Date: Thu Sep 05 2002 - 13:52:32 EDT

Hi Sunny,

I have a similar application that repaints a number of layers at 8 Hz on
a 500 MHz Intel x86 PC and it works OK. I use several techniques to
optimize performance:

1. Since I have multiple dynamic layers, I included another invisible
layer whose main job is to synchronize repaints for the other layers.
 This minimizes the number of calls to repaint().

2. My application is a radar display, and since the radar sweep is only
active in one area of the screen at a given time, I use clipping areas
to minimize the portion of the screen that has to be repainted. You can
do this using repaint( x1, y1, x2, y2 ) instead of plain old repaint().

3. Make sure you are using the BufferedMapBean instead of the plain
MapBean. BufferedMapBean forces layers to draw their graphics into an
image buffer that gets blitted to the screen all at once when the AWT
does the next redraw.

4. If you have a lot of dynamic objects, you might consider using an
OMPoly for your triangles instead of an OMBitMap, but I don't know
exactly how much difference that would make - just a suggestion.

5. Make sure that you only call generate() on your OMGraphics A.) when
they are created and B.) when the projection changes. If you have lots
of OMGraphics and you call generate() every time you call render(), it
really slows things down, and it's unnecessary.

You can take all of this with a grain of salt since I don't use the
OMGraphicHandlerLayer and I don't know anything about it.

You could also try running your app on a Windows PC to see how it
performs on different hardware running a different Java VM.

I also recommend that you download a trial version of OptimizeIt
<http://www.borland.com/optimizeit/> and profile your application for
performance bottlenecks. It's a great tool.

Hope this helps,

George

Shih-Hung Lin wrote:

>I finally have my application up and running. I appreciate Don's hint to make my
>work easy. I, however, couldn't tune up the performance. The real time back end,
>a propitiatory legacy system written in C, provides a set of data through a socket
>every 200 ms in my current design. In other words, my application need to update
>the layer at the rate of 5 Hz to provide satisfactory smooth movement. In two
>simple case experiments, a dynamic object moving around and none at all, the
>method OMGraphicHandlerLayer.repaint() consumes almost all CPU time (I have a Sun
>workstation running at 450 MHz). Did I do anything wrong? Or, is that the nature
>of repaint()?
>
>This is my current setup. The layer is a subclass of OMGraphicHandlerLayer. I
>use a triangle (OMBitmap) with a label (OMText) to represent the location and
>direction for each dynamic object. These two were stored in an OMGraphicList.
>Repaint() is called in every 200 ms to update the layer. Is there any more
>efficient way to achieve the same goal?
>
>-Sunny
>
>Don Dietrick wrote:
>
>>Hi Sunny,
>>
>>You have a number of options here, and most of them involve getting
>>access to the MapHandler. Once you have the MapHandler, you can pretty
>>much get to any component.
>>
>>Using the MapHandler, you can location the LayerHandler, get it's
>>layers, and iterate through them to find your layer.
>>
>>Alternatively, the Layer class has a property, addToBeanContext, that
>>is false by default (layers are isolated from the MapHandler by
>>default). If you set that to true in the properties file, the layer
>>will be added directly to the MapHandler, and you can iterate through
>>the MapHandler objects to find your layer.
>>
>>You could have your back-end create the layer and add it to the
>>MapHandler, where the LayerHandler will pick it up to add it to the map
>>(if it's visible). You wouldn't need to define layer properties for it
>>at all in that case.
>>
>>Lastly, with the next version of OpenMap due out shortly, the
>>com.bbn.openmap.plugin.graphicLoader.GraphicLoader interface has been
>>formally defined as an object that provides OMGraphics on it's own
>>schedule (the graphicLoader package and pilot package have been
>>adjusted accordingly). If a GraphicLoader (which is what your back-end
>>basically is) gets added to the MapHandler (say, by defining it in the
>>openmap.components property or whatever), the LayerHandler has been
>>updated to create a GraphicLoaderPlugIn/PlugInLayer combination to
>>display its graphics.
>>
>>Hope this helps,
>>
>>Don
>>
>>On Wednesday, September 4, 2002, at 11:28 AM, Shih-Hung Lin wrote:
>>
>>>Hi, Group,
>>>
>>>I am new to OpenMap development and wish someone here would help me
>>>with some basics. I am currently working on a new layer with dynamic
>>>objects which reflects the state of a real-time back end. So far I
>>>have those objects static displayed on the layer. I use
>>>"openmap.properties" as following to define the layer and it show up
>>>as I expected.
>>>
>>>openmap.layers=..... dynamic .....
>>> :
>>> :
>>>dynamic.class=com.xyz.layer.DynamicLayer
>>>dynamic.prettyName=Dynamic Objects
>>> :
>>>
>>>In order to move them, I need to grab a reference to the layer. I
>>>wonder if there is a standard way to get references to individual
>>>layers defined in property file.
>>>
>>>-Sunny
>>>
>>>
>>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>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"]
>>
>
>--
>[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"]
>
>.
>

-- 
George Uecker				george.uecker@dot21rts.com
Software Engineer                       (410) 480-7236
Dot21 Real-Time Systems Inc.            (410) 313-7515 fax
--
[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 Thu Sep 5 13:56:13 2002

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