Re: [OpenMap Users] How can I effectively use repaint()?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 25 Mar 2005 14:17:38 -0500

On Mar 25, 2005, at 1:46 PM, Chris Allport wrote:

> Thank you! Sorry for misreading the EditableOMRect code. I see what
> you
> mean there, now.
>
> In MapBean, redraw(layer) applies a repaint policy "waiting for lower
> layers
> to call for a repaint()" -- is this worth messing with?

Probably not.

> What do you think of this idea: Use layers primarily for processing
> mouse
> events, etc. Forward all graphics to be drawn to a single, renderable
> layer, and allow all graphics to be generated/painted/etc. together???

I don't understand what you are trying to do that the OMDrawingTool
doesn't handle already.

- Don

> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: Friday, March 25, 2005 1:11 PM
> To: chris.allport_at_red-inc.us
> Cc: OpenMap Users
> Subject: Re: [OpenMap Users] How can I effectively use repaint()?
>
>
> Hi Chris,
>
> On Mar 25, 2005, at 12:28 PM, Chris Allport wrote:
>
>> When repaint() is called, does it simply redraw the current layer, or
>> does
>> it try to redraw all layers?
>
> All the layers are redrawn when a layer.repaint() method is called.
>
>> In a BufferedMapBean application with multiple layers, does it make
>> sense to
>> allow each layer to call repaint() as they change, or should one,
>> single
>> repaint() be called after all layers are updated?
>
> You have no accurate information available to you to make that
> assessment. Layers are quite independent, and you can't assume that
> their requests for painting mean they are in a stable state. In
> theory, only a layer knows what it's supposed to be showing at any
> given time. If it's told to render before it's ready, it should draw
> nothing, and call for a repaint when it has something new to display.
>
>> In reviewing EditableOMGraphic, it seems that when the object is
>> moved:
>> - the entire map is marked dirty - map.setBufferDirty(true)
>
> Only when the drawing tool is finished. Not while it's being edited.
> The map is marked dirty to clean up anything left over from the XOR
> rendering from the drawing tool, and also to render the modified
> OMGraphic in it's place in the layer that had it changed. The
> OMDrawingTool paints that EditableOMGraphic on top of the map when it's
> being moved. If the receiving layer isn't visible, or if it's covered
> by other layers, the complete repaint needs to happen to get the layer
> ordering correct.
>
>> - all of the graphics are repainted -
>> map.paintChildren(map.getGraphics())
>>
>> Now, if a user is dragging an object around, they obviously cannot be
>> dragging around multiple objects, so maybe regerating the whole map
>> during a
>> drag makes sense.
>
> That shouldn't be happening during a drag. The drag should be XOR
> rendering some lightweight representation of the objects around on top
> of the map, with a repaint happening when all of the editing is
> complete.
>
>> However, what is the best way to manage repaint() in an
>> application with multiple graphics on multiple layers that are
>> constantly
>> updated?
>
> Move the unchanging layers to the background layer in the
> BufferedLayerMapBean, and use a timer to limit update map repaints to
> specific intervals for the changing layers, maybe having a separate
> repaint2() method that works with a centralized timer object. You
> still want the main repaint() method to work in response to projection
> changes.
>
> - Don
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Fri Mar 25 2005 - 14:18:16 EST

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