SnapSettings Class

GeometryEditor."> SnapSettings Class | ArcGISQtCpp
  • SnapSettings
  • class Esri::ArcGISRuntime::SnapSettings

    Controls interactive snapping functionality for the GeometryEditor. More...

    Header: #include <SnapSettings.h>
    Since: Esri::ArcGISRuntime 200.4
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    SnapSettings(QObject *parent = nullptr)
    virtual ~SnapSettings() override
    bool isEnabled() const
    void setEnabled(bool enabled)
    QList<Esri::ArcGISRuntime::SnapSourceSettings *> sourceSettings() const
    void syncSourceSettings()

    Detailed Description

    Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors.

    If isEnabled is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. When the edit position has been adjusted, visual cues show the user the adjusted edit position, and which aspect of the feature geometry was used as the best candidate for that adjustment.

    To use snapping in the GeometryEditor:

    You can snap to SnapSource objects that are contained in the MapView associated with the GeometryEditor, and are visible. As snapping is used to maintain data integrity between different sources of data, only SnapSource objects that provide full resolution geometries can be used for snapping. See SnapSource for more information.

    The visual cues that indicate to a user when snapping has occurred can be customized using GeometryEditorStyle::snappedToVertexSymbol, GeometryEditorStyle::snappedToLineSymbol. If there are multiple potential candidates that could be snapped to for a given pointer position, then GeometryEditorStyle::multipleSnapCandidatesSymbol is used to indicate this.

    See also GeometryEditor, SnapSourceSettings, and SnapSource.

    Member Function Documentation

    [explicit] SnapSettings::SnapSettings(QObject *parent = nullptr)

    Creates a default SnapSettings.

    • parent - The optional parent QObject.

    [override virtual] SnapSettings::~SnapSettings()

    Destructor.

    bool SnapSettings::isEnabled() const

    Returns true if interactive geometry edits made using the GeometryEditor should happen using the current SnapSettings, false otherwise. Default is false.

    If isEnabled is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. The content of sourceSettings determines which sources of geometries can be used to snap to.

    void SnapSettings::setEnabled(bool enabled)

    Sets the enabled to enabled.

    See also isEnabled.

    QList<Esri::ArcGISRuntime::SnapSourceSettings *> SnapSettings::sourceSettings() const

    Returns defines the collection of snapping sources and whether or not each is enabled for snapping.

    Call syncSourceSettings to populate this collection with a SnapSourceSettings for each valid SnapSource present in the connected Map. SnapSettings is connected to a Map via GeometryEditor::snapSettings, MapView::geometryEditor, and MapView::map. If there is no connected map, or the map contains no valid SnapSource objects, then the collection will be empty after syncSourceSettings returns.

    The order of SnapSourceSettings objects will match the order that the associated SnapSource objects appear in the Map::operationalLayers collection. The collection will not contain a SnapSourceSettings for any SnapSource which is not yet LoadStatus::Loaded when syncSourceSettings is called.

    As snapping is used to maintain data integrity between different sources of data, only SnapSource objects that provide full resolution geometries as considered valid for creating a SnapSourceSettings object - see SnapSource for more information.

    void SnapSettings::syncSourceSettings()

    Synchronizes the sourceSettings collection based on SnapSource objects in the currently connected Map.

    Call this method to populate sourceSettings with a SnapSourceSettings for each valid SnapSource present in the Map currently connected to this SnapSettings via GeometryEditor::snapSettings, MapView::geometryEditor, and MapView::map. If there is no connected Map, or the map contains no SnapSource objects valid for snapping, then the collection will be empty after this method returns.

    The order of SnapSourceSettings objects will match the order that the associated SnapSource objects appear in the Map::operationalLayers collection. The collection will not contain a SnapSourceSettings for any SnapSource which is not yet LoadStatus::Loaded when syncSourceSettings is called.

    Subsequent calls will update the existing collection, accounting for SnapSource objects that have been added, removed, or moved since the last call to the same connected map. Any changes made to existing SnapSourceSettings objects, for example setting SnapSourceSettings::isEnabled, will be preserved.

    See also sourceSettings.

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