scott.brown

Highlight features on mouseover in an ArcMap tool

Discussion created by scott.brown on Mar 1, 2011
Latest reply on Mar 29, 2011 by scott.brown
Hello,

I'm looking for the recommended workflow for quickly identifying the nearest feature to the cursor in ArcMap (version 9.3 using .NET) and highlighting it.

I've tried three approaches. First I formed an envelope around the mouse in device units (pixels), and used IFocusMap.SelectByShape(..., ..., true) to fetch and highlight a single feature from the layer. Obviously this wasn't ideal.

I considered using IFeatureIndex.NearestFeature(), but I'm concerned about overhead, as each time the tool performs its function it changes the underlying features, invalidating the index.

I settled on using IFeatureSnapAgent. This quickly gives me the nearest point on the nearest feature. However, to find and highlight the feature itself seems to require an intersection search with the snapped point to fetch an IFeature. This seems redundant and inefficient.

Could someone suggest how I might efficiently highlight a feature on mouseover?

Thanks!
- Scott

Outcomes