Defines the set of interactive operations you can enable or disable for a VertexTool or FreehandTool. More...
Header: | #include <InteractionConfiguration.h> |
Since: | Esri::ArcGISRuntime 200.1 |
Inherits: | Esri::ArcGISRuntime::Object |
Public Functions
InteractionConfiguration(QObject *parent = nullptr) | |
virtual | ~InteractionConfiguration() override |
bool | isAllowDeletingSelectedElement() const |
bool | isAllowGeometrySelection() const |
bool | isAllowMidVertexSelection() const |
bool | isAllowMovingSelectedElement() const |
bool | isAllowPartCreation() const |
bool | isAllowPartSelection() const |
bool | isAllowRotatingSelectedElement() const |
bool | isAllowScalingSelectedElement() const |
bool | isAllowVertexCreation() const |
bool | isAllowVertexSelection() const |
bool | isRequireSelectionBeforeMove() const |
Esri::ArcGISRuntime::GeometryEditorScaleMode | scaleMode() const |
void | setAllowCreation(bool allowCreation) |
void | setAllowDeletingSelectedElement(bool allowDeletingSelectedElement) |
void | setAllowDeletion(bool allowDeletion) |
void | setAllowGeometrySelection(bool allowGeometrySelection) |
void | setAllowMidVertexSelection(bool allowMidVertexSelection) |
void | setAllowMovingSelectedElement(bool allowMovingSelectedElement) |
void | setAllowPartCreation(bool allowPartCreation) |
void | setAllowPartSelection(bool allowPartSelection) |
void | setAllowRotatingSelectedElement(bool allowRotatingSelectedElement) |
void | setAllowScalingSelectedElement(bool allowScalingSelectedElement) |
void | setAllowSelection(bool allowSelection) |
void | setAllowTransformation(bool allowTransformation) |
void | setAllowVertexCreation(bool allowVertexCreation) |
void | setAllowVertexSelection(bool allowVertexSelection) |
void | setRequireSelectionBeforeMove(bool requireSelectionBeforeMove) |
void | setScaleMode(Esri::ArcGISRuntime::GeometryEditorScaleMode scaleMode) |
Detailed Description
An InteractionConfiguration allows you to customize the interactive geometry editing experience to suit your specific users. For example:
- Disable vertex, mid-vertex, and part selection (isAllowVertexCreation, isAllowMidVertexSelection, isAllowPartCreation) to define a tool to only move the complete geometry.
- Disable moving the selected element (isAllowMovingSelectedElement) but allow all selections, and provide a tool for a user to enter new coordinates instead of moving interactively.
You can tap multiple times on any GeometryEditorElement to select the different types of GeometryEditorElement representing vertices, parts, and the entire geometry. For example if all elements are allowed to be selected:
- tap twice on a vertex of a Multipoint to select first the vertex and then the entire multipoint geometry
- tap three times on a vertex of a Polyline or Polygon to select first the vertex, then the part, and then the entire geometry
- tap twice on an edge of a Polyline or Polygon to select first the part and then the entire geometry
- tap twice on a fill of a Polygon to select first the part and then the entire geometry
Depending on the values of isAllowMovingSelectedElement, isAllowRotatingSelectedElement, and isAllowScalingSelectedElement, visual handles are displayed to help the user move, rotate, or scale the selected element.
You can change the interaction properties of a tool at any point, including when a geometry editor is started (GeometryEditor::isStarted = true
) and the tool is in use by the editor. If you change a property that disallows an in-progress interaction, then the interaction is cancelled and does not affect the state of the GeometryEditor.
Convenience methods are available to quickly set all properties relative to a category of interaction - for example use setAllowSelection(bool) to change all selection interactions, and setAllowTransformation(bool) to change all properties that control geometry transformation.
Relevant samples:
- Create and edit geometries: Use the Geometry Editor to create new point, multipoint, polyline, or polygon geometries or to edit existing geometries by interacting with a map view.
See also VertexTool::configuration, FreehandTool::configuration, setAllowSelection(bool), setAllowTransformation(bool), setAllowDeletion(bool), and ReticleInteractionConfiguration.
Member Function Documentation
[explicit]
InteractionConfiguration::InteractionConfiguration (QObject *parent = nullptr)
Creates an InteractionConfiguration that enables selection, transformation and deletion.
- parent - The optional parent QObject.
Defines the most powerful and least restrictive interactive experience. When you create a new VertexTool or FreehandTool, its InteractionConfiguration property defines the values appropriate for that tool, which may differ from the default values set by this constructor. For more information on the different default values for these tools, see VertexTool and FreehandTool.
See also VertexTool::configuration, FreehandTool::configuration, setAllowSelection(bool), setAllowTransformation(bool), and setAllowDeletion(bool).
[override virtual]
InteractionConfiguration::~InteractionConfiguration ()
Destructor.
bool InteractionConfiguration::isAllowDeletingSelectedElement () const
Returns true
if the selected GeometryEditorElement can be interactively deleted, false
otherwise. Default is true
.
Whether true
or false
, an element can be deleted by GeometryEditor::deleteSelectedElement.
If false
, then the GeometryEditorElement::canDelete property of the GeometryEditor::selectedElement is also false
. If you have implemented a customization to allow users to interactively delete the selected element, then you can use this property to check if that customization should be enabled.
setAllowDeletion(bool) sets this property.
bool InteractionConfiguration::isAllowGeometrySelection () const
Returns true
if the entire geometry can be interactively selected, false
otherwise. Default is true
.
If true
, you can tap multiple times on elements of the geometry to make the entire geometry selected.
Whether true
or false
, the entire geometry can be selected by GeometryEditor::selectGeometry.
setAllowSelection(bool) sets this property.
See also GeometryEditor::selectedElement, GeometryEditor::selectedElementChanged, and GeometryEditorGeometry.
bool InteractionConfiguration::isAllowMidVertexSelection () const
Returns true
if a mid-vertex of a polygon or polyline can be interactively selected, false
otherwise. Default is true
.
By default, mid-vertices (GeometryEditorMidVertex) are displayed and can be helpful in interactive workflows to provide a visual cue that new vertices can be inserted between the existing vertices of polygons and polylines. They may be most helpful for users with less editing experience.
If true
, and isAllowVertexCreation is also true
, then you can select and drag a mid-vertex to insert a vertex into the GeometryEditor::geometry and immediately move it to the required position.
If false
, and you also do not intend to programmatically select any mid-vertices (GeometryEditor::selectMidVertex(int, int)) then set GeometryEditorStyle::midVertexSymbol to empty to prevent the display of unusable mid-vertices.
Whether true
or false
, a mid-vertex can be selected by GeometryEditor::selectMidVertex(int, int).
setAllowSelection(bool) sets this property.
See also GeometryEditor::selectedElement and GeometryEditor::selectedElementChanged.
bool InteractionConfiguration::isAllowMovingSelectedElement () const
Returns true
if the selected GeometryEditorElement can be interactively moved, false
otherwise. Default is true
.
If true
, you can use a drag gesture to move the selected GeometryEditorElement to the required location. Create a tool to allow moving only specific types of GeometryEditorElement by also allowing or disallowing the selection of different types of element (isAllowVertexSelection for example).
If false
, the behavior of a drag gesture depends on the current GeometryEditor::tool. A VertexTool will pan the map, whereas a FreehandTool will create a new part (depending on isAllowPartCreation).
If true
, and the selected element is a GeometryEditorPart or a GeometryEditorGeometry with a geometry type of GeometryType::Polyline or GeometryType::Polygon, then a bounding box is drawn using the GeometryEditorStyle::boundingBoxSymbol.
setAllowTransformation(bool) sets this property.
See also isRequireSelectionBeforeMove.
bool InteractionConfiguration::isAllowPartCreation () const
Returns true
if you can interactively create a new part in a polyline or polygon, false
otherwise. Default is true
.
If true
and the GeometryType of the GeometryEditor::geometry is a polygon or polyline, you can you can add new parts to the Multipart geometry - the GeometryEditor::tool determines the interaction required to add the new part. If the GeometryType of the GeometryEditor::geometry is a point or multipoint, this property is ignored. For new geometry creation (using GeometryEditor::start(Esri::ArcGISRuntime::GeometryType), or calling GeometryEditor::start(const Esri::ArcGISRuntime::Geometry&) with an empty geometry), this property is always ignored when adding the first part, and respected thereafter.
Users less experienced with GIS data may not understand how visually separate parts of polygons and polylines form a single geometry. You may wish to prevent such users from inadvertently creating geometries with multiple parts in order to keep their workflows straightforward and understandable. Alternatively, your app may be editing data which does not support multipart geometries.
setAllowCreation(bool) sets this property.
{GeometryEditor::replaceGeometry(const Esri::ArcGISRuntime::Geometry&)}, {Esri::ArcGISRuntime::InteractionConfiguration::isAllowVertexCreation} {isAllowVertexCreation}
See also Esri::ArcGISRuntime::GeometryEditor::replaceGeometry(const Esri::ArcGISRuntime::Geometry&).
bool InteractionConfiguration::isAllowPartSelection () const
Returns true
to allow a part of a Multipart geometry (Polyline or Polygon) to be selected interactively, false
otherwise. Default is true
.
If true
, you can tap on the edge of a polygon or polyline GeometryEditorGeometry in order to the select the part.
Whether true
or false
, a part can be selected by GeometryEditor::selectPart(int). Parts are also selected after creation using a FreehandTool.
setAllowSelection(bool) sets this property.
See also isAllowPartCreation and GeometryEditorPart.
[since Esri::ArcGISRuntime 200.2]
bool InteractionConfiguration::isAllowRotatingSelectedElement () const
Returns true
to allow you to interactively rotate the selected GeometryEditorElement, false
otherwise. Default is true
.
This property applies when the GeometryEditor::selectedElement is:
- a GeometryEditorGeometry when GeometryEditor::geometry is a GeometryType::Polygon, a GeometryType::Polyline, or a GeometryType::Multipoint
- a GeometryEditorPart
For example, this does not apply if the selected element is a GeometryEditorVertex because a zero-dimensional geometry cannot be rotated.
When this property is true
, and the GeometryEditor::selectedElement is rotatable, then a control handle is displayed (see GeometryEditorStyle::rotateHandleSymbol) that allows the selected element to be interactively rotated. The bounding box of the selected element is also displayed (GeometryEditorStyle::boundingBoxSymbol).
Interactive rotation changes the position of the selected element according to the movement of the rotation handle using the center of the extent of the selected element as the center of rotation (origin). Use GeometryEditor::rotateSelectedElement(double, const Esri::ArcGISRuntime::Point&) to rotate the selected element around a given origin.
setAllowTransformation(bool) sets this property.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also GeometryEditorElement::canRotate and GeometryEditor::geometryChanged.
[since Esri::ArcGISRuntime 200.2]
bool InteractionConfiguration::isAllowScalingSelectedElement () const
Returns true
to allow you to interactively scale the selected GeometryEditorElement, false
otherwise. Default is true
.
This property applies when the GeometryEditor::selectedElement is:
- a GeometryEditorGeometry when GeometryEditor::geometry is a GeometryType::Polygon, a GeometryType::Polyline, or a GeometryType::Multipoint
- a GeometryEditorPart
For example, this does not apply if the selected element is a GeometryEditorVertex because a zero-dimensional geometry cannot be scaled.
When this property is true
, and the GeometryEditor::selectedElement is scalable, then control handles are displayed (see GeometryEditorStyle::boundingBoxHandleSymbol) that allow the selected element to be interactively scaled. The bounding box of the selected element is also displayed (GeometryEditorStyle::boundingBoxSymbol).
Interactive scaling changes the extent of the selected element according to the movement of the scale handle being moved - the opposite handle is used as the origin of the scale transformation. Use GeometryEditor::scaleSelectedElement(double, double, const Esri::ArcGISRuntime::Point&) to scale the selected element relative to a given origin.
setAllowTransformation(bool) sets this property.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also GeometryEditorElement::canScale and GeometryEditor::geometryChanged.
bool InteractionConfiguration::isAllowVertexCreation () const
Returns true
to allow a vertex to be created interactively, false
otherwise. Default is true
.
If true
, you can tap on the map to add a new vertex. The vertex is inserted after the previously selected vertex, or as the first vertex if the previous selection was the first vertex in a Polyline. If you tap on an existing GeometryEditorElement then selection occurs instead.
A FreehandTool ignores this property as it does not create individual vertices; instead you use a freehand gesture to create a part in a polygon or polyline geometry.
Whether true
or false
, a vertex can be created by GeometryEditor::insertVertex(const Esri::ArcGISRuntime::Point&).
setAllowCreation(bool) sets this property.
See also GeometryEditor::geometryChanged and isAllowPartCreation.
bool InteractionConfiguration::isAllowVertexSelection () const
Returns true
to allow vertices to be selected interactively, false
otherwise. Default is true
.
If true
, you can tap on a vertex to select it.
To prevent vertices from being selected interactively by tapping on the vertex, while still allowing programmatic selection, set isAllowVertexSelection to false
.
Whether true
or false
, a vertex may still become selected in other ways, for example by a call to GeometryEditor::selectVertex(int, int), or when a new vertex is created.
setAllowSelection(bool) sets this property.
See also GeometryEditor::selectedElement, GeometryEditor::selectedElementChanged, and GeometryEditorVertex.
bool InteractionConfiguration::isRequireSelectionBeforeMove () const
Returns true
to require a GeometryEditorElement to first be selected before it can be moved by interactively dragging, false
otherwise. Default is false
.
By default, you can select and immediately move an element in one gesture. Some users may find this can lead to an increase in accidental element moves when editing. By setting this to true
, this can reduce the possibility of accidental moves. Alternatively, you may wish to provide access to GeometryEditor::undo and GeometryEditor::redo to provide easy correction of accidental edits.
If false
, the behavior of a drag gesture depends on the current GeometryEditor::tool. For a VertexTool, a drag gesture on the map over a geometry editor element that is not already selected pans the map, whereas a FreehandTool will create a new part (depending on isAllowPartCreation).
This property applies if and only if isAllowMovingSelectedElement is true
.
[since Esri::ArcGISRuntime 200.2]
Esri::ArcGISRuntime::GeometryEditorScaleMode InteractionConfiguration::scaleMode () const
Determines how a geometry can be interactively scaled (resized) to fill its allocated space while using the GeometryEditor.
This property is ignored during geometry editing if isAllowScalingSelectedElement is false
. It will be used to define how geometries are initially created by a drag interaction when the active tools is a ShapeTool regardless of the value of isAllowScalingSelectedElement.
The scale control handles displayed to the user differ according to the value of this property.
{isAllowScalingSelectedElement}, {Esri::ArcGISRuntime::GeometryEditorElement::canScale} {GeometryEditorElement::canScale}, {Esri::ArcGISRuntime::GeometryEditor::scaleSelectedElement(double, double, const Esri::ArcGISRuntime::Point&)} {GeometryEditor::scaleSelectedElement(double, double, const Esri::ArcGISRuntime::Point&)}
This function was introduced in Esri::ArcGISRuntime 200.2.
See also setScaleMode() and Esri::ArcGISRuntime::InteractionConfiguration::isAllowScalingSelectedElement.
void InteractionConfiguration::setAllowCreation (bool allowCreation )
Enable or disable creation.
- allowCreation - Indicates if creation is allowed.
Sets the following properties:
Deletion, selection and transformation properties are unaltered.
void InteractionConfiguration::setAllowDeletingSelectedElement (bool allowDeletingSelectedElement )
Sets the allowDeletingSelectedElement to allowDeletingSelectedElement.
See also isAllowDeletingSelectedElement.
void InteractionConfiguration::setAllowDeletion (bool allowDeletion )
Enable or disable deletion.
- allowDeletion - Indicates if deletion is allowed.
Sets the following properties:
Creation, selection and transformation properties are unaltered.
void InteractionConfiguration::setAllowGeometrySelection (bool allowGeometrySelection )
Sets the allowGeometrySelection to allowGeometrySelection.
See also isAllowGeometrySelection.
void InteractionConfiguration::setAllowMidVertexSelection (bool allowMidVertexSelection )
Sets the allowMidVertexSelection to allowMidVertexSelection.
See also isAllowMidVertexSelection.
void InteractionConfiguration::setAllowMovingSelectedElement (bool allowMovingSelectedElement )
Sets the allowMovingSelectedElement to allowMovingSelectedElement.
See also isAllowMovingSelectedElement.
void InteractionConfiguration::setAllowPartCreation (bool allowPartCreation )
Sets the allowPartCreation to allowPartCreation.
See also isAllowPartCreation.
void InteractionConfiguration::setAllowPartSelection (bool allowPartSelection )
Sets the allowPartSelection to allowPartSelection.
See also isAllowPartSelection.
void InteractionConfiguration::setAllowRotatingSelectedElement (bool allowRotatingSelectedElement )
Sets the allowRotatingSelectedElement to allowRotatingSelectedElement.
See also isAllowRotatingSelectedElement.
void InteractionConfiguration::setAllowScalingSelectedElement (bool allowScalingSelectedElement )
Sets the allowScalingSelectedElement to allowScalingSelectedElement.
See also isAllowScalingSelectedElement.
void InteractionConfiguration::setAllowSelection (bool allowSelection )
Enable or disable selection.
- allowSelection - Indicates if selection is allowed.
Sets the following properties:
Creation, deletion and transformation properties are unaltered.
void InteractionConfiguration::setAllowTransformation (bool allowTransformation )
Enable or disable interactions that transform the GeometryEditor::geometry, for example isAllowMovingSelectedElement.
- allowTransformation - Indicates if transformation is allowed.
Sets the following properties:
Creation, deletion and selection properties are unaltered.
void InteractionConfiguration::setAllowVertexCreation (bool allowVertexCreation )
Sets the allowVertexCreation to allowVertexCreation.
See also isAllowVertexCreation.
void InteractionConfiguration::setAllowVertexSelection (bool allowVertexSelection )
Sets the allowVertexSelection to allowVertexSelection.
See also isAllowVertexSelection.
void InteractionConfiguration::setRequireSelectionBeforeMove (bool requireSelectionBeforeMove )
Sets the requireSelectionBeforeMove to requireSelectionBeforeMove.
See also isRequireSelectionBeforeMove.
[since Esri::ArcGISRuntime 200.2]
void InteractionConfiguration::setScaleMode (Esri::ArcGISRuntime::GeometryEditorScaleMode scaleMode )
Sets the scaleMode to scaleMode.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also scaleMode.