GeometryEditor class final
Allows you to create new geometries, and change existing geometries, by interacting with an ArcGISMapViewController.
To use a GeometryEditor:
- Set the ArcGISMapViewController.geometryEditor property.
- Call one of the start methods.
- To interactively create new geometries from scratch, call GeometryEditor.startWithGeometryType passing in a GeometryType to determine the type of geometry created.
- For geometry editing workflows, pass an existing Geometry into GeometryEditor.startWithGeometry.
- You can then edit the geometry directly on the map view using mouse or
touch gestures.
- The GeometryEditor.tool determines how you draw on the map to define the new geometry, for example by adding individual vertices or with a freehand gesture. The default tool is VertexTool.
- If you passed in an initial geometry, it is displayed in the view, and you can interact with the geometry to make changes.
- Call GeometryEditor.stop to return the geometry and prevent the geometry
editor from processing any more interactions.
- Geometries are immutable, therefore a new Geometry object reflecting the updates is returned from GeometryEditor.geometry and GeometryEditor.stop each time.
When started (GeometryEditor.isStarted is true), you can interact with the different GeometryEditorElement objects that compose the representation of the GeometryEditor.geometry in the map view. Depending on what is selected, different types of GeometryEditorElement are returned from GeometryEditor.selectedElement.
The type of the current GeometryEditor.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 GeometryEditor.geometry or GeometryEditor.selectedElement (for example calling GeometryEditor.selectVertex or GeometryEditor.moveSelectedElement) not affected by the settings in InteractionConfiguration or ReticleInteractionConfiguration.
Change the appearance of the geometry by using the GeometryEditorStyle of the current GeometryEditor.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 GeometryEditor.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 GeometryEditor.insertVertex to add a subsequent vertex based on a GPS location from LocationDisplay.
- Use GeometryEditor.deleteSelectedElement to delete the current GeometryEditor.selectedElement.
- Use GeometryEditor.moveSelectedElement to move the currently selected GeometryEditorElement to a specific ArcGISPoint, or GeometryEditor.moveSelectedElementWithDelta to nudge it in a specific direction.
- Use GeometryEditor.replaceGeometry to take the current GeometryEditor.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 GeometryEditor.undo and GeometryEditor.redo to undo and redo individual interactive or programmatic edits.
Use GeometryEditor.onGeometryChanged and GeometryEditor.onSelectedElementChanged to be notified when a user interaction or API call has changed the GeometryEditor.selectedElement or GeometryEditor.geometry. Changing the geometry state can also change GeometryEditor.canUndo, which triggers GeometryEditor.onCanUndoChanged.
- Implemented types
Constructors
- GeometryEditor()
-
Creates a default GeometryEditor.
factory
Properties
- canRedo → bool
-
True if there are actions that can be redone on the
GeometryEditor.geometry, false otherwise.
no setter
- canUndo → bool
-
True if there are actions that can be undone on the
GeometryEditor.geometry, false otherwise.
no setter
- geometry → Geometry?
-
The current geometry, updated as you interact with the view.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isStarted → bool
-
True if an editing session is active, false otherwise.
no setter
- isVisible ↔ bool
-
True if the geometry is visible in the view, false otherwise.
getter/setter pair
-
onCanRedoChanged
→ Stream<
bool> -
Indicates that the value of GeometryEditor.canRedo changed.
no setter
-
onCanUndoChanged
→ Stream<
bool> -
Indicates that the value of GeometryEditor.canUndo changed.
no setter
-
onGeometryChanged
→ Stream<
Geometry?> -
Indicates that the state of the geometry held by the GeometryEditor
changed.
no setter
-
onIsStartedChanged
→ Stream<
bool> -
Indicates that the value of GeometryEditor.isStarted changed.
no setter
-
onSelectedElementChanged
→ Stream<
GeometryEditorElement?> -
Indicates that the selected element of the GeometryEditor changed.
no setter
-
onSnapChanged
→ Stream<
SnapChangedInfo> -
Indicates that the snap candidate used by the GeometryEditor has
changed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedElement → GeometryEditorElement?
-
The element that is currently selected in the GeometryEditor, or null if
nothing is selected.
no setter
- snapSettings ↔ SnapSettings
-
Configurable options for interactive snapping.
getter/setter pair
- tool ↔ GeometryEditorTool
-
The tool defining how you interact with the view to create and edit the
GeometryEditor.geometry.
getter/setter pair
Methods
-
clearGeometry(
) → void - Clears the current geometry being edited.
-
clearSelection(
) → void - Clears the current selection.
-
deleteSelectedElement(
) → void - Deletes the selected element from the current GeometryEditor.geometry.
-
insertVertex(
ArcGISPoint point) → void - 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(
ArcGISPoint newPoint) → void - Moves the selected element to the specified location.
-
moveSelectedElementWithDelta(
{required double deltaX, required double deltaY}) → void - Moves the selected element by the specified distances along the x-axis and y-axis.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
redo(
) → void - Redoes the last action undone on the GeometryEditor.geometry.
-
replaceGeometry(
Geometry geometry) → void - Replaces the current GeometryEditor.geometry with the specified geometry.
-
rotateSelectedElement(
{required double angle, ArcGISPoint? origin}) → void - Rotates the GeometryEditor.selectedElement by the specified angle.
-
scaleSelectedElement(
{required double scaleX, required double scaleY, ArcGISPoint? origin}) → void - Scales the selected element by the specified factors.
-
selectGeometry(
) → void - Selects the entire GeometryEditor.geometry.
-
selectMidVertex(
{required int partIndex, required int segmentIndex}) → void - Selects the mid-vertex with the specified indices.
-
selectPart(
{required int partIndex}) → void - Selects the part with the specified index.
-
selectVertex(
{required int partIndex, required int vertexIndex}) → void - Selects the vertex with the specified indices.
-
startWithGeometry(
Geometry initialGeometry) → void - Starts a geometry editing session based on the specified geometry.
-
startWithGeometryType(
GeometryType geometryType) → void - Starts a geometry editing session with an empty geometry of the specified GeometryType.
-
stop(
) → Geometry? - Stops the editing session by making the GeometryEditor no longer respond to user interaction and clears the GeometryEditor.geometry.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Undoes the last action on the GeometryEditor.geometry.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited