Re: [OpenMap Users] Mouse Wheel Events

From: Don Dietrick <dietrick_at_bbn.com>
Date: Thu, 26 Aug 2004 09:53:24 -0400

Hi Chris,

Roy has the MouseWheelEvent handled in the MapMouseMode, but it sounds
like you want to have those events passed to the layer. You'll
probably have to set up the MapMouseMode -> Layer event handling for
that. The MapMouseEvent isn't equipped to represent MouseWheelEvents,
so your MapMouseMode should probably test to find out if a
MapMouseListener is a MouseWheelListener, and forward those events on
appropriately.

- Don

On Aug 26, 2004, at 8:31 AM, Chris Allport wrote:

> Thank you. This is very helpful.
>
> I had some difficulties connecting it up. Instead of extending the
> NavMouseMode, I extended SelectMouseMode and do this (I am not using
> it for
> map navigation or zoom):
>
> ExtendedSelectMouseMode mouseMode = new ExtendedSelectMouseMode();
> MouseDelegator md = new MouseDelegator(mapBean);
>
> Layer[] layers = new Layer[] {
> firstLayer,
> secondLayer
> };
>
> md.setupMouseModesWithLayers(layers);
> md.setActiveMouseMode(mouseMode);
>
> In each of my layers, I changed getMouseModeServiceList() to return
> ExtendedSelectMouseMode.modeID instead of SelectMouseMode.modeID.
>
> And it does not seem to fire off the mouseWheelMoved listener. I feel
> like
> I am missing something obvious.
>
> Thanks-
>
> Chris
>
>
> -----Original Message-----
> From: Roy Newton [mailto:newton_at_bmh.com]
> Sent: Wednesday, August 25, 2004 11:39 AM
> To: chris.allport_at_red-inc.us; openmap-users_at_bbn.com
> Subject: Re: [OpenMap Users] Mouse Wheel Events
>
>
> Here's the way I did it...
>
>
> public class TacMapNavMode extends NavMouseMode implements
> MouseWheelListener{
>
> ...
>
> public void mouseWheelMoved(MouseWheelEvent e) {
>
> float curLevel = TacMap.getInstance().getMainMapBean().getScale();
>
> if(e.getWheelRotation() > 0){ //down
>
> TacMap.getInstance().zoom(curLevel * 0.5f);
>
> }
>
> else{//up
>
> TacMap.getInstance().zoom(curLevel / 0.5f);
>
> }
>
> }
>
>
>
>
>
> }
>
> ----- Original Message -----
> From: "Chris Allport" <chris.allport_at_red-inc.us>
> To: <openmap-users_at_bbn.com>
> Sent: Wednesday, August 25, 2004 10:31 AM
> Subject: [OpenMap Users] Mouse Wheel Events
>
>
>> I would like to capture mouse wheel events in one of my layers. I
>> found
>> that I cannot simply extend the MouseWheelListener in my layer -- it
> blocks
>> the other mouse events.
>>
>> Can anyone share how they have implemented capturing the mouse wheel?
>>
>> Thanks in advance-
>>
>> Chris
>>
>> --
>> Chris Allport
>> Unmanned Systems Research & Development Lab
>> Patuxent River Naval Air Station
>> Phone: (301) 904-5943
>>
>>
>> --
>> [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"]
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 Thu Aug 26 2004 - 09:54:28 EDT

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