Select to view content in your preferred language

SketchEditor GeometryChanged events NewGeometry equals OldGeometry

1919
3
Jump to solution
08-12-2018 11:03 PM
JonasHashagen
Emerging Contributor

The GeometryChanged event of the SketchEditor does sometimes return NewGeometry which equals OldGeometry even though that a point has been modifed using the editor.

Reproduction Steps:

  1. Start the SketchEditor with an already existing geometry as initial geometry and drawAndEdit == true.
  2. Select and move one point of the geometry.
    Expectation: GeometryChanged event gets raised and NewGeometry is different from OldGeometry.
    Observation: GeometryChanged event gets raised and NewGeometry equals OldGeometry (OldGeometry.IsEqual(NewGeometry) == true).

Adding a point, deleting a point or moving multiple points will return the correct NewGeometry.

When registering to the PropertyChanged event and filtering for Geometry property the provided value is what I'd expected to be returned as NewGeometry from the GeometryChanged event. So registering to the PropertyChanged event is currently used by me as a workaround.

1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor

Thank you for reporting this issue and offering us a workaround. It does appear GeometryChanged to be raised earlier with an old value for NewGeometry. I just logged the issue so we can work on getting this fixed in future releases of the API.

The Undo/Redo for change in vertex positions however, appear to be working. But if you need to know when/what Geometry has changed to, GeometryChangedEventArgs.NewGeometry only reflects the change when a new vertex is added or a vertex gets deleted.

May I ask what you're using SketchEditor.Geometry for? Would it be something where two-way binding to this property can be done or is it necessary to do in code-behind where you subscribe to PropertyChanged event? Thanks.

View solution in original post

3 Replies
JenniferNery
Esri Regular Contributor

Thank you for reporting this issue and offering us a workaround. It does appear GeometryChanged to be raised earlier with an old value for NewGeometry. I just logged the issue so we can work on getting this fixed in future releases of the API.

The Undo/Redo for change in vertex positions however, appear to be working. But if you need to know when/what Geometry has changed to, GeometryChangedEventArgs.NewGeometry only reflects the change when a new vertex is added or a vertex gets deleted.

May I ask what you're using SketchEditor.Geometry for? Would it be something where two-way binding to this property can be done or is it necessary to do in code-behind where you subscribe to PropertyChanged event? Thanks.

JonasHashagen
Emerging Contributor

Using two-way binding is not applicable as I'm using the event in the context of my question Exit condition for SketchEditor

0 Kudos
BjørnarSundsbø1
Frequent Contributor

Using the SketchEditor as a measure tool, I experience the same. Adding new vertexes works, but if I move an existing point, e.NewGeometry holds OldGeometry. Moving the point again, I get the geometry I was supposed to get the previous time, and so on. I have a sample if needed

0 Kudos