ColorTable

new SuperMap3D.ColorTable()

颜色表类。

Methods

staticSuperMap3D.ColorTable.clone(colorTable, result)ColorTable

复制颜色表对象。
Name Type Description
colorTable ColorTable 待复制的颜色表对象。
result ColorTable optional 用于存储结果的对象,如果undefined,将创建一个新实例。
Returns:
经修改的结果参数,如果未提供则返回一个新实例。如果颜色表undefined,返回undefined。
Example:
var colorTable = new SuperMap3D.ColorTable();
colorTable.insert(900, new SuperMap3D.Color(1, 0, 0));
colorTable.insert(600, new SuperMap3D.Color(0, 0, 1));
var cloneTable = SuperMap3D.ColorTable.clone(colorTable);

clear()

移除颜色表。
Example:
var colorTable = new SuperMap3D.ColorTable();
colorTable.clear();

count()Number

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

getItem(index)Object

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

insert(value, color)

颜色表插入新的项。
Name Type Description
value Number 高度值。
color Color optional 颜色信息。
Example:
var colorTable = new SuperMap3D.ColorTable();
colorTable.insert(900, new SuperMap3D.Color(1, 0, 0));
colorTable.insert(600, new SuperMap3D.Color(0, 0, 1));

remove(value)Boolean

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