Class: DrawPolygon

DrawPolygon(viewer, optionsopt)

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
Name Type Attributes Description
color Cesium.Color <optional>
The color of the polygon.
clampToGround boolean <optional>
Whether to clamp the polygon to the ground.
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