ColorTable

new Cesium.ColorTable()

Color table class.

Methods

staticCesium.ColorTable.clone(colorTable, result)ColorTable

Copy the color table object.
Name Type Description
colorTable ColorTable The color table object to be copied.
result ColorTable optional The object used to store the result. If undefined, a new instance will be created.
Returns:
The modified result parameter, or a new instance if not provided. If the color table is undefined, return undefined.
Example:
var colorTable = new Cesium.ColorTable();
colorTable.insert(900, new Cesium.Color(1, 0, 0));
colorTable.insert(600, new Cesium.Color(0, 0, 1));
var cloneTable = Cesium.ColorTable.clone(colorTable);

clear()

Remove the color table.
Example:
var colorTable = new Cesium.ColorTable();
colorTable.clear();

count()Number

Get the number of color table objects.
Returns:
The number of color tables.
Example:
var colorTable = new Cesium.ColorTable();
var count = colorTable.count();

getItem(index)Object

Get the color table object of the specified index.
Name Type Description
index Number The specified index value.
Returns:
Object color table: Key is the elevation value, and Value is the object color.
Example:
var colorTable = new Cesium.ColorTable();
var value = colorTable.getItem(1)

insert(value, color)

The color table inserts a new item.
Name Type Description
value Number The height value.
color Color optional Color information.
Example:
var colorTable = new Cesium.ColorTable();
colorTable.insert(900, new Cesium.Color(1, 0, 0));
colorTable.insert(600, new Cesium.Color(0, 0, 1));

remove(value)Boolean

Color information.
Name Type Description
value Number Specify the height value.
Returns:
Return true if the removal is successful, otherwise false.
Example:
var colorTable = new Cesium.ColorTable();
colorTable.remove(30);