UserDrawing

UserDrawing

new UserDrawing(options)

Source:

For user drawings, which includes lines and/or a polygon

Parameters:
Name Type Description
options Object

Object with the following properties:

Properties
Name Type Attributes Default Description
terria Terria

The Terria instance.

messageHeader String <optional>
'Draw on Map'

Heading for the dialog which pops up when in user drawing mode

allowPolygon Bool <optional>
true

Let the user click on first point to close loop

onPointClicked PointClickedCallback <optional>

Way to subscribe to point clicks

onPointMoved PointMovedCallback <optional>

Way to subscribe to point moves

onCleanUp CleanUpCallback <optional>

Way to add own cleanup

onMakeDialogMessage MakeDialogMessageCallback <optional>

Way to customise dialog message

Members

allowPolygon :Bool

Source:
Default Value:
  • true

If true, user can click on first point to close the line, turning it into a polygon.

Type:
  • Bool

closeLoop :Bool

Source:

Whether the first and last point in the user drawing are the same

Type:
  • Bool

inDrawMode :Bool

Source:

Whether to interpret user clicks as drawing

Type:
  • Bool

messageHeader :String

Source:
Default Value:
  • 'Draw on Map'

Text that appears at the top of the dialog when drawmode is active.

Type:
  • String

onCleanUp :CleanUpCallback

Source:
Default Value:
  • undefined

Callback that occurs on clean up, i.e. when drawing is done or cancelled.

Type:

onMakeDialogMessage :MakeDialogMessageCallback

Source:
Default Value:
  • undefined

Callback that occurs when the dialog is redrawn, to add additional information to dialog.

Type:

onPointClicked :PointClickedCallback

Source:
Default Value:
  • undefined

Callback that occurs when point is clicked (may be added or removed). Function takes a CustomDataSource which is a list of PointEntities.

Type:

onPointMoved :PointMovedCallback

Source:
Default Value:
  • undefined

Callback that occurs when point is moved. Function takes a CustomDataSource which is a list of PointEntities.

Type:

otherEntities :CustomDataSource

Source:

Storage for line that connects the points, and polygon if the first and last point are the same

Type:

pointEntities :CustomDataSource

Source:

Storage for points that will be drawn

Type:

polygon :Entity

Source:

Polygon that will be drawn if the user drawing is a closed shape

Type:
  • Entity

terria :Terria

Source:
Default Value:
  • undefined

Instance of Terria

Type:

(inner) svgDataDeclare

Source:

SVG element for point drawn when user clicks. http://stackoverflow.com/questions/24869733/how-to-draw-custom-dynamic-billboards-in-cesium-js

Methods

enterDrawMode()

Source:

Start interpreting user clicks as placing or removing points.