Class GeometryEditor
Allows you to create new geometries, and change existing geometries, by interacting with a MapView.
Implements
Namespace: Esri.ArcGISRuntime.UI.Editing
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class GeometryEditor : INotifyPropertyChanged
Remarks
To use a GeometryEditor:
- Set the GeometryEditor property.
- Call one of the start methods.
- You can then edit the geometry directly on the map view using mouse or touch gestures.
- Call Stop() to return the geometry and prevent the geometry editor from processing any more interactions.
When started (IsStarted is true
), you can interact with the different
GeometryEditorElement objects that compose the representation of the Geometry in the map
view. Depending on what is selected, different types of GeometryEditorElement are returned from
SelectedElement. Tap to select the different elements and drag to move them. Tap multiple
times on an element to select the different types of GeometryEditorElement representing vertices, parts, and
the entire geometry. You can control which interactions are possible by changing the InteractionConfiguration
of the current Tool. For example, you can change the types of element you can tap to select,
and whether they can create new vertices or parts by tapping or dragging on the map. Programmatic changes to the
Geometry or SelectedElement (for example
SelectVertex(Int64, Int64) or MoveSelectedElement(MapPoint)) are
not affected by the settings in InteractionConfiguration.
Change the appearance of the geometry by using the GeometryEditorStyle of the current Tool - for example to match the symbology used by the graphic or feature being edited.
Programmatic editing methods are also provided so you can augment your interactive geometry editing to support specific user requirements. For example:
- Use InsertVertex(MapPoint) to add a subsequent vertex based on a GPS location from LocationDisplay.
- Use DeleteSelectedElement() to delete the current SelectedElement.
- Use MoveSelectedElement(MapPoint) to move the currently selected GeometryEditorElement to a specific Point, or MoveSelectedElement(Double, Double) to nudge it in a specific direction.
- Use ReplaceGeometry(Geometry) to take the current Geometry, apply an operation such as a union or intersect by using GeometryEngine, and then replace the current geometry with the result so you can continue to edit as required.
- Use Undo() and Redo() to undo and redo individual interactive or programmatic edits.
Use
Starting a GeometryEditor and a SketchEditor in the same view at the same time is likely to cause unexpected behavior.
Constructors
Name | Description |
---|---|
GeometryEditor() | Initializes a new instance of the GeometryEditor class. |
Properties
Name | Description |
---|---|
CanRedo | Gets a value indicating whether there are actions that can be redone on the Geometry. |
CanUndo | Gets a value indicating whether there are actions that can be undone on the Geometry. |
Geometry | Gets the current geometry, updated as you interact with the view. |
IsStarted | Gets a value indicating whether an editing session is active. |
IsVisible | Gets or sets a value indicating whether the geometry is visible in the view. |
SelectedElement | Gets the element that is currently selected in the GeometryEditor, or |
Tool | Gets or sets the tool defining how you interact with the view to create and edit the Geometry. |
Methods
Name | Description |
---|---|
ClearGeometry() | Clears the current geometry being edited. |
ClearSelection() | Clears the current selection. |
DeleteSelectedElement() | Deletes the selected element from the current Geometry. |
InsertVertex(MapPoint) | Creates a new vertex at the specified location and inserts it after the currently selected element, or appends the point if there is nothing selected. |
MoveSelectedElement(MapPoint) | Moves the selected element to the specified location. |
MoveSelectedElement(Double, Double) | Moves the selected element by the specified deltas. |
Redo() | Redoes the last action undone on the Geometry. |
ReplaceGeometry(Geometry) | Replaces the current Geometry with the specified geometry. |
RotateSelectedElement(Double, MapPoint) | Rotates the SelectedElement by the specified angle. |
ScaleSelectedElement(Double, Double, MapPoint) | Scales the selected element by the specified factors. |
SelectGeometry() | Selects the entire Geometry. |
SelectMidVertex(Int64, Int64) | Selects the mid-vertex with the specified indices. |
SelectPart(Int64) | Selects the part with the specified index. |
SelectVertex(Int64, Int64) | Selects the vertex with the specified indices. |
Start(Geometry) | Starts a geometry editing session based on the specified geometry. |
Start(GeometryType) | Starts a geometry editing session with an empty geometry of the specified GeometryType. |
Stop() | Stops the editing session by making the GeometryEditor no longer respond to user interaction and clears the Geometry. |
Undo() | Undoes the last action on the Geometry. |
Events
Name | Description |
---|---|
PropertyChanged | Occurs when a non-dependency property value changes. |
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 200.2 |
.NET 6.0 | 200.2 |
.NET 6.0 Windows | 200.2 |
.NET 6.0 Android | 200.2 |
.NET 6.0 iOS | 200.2 |
.NET Framework | 200.2 |
UWP | 200.2 |