Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DrawingBoard

The DrawingBoard is a tool to easily enable the user to draw the geometry for a feature by user interaction with mouse/touch "taps" on the screen. A feature based on the drawn geometry and custom properties can be created when the drawing operation is done.

Hierarchy

  • DrawingBoard

Index

Methods

addShape

  • Add a shape-point to the feature.

    Parameters

    • position: PixelPoint | GeoPoint

      the coordinate in pixels relative to the screen that should be added to the coordinates of the feature.

    • Optional navlink: Navlink

    Returns DrawingShape

cancel

  • cancel(): void
  • Cancel the current drawing operation.

    Returns void

create

  • Finish current drawing operation and create the drawn feature.

    Parameters

    • Optional properties: any

      properties the feature will be created with.

    Returns Line | Navlink | Area | undefined

    the created Feature or undefined if creation fails due to invalid geometry.

getGeometry

getLength

  • getLength(): number
  • Get the total number of coordinates / shape-points of the currently drawn feature.

    Returns number

    Number of coordinates

isActive

  • isActive(): boolean
  • Get the active state of the drawing board.

    Returns boolean

    true when active, otherwise false

removeShape

  • removeShape(index?: number): void
  • Remove a shape-point. If no index is defined, the last added shape-point will be removed.

    Parameters

    • Optional index: number

      the index of the shape-point to be removed.

    Returns void

setAttributes

  • setAttributes(p: any): void
  • deprecated
    • use setProperties instead.

    Parameters

    • p: any

    Returns void

setGeometry

  • Set the geometry of the currently drawn feature.

    If the geometry of an area (MultiPolygon) is specified, only the first exterior is processed.

    Parameters

    Returns void

setProperties

  • setProperties(properties: any): void
  • Set properties of the feature.

    Parameters

    • properties: any

      properties the feature will be created with.

    Returns void

start

  • Start a new drawing operation to shape/draw the geometry a feature by user interaction with mouse/touch "taps" on the screen.

    Parameters

    • Optional options: { connectTo?: Navlink; layer?: TileLayer; mode?: "Area" | "Line" | "Navlink"; onShapeAdd?: (event: EditorEvent) => void; onShapeRemove?: (event: EditorEvent) => void; position?: PixelPoint | GeoPoint; styleGroup?: Style[]; tolerance?: number }

      options to configure the drawing operation

      • Optional connectTo?: Navlink

        the Navlink feature to which the drawn Navlink should connect.

      • Optional layer?: TileLayer

        the layer where the feature should be created in.

      • Optional mode?: "Area" | "Line" | "Navlink"

        the type of feature that should be drawn.

      • Optional onShapeAdd?: (event: EditorEvent) => void

        event listener that's called for each shape-point that's being added by user interaction. The target of the event is the drawn shape-point DrawingShape

      • Optional onShapeRemove?: (event: EditorEvent) => void

        function that's called for each shape-point that's being removed by user interaction. The target of the event is the drawn shape-point DrawingShape

      • Optional position?: PixelPoint | GeoPoint

        defines the first coordinate /the starting position.

      • Optional styleGroup?: Style[]

        for custom draw styling.

      • Optional tolerance?: number

        The tolerance in meters, used to determine the level of simplification. The simplification is applied to the LineString geometry only after drawing the geometry is complete by calling DrawingBoard.create. Tolerance has no effect if mode is set to "Area". Set tolerance to 0 to disable simplification.

        defaultvalue

        1

    Returns boolean

Generated using TypeDoc