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"]
>
--
[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 Jun 21 2007 - 17:45:44 EDT