Re: [OpenMap Users] icon displaying in open map , dragging icon in open map

From: Don Dietrick <dietrick@bbn.com>
Date: Mon Mar 15 2004 - 17:30:33 EST

Hi Steve,

To display an icon in an OpenMap layer, you would use an OMScalingIcon.

For instance, in the DemoLayer, you could add this to the init() method:

// First, get the icon image from your image file:

URL imageURL = PropUtils.getResourceOrFileOrURL(imageURLString);
ImageIcon ii = new ImageIcon(imageURL);
Image fileImage = ii.getImage();
OMScalingIcon icon = new OMScalingIcon(centerLat, centerLon, fileImage);
omList.add(icon);

Dragging is a different story. We don't have an EditableOMRaster that
will drag this object around the map automatically for you yet. You'd
have to trap the mouse events (again, check the DemoLayer) to see if an
MouseEvent is touching the OMScalingIcon, and change the lat/lon
settings for the OMScalingIcon to match the MouseEvent location (you
can ask it for the lat/lon, it's actually a MapMouseEvent).

Hope this helps,

Don

On Mar 11, 2004, at 8:29 AM, steven frierdich wrote:

>
>
> Does anyone have an example source code, or a link to an example
> available for download that shows how to display an icon in a layer in
> open maps and also demonstrates how to drag the icon?
> Thanks
> Steve
>
> --
> [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 Mon Mar 15 17:30:53 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT