Measurement

new IonSdkMeasurements.Measurement(options)

An abstract class defining a measurement.
Name Type Description
options Object An object with the following properties:
Name Type Description
scene Scene The scene
units MeasureUnits The selected units of measurement
locale String optional The BCP 47 language tag string customizing language-sensitive number formatting. If undefined, the runtime's default locale is used. See the Intl page on MDN
primitives PrimitiveCollection A collection in which to store the measurement primitives
labels LabelCollection A collection in which to add the labels
points PointPrimitiveCollection A collection in which to add points

Members

readonly icon : String

Gets the icon.

readonly id : String

Gets the id.

readonly instructions : Array.<String>

Gets the instruction text.

readonly mode : DrawingMode

Gets the current drawing mode.

selectedUnits : MeasureUnits

Gets and sets the selected units of measurement.

readonly thumbnail : String

Gets the thumbnail.

readonly type : String

Gets the type.

Methods

destroy()

Destroys the widget.

handleClick(clickPosition)

Handles click events while performing a measurement.
Name Type Description
clickPosition Cartesian2 The click position

handleDoubleClick()

Handles double click events while performing a measurement.

handleKeyDown(key)

Handles key down events by invoking the handler registered for the pressed key via Measurement#setKeyHandler.
Name Type Description
key String The KeyboardEvent.key value of the pressed key

handleLeftDown(mousePosition)

Handles left down mouse events while performing a measurement.
Name Type Description
mousePosition Cartesian2 The mouse position

handleLeftUp(mousePosition)

Handles left up mouse events while performing a measurement.
Name Type Description
mousePosition Cartesian2 The mouse position

handleMouseMove(mousePosition, shift)

Handles mouse move events while performing a measurement.
Name Type Description
mousePosition Cartesian2 The mouse position
shift boolean optional True if the shift key was pressed

hasKeyHandler(key)Boolean

Checks if a key handler is set for the specified key.
Name Type Description
key String The keyboard key to check
Returns:
true if a handler is set for the key, false otherwise.

isDestroyed()Boolean

Returns:
true if the object has been destroyed, false otherwise.

removeAllKeyHandlers()

Removes all registered key handlers.

removeKeyHandler(key)

Removes the key handler for the specified key. The key is a KeyboardEvent.key value (e.g. "Escape", "Delete", "z") and is case-sensitive.
Name Type Description
key String The keyboard key to remove the handler for

reset()

Resets the widget.

setKeyHandler(key, handler)

Sets a key handler for the specified key. The key must be a non-empty string matching a KeyboardEvent.key value (e.g. "Escape", "Delete", "z"). The value is case-sensitive.
Name Type Description
key String The keyboard key (e.g., "Escape", "Delete")
handler function The function invoked when the key is pressed
Throws:
  • DeveloperError : key must be a non-empty string and a valid KeyboardEvent.key value.
  • DeveloperError : handler must be a callback function.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.