Base class for a handle that draws helper shapes.

Subclasses should override EditHandle.onDraw and draw shapes with getHelperStyle. Typically the helper style is EditHandleStyles.helperStyle.

Since

2022.1

Hierarchy

Constructors

Accessors

Methods

  • Emits an "EditShape" event.

    Typically, a handle emits this right after changing the shape.

    Parameters

    Returns void

  • Returns the mouse cursor to show.

    CreateController will check the active handle's cursor on every map's cursor when the returned cursor string changes.

    The default implementation always returns null.

    Parameters

    Returns null | string

    a cursor, or null if no mouse cursor should be shown for this handle.

  • Returns the default helper style.

    This is the helper style that is used if no helperStyle was passed into the constructor.

    Parameters

    Returns null | ShapeStyle

    The context's helper style

  • Returns the drape target for a shape drawn by this helper handle.

    This will make sure "flat" helper shapes are draped on meshes, if there is a mesh layer on the map. 3D helper shapes are not draped.

    In detail, this uses the following heuristics to determine a DrapeTarget: By default, this uses the drapeTarget of getHelperStyle. If that is not defined, this looks at the shape's Z bounds (depth). If the shape has depth, this returns DrapeTarget.NOT_DRAPED. Otherwise, DrapeTarget.ALL is returned.

    Parameters

    Returns DrapeTarget

  • Returns the helper style, to be used for visualizing helper shapes in onDraw.

    This returns the helper style that was passed into the constructor. If no helper style was passed into the constructor, this returns the context's helper style.

    Parameters

    Returns null | ShapeStyle

  • Populates a context menu with entries.

    For example, a handle for a point in a polyline might add a "Delete point" context menu entry.

    Parameters

    • event: GestureEvent

      the input event that triggered opening the context menu.

    • context: EditContext

      the edit context

    • contextMenu: ContextMenu

      the context menu to add entries to.

    • onDone: (() => void)

      a callback that needs to be called when a menu action is performed. Call this at the end of the ContextMenuItem.action implementation.

        • (): void
        • Returns void

    Returns void

  • This method allows the handle to draw shapes on the map.

    For example, a point handle draws an icon at its point using EditHandleStyles.handleIconStyle.

    A handle can also draw "helper" shapes. These are shapes that are not interactive, but help the user while editing. For example, the base shape of an extruded shape, draped over terrain. Or lines showing how a point can move.

    For consistency with built-in handles, it's recommended to draw helper shapes using EditHandleStyles.handleIconStyle.

    The default implementation draws nothing.

    Parameters

    Returns void

  • This method allows the handle to draw labels on the map.

    For example, you can use this to show coordinates of points, or the current radius of a circle on top of an edit handle.

    The default implementation draws nothing.

    Parameters

    Returns void

  • Called when (another) handle changes the feature or shape, as indicated by the "EditShape" event.

    This handle can update its own state, based on the changed shape.

    For example, a PointListInsertHandle just inserted a point in a polyline. The PointListTranslateHandle uses the update to recalculate new sub-handles, based on the new polyline (with the extra point).

    The default implementation does nothing.

    Returns void

Events

"EditShape" event

  • on("EditShape", callback: ((event) => void)) : Handle
  • An event that is emitted whenever this handle changes the shape of a feature.

    EditShape

    Parameters

    • event: "EditShape"
    • callback: ((event) => void)

    Returns Handle