Creates a new polyline object on the terrain.
createPolyline(vertices, [lineColor], [name], [heightType]);
Parameter |
Description |
vertices |
An array of SGCoord3D, SGCoord2D, SGPosition or numbers. If the array is composed of numbers, the numbers must be as follows: x1, h1, y1, x2, h2, y2… |
lineColor |
Optional, default: sgLime The color of the object outline Can be one of the following: SGColor, HTML color string (e.g., “#FF0000”), a number that represents ABGR color (e.g., 0xAA0000FF) or one of the predefined Skyline Globe colors (e.g., sgRed). For a complete list of the pre defined colors, see Skyline Globe Colors |
name |
Optional The node name |
heightType |
Optional, default: sgHeightOnTerrain Determines how the polyline is placed on the terrain Can be one of the following: sgHeightOnTerrain - the vertices are placed on the terrain sgHeightRelative- each of the polyline vertices has a height relative to the terrain sgHeightAbsolute - each of the polyline vertices has a height relative to the terrain database vertical datum base ellipsoid |
Return Value
An SGNode object. If the method fails, the return value is null. SGWorld.lastError will contain the failure reason.
Remarks
To modify other properties of the polyline such as line style, access the node innerObj. See SGNode.innerObj property and ITerrainPolyline5 interface for more details.
The default polyline is drawn on the terrain surface (height type is sgHeightOnTerrain). It is however, possible to create a polyline in the air by simply passing a different height type (either sgHeightRelative or sgHeightAbsolute).
Example
The following example illustrates the use of the createPolyline method.
function createPolyline()
{
var points = new Array(
new SGCoord3D(-114.73656,36.01659, 10000),
new SGCoord3D(-115.14515,36.15498, 300000),
new SGCoord3D(-118.24834,34.05090, 700000)
);
var poly = globe.creator.createPolyline(points,
sgRed,
"my poly",
sgHeightAbsolute
);
globe.root.appendChild(poly);
globe.navigate.flyTo(poly);
}