Hi Mike,
On Wednesday, January 16, 2002, at 04:04 PM, Mike White wrote:
> My applet is based on one of the simple examples rather than
> OpenMapApplet.java, which is probably part of the problem.
Ahh. You'll have to look in the code to find out where the
MouseDelegator is set. It probably has the setDefaultMouseModes()
called on it, with the NavMouseMode set as the active one. You have to
call md.setActiveMouseModeWithId(SelectMouseMode.modeID) to get it to
use the SelectMouseMode.
> I haven't figured out how to determine or set the current mouse mode.
> The docs mention MouseDelegator for setting the mode, and I think
> you get that from a MapHandler. I'm not sure how to get the MapHandler
> though.
I don't think the example applications use the MapHandler. You'll have
to reference OpenMap.java, which shows how to use it as a handle to the
map and all its components.
The examples all reference the old way of doing things, where you have
to hook all the components by hand. The OpenMap.java class is a simple
example of how to create a MapHandler, and then add all the components
to it (it's done in the PropertyHandler, but you could do that by hand),
and they find and hook themselves up to each other.
If you were going to embed OpenMap components in an application, the
MapHandler would be the one component you would have to hang on to as a
reference to the map.
- Don
>
> Donald Dietrick wrote:
>>
>> Hi Mike,
>>
>> Is the "Gestures" mouse mode active?
>>
>> - Don
>>
>> On Wednesday, January 16, 2002, at 03:23 PM, Mike White wrote:
>>
>>> I've implemented a layer which wants to get selection mouse events.
>>> Below is the code for my layer. Unfortunately, my mouse handling
>>> calls never happen. Even getMapMouseListener() and
>>> getMouseModeServiceList() never get called. The paint and
>>> projectionChanged methods do get called appropriately, so
>>> the layer is "active" in that sense. How do I get it so that this
>>> layer receives mouse events?
>>>
>>> public class SensorOMLayer extends Layer implements MapMouseListener
>>> {
>>> ...
>>>
>>> public MapMouseListener getMapMouseListener()
>>> {
>>> return this;
>>> }
>>>
>>> public java.lang.String[] getMouseModeServiceList()
>>> {
>>> // Return a list of the modes that are interesting to the
>>> MapMouseListener.
>>> return new String[] { SelectMouseMode.modeID };
>>> }
>>>
>>> ...
>>>
>>> public boolean mouseClicked(java.awt.event.MouseEvent e)
>>> {
>>> System.out.println( "Got click!\n" );
>>> ...
>>>
>>> return true;
>>> }
>>>
>>> ... etc. other mouse routines.
>>> };
>>>
>>> --
>>> [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"]
>>>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> --
> [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"]
>
-- [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 Wed Jan 16 17:32:05 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT