drawPolygon
drawPolygon(options) → object
Activates an interactive mode for drawing a polygon
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 PolygonGraphics
object, e.g., height, 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 polygon. For more information, see an online
interactive tutorial with code editor.
TerraExplorer.drawing.drawPolygon({AltitudeMethod:
TerraExplorer.AltitudeMethod.RELATIVE_TO_TERRAIN, Altitude: 0.1,style:
{material:Cesium.Color.YELLOW, width: 2}, onFinish: onFinishDrawing});
function
onFinishDrawing(points) {
TerraExplorer.objects.polygon.create("Polygon",
points, {});
}