UNPKG

rn_supermap

Version:

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

55 lines (50 loc) 1.42 kB
/********************************************************************************* Copyright © SuperMap. All rights reserved. Author: Yang Shanglong E-mail: yangshanglong@supermap.com **********************************************************************************/ import { NativeModules } from 'react-native'; let EPL = NativeModules.JSElementPolygon; import CollectorElement from './CollectorElement'; /** * 线类型采集对象类 */ export default class ElementPolygon extends CollectorElement { constructor() { super(); Object.defineProperty(this, "_ElementPolygonId", { get: function () { return this._SMCollectorElementId }, set: function (_ElementPolygonId) { this._SMCollectorElementId = _ElementPolygonId; } }) } /** * ElementPolygon 对象构造方法 * @returns {Promise.<ElementPolygon>} */ async createObj() { try { let id = await EPL.createObj(); let geoLine = new ElementPolygon(); geoLine._ElementPolygonId = id; return geoLine; } catch (e) { console.error(e); } } /** * 通过 Geomotry 构造面类型的采集对象 * @param geometry * @returns {Promise.<ElementPolygon>} */ async fromGeometry(geometry) { try { return await EPL.fromGeometry(this._ElementPolygonId, geometry._SMGeometryId); } catch (e) { console.error(e); } } }