new DrawPolygon(viewer, optionsopt)
DrawPolygon class for drawing a polygon in a Cesium viewer.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
Cesium.Viewer | The Cesium viewer instance. | |||||||||||||
options |
Object |
<optional> |
Options for the drawing tool.
Properties
|
- Source:
Example
const drawPolygon = new DrawPolygon(viewer, { color: Cesium.Color.RED });
drawPolygon.on();
// To disable the drawing tool and clear entities
drawPolygon.off();
Methods
getPositions() → {Array}
get position of the polygon
- Source:
Returns:
cartesians - Array of Cesium.Cartesian3 positions
- Type
- Array
off() → {void}
Disables the polygon drawing tool. and clears the entities.
- Source:
Returns:
- Type
- void
on() → {boolean|void}
Enables the polygon drawing tool.
Left click to add points, right click to finish.
- Source:
Returns:
-
Continue - Whether to continue measuring after the first click.
- Type
- boolean
-
- Type
- void