ThinkGeo.com    |     Documentation    |     Premium Support

Mouse move or Mouse over issue

Hi,

Hi, as we don’t have Map mouse move event in Web edition. I used map events in client side like follows

map.events.register(‘mouseover’, map, mapMouseOver);

function mapMouseOver(e) {
CallServer(e.x.toString()+","+e.y.toString());
}

from this i am getting Screencoordinates and sending it to Server.
There i am using following code get my ‘AircraftLayer’

PointShape worldCoordinate = wfMap.ToWorldCoordinate((float)Convert.ToDouble(e.Split(’,’)[0].ToString()), (float)Convert.ToDouble(e.Split(’,’)[1].ToString()));
if (wfMap.CustomOverlays.Contains(“Aircrafts”))
{
InMemoryFeatureLayer imAircraft = (InMemoryFeatureLayer)((LayerOverlay)wfMap.CustomOverlays[“Aircrafts”]).Layers[“AircraftLayer”];
imAircraft.Open();
Collection flabels = imAircraft.FeatureSource.GetFeaturesWithinDistanceOf(worldCoordinate, wfMap.MapUnit, DistanceUnit.NauticalMile, 100, ReturningColumnsType.AllColumns);
imAircraft.Close();
if (flabels.Count > 0)
{

            }
        }

But I could not able to get any count when I mouse over on my Aircrafts…

I am thinking may be I am not passing right Screen coordinates CallServer(e.x.toString()+","+e.y.toString());

Can anyone please look into it give me the solution …

Thanks,
Ashok

Hi Ashok,

I think you should want to convert the coordinate to world coordinates in client side, then pass the value back server side and query based on the world coordinates.

The code should looks like: PointShape worldCoordinate = Map1.ToWorldCoordinate(screenX, screenY);

And you can query the key word: Map1.ToWorldCoordinate in our forum to find more scenario about this API.

Regards,

Ethan