Re: [OpenMap Users] Other mouse events.

From: Don Dietrick <dietrick@bbn.com>
Date: Mon Jun 30 2003 - 17:28:03 EDT

Hi Tony,

On Sunday, June 29, 2003, at 09:51 PM, avasile@csc.com.au wrote:

> Which class in the API do I use to handle the mouse events rather than
> like Mouse Delegate which just moves the centre of the display around?
> What
> I would like to do is have one popup menu if I'm not over an object and
> another menu if I am over an icon on the display.

The MouseDelegator doesn't do anything with the MouseEvents. The
MouseEvents are handled by MapMouseModes. Whichever MapMouseMode is
active dictates which components receive MouseEvents, or what happens
when the mouse is used. The MouseDelegator manages which
MapMouseEvents are available, and which one is active, providing that
information to any GUI widgets (menu or tool panel buttons) that care.

Every layer, when it's added to the MapBean, is asked which
MapMouseMode it wants to receive MapMouseEvents from. Its a way to
scope and control how layers may receive events.

The NavMouseMode is the one that recenters the MapBean on a click, or
recenters and rescales when a box is drawn. Generally, layers don't
receive MapMouseEvents from the NavMouseMode.

The SelectMouseMode (Gestures), is the one that most layers say they
want to receive MapMouseEvents from. Each layer, from top to bottom,
is given a chance to respond/consume every MouseEvent.

You can certainly create your own MapMouseMode, and modify a layer to
use that MapMouseMode so no other layers can receive MouseEvents.

We've done something similar to what you've described in the
com.bbn.openmap.layer.location.LocationLayer. It listens to the
"Gestures" mouse mode, and provides different menus depending on if a
location has been clicked on or just the background map.

> Also the mapbean works in map scales. What I would like to do is work
> on a
> range from the centre position of the current mapbean. Is this
> possible in
> OpenMap or would I have to make up my own class to handle this sort of
> behaviour?

It is possible to get this behavior by creating your own MapMouseMode
or extending one of the classes in the package.

> Also I would like to reposition the display based on a method
> call rather than just a mouse click is this possible?

Sure, the MapBean has methods that let you control its projection. You
can get a handle to the MapBean through the ProjectionChanged() method
on a layer (in the ProjectionEvent), or you can use the MapHandler to
get it - see:

http://openmap.bbn.com/cgi-bin/faqw.py?req=all#7.7
http://openmap.bbn.com/cgi-bin/faqw.py?req=all#7.8

Hope this helps,

- Don

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Jun 30 17:28:57 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT