PolylineCollection

external class PolylineCollection(source)

A renderable collection of polylines.

Polylines are added and removed from the collection using PolylineCollection.add and PolylineCollection.remove.

// Create a polyline collection with two polylines
const polylines = new PolylineCollection();
polylines.add({
positions : Cartesian3.fromDegreesArray([
-75.10, 39.57,
-77.02, 38.53,
-80.50, 35.14,
-80.12, 25.46]),
width : 2
});

polylines.add({
positions : Cartesian3.fromDegreesArray([
-73.10, 37.57,
-75.02, 36.53,
-78.50, 33.14,
-78.12, 23.46]),
width : 4
});

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

This property is for debugging only; it is not for production use nor is it optimized.

Link copied to clipboard
var length: Int

Returns the number of polylines in this collection. This is commonly used with PolylineCollection.get to iterate over all the polylines in the collection.

Link copied to clipboard

The 4x4 transformation matrix that transforms each polyline in this collection from model to world coordinates. When this is the identity matrix, the polylines are drawn in world coordinates, i.e., Earth's WGS84 coordinates. Local reference frames can be used by providing a different transformation matrix, like that returned by Transforms.eastNorthUpToFixedFrame.

Link copied to clipboard

Determines if polylines in this collection will be shown.

Functions

Link copied to clipboard
fun add(options: Any? = definedExternally): Polyline

Creates and adds a polyline with the specified initial properties to the collection. The added polyline is returned so it can be modified or removed from the collection later.

Link copied to clipboard
fun contains(polyline: Polyline): Boolean

Determines if this collection contains the specified polyline.

Link copied to clipboard
fun destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Link copied to clipboard
operator fun get(index: Int): Polyline

Returns the polyline in the collection at the specified index. Indices are zero-based and increase as polylines are added. Removing a polyline shifts all polylines after it to the left, changing their indices. This function is commonly used with PolylineCollection.length to iterate over all the polylines in the collection.

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.

Link copied to clipboard
fun remove(polyline: Polyline): Boolean

Removes a polyline from the collection.

Link copied to clipboard
fun removeAll()

Removes all polylines from the collection.

Link copied to clipboard
fun update()

Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.