drawPolyline

drawPolyline(options) object

Activates an interactive mode for drawing a polyline in the 3D World.

Parameters

Name

Type

Description

options

Object

Name

Type

Default

Description

style

Object

Empty object

Object that contains all the properties of the Cesium PolylineGraphics object, e.g., width, shadows.

AltitudeMethod

AltitudeMethod

On 'terrain (3)

An object that determines the altitude method. It can be set to any of the following:

§   RELATIVE_TO_MODEL = 0

§   RELATIVE_TO_TERRAIN = 1

§   ABSOLUTE = 2

§   ON_TERRAIN = 3

Altitude

Number

0

Initial altitude of the points drawn.

onMouseMove

drawing ~ onMouseMove

Empty function

Callback function called when the mouse is moved.

onPointUpdate

drawing ~ onPointUpdate

Empty function

Callback function called when a point is added or modified.

onFinish

drawing ~ onFinish

Empty function

Callback function called when the draw operation is complete.

onAbort

drawing ~ onAbort

Empty function

Callback function called when the draw operation is aborted.

useFirstPointAsAltitude

Boolean

False

A Boolean that determines whether to use the altitude of the first point drawn as the altitude for all the points.

intersectionStyle

object

Empty object

Object that contains all the properties of the Cesium PolylineGraphics object, e.g., material, width, shadows.

planeMode

Boolean

False

When set to true, the first three points define a plane, to which all points are aligned.

 

Returns

A helper object whose members enable control of the drawing operation. These include:

§   .finish() – finish the drawing

§   .abort() – cancel the drawing operation

§   cancelLastPoint() – cancel the last Point drawn

§   .options  – override the initial styling set by the options (style) parameter

Example

The following example activates an interactive mode for drawing a polyline. For more information, see an online interactive tutorial with code editor. 

 

TerraExplorer.drawing.drawPolyline({

    AltitudeMethod: TerraExplorer.AltitudeMethod.RELATIVE_TO_MODEL, Altitude: 0.1,style: {material:Cesium.Color.YELLOW, width: 2}, onFinish: onFinishDrawing

});

function onFinishDrawing(points) {

       TerraExplorer.objects.polyline.create("Polyline", points, {});

}

 

Type Definitions