rn_supermap
Version:
rn_supermap 一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。
84 lines (74 loc) • 1.77 kB
JavaScript
/*********************************************************************************
Copyright © SuperMap. All rights reserved.
Author: Yang Shanglong
E-mail: yangshanglong@supermap.com
**********************************************************************************/
import { NativeModules } from 'react-native'
let S = NativeModules.JSSymbol
import SymbolLibrary from './SymbolLibrary'
/**
* @class Symbol
* @description 符号基类。
符号库中所有的符号类,包括点状符号类,线型符号类和填充符号类都继承自符号基类。
*/
export default class Symbol {
async dispose() {
try {
await S.dispose(this._SMSymbolId)
} catch (e) {
console.error(e)
}
}
async draw(w, h) {
try {
return await S.draw(this._SMSymbolId, w, h)
} catch (e) {
console.error(e)
}
}
async getID() {
try {
return await S.getID(this._SMSymbolId)
} catch (e) {
console.error(e)
}
}
async getLibrary() {
try {
let id = await S.getLibrary(this._SMSymbolId)
let lib = new SymbolLibrary()
lib._SMSymbolLibraryId = id
return lib
} catch (e) {
console.error(e)
}
}
async getName() {
try {
return await S.getName(this._SMSymbolId)
} catch (e) {
console.error(e)
}
}
async getType() {
try {
return await S.getType(this._SMSymbolId)
} catch (e) {
console.error(e)
}
}
async setSymbolStyle(geoStyle) {
try {
return await S.draw(this._SMSymbolId, geoStyle._SMGeoStyleId)
} catch (e) {
console.error(e)
}
}
async toString() {
try {
return await S.toString(this._SMSymbolId)
} catch (e) {
console.error(e)
}
}
}