drawPoints

drawPoints(options) object

Activates an interactive mode for drawing points 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 PointGraphics object, e.g., color and visibility. Determines how the point will be displayed.

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.

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 points. Multiple points can be added, until right-clicking to finish. For more information, see an online interactive tutorial with code editor.

 

TerraExplorer.drawing.drawPoints({AltitudeMethod: TerraExplorer.AltitudeMethod.RELATIVE_TO_MODEL, Altitude: 0.1, onFinish: onFinishDrawing});

 

function onFinishDrawing(points){

points.forEach(function(p){

TerraExplorer.objects.point.create("Point",p, {backgroundColor:Cesium.Color.BLACK, color: Cesium.Color.RED, outlineColor:Cesium.Color.ORANGE, outlineWidth:5, pixelSize:6, heightReference: Cesium.HeightReference.CLAMP_TO_GROUND});

});

}