SketchEditor QML Type

  • Esri.ArcGISRuntime
  • SketchEditor
  • A class that allows the user to sketch geometries on the map. More...

    Import Statement: import Esri.ArcGISRuntime
    Since: Esri.ArcGISRuntime 100.12
    Inherits:

    Object

    Properties

    Signals

    Methods

    Detailed Description

    Instances of this class represent a sketch editor that allows the user to interactively sketch geometries. You can sketch point, polygon, and polyline geometries from scratch, modify existing geometries, insert and remove vertices, undo and redo changes, and so on.

    The sketch editor must be set on the view using the sketchEditor property and then started to perform the sketch based on user interactions.

    A new GeometryEditor class provides a successor to this class, supporting a wider array of use cases and providing a foundation for additional future geometry editing capabilities. If starting new development, use GeometryEditor in preference to SketchEditor.

    This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

    TypeDefault Property
    SketchStylestyle

    Property Documentation

    [read-only] creationMode : Enums.SketchCreationMode

    Specifies which type of geometry will be sketched and what type of user interaction is used to create it (read-only).


    [read-only] geometry : Geometry

    The geometry currently being sketched. It is updated as the user interacts with the view (read-only).


    opacity : real

    The opacity of the SketchEditor. Ranges between 0.0 and 1.0.


    selectedVertex : SketchVertex

    The currently selected sketch vertex.


    [read-only] started : bool

    Indicates whether the sketch editor is started and will respond to user interactions with the view (read-only).


    [default] style : SketchStyle

    The object describing the styling of the sketch editor.


    visible : bool

    Whether the SketchEditor is visible


    Signal Documentation

    creationModeChanged()

    Emitted when the creationMode property changes.

    Note: The corresponding handler is onCreationModeChanged.


    geometryChanged()

    Emitted when the geometry property changes.

    Note: The corresponding handler is onGeometryChanged.


    opacityChanged()

    Emitted when the opacity property changes.

    Note: The corresponding handler is onOpacityChanged.


    selectedVertexChanged()

    Emitted when the selectedVertex property changes.

    Note: The corresponding handler is onSelectedVertexChanged.


    startedChanged()

    Emitted when the started property changes.

    Note: The corresponding handler is onStartedChanged.


    styleChanged()

    Emitted when the style property changes.

    Note: The corresponding handler is onStyleChanged.


    visibleChanged()

    Emitted when the visible property changes.

    Note: The corresponding handler is onVisibleChanged.


    Method Documentation

    bool insertVertexAfterSelectedVertex(Point point)

    Inserts point after the currently selected vertex programmatically. Requires a vertex to be selected. Returns whether the insertion was successful.


    bool isSketchValid()

    A lightweight check to see if the current Geometry of this SketchEditor can produce a valid geometry. Returns true if:

    • It is a Point and contains non-NaN x and y coordinates
    • It is a Multipoint and contains at least one valid vertex
    • It is a Polyline with at least 2 valid vertices in each part, and at least one part
    • It is a Polygon with at least 3 valid vertices in each part, and at least one part
    • It is an Envelope and it contains non-NaN xmin, ymin, xmax, and ymax-coordinates

    bool moveSelectedVertex(Point point)

    Moves the selected vertex to point programmatically. Requires a vertex to be selected. Returns whether the move was successful.


    void redo()

    Redoes the last undo.


    bool removeSelectedVertex()

    Removes the currently selected vertex programmatically. Requires a vertex to be selected. Returns whether the removal was successful.


    bool replaceGeometry(Geometry geometry)

    Replaces the entire sketch geometry with geometry programmatically. Returns whether the replace was successful.


    bool startWithCreationMode(Enums.SketchCreationMode creationMode)

    Starts an empty sketch of type based on the provided creationMode.

    The sketch editor begins responding to user interactions with the MapView to perform the sketch. Returns whether startCreationMode was successful.


    bool startWithCreationModeAndEditConfiguration(Enums.SketchCreationMode creationMode, SketchEditConfiguration editConfiguration)

    Starts an empty sketch of geometry type based on the provided creationMode, with capabilities based on provided editConfiguration.

    The sketch editor begins responding to user interactions with the MapView to perform the sketch. Depending on how the SketchEditConfiguration is configured, the Sketcheditor will exhibit different behaviours and capabilites.

    Returns whether startWithCreationModeAndEditConfiguration was successful.


    bool startWithGeometry(Geometry geometry)

    Starts a sketch based on the provided geometry.

    The sketch editor begins responding to user interactions with the MapView to perform the sketch. The creationMode defaults to SketchCreationMode.Point, SketchCreationMode.Polyline, or SketchCreationMode.Polygon depending upon the type of geometry provided.

    Returns whether startWithGeometry was successful.


    bool startWithGeometryAndCreationMode(Geometry geometry, Enums.SketchCreationMode creationMode)

    Starts a sketch based on the provided geometry.

    The sketch editor begins responding to user interactions with the MapView to perform the sketch. Returns whether startWithGeometryAndCreationMode was successful.

    Note: geometry can be null, equivalent to call SketchEditor::startWithCreationMode.

    Note: creationMode must correspond to the type of geometry, or start will fail and this method will return false.


    bool startWithGeometryCreationModeAndEditConfiguration(Geometry geometry, Enums.SketchCreationMode creationMode, SketchEditConfiguration editConfiguration)

    Starts a sketch based on the provided geometry , creationMode and editConfiguration.

    The sketch editor begins responding to user interactions with the MapView to perform the sketch. Depending on how the SketchEditConfiguration is configured, the sketch editor will exhibit different behaviours and capabilites.

    Returns whether startWithGeometryCreationModeAndEditConfiguration was successful.

    Note: geometry can be null, equivalent to call SketchEditor::startWithCreationModeAndEditConfiguration.

    Note: creationMode must correspond to the type of geometry, or start will fail and this method will return false.


    void stop()

    Stops the sketch by making the sketch editor no longer respond to user interaction.

    This also clears the SketchEditor::geometry.


    void undo()

    Undoes the last sketch action.


    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.