Re: [OpenMap Users] Implementing a Layer that Hijacks Mouse Clicks

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Thu, 17 May 2012 17:39:18 -0400

Hi Ian,

There's a better way to do what you want to do, but I'm not sure what
you want to do. Do you want to do anything in particular with the
mouse events, or how to interact with OMGraphics on your layer? You
get a lot of help doing this if your overlay layer extends
OMGraphicHandlerLayer. If you are extending OMGraphicHandlerLayer and
want events to fall through to other layers, set the consumeEvents
flag to false on your layer.

If you want to interact with the OMGraphics on your layer, I suggest
taking a look at the code for the
com.bbn.openmap.layer.learn.InteractionLayer. There are comments in
the code explaining all the different aspects of receiving and
managing MouseEvents with the current MapMouseModes.

If you want to do something else, or have question about that layer or
your layer, let me know. If you have more specifics that'll help,
too.

Cheers,

Don


On Thu, May 17, 2012 at 5:29 AM, Renton Ian
<ian.renton_at_uk.atlas-elektronik.com> wrote:
> Hi,
>
> I am attempting to create an OpenMap layer that handles mouse events internally.
>
> OpenMap's Layer.addMouseListener() method prevents me from attaching my own mouse listener as it rejects any listener that isn't part of javax.swing.  The Javadoc helpfully points out that this is to stop classes stealing the mouse events and thus not letting them fall through to the map.
>
> However, that's exactly what I want to do.  My "overlay"-type layer gets switched on and off, but when it's on, it sits on top and steals mouse clicks to handle them itself rather than passing them through to the layers below.
>
> Can I only do this by overriding OpenMap's Layer class to remove the check, or is there a better way to do what I'm trying to do?
>
> Thanks,
>
> Ian
>
> --
> Ian Renton
> UX / Software Engineer
> ATLAS ELEKTRONIK UK
> Atlas House, Dorset Green Tech. Park, DT2 8ZB, U.K.
> Tel: +44 (0) 1305 212341
> The information contained within this e-mail and any files attached to this e-mail are private and in addition may include commercially sensitive information. The contents of this e-mail are for the intended recipient only and therefore if you wish to disclose the information contained within this e-mail or attached files, please contact the sender prior to any such disclosure.
>
> If you are not the intended recipient, any disclosure, copying or distribution is prohibited. Please also contact the sender and inform them of the error and delete the e-mail, including any attached files from your system.
>
> Atlas Elektronik UK Limited Registered Office Meadows Road, Queensway Meadows, Newport, South Wales NP19 4SS, UK.  Company No. 05582639
>
> --
> [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 Thu May 17 2012 - 17:40:47 EDT

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