UNPKG

imobile_for_javascript

Version:

iMobile for JavaScript,是SuperMap iMobile推出的一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。

43 lines (40 loc) 1.15 kB
import {NativeModules} from 'react-native'; let GL = NativeModules.JSGeoLine; import Geometry from './Geometry.js'; /** * @class GeoLine */ export default class GeoLine extends Geometry{ constructor(){ super(); //同步子类Id和父类Id Object.defineProperty(this,"geoLineId",{ get:function () { return this.geometryId }, set:function (geoLineId) { this.geometryId = geoLineId; } }) } /** * create a GeoLine instance * @memberOf GeoLine * @param points an Array laden with point objects. For example: [ {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.geoLineId = geoLineId; return geoLine; }catch (e){ console.error(e); } } }