Re: [OpenMap Users] How To capture Event in a Layer

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 16 May 2008 11:59:42 -0400

Hi Mike,

Do you really need the MouseEvent object, or do you just want to know
when things (clicks, mouse overs, etc) happen over your map objects?

The OMGraphicHandler has a lot of functionality already built into it
to let you know when the mouse is doing something over your objects.
Look at the com.bbn.openmap.layer.learn.InteractionLayer for guidance
with respect to that.

You can respond to mouse clicks this way, too, with the selected(...)
method, popping up a window with your picture in it. Alternatively,
you could construct html that references an image URL, and call
layer.fireRequestBrowserContent(String browserContent).

Hope this helps,

Don

On May 14, 2008, at 4:19 PM, Ta3ban4_at_aol.com wrote:

> Chirs , Kennedy and All
>
> Thanks guys for taking the time to reply back.
>
> I got the mouse event working by doing the following ; Not
> sure if this is the best/correct way ;
>
> public class MyLatLongLayer extends
> OMGraphicHandlerLayer implements MapMouseListener
> { ,,,,,,,
> public MapMouseListener getMapMouseListener()
> {return this;}
> public String[] getMouseModeServiceList(){ return
> new String[] { SelectMouseMode.modeID };}
> }
>
>
> Then from my main program I load the different layers and
> then do the following
> MouseDelegator mouseDelegator = new MouseDelegator();
> mapHandler.add(mouseDelegator);
> SelectMouseMode selectMouseMode = new SelectMouseMode();
> mapHandler.add(selectMouseMode);
> NavMouseMode2 nav2= new NavMouseMode2();
> mapHandler.add(nav2);
> ,,,,,
> mapHandler.add(new MouseModeButtonPanel());
>
> From main gui by selecting Gestures from the
> MouseModeButton i received the different mouse events in
> MyLatLongLayer
> The layer would be added to display the lat/long position
>
>
> finally Let me give you an idea about my school project
> maybe you guys can give me some hints and ideas how to proceed .
>
> My application side of that project is to receive
> Aircraft objects that contain a lat/long and
> some other simple information (N objects/sec ), display
> them on a map and load the appropriate shape/tiff files.
> User shall be able to click on the aircraft and get the
> information about that aircraft in pop up window/or like
> LocationLayer that holds cities.
> I will implement the ideas that guys mentioned.
>
>
> Thanks in Advance
>
> Mike
>
> In a message dated 5/14/2008 2:10:46 P.M. Eastern Standard Time, kroberts_at_syrres.com
> writes:
>
> Mike,
>
> Since you're extending OMGraphicHandlerLayer, capturing mouse events
> is
> actually pretty easy. You basically need to do a couple of things:
>
> 1) Override the receivesMapEvents() method to return true.
>
> 2) Call the setMouseModeIDsForEvents() method in your constructor to
> set the
> MapMouseModes that you want to receive mouse clicks from. You
> probably want
> to listen for at least SelectMouseMode.
>
> 3) Override the appropriate method(s) to handle clicks on the layer:
> leftClick(), getItemsForMapMenu(), etc...
>
> One note: I don't think the default StandardMapMouseInterpreter
> passes left
> clicks to the OMGraphicHandlerLayer by default. You may need to
> create your
> own class that extends StandardMapMouseInterpreter that overrides
> leftClick() and passes the mouse event to the leftClick() method of
> your
> layer. I think that's what I did.
>
> I hope this helps.
>
> -Kennedy
> --
> View this message in context: http://www.nabble.com/How-To-capture-Event-in-a-Layer-tp17193632p17237519.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [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"]
>
>
>
> Wondering what's for Dinner Tonight? Get new twists on family
> favorites at AOL Food.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 May 16 2008 - 12:02:25 EDT

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