Class: ShapeEditor

ShapeEditor(worldWindow)

Provides a controller for editing shapes. Depending on the type of shape, the following actions are available:
  • Edit the location and size of its vertexes using control points;
  • Rotate the shape using a handle;
  • Drag the shape on the surface of the globe.

To start editing a shape, pass it to the ShapeEditor#edit method. To end the edition, call the ShapeEditor#stop method.

Dragging the body of the shape moves the whole shape. Dragging a control point performs the action associated with that control point. The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point.

This editor currently supports all surface shapes except SurfaceImage.

Constructor

new ShapeEditor(worldWindow)

Constructs a new shape editor attached to the specified World Window.
Parameters:
Name Type Description
worldWindow WorldWindow The World Window to associate this shape editor controller with.
Source:
Throws:
If the specified World Window is null or undefined.
Type
ArgumentError

Members

annotationAttributes :AnnotationAttributes

Attributes used for the annotation that displays hints during the actions on the shape.
Type:
Source:

moveControlPointAttributes :PlacemarkAttributes

Attributes used for the control points that move the boundaries of the shape.
Type:
Source:

resizeControlPointAttributes :PlacemarkAttributes

Attributes used for the control points that resize the shape.
Type:
Source:

rotateControlPointAttributes :PlacemarkAttributes

Attributes used for the control points that rotate the shape.
Type:
Source:

shadowControlPointAttributes :PlacemarkAttributes

Attributes used for the shadow control points used to mask the middle of a segment.
Type:
Source:

(readonly) shape :Object

The shape currently being edited.
Type:
  • Object
Source:

(readonly) worldWindow :WorldWindow

The World Window associated with this shape editor.
Type:
Source:

Methods

create(shape, properties) → {Promise}

Creates the specified shape. Currently, only surface shapes are supported.
Parameters:
Name Type Description
shape SurfaceShape The shape to edit.
properties Object Configuration properties for the shape:
  • TODO: describe properties fro each shape
  • attributes: {ShapeAttributes} attributes of the shape.
    Source:
    Returns:
    shape if the creator can create the specified shape; otherwise null.
    Type
    Promise

    edit(shape, config) → {Boolean}

    Edits the specified shape. Currently, only surface shapes are supported.
    Parameters:
    Name Type Description
    shape SurfaceShape The shape to edit.
    config Object Configuration properties for the ShapeEditor:
    • move: {Boolean} move true to enable move action on shape, false to disable move action on shape.
    • reshape: {Boolean} reshape true to enable reshape action on shape, false to disable reshape action on shape.
    • rotate: {Boolean} rotate true to enable rotate action on shape, false to disable rotate action on shape.
    • manageControlPoint: {Boolean} manageControlPoint true to enable the action to manage the control points of the shape, false to disable it.
      Source:
      Returns:
      true if the editor could start the edition of the specified shape; otherwise false.
      Type
      Boolean

      isCreatorEnabled()

      Identifies whether the shape editor create mode is armed.
      Source:
      Returns:
      true if armed, false if not armed.

      setCreatorEnabled(armed)

      Arms and disarms the shape editor create mode. When armed, editor monitors user input and builds the shape in response to user actions. When disarmed, the shape editor ignores all user input for creation of a new shape.
      Parameters:
      Name Type Description
      armed true to arm the shape editor create mode, false to disarm it.
      Source:

      stop() → {SurfaceShape}

      Stops the current edition activity if any.
      Source:
      Returns:
      The shape being edited if any; otherwise null.
      Type
      SurfaceShape