Class GeometryEditor
Allows you to create new geometries, and change existing geometries, by interacting with a MapView.
Inheritance
Implements
Namespace: Esri.ArcGISRuntime.UI.Editing
Assembly: Esri.ArcGISRuntime.dll
Syntax
public 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.
The type of the current Tool determines how you create and edit geometries, with the current InteractionConfiguration or ReticleInteractionConfiguration allowing you to enable or disable different interactions and capabilities of the tool.
- The default VertexTool allows you to create and edit geometries by interacting with individual vertices. You can tap to select the different elements and drag to move them, and also tap multiple times on an element to select the different types of GeometryEditorElement representing vertices, parts, or the entire geometry. You can rotate and scale the selected element (if applicable to the selected element type), and can also create new parts in a multipart geometry (if enabled in the InteractionConfiguration).
- The FreehandTool is ideal for creating new polygon or polyline geometries using a single freehand drag gesture. It also allows multiple taps to cycle the selected element type.
- The ShapeTool is ideal for creating new polygon or polyline geometries with a geometric shape by using a single drag interaction. It also allows multiple taps to cycle the selected element type.
- The ReticleVertexTool is recommended for precise, vertex-based, geometry editing on touch devices, especially when using snapping (SnapSettings). It does not support multiple taps to cycle the selected element.
Programmatic changes to the Geometry or SelectedElement (for example calling SelectVertex(Int64, Int64) or MoveSelectedElement(MapPoint)) not affected by the settings in InteractionConfiguration or ReticleInteractionConfiguration.
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.
Enabling snapping can help ensure that interactive edits are more accurate, with fewer errors, by allowing you to create geometries that connect to each other and are coincident. Use SnapSettings to configure snapping behavior.
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 System.Drawing.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
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 |
SnapSettings | Gets or sets the configurable options for interactive snapping. |
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. |
OnPropertyChanged(String) | Raises the PropertyChanged event. |
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. |
SnapChanged | Indicates that the snap candidate used by the GeometryEditor has changed. |
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 200.3 - 200.6 |
.NET | 200.3 - 200.6 |
.NET Windows | 200.3 - 200.6 |
.NET Android | 200.3 - 200.6 |
.NET iOS | 200.3 - 200.6 |
.NET Framework | 200.3 - 200.6 |
UWP | 200.3 - 200.6 |