Snapped feature

930
2
05-17-2011 01:52 AM
ThibautDusanter
New Contributor
Hi,

I looked for a long time on the documentation but I didn't find It.

Is there a way to get the snapped feature(s)?

With the ISnapEnvironment, it is possible to know if the point is snapped but not with which feature.

Did I miss something? Does someone have a solution?

Thanks a lot,
Thib
0 Kudos
2 Replies
UjjwalNigam
New Contributor III
Hi,
Once the feature gets successfully snapped, it's co-ordinates are same as the feature to which it has snapped to. Using the new set of co-ordinates, and InvertAgent, the other feature can be located.

Read the remarks from ESRI:
Remarks
As an example: there may be several FeatureSnap agents present. Each receives a point from the current cursor location, which is passed to the agent via the SnapPoint method. If the conditions for a snap are met, the boolean value of the agent returns TRUE, the point's coordinates are updated based on the active FeatureSnap's conditions and the same point is returned to SnapPoint. In the Editor, the InvertAgent location is always set equal to this point. Thus, when snapping conditions are met, the InvertAgent (blue dot) is passed the point with altered coordinates, and the corresponding location shift is manifested as a "snap".


http://edndoc.esri.com/arcobjects/9.2/componenthelp/esriEditor/ISnapEnvironment_SnapPoint.htm

Other approach could be, that you pass the point to the IIdentify.Identify() method, which would return you an array of objects which you can loop through.

Hope it helps...
0 Kudos
ThibautDusanter
New Contributor
Hi,

thanks for your help.

Regarding the InvertAgent, I have read this paragraph.
The fact is:
the coordinates are modified to the snapped feature location but at the end you only have the new coordinates, not the feature itself. Do you agreee?

Regarding the IIdentify.Identify() method, If I understand well it works on a layer. Which means that I need to loop through all layers. I may do it this way but it seems to me that we are repeting the work done by the ISnapEnvironment which is not very "clean".

Do you have another idea?
Thanks again ujjwalesri
0 Kudos