IMapMouseHandlerHitTest Method |
Namespace: Telogis.GeoBase
Related articles: Renderers Tutorial, Mouse Events.
public IMapMouseHandler HitTest(int x, int y, IMap aMap) { int x1, y1; // Convert 'location' - A BalloonPushPin knows its LatLon - to // x & y map co-ordinates. aMap.LatLontoXY(out x1, out y1 , location); // Get a Rectangle with the size of this BalloonPushPin, located at x1,y1 co-ordinates. System.Drawing.Rectangle rect = Telogis.GeoBase.ImageUtils.IconCache.Rectangle(Icon, x1, y1); // If the rectangle contains the co-ordinates that are being tested // we have a hit, and so we return this BalloonPushPin. if (rect.Contains(x, y)) { return this; } // Otherwise there is no hit, and we return null. return null; }