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

From: Davidian <kroberts_at_syrres.com>
Date: Wed, 14 May 2008 11:08:12 -0700 (PDT)

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"]
Received on Wed May 14 2008 - 14:08:42 EDT

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