|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
How To capture Event in a LayerHi All,
I have a problem
receiving different mouse event on a layer. Created a class that extends
OMGraphicHandlerLayer and implementing
MapMouseListener and
adding it to layer handler. That class simply should detect the
mouse X/Y position and display it in the same way
for example
the DateLayer or ScaleDisplayLayer. My problem i guess that i cant figure
out how to capture the mouse event. I have been looking
at the event class and a
lot of example but i can get a good understanding how it works.My main class
is modified simple2 example.
As far as I
know , I have to change the mouse event mod to be able to
capture the mouse event but not sure how exactly i can
do that.
Would anyone give some
idea/Guidance in how to get that mouse event !.
Thanks in Advance
Mike Wondering what's for Dinner Tonight? Get new twists on family favorites at AOL Food. |
|
|
|
|
|
Re: How To capture Event in a LayerMike,
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 |
|
|
|
|
|
|
|
|
Re: How To capture Event in a LayerHi 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@... 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@... > 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@..." > 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@... BBN Technologies, Cambridge MA =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
|
|
|
Re: How To capture Event in a LayerHi Mike,
Regarding the DateLayer not updating the date except when the projection changes - I don't know if that's really a bug, it's just how it was written (in 1998). It would be trivial to add a javax.swing.Timer class that updated the label at regular intervals. Cheers, Don Ta3ban4@... wrote: > Hi Don, > I was looking how to get any mouse even in a layer i was > creating for the purpose of learning by > examples. I guess you are write OMGraphicHandler has a lot > of functionality just need to dig a bit > more in it. > Another thing, I just notice a possible bug with the > DateLayer, using the OpenMap example. The > date is not being updated except when the projection is > changed. Did anyone notice that or I missed > something ? > > Thanks > Mike > In a message dated 5/16/2008 12:04:16 P.M. Eastern Standard Time, > dietrick@... writes: > > 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@... 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@... > > 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@..." > > 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@... > BBN Technologies, Cambridge MA > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > > > -- > [To unsubscribe to this list send an email to "majdart@..." > 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@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: How To capture Event in a Layerhi
i am trying to do same but my object is city icon by clicking on it it show information of city please guide me i am using SimpleMap2 example. can mail also raman.pisl@gmail.com
|
| Free embeddable forum powered by Nabble | Forum Help |