This project is read-only.

Hover over point layer

Apr 22, 2011 at 7:40 PM

I am working on a project that would like to have information pop up on the screen when a point (from a generated map layer) is hovered over.  I'm trying to figure out a way to  approach this.  So far I've come up with:

1)  Use a mapTool to draw the points, then catch with a mouse over

2)  Use point selection similar to that suggested here:

except on mouse move.

3)  Cache up all points (there aren't that many) in some sort of structure and do the query against that using the arguments from geoMouseArgs


Any other ideas?


Aaron Parks

RTI International

Apr 22, 2011 at 9:07 PM

The first way I've implemented this is to just use a buffer.  The bit with the pixelToProj is to get an appropriate buffer relative to the zoom level.  This works, but it is kind of jumpy.


 IFeatureSet createdFS=new FeatureSet(FeatureType.Polygon);
            createdFS.Projection = map.Projection;
            Point p=new Point(e.GeographicLocation);
            //let's get a map distance
            Coordinate bufLeft = map.PixelToProj(new System.Drawing.Point(e.X - 10, e.Y));
            Coordinate bufRight = map.PixelToProj(new System.Drawing.Point(e.X + 10, e.Y));
            createdFS.Name = "" + counter;
            IList hits = setFS.Select(createdFS.Extent);
            foreach(IFeature feat in hits)
                MessageBox.Show("Here is some info about feature: \nRunID: "+feat.DataRow["RunID"]+"\nMUID: " + feat.DataRow["MUID"]+"\nResource Region: "+feat.DataRow["ResourceRegion"]);


Aaron Parks

RTI International