Re: [OpenMap Users] Getting at current projection in OMGraphicHandlerPlugIn?

From: Bas Schulte <basschulte@gmail.com>
Date: Thu Nov 09 2006 - 13:42:19 EST

Hi,

On 9-nov-2006, at 19:18, Don Dietrick wrote:

> It's actually a little easier than that. The MouseEvent is
> actually a MapMouseEvent, and if you cast it to a MapMouseEvent
> you'll find it has a getLatLon() method.
>
> The other thing you can do from a plugin is call getComponent(),
> which returns the layer (PlugInLayer), and you can call
> getProjection() on the layer.

Got ya.

So it boils down to this:

public class MyFirstPlugIn extends OMGraphicHandlerPlugIn //
OMGraphicHandlerPlugIn implements MapMouseListener interface
{
    ...

    public boolean mouseClicked(MouseEvent e)
    {
       if (e instanceof MapMouseEvent) {
          LatLonPoint lp = ((MapMouseEvent)e).getLatLon();

          System.err.println("Latlon of click=" + lp.toString());
       } else {
          System.err.println("HUH? got mouseClicked but not a
MapMouseEvent?!?");
       }

       return (false);
    }

    ...
}

--
[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 Thu Nov 9 13:49:50 2006

This archive was generated by hypermail 2.1.8 : Thu Nov 09 2006 - 13:49:51 EST