Class: Dots

Dots()

new Dots()

Source:

Methods

(async, static) append(dot) → {Promise}

添加一个点
Parameters:
Name Type Description
dot 待添加的点对象
Source:
Returns:
新添加点的索引,小于0失败
Type
Promise

(async, static) appendDots(dots) → {Promise}

将另一个Dots的点添加到尾端
Parameters:
Name Type Description
dots 待添加的点序列对象
Source:
Returns:
大于0成功,否则失败
Type
Promise

(async, static) clear() → {Promise}

清空
Source:
Returns:
大于0成功,否则失败
Type
Promise

(async, static) createObj() → {Promise.<Dots>}

构造一个新的 Dots 对象。
Source:
Returns:
Type
Promise.<Dots>

(async, static) fromObjectArray(objArray) → {Number}

通过包含多个对象的数组,给Dots设置点
Parameters:
Name Type Description
objArray Array 包含一系列对象的数组,对象形式{x: Number, y: Number}
Source:
Returns:
大于0成功,否则失败
Type
Number
Example
let array = [];
    array.push({x: 114.63, y: 30.40});
    array.push({x: 114.33, y: 30.24});
    array.push({x: 114.22, y: 30.22});
    array.push({x: 114.15, y: 30.66});
    let dotsModule = new Dots();
    let dots = await dotsModule.createObj();
    await dots.fromObjectArray(array);

(async, static) get(index) → {Promise.<Dot>}

返回索引处的点
Parameters:
Name Type Description
index 待查找的索引号
Source:
Returns:
索引处的点
Type
Promise.<Dot>

(static) isValid() → {Boolean}

判断Dots对象是否有效
Source:
Returns:
true:有效;false:无效
Type
Boolean

(async, static) remove(index) → {Promise}

删除索引处的点
Parameters:
Name Type Description
index 待删除的点索引
Source:
Returns:
大于0成功,否则失败
Type
Promise

(async, static) size() → {Promise}

获取X坐标
Source:
Returns:
折线点数
Type
Promise

(async, static) toObjectArray() → {Array}

返回Dots的一系列点坐标构成的对象数组
Source:
Returns:
返回包含由点坐标构成的对象的数组,对象形式{x: Number, y: Number}
Type
Array