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

From: <Ta3ban4_at_aol.com>
Date: Wed, 14 May 2008 16:19:44 EDT

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.      
(http://food.aol.com/dinner-tonight?NCID=aolfod00030000000001)
--
[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 Wed May 14 2008 - 16:21:53 EDT

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