java.lang.Object
com.esri.arcgisruntime.mapping.view.geometryeditor.GeometryEditorTool
com.esri.arcgisruntime.mapping.view.geometryeditor.ShapeTool

public final class ShapeTool extends GeometryEditorTool
Allows you to create polygon or polyline geometries with a geometric shape by using a single drag interaction.

Create a new shape tool using create(ShapeToolType) and specify the type of shape to be created - the shapeTypeProperty() cannot be changed after the tool is instantiated. Call GeometryEditor.start(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 a 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 configurationProperty().

You can also use this tool to add new geometric shaped parts to existing polygon or polyline geometries by setting InteractionConfiguration.allowPartCreationProperty() to true in the ShapeTool.configurationProperty() and calling GeometryEditor.start(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 GeometryEditorTool.styleProperty(). By default, this tool enables creation, selection, transformation, and deletion. This behavior can be customized with ShapeTool.configurationProperty().

Since:
200.2.0
See Also:
  • Property Details

  • Method Details

    • configurationProperty

      public ObjectProperty<InteractionConfiguration> configurationProperty()
      Defines the set of interactive operations enabled when using this tool.

      By default, this tool has an InteractionConfiguration.allowPartCreationProperty() value of false in the configurationProperty(), 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.allowPartCreationProperty() to true.

      Attempting to set the value to null will throw a NullPointerException exception.

      Since:
      200.2.0
      See Also:
    • getConfiguration

      public InteractionConfiguration getConfiguration()
      Gets the value of the property configuration.
      Property description:
      Defines the set of interactive operations enabled when using this tool.

      By default, this tool has an InteractionConfiguration.allowPartCreationProperty() value of false in the configurationProperty(), 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.allowPartCreationProperty() to true.

      Attempting to set the value to null will throw a NullPointerException exception.

      Since:
      200.2.0
    • setConfiguration

      public void setConfiguration(InteractionConfiguration configuration)
      Sets the value of the property configuration.
      Property description:
      Defines the set of interactive operations enabled when using this tool.

      By default, this tool has an InteractionConfiguration.allowPartCreationProperty() value of false in the configurationProperty(), 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.allowPartCreationProperty() to true.

      Attempting to set the value to null will throw a NullPointerException exception.

      Since:
      200.2.0
    • shapeTypeProperty

      public ReadOnlyObjectProperty<ShapeToolType> shapeTypeProperty()
      The type of geometric shape drawn by this tool, set at instantiation using create(ShapeToolType).
      Since:
      200.2.0
      See Also:
    • getShapeType

      public ShapeToolType getShapeType()
      Gets the value of the property shapeType.
      Property description:
      The type of geometric shape drawn by this tool, set at instantiation using create(ShapeToolType).
      Since:
      200.2.0
    • create

      public static ShapeTool create(ShapeToolType shapeType)
      Create a ShapeTool to draw the specified ShapeToolType.

      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 configurationProperty().

      Parameters:
      shapeType - the type of shape drawn by this tool
      Returns:
      a new ShapeTool with the given ShapeToolType and default configuration and style properties
      Throws:
      NullPointerException - if shapeType is null
      Since:
      200.2.0
      See Also: