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
|
- 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.
Returns:
- Type
- void
on() → {boolean|void}
Enables the distance measurement tool.
Click to start measuring, and click again to stop.
Returns:
-
Continue - Whether to continue measuring after the first click.
- Type
- boolean
-
- Type
- void