Repository navigation
Expand file tree
/
Copy pathGeoLine.js
More file actions
49 lines (45 loc) · 1.38 KB
/
Copy pathGeoLine.js
File metadata and controls
49 lines (45 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*********************************************************************************
Copyright © SuperMap. All rights reserved.
Author: Will
E-mail: pridehao@gmail.com
**********************************************************************************/
import {NativeModules} from 'react-native';
let GL = NativeModules.JSGeoLine;
import Geometry from './Geometry.js';
/**
* @class GeoLine
* @description 线几何对象类。
*/
export default class GeoLine extends Geometry{
constructor(){
super();
Object.defineProperty(this,"_SMGeoLineId",{
get:function () {
return this._SMGeometryId
},
set:function (_SMGeoLineId) {
this._SMGeometryId = _SMGeoLineId;
}
})
}
/**
* GeoLine 对象构造方法
* @memberOf GeoLine
* @param {Array} points -点信息数组,eg: [ {x:1.1,y:1.2} , {x:2.3,y:3.4} ]
* @returns {Promise.<GeoLine>}
*/
async createObj(points){
try{
if(!!points && typeof points == "array"){
var {geoLineId} = await GL.createObjByPts();
}else{
var {geoLineId} = await GL.createObj();
}
geoLine = new GeoLine();
geoLine._SMGeoLineId = geoLineId;
return geoLine;
}catch (e){
console.error(e);
}
}
}