ColorTable

new Cesium.ColorTable()

颜色表类。

Methods

staticCesium.ColorTable.clone(colorTable, result)ColorTable

克隆一个颜色表对象。
Name Type Description
colorTable ColorTable 待克隆的颜色表对象。
result ColorTable optional 如果未传入该参数,将创建一个colorTable的新实例。
Returns:
颜色表对象。
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()

移除颜色表中所有内容。
Example:
var colorTable = new Cesium.ColorTable();
colorTable.clear();

count()Number

获取颜色表对象的数量。
Returns:
颜色表数量。
Example:
var colorTable = new Cesium.ColorTable();
var count = colorTable.count();

getItem(index)Object

获取指定索引的颜色表对象。
Name Type Description
index Number 指定的索引值。
Returns:
对象颜色表:Key为高程值,Value为对象颜色。
Example:
var colorTable = new Cesium.ColorTable();
var value = colorTable.getItem(1);

insert(value, color)

向颜色表插入一个项。
Name Type Description
value Number 高度值。
color Color optional color 颜色信息。
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

从颜色表中移除指定高度的项。
Name Type Description
value Number 指定的高度值。
Returns:
移除成功返回true,否则返回false。
Example:
var colorTable = new Cesium.ColorTable();
colorTable.remove(30);