RE: [OpenMap Users] How to export coord info to clipboard (UNCLASSIFIED)

From: Lackey, Michael B. \(SED/BTI\) <"Lackey,>
Date: Mon, 25 Jun 2007 11:28:20 -0500

Classification: UNCLASSIFIED
Caveats: NONE

Hello Carsten,

What am I doing wrong? I have a derived class ClipboardMouseMode, and is being properly instantiated/loaded by component factory. I know this because (1) I have enabled componenet factory detail debugging, and (2) because I have placed Debug.Output("ClipboardMouse Constructor") in the constructor, and see that output on the console.

But, debug statements indicate no mouse events are being called, e.g., mousePressed(), mouseClicked(), and mouseDragged().

Have tried:

public class ClipboardMouseMode extends PanMouseMode
and
public class ClipboardMouseMode extends NavMouseMode
and
public class ClipboardMouseMode extends CoordMouseMode

For each, have tried changing mouse mode using main menu item Control/MouseMode/Navigation... But this does not seem to help.

I am running OpenMap executable using OpenMap.bat found in the bin directory, and with the default openmap.properties (but with my changes) found in openmap-4.6.3 folder. Should I be using a different properties file?

Mike Lackey
Brockwell Technologies, Inc.
256-876-0167

-----Original Message-----
From: "Carsten . Madsen" [mailto:com_at_navicon.dk]
Sent: Thursday, June 21, 2007 4:43 PM
To: Lackey, Michael B. (SED/BTI)
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] How to export coord info to clipboard (UNCLASSIFIED)

Hi

Install your own mouse mode via the openmap.properties file, e.g., extend the PanMouseMode and override mouseClicked to do the copy to clip board

class ClipboardMouseMode extends PanMouseMode {

  public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        LatLonPoint llp = null;
        int x = e.getX();
        int y = e.getY();
        if (e.getSource() instanceof MapBean) {
              llp = ((MapBean) e.getSource()).getProjection().inverse(x, y);
              Clipboard systemClipboard = Toolkit.getDefaultToolkit()
                            .getSystemClipboard();
              // format, UTM convert llp here
              Transferable transferableText = new StringSelection(llp);
              systemClipboard.setContents(transferableText, null);
        }
    }

}

Then add

panMouseMode.class=ClipboardMouseMode

to openmap.properties in your home dir and add ClipboardMouseMode to the classpath before launching OM.

BR
Carsten


Lackey, Michael B. (SED/BTI) wrote:
> Classification: UNCLASSIFIED
> Caveats: NONE
>
> Hello All,
>
> Question for the group.
>
> When using OpenMap, vanilla installation, no mods, would like to
> right-click and have the s/w place the coord info (lat/lon, or even
> better UTM) on the clipboard. Such that it can then be copied
> (pasted) into another app.
>
> Searched the arhives for "clipboard", not much luck.
>
> Browsing the source, I see that file CoordMouseMode.java derives from
> AbstractMouseMode, and has access to current coord info.
>
> So I think it might be possible to modify the source, and override
> AbstractMouseMode.MouseClick(). But I'm rather not modify the source,
> if there's an alternative.
>
> Question: is it possible to add a layer which does noting more than
> catch mouse events and export data to the clipboard? As outlined in
> the FAQ? This requires registering a mouse listener with the MapBean?
> If this info is already in the list archives, please point it out.
>
> I realize I'm at 30,000 ft. and asking a 3,000 ft question, but time
> is (as always) of the essence.
>
>
> Mike Lackey
> Brockwell Technologies, Inc.
> 256-876-0167
>
> Classification: UNCLASSIFIED
> Caveats: NONE
>
> --
> [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"]
>
Classification: UNCLASSIFIED
Caveats: NONE

--
[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 Mon Jun 25 2007 - 12:31:25 EDT

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