Get Feature that was snapped to in New Snapping Environment

580
2
03-13-2012 11:52 AM
Highlighted
New Contributor II
Hi All-

Does anyone know if there is a way to get the feature that something was just snapped to in the Snapping Environment in ArcGIS 10? I have code that will do this in the classic snapping mode but I would like to take advantage of the new snapping environment.

In classic snapping you could loop through the IFeatureSnapAgent.FeatureCache and perfrom a HitTest to see which feature was just snapped to.

I see you can get the location of the snapped point via ISnappingEnvironment.PointSnapper.Snap(), but this does not expose any information about what was snapped to. I see you can add/clear/update a geometry cache on the ISnappingEnvironment.PointSnapper but you can't get any of the items in cache. I'm not too sure that would be helped either way since its just geometries and not features. I guess in theory you could perform a spatial query against each layer in the map with the location of the ISnappingResult but I don't see this as something that is feasible performance wise.

I am missing something or has anyone else dealt with this limitation of the new Snapping Environment?
Reply
0 Kudos
2 Replies
Highlighted
Esri Regular Contributor
Matt,
The only information we expose is on the ISnappingResult interface. What are you looking to do with the snapped feature/layer info if we made it available?
Reply
0 Kudos
Highlighted
New Contributor II
...What are you looking to do with the snapped feature/layer info if we made it available?


I'm actually converting some 9.3 code to the 10.0 environment that several clients use. I believe there are several versions of similar tools on Arcscripts that do the same thing with 9.3 or classic snapping. Its an extension that will set a rotation value on a point feature in the create feature event based on the angle of the line that it was snapped to. Really I only need the shape of the feature so if the geometry cache on the IPointSnapper had a getter that would also work assuming it is not cleared after something is snapped.

Any other work-arounds or suggestions would be great!

Matt
Reply
0 Kudos