Class: MeasureDistance

MeasureDistance(viewer, optionsopt)

new MeasureDistance(viewer, optionsopt)

MeasureDistance class for measuring distances in a Cesium viewer. This class provides methods to enable and disable the measurement tool, as well as to calculate the distance between points.
Parameters:
Name Type Attributes Description
viewer Cesium.Viewer The Cesium viewer instance.
options Object <optional>
Options for the measurement tool.
Properties
Name Type Attributes Description
color Cesium.Color <optional>
The color of the measurement line and points.
clampToGround boolean <optional>
Whether to clamp the measurement to the ground.
Source:
Example
const measureDistance = new MeasureDistance(viewer, { color: Cesium.Color.RED });
measureDistance.on();
// To disable the measurement tool and clear entities:
measureDistance.off();

Methods

off() → {void}

Disables the measurement tool and clears the entities.
Source:
Returns:
Type
void

on() → {boolean|void}

Enables the distance measurement tool. Click to start measuring, and click again to stop.
Source:
Returns:
  • Continue - Whether to continue measuring after the first click.
    Type
    boolean
  • Type
    void