Class: ColorTable

ColorTable

new ColorTable()

Color chart category.

Methods

static clone(colorTable, result){ColorTable}

Copy color chart objects.

Name Type Description
colorTable ColorTable

The color chart object to be copied.

result ColorTable optional

The object that stores the results, if undefined, will create a new instance.

Returns:
Type Description
ColorTable If the modified result parameters are not provided, return a new instance. If the color chart is undefined, return 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()

Remove the color chart.

Example
var colorTable = new SuperMap3D.ColorTable();
colorTable.clear();

count(){Number}

Get the number of color chart objects.

Returns:
Type Description
Number Number of color charts.
Example
var colorTable = new SuperMap3D.ColorTable();
var count = colorTable.count();

destroy()

Destroy the color chart

getItem(index){Object}

Retrieve the color table object of the specified index.

Name Type Description
index Number

The specified index value.

Returns:
Type Description
Object Object color table: Key is the elevation value, Value is the object color.
Example
var colorTable = new SuperMap3D.ColorTable();
var value = colorTable.getItem(1)

insert(value, color)

Insert a new item into the color chart.

Name Type Description
value Number

Height value.

color Color optional

Color information.

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}

Remove the specified height item from the color chart.

Name Type Description
value Number

Specify the height value.

Returns:
Type Description
Boolean Return true for successful removal, otherwise return false.
Example
var colorTable = new SuperMap3D.ColorTable();
colorTable.remove(30);