Re: [OpenMap Users] Optimizing Performance

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Mon, 6 Jun 2011 13:59:42 -0400

Hi Ruben,

On Mon, Jun 6, 2011 at 12:39 PM, Ruben DF <rdocasalf_at_gmail.com> wrote:
> Hi Don,
>
> 2011/5/23 Don Dietrick <dfdietrick_at_gmail.com>

>> You might want to check to see if the map
>> location of your objects have changed before deciding to repaint,
>> instead of checking whether the objects have moved geospatially.
>
> I'm afraid I don't understand this...what is the difference between checking
> whether the objets have moved geospatially or checking whether have changed
> their map location??

Map pixels cover a certain amount of area, so lat/lons that are
projected onto the map may be resolved to the same pixel. It's
possible, depending on the map scale, where objects are moving (their
lat/lons change) but their pixel position on the map doesn't change.
If that's the case, you don't have to redraw the map.


>>  If
>> you are changing how things look (vibrating map objects to highlight
>> them, changing their color, etc), I can understand why you would want
>> the update rate to be something higher.  In that case, you might want
>> to buffer several maps together with different rendering parameters,
>> and then loop that set.
>
> I think the problem is on a layer which contains the trace of the plains,
> i.e, contains a set of OMPoints which is growing each second (36 points are
> created per second, so after 10 minutes, there are more than 20000 points
> and cpu is collapsed). I generate only the 36 new points which are created
> per second, but I have a problem on the render method, since I need to
> render all of them if I want to see them on the map...is it possible to make
> a layer and set Background as true and only render the last point? If
> backgroud is true there are no movement (only when zoom or pan since
> projectionchanged() is called) and right now I must render all the points to
> see them on the map...

I don't think I'd mess with the Background setting of the layer, since
that drops the layer below any other layer not marked as a background
layer. You could do something similar - by writing a new RenderPolicy
similar to the BufferedImageRenderPolicy, or by managing a
BufferedImage in your layer and drawing old points into that, and then
just draw that image.

You don't have to generate older points/OMGraphics if the map doesn't
change and their position doesn't change. If the zoom level, window
size or position of the map changes, you'll have to generate all the
points and you'll lose any image buffering savings for one render
cycle. But if you are watching a non-moving map, drawing the latest
points into an image buffer and simply rendering that buffer should
work well.

- Don

>
>>
>> - Don
>>
>> On Mon, May 23, 2011 at 7:25 AM, Jesper Berglund
>> <jesper.berglund_at_pertexo.se> wrote:
>> > Has the map changed during the 40ms, like panning or zooming?
>> > Is there objects on the map which has changed?
>> >
>> > Don't repaint all layers, only those who might have changed.
>> >
>> > Repaint only on changes of data.
>> >
>> > If there is a burst of events, coalesce during a timeperiod and then
>> > repaint
>> > using javax.swing.Timer .
>> >
>> > These are the measures that I have made in my Openmap app.
>> >
>> > HTH
>> >
>> > /Jesper
>> >
>> > Ruben DF skrev 2011-05-23 11:30:
>> >>
>> >> Hi,
>> >>
>> >> I'm afraid I cannot repaint each 500 ms or longer...it's a customer's
>> >> requirement... :(
>> >>
>> >> Thanks anyway!
>> >
>> > --
>> > [To unsubscribe to this list send an email to "majdart_at_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_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Jun 06 2011 - 14:01:29 EDT

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