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

From: Bas Schulte <basschulte_at_gmail.com>
Date: Thu, 9 Nov 2006 19:42:19 +0100

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_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Nov 09 2006 - 13:43:00 EST

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