polygon

The polygon object enables creation of polygon objects and provides access to created objects. The following member and method are available:

§  items

§  create()

items 

static items : Array<TerraExplorerObject>

Returns an array of TerraExplorerObject containing all polygon objects in the project.

create

create(description, verticesArr, options) → {promise}

Creates a polygon object.

Parameters

Name

Type

Description

description

String

The name of the object as it appears in the Layers and Objects section of the Analysis tab on the sidebar.

verticesArr

Array of
 Cesium.Cartesian3

Array which represents the position of each of the vertices in the polygon object.

options

Object

Name

Type

Description

All Cesium PolygonGraphics

PolygonGraphics object

Determines the polygon style.

ignoreDepth

Boolean

Determines whether the depth value should be ignored, and the polygon made visible even when hidden by the terrain or an object.

Returns

Promise - A promise that resolves to the newly created TerraExplorerObject polygon object.

 

Example

The following example creates a polygon object:

var pos1 = new Cesium.Cartesian3(-2310134.6712067625, -5075997.653401327, 3084761.678725282);

var pos2 = new Cesium.Cartesian3(-2310131.4953844063, -5076000.808094176, 3084758.837050934);

var pos3 = new Cesium.Cartesian3(-2310137.366409833, -5076002.783754897, 3084749.9968079026);

var cart = [pos1, pos2, pos3];

var options = {material: Cesium.Color.RED, outline: true, outlineColor:Cesium.Color.ORANGE, outlineWidth:5, heightReference:Cesium.HeightReference.RELATIVE_TO_GROUND, height:0, ignoreDepth:true};

Cesium.when(TerraExplorer.objects.polygon.create("polygonExample", cart, options), function(teObject) { teObject.flyTo();});