modifyTerrain

The modifyTerrain object enables creation of modify terrain objects and provides access to created objects. Modify terrain objects modify the elevation values in an area of the terrain based on a polygon. The surface of the terrain is raised or lowered according to the elevation values of the polygon's points and the options set. The following member and method are available:

§  items

§  create()

items

static items : Array<TerraExplorerObject>

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

create

create(description, polygon, altitude, options) → {promise}

Creates a modify terrain object.

Parameters

Name

Type

Description

description

String

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

polygon

Array of
 Cesium.Cartesian3

Array which represents the modify terrain polygon.

altitude

Number

The altitude by which to raise or lower the surface of the terrain in the area of the modify terrain polygon.

options

Object

Name

Type

Description

mtType

Number

Determines how the modified terrain elevation values affect the terrain's elevation. The following are the possible values: 

§  Replace = 0
Replaces the area defined by the modified terrain object with the passed altitude value. All points of the modified terrain are set at the same altitude, creating a horizontal flat surface (default).

§  Offset_Altitude = 1
Offsets the area defined by the modified terrain with the passed altitude value.

§  Crop_Above = 2
Replaces all elevation values that are higher than the passed altitude value with the passed altitude value.

§  Crop_Below = 3
Replaces all elevation values that are lower than the passed altitude value with the passed altitude value.

Returns

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

 

Example

The following example creates a modifyTerrain object:

 var pos1 = Cesium.Cartesian3.fromDegrees(-122.50984, 37.82545);

var pos2 = Cesium.Cartesian3.fromDegrees(-122.50458, 37.82845);

var pos3 = Cesium.Cartesian3.fromDegrees(-122.50182, 37.82574);

var pos4 = Cesium.Cartesian3.fromDegrees(-122.50678, 37.82262);

var cart = [pos1, pos2, pos3, pos4];

Cesium.when(TerraExplorer.objects.modifyTerrain.create("modifyTerrain", cart, 200), function(teObject){teObject.flyTo();});