Allows you to create polygon or polyline geometries with a geometric shape by using a single drag interaction. More...
Header: | #include <ShapeTool.h> |
Since: | Esri::ArcGISRuntime 200.2 |
Inherits: | Esri::ArcGISRuntime::GeometryEditorTool |
Public Functions
virtual | ~ShapeTool() override |
Esri::ArcGISRuntime::InteractionConfiguration * | configuration() const |
void | setConfiguration(Esri::ArcGISRuntime::InteractionConfiguration *configuration) |
Esri::ArcGISRuntime::ShapeToolType | shapeType() const |
Static Public Members
Esri::ArcGISRuntime::ShapeTool * | create(Esri::ArcGISRuntime::ShapeToolType shapeType, QObject *parent = nullptr) |
Detailed Description
Create a new shape tool using create(Esri::ArcGISRuntime::ShapeToolType, QObject*) and specify the type of shape to be created - the shapeType cannot be changed after the tool is instantiated. Call GeometryEditor::start(Esri::ArcGISRuntime::GeometryType), passing in either GeometryType::Polyline or GeometryType::Polygon, then drag on the MapView to define the location and size of the shape. For example, drag diagonally to define the corners of a bounding box within which a ShapeToolType::Rectangle or ShapeToolType::Arrow shape fits, or to define the center point and a point on the circumference of an ShapeToolType::Ellipse or point of a ShapeToolType::Triangle.
You can select different GeometryEditorElement objects by tapping, move selected elements, and use transformation control handles to rotate and scale the selected elements, subject to the current configuration.
You can also use this tool to add new geometric shaped parts to existing polygon or polyline geometries by setting InteractionConfiguration::isAllowPartCreation to true
in the configuration and calling GeometryEditor::start(const Esri::ArcGISRuntime::Geometry&). You cannot use ShapeTool to create geometry types other than GeometryType::Polygon or GeometryType::Polyline.
By default, this tool does not display vertices or mid-vertices because you do not interact with individual vertices using this tool. The appearance can be customized by changing style. By default, this tool enables creation, selection, transformation, and deletion. This behavior can be customized with configuration.
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, FreehandTool, ReticleVertexTool, and GeometryEditor::tool.
Member Function Documentation
[override virtual]
ShapeTool::~ShapeTool ()
Destructor.
Esri::ArcGISRuntime::InteractionConfiguration *ShapeTool::configuration() const
Defines the set of interactive operations enabled when using this tool.
By default, this tool has an InteractionConfiguration::isAllowPartCreation value of false
in the configuration, which allows only the initial part of the specified shape to be added interactively - subsequent interactions may navigate the map view instead of changing the geometry. To add additional parts to the geometry with each new drag interaction, each with the specified ShapeToolType, set InteractionConfiguration::isAllowPartCreation to true
.
See also setConfiguration().
[static]
Esri::ArcGISRuntime::ShapeTool *ShapeTool::create(Esri::ArcGISRuntime::ShapeToolType shapeType , QObject *parent = nullptr)
Creates a ShapeTool to draw the specified ShapeToolType.
- shapeType - The type of shape drawn by this tool.
- parent - The optional QObject parent.
By default, this tool enables the creation, selection, transformation, and deletion interactions appropriate for creating geometries with a geometric shape. This behavior can be customized with configuration.
See also shapeType.
[since Esri::ArcGISRuntime 200.2]
void ShapeTool::setConfiguration (Esri::ArcGISRuntime::InteractionConfiguration *configuration)
Sets the configuration to configuration.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also configuration.
Esri::ArcGISRuntime::ShapeToolType ShapeTool::shapeType () const
Returns the type of geometric shape drawn by this tool, set at instantiation using create(Esri::ArcGISRuntime::ShapeToolType, QObject*).