Re: [OpenMap Users] Question about PanMouseMode and MouseWheel

From: Don Dietrick <>
Date: Mon, 16 Oct 2006 11:06:26 -0400

Hi Stephane,

The latest version of the PanMouseMode in the beta out of CVS on the
website does what you expect.

- Don

On Oct 16, 2006, at 3:05 AM, Stéphane Wasserhardt wrote:

> Hi !
> I'd like to know if there is a particular reason to instanciate new
> BufferedImages each time PanMouseMode.createBuffers is called ?
> I think this is only needed when the mapBean's width or height
> changes !
> I ask this question because rotating the mouse wheel (numerous
> times) when the panMouseMode is active causes many createBuffers
> calls. The garbage collector doesn't have time enough to free the
> previous images thus causing slowdowns... If you have not much
> memory available (try with -Xmx32m) and a memory-consumming
> application, it can even cause OutOfMemoryErrors !
> Another problem is multi-threading. Each time the wheel is rotated,
> projectionChanged is called from a different worker thread. Each
> one of these calls lead to a createBuffer call : images instances
> are uselessly created one after the other! Instanciation can also
> happens during the previous call's instanciation!
> First, I think it would be better to flush the bufferedImages
> before creating new instances, even if it won't change much...
> (have a look at ).
> The createBuffer method should also be synchronized to be sure that
> the images are completely instanciated before flushing and re-
> instanciating them...
> For a real improvement, the images should only be instanciated when
> the mapBean's size changes. In other cases re-instanciation is not
> needed because the images are fully painted in the mouseDragged
> method.
> I attached a new version of PanMouseMode. If I didn't miss
> anything, I think it should be better to use this one instead of
> the current version...
> Stephane
> <>

Don Dietrick,
BBN Technologies, Cambridge, MA

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Oct 16 2006 - 11:09:51 EDT

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