Why is SketchEditor marked as sealed

813
11
11-22-2016 05:49 AM
TorstenVikstrom
New Contributor

Why have you marked the SketchEditor class as sealed?

The Editor class in the previous version (10.2.7) was not sealed and we could easily adjust the functionality as needed.

Please change this in the next release! We are not able to upgrade to version 100.0.0 until this is solved.

0 Kudos
11 Replies
JenniferNery
Esri Regular Contributor

In 10.2.x, Editor was not sealed because you can override OnGenerateSymbol. In 100.0.0, SketchEditor has SketchStyle which you can use to update Symbology. Do you have a specific use case that is currently not addressed?

Thanks.

Jennifer

0 Kudos
StefanKallin1
New Contributor II

Hi Jennifer,

I will answer this as I implemented our solution.

We are currently doing an override of OnGenerateSymbol but only to keep track of the selected vertex (if any).

In addition to this we use a bit of reflection magic to enable our users to create and edit geometries using not only mouse/touch but GPS data and other positioning devices as well. This is not possible through the editor unless we are able to derive from it.

With kind regards,

Stefan

0 Kudos
JenniferNery
Esri Regular Contributor

Hi Stefan,

Thanks for the clarification. You should be able to insert MapPoint from another source (without interaction with map) by calling AddCommand. Either these snippet will insert after selected vertex. If you want to disable SketchEditor from responding to map interaction, mark SketchEditor.IsEnabled=False so no tap event will add vertex but instead programmatically insert after selected vertex. Last vertex added in Polyline/Polygon becomes the new selected vertex, but you can tap to select a vertex to insert after that position.

if(MyMapView.SketchEditor.AddCommand.CanExecute(MapPointSource))

   MyMapView.SketchEditor.AddCommand.Execute(MapPointSource);

or

<Button Content="Add" Command="{Binding AddCommand}" CommandParameter="{Binding ElementName=Coordinates, Path=SelectedItem}" DataContext="Binding

ElementName=MyMapView, Path=SketchEditor}"/>

Thanks.

Jennifer

0 Kudos
StefanKallin1
New Contributor II

Hi Jennifer,

The ability to add points from other sources using the AddCommand is  good, but not quite good enough.

We still need the ability to move a selected vertex using data from any source, GPS or similar.

During editing it is also useful to let the user select a vertex and then add new points after the selected one and not only at the end of the geometry.

The ability to create a new geometry using commands was already present in the old implementation but our implementation does also cover any additional editing.

Stefan

0 Kudos
JenniferNery
Esri Regular Contributor

Do you mean you also need to programmatically update selected vertex? Currently, you will only be able to update selected vertex by tapping onto a vertex with SketchEditor.Enabled=True. The next AddCommand will add vertex after this selected vertex.

You also might want to look at Polyline/PolygonBuilder to update your geometry. It has AddPoint, InsertPoint, SetPoint, RemovePoint, etc that might better suit your need. This gives you more control over which index you want to insert the point. You can then use SketchEditor.ReplaceGeometry(geometry) with geometry from builder if you need this geometry change to be added onto the undo stack.

Will that work for you?

0 Kudos
StefanKallin1
New Contributor II

We would like to be able to:

  • Create new geometries using whatever positioning sources our users feel like using
  • Edit existing geometries and add or move vertexes using whatever positioning sources our user feel like using

Of course we could use the Polyline/PolygonBuilder but this would, in effect, mean that we have to implement a fully featured version of the new SketchEditor to replace our extension of the old Editor. I may come across as a bit grumpy but you really have to factor in your existing users when you change your API.

The key issue is that our present implementation use the Editor in a fashion that let the users mix mouse/touch input, GPS data capture and data from other positioning sources when they create or edit geometries.

Are you suggesting that we are able to inject data into the geometry builder while the SketchEditor is active?

0 Kudos
JenniferNery
Esri Regular Contributor

Yes, you can use Polyline/Polygon builder with SketchEditor. If selecting vertex by tap to specify where AddCommand will insert new vertex is not enough, you can use polygonBuilder.Parts[0].SetPoint(index, MapPoint) for example and then update geometry using SketchEditor.ReplaceGeometry(polygonBuilder.ToGeometry()) so that edit tools (vertex, mid-vertex, selected vertex) are re-drawn with the new geometry. You can either turn on/off SketchEditor.IsEnabled so you can also interactively add/insert/move/delete vertex or keep using Add/DeleteCommand to programmatically update geometry, these commands act on selected vertex.

0 Kudos
JenniferNery
Esri Regular Contributor

SketchEditor.Geometry has the current state of geometry. When GeometryUpdated event is raised, its event args also contain the OldGeometry. I think this property and event might be of interest when using a geometry builder along side SketchEditor to keep them in sync.

0 Kudos
StefanKallin1
New Contributor II

OK,

I will take a shot tomorrow and make a test app to verify this.

It does sound a bit cumbersome but I will reserve my judgement until I have tried it.

0 Kudos