;

SketchEditor Class

  • SketchEditor
  • class Esri::ArcGISRuntime::SketchEditor

    A class that allows the user to sketch geometries on the map. More...

    Header: #include <SketchEditor>
    Since: Esri::ArcGISRuntime 100.12
    Inherits: Esri::ArcGISRuntime::Object

    This class was introduced in Esri::ArcGISRuntime 100.12.

    Public Functions

    SketchEditor(QObject *parent = nullptr)
    virtual ~SketchEditor() override
    Esri::ArcGISRuntime::SketchCreationMode creationMode() const
    Esri::ArcGISRuntime::Geometry geometry() const
    bool insertVertexAfterSelectedVertex(const Esri::ArcGISRuntime::Point &point)
    bool isSketchValid() const
    bool isStarted() const
    bool isVisible() const
    bool moveSelectedVertex(const Esri::ArcGISRuntime::Point &point)
    float opacity() const
    bool removeSelectedVertex()
    bool replaceGeometry(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::SketchVertex *selectedVertex() const
    void setOpacity(float opacity)
    void setSelectedVertex(Esri::ArcGISRuntime::SketchVertex *selectedVertex)
    void setStyle(Esri::ArcGISRuntime::SketchStyle *style)
    void setVisible(bool visible)
    Esri::ArcGISRuntime::SketchStyle *style() const

    Public Slots

    bool redo()
    bool start(Esri::ArcGISRuntime::SketchCreationMode creationMode, Esri::ArcGISRuntime::SketchEditConfiguration *editConfiguration)
    bool start(Esri::ArcGISRuntime::SketchCreationMode creationMode)
    bool start(const Esri::ArcGISRuntime::Geometry &geometry, Esri::ArcGISRuntime::SketchCreationMode creationMode, Esri::ArcGISRuntime::SketchEditConfiguration *editConfiguration)
    bool start(const Esri::ArcGISRuntime::Geometry &geometry, Esri::ArcGISRuntime::SketchCreationMode creationMode)
    bool start(const Esri::ArcGISRuntime::Geometry &geometry)
    void stop()
    bool undo()

    Signals

    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 MapView::setSketchEditor and then started to perform the sketch based on user interactions.

    Member Function Documentation

    SketchEditor::SketchEditor(QObject *parent = nullptr)

    Constructs a SketchEditor with an optional parent.

    [signal] void SketchEditor::creationModeChanged()

    Signal emitted when the creationMode changes.

    [signal] void SketchEditor::geometryChanged()

    Signal emitted when the geometry changes.

    [signal] void SketchEditor::opacityChanged()

    Signal emitted when opacity changes.

    [slot] bool SketchEditor::redo()

    Redoes the last undo. Returns whether the redo was successful.

    [signal] void SketchEditor::selectedVertexChanged()

    Signal emitted when selectedVertex changes.

    [slot] bool SketchEditor::start(Esri::ArcGISRuntime::SketchCreationMode creationMode, Esri::ArcGISRuntime::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 start was successful.

    [slot] bool SketchEditor::start(Esri::ArcGISRuntime::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 start was successful.

    [slot] bool SketchEditor::start(const Esri::ArcGISRuntime::Geometry &geometry, Esri::ArcGISRuntime::SketchCreationMode creationMode, Esri::ArcGISRuntime::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 Sketcheditor will exhibit different behaviours and capabilites. Returns whether start was successful.

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

    [slot] bool SketchEditor::start(const Esri::ArcGISRuntime::Geometry &geometry, Esri::ArcGISRuntime::SketchCreationMode creationMode)

    Starts a sketch based on the provided geometry and creationMode.

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

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

    [slot] bool SketchEditor::start(const Esri::ArcGISRuntime::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 start was successful.

    [signal] void SketchEditor::startedChanged()

    Signal emitted when isStarted changes.

    [slot] void SketchEditor::stop()

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

    This also clears the SketchEditor::geometry.

    [signal] void SketchEditor::styleChanged()

    Signal emitted when style changes.

    [slot] bool SketchEditor::undo()

    Undoes the last sketch action. Returns whether the undo was successful.

    [signal] void SketchEditor::visibleChanged()

    Signal emitted when isVisible changes.

    [override virtual] SketchEditor::~SketchEditor()

    Destructor.

    Esri::ArcGISRuntime::SketchCreationMode SketchEditor::creationMode() const

    Specifies which type of geometry will be sketched and what type of user interaction is used to create it.

    Esri::ArcGISRuntime::Geometry SketchEditor::geometry() const

    The geometry currently being sketched. It is updated as the user interacts with the view.

    bool SketchEditor::insertVertexAfterSelectedVertex(const Esri::ArcGISRuntime::Point &point)

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

    bool SketchEditor::isSketchValid() const

    Returns the result of 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

    Prior to Esri::ArcGISRuntime 100.8, only one part of a multipart polygon or polyline was required to have the minimum number (2 for a polyline, 3 for a polygon) of vertices.

    bool SketchEditor::isStarted() const

    Returns whether the sketch editor is started and will respond to user interactions with the view.

    bool SketchEditor::isVisible() const

    Returns whether the SketchEditor is visible.

    bool SketchEditor::moveSelectedVertex(const Esri::ArcGISRuntime::Point &point)

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

    float SketchEditor::opacity() const

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

    See also setOpacity().

    bool SketchEditor::removeSelectedVertex()

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

    bool SketchEditor::replaceGeometry(const Esri::ArcGISRuntime::Geometry &geometry)

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

    Esri::ArcGISRuntime::SketchVertex *SketchEditor::selectedVertex() const

    Returns the currently selected vertex.

    See also setSelectedVertex().

    void SketchEditor::setOpacity(float opacity)

    Sets the opacity of the SketchEditor

    See also opacity.

    void SketchEditor::setSelectedVertex(Esri::ArcGISRuntime::SketchVertex *selectedVertex)

    Sets the selectedVertex to selectedVertex.

    See also selectedVertex.

    void SketchEditor::setStyle(Esri::ArcGISRuntime::SketchStyle *style)

    Sets the style to style.

    See also style.

    void SketchEditor::setVisible(bool visible)

    Sets whether the SketchEditor is visible

    See also isVisible.

    Esri::ArcGISRuntime::SketchStyle *SketchEditor::style() const

    Returns the object describing the styling of the sketch editor.

    See also setStyle().

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