So I am creating a fairly small, and hopefully simple, editor extension. This is in Arc 10.4.
What I would like to do is this. If a user is editing a feature and is manipulating the edit sketch, when they move a point I want any other coincident vertices in other features to move with it. Executing this should be easy enough:
- Loop through all feature classes in the GDB
- Buffer the original point and execute a spatial query
- See if the original point exists on any discovered features
- If a feature has the original point, move to the new location
#2 is the problem. The issue is that the OnVertexMoved event only provides the new point location, not the old. My first try was to get the selected feature from the Editor and then pull other information from the IEditSketch interface like so:
//from inside OnVertexMoved
IFeature source_feature = ArcMap.Editor.EditSelection.Next();
IEditSketch e_sketch = ArcMap.Editor as IEditSketch;
IGeometryCollection gc = source_feature.Shape as IGeometryCollection;
IGeometry geo_part = gc.Geometry[e_sketch.Part];
IPoint orig_point = (geo_part as IPointCollection).Point[e_sketch.Vertex];
But e_sketch.Part and e_sketch.Vertex are both invalid (-1). Is there a good way to grab the original vertex location? At this point the original feature's geometry should be unmodified so even just the part and/or index of the vertex should be sufficient.
IFeatureChanges
, then finding the point inOriginalShape
? To get an index for the point, try looping through each point in IEditsketch.Geometry to find closest point to e_sketch.vertex (distance should be zero).