When you create a function that gets all OMGraphics from the specified layer when the mouse moves over the
region you want this reaction for. Put those graphics in a vector, and in a loop, create a temporary Location outr of
every graphic and execute the method distance(in, int) for your mouse position.
Keep the smallest distance in memory and return this or it's name. Now you can use that Object to refer to.
In the small example here there's a limit as well.
Martijn van der Pauw
String returnlocation="";
Layer[] l = this.testIS.getLayers();
Vector graphics = ((com.bbn.openmap.layer.location.LocationLayer)l[0]).getGraphicList();
if (graphics != null){
int x = (int)mousex;
int y = (int)mousey;
float limit = 4.0f;
com.bbn.openmap.layer.location.Location ret = null;
com.bbn.openmap.layer.location.Location loc;
float closestDistance = Float.MAX_VALUE;
float currentDistance;
int i;
int size = graphics.size();
for (i = 0; i < size; i++)
{
loc = (com.bbn.openmap.layer.location.Location)graphics.elementAt(i);
currentDistance = loc.distance(x, y);
if (currentDistance < closestDistance)
{
ret = loc;
closestDistance = currentDistance;
}
}
if (closestDistance <= limit)
{
returnlocation=(ret.getName());
}
Op 28 Jun 02, om 9:40, Kandula, Ravindra schreef:
>
> Hi,
> I am using openmap for showing my data on the map in the form of
> points
> at different locations on u.s map. I completed this part of doing things.
> But now I want to add tooltips for all the points with name and datavalue
> inside the text of tooltip and when the mouse passed over the point above
> data should be shown as a tooltip.
> At present I am using Imageserver class and and a layer customised
> for
> this purpose and using OMText and OmPoint graphics for adding points based
> on the data available for that particular location.
> So in the above scenario can I know is there any way of doing it by
> modifying any of the existing classes or adding new ones. Any help will be
> appreciated. Thanks, Ravi.k.
>
> --
> [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"]
Martijn van der Pauw, internetontwikkelaar.
Meteo Consult
martijn@weer.nl
tel: 0317 - 399800
fax: 0317 - 423164
http://www.weer.nl
-- [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 Fri Jun 28 11:30:05 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT