diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 3194102a..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..94576018 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ + +.DS_Store +ios/iPhoneOS.sdk +ios/iPhoneSimulator.sdk +ios/MessageQueue.sdk + +android/imobile_for_javascript.iml +android/local.properties +android/rnsupermap.iml +android/android.iml +android/build +android/gradle \ No newline at end of file diff --git a/.idea/.DS_Store b/.idea/.DS_Store deleted file mode 100644 index 856df9f9..00000000 Binary files a/.idea/.DS_Store and /dev/null differ diff --git a/.npmignore b/.npmignore index ab49093a..43fde3a3 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,5 @@ /npm-debug.log +.DS_Store +ios/iPhoneOS.sdk +ios/iPhoneSimulator.sdk +ios/MessageQueue.sdk diff --git a/API Doc/BufferAnalyst.html b/API Doc/BufferAnalyst.html new file mode 100644 index 00000000..fe6c0e66 --- /dev/null +++ b/API Doc/BufferAnalyst.html @@ -0,0 +1,2061 @@ + + + + + JSDoc: Class: BufferAnalyst + + + + + + + + + + +
+ +

Class: BufferAnalyst

+ + + + + + +
+ +
+ +

BufferAnalyst

+ + +
+ +
+
+ + + + + +

new BufferAnalyst()

+ + + + + +
+ 缓冲区分析类。该类用于为点、线、面数据集(或记录集)创建缓冲区,包括单边缓冲区、多重缓冲区和线单边多重缓冲区。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createBuffer(sourceDataSet, sourceDataSet, bufferAnalystParam, isUnion, isAttributeRetained) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
bufferAnalystParam + + +BufferAnalystParameter + + + + 缓冲区分析参数对象
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) createLineOneSideMultiBuffer(sourceDataSet, sourceDataSet, arrBufferRadius, bufferRadiusUnit, semicircleSegment, isLeft, isUnion, isAttributeRetained, isRing) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集单边多重缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
arrBufferRadius + + +array + + + + 指定的多重缓冲区半径列表
bufferRadiusUnit + + +number + + + + 指定的缓冲区半径单位
semicircleSegment + + +number + + + + 指定的弧短拟合数
isLeft + + +boolean + + + + 是否生成左缓冲区
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
isRing + + +boolean + + + + 是否生成环装缓冲区
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) createMultiBuffer(sourceDataSet, sourceDataSet, arrBufferRadius, bufferRadiusUnit, semicircleSegment, isUnion, isAttributeRetained, isRing) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集多重缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
arrBufferRadius + + +array + + + + 指定的多重缓冲区半径列表
bufferRadiusUnit + + +number + + + + 指定的缓冲区半径单位
semicircleSegment + + +number + + + + 指定的弧短拟合数
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
isRing + + +boolean + + + + 是否生成环装缓冲区
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+ +

BufferAnalyst

+ + +
+ +
+
+ + + + + +

new BufferAnalyst()

+ + + + + +
+ 几何对象缓冲区分析类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createBuffer(sourceDataSet, sourceDataSet, bufferAnalystParam, isUnion, isAttributeRetained) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
bufferAnalystParam + + +BufferAnalystParameter + + + + 缓冲区分析参数对象
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) createLineOneSideMultiBuffer(sourceDataSet, sourceDataSet, arrBufferRadius, bufferRadiusUnit, semicircleSegment, isLeft, isUnion, isAttributeRetained, isRing) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集单边多重缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
arrBufferRadius + + +array + + + + 指定的多重缓冲区半径列表
bufferRadiusUnit + + +number + + + + 指定的缓冲区半径单位
semicircleSegment + + +number + + + + 指定的弧短拟合数
isLeft + + +boolean + + + + 是否生成左缓冲区
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
isRing + + +boolean + + + + 是否生成环装缓冲区
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) createMultiBuffer(sourceDataSet, sourceDataSet, arrBufferRadius, bufferRadiusUnit, semicircleSegment, isUnion, isAttributeRetained, isRing) → {Promise.<boolean>}

+ + + + + +
+ 创建矢量数据集多重缓冲区 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sourceDataSet + + +Dataset + + + + 源矢量数据集
sourceDataSet + + +Dataset + + + + 用于存储缓冲区分析结果的数据集
arrBufferRadius + + +array + + + + 指定的多重缓冲区半径列表
bufferRadiusUnit + + +number + + + + 指定的缓冲区半径单位
semicircleSegment + + +number + + + + 指定的弧短拟合数
isUnion + + +boolean + + + + 是否合并缓冲区
isAttributeRetained + + +boolean + + + + 是否保留进行缓冲区分析的对象的字段属性
isRing + + +boolean + + + + 是否生成环装缓冲区
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/BufferAnalyst.js.html b/API Doc/BufferAnalyst.js.html new file mode 100644 index 00000000..c1c5e9e9 --- /dev/null +++ b/API Doc/BufferAnalyst.js.html @@ -0,0 +1,133 @@ + + + + + JSDoc: Source: BufferAnalyst.js + + + + + + + + + + +
+ +

Source: BufferAnalyst.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ ref:DatasetVector
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let BA = NativeModules.JSBufferAnalyst;
+
+/**
+ * @class BufferAnalyst
+ * @description 缓冲区分析类。该类用于为点、线、面数据集(或记录集)创建缓冲区,包括单边缓冲区、多重缓冲区和线单边多重缓冲区。
+ **/
+export default class BufferAnalyst {
+    
+    /**
+     * 创建矢量数据集缓冲区
+     * @memberOf BufferAnalyst
+     * @param {Dataset} sourceDataSet - 源矢量数据集
+     * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集
+     * @param {BufferAnalystParameter} bufferAnalystParam - 缓冲区分析参数对象
+     * @param {boolean} isUnion - 是否合并缓冲区
+     * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性
+     * @returns {Promise.<boolean>}
+     */
+    async createBuffer(sourceDataSet,resultDataSet,bufferAnalystParam,isUnion,isAttributeRetained){
+        try{
+            var {isCreate} = await BA.createBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,bufferAnalystParam._SMBufferAnalystParameterId,isUnion,isAttributeRetained);
+            
+            return isCreate;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 创建矢量数据集单边多重缓冲区
+     * @memberOf BufferAnalyst
+     * @param {Dataset} sourceDataSet - 源矢量数据集
+     * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集
+     * @param {array} arrBufferRadius - 指定的多重缓冲区半径列表
+     * @param {number} bufferRadiusUnit - 指定的缓冲区半径单位
+     * @param {number} semicircleSegment - 指定的弧短拟合数
+     * @param {boolean} isLeft - 是否生成左缓冲区
+     * @param {boolean} isUnion - 是否合并缓冲区
+     * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性
+     * @param {boolean} isRing - 是否生成环装缓冲区
+     * @returns {Promise.<boolean>}
+     */
+    async createLineOneSideMultiBuffer(sourceDataSet,resultDataSet,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isLeft,isUnion,isAttributeRetained,isRing){
+        try{
+            var {isCreate} = await BA.createLineOneSideMultiBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isLeft,isUnion,isAttributeRetained,isRing);
+            
+            return isCreate;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 创建矢量数据集多重缓冲区
+     * @memberOf BufferAnalyst
+     * @param {Dataset} sourceDataSet - 源矢量数据集
+     * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集
+     * @param {array} arrBufferRadius - 指定的多重缓冲区半径列表
+     * @param {number} bufferRadiusUnit - 指定的缓冲区半径单位
+     * @param {number} semicircleSegment - 指定的弧短拟合数
+     * @param {boolean} isUnion - 是否合并缓冲区
+     * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性
+     * @param {boolean} isRing - 是否生成环装缓冲区
+     * @returns {Promise.<boolean>}
+     */
+    async createMultiBuffer(sourceDataSet,resultDataSet,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isUnion,isAttributeRetained,isRing){
+        try{
+            var {isCreate} = await BA.createMultiBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isUnion,isAttributeRetained,isRing);
+            
+            return isCreate;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/BufferAnalystGeometry.js.html b/API Doc/BufferAnalystGeometry.js.html new file mode 100644 index 00000000..078bdc5e --- /dev/null +++ b/API Doc/BufferAnalystGeometry.js.html @@ -0,0 +1,90 @@ + + + + + JSDoc: Source: BufferAnalystGeometry.js + + + + + + + + + + +
+ +

Source: BufferAnalystGeometry.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ ref:Geometry,BufferAnalystParameter,PrjCoordSys,GeoRegion
+ description:此方法ios/android 应该存在差异,待排查
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let BAG = NativeModules.JSBufferAnalystGeometry;
+import GeoRegion from './GeoRegion.js';
+
+/**
+ * @class BufferAnalyst
+ * @description 几何对象缓冲区分析类。
+ **/
+export default class BufferAnalystGeometry {
+    
+    /**
+     * (静态方法)根据给定的几何对象及缓冲区分析参数对象创建缓冲区。
+     * @memberOf BufferAnalystGeometry
+     * @param {Geometry} geometry - 几何对象
+     * @param {BufferAnalystParameter} bufferAnalystParameter - 缓冲区分析参数对象
+     * @param {PrjCoordSys } prjCoordSys - 地图的投影坐标系
+     * @returns {Promise.<GeoRegion>}
+     */
+    static async createBuffer(geometry,bufferAnalystParameter,prjCoordSys){
+        try{
+            var {geoRegionId} = await BAG.createBuffer(this._SMBufferAnalystGeometryId,
+                geometry._SMGeometryId,bufferAnalystParameter._SMBufferAnalystParameterId,prjCoordSys._SMPrjCoordSysId);
+            var geoRegion = new GeoRegion();
+            geoRegion._SMGeoRegionId = geoRegionId;
+//            console.log("geoRegion.geometryId:"+geoRegion.geometryId);
+//            console.log("geoRegion.geoRegionId:" + geoRegion.geoRegionId);
+            return geoRegion;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/BufferAnalystParameter.html b/API Doc/BufferAnalystParameter.html new file mode 100644 index 00000000..6b2207f2 --- /dev/null +++ b/API Doc/BufferAnalystParameter.html @@ -0,0 +1,1517 @@ + + + + + JSDoc: Class: BufferAnalystParameter + + + + + + + + + + +
+ +

Class: BufferAnalystParameter

+ + + + + + +
+ +
+ +

BufferAnalystParameter

+ + +
+ +
+
+ + + + + +

new BufferAnalystParameter()

+ + + + + +
+ 缓冲区分析参数类,用于为缓冲区分析提供必要的参数信息。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<BufferAnalystParameter>}

+ + + + + +
+ 构造BufferAnalystParameter对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<BufferAnalystParameter> + + +
+
+ + + + + + + + + + +

(static) getEndType() → {Promise.<number>}

+ + + + + +
+ 获取缓冲区端点类型。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) getLeftDistance() → {Promise.<string>}

+ + + + + +
+ 获取左缓冲区的距离。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + +

(static) getRadiusUnit() → {Promise.<number>}

+ + + + + +
+ 获取缓冲区分析的半径单位。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) getRightDistance() → {Promise.<string>}

+ + + + + +
+ 获取右缓冲区的距离。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + +

(static) getSemicircleLineSegment() → {Promise.<number>}

+ + + + + +
+ 获取半圆弧线段个数,即用多少个线段来模拟一个半圆。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) setEndType(bufferEndType) → {Promise.<void>}

+ + + + + +
+ 设置缓冲区端点类型。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bufferEndType + + +number + + + + 缓冲区端点类型
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setLeftDistance(distance) → {Promise.<void>}

+ + + + + +
+ 设置左缓冲区的距离。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number +| + +string + + + + 左缓冲区的距离
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setRadiusUnit(radiusUnit) → {Promise.<void>}

+ + + + + +
+ 设置缓冲区分析的半径单位。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
radiusUnit + + +number + + + + 缓冲区分析的半径单位
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setRightDistance(distance) → {Promise.<void>}

+ + + + + +
+ 设置右缓冲区的距离。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number +| + +string + + + + 左缓冲区的距离
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSemicircleLineSegment(segment) → {Promise.<void>}

+ + + + + +
+ 设置半圆弧线段个数,即用多少个线段来模拟一个半圆。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
segment + + +number + + + + 半圆弧线段个数
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/BufferAnalystParameter.js.html b/API Doc/BufferAnalystParameter.js.html new file mode 100644 index 00000000..7317b57c --- /dev/null +++ b/API Doc/BufferAnalystParameter.js.html @@ -0,0 +1,231 @@ + + + + + JSDoc: Source: BufferAnalystParameter.js + + + + + + + + + + +
+ +

Source: BufferAnalystParameter.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ ref:none
+ description:涉及枚举。
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let BAP = NativeModules.JSBufferAnalystParameter;
+
+/**
+ * @class BufferAnalystParameter
+ * @description 缓冲区分析参数类,用于为缓冲区分析提供必要的参数信息。
+ **/
+export default class BufferAnalystParameter {
+
+    /**
+     * 构造BufferAnalystParameter对象
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<BufferAnalystParameter>}
+     */
+    async createObj(){
+        try{
+            var {bufferAnalystParameterId} = await BAP.createObj();
+            var bufferAnalystParameter = new BufferAnalystParameter();
+            bufferAnalystParameter._SMBufferAnalystParameterId = bufferAnalystParameterId;
+            return bufferAnalystParameter;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置缓冲区端点类型。
+     * @memberOf BufferAnalystParameter
+     * @param {number} bufferEndType - 缓冲区端点类型
+     * @returns {Promise.<void>}
+     */
+    async setEndType(bufferEndType){
+        try{
+            await BAP.setEndType(this._SMBufferAnalystParameterId,bufferEndType);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取缓冲区端点类型。
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<number>}
+     */
+    async getEndType(){
+        try{
+            var {EndType} = await BAP.getEndType(this._SMBufferAnalystParameterId);
+            return EndType;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置左缓冲区的距离。
+     * @memberOf BufferAnalystParameter
+     * @param {number | string} distance - 左缓冲区的距离
+     * @returns {Promise.<void>}
+     */
+    async setLeftDistance(distance){
+        try{
+            if(typeof distance == 'number'){
+                await BAP.setLeftDistance(this._SMBufferAnalystParameterId,distance);
+            }else{
+                await BAP.setLeftDistanceByStr(this._SMBufferAnalystParameterId,distance);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取左缓冲区的距离。
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<string>}
+     */
+    async getLeftDistance(){
+        try{
+            var {leftDistance} = await BAP.getLeftDistance(this._SMBufferAnalystParameterId);
+            return leftDistance;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置右缓冲区的距离。
+     * @memberOf BufferAnalystParameter
+     * @param {number | string} distance - 左缓冲区的距离
+     * @returns {Promise.<void>}
+     */
+    async setRightDistance(distance){
+        try{
+            if(typeof distance == 'number'){
+                await BAP.setRightDistance(this._SMBufferAnalystParameterId,distance);
+            }else{
+                await BAP.setRightDistanceByStr(this._SMBufferAnalystParameterId,distance);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取右缓冲区的距离。
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<string>}
+     */
+    async getRightDistance(){
+        try{
+            var {rightDistance} = await BAP.getRightDistance(this._SMBufferAnalystParameterId);
+            return rightDistance;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 设置缓冲区分析的半径单位。
+     * @memberOf BufferAnalystParameter
+     * @param {number} radiusUnit - 缓冲区分析的半径单位
+     * @returns {Promise.<void>}
+     */
+    async setRadiusUnit(radiusUnit){
+        try{
+            await BAP.setRadiusUnit(this._SMBufferAnalystParameterId,radiusUnit);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取缓冲区分析的半径单位。
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<number>}
+     */
+    async getRadiusUnit(){
+        try{
+            var {radiusUnit} = await BAP.getRadiusUnit(this._SMBufferAnalystParameterId);
+            return radiusUnit;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 设置半圆弧线段个数,即用多少个线段来模拟一个半圆。
+     * @memberOf BufferAnalystParameter
+     * @param {number} segment - 半圆弧线段个数
+     * @returns {Promise.<void>}
+     */
+    async setSemicircleLineSegment(segment){
+        try{
+            await BAP.setSemicircleLineSegment(this._SMBufferAnalystParameterId,segment);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取半圆弧线段个数,即用多少个线段来模拟一个半圆。
+     * @memberOf BufferAnalystParameter
+     * @returns {Promise.<number>}
+     */
+    async getSemicircleLineSegment(){
+        try{
+            var {segment} = await BAP.getSemicircleLineSegment(this._SMBufferAnalystParameterId);
+            return segment;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/DataDownloadService.html b/API Doc/DataDownloadService.html new file mode 100644 index 00000000..3a86fe84 --- /dev/null +++ b/API Doc/DataDownloadService.html @@ -0,0 +1,1374 @@ + + + + + JSDoc: Class: DataDownloadService + + + + + + + + + + +
+ +

Class: DataDownloadService

+ + + + + + +
+ +
+ +

DataDownloadService

+ + +
+ +
+
+ + + + + +

new DataDownloadService()

+ + + + + +
+ 数据下载类,用于从iServer服务器上下载数据到本地。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(url) → {Promise.<DataDownloadService>}

+ + + + + +
+ 根据指定的url构造一个新的 DataDownloadService 对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + 指定的url
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DataDownloadService> + + +
+
+ + + + + + + + + + +

(static) download(fullUrl, fromIndex, toIndex) → {Promise.<void>}

+ + + + + +
+ 获取指定的数据服务地址下对象集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 数据服务的地址,如:http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_R。
fromIndex + + +number + + + + 起始下标。
toIndex + + +number + + + + 结束下标。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) downloadAll(fullUrl) → {Promise.<void>}

+ + + + + +
+ 获取指定的数据服务地址下所有对象集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + 数据服务的地址,如:http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_R。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) downloadAllByName(serviceName, datasourceName, datasetName) → {Promise.<void>}

+ + + + + +
+ 获取指定的数据服务地址、数据源名称、数据集名称下所有对象集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + 服务名称。
datasourceName + + 数据源名。
datasetName + + 数据集名。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) downloadByName(serviceName, datasourceName, datasetName, fromIndex, toIndex) → {Promise.<void>}

+ + + + + +
+ 从iServer服务器上下载对象集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + 服务名称。
datasourceName + + 数据源名。
datasetName + + 数据集名。
fromIndex + + 起始下标。
toIndex + + 结束下标。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) downloadDataset(urlDatset, datasource) → {Promise.<void>}

+ + + + + +
+ 从服务器上下载一个数据集(支持点、线、面数据集),且在本地数据源中不存在与被下载的数据集同名的数据集,同时会在本地和服务器上创建一个同步属性数据集, 用于记录所下载的数据集在本地被修改的情况。同步数据集的名称为被下载的数据集名加上后缀“_Table”。如果下载失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
urlDatset + + dataset在服务器上的地址。
datasource + + 本地数据源。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) updateDataset(urlDatset, dataset) → {Promise.<void>}

+ + + + + +
+ 从服务器上更新本地数据集(支持点、线、面数据集),且要求本地存在同步数据集,服务器上存在要下载的数据集及其同步属性数据集。 如果更新失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
urlDatset + + 数据集在服务器上的地址。
dataset + + 本地数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/DataDownloadService.js.html b/API Doc/DataDownloadService.js.html new file mode 100644 index 00000000..8e510919 --- /dev/null +++ b/API Doc/DataDownloadService.js.html @@ -0,0 +1,194 @@ + + + + + JSDoc: Source: DataDownloadService.js + + + + + + + + + + +
+ +

Source: DataDownloadService.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ ref:ServiceBase
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let DDS = NativeModules.JSDataDownloadService;
+import ServiceBase from './ServiceBase.js';
+
+/**
+ * @class DataDownloadService
+ * @description 数据下载类,用于从iServer服务器上下载数据到本地。
+ */
+export default class DataDownloadService extends ServiceBase{
+    
+    constructor(){
+        super();
+        Object.defineProperty(this,"_SMDataDownloadServiceId",{
+            get:function () {
+                return this._SMServiceBaseId
+            },
+            set:function (_SMDataDownloadServiceId) {
+                this._SMServiceBaseId = _SMDataDownloadServiceId;
+            }
+        })
+    }
+
+    /**
+     * 根据指定的url构造一个新的 DataDownloadService 对象。
+     * @memberOf DataDownloadService
+     * @param {string} url - 指定的url
+     * @returns {Promise.<DataDownloadService>}
+     */
+    async createObj(url){
+        try{
+            var {_dataDownloadServiceId_} = await DDS.createObj(url);
+            var dataDownloadService = new DataDownloadService();
+            dataDownloadService._SMDataDownloadServiceId = _dataDownloadServiceId_;
+            return dataDownloadService;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取指定的数据服务地址下对象集合。
+     * @memberOf DataDownloadService
+     * @param {string} fullUrl - 数据服务的地址,如:http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_R。
+     * @param {number} fromIndex - 起始下标。
+     * @param {number} toIndex - 结束下标。
+     * @returns {Promise.<void>}
+     */
+    async download(fullUrl,fromIndex,toIndex){
+        try{
+            await DDS.download(this._SMDataDownloadServiceId,fullUrl,fromIndex,toIndex);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 从iServer服务器上下载对象集合。
+     * @memberOf DataDownloadService
+     * @param serviceName - 服务名称。
+     * @param datasourceName - 数据源名。
+     * @param datasetName - 数据集名。
+     * @param fromIndex - 起始下标。
+     * @param toIndex - 结束下标。
+     * @returns {Promise.<void>}
+     */
+    async downloadByName(serviceName,datasourceName,datasetName,fromIndex,toIndex){
+        try{
+            await DDS.downloadByName(this._SMDataDownloadServiceId,
+                serviceName,datasourceName,datasetName,fromIndex,toIndex);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取指定的数据服务地址下所有对象集合。
+     * @memberOf DataDownloadService
+     * @param fullUrl - 数据服务的地址,如:http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_R。
+     * @returns {Promise.<void>}
+     */
+    async downloadAll(fullUrl){
+        try{
+            await DDS.downloadAll(this._SMDataDownloadServiceId,fullUrl);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取指定的数据服务地址、数据源名称、数据集名称下所有对象集合。
+     * @memberOf DataDownloadService
+     * @param serviceName - 服务名称。
+     * @param datasourceName - 数据源名。
+     * @param datasetName - 数据集名。
+     * @returns {Promise.<void>}
+     */
+    async downloadAllByName(serviceName,datasourceName,datasetName){
+        try{
+            await DDS.downloadAllByName(this._SMDataDownloadServiceId,
+                serviceName,datasourceName,datasetName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 从服务器上下载一个数据集(支持点、线、面数据集),且在本地数据源中不存在与被下载的数据集同名的数据集,同时会在本地和服务器上创建一个同步属性数据集, 用于记录所下载的数据集在本地被修改的情况。同步数据集的名称为被下载的数据集名加上后缀“_Table”。如果下载失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。
+     * @memberOf DataDownloadService
+     * @param urlDatset - dataset在服务器上的地址。
+     * @param datasource - 本地数据源。
+     * @returns {Promise.<void>}
+     */
+    async downloadDataset(urlDatset,datasource){
+        try{
+            await DDS.downloadDataset(this._SMDataDownloadServiceId,
+                urlDatset,datasource.datasourceId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *从服务器上更新本地数据集(支持点、线、面数据集),且要求本地存在同步数据集,服务器上存在要下载的数据集及其同步属性数据集。 如果更新失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。
+     * @memberOf DataDownloadService
+     * @param urlDatset - 数据集在服务器上的地址。
+     * @param dataset - 本地数据集。
+     * @returns {Promise.<void>}
+     */
+    async updateDataset(urlDatset,dataset){
+        try{
+            await DDS.updateDataset(this._SMDataDownloadServiceId,
+                urlDatset,dataset.datasetId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/DataUploadService.html b/API Doc/DataUploadService.html new file mode 100644 index 00000000..b86235ee --- /dev/null +++ b/API Doc/DataUploadService.html @@ -0,0 +1,2483 @@ + + + + + JSDoc: Class: DataUploadService + + + + + + + + + + +
+ +

Class: DataUploadService

+ + + + + + +
+ +
+ +

DataUploadService

+ + +
+ +
+
+ + + + + +

new DataUploadService()

+ + + + + +
+ 数据上传类,用于将本地数据上传到iServer服务器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) addDataset(fullUrl, datasetName, datasetType) → {Promise.<void>}

+ + + + + +
+ 根据指定的数据集名称和数据类型添加数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 服务名称。
datasetName + + +string + + + + 数据集名。
datasetType + + +Dataset.Type + + + + 数据类型。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) addFeature(fullUrl, feature) → {Promise.<void>}

+ + + + + +
+ 向指定的数据服务地址添加对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 指定的数据服务地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
feature + + +object + + + + 待添加对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) addFeatureByName(serviceName, datasourceName, datasetName, feature) → {Promise.<void>}

+ + + + + +
+ 向iServer服务器中添加对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + +string + + + + 服务名称。
datasourceName + + +string + + + + 数据源名。
datasetName + + +string + + + + 数据集名。
feature + + +object + + + + 添加对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) cloneDataset(serviceName, datasourceName, destDatasetName, srcDatasourceName, srcDatasetName) → {Promise.<void>}

+ + + + + +
+ 通过复制指定数据源中的指定数据集向服务中添加数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + +string + + + + 服务名称。
datasourceName + + +string + + + + 数据源名。
destDatasetName + + +string + + + + 目标数据集名。
srcDatasourceName + + +string + + + + 源数据源名。
srcDatasetName + + +string + + + + 源数据集名。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) commitDataset(urlDataset, dataset) → {Promise.<void>}

+ + + + + +
+ 将本地数据集中修改、删除、新增的数据提交到服务器上对应的数据集中。提交时要求本地和服务器上都存在该数据集及其对应的属性数据集(属性数据集用于记录被修改和被删除的记录)。 同时本地数据集的版本不得高于服务器上的版本(即本地的Max[SmUserID]不大于服务器上的Max[SMID]),否则不能提交,需要先进行更新。目前数据集的类型支持点、线、面数据集。 如果提交失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
urlDataset + + +string + + + + dataset在服务器上的地址。
dataset + + +objecg + + + + 本地数据集,可以使点、线、面数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) createObj(url) → {Promise.<DataUploadService>}

+ + + + + +
+ 指定url地址创建一个DataUploadService实例 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + 指定的url
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DataUploadService> + + +
+
+ + + + + + + + + + +

(static) deleteDataset(fullUrl) → {Promise.<void>}

+ + + + + +
+ 删除数据集 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 要删除的数据集地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) deleteDatasetByName(serviceName, datasourceName, datasetName) → {Promise.<void>}

+ + + + + +
+ 删除数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + +string + + + + 服务名称。
datasourceName + + +string + + + + 数据源名。
datasetName + + +string + + + + 源数据集名。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) deleteFeature(fullUrl, featureIDs) → {Promise.<void>}

+ + + + + +
+ 根据指定的对象ID数组删除iServer服务器中的对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 指定数据服务地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
featureIDs + + +object + + + + 对象ID数组。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) deleteFeatureByName(serviceName, datasourceName, datasetName, featureIDs) → {Promise.<void>}

+ + + + + +
+ 根据指定的对象ID数组删除iServer服务器中的对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + +string + + + + 服务名称。
datasourceName + + +string + + + + 数据源名。
datasetName + + +string + + + + 数据集名。
featureIDs + + +array + + + + 对象ID数组。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) modifyFeature(fullUrl, featureID, feature) → {Promise.<void>}

+ + + + + +
+ 根据指定的ID修改对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fullUrl + + +string + + + + 要修改的对象地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
featureID + + +number + + + + 要修改的对象ID。
feature + + +object + + + + 修改的值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) modifyFeatureByName(serviceName, datasourceName, datasetName, featureID, feature) → {Promise.<void>}

+ + + + + +
+ 根据指定的ID和数据名称修改对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceName + + +string + + + + 服务名称。
datasourceName + + +string + + + + 数据源名。
datasetName + + +string + + + + 数据集名。
featureID + + +number + + + + 要修改的对象ID。
feature + + +object + + + + 结果对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/DataUploadService.js.html b/API Doc/DataUploadService.js.html new file mode 100644 index 00000000..53f2f84f --- /dev/null +++ b/API Doc/DataUploadService.js.html @@ -0,0 +1,278 @@ + + + + + JSDoc: Source: DataUploadService.js + + + + + + + + + + +
+ +

Source: DataUploadService.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let DUS = NativeModules.JSDataUploadService;
+import ServiceBase from './ServiceBase.js';
+
+/**
+ * @class DataUploadService
+ * @description 数据上传类,用于将本地数据上传到iServer服务器。
+ */
+export default class DataUploadService extends ServiceBase{
+
+    constructor(){
+        super();
+        Object.defineProperty(this,"_SMDataUploadServiceId",{
+            get:function () {
+                return this._SMServiceBaseId
+            },
+            set:function (_SMDataUploadServiceId) {
+                this._SMServiceBaseId = _SMDataUploadServiceId;
+            }
+        })
+    }
+
+    /**
+     * 指定url地址创建一个DataUploadService实例
+     * @memberOf DataUploadService
+     * @param {string} url - 指定的url
+     * @returns {Promise.<DataUploadService>}
+     */
+    async createObj(url){
+        try{
+            var {_dataUploadServiceId_} = await DUS.createObj(url);
+            var datauploadService = new DataUploadService();
+            datauploadService._SMDataUploadServiceId = _dataUploadServiceId_;
+            return datauploadService;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的数据集名称和数据类型添加数据集。
+     * @memberOf DataUploadService
+     * @param {string} fullUrl - 服务名称。
+     * @param {string} datasetName - 数据集名。
+     * @param {Dataset.Type} datasetType - 数据类型。
+     * @returns {Promise.<void>}
+     */
+    async addDataset(fullUrl,datasetName,datasetType){
+        try{
+            await DUS.addDataset(this._SMDataUploadServiceId,fullUrl,datasetName,datasetType);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 通过复制指定数据源中的指定数据集向服务中添加数据集。
+     * @memberOf DataUploadService
+     * @param {string} serviceName - 服务名称。
+     * @param {string} datasourceName - 数据源名。
+     * @param {string} destDatasetName - 目标数据集名。
+     * @param {string} srcDatasourceName - 源数据源名。
+     * @param {string} srcDatasetName - 源数据集名。
+     * @returns {Promise.<void>}
+     */
+    async cloneDataset(serviceName,datasourceName,destDatasetName,srcDatasourceName,srcDatasetName){
+        try{
+            await DUS.cloneDataset(this._SMDataUploadServiceId,serviceName,
+                datasourceName,destDatasetName,srcDatasourceName,srcDatasetName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 向指定的数据服务地址添加对象。
+     * @memberOf DataUploadService
+     * @param {string} fullUrl - 指定的数据服务地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
+     * @param {object} feature - 待添加对象。
+     * @returns {Promise.<void>}
+     */
+    async addFeature(fullUrl,feature){
+        try{
+            await DUS.addFeature(this._SMDataUploadServiceId,fullUrl,feature._SMFeatureId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 向iServer服务器中添加对象。
+     * @memberOf DataUploadService
+     * @param {string} serviceName - 服务名称。
+     * @param {string} datasourceName - 数据源名。
+     * @param {string} datasetName - 数据集名。
+     * @param {object} feature - 添加对象。
+     * @returns {Promise.<void>}
+     */
+    async addFeatureByName(serviceName,datasourceName,datasetName,feature){
+        try{
+            await DUS.addFeatureByName(this._SMDataUploadServiceId,serviceName,datasourceName,
+                datasetName,feature._SMFeatureId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的对象ID数组删除iServer服务器中的对象。
+     * @memberOf DataUploadService
+     * @param {string} fullUrl - 指定数据服务地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
+     * @param {object} featureIDs - 对象ID数组。
+     * @returns {Promise.<void>}
+     */
+    async deleteFeature(fullUrl,featureIDs){
+        try{
+            await DUS.deleteFeature(this._SMDataUploadServiceId,fullUrl,featureIDs);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的对象ID数组删除iServer服务器中的对象。
+     * @memberOf DataUploadService
+     * @param {string} serviceName - 服务名称。
+     * @param {string} datasourceName - 数据源名。
+     * @param {string} datasetName - 数据集名。
+     * @param {array} featureIDs - 对象ID数组。
+     * @returns {Promise.<void>}
+     */
+    async deleteFeatureByName(serviceName,datasourceName,datasetName,featureIDs){
+        try{
+            await DUS.deleteFeatureByName(this._SMDataUploadServiceId,serviceName,
+                datasourceName,datasetName,featureIDs);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的ID修改对象。
+     * @memberOf DataUploadService
+     * @param {string} fullUrl - 要修改的对象地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
+     * @param {number} featureID - 要修改的对象ID。
+     * @param {object} feature - 修改的值。
+     * @returns {Promise.<void>}
+     */
+    async modifyFeature(fullUrl,featureID,feature){
+        try{
+            await DUS.modifyFeature(this._SMDataUploadServiceId,fullUrl,featureID,feature._SMFeatureId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的ID和数据名称修改对象。
+     * @memberOf DataUploadService
+     * @param {string} serviceName - 服务名称。
+     * @param {string} datasourceName - 数据源名。
+     * @param {string} datasetName - 数据集名。
+     * @param {number} featureID - 要修改的对象ID。
+     * @param {object} feature - 结果对象。
+     * @returns {Promise.<void>}
+     */
+    async modifyFeatureByName(serviceName,datasourceName,datasetName,featureID,feature){
+        try{
+            await DUS.modifyFeatureByName(this._SMDataUploadServiceId,serviceName,
+                datasourceName,datasetName,featureID,feature._SMFeatureId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 提交
+     * @description 将本地数据集中修改、删除、新增的数据提交到服务器上对应的数据集中。提交时要求本地和服务器上都存在该数据集及其对应的属性数据集(属性数据集用于记录被修改和被删除的记录)。 同时本地数据集的版本不得高于服务器上的版本(即本地的Max[SmUserID]不大于服务器上的Max[SMID]),否则不能提交,需要先进行更新。目前数据集的类型支持点、线、面数据集。 如果提交失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。
+     * @memberOf DataUploadService
+     * @param {string} urlDataset  - dataset在服务器上的地址。
+     * @param {objecg} dataset - 本地数据集,可以使点、线、面数据集。
+     * @returns {Promise.<void>}
+     */
+    async commitDataset(urlDataset,dataset){
+        try{
+            await DUS.commitDataset(this._SMDataUploadServiceId,fullUrl,dataset._SMDatasetId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 删除数据集
+     * @memberOf DataUploadService
+     * @param {string} fullUrl - 要删除的数据集地址,如:http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes。
+     * @returns {Promise.<void>}
+     */
+    async deleteDataset(fullUrl){
+        try{
+            await DUS.deleteDataset(this._SMDataUploadServiceId,fullUrl);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 删除数据集。
+     * @memberOf DataUploadService
+     * @param {string} serviceName - 服务名称。
+     * @param {string} datasourceName - 数据源名。
+     * @param {string} datasetName - 源数据集名。
+     * @returns {Promise.<void>}
+     */
+    async deleteDatasetByName(serviceName,datasourceName,datasetName){
+        try{
+            await DUS.deleteDatasetByName(this._SMDataUploadServiceId,serviceName,datasourceName,datasetName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Dataset.html b/API Doc/Dataset.html new file mode 100644 index 00000000..7209d58a --- /dev/null +++ b/API Doc/Dataset.html @@ -0,0 +1,1786 @@ + + + + + JSDoc: Class: Dataset + + + + + + + + + + +
+ +

Class: Dataset

+ + + + + + +
+ +
+ +

Dataset

+ + +
+ +
+
+ + + + + +

new Dataset()

+ + + + + +
+ 所有数据集类型(如矢量数据集,栅格数据集等)的基类。提供各数据集共有的方法和事件。数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集和栅格数据集和影像数据集,以及为了处理特定问题而设计的如拓扑数据集,网络数据集等。数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,线数据集,面数据集等,各矢量数据集是空间特征和性质相同而组织在一起的数据的集合。而栅格数据集由像元阵列组成,在表现要素上比矢量数据集欠缺,但是可以很好的表现空间现象的位置关系。光栅数据集包括影像数据集和栅格数据集。 + +在 SuperMap 中有十八种类型的数据集,但目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,纯属性表数据集和影像数据集。 +
+ + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
TYPE.TABULAR + + +number + + + + 纯属性数据集。
TYPE.POINT + + +number + + + + 点数据集。
TYPE.LINE + + +number + + + + 线数据集。
TYPE.REGION + + +number + + + + 多边形数据集。
TYPE.TEXT + + +number + + + + 文本数据集。
TYPE.IMAGE + + +number + + + + 影像数据集。
TYPE.CAD + + +number + + + + 复合数据集。
TYPE.NETWORK + + +number + + + + 网络数据集。
TYPE.NETWORK3D + + +number + + + + 三维网络数据集。
TYPE.NdfVector + + +number + + + + -
TYPE.GRID + + +number + + + + 栅格数据集。
TYPE.WMS + + +number + + + + WMS数据集。
TYPE.WCS + + +number + + + + WCS数据集。
TYPE.WFS + + +number + + + + WFS数据集。
TYPE.POINT3D + + +number + + + + 三维点数据集。
TYPE.LINE3D + + +number + + + + 三维线数据集。
TYPE.REGION3D + + +number + + + + 三维面数据集。
TYPE.DEM + + +number + + + + -
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) getDatasource() → {Promise.<Datasource>}

+ + + + + +
+ 返回此数据集对象所属数据源对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Datasource> + + +
+
+ + + + + + + + + + +

(static) getEncodeType() → {Promise.<Promise.type>}

+ + + + + +
+ 返回此数据集数据存储时的编码方式。对数据集采用压缩编码方式,可以减少数据存储所占用的空间,降低数据传输时的网络负载和服务器的负载。矢量数据集支持的编码方式有Byte,Int16,Int24,Int32,SGL,LZW,DCT,也可以指定为不使用编码方式。光栅数据支持的编码方式有DCT,SGL,LZW 或不使用编码方式。具体请参见EncodeType类型。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.type> + + +
+
+ + + + + + + + + + +

(static) getFieldValue(SQL, fieldName) → {Promise.<Array>}

+ + + + + +
+ 通过查询语句获取字段内容 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
SQL + + +string + + + + 查询语句
fieldName + + +string + + + + 字段名
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Array> + + +
+
+ + + + + + + + + + +

(static) getGeoInnerPoint(SQL) → {Promise.<Array>}

+ + + + + +
+ 通过查询语句获取所需几何对象内点集合 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
SQL + + +string + + + + 查询语句
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Array> + + +
+
+ + + + + + + + + + +

(static) getPrjCoordSys() → {Promise.<PrjCoordSys>}

+ + + + + +
+ 返回数据集的投影信息。 +当该数据集的投影采用其所在数据源的投影时,该方法返回 null。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<PrjCoordSys> + + +
+
+ + + + + + + + + + +

(static) getSMID(SQL) → {Promise.<Array>}

+ + + + + +
+ 通过查询语句获取所需几何对象ID集合 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
SQL + + +string + + + + 查询语句
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Array> + + +
+
+ + + + + + + + + + +

(static) getType() → {Dataset.Type}

+ + + + + +
+ 返回此数据集的类型。目前版本支持的数据集类型包括纯属性表数据集、点数据集、线数据集、面数据集、文本数据集和影像数据集(DatasetImage)。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Dataset.Type + + +
+
+ + + + + + + + + + +

(static) isopen() → {boolean}

+ + + + + +
+ 判断此数据集是否已经打开。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开数据集的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以通过该方法来判定数据集是否已被打开。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - 如果此数据集已经被打开,返回 true;否则返回 false。 +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) openDataset() → {boolean}

+ + + + + +
+ 用于打开数据集,准备对数据集进行操作。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以先使用 isOpen 方法来判断一下数据集是否已经被打开。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) toDatasetVector() → {Promise.<DatasetVector>}

+ + + + + +
+ 转成DatasetVector对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DatasetVector> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Dataset.js.html b/API Doc/Dataset.js.html new file mode 100644 index 00000000..1505df86 --- /dev/null +++ b/API Doc/Dataset.js.html @@ -0,0 +1,195 @@ + + + + + JSDoc: Source: Dataset.js + + + + + + + + + + +
+ +

Source: Dataset.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ ref:PrjCoordSys
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let D = NativeModules.JSDataset;
+import Datasource from './Datasource.js';
+import DatasetVector from './DatasetVector.js';
+import PrjCoordSys from './PrjCoordSys.js';
+
+/**
+ * @class Dataset
+ * @description 所有数据集类型(如矢量数据集,栅格数据集等)的基类。提供各数据集共有的方法和事件。数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集和栅格数据集和影像数据集,以及为了处理特定问题而设计的如拓扑数据集,网络数据集等。数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,线数据集,面数据集等,各矢量数据集是空间特征和性质相同而组织在一起的数据的集合。而栅格数据集由像元阵列组成,在表现要素上比矢量数据集欠缺,但是可以很好的表现空间现象的位置关系。光栅数据集包括影像数据集和栅格数据集。
+ *
+ * 在 SuperMap 中有十八种类型的数据集,但目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,纯属性表数据集和影像数据集。
+ * @property {number} TYPE.TABULAR - 纯属性数据集。
+ * @property {number} TYPE.POINT - 点数据集。
+ * @property {number} TYPE.LINE - 线数据集。
+ * @property {number} TYPE.REGION - 多边形数据集。
+ * @property {number} TYPE.TEXT - 文本数据集。
+ * @property {number} TYPE.IMAGE - 影像数据集。
+ * @property {number} TYPE.CAD - 复合数据集。
+ * @property {number} TYPE.NETWORK - 网络数据集。
+ * @property {number} TYPE.NETWORK3D - 三维网络数据集。
+ * @property {number} TYPE.NdfVector -
+ * @property {number} TYPE.GRID - 栅格数据集。
+ * @property {number} TYPE.WMS - WMS数据集。
+ * @property {number} TYPE.WCS - WCS数据集。
+ * @property {number} TYPE.WFS - WFS数据集。
+ * @property {number} TYPE.POINT3D - 三维点数据集。
+ * @property {number} TYPE.LINE3D - 三维线数据集。
+ * @property {number} TYPE.REGION3D - 三维面数据集。
+ * @property {number} TYPE.DEM -
+ */
+export default class Dataset{
+
+    /**
+     * 转成DatasetVector对象
+     * @memberOf Dataset
+     * @returns {Promise.<DatasetVector>}
+     */
+    async toDatasetVector(){
+        try{
+            var {datasetVectorId} = await D.toDatasetVector(this._SMDatasetId);
+            var datasetVector = new DatasetVector();
+            datasetVector._SMDatasetVectorId = datasetVectorId;
+            return datasetVector;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回数据集的投影信息。
+     * 当该数据集的投影采用其所在数据源的投影时,该方法返回 null。
+     * @memberOf Dataset
+     * @returns {Promise.<PrjCoordSys>}
+     */
+    async getPrjCoordSys(){
+        try{
+            var {prjCoordSysId} = await D.getPrjCoordSys(this._SMDatasetId);
+            var prjCoordSys = new PrjCoordSys();
+            prjCoordSys._SMPrjCoordSysId = prjCoordSysId;
+            return prjCoordSys;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于打开数据集,准备对数据集进行操作。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以先使用 isOpen 方法来判断一下数据集是否已经被打开。
+     * @memberOf Dataset
+     * @returns {boolean}
+     */
+    async openDataset(){
+        try{
+            var {opened} = await D.openDataset(this._SMDatasetId);
+            return opened;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 判断此数据集是否已经打开。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开数据集的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以通过该方法来判定数据集是否已被打开。
+     * @memberOf Dataset
+     * @returns {boolean} - 如果此数据集已经被打开,返回 true;否则返回 false。
+     */
+    async isopen(){
+        try{
+            var {opened} = await D.isopen(this._SMDatasetId);
+            return opened;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此数据集的类型。目前版本支持的数据集类型包括纯属性表数据集、点数据集、线数据集、面数据集、文本数据集和影像数据集(DatasetImage)。
+     * @memberOf Dataset
+     * @returns {Dataset.Type}
+     */
+    async getType(){
+        try{
+            var {type} = await D.getType(this._SMDatasetId);
+            return type;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此数据集对象所属数据源对象。
+     * @memberOf Dataset
+     * @returns {Promise.<Datasource>}
+     */
+    async getDatasource(){
+        try{
+            var {datasourceId} = await D.getDatasource(this._SMDatasetId);
+            var datasource = new Datasource();
+            datasource._SMDatasourceId = datasourceId;
+            return datasource;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此数据集数据存储时的编码方式。对数据集采用压缩编码方式,可以减少数据存储所占用的空间,降低数据传输时的网络负载和服务器的负载。矢量数据集支持的编码方式有Byte,Int16,Int24,Int32,SGL,LZW,DCT,也可以指定为不使用编码方式。光栅数据支持的编码方式有DCT,SGL,LZW 或不使用编码方式。具体请参见EncodeType类型。
+     * @memberOf Dataset
+     * @returns {Promise.<Promise.type>}
+     */
+    async getEncodeType(){
+        try{
+            var {type} = await D.getEncodeType(this._SMDatasetId);
+            return type;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/DatasetVector.html b/API Doc/DatasetVector.html new file mode 100644 index 00000000..aef0ed0b --- /dev/null +++ b/API Doc/DatasetVector.html @@ -0,0 +1,1675 @@ + + + + + JSDoc: Class: DatasetVector + + + + + + + + + + +
+ +

Class: DatasetVector

+ + + + + + +
+ +
+ +

DatasetVector

+ + +
+ +
+
+ + + + + +

new DatasetVector()

+ + + + + +
+ 矢量数据集类。用于对矢量数据集进行描述,并对之进行相应的管理和操作。对矢量数据集的操作主要包括数据查询、修改、删除、建立索引等。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) buildSpatialIndex(spatialIndexType) → {Promise.<boolean>}

+ + + + + +
+ 根据给定的空间索引类型来为矢量数据集创建空间索引。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
spatialIndexType + + +DatasetVector.SpatialIndeType + + + + 指定的需要创建空间索引的类型
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) computeBounds() → {Promise.<object>}

+ + + + + +
+ 计算数据集的空间范围 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<object> + + +
+
+ + + + + + + + + + +

(static) dropSpatialIndex() → {Promise.<boolean>}

+ + + + + +
+ 删除空间索引 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) fromGeoJSON(geoJson) → {Promise.<boolean>}

+ + + + + +
+ 将数据集中指定起止SmID的对象,转换成GeoJSON格式的字符串 +仅支持点、线、面和CAD数据集,转换点、线、面对象.hasAtrributte为true时,结果中包含属性值;hasAtrribute为false时,只有几何对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geoJson + + +string + + + + json字符串
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) getRecordset(isEmptyRecordset, cursorType) → {Promise.<Recordset>}

+ + + + + +
+ 根据给定的参数来返回空的记录集或者返回包括所有记录的记录集对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isEmptyRecordset + + +boolean + + + +
cursorType + + +number + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Recordset> + + +
+
+ + + + + + + + + + +

(static) getSpatialIndexType() → {Promise.<DatasetVector.SpatialIndeType>}

+ + + + + +
+ 返回当前的空间索引类型 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DatasetVector.SpatialIndeType> + + +
+
+ + + + + + + + + + +

(static) query(queryParameter) → {Promise}

+ + + + + +
+ 通过设置查询条件对矢量数据集进行查询,该方法默认查询空间信息与属性信息。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
queryParameter + + +object + + + + 定义的查询条件。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - 返回查询结果对象:result:{geoJson:geoJson结果集数组,每次10条,queryParameterId:查询条件对象的引用,可用于重复查询,counts:总记录数,batch:返回的批次数量,size:每批次记录数(最大为10),recordsetId:记录集对象引用} +
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) queryByFilter(attributeFilter, geoRegion, count, callback) → {Promise.<void>}

+ + + + + +
+ 异步空间查询,查询指定空间范围内符合字段条件的记录; +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
attributeFilter + + +string + + + + 查询过滤字段
geoRegion + + +object + + + + 查询的区域
count + + 返回的查询结果个数
callback + + +function + + + + 返回结果的处理函数,回调参数callback(e){},e为Recordset的geoJson格式对象的数组
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) queryInBuffer(rectangle2D, cursorType) → {Promise.<Recordset>}

+ + + + + +
+ 查询落在已知空间范围内的记录。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rectangle2D + + +Rectangle2D + + + +
cursorType + + +number + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Recordset> + + +
+
+ + + + + + + + + + +

(static) toGeoJSON(hasAttributte, startID, endID) → {Promise.<string>}

+ + + + + +
+ 从GeoJSON字符串中获取几何对象,并将其存入数据集中 +仅支持点、线、面和CAD数据集,获取点、线、面对象 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hasAttributte + + +boolean + + + + 是否包含属性值
startID + + +number + + + + 起始SmID
endID + + +number + + + + 结束SmID
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/DatasetVector.js.html b/API Doc/DatasetVector.js.html new file mode 100644 index 00000000..ed00a856 --- /dev/null +++ b/API Doc/DatasetVector.js.html @@ -0,0 +1,337 @@ + + + + + JSDoc: Source: DatasetVector.js + + + + + + + + + + +
+ +

Source: DatasetVector.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ Description:数据集类
+ ref:rectangle2D
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let DV = NativeModules.JSDatasetVector;
+import Dataset from './Dataset.js';
+import Recordset from  './Recordset.js';
+import QueryParameter from './QueryParameter.js';
+
+
+/**
+ * @class DatasetVector
+ * @description 矢量数据集类。用于对矢量数据集进行描述,并对之进行相应的管理和操作。对矢量数据集的操作主要包括数据查询、修改、删除、建立索引等。
+ */
+export default class DatasetVector {
+   /* constructor(){
+        super();
+        Object.defineProperty(this,"datasetVectorId",{
+                              get:function(){
+                              return this.datasetId
+                              },
+                              set:function(datasetVectorId){
+                              this.datasetId = datasetVectorId;
+                              }
+                              })
+    }*/
+    
+    /**
+     * 查询落在已知空间范围内的记录。
+     * @memberOf DatasetVector
+     * @deprecated - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。
+     * @param {Rectangle2D} rectangle2D
+     * @param {number} cursorType
+     * @returns {Promise.<Recordset>}
+     */
+    async queryInBuffer(rectangle2D, cursorType) {
+        try {
+            var {recordsetId} = await DV.queryInBuffer(this._SMDatasetVectorId, rectangle2D._SMRectangle2DId, cursorType);
+            var recordset = new Recordset();
+            recordset.recordsetId = recordsetId;
+            return recordset;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据给定的参数来返回空的记录集或者返回包括所有记录的记录集对象。
+     * @memberOf DatasetVector
+     * @deprecated - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。
+     * @param {boolean} isEmptyRecordset
+     * @param {number} cursorType
+     * @returns {Promise.<Recordset>}
+     */
+    async getRecordset(isEmptyRecordset, cursorType) {
+        try {
+            var {recordsetId} =await DV.getRecordset(this._SMDatasetVectorId, isEmptyRecordset, cursorType);
+            var recordset = new Recordset();
+            recordset.recordsetId = recordsetId;
+            return recordset;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 通过设置查询条件对矢量数据集进行查询,该方法默认查询空间信息与属性信息。
+     * @memberOf DatasetVector
+     * @param {object}queryParameter - 定义的查询条件。
+     * @returns {Promise} - 返回查询结果对象:result:{geoJson:geoJson结果集数组,每次10条,queryParameterId:查询条件对象的引用,可用于重复查询,counts:总记录数,batch:返回的批次数量,size:每批次记录数(最大为10),recordsetId:记录集对象引用}
+     */
+    async query(queryParameter) {
+        try {
+            var QueryParameterFac = new QueryParameter();
+            var qp = await QueryParameterFac.createObj();
+
+            if (!queryParameter
+            // && (queryParameter.attributeFilter || queryParameter.groupBy ||
+            //         queryParameter.hasGeometry || queryParameter.resultFields || queryParameter.orderBy ||
+            //         queryParameter.spatialQueryMode)
+            ) {
+                qp.queryParameterId = "0";
+            } else {
+                queryParameter.attributeFilter && await qp.setAttributeFilter(queryParameter.attributeFilter);
+
+                queryParameter.groupBy && await qp.setGroupBy(queryParameter.groupBy);
+
+                queryParameter.hasGeometry && await qp.setHasGeometry(queryParameter.hasGeometry);
+
+                queryParameter.resultFields && await qp.setResultFields(queryParameter.resultFields);
+
+                queryParameter.orderBy && await qp.setOrderBy(queryParameter.orderBy);
+
+                queryParameter.spatialQueryObject && await qp.setSpatialQueryObject(queryParameter.spatialQueryObject);
+
+                queryParameter.spatialQueryMode && await qp.setSpatialQueryMode(queryParameter.spatialQueryMode);
+
+                if (queryParameter.size) qp.size = queryParameter.size;
+                if (queryParameter.batch) qp.batch = queryParameter.batch;
+            }
+
+
+            var result = await DV.query(this._SMDatasetVectorId, qp._SMQueryParameterId,
+                qp.size, qp.batch);
+            return result;
+        } catch (e) {
+            console.log(e);
+        }
+    }
+
+    /**
+     *根据给定的空间索引类型来为矢量数据集创建空间索引。
+     * @memberOf DatasetVector
+     * @param {DatasetVector.SpatialIndeType} spatialIndexType - 指定的需要创建空间索引的类型
+     * @returns {Promise.<boolean>}
+     */
+    async buildSpatialIndex(spatialIndexType) {
+        try {
+            var {built} =await DV.buildSpatialIndex(this._SMDatasetVectorId, spatialIndexType);
+            return built;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 删除空间索引
+     * @memberOf DatasetVector
+     * @returns {Promise.<boolean>}
+     */
+    async dropSpatialIndex() {
+        try {
+            var {dropped} =await DV.dropSpatialIndex(this._SMDatasetVectorId);
+            return dropped;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回当前的空间索引类型
+     * @memberOf DatasetVector
+     * @returns {Promise.<DatasetVector.SpatialIndeType>}
+     */
+    async getSpatialIndexType() {
+        try {
+            var {type} =await DV.getSpatialIndexType(this._SMDatasetVectorId);
+            return type;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 计算数据集的空间范围
+     * @memberOf DatasetVector
+     * @returns {Promise.<object>}
+     */
+    async computeBounds() {
+        try {
+            var {bounds} =await DV.computeBounds(this._SMDatasetVectorId);
+            return bounds;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     *从GeoJSON字符串中获取几何对象,并将其存入数据集中
+     *仅支持点、线、面和CAD数据集,获取点、线、面对象
+     * @memberOf DatasetVector
+     * @param {boolean} hasAttributte - 是否包含属性值
+     * @param {number} startID - 起始SmID
+     * @param {number} endID - 结束SmID
+     * @returns {Promise.<string>}
+     */
+    async toGeoJSON(hasAttributte, startID, endID) {
+        try {
+            var {geoJSON} =await DV.toGeoJSON(this._SMDatasetVectorId);
+            var json = JSON.parse(geoJSON);
+            return geoJSON;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将数据集中指定起止SmID的对象,转换成GeoJSON格式的字符串
+     *仅支持点、线、面和CAD数据集,转换点、线、面对象.hasAtrributte为true时,结果中包含属性值;hasAtrribute为false时,只有几何对象。
+     * @memberOf DatasetVector
+     * @param {string} geoJson - json字符串
+     * @returns {Promise.<boolean>}
+     */
+    async fromGeoJSON(geoJson) {
+        try {
+            var {done} =await DV.fromGeoJSON(this._SMDatasetVectorId,geoJson);
+            return done;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 异步空间查询,查询指定空间范围内符合字段条件的记录;
+     * @memberOf DatasetVector
+     * @param {string} attributeFilter - 查询过滤字段
+     * @param {object} geoRegion - 查询的区域
+     * @param count - 返回的查询结果个数
+     * @param {function} callback - 返回结果的处理函数,回调参数callback(e){},e为Recordset的geoJson格式对象的数组
+     * @returns {Promise.<void>}
+     */
+    async queryByFilter(attributeFilter,geoRegion,count,callback) {
+        try {
+            var success = await DV.queryByFilter(this._SMDatasetVectorId,attributeFilter,geoRegion.geometryId,count);
+            if(!success) return null;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSDatasetVector.query_by_filter', function(e) {
+                var features = [];
+                var records = [];
+                for(var i in e){
+                    features[i] = JSON.parse(e[i]);
+                    records = records.concat(features[i]);
+                }
+                if(typeof callback == 'function'){
+                    callback(records);
+                }else{
+                    console.error("Please set a callback function as the fourth argument.");
+                }
+            });
+
+        } catch (e) {
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 通过查询语句获取所需几何对象ID集合
+     * @memberOf Dataset
+     * @param {string} SQL - 查询语句
+     * @returns {Promise.<Array>}
+     */
+    async getSMID(SQL){
+        try{
+            var {result} = await DV.getSMID(this._SMDatasetVectorId,SQL);
+            return result;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 通过查询语句获取字段内容
+     * @memberOf Dataset
+     * @param {string} SQL - 查询语句
+     * @param {string} fieldName - 字段名
+     * @returns {Promise.<Array>}
+     */
+    async getFieldValue(SQL,fieldName){
+        try{
+            var {result} = await DV.getFieldValue(this._SMDatasetVectorId,SQL,fieldName);
+            return result;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 通过查询语句获取所需几何对象内点集合
+     * @memberOf Dataset
+     * @param {string} SQL - 查询语句
+     * @returns {Promise.<Array>}
+     */
+    async getGeoInnerPoint(SQL){
+        try{
+            var {result} = await DV.getGeoInnerPoint(this._SMDatasetVectorId,SQL);
+            return result;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/DatasetVectorInfo.html b/API Doc/DatasetVectorInfo.html new file mode 100644 index 00000000..ef9e5ac5 --- /dev/null +++ b/API Doc/DatasetVectorInfo.html @@ -0,0 +1,339 @@ + + + + + JSDoc: Class: DatasetVectorInfo + + + + + + + + + + +
+ +

Class: DatasetVectorInfo

+ + + + + + +
+ +
+ +

DatasetVectorInfo

+ + +
+ +
+
+ + + + + +

new DatasetVectorInfo()

+ + + + + +
+ 矢量数据集信息类。 + 包括了矢量数据集的信息,如矢量数据集的名称,数据集的类型。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObjByNameType(name, type) → {Promise.<DatasetVectorInfo>}

+ + + + + +
+ 创建DatasetVectorInfo实例 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + 数据集的名称
type + + +number + + + + 数据集的类型
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DatasetVectorInfo> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/DatasetVectorInfo.js.html b/API Doc/DatasetVectorInfo.js.html new file mode 100644 index 00000000..ce0bd73a --- /dev/null +++ b/API Doc/DatasetVectorInfo.js.html @@ -0,0 +1,85 @@ + + + + + JSDoc: Source: DatasetVectorInfo.js + + + + + + + + + + +
+ +

Source: DatasetVectorInfo.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let DVI = NativeModules.JSDatasetVectorInfo;
+
+/**
+ * @class DatasetVectorInfo
+ * @description 矢量数据集信息类。
+   包括了矢量数据集的信息,如矢量数据集的名称,数据集的类型。
+ */
+export default class DatasetVectorInfo {
+
+    /**
+     * 创建DatasetVectorInfo实例
+     * @memberOf DatasetVectorInfo
+     * @param {string} name - 数据集的名称
+     * @param {number} type - 数据集的类型
+     * @returns {Promise.<DatasetVectorInfo>}
+     */
+    async createObjByNameType(name,type){
+        try{
+            var {datasetVectorInfoId} = await DVI.createObjByNameType(name,type);
+            var datasetVectorInfo = new DatasetVectorInfo();
+            datasetVectorInfo.datasetVectorInfoId = datasetVectorInfoId;
+            return datasetVectorInfo;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Datasource.html b/API Doc/Datasource.html new file mode 100644 index 00000000..ef2b409d --- /dev/null +++ b/API Doc/Datasource.html @@ -0,0 +1,1535 @@ + + + + + JSDoc: Class: Datasource + + + + + + + + + + +
+ +

Class: Datasource

+ + + + + + +
+ +
+ +

Datasource

+ + +
+ +
+
+ + + + + +

new Datasource()

+ + + + + +
+ 该类管理投影信息、数据源与数据库的连接信息和对其中的数据集的相关操作,如通过已有数据集复制生成新的数据集等。 +
+ + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
EncodeType + + +number + + + + 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT
DatasourceEncrytionType + + +number + + + + 数据集存储时的压缩编码方式 DEFAULT | AES
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) containDataset(datasetName) → {Promise.<boolean>}

+ + + + + +
+ 检查当前数据源中是否包含指定名称的数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetName + + +string + + + + 数据集名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) copyDataset(srcDataset, desDatasetName, encodeType) → {Promise.<Dataset>}

+ + + + + +
+ 用于在相同或不同引擎数据源中复制数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
srcDataset + + +object + + + + 要复制的源数据集。
desDatasetName + + +string + + + + 目标数据集的名称。
encodeType + + +Datasource.EncodeType + + + + 数据集的编码方式。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Dataset> + + +
+
+ + + + + + + + + + +

(static) createDatasetVector(datasetVectorInfo|datasetName, datasetType, encodeType) → {Promise.<DatasetVector>}

+ + + + + +
+ 根据指定的矢量数据集信息来创建矢量数据集。可传入一个datasetVectorInfo类对象,或直接传入数据集名称、数据集类型和编码类型三个参数。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVectorInfo|datasetName + + +object +| + +string + + + + 数据集矢量信息对象
datasetType + + +number + + + + Dataset
encodeType + + +number + + + + 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DatasetVector> + + +
+
+ + + + + + + + + + +

(static) deleteDataset(datasetName) → {Promise.<boolean>}

+ + + + + +
+ 用于删除指定名称的数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetName + + +string + + + + 数据集名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) getAvailableDatasetName(name) → {Promise.<string>}

+ + + + + +
+ 返回一个数据源中未被使用的数据集的名称。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + 待检测名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + +

(static) getDataset(index|name) → {Promise.<Dataset>}

+ + + + + +
+ 指定名称或序号来获取数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
index|name + + +number +| + +string + + + + 既可以是序号,也可以是数据集名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Dataset> + + +
+
+ + + + + + + + + + +

(static) getDatasetCount() → {Promise.<number>}

+ + + + + +
+ 返回数据集集合中数据集的个数。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) getDatasets() → {Promise.<Datasets>}

+ + + + + +
+ 获取数据集集合。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • - 已弃用,Datasets类不建议使用,后续版本即将移除此接口
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Datasets> + + +
+
+ + + + + + + + + + +

(static) getPrjCoordSys() → {Promise.<PrjCoordSys>}

+ + + + + +
+ 返回数据源的投影信息。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<PrjCoordSys> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Datasource.js.html b/API Doc/Datasource.js.html new file mode 100644 index 00000000..3e8a69e5 --- /dev/null +++ b/API Doc/Datasource.js.html @@ -0,0 +1,253 @@ + + + + + JSDoc: Source: Datasource.js + + + + + + + + + + +
+ +

Source: Datasource.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ Description:数据源类
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let D = NativeModules.JSDatasource;
+import Datasets from './Datasets.js';
+import Dataset from './Dataset.js';
+import DatasetVector from './DatasetVector.js';
+import PrjCoordSys from './PrjCoordSys.js';
+
+/**
+ * @class Datasource
+ * @description 该类管理投影信息、数据源与数据库的连接信息和对其中的数据集的相关操作,如通过已有数据集复制生成新的数据集等。
+ * @property {number} EncodeType - 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT
+ * @property {number} DatasourceEncrytionType - 数据集存储时的压缩编码方式 DEFAULT | AES
+ */
+export default class Datasource{
+
+    /**
+     * 获取数据集集合。
+     * @memberOf Datasource
+     * @deprecated - 已弃用,Datasets类不建议使用,后续版本即将移除此接口
+     * @returns {Promise.<Datasets>}
+     */
+    async getDatasets(){
+        console.warn("Datasource.js:getDatasets() function has been deprecated. If you want to get dataset , please call the getDataset() function");
+        try{
+            var {datasetsId} = await D.getDatasets(this._SMDatasourceId);
+            var datasets = new Datasets();
+            datasets._SMDatasetsId = datasetsId;
+
+            return datasets;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 指定名称或序号来获取数据集。
+     * @memberOf Datasource
+     * @param {number | string} index|name - 既可以是序号,也可以是数据集名称
+     * @returns {Promise.<Dataset>}
+     */
+    async getDataset(arg){
+        try{
+            var dataset = new Dataset();
+            if(typeof arg != "string"){
+                var {datasetId} = await D.getDataset(this._SMDatasourceId,arg);
+            }else{
+                var {datasetId} = await D.getDatasetByName(this._SMDatasourceId,arg);
+            }
+            dataset._SMDatasetId = datasetId;
+
+            return dataset;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回一个数据源中未被使用的数据集的名称。
+     * @memberOf Datasource
+     * @param {string} name - 待检测名称
+     * @returns {Promise.<string>}
+     */
+    async getAvailableDatasetName(name){
+        try{
+            var {datasetName} = await D.getAvailableDatasetName(this._SMDatasourceId,name);
+            return datasetName;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据指定的矢量数据集信息来创建矢量数据集。可传入一个datasetVectorInfo类对象,或直接传入数据集名称、数据集类型和编码类型三个参数。
+     * @memberOf Datasource
+     * @param {object | string} datasetVectorInfo|datasetName - 数据集矢量信息对象
+     * @param {number} datasetType - {@link Dataset}
+     * @param {number} encodeType - 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT
+     * @returns {Promise.<DatasetVector>}
+     */
+    async createDatasetVector(nameOrInfoObj,datasetType,encodeType){
+        try{
+            if(arguments.length === 1){
+                var {datasetVectorId} = await D.createDatasetVector(this._SMDatasourceId,nameOrInfoObj.datasetVectorInfoId);
+                var datasetVector = new DatasetVector();
+                datasetVector._SMDatasetVectorId = datasetVectorId;
+                return datasetVector;
+            }else{
+                var {datasetVectorId} = await D.createDatasetVectorDirectly(this._SMDatasourceId,nameOrInfoObj,datasetType,encodeType);
+                var datasetVector = new DatasetVector();
+                datasetVector._SMDatasetVector = datasetVectorId;
+                return datasetVector;
+            }
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+
+    /**
+     * 用于在相同或不同引擎数据源中复制数据集。
+     * @memberOf Datasource
+     * @param {object} srcDataset - 要复制的源数据集。
+     * @param {string} desDatasetName - 目标数据集的名称。
+     * @param {Datasource.EncodeType}encodeType - 数据集的编码方式。
+     * @returns {Promise.<Dataset>}
+     */
+    async copyDataset(srcDataset,desDatasetName,encodeType){
+        try{
+            var {datasetId} = await D.copyDataset(this._SMDatasourceId,srcDataset._SMDatasetId,desDatasetName,encodeType | 0);
+            var dataset = new Dataset();
+            dataset.datasetId = datasetId;
+            return dataset;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /*
+     * 修改当前数据源的密码
+     * @memberOf Datasource
+     * @param {number} oldPassword - 原始密码,不能为null
+     * @param {number} newPassword - 新密码,不能为null
+     * @param {Datasource.DatasourceEncrytionType} datasourceEncrytionType
+     * @returns {Promise.<Promise.changed>} 新密码使用的加密类型
+     */
+   /* async changepassword(oldPassword,newPassword,datasourceEncrytionType){
+        try{
+            if(!oldPassword || !newPassword) throw new Error("Datasource.js:原始密码和新密码不能为空。");
+            var {changed} = await D.changepassword(this._SMDatasourceId,oldPassword,newPassword, datasourceEncrytionType | 0);
+            return changed;
+        }catch(e){
+            console.error(e);
+        }
+    } */
+
+    /**
+     * 返回数据源的投影信息。
+     * @memberOf Datasource
+     * @returns {Promise.<PrjCoordSys>}
+     */
+    async getPrjCoordSys(){
+        try{
+            var {prjCoordSysId} = await D.getPrjCoordSys(this._SMDatasourceId);
+            var prjCoordSys = new PrjCoordSys();
+            prjCoordSys._SMPrjCoordSysId = prjCoordSysId;
+            return prjCoordSys;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 检查当前数据源中是否包含指定名称的数据集。
+     * @memberOf Datasource
+     * @param {string} datasetName - 数据集名称
+     * @returns {Promise.<boolean>}
+     */
+    async containDataset(datasetName){
+        try{
+            var {contain} = await D.containDataset(this._SMDatasourceId,datasetName);
+            return contain;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于删除指定名称的数据集。
+     * @memberOf Datasource
+     * @param {string} datasetName - 数据集名称
+     * @returns {Promise.<boolean>}
+     */
+    async deleteDataset(datasetName){
+        try{
+            var {deleted} = await D.deleteDataset(this._SMDatasourceId,datasetName);
+            return deleted;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回数据集集合中数据集的个数。
+     * @memberOf Datasource
+     * @returns {Promise.<number>}
+     */
+    async getDatasetCount(){
+        try{
+            var {count} = await D.getDatasetCount(this._SMDatasourceId);
+            return count;
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/DatasourceConnectionInfo.html b/API Doc/DatasourceConnectionInfo.html new file mode 100644 index 00000000..b0eeba4f --- /dev/null +++ b/API Doc/DatasourceConnectionInfo.html @@ -0,0 +1,713 @@ + + + + + JSDoc: Class: DatasourceConnectionInfo + + + + + + + + + + +
+ +

Class: DatasourceConnectionInfo

+ + + + + + +
+ +
+ +

DatasourceConnectionInfo

+ + +
+ +
+
+ + + + + +

new DatasourceConnectionInfo()

+ + + + + +
+ 数据源连接信息类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<DatasourceConnectionInfo>}

+ + + + + +
+ 创建一个DatasourceConnectionInfo实例 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<DatasourceConnectionInfo> + + +
+
+ + + + + + + + + + +

(static) setAlias(alias) → {Promise.<void>}

+ + + + + +
+ 设置数据源别名 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
alias + + +string + + + + 别名
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setEngineType(engineType) → {Promise.<void>}

+ + + + + +
+ 对不同类型的空间数据源,需要不同的空间数据库引擎来存储和管理,对文件型数据源,即 UDB 数据源,需要 SDX+ for UDB,引擎类型为 UDB。目前版本支持的引擎类型包括 UDB 引擎(UDB),影像只读引擎(IMAGEPLUGINS)。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
engineType + + +string + + + + 数据源连接的引擎类型。BaiDu,BingMaps,GoogleMaps,OGC,OpenGLCache,OpenStreetMaps,Rest,SuperMapCloud,UDB
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setServer(url) → {Promise.<void>}

+ + + + + +
+ 对于 UDB 文件,为其文件的名称,其中包括路径名称和文件的后缀名。特别地,此处的路径为绝对路径。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + 数据库服务器名或文件名。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/DatasourceConnectionInfo.js.html b/API Doc/DatasourceConnectionInfo.js.html new file mode 100644 index 00000000..74909b07 --- /dev/null +++ b/API Doc/DatasourceConnectionInfo.js.html @@ -0,0 +1,125 @@ + + + + + JSDoc: Source: DatasourceConnectionInfo.js + + + + + + + + + + +
+ +

Source: DatasourceConnectionInfo.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let DCI = NativeModules.JSDatasourceConnectionInfo;
+
+/**
+ * @class DatasourceConnectionInfo
+ * @description 数据源连接信息类。
+ */
+export default class DatasourceConnectionInfo{
+    /**
+     * 创建一个DatasourceConnectionInfo实例
+     * @memberOf DatasourceConnectionInfo
+     * @returns {Promise.<DatasourceConnectionInfo>}
+     */
+    async createObj(){
+        try{
+            var {datasourceConnectionInfoId} = await DCI.createObj();
+            var datasourceConnectionInfo = new DatasourceConnectionInfo();
+            datasourceConnectionInfo._SMDatasourceConnectionInfoId=datasourceConnectionInfoId;
+            return datasourceConnectionInfo;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置数据库服务器名或文件名。
+     * @description 对于 UDB 文件,为其文件的名称,其中包括路径名称和文件的后缀名。特别地,此处的路径为绝对路径。
+     * @memberOf DatasourceConnectionInfo
+     * @param {string} url - 数据库服务器名或文件名。
+     * @returns {Promise.<void>}
+     */
+    async setServer(url){
+        try{
+            await DCI.setServer(this._SMDatasourceConnectionInfoId,url);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回数据源连接的引擎类型。
+     * @description 对不同类型的空间数据源,需要不同的空间数据库引擎来存储和管理,对文件型数据源,即 UDB 数据源,需要 SDX+ for UDB,引擎类型为 UDB。目前版本支持的引擎类型包括 UDB 引擎(UDB),影像只读引擎(IMAGEPLUGINS)。
+     * @memberOf DatasourceConnectionInfo
+     * @param {string} engineType - 数据源连接的引擎类型。BaiDu,BingMaps,GoogleMaps,OGC,OpenGLCache,OpenStreetMaps,Rest,SuperMapCloud,UDB
+     * @returns {Promise.<void>}
+     */
+    async setEngineType(engineType){
+        try{
+            await DCI.setEngineType(this._SMDatasourceConnectionInfoId,engineType);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置数据源别名
+     * @memberOf DatasourceConnectionInfo
+     * @param {string} alias - 别名
+     * @returns {Promise.<void>}
+     */
+    async setAlias(alias){
+        try{
+            await DCI.setAlias(this._SMDatasourceConnectionInfoId,alias);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Feature.html b/API Doc/Feature.html new file mode 100644 index 00000000..a7f36573 --- /dev/null +++ b/API Doc/Feature.html @@ -0,0 +1,761 @@ + + + + + JSDoc: Class: Feature + + + + + + + + + + +
+ +

Class: Feature

+ + + + + + +
+ +
+ +

Feature

+ + +
+ +
+
+ + + + + +

new Feature()

+ + + + + +
+ 几何对象类,包含几何对象与属性信息。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(fieldNames, fieldValues, geometry) → {Promise.<Feature>}

+ + + + + +
+ Feature对象构造函数。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fieldNames + + +array + + + + 指定的属性名数组。
fieldValues + + +array + + + + 指定的属性值数组。
geometry + + +object + + + + 指定的几何对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Feature> + + +
+
+ + + + + + + + + + +

(static) getFieldNames() → {Promise.<Array>}

+ + + + + +
+ 获取属性名数组。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Array> + + +
+
+ + + + + + + + + + +

(static) getFieldValues() → {Promise.<array>}

+ + + + + +
+ 获取属性值数组。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<array> + + +
+
+ + + + + + + + + + +

(static) getGeometry() → {Promise.<Geometry>}

+ + + + + +
+ 获取几何对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Geometry> + + +
+
+ + + + + + + + + + +

(static) toJson() → {Promise.<object>}

+ + + + + +
+ 将类对象转换成Json串。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<object> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Feature.js.html b/API Doc/Feature.js.html new file mode 100644 index 00000000..7b460733 --- /dev/null +++ b/API Doc/Feature.js.html @@ -0,0 +1,144 @@ + + + + + JSDoc: Source: Feature.js + + + + + + + + + + +
+ +

Source: Feature.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let F = NativeModules.JSFeature;
+import Geometry from './Geometry.js';
+
+/**
+ * @class Feature
+ * @description 几何对象类,包含几何对象与属性信息。
+ */
+export default class Feature {
+    /**
+     * Feature对象构造函数。
+     * @memberOf Feature
+     * @param {array} fieldNames - 指定的属性名数组。
+     * @param {array} fieldValues - 指定的属性值数组。
+     * @param {object} geometry - 指定的几何对象。
+     * @returns {Promise.<Feature>}
+     */
+    async createObj(fieldNames,fieldValues,geometry){
+        try{
+            var {_featureId_} = await F.createObj(fieldNames,fieldValues,geometry._SMGeometryId);
+            var feature = new Feature();
+            feature._SMFeatureId = _featureId_;
+            return feature;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取属性名数组。
+     * @memberOf Feature
+     * @returns {Promise.<Array>}
+     */
+    async getFieldNames(){
+        try{
+            var arr = F.getFieldNames(this._SMFeatureId);
+            return arr;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取属性值数组。
+     * @memberOf Feature
+     * @returns {Promise.<array>}
+     */
+    async getFieldValues(){
+        try{
+            var arr = F.getFieldValues(this._SMFeatureId);
+            return arr;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取几何对象。
+     * @memberOf Feature
+     * @returns {Promise.<Geometry>}
+     */
+    async getGeometry(){
+        try{
+            var {geometryId} = await F.getGeometry(this._SMFeatureId);
+            var geometry = new Geometry();
+            geometry._SMGeometryId = geometryId;
+            return geometry;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将类对象转换成Json串。
+     * @memberOf Feature
+     * @returns {Promise.<object>}
+     */
+    async toJson(){
+        try{
+            var jsonString = await F.toJson(this._SMFeatureId);
+            var jsonObj = JSON.parse(jsonString);
+            return jsonObj;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/FeatureSet.html b/API Doc/FeatureSet.html new file mode 100644 index 00000000..080417f8 --- /dev/null +++ b/API Doc/FeatureSet.html @@ -0,0 +1,1215 @@ + + + + + JSDoc: Class: FeatureSet + + + + + + + + + + +
+ +

Class: FeatureSet

+ + + + + + +
+ +
+ +

FeatureSet

+ + +
+ +
+
+ + + + + +

new FeatureSet()

+ + + + + +
+ 要素资源集合类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) delete() → {Promise.<void>}

+ + + + + +
+ 用于删除当前要素,成功则返回 true。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) deleteAll() → {Promise.<void>}

+ + + + + +
+ 物理性删除指定要素集中的所有要素,即把要素从设备的物理存储介质上删除,无法恢复。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getFeatureCount() → {Promise.<number>}

+ + + + + +
+ 返回要素集合中要素的个数。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) getFieldValue(fieldName) → {Promise.<string>}

+ + + + + +
+ 根据字段名指定字段,返回当前要素该字段的值。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fieldName + + +string + + + + 字段名。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + +

(static) getGeometry() → {Promise.<Geometry>}

+ + + + + +
+ 获取当前要素中的几何对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Geometry> + + +
+
+ + + + + + + + + + +

(static) isReadOnly() → {Promise.<void>}

+ + + + + +
+ 返回要素集是否是只读的,如果是只读的,则返回 true,表示要素集中的信息将不可被修改。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) moveFirst() → {Promise.<void>}

+ + + + + +
+ 用于移动当前要素位置到第一个要素,使第一个要素成为当前要素。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) moveLast() → {Promise.<void>}

+ + + + + +
+ 用于移动当前要素位置到最后一个要素,使最后一个要素成为当前要素。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) moveNext() → {Promise.<void>}

+ + + + + +
+ 移动当前要素位置到下一个要素,使该要素成为当前要素。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) movePrev() → {Promise.<void>}

+ + + + + +
+ 移动当前要素位置到上一个要素,使该要素成为当前要素。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/FeatureSet.js.html b/API Doc/FeatureSet.js.html new file mode 100644 index 00000000..c4cda013 --- /dev/null +++ b/API Doc/FeatureSet.js.html @@ -0,0 +1,203 @@ + + + + + JSDoc: Source: FeatureSet.js + + + + + + + + + + +
+ +

Source: FeatureSet.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let FS = NativeModules.JSFeatureSet;
+import Geometry from './Geometry.js';
+
+/**
+ * @class FeatureSet
+ * @description 要素资源集合类。
+ */
+export default class FeatureSet {
+    /**
+     * 删除要素
+     * @description 物理性删除指定要素集中的所有要素,即把要素从设备的物理存储介质上删除,无法恢复。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async deleteAll(){
+        try{
+            await FS.deleteAll(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于删除当前要素,成功则返回 true。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async delete(){
+        try{
+            await FS.delete(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回要素集合中要素的个数。
+     * @memberOf FeatureSet
+     * @returns {Promise<number>}
+     */
+    async getFeatureCount(){
+        try{
+            var count = await FS.getFeatureCount(this._SMFeatureSetId);
+            return count;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据字段名指定字段,返回当前要素该字段的值。
+     * @memberOf FeatureSet
+     * @param {string} fieldName - 字段名。
+     * @returns {Promise<string>}
+     */
+    async getFieldValue(fieldName){
+        try{
+            var value = await FS.getFieldValue(this._SMFeatureSetId,fieldName);
+            return value;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取当前要素中的几何对象。
+     * @memberOf FeatureSet
+     * @returns {Promise.<Geometry>}
+     */
+    async getGeometry(){
+        try{
+            var {geometryId} = await FS.getGeometry(this._SMFeatureSetId);
+            var geometry = new Geometry();
+            geometry._SMGeometryId = geometryId;
+            return geometry;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回要素集是否是只读的,如果是只读的,则返回 true,表示要素集中的信息将不可被修改。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async isReadOnly(){
+        try{
+            await FS.isReadOnly(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于移动当前要素位置到第一个要素,使第一个要素成为当前要素。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async moveFirst(){
+        try{
+            await FS.moveFirst(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于移动当前要素位置到最后一个要素,使最后一个要素成为当前要素。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async moveLast(){
+        try{
+            await FS.moveLast(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移动当前要素位置到下一个要素,使该要素成为当前要素。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async moveNext(){
+        try{
+            await FS.moveNext(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移动当前要素位置到上一个要素,使该要素成为当前要素。
+     * @memberOf FeatureSet
+     * @returns {Promise.<void>}
+     */
+    async movePrev(){
+        try{
+            await FS.movePrev(this._SMFeatureSetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/GeoLine.html b/API Doc/GeoLine.html new file mode 100644 index 00000000..89d8dfed --- /dev/null +++ b/API Doc/GeoLine.html @@ -0,0 +1,315 @@ + + + + + JSDoc: Class: GeoLine + + + + + + + + + + +
+ +

Class: GeoLine

+ + + + + + +
+ +
+ +

GeoLine

+ + +
+ +
+
+ + + + + +

new GeoLine()

+ + + + + +
+ 线几何对象类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(points) → {Promise.<GeoLine>}

+ + + + + +
+ GeoLine 对象构造方法 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
points + + +Array + + + + 点信息数组,eg: [ {x:1.1,y:1.2} , {x:2.3,y:3.4} ]
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<GeoLine> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/GeoLine.js.html b/API Doc/GeoLine.js.html new file mode 100644 index 00000000..d565f3b6 --- /dev/null +++ b/API Doc/GeoLine.js.html @@ -0,0 +1,100 @@ + + + + + JSDoc: Source: GeoLine.js + + + + + + + + + + +
+ +

Source: GeoLine.js

+ + + + + + +
+
+
/*********************************************************************************
+ 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);
+        }
+    }
+
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/GeoPoint.html b/API Doc/GeoPoint.html new file mode 100644 index 00000000..1c5c48cc --- /dev/null +++ b/API Doc/GeoPoint.html @@ -0,0 +1,538 @@ + + + + + JSDoc: Class: GeoPoint + + + + + + + + + + +
+ +

Class: GeoPoint

+ + + + + + +
+ +
+ +

GeoPoint

+ + +
+ +
+
+ + + + + +

new GeoPoint()

+ + + + + +
+ 点几何对象类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(x, y) → {Promise.<GeoPoint>}

+ + + + + +
+ 构造一个新的 GeoPoint 对象,x,y参数为可选参数,无参数时此几何点对象的坐标 X,Y 分别为-1.7976931348623157e+308。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + 指定点几何对象的 X 坐标值。
y + + +number + + + + 指定点几何对象的 y 坐标值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<GeoPoint> + + +
+
+ + + + + + + + + + +

(static) getX() → {Promise.<Promise.number>}

+ + + + + +
+ 返回此点几何对象的 X 坐标。使用无参构造函数构造的点对象的 X 坐标值为默认值。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.number> + + +
+
+ + + + + + + + + + +

(static) getY() → {Promise.<Promise.number>}

+ + + + + +
+ 返回此点几何对象的 Y 坐标。使用无参构造函数构造的点对象的 Y 坐标值为默认值。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.number> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/GeoPoint.js.html b/API Doc/GeoPoint.js.html new file mode 100644 index 00000000..f5556ea2 --- /dev/null +++ b/API Doc/GeoPoint.js.html @@ -0,0 +1,131 @@ + + + + + JSDoc: Source: GeoPoint.js + + + + + + + + + + +
+ +

Source: GeoPoint.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let P = NativeModules.JSGeoPoint;
+import Geometry from './Geometry.js';
+
+/**
+ * @class GeoPoint
+ * @description 点几何对象类。
+ */
+export default class GeoPoint extends Geometry{
+    constructor(){
+        super();
+        Object.defineProperty(this,"_SMGeoPointId",{
+            get:function () {
+                return this._SMGeometryId
+            },
+            set:function (_SMGeoPointId) {
+                this._SMGeometryId = _SMGeoPointId;
+            }
+        })
+    }
+
+    /**
+     * 构造一个新的 GeoPoint 对象,x,y参数为可选参数,无参数时此几何点对象的坐标 X,Y 分别为-1.7976931348623157e+308。
+     * @memberOf GeoPoint
+     * @param {number} x - 指定点几何对象的 X 坐标值。
+     * @param {number} y - 指定点几何对象的 y 坐标值。
+     * @returns {Promise.<GeoPoint>}
+     */
+    async createObj(){
+        try{
+            if(typeof arguments[0] == 'number' && typeof arguments[1] == 'number'){
+                var {geoPointId} = await P.createObjByXY(arguments[0],arguments[1]);
+                var geoPoint = new GeoPoint();
+                geoPoint._SMGeoPointId = geoPointId;
+                return geoPoint;
+            }else{
+                var {geoPointId} = await P.createObj();
+                var geoPoint = new GeoPoint(geoPointId);
+                geoPoint._SMGeoPointId = geoPointId;
+                return geoPoint;
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此点几何对象的 X 坐标。使用无参构造函数构造的点对象的 X 坐标值为默认值。
+     * @memberOf GeoPoint
+     * @returns {Promise.<Promise.number>}
+     */
+    async getX(){
+        try {
+            var {coordsX} = await P.getX(this._SMGeoPointId);
+            return coordsX;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此点几何对象的 Y 坐标。使用无参构造函数构造的点对象的 Y 坐标值为默认值。
+     * @memberOf GeoPoint
+     * @returns {Promise.<Promise.number>}
+     */
+    async getY(){
+        try {
+            var {coordsY} = await P.getY(this._SMGeoPointId);
+            return coordsY;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/GeoRegion.html b/API Doc/GeoRegion.html new file mode 100644 index 00000000..3cc62e46 --- /dev/null +++ b/API Doc/GeoRegion.html @@ -0,0 +1,162 @@ + + + + + JSDoc: Class: GeoRegion + + + + + + + + + + +
+ +

Class: GeoRegion

+ + + + + + +
+ +
+ +

GeoRegion

+ + +
+ +
+
+ + + + + +

new GeoRegion()

+ + + + + +
+ 面几何对象类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/GeoRegion.js.html b/API Doc/GeoRegion.js.html new file mode 100644 index 00000000..268b2101 --- /dev/null +++ b/API Doc/GeoRegion.js.html @@ -0,0 +1,72 @@ + + + + + JSDoc: Source: GeoRegion.js + + + + + + + + + + +
+ +

Source: GeoRegion.js

+ + + + + + +
+
+
import {NativeModules} from 'react-native';
+let X = NativeModules.JSGeoRegion;
+import Geometry from './Geometry.js';
+
+/**
+ * @class GeoRegion
+ * @description 面几何对象类。
+ */
+export default class GeoRegion extends Geometry{
+    constructor(){
+        super();
+        Object.defineProperty(this,"_SMGeoRegionId",{
+            get:function () {
+                return this._SMGeometryId
+            },
+            set:function (_SMGeoRegionId) {
+                this._SMGeometryId = _SMGeoRegionId;
+            }
+        });
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/GeoStyle.html b/API Doc/GeoStyle.html new file mode 100644 index 00000000..3e19be56 --- /dev/null +++ b/API Doc/GeoStyle.html @@ -0,0 +1,1403 @@ + + + + + JSDoc: Class: GeoStyle + + + + + + + + + + +
+ +

Class: GeoStyle

+ + + + + + +
+ +
+ +

GeoStyle

+ + +
+ +
+
+ + + + + +

new GeoStyle()

+ + + + + +
+ 几何风格类。用于定义点状符号、线状符号、填充符号及其相关设置。对于文本对象只能设置文本风格,不能设置几何风格。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<GeoStyle>}

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

(static) setFillForeColor(r, g, b) → {Promise.<void>}

+ + + + + +
+ 设置填充符号的前景色。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
r + + +number + + + + rgb颜色的red值
g + + +number + + + + rgb颜色的green值
b + + +number + + + + rgb颜色的blue值
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setFillOpaqueRate(rate) → {Promise.<void>}

+ + + + + +
+ 设置填充不透明度,合法值0-100的数值。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rate + + +number + + + + 透明度比例
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setLineColor(r, g, b) → {Promise.<void>}

+ + + + + +
+ 设置线状符号型风格或点状符号的颜色。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
r + + +number + + + + rgb颜色的red值
g + + +number + + + + rgb颜色的green值
b + + +number + + + + rgb颜色的blue值
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setLineSymbolID(symbolId) → {Promise.<void>}

+ + + + + +
+ 返回线状符号的编码。此编码用于唯一标识各线状符号。 + 线状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
symbolId + + +number + + + + 一个用来设置线型符号的编码的整数值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setLineWidth(lineWidth) → {Promise.<void>}

+ + + + + +
+ 设置线状符号的宽度。单位为毫米,精度到0.1。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
lineWidth + + +number + + + + 用来设置线状符号的宽度。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMarkerSize(size2D) → {Promise.<void>}

+ + + + + +
+ 设置点状符号的大小,单位为毫米,精确到0.1毫米。其值必须大于等于0。如果为0,则表示不显示,如果是小于0,会抛出异常。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
size2D + + +number + + + + 用来设置点状符号的大小的值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMarkerSymbolID(markerSymbolId) → {Promise.<void>}

+ + + + + +
+ 返回点状符号的编码。此编码用于唯一标识各点状符号。 + 点状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
markerSymbolId + + +number + + + + 点状符号的编码。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/GeoStyle.js.html b/API Doc/GeoStyle.js.html new file mode 100644 index 00000000..47e60e6c --- /dev/null +++ b/API Doc/GeoStyle.js.html @@ -0,0 +1,183 @@ + + + + + JSDoc: Source: GeoStyle.js + + + + + + + + + + +
+ +

Source: GeoStyle.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ ref:Size2d
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let G = NativeModules.JSGeoStyle;
+
+/**
+ * @class GeoStyle
+ * @description 几何风格类。用于定义点状符号、线状符号、填充符号及其相关设置。对于文本对象只能设置文本风格,不能设置几何风格。
+ */
+export default class GeoStyle {
+    /**
+     * 构造一个新的 GeoStyle 对象。
+     * @memberOf GeoStyle
+     * @returns {Promise.<GeoStyle>}
+     */
+    async createObj(){
+        var {geoStyleId} =await G.createObj();
+        var geoStyle = new GeoStyle();
+        geoStyle._SMGeoStyleId = geoStyleId;
+        return geoStyle;
+    }catch(e){
+        console.log(e);
+    }
+
+    /**
+     * 设置线状符号型风格或点状符号的颜色。
+     * @memberOf GeoStyle
+     * @param {number} r - rgb颜色的red值
+     * @param {number} g - rgb颜色的green值
+     * @param {number} b - rgb颜色的blue值
+     * @returns {Promise.<void>}
+     */
+    async setLineColor(r,g,b){
+        try{
+            await G.setLineColor(this._SMGeoStyleId,r,g,b);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回线状符号的编码。此编码用于唯一标识各线状符号。
+     线状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。
+     * @memberOf GeoStyle
+     * @param {number} symbolId  - 一个用来设置线型符号的编码的整数值。
+     * @returns {Promise.<void>}
+     */
+    async setLineSymbolID(symbolId){
+        try{
+            await G.setLineSymbolID(this._SMGeoStyleId,symbolId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置线状符号的宽度。单位为毫米,精度到0.1。
+     * @memberOf GeoStyle
+     * @param {number} lineWidth - 用来设置线状符号的宽度。
+     * @returns {Promise.<void>}
+     */
+    async setLineWidth(lineWidth){
+        try{
+            await G.setLineWidth(this._SMGeoStyleId,lineWidth);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回点状符号的编码。此编码用于唯一标识各点状符号。
+     点状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。
+     * @memberOf GeoStyle
+     * @param {number} markerSymbolId - 点状符号的编码。
+     * @returns {Promise.<void>}
+     */
+    async setMarkerSymbolID(markerSymbolId){
+        try{
+            await G.setMarkerSymbolID(this._SMGeoStyleId,markerSymbolId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置点状符号的大小,单位为毫米,精确到0.1毫米。其值必须大于等于0。如果为0,则表示不显示,如果是小于0,会抛出异常。
+     * @memberOf GeoStyle
+     * @param {number} size2D - 用来设置点状符号的大小的值。
+     * @returns {Promise.<void>}
+     */
+    async setMarkerSize(size2D){
+        try{
+            await G.setMarkerSize(this._SMGeoStyleId,size2D._SMSize2DId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *设置填充符号的前景色。
+     * @memberOf GeoStyle
+     * @param {number} r - rgb颜色的red值
+     * @param {number} g - rgb颜色的green值
+     * @param {number} b - rgb颜色的blue值
+     * @returns {Promise.<void>}
+     */
+    async setFillForeColor(r,g,b){
+        try{
+            await G.setFillForeColor(this._SMGeoStyleId,r,g,b);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置填充不透明度,合法值0-100的数值。
+     * @memberOf GeoStyle
+     * @param {number} rate - 透明度比例
+     * @returns {Promise.<void>}
+     */
+    async setFillOpaqueRate(rate){
+        try{
+            await G.setFillOpaqueRate(this._SMGeoStyleId,rate)
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Geometry.html b/API Doc/Geometry.html new file mode 100644 index 00000000..8264fcf9 --- /dev/null +++ b/API Doc/Geometry.html @@ -0,0 +1,417 @@ + + + + + JSDoc: Class: Geometry + + + + + + + + + + +
+ +

Class: Geometry

+ + + + + + +
+ +
+ +

Geometry

+ + +
+ +
+
+ + + + + +

new Geometry()

+ + + + + +
+ 所有具体几何类型(GeoPoint, GeoLine, GeoRegion 等)的基类,提供了基本的几何类型的方法。 + 该类用于表示地理实体的空间特征,并提供相关的处理方法。根据地理实体的空间特征不同,分别用点(GeoPoint),线(GeoLine),面(GeoRegion)等加以描述。当该类的子类的对象实例被 dispose 后,再调用该类的方法会抛出 ObjectDisposedException。 + 用户自己创建的 Geometry 对象,例如 GeoPoint、GeoLine、GeoRegion 等对象,在执行完系列操作后,需要对其进行释放。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) getInnerPoint() → {Promise.<Point2D>}

+ + + + + +
+ 返回几何对象的内点。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point2D> + + +
+
+ + + + + + + + + + +

(static) setStyle(geoStyle) → {Promise.<void>}

+ + + + + +
+ 设置几何对象的风格。几何风格是用于定义几何对象在显示时的符号、线型、填充模式等信息。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geoStyle + + +object + + + + 用来设置几何对象风格的 GeoStyle 对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Geometry.js.html b/API Doc/Geometry.js.html new file mode 100644 index 00000000..46d8e4f0 --- /dev/null +++ b/API Doc/Geometry.js.html @@ -0,0 +1,93 @@ + + + + + JSDoc: Source: Geometry.js + + + + + + + + + + +
+ +

Source: Geometry.js

+ + + + + + +
+
+
import {NativeModules} from 'react-native';
+let G = NativeModules.JSGeometry;
+import Point2D from './Point2D.js';
+
+/**
+ * @class Geometry
+ * @description 所有具体几何类型(GeoPoint, GeoLine, GeoRegion 等)的基类,提供了基本的几何类型的方法。
+ 该类用于表示地理实体的空间特征,并提供相关的处理方法。根据地理实体的空间特征不同,分别用点(GeoPoint),线(GeoLine),面(GeoRegion)等加以描述。当该类的子类的对象实例被 dispose 后,再调用该类的方法会抛出 ObjectDisposedException。
+ 用户自己创建的 Geometry 对象,例如 GeoPoint、GeoLine、GeoRegion 等对象,在执行完系列操作后,需要对其进行释放。
+ */
+export default class Geometry {
+    /**
+     * 返回几何对象的内点。
+     * @memberOf Geometry
+     * @returns {Promise.<Point2D>}
+     */
+    async getInnerPoint(){
+        try{
+            var {point2DId} = await G.getInnerPoint(this._SMGeometryId);
+            var point2D = new Point2D();
+            point2D._SMPoint2DId = point2DId;
+            return point2D;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置几何对象的风格。几何风格是用于定义几何对象在显示时的符号、线型、填充模式等信息。
+     * @memberOf Geometry
+     * @param {object} geoStyle - 用来设置几何对象风格的 GeoStyle 对象。
+     * @returns {Promise.<void>}
+     */
+    async setStyle(geoStyle){
+        try{
+            var id = this._SMGeometryId || this._SMGeoPointId;
+            await G.setStyle(id,geoStyle._SMGeoStyleId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/IndustryNavi.js.html b/API Doc/IndustryNavi.js.html new file mode 100644 index 00000000..ceb457f6 --- /dev/null +++ b/API Doc/IndustryNavi.js.html @@ -0,0 +1,510 @@ + + + + + JSDoc: Source: IndustryNavi.js + + + + + + + + + + +
+ +

Source: IndustryNavi.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules,DeviceEventEmitter} from 'react-native';
+let N = NativeModules.JSNavigation2;
+import Dataset from './Dataset.js';
+import GeoLine from './GeoLine';
+
+/**
+ * @class Navigation2 
+ * @description 行业导航类,提供基于拓扑路网的路径分析与导引。
+ */
+export default class Navigation2{
+    /**
+     * 设置路径可见
+     * @memberOf Navigation2
+     * @param {boolean} visible - 设置分析路径是否可见。
+     * @returns {Promise.<void>}
+     */
+    async setPathVisible(visible){
+        try{
+            await N.setPathVisible(this._SMNavigation2Id,visible);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置用于分析的网络数据集。必选。
+     * @memberOf Navigation2
+     * @param {object} datasetVector - 网络数据集。
+     * @returns {Promise.<void>}
+     */
+    async setNetworkDataset(datasetVector){
+            try{
+                await N.setNetworkDataset(this._SMNavigation2Id,datasetVector._SMDatasetVectorId);
+            }catch (e){
+                console.error(e);
+            }
+    }
+
+    /**
+     * 加载内存文件。
+     * @memberOf Navigation2
+     * @param {string} path - 内存文件路径。
+     * @returns {Promise.<void>}
+     */
+    async loadModel(path){
+        try{
+            await N.loadModel(this._SMNavigation2Id,path);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置导航起点
+     * @memberOf Navigation2
+     * @param x - 起点横坐标
+     * @param y - 起点纵坐标
+     * @param map - 导航所属地图对象
+     * @returns {Promise.<void>}
+     */
+    async setStartPoint(x,y,map){
+        try{
+            await N.setStartPoint(this._SMNavigation2Id,x,y,map._SMMapId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置导航终点
+     * @memberOf Navigation2
+     * @param x - 终点横坐标
+     * @param y - 终点纵坐标
+     * @param map - 导航所属地图对象
+     * @returns {Promise.<void>}
+     */
+    async setDestinationPoint(x,y,map){
+        try{
+            await N.setDestinationPoint(this._SMNavigation2Id,x,y,map._SMMapId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 路径分析
+     * @memberOf Navigation2
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async routeAnalyst(){
+        try{
+            var {finished} = await N.routeAnalyst(this._SMNavigation2Id);
+            return finished;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 开始导航
+     * @memberOf Navigation2
+     * @param guideMode - 导航模式:1:真实导航;2:模拟导航
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async startGuide(guideMode){
+        try{
+            var {isGuiding} = await N.startGuide(this._SMNavigation2Id,guideMode);
+            return isGuiding;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+
+    /**
+     * 设置转向表数据集。可选。
+     * @memberOf Navigation2
+     * @param {DatasetVector} value - 转向表数据集。
+     * @returns {Promise.<void>}
+     */
+    async setTurnDataset(value){
+        try{
+            await N.setTurnDataset(this._SMNavigation2Id,value._SMDatasetVectorId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置高程点数据集。可选。
+     * @memberOf Navigation2
+     * @param {DatasetVector} value - 转向表数据集。
+     * @returns {Promise.<void>}
+     */
+    async setAltimetricPointDataset(value){
+        try{
+            await N.setAltimetricPointDataset(this._SMNavigation2Id,value._SMDatasetVectorId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取路径分析线路。
+     * @memberOf Navigation2
+     * @returns {Promise.<void>}
+     */
+    async getRoute(){
+        try{
+            var {geoLineId} = await N.getRoute(this._SMNavigation2Id);
+            var geoLine = new GeoLine();
+            geoLine._SMGeoLineId = geoLineId;
+            return geoLine;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 清除路径分析结果。
+     * @memberOf Navigation2
+     * @returns {Promise.<GeoLine>}
+     */
+    async cleanPath(){
+        try{
+            await N.cleanPath(this._SMNavigation2Id);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 暂停导航
+     * @memberOf Navigation2
+     * @returns {Promise.<void>}
+     */
+    async pauseGuide(){
+        try{
+            await N.pauseGuide(this._SMNavigation2Id);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 继续导航
+     * @memberOf Navigation2
+     * @returns {Promise.<void>}
+     */
+    async resumeGuide(){
+        try{
+            await N.resumeGuide(this._SMNavigation2Id);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 停止引导。
+     * @memberOf Navigation2
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async stopGuide(){
+        try{
+            var {stoped} = await N.stopGuide(this._SMNavigation2Id);
+            return stoped
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 判断是否正在进行引导。
+     * @memberOf Navigation2
+     * @returns {Promise.<Promise.yes>}
+     */
+    async isGuiding(){
+        try{
+            var {yes} = await N.isGuiding(this._SMNavigation2Id);
+            return yes
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 引导过程中是否允许平移地图。
+     * @memberOf Navigation2
+     * @param {boolean} pan
+     * @returns {Promise.<void>}
+     */
+    async enablePanOnGuide(pan){
+        try{
+            await N.enablePanOnGuide(this._SMNavigation2Id,pan);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 导航中,小车在屏幕中居中显示
+     * @memberOf Navigation2
+     * @returns {Promise.<void>}
+     */
+    async locateMap(){
+        try{
+            await N.locateMap(this._SMNavigation2Id);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置是否自动采集GPS,设置为false时,需用户自己调用setGPSData传入GPS数据。
+     * @memberOf Navigation2
+     * @param {boolean} isAutoNavi - 是否自动采集GPS,默认自动采集。
+     * @returns {Promise.<void>}
+     */
+    async setIsAutoNavi(isAutoNavi){
+        try{
+            await N.setIsAutoNavi(this._SMNavigation2Id,isAutoNavi);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置GPS数据。
+     * @memberOf Navigation2
+     * @param {object} newGps - GPS数据。
+     * @returns {Promise.<void>}
+     */
+    async setGPSData(newGps){
+        try{
+            await N.setGPSData(this._SMNavigation2Id,newGps);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置最高限速字段
+     * @memberOf Navigation2
+     * @param {string} value - 速度字段名称
+     * @returns {Promise.<void>}
+     */
+    async setSpeedField(value){
+        try{
+            await N.setSpeedField(this._SMNavigation2Id,value);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取障碍点集合
+     * @memberOf Navigation2
+     * @returns {Promise.<array>}
+     */
+    async getBarrierPoints(){
+        try{
+            var {barrierPoints} = await N.getBarrierPoints(this._SMNavigation2Id);
+            return barrierPoints;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置障碍点
+     * @memberOf Navigation2
+     * @param {array} barrierPoints - 障碍点集合(参数为null时,为清空障碍点)
+     * @returns {Promise.<void>}
+     */
+    async setBarrierPoints(barrierPoints){
+        try{
+            await N.setBarrierPoints(this._SMNavigation2Id,barrierPoints);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置障碍节点
+     * @memberOf Navigation2
+     * @param {array} value 障碍节点集合(其包含的值为网络数据集中的节点数据的SmID值,number类型)
+     * @returns {Promise.<void>}
+     */
+    async setBarrierNodes(value){
+        try{
+            await N.setBarrierNodes(this._SMNavigation2Id,value);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置障碍边
+     * @memberOf Navigation2
+     * @param {array} value 
+     * @description value:障碍边集合(参数为null时,为清空障碍边);其包含的int值为网络数据集中的线数据的SmID值
+     * @returns {Promise.<void>}
+     */
+    async setBarrierEdges(value){
+        try{
+            await N.setBarrierEdges(this._SMNavigation2Id,value);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取障碍边集合
+     * @memberOf Navigation2
+     * @returns {Promise.<void>}
+     */
+    async getBarrierEdges(){
+        try{
+            var {barrierEdges} = await N.getBarrierEdges(this._SMNavigation2Id);
+            return barrierEdges;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置离终点的距离变化监听器。
+     * @memberOf Navigation2
+     * @param events - 离终点的距离变化监听器回调函数对象。
+     * @description 用法:await industryNavi.setDistanceChangeListener({distanceChange:(e) => {console.log(e.distance}})
+     * @returns {Promise}
+     */
+    async setDistanceChangeListener(events){
+        try{
+            var success = await N.setDistanceChangeListener(this._SMNavigation2Id);
+            if(success){
+                typeof events.distanceChange !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.distance_change",function (e) {
+                    events.distanceChange(e);
+                });
+            }
+            return success;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /*
+     * 设置导航信息变化监听器
+     * @param callback - 导航信息变化监听器回调函数。
+     * @description 用法:await industryNavi.setDistanceChangeListener(
+     *      {
+     *          startNavi:(e) => {console.log("start")},
+     *          naviInfoUpdate:(e) => {console.log(e.curRoadName + e.direction ....)},
+     *          arrivedDestination:(e) => {console.log("updated")},
+     *          stopNavi:(e) => {console.log("stop")},
+     *          adjustFailure:(e) => {console.log("failure")},
+     *          playNaviMessage:(e) => {console.log(e.message)},
+     *
+     *      }
+     * );
+     * 其中naviInfoUpdate回调中的参数是一个NaviInfo对象,其结构为:
+     *      {
+     *           curRoadName:--,
+     *           direction:--,
+     *           iconType:--,
+     *           nextRoadName:--,
+     *           routeRemainDis:--,
+     *           routeRemainTime:--,
+     *           segRemainDis:--
+     *      }
+     * @returns {Promise}
+     */
+    async addNaviInfoListener(events){
+        try{
+            var success = await N.addNaviInfoListener(this._SMNavigation2Id);
+            if(success){
+                typeof events.startNavi !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.start_navi",function (e) {
+                    events.startNavi(e);
+                });
+
+                typeof events.naviInfoUpdate !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.navi_info_update",function (e) {
+                    events.naviInfoUpdate(e);
+                });
+
+                typeof events.arrivedDestination !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.arrived_destination",function (e) {
+                    events.arrivedDestination(e);
+                });
+
+                typeof events.stopNavi !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.stop_navi",function (e) {
+                    events.stopNavi(e);
+                });
+
+                typeof events.adjustFailure !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.adjust_failure",function (e) {
+                    events.adjustFailure(e);
+                });
+
+                typeof events.playNaviMessage !== 'function'  ||
+                DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.play_navi_massage",function (e) {
+                    events.playNaviMessage(e);
+                });
+            }
+            return success;
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Layer.html b/API Doc/Layer.html new file mode 100644 index 00000000..06632d14 --- /dev/null +++ b/API Doc/Layer.html @@ -0,0 +1,1656 @@ + + + + + JSDoc: Class: Layer + + + + + + + + + + +
+ +

Class: Layer

+ + + + + + +
+ +
+ +

Layer

+ + +
+ +
+
+ + + + + +

new Layer()

+ + + + + +
+ (该类的实例不可被创建,只可以通过在 Map 类中的 addLayer 方法来创建)该类提供了图层显示和控制等的便于地图管理的一系列方法。当数据集被加载到地图窗口中显示的时,就形成了一个图层,因此图层是数据集的可视化显示。一个图层是对一个数据集的引用或参考。通过对可视化的图层的编辑,可以对 相应的数据集的要素进行编辑。一个图层或多个图层叠加显示则形成了地图。图层分为普通图层和专题图层,矢量的普通图层中所有要素采用相同的渲染风格,栅格图层采用颜色表来显示其像元;而专题图层则采用指定类型的专题图风格来渲染其中的 要素或像元。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) getAdditionalSetting() → {Promise.<LayerSetting>}

+ + + + + +
+ 返回普通图层的风格设置。LayerSettingVector 类用来对矢量数据图层风格进行设置和修改。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<LayerSetting> + + +
+
+ + + + + + + + + + +

(static) getDataset() → {Promise.<Dataset>}

+ + + + + +
+ 返回此图层对应的数据集对象。图层是对数据集的引用,因而,一个图层与一个数据集相对应。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Dataset> + + +
+
+ + + + + + + + + + +

(static) getEditable() → {Promise.<boolean>}

+ + + + + +
+ 判断图层是否处于可编辑状态。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) getName() → {Promise.<void>}

+ + + + + +
+ 返回图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该标识不区分大小写。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getSelection() → {Promise.<Selection>}

+ + + + + +
+ 返回此图层中的选择集对象。选择集是个集合,其中包含选择的图层中的一个或多个要素。在选择集中的要素才可以被编辑。注意选择集只适用于矢量数据集,栅格数据集和影像数据集没有选择集。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Selection> + + +
+
+ + + + + + + + + + +

(static) getVisible() → {Promise.<boolean>}

+ + + + + +
+ 获取此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) isSelectable() → {Promise.<boolean>}

+ + + + + +
+ 返回图层中对象是否可以选择 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +void + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) setAdditionalSetting(layerSetting) → {Promise.<void>}

+ + + + + +
+ 设置普通图层的风格。普通图层风格的设置对矢量数据图层、栅格数据图层以及影像数据图层是不相同的。LayerSettingVector类用来对矢量数据图层的风格进行设置和修改。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
layerSetting + + +LayerSetting + + + + 普通图层的风格设置.LayerSetting
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDataset(dataset) → {Promise.<void>}

+ + + + + +
+ 设置图层关联的数据集。 设置的数据集必须与当前地图属于同一工作空间,且数据集类型与原有数据集类型一致,否则会抛出异常(该方法暂不支持iOS设备)。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
dataset + + +object + + + + 图层关联的数据集
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setEditable(editable) → {Promise.<void>}

+ + + + + +
+ 设置图层是否处于可编辑状态。该方法控制是否对图层所引用的数据进行修改。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
editable + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSelectable(b) → {Promise.<void>}

+ + + + + +
+ 设置图层中对象是否可以选择。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
b + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setVisible(b) → {Promise.<void>}

+ + + + + +
+ 设置此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
b + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Layer.js.html b/API Doc/Layer.js.html new file mode 100644 index 00000000..0beaa1e3 --- /dev/null +++ b/API Doc/Layer.js.html @@ -0,0 +1,251 @@ + + + + + JSDoc: Source: Layer.js + + + + + + + + + + +
+ +

Source: Layer.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let L = NativeModules.JSLayer;
+import Dataset from './Dataset.js';
+import Selection from './Selection.js';
+import LayerSetting from './LayerSetting.js';
+import LayerSettingVector from './LayerSettingVector.js';
+
+/**
+ * @class Layer
+ * @description (该类的实例不可被创建,只可以通过在 Map 类中的 addLayer 方法来创建)该类提供了图层显示和控制等的便于地图管理的一系列方法。当数据集被加载到地图窗口中显示的时,就形成了一个图层,因此图层是数据集的可视化显示。一个图层是对一个数据集的引用或参考。通过对可视化的图层的编辑,可以对 相应的数据集的要素进行编辑。一个图层或多个图层叠加显示则形成了地图。图层分为普通图层和专题图层,矢量的普通图层中所有要素采用相同的渲染风格,栅格图层采用颜色表来显示其像元;而专题图层则采用指定类型的专题图风格来渲染其中的 要素或像元。
+ */
+export default class Layer{
+    /**
+     * 设置图层是否处于可编辑状态。该方法控制是否对图层所引用的数据进行修改。
+     * @memberOf Layer
+     * @param {boolean} editable
+     * @returns {Promise.<void>}
+     */
+    async setEditable(editable){
+        try{
+            await L.setEditable(this._SMLayerId,editable);
+        }catch(e){
+            console.error(e);
+        }
+    }
+    /**
+     * 判断图层是否处于可编辑状态。
+     * @memberOf Layer
+     * @returns {Promise.<boolean>}
+     */
+    async getEditable(){
+        try{
+            var{isEditable} = await L.getEditable(this._SMLayerId);
+            return isEditable;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该标识不区分大小写。
+     * @memberOf Layer
+     * @returns {Promise.<void>}
+     */
+    async getName(){
+        try{
+            var {layerName} = await L.getName(this._SMLayerId);
+            return layerName;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此图层对应的数据集对象。图层是对数据集的引用,因而,一个图层与一个数据集相对应。
+     * @memberOf Layer
+     * @returns {Promise.<Dataset>}
+     */
+    async getDataset(){
+        try{
+            var {datasetId} = await L.getDataset(this._SMLayerId);
+            var dataset = new Dataset();
+            dataset._SMDatasetId = datasetId;
+            return dataset;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置图层关联的数据集。 设置的数据集必须与当前地图属于同一工作空间,且数据集类型与原有数据集类型一致,否则会抛出异常(该方法暂不支持iOS设备)。
+     * @memberOf Layer
+     * @param {object} dataset - 图层关联的数据集
+     * @returns {Promise.<void>}
+     */
+    async setDataset(dataset){
+        try{
+            await L.setDataset(this._SMLayerId,dataset._SMDatasetId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此图层中的选择集对象。选择集是个集合,其中包含选择的图层中的一个或多个要素。在选择集中的要素才可以被编辑。注意选择集只适用于矢量数据集,栅格数据集和影像数据集没有选择集。
+     * @memberOf Layer
+     * @returns {Promise.<Selection>}
+     */
+    async getSelection(){
+        try{
+            var {selectionId,recordsetId} = await L.getSelection(this._SMLayerId);
+            var selection = new Selection();
+            selection._SMSelectionId = selectionId;
+            selection._SMRecordsetId = recordsetId;
+            return selection;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置图层中对象是否可以选择。
+     * @memberOf Layer
+     * @param {boolean} b
+     * @returns {Promise.<void>}
+     */
+    async setSelectable(b){
+        try{
+            await L.setSelectable(this._SMLayerId,b);
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 返回图层中对象是否可以选择
+     * @memberOf Layer
+     * @param {void}
+     * @returns {Promise.<boolean>}
+     */
+    async isSelectable(){
+        try{
+            var{selectable} = await L.isSelectable(this._SMLayerId);
+            return selectable;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。
+     * @memberOf Layer
+     * @returns {Promise.<boolean>}
+     */
+    async getVisible(){
+        try{
+            var isVisible = await L.getVisible(this._SMLayerId);
+            return isVisible;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。
+     * @memberOf Layer
+     * @param {boolean} b
+     * @returns {Promise.<void>}
+     */
+    async setVisible(b){
+        try{
+            await L.setVisible(this._SMLayerId,b);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回普通图层的风格设置。LayerSettingVector 类用来对矢量数据图层风格进行设置和修改。
+     * @memberOf Layer
+     * @returns {Promise.<LayerSetting>}
+     */
+    async getAdditionalSetting(){
+        try{
+            var layerSetting;
+            var {_layerSettingId_,type} = await L.getAdditionalSetting(this._SMLayerId);
+            if(type===0){
+            layerSetting = new LayerSettingVector();
+            layerSetting._SMLayerSettingVectorId = _layerSettingId_;
+            }else if(type===1){
+            //image
+            }else{
+            //grid
+            }
+            return layerSetting;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置普通图层的风格。普通图层风格的设置对矢量数据图层、栅格数据图层以及影像数据图层是不相同的。LayerSettingVector类用来对矢量数据图层的风格进行设置和修改。
+     * @memberOf Layer
+     * @param {LayerSetting} layerSetting - 普通图层的风格设置.{@link LayerSetting}
+     * @returns {Promise.<void>}
+     */
+    async setAdditionalSetting(layerSetting){
+        try{
+            await L.setAdditionalSetting(this._SMLayerId,layerSetting._SMLayerSettingId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/LayerSetting.html b/API Doc/LayerSetting.html new file mode 100644 index 00000000..a1c87d36 --- /dev/null +++ b/API Doc/LayerSetting.html @@ -0,0 +1,266 @@ + + + + + JSDoc: Class: LayerSetting + + + + + + + + + + +
+ +

Class: LayerSetting

+ + + + + + +
+ +
+ +

LayerSetting

+ + +
+ +
+
+ + + + + +

new LayerSetting()

+ + + + + +
+ 图层设置基类。(虚类) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) getType() → {Promise.<(Promise|*|Dataset.Type)>}

+ + + + + +
+ 返回此图层的类型。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<(Promise|*|Dataset.Type)> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/LayerSetting.js.html b/API Doc/LayerSetting.js.html new file mode 100644 index 00000000..21f575fb --- /dev/null +++ b/API Doc/LayerSetting.js.html @@ -0,0 +1,80 @@ + + + + + JSDoc: Source: LayerSetting.js + + + + + + + + + + +
+ +

Source: LayerSetting.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let LS = NativeModules.JSLayerSetting;
+
+/**
+ * @class LayerSetting
+ * @description 图层设置基类。(虚类)
+ */
+export default class LayerSetting {
+
+    /**
+     *  返回此图层的类型。
+     *  @memberOf LayerSetting
+     * @returns {Promise.<Promise|*|Dataset.Type>}
+     */
+    async getType(){
+        try{
+            var layerSettingType = await LS.getType(this._SMLayerSettingId);
+            return layerSettingType;
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/LayerSettingVector.html b/API Doc/LayerSettingVector.html new file mode 100644 index 00000000..8434cad3 --- /dev/null +++ b/API Doc/LayerSettingVector.html @@ -0,0 +1,615 @@ + + + + + JSDoc: Class: LayerSettingVector + + + + + + + + + + +
+ +

Class: LayerSettingVector

+ + + + + + +
+ +
+ +

LayerSettingVector

+ + +
+ +
+
+ + + + + +

new LayerSettingVector()

+ + + + + +
+ 矢量图层设置类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<LayerSettingVector>}

+ + + + + +
+ 创建一个LayerSettingVector实例 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<LayerSettingVector> + + +
+
+ + + + + + + + + + +

(static) getStyle() → {Promise.<GeoStyle>}

+ + + + + +
+ 获取矢量图层的风格。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<GeoStyle> + + +
+
+ + + + + + + + + + +

(static) getType() → {Promise.<type>}

+ + + + + +
+ 获取矢量图层的风格。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<type> + + +
+
+ + + + + + + + + + +

(static) setStyle(geoStyle) → {Promise.<void>}

+ + + + + +
+ 设置矢量图层的风格。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geoStyle + + +object + + + + 矢量图层的风格。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/LayerSettingVector.js.html b/API Doc/LayerSettingVector.js.html new file mode 100644 index 00000000..b905e59d --- /dev/null +++ b/API Doc/LayerSettingVector.js.html @@ -0,0 +1,141 @@ + + + + + JSDoc: Source: LayerSettingVector.js + + + + + + + + + + +
+ +

Source: LayerSettingVector.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let LSV = NativeModules.JSLayerSettingVector;
+import GeoStyle from './GeoStyle.js';
+import LayerSetting from './LayerSetting.js';
+
+/**
+ * @class LayerSettingVector
+ * @description 矢量图层设置类。
+ */
+export default class LayerSettingVector extends LayerSetting{
+    constructor(){
+        super();
+        Object.defineProperty(this,"_SMLayerSettingVectorId",{
+                              get:function(){
+                              return this._SMLayerSettingId
+                              },
+                              set:function(_SMLayerSettingVectorId){
+                              this._SMLayerSettingId = _SMLayerSettingVectorId;
+                              }
+                              })
+    }
+    
+    /**
+     * 创建一个LayerSettingVector实例
+     * @memberOf LayerSettingVector
+     * @returns {Promise.<LayerSettingVector>}
+     */
+    async createObj(){
+        try{
+            var {_layerSettingVectorId_} = await LSV.createObj();
+            var layerSettingVector = new LayerSettingVector();
+            layerSettingVector._SMLayerSettingVectorId = _layerSettingVectorId_
+            return layerSettingVector;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取矢量图层的风格。
+     * @memberOf LayerSettingVector
+     * @returns {Promise.<GeoStyle>}
+     */
+    async getStyle(){
+        try{
+
+            var {geoStyleId} = await LSV.getStyle(this._SMLayerSettingVectorId);
+            var geoStyle = new GeoStyle();
+            geoStyle._SMGeoStyleId = geoStyleId;
+            return geoStyle;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置矢量图层的风格。
+     * @memberOf LayerSettingVector
+     * @param {object} geoStyle - 矢量图层的风格。
+     * @returns {Promise.<void>}
+     */
+    async setStyle(geoStyle){
+        try{
+            await LSV.setStyle(this._SMLayerSettingVectorId,geoStyle._SMGeoStyleId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取矢量图层的风格。
+     * @memberOf LayerSettingVector
+     * @returns {Promise.<type>}
+     */
+    async getType(){
+        try{
+            
+            var {type} = await LSV.getType(this._SMLayerSettingVectorId);
+            return type;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/LocationManager.html b/API Doc/LocationManager.html new file mode 100644 index 00000000..f076d83d --- /dev/null +++ b/API Doc/LocationManager.html @@ -0,0 +1,615 @@ + + + + + JSDoc: Class: LocationManager + + + + + + + + + + +
+ +

Class: LocationManager

+ + + + + + +
+ +
+ +

LocationManager

+ + +
+ +
+
+ + + + + +

new LocationManager()

+ + + + + +
+ 位置管理插件,目前仅支持从GPS设备中获取当前位置。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) closeGpsDevice() → {Promise.<void>}

+ + + + + +
+ 关闭GPS设备。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) createObj() → {Promise.<LocationManager>}

+ + + + + +
+ 创建一个LocationManager实例 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<LocationManager> + + +
+
+ + + + + + + + + + +

(static) getLocationInfo(_callback) → {Promise.<void>}

+ + + + + +
+ Gps对象数据(oldGps,newGps):{dAltitude:double,dBearing:double,dLatitude:double,dLongitude:double,dSpeed:double,lTime:string,nDay:number,nEasting:number,nFixMode:number,nHour:number,nMinute:number,nNorthing:number,nQualityIndicator:number,nSatellites:number,nSecond:number,nYear:number} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
_callback + + +function + + + + 位置信息变化处理函数,回调参数保存e:{"oldGps":object,"newGps":object,isGPSPointValid:boolean}
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) openGpsDevice() → {Promise.<void>}

+ + + + + +
+ 开启GPS设备。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/LocationManager.js.html b/API Doc/LocationManager.js.html new file mode 100644 index 00000000..35451d91 --- /dev/null +++ b/API Doc/LocationManager.js.html @@ -0,0 +1,131 @@ + + + + + JSDoc: Source: LocationManager.js + + + + + + + + + + +
+ +

Source: LocationManager.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules,DeviceEventEmitter} from 'react-native';
+let LM = NativeModules.JSLocationManager;
+
+/**
+ * @class LocationManager
+ * @description 位置管理插件,目前仅支持从GPS设备中获取当前位置。
+ */
+export default class LocationManager {
+    
+    /**
+     * 创建一个LocationManager实例
+     * @memberOf LocationManager
+     * @returns {Promise.<LocationManager>}
+     */
+    async createObj(){
+        try{
+            var {_locationManagePluginId_} = await LM.createObj();
+            var loactionManager = new LocationManager();
+            loactionManager._SMLocationManagerId = _locationManagePluginId_;
+            return loactionManager;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 开启GPS设备。
+     * @memberOf LocationManager
+     * @returns {Promise.<void>}
+     */
+    async openGpsDevice(){
+        try{
+            await LM.openGpsDevice(this._SMLocationManagerId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 关闭GPS设备。
+     * @memberOf LocationManager
+     * @returns {Promise.<void>}
+     */
+    async closeGpsDevice(){
+        try{
+            await LM.closeGpsDevice(this._SMLocationManagerId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 监听定位信息,获取定位数据
+     * @memberOf LocationManager
+     * @param {function}_callback - 位置信息变化处理函数,回调参数保存e:{"oldGps":object,"newGps":object,isGPSPointValid:boolean}
+     * @description Gps对象数据(oldGps,newGps):{dAltitude:double,dBearing:double,dLatitude:double,dLongitude:double,dSpeed:double,lTime:string,nDay:number,nEasting:number,nFixMode:number,nHour:number,nMinute:number,nNorthing:number,nQualityIndicator:number,nSatellites:number,nSecond:number,nYear:number}
+     * @returns {Promise.<void>}
+     */
+    async getLocationInfo(_callback){
+        try{
+            DeviceEventEmitter.addListener("com.supermap.RN.JSLocationManager.location_changed_event",function (e) {
+                if(typeof _callback == "function"){
+                    console.log("locationManager");
+                    _callback(e);
+                }else{
+                    console.error("Please set a callback in the first argument.");
+                }
+            });
+            await LM.getLocationInfo(this._SMLocationManagerId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Map.html b/API Doc/Map.html new file mode 100644 index 00000000..66f99988 --- /dev/null +++ b/API Doc/Map.html @@ -0,0 +1,4331 @@ + + + + + JSDoc: Class: Map + + + + + + + + + + +
+ +

Class: Map

+ + + + + + +
+ +
+ +

Map

+ + +
+ +
+
+ + + + + +

new Map()

+ + + + + +
+ 地图类,负责地图显示环境的管理。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) addDataset(dataset, addToHead) → {Promise.<void>}

+ + + + + +
+ 用于把一个数据集添加到此地图作为一个普通图层显示,即创建一个普通图层。(@deprecated) +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
dataset + + +object + + + +
addToHead + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) addLayer(dataset, addToHead) → {Promise.<layer>}

+ + + + + +
+ 用于把一个数据集添加到此图层集合作为一个普通图层显示,即创建一个普通图层。其风格由系统默认设置。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
dataset + + 要添加到图层的数据集。
addToHead + + 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<layer> + + +
+
+ + + + + + + + + + +

(static) addThemeLayer(dataset, theme, addToHead) → {Promise.<Layer>}

+ + + + + +
+ 用于将一个数据集添加到此图层集合作为一个专题图层显示,即创建一个专题图层,并指定专题图层的专题图对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
dataset + + 要添加到图层的数据集。
theme + + 指定此专题图层的专题图对象。
addToHead + + 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Layer> + + +
+
+ + + + + + + + + + +

(static) close() → {Promise.<void>}

+ + + + + +
+ 关闭当前地图。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) contains(name) → {Promise.<number>}

+ + + + + +
+ 判断地图是否包含某个名字的图层。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + 图层的名字。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ 找到指定图层则返回图层索引,否则返回-1 +
+ + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) getBounds() → {Promise.<Promise.bound>}

+ + + + + +
+ 返回当前地图的空间范围。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} +
+ + + +
+
+ Type +
+
+ +Promise.<Promise.bound> + + +
+
+ + + + + + + + + + +

(static) getCenter(point2D) → {Promise.<void>}

+ + + + + +
+ 获取当前地图的显示范围的中心点。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point2D + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getLayer(layerIndex|layerName) → {Promise.<Layer>}

+ + + + + +
+ 返回此图层集合中指定索引或名称的图层对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
layerIndex|layerName + + +number +| + +string + + + + 指定索引或名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Layer> + + +
+
+ + + + + + + + + + +

(static) getLayers() → {Promise.<Layers>}

+ + + + + +
+ 返回当前地图所包含的图层集合对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Layers> + + +
+
+ + + + + + + + + + +

(static) getLayersCount() → {Promise.<Promise.count>}

+ + + + + +
+ 返回此图层集合中图层对象的总数。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.count> + + +
+
+ + + + + + + + + + +

(static) getTrackingLayer() → {Promise.<TrackingLayer>}

+ + + + + +
+ 返回当前地图的跟踪图层。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<TrackingLayer> + + +
+
+ + + + + + + + + + +

(static) getViewBounds() → {Promise.<Promise.bound>}

+ + + + + +
+ 返回当前地图的可见范围,也称显示范围。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} +
+ + + +
+
+ Type +
+
+ +Promise.<Promise.bound> + + +
+
+ + + + + + + + + + +

(static) isDynamicProjection(bounds) → {Promise.<Promise.is>}

+ + + + + +
+ 返回是否允许地图动态投影显示(该接口为安卓端专有接口,iOS无此接口)。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bounds + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.is> + + +
+
+ + + + + + + + + + +

(static) mapToPixel(point2D) → {Promise.<Point>}

+ + + + + +
+ 将地图中指定点的地图坐标转换为像素坐标。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point2D + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point> + + +
+
+ + + + + + + + + + +

(static) moveDown(name) → {Promise.<bool>}

+ + + + + +
+ 图层下移一层(图层的索引从 0 开始,从顶层开始依次编号)。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + 图层的名字。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<bool> + + +
+
+ + + + + + + + + + +

(static) moveUp(name) → {Promise.<bool>}

+ + + + + +
+ 图层上移一层(图层的索引从 0 开始,从顶层开始依次编号)。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + 图层的名字。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<bool> + + +
+
+ + + + + + + + + + +

(static) open(mapName) → {Promise.<void>}

+ + + + + +
+ 打开指定名称的地图。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mapName + + +string + + + + 地图名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) pan(offsetX, offsetY) → {Promise.<void>}

+ + + + + +
+ 将地图平移指定的距离。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
offsetX + + +double + + + + X 方向上的移动距离,单位为坐标单位。
offsetY + + +double + + + + Y 方向上的移动距离,单位为坐标单位。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) pixelToMap(point) → {Promise.<Point2D>}

+ + + + + +
+ 将地图中指定点的像素坐标转换为地图坐标。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point2D> + + +
+
+ + + + + + + + + + +

(static) refresh() → {Promise.<void>}

+ + + + + +
+ 重新绘制当前地图。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeLayer(index) → {Promise.<void>}

+ + + + + +
+ 用于把一个图层移除。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
index + + 要移除图层的名字或序号。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) save(mapName) → {Promise.<Promise.saved>}

+ + + + + +
+ 将当前地图保存/另存为指定名称的地图 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mapName + + +string + + + + 地图名称(可选参数)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.saved> + + +
+
+ + + + + + + + + + +

(static) setCenter(point2D) → {Promise.<void>}

+ + + + + +
+ 设置当前地图的显示范围的中心点。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point2D + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDynamicProjection(value) → {Promise.<void>}

+ + + + + +
+ 设置地图是否动态投影显示,以及地图的投影坐标系 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +boolean + + + + 地图是否动态投影
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMapLoadedListener(onMapLoaded) → {Promise.<void>}

+ + + + + +
+ 获取用于接收地图加载完成的监听器。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
onMapLoaded + + +function + + + + 地图打开并显示完成后触发该方法。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMapOperateListener(events) → {Promise.<void>}

+ + + + + +
+ 添加一个用于接收地图打开、关闭事件的监听器。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + + +object + + + + 传入一个对象作为参数,该对象可以包含两个属性:mapOpened和mapClosed。两个属性的值均为function类型,分部作为打开地图和关闭地图监听事件的处理函数。例:{"mapOpened":()=>return console.log('map opened'),"mapClosed":()=> console.log('map closed')}
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setViewBounds(bounds) → {Promise.<void>}

+ + + + + +
+ 设置当前地图的可见范围,也称显示范围。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bounds + + +object + + + + Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}}
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setWorkspace(workspace) → {Promise.<void>}

+ + + + + +
+ 设置当前地图所关联的工作空间。地图是对其所关联的工作空间中的数据的显示。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
workspace + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) viewEntire() → {Promise.<void>}

+ + + + + +
+ 全幅显示此地图。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) zoom(ratio) → {Promise.<void>}

+ + + + + +
+ 将地图放大或缩小指定的比例。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ratio + + +double + + + + 缩放地图比例,此值不可以为负。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Map.js.html b/API Doc/Map.js.html new file mode 100644 index 00000000..341934d7 --- /dev/null +++ b/API Doc/Map.js.html @@ -0,0 +1,609 @@ + + + + + JSDoc: Source: Map.js + + + + + + + + + + +
+ +

Source: Map.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import { NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform } from 'react-native';
+let M = NativeModules.JSMap;
+import Layer from './Layer.js';
+import Layers from './Layers.js';
+import Point2D from './Point2D.js';
+import Point from './Point.js';
+import TrackingLayer from './TrackingLayer.js';
+
+const nativeEvt = new NativeEventEmitter(M);
+
+/**
+ * @class Map
+ * @description 地图类,负责地图显示环境的管理。
+ */
+export default class Map{
+
+    /**
+     * 设置当前地图所关联的工作空间。地图是对其所关联的工作空间中的数据的显示。
+     * @memberOf Map
+     * @param {object} workspace
+     * @returns {Promise.<void>}
+     */
+    async setWorkspace(workspace){
+        try{
+            await M.setWorkspace(this._SMMapId,workspace._SMWorkspaceId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 重新绘制当前地图。
+     * @memberOf Map
+     * @returns {Promise.<void>}
+     */
+    async refresh(){
+        try{
+            await M.refresh(this._SMMapId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此图层集合中指定索引或名称的图层对象。
+     * @memberOf Map
+     * @param {number | string} layerIndex|layerName - 指定索引或名称
+     * @returns {Promise.<Layer>}
+     */
+    async getLayer(layerIndex){
+        try{
+            var layer = new Layer();
+            if(typeof layerIndex == "string"){
+                var {layerId} = await M.getLayerByName(this._SMMapId,layerIndex);
+            }else{
+                var {layerId} = await M.getLayer(this._SMMapId,layerIndex);
+            }
+            layer._SMLayerId = layerId;
+            return layer;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于把一个数据集添加到此地图作为一个普通图层显示,即创建一个普通图层。(@deprecated)
+     * @memberOf Map
+     * @param {object} dataset
+     * @param {boolean} addToHead
+     * @returns {Promise.<void>}
+     */
+    async addDataset(dataset,addToHead){
+        console.warn("Map.js:addDataset() function has been deprecated. If you want to add Layer , please call the addLayer() function");
+        try{
+            await M.addDataset(this._SMMapId,dataset._SMDatasetId,addToHead);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回当前地图所包含的图层集合对象。
+     * @memberOf Map
+     * @deprecated
+     * @returns {Promise.<Layers>}
+     */
+    async getLayers(){
+        console.warn("Map.js:getLayers() function has been deprecated. If you want to get Layer , please call the getLayer() function");
+        try{
+            var {layersId} = await M.getLayers(this._SMMapId);
+            var layers = new Layers();
+            layers._SMLayersId = layersId;
+            return layers;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回此图层集合中图层对象的总数。
+     * @memberOf Map
+     * @returns {Promise.<Promise.count>}
+     */
+    async getLayersCount(){
+        try{
+            var {count} = await M.getLayersCount(this._SMMapId);
+            return count;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 打开指定名称的地图。
+     * @memberOf Map
+     * @param {string} mapName - 地图名称
+     * @returns {Promise.<void>}
+     */
+    async open(mapName){
+        try{
+            await M.open(this._SMMapId,mapName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 关闭当前地图。
+     * @memberOf Map
+     * @returns {Promise.<void>}
+     */
+    async close(){
+        try{
+            await M.close(this._SMMapId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将地图中指定点的像素坐标转换为地图坐标。
+     * @memberOf Map
+     * @param {object} point
+     * @returns {Promise.<Point2D>}
+     */
+    async pixelToMap(point){
+        try{
+            var {point2DId,x,y} = await M.pixelToMap(this._SMMapId,point._SMPointId);
+            var point2D = new Point2D();
+            point2D._SMPoint2DId = point2DId;
+            point2D.x = x;
+            point2D.y = y;
+            return point2D;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将地图中指定点的地图坐标转换为像素坐标。
+     * @memberOf Map
+     * @param {object} point2D
+     * @returns {Promise.<Point>}
+     */
+    async mapToPixel(point2D){
+        try{
+            var {pointId,x,y} = await M.mapToPixel(this._SMMapId,point2D._SMPoint2DId);
+            var point = new Point();
+            point._SMPointId = pointId;
+            point.x = x;
+            point.y = y;
+            return point;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 获取当前地图的显示范围的中心点。
+     * @memberOf Map
+     * @param {object} point2D
+     * @returns {Promise.<void>}
+     */
+    async getCenter(){
+        try{
+            var {point2DId,x,y} = await M.getCenter(this._SMMapId);
+            var point2D = new Point2D();
+            point2D._SMPoint2DId = point2DId;
+            point2D.x = x;
+            point2D.y = y;
+            return point2D;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置当前地图的显示范围的中心点。
+     * @memberOf Map
+     * @param {object} point2D
+     * @returns {Promise.<void>}
+     */
+    async setCenter(point2D){
+        try{
+            await M.setCenter(this._SMMapId,point2D._SMPoint2DId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回当前地图的跟踪图层。
+     * @memberOf Map
+     * @returns {Promise.<TrackingLayer>}
+     */
+    async getTrackingLayer(){
+        try{
+            var {trackingLayerId} = await M.getTrackingLayer(this._SMMapId);
+            var trackingLayer = new TrackingLayer();
+            trackingLayer._SMTrackingLayerId = trackingLayerId;
+            return trackingLayer;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将当前地图保存/另存为指定名称的地图
+     * @memberOf Map
+     * @param {string} mapName 地图名称(可选参数)
+     * @returns {Promise.<Promise.saved>}
+     */
+    async save(mapName){
+        try{
+            if(typeof mapName === 'string'){
+                var {saved} = await M.saveAs(this._SMMapId,mapName);
+            }else{
+                var {saved} = await M.save(this._SMMapId);
+            }
+            return saved;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回当前地图的空间范围。
+     * @memberOf Map
+     * @returns {Promise.<Promise.bound>} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}}
+     */
+    async getBounds(){
+        try{
+            var {bound} = await M.getBounds(this._SMMapId);
+            return bound;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回当前地图的可见范围,也称显示范围。
+     * @memberOf Map
+     * @returns {Promise.<Promise.bound>} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}}
+     */
+    async getViewBounds(){
+        try{
+            var {bound} = await M.getViewBounds(this._SMMapId);
+            return bound;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置当前地图的可见范围,也称显示范围。
+     * @memberOf Map
+     * @param {object} bounds - Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}}
+     * @returns {Promise.<void>}
+     */
+    async setViewBounds(bounds){
+        try{
+            await M.setViewBounds(this._SMMapId,bounds);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回是否允许地图动态投影显示(该接口为安卓端专有接口,iOS无此接口)。
+     * @memberOf Map
+     * @param {object} bounds
+     * @returns {Promise.<Promise.is>}
+     */
+    async isDynamicProjection(){
+        try{
+            var {is} = await M.isDynamicProjection(this._SMMapId);
+            return is;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置地图是否动态投影显示,以及地图的投影坐标系
+     * @memberOf Map
+     * @param {boolean} value - 地图是否动态投影
+     * @returns {Promise.<void>}
+     */
+    async setDynamicProjection(value){
+        try{
+            await M.setDynamicProjection(this._SMMapId,value);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取用于接收地图加载完成的监听器。
+     * @memberOf Map
+     * @param {function} onMapLoaded - 地图打开并显示完成后触发该方法。
+     * @returns {Promise.<void>}
+     */
+    async setMapLoadedListener(onMapLoaded){
+        try{
+            var success = await M.setMapLoadedListener(this._SMMapId);
+
+            if(!success) return ;
+            //差异化处理
+            if(Platform.OS === 'ios'){
+                
+                nativeEvt.addListener("com.supermap.RN.JSMap.map_loaded",function (e) {
+                    if(typeof onMapLoaded === 'function'){
+                        onMapLoaded();
+                    }else{
+                        console.error("Please set a callback function to the first argument.");
+                    }
+                });
+                return
+            }
+
+            DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_loaded",function (e) {
+                if(typeof onMapLoaded === 'function'){
+                    onMapLoaded();
+                }else{
+                    console.error("Please set a callback function to the first argument.");
+                }
+            });
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加一个用于接收地图打开、关闭事件的监听器。
+     * @memberOf Map
+     * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:mapOpened和mapClosed。两个属性的值均为function类型,分部作为打开地图和关闭地图监听事件的处理函数。例:{"mapOpened":()=>return console.log('map opened'),"mapClosed":()=> console.log('map closed')}
+     * @returns {Promise.<void>}
+     */
+    async setMapOperateListener(events){
+        try{
+            var success = await M.setMapOperateListener(this._SMMapId);
+
+            if(!success) return ;
+            //差异化处理
+            if(Platform.OS === 'ios'){
+                
+                nativeEvt.addListener("com.supermap.RN.JSMap.map_opened",function (e) {
+                    if(typeof events.mapOpened === 'function'){
+                        events.mapOpened();
+                    }else{
+                        console.error("Please set a callback to the property 'mapOpened' in the first argument.");
+                    }
+                });
+                
+                nativeEvt.addListener("com.supermap.RN.JSMap.map_closed",function (e) {
+                    if(typeof events.mapClosed === 'function'){
+                        events.mapClosed();
+                    }else{
+                        console.error("Please set a callback to the property 'mapClosed' in the first argument.");
+                    }
+                });
+                return
+            }
+
+            DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_opened",function (e) {
+                if(typeof events.mapOpened === 'function'){
+                    events.mapOpened();
+                }else{
+                    console.error("Please set a callback to the property 'mapOpened' in the first argument.");
+                }
+            });
+
+            DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_closed",function (e) {
+                if(typeof events.mapClosed === 'function'){
+                    events.mapClosed();
+                }else{
+                    console.error("Please set a callback to the property 'mapClosed' in the first argument.");
+                }
+            });
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将地图平移指定的距离。
+     * @memberOf Map
+     * @param {double} offsetX - X 方向上的移动距离,单位为坐标单位。
+     * @param {double} offsetY - Y 方向上的移动距离,单位为坐标单位。
+     * @returns {Promise.<void>}
+     */
+    async pan(offsetX,offsetY){
+        try{
+            await M.pan(this._SMMapId,offsetX,offsetY);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 全幅显示此地图。
+     * @memberOf Map
+     * @returns {Promise.<void>}
+     */
+    async viewEntire(){
+        try{
+            await M.viewEntire(this._SMMapId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 将地图放大或缩小指定的比例。
+     * @memberOf Map
+     * @param {double} ratio - 缩放地图比例,此值不可以为负。
+     * @returns {Promise.<void>}
+     */
+    async zoom(ratio){
+        try{
+            if(ratio < 0) throw new Error("Ratio can`t be nagative.");
+            await M.zoom(this._SMMapId,ratio);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于把一个数据集添加到此图层集合作为一个普通图层显示,即创建一个普通图层。其风格由系统默认设置。
+     * @memberOf Map
+     * @param dataset - 要添加到图层的数据集。
+     * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。
+     * @returns {Promise.<layer>}
+     */
+    async addLayer(dataset,addToHead){
+        try{
+            var {layerId} = await M.addLayer(this._SMMapId,dataset._SMDatasetId,addToHead);
+            var layer = new Layer();
+            layer._SMLayerId = layerId;
+            return layer;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于将一个数据集添加到此图层集合作为一个专题图层显示,即创建一个专题图层,并指定专题图层的专题图对象。
+     * @memberOf Map
+     * @param dataset - 要添加到图层的数据集。
+     * @param theme - 指定此专题图层的专题图对象。
+     * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。
+     * @returns {Promise.<Layer>}
+     */
+    async addThemeLayer(dataset,theme,addToHead){
+        try{
+            var {layerId} = await M.addThemeLayer(this._SMMapId,dataset._SMDatasetId,theme._SMThemeId,addToHead);
+            var layer = new Layer();
+            layer._SMLayerId = layerId;
+            return layer;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 用于把一个图层移除。
+     * @memberOf Map
+     * @param index<string/number> - 要移除图层的名字或序号。
+     * @returns {Promise.<void>}
+     */
+    async removeLayer(index){
+        try{
+            if(typeof index === 'string'){
+            var {layerId} = await M.removeLayerByName(this._SMMapId,index);
+            }else if(typeof index === 'number'){
+            var {layerId} = await M.removeLayerByIndex(this._SMMapId,index);
+            }else{
+                throw new Error ('index must be number or string!');
+            }
+            var layer = new Layer();
+            layer._SMLayerId = layerId;
+            return layer;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 判断地图是否包含某个名字的图层。
+     * @memberOf Map
+     * @param name - 图层的名字。
+     * @returns {Promise.<number>} 找到指定图层则返回图层索引,否则返回-1
+     */
+    async contains(name){
+        try{
+            var {isContain} = await M.contains(this._SMMapId,name);
+            return isContain;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 图层下移一层(图层的索引从 0 开始,从顶层开始依次编号)。
+     * @memberOf Map
+     * @param name - 图层的名字。
+     * @returns {Promise.<bool>}
+     */
+    async moveDown(name){
+        try{
+            var {moved} = await M.moveDown(this._SMMapId,name);
+            return moved;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 图层上移一层(图层的索引从 0 开始,从顶层开始依次编号)。
+     * @memberOf Map
+     * @param name - 图层的名字。
+     * @returns {Promise.<bool>}
+     */
+    async moveUp(name){
+        try{
+            var {moved} = await M.moveUp(this._SMMapId,name);
+            return moved;
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/MapControl.html b/API Doc/MapControl.html new file mode 100644 index 00000000..9f687bc8 --- /dev/null +++ b/API Doc/MapControl.html @@ -0,0 +1,4796 @@ + + + + + JSDoc: Class: MapControl + + + + + + + + + + +
+ +

Class: MapControl

+ + + + + + +
+ +
+ +

MapControl

+ + +
+ +
+
+ + + + + +

new MapControl()

+ + + + + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ACTION + + +object + + + + PAN:地图漫游。 + VERTEXADD:在可编辑图层中为对象添加节点。 + VERTEXDELETE:在可编辑图层中为对象删除节点。 + SELECT:在对象上点击,选择对象。 + VERTEXEDIT:在可编辑图层中编辑对象的节点。 + CREATEPOINT:在可编辑图层上点击式绘点。 + CREATEPOLYLINE:在可编辑图层中点击式绘直线。 + CREATEPOLYGON:在可编辑图层中点击式绘多边形。
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) addActionChangedListener(actionChange)

+ + + + + +
+ 监听编辑行为的变更事件 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
actionChange + + +function + + + + 编辑行为变更函数,回调事件参数:e:newAction,e:oldAction
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) addGeometryAddedListener(event) → {Promise.<*>}

+ + + + + +
+ 添加对象添加监听器 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +object + + + + event:{geometryAdded: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addGeometryDeletedListener(event) → {Promise.<boolean>}

+ + + + + +
+ event:{geometryDeleted: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,被删除对象id,删除结果canceled,ture为删除成功,否则为false. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) addGeometryDeletingListener(event) → {Promise.<*>}

+ + + + + +
+ 添加对象删除完成前监听器。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +object + + + + event:{geometryDeleting: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addGeometryModifiedListener(event) → {Promise.<*>}

+ + + + + +
+ 添加对象修改完成监听器 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +object + + + + event:{geometryModified: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addGeometryModifyingListener(event) → {Promise.<*>}

+ + + + + +
+ 添加对象修改前监听器 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addGeometrySelectedListener(events) → {Promise.<*>}

+ + + + + +
+ events:{geometrySelected: e => {...},geometryMultiSelected e => {...}} + geometrySelected 单个集合对象被选中事件的回调函数,参数e为获取结果 e:{layer:--, id:--} layer:操作的图层,操作对象id。geometryMultiSelected 多个集合对象被选中事件的回调函数,参数e为获取结果数组:e:{geometries:[layer:--,id:--]} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addMeasureListener(events) → {Promise.<*>}

+ + + + + +
+ events:{lengthMeasured: e => {...},areaMeasured: e => {...},e => {...},angleMeasured: e => {...}} +lengthMeasured 长度量算结果。 e:{curResult:--, curPoint:{x:--,y--} +areaMeasured 面积量算结果。 e:{curResult:--, curPoint:{x:--,y--} +angleMeasured 测量角度结果 通过设置Action.MEASUREANGLE实现测量角度。 e:{curAngle:--, curPoint:{x:--,y--} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) addPlotLibrary() → {Promise.<int>}

+ + + + + +
+ 添加标绘库。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<int> + + +
+
+ + + + + + + + + + +

(static) addUndoStateChangeListener(event) → {Promise.<*>}

+ + + + + +
+ event:{undoStateChange: e => {...}} e:{canUndo:--,canRedo:--} 返回参数canUndo表示是否可取消,canRedo表示是否可重复 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) cancel() → {Promise.<void>}

+ + + + + +
+ 取消操作,对于采集而言,新建的未提交的数据将被清除,对于编辑,将回到上一次提交保存的状态。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) deleteCurrentGeometry() → {Promise.<Promise.deleted>}

+ + + + + +
+ 删除当前绘制出来的几何对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.deleted> + + +
+
+ + + + + + + + + + +

(static) getAction() → {Promise.<string>}

+ + + + + +
+ 返回地图控件中地图的当前操作状态。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<string> + + +
+
+ + + + + + + + + + +

(static) getCurrentGeometry() → {Promise.<(GeoPoint|GeoLine|GeoRegion|Geometry)>}

+ + + + + +
+ 获得当前Geometry几何对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<(GeoPoint|GeoLine|GeoRegion|Geometry)> + + +
+
+ + + + + + + + + + +

(static) getEditLayer() → {Promise.<object>}

+ + + + + +
+ 获取当前编辑图层 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<object> + + +
+
+ + + + + + + + + + +

(static) getIndustryNavi() → {Promise.<Navigation2>}

+ + + + + +
+ 获取导航控件 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Navigation2> + + +
+
+ + + + + + + + + + +

(static) getMap() → {Promise.<Map>}

+ + + + + +
+ 返回在地图控件中显示的地图对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Map> + + +
+
+ + + + + + + + + + +

(static) getTraditionalNavi() → {Promise.<TraditionalNavi>}

+ + + + + +
+ 获得传统导航控件 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<TraditionalNavi> + + +
+
+ + + + + + + + + + +

(static) redo() → {Promise.<boolean>}

+ + + + + +
+ 地图窗口上恢复上一步的操作。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) removeActionChangedListener() → {Promise.<void>}

+ + + + + +
+ 移除动作变更监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeEditStatusListener() → {Promise.<void>}

+ + + + + +
+ 添加、删除节点事件的监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometryAddedListener() → {Promise.<void>}

+ + + + + +
+ 移除对象添加监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometryDeletedListener() → {Promise.<void>}

+ + + + + +
+ 移除对象删除完成监听器 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometryDeletingListener() → {Promise.<void>}

+ + + + + +
+ 移除对象删除完成前监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometryModifiedListener() → {Promise.<void>}

+ + + + + +
+ 移除对象删除完成前监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometryModifyingListener() → {Promise.<void>}

+ + + + + +
+ 移除对象修改完成监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeGeometrySelectedListener() → {Promise.<void>}

+ + + + + +
+ 移除对象选中监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeMeasureListener() → {Promise.<void>}

+ + + + + +
+ 移除量算监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removePlotLibrary() → {Promise.<void>}

+ + + + + +
+ 添加标绘库。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) removeUndoStateChangeListener() → {Promise.<void>}

+ + + + + +
+ 移除Undo监听器。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setAction(actionType) → {Promise.<void>}

+ + + + + +
+ 设置地图控件中地图的当前操作状态。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
actionType + + +number + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setConfigurationChangedListener(events) → {Promise.<void>}

+ + + + + +
+ 设置横竖屏切换监听器。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + + +object + + + + 传入一个对象作为参数,该对象可以包含两个属性:toHorizontalScreen和toVerticalScreen。两个属性的值均为function类型,分部作为横屏与竖屏监听事件的处理函数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setEditStatusListener(events) → {Promise.<*>}

+ + + + + +
+ events:{addNodeEnable: e => {...},deleteNodeEnable: e => {...}} +addNodeEnable: 添加节点有效。e:{isEnable:--} +deleteNodeEnable: 删除节点有效。 e:{isEnable:--} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) setGestureDetector(events) → {Promise.<void>}

+ + + + + +
+ 监听导航事件 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + + +object + + + + 传入一个对象作为参数,该对象可以包含两个属性:longPressHandler和scrollHandler。两个属性的值均为function类型,分部作为长按与滚动监听事件的处理函数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMapParamChangedListener(events)

+ + + + + +
+ events: {boundsChanged:fun(){},scaleChanged:fun(){},angleChanged:fun(){},sizeChanged:fun(){}} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + + 该对象有下面四个函数类型的属性分别处理四种监听事件
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) setPlotSymbol() → {Promise.<int>}

+ + + + + +
+ 设置标绘图案。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<int> + + +
+
+ + + + + + + + + + +

(static) setRefreshListener(callback) → {Promise.<void>}

+ + + + + +
+ 地图刷新监听器 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callback + + +function + + + + 刷新处理回调函数
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) submit() → {Promise.<(Promise|*|{phasedRegistrationNames})>}

+ + + + + +
+ 提交操作,对于采集而言,该接口将把采集的新几何对象写入到数据集,对于编辑,则是更新数据集中的正在编辑的对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<(Promise|*|{phasedRegistrationNames})> + + +
+
+ + + + + + + + + + +

(static) undo() → {Promise.<boolean>}

+ + + + + +
+ 地图控件上撤消上一次的操作。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/MapControl.js.html b/API Doc/MapControl.js.html new file mode 100644 index 00000000..a910d779 --- /dev/null +++ b/API Doc/MapControl.js.html @@ -0,0 +1,956 @@ + + + + + JSDoc: Source: MapControl.js + + + + + + + + + + +
+ +

Source: MapControl.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+const LONGPRESS_EVENT = "com.supermap.RN.JSMapcontrol.long_press_event";
+
+import { NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform } from 'react-native';
+let MC = NativeModules.JSMapControl;
+import Map from './Map.js';
+import Navigation2 from './IndustryNavi.js';
+import TraditionalNavi from './TraditionalNavi';
+import GeoPoint from './GeoPoint.js';
+import GeoRegion from './GeoRegion.js';
+import GeoLine from './GeoLine.js';
+import Geometry from './Geometry.js';
+import Layer from './Layer.js';
+
+const nativeEvt = new NativeEventEmitter(MC);
+
+/**
+ * @class MapControl
+ * @property {object} ACTION - PAN:地图漫游。
+ VERTEXADD:在可编辑图层中为对象添加节点。
+ VERTEXDELETE:在可编辑图层中为对象删除节点。
+ SELECT:在对象上点击,选择对象。
+ VERTEXEDIT:在可编辑图层中编辑对象的节点。
+ CREATEPOINT:在可编辑图层上点击式绘点。
+ CREATEPOLYLINE:在可编辑图层中点击式绘直线。
+ CREATEPOLYGON:在可编辑图层中点击式绘多边形。
+ */
+export default class MapControl{
+
+    /**
+     * 返回在地图控件中显示的地图对象。
+     * @memberOf MapControl
+     * @returns {Promise.<Map>}
+     */
+    async getMap(){
+        try{
+            var {mapId} =await MC.getMap(this._SMMapControlId);
+            var map = new Map();
+            map._SMMapId = mapId;
+            return map;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置地图控件中地图的当前操作状态。
+     * @memberOf MapControl
+     * @param {number} actionType
+     * @returns {Promise.<void>}
+     */
+    async setAction(actionType){
+        try{
+            await MC.setAction(this._SMMapControlId,actionType);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 提交操作,对于采集而言,该接口将把采集的新几何对象写入到数据集,对于编辑,则是更新数据集中的正在编辑的对象。
+     * @memberOf MapControl
+     * @returns {Promise.<Promise|*|{phasedRegistrationNames}>}
+     */
+    async submit(){
+        try{
+            var submited = await MC.submit(this._SMMapControlId);
+            return submited;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 监听编辑行为的变更事件
+     * @memberOf MapControl
+     * @param {function} actionChange 编辑行为变更函数,回调事件参数:e:newAction,e:oldAction
+     */
+    async addActionChangedListener(actionChange){
+        try{
+            DeviceEventEmitter.addListener('ActionChange', function(e) {
+                actionChange && actionChange(e);
+            });
+            if(typeof actionChange == "function"){
+                await MC.addActionChangedListener(this.mapControlId);
+            }else{
+                throw new Error("addActionChangedListener need a callback function as first argument!");
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除动作变更监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeActionChangedListener(actionChange){
+        try{
+            await MC.removeActionChangedListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 监听导航事件
+     * @memberOf MapControl
+     * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:longPressHandler和scrollHandler。两个属性的值均为function类型,分部作为长按与滚动监听事件的处理函数。
+     * @returns {Promise.<void>}
+     */
+    async setGestureDetector(handlers){
+        try{
+            if(handlers){
+                await MC.setGestureDetector(this._SMMapControlId);
+            }else{
+                throw new Error("setGestureDetector need callback functions as first two argument!");
+            }
+            //差异化
+            if(Platform.OS === 'ios'){
+                if(typeof handlers.longPressHandler === "function"){
+                    nativeEvt.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) {
+                                                   // longPressHandler && longPressHandler(e);
+                                                   handlers.longPressHandler(e);
+                                                   });
+                }
+                
+                if(typeof handlers.scrollHandler === "function"){
+                    nativeEvt.addListener('com.supermap.RN.JSMapcontrol.scroll_event',function (e) {
+                                                   scrollHandler && scrollHandler(e);
+                                                   });
+                }
+            }else{
+                if(typeof handlers.longPressHandler === "function"){
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) {
+                                                   // longPressHandler && longPressHandler(e);
+                                                   handlers.longPressHandler(e);
+                                                   });
+                }
+                
+                if(typeof handlers.scrollHandler === "function"){
+                    DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.scroll_event',function (e) {
+                                                   scrollHandler && scrollHandler(e);
+                                                   });
+                }
+            }
+
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    async deleteGestureDetector(){
+        try{
+            await MC.deleteGestureDetector(this._SMMapControlId)
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *  监听地图参数变化,分别由边界变化sizeChanged,比例尺变化scaleChanged,角度变化angleChanged,中心点变化boundsChanged(iOS目前只支持比例尺变化监听与中心点变化监听)。
+     * @memberOf MapControl
+     * @param events 该对象有下面四个函数类型的属性分别处理四种监听事件
+     * @description events: {boundsChanged:fun(){},scaleChanged:fun(){},angleChanged:fun(){},sizeChanged:fun(){}}
+     */
+    async setMapParamChangedListener(events){
+        try{
+            boundsChanged = events.boundsChanged;
+            scaleChanged = events.scaleChanged;
+            angleChanged = events.angleChanged;
+            sizeChanged = events.sizeChanged;
+
+            var success = await MC.setMapParamChangedListener(this._SMMapControlId);
+            console.debug("Listening map parameters changed.");
+
+            if(!success) return;
+            //差异化处理
+            if(Platform.OS === 'ios'){
+                nativeEvt.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged',function (e) {
+                   if(typeof boundsChanged == 'function'){
+                       events.boundsChanged(e);
+                   }else{
+                       console.error("Please set a callback to the property 'boundsChanged' in the first argument.");
+                   }
+                });
+                nativeEvt.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged',function (e) {
+                  if(typeof events.scaleChanged == 'function'){
+                      events.scaleChanged(e);
+                  }else{
+                      console.error("Please set a callback to the property 'scaleChanged' in the first argument.");
+                  }
+                });
+
+                return
+            }
+
+            DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged',function (e) {
+                if(typeof boundsChanged == 'function'){
+                    events.boundsChanged(e);
+                }else{
+                    console.error("Please set a callback to the property 'boundsChanged' in the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged',function (e) {
+                if(typeof events.scaleChanged == 'function'){
+                    events.scaleChanged(e);
+                }else{
+                    console.error("Please set a callback to the property 'scaleChanged' in the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.AngleChanged',function (e) {
+                if(typeof events.angleChanged == 'function' ){
+                    events.angleChanged(e);
+                }else {
+                    console.error("Please set a callback to the property 'angleChanged' in the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.SizeChanged',function (e) {
+                if(typeof events.sizeChanged == 'function' ){
+                    events.sizeChanged(e);
+                }else {
+                    console.error("Please set a callback to the property 'sizeChanged' in the first argument.");
+                }
+            });
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 地图刷新监听器
+     * @memberOf MapControl
+     * @param {function} callback - 刷新处理回调函数
+     * @returns {Promise.<void>}
+     */
+    async setRefreshListener(callback){
+        try{
+            var success = await MC.setRefreshListener(this._SMMapControlId);
+            console.log("MapControl:test result:",success);
+            if(success){
+                DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.refresh_event",function (e) {
+                    // console.log("MapControl:监听到地图刷新");
+                    if(typeof callback == 'function'){
+                        callback(e);
+                    }else{
+                        console.error("Please set a callback function as the first argument.");
+                    }
+                });
+            }
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获得当前Geometry几何对象
+     * @memberOf MapControl
+     * @returns {Promise.<GeoPoint|GeoLine|GeoRegion|Geometry>}
+     */
+    async getCurrentGeometry(){
+        try{
+            var {geometryId,geoType} = await MC.getCurrentGeometry(this._SMMapControlId);
+
+            if(geoType == "GeoPoint"){
+                var geoPoint = new GeoPoint();
+                geoPoint._SMGeoPointId = geometryId;
+            }else if(geoType == "GeoRegion"){
+                var geoRegion = new GeoRegion();
+                geoRegion._SMGeoRegionId = geometryId;
+            }else if(geoType == "GeoLine"){
+                var geoLine = new GeoLine();
+                geoLine._SMGeoLineId = geometryId;
+            }else{
+                var geometry = new Geometry();
+                geometry._SMGeometryId = geometryId;
+            }
+            return geoPoint || geoLine || geoRegion || geometry;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取导航控件
+     * @memberOf MapControl
+     * @returns {Promise.<Navigation2>}
+     */
+    async getIndustryNavi(){
+        try{
+            var {navigation2Id} = await MC.getNavigation2(this._SMMapControlId);
+            var navigation2 = new Navigation2();
+            navigation2._SMNavigation2Id = navigation2Id;
+            return navigation2;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置横竖屏切换监听器。
+     * @memberOf MapControl
+     * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:toHorizontalScreen和toVerticalScreen。两个属性的值均为function类型,分部作为横屏与竖屏监听事件的处理函数。
+     * @returns {Promise.<void>}
+     */
+    async  setConfigurationChangedListener(events){
+        try{
+            var success = await MC. setConfigurationChangedListener();
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_horizontal_screen',function (e) {
+                if(typeof events.toHorizontal_screen == 'function'){
+                    events.toHorizontalScreen();
+                }else{
+                    console.error("Please set a callback to the property 'toHorizontalScreen' in the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_verticalscreen',function (e) {
+                if(typeof events.toVerticalScreen == 'function'){
+                    events.toVerticalScreen();
+                }else{
+                    console.error("Please set a callback to the property 'toVerticalScreen' in the first argument.");
+                }
+            });
+
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获得传统导航控件
+     * @memberOf MapControl
+     * @returns {Promise.<TraditionalNavi>}
+     */
+    async getTraditionalNavi(){
+        try{
+            var {traditionalNaviId} = await MC.getTraditionalNavi(this._SMMapControlId);
+            var traditionalNavi= new TraditionalNavi();
+            traditionalNavi._SMTraditionalNaviId = traditionalNaviId;
+            return traditionalNavi;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回地图控件中地图的当前操作状态。
+     * @memberOf MapControl
+     * @returns {Promise.<string>}
+     */
+    async getAction(){
+        try{
+            var {actionType} = await MC.getAction(this._SMMapControlId);
+            for( p in this.ACTION){
+                if(this.ACTION[p] === actionType){
+                    console.log("MapControl.js:"+p);
+                    return p;
+                }else{
+                    throw new Error("Unknown Type");
+                }
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 地图窗口上恢复上一步的操作。
+     * @memberOf MapControl
+     * @returns {Promise.<boolean>}
+     */
+    async redo(){
+        try{
+            var {redone} = await MC.redo(this._SMMapControlId);
+            return redone;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 地图控件上撤消上一次的操作。
+     * @memberOf MapControl
+     * @returns {Promise.<boolean>}
+     */
+    async undo(){
+        try{
+            var {undone} = await MC.undo(this._SMMapControlId);
+            return undone;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 取消操作,对于采集而言,新建的未提交的数据将被清除,对于编辑,将回到上一次提交保存的状态。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async cancel(){
+        try{
+            var {canceled} = await MC.cancel(this._SMMapControlId);
+            return canceled;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 删除当前绘制出来的几何对象。
+     * @memberOf MapControl
+     * @returns {Promise.<Promise.deleted>}
+     */
+    async deleteCurrentGeometry(){
+        try{
+            var {deleted} = await MC.deleteCurrentGeometry(this._SMMapControlId);
+            return deleted;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取当前编辑图层
+     * @memberOf MapControl
+     * @returns {Promise.<object>}
+     */
+    async getEditLayer(){
+        try{
+            var {layerId} = await MC.getEditLayer(this._SMMapControlId);
+            var layer = new Layer();
+            layer._SMLayerId = layerId;
+            return layer;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象删除完成监听器。
+     * @memberOf MapControl
+     * @param {object} event 
+     * @description event:{geometryDeleted: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,被删除对象id,删除结果canceled,ture为删除成功,否则为false.
+     * @returns {Promise.<boolean>}
+     */
+    async addGeometryDeletedListener(event){
+        try{
+            var success = await MC.addGeometryDeletedListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.geometry_deleted',function (e) {
+                if(typeof event.geometryDeleted === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    event.geometryDeleted(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象删除完成监听器
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometryDeletedListener(){
+        try{
+            await MC. removeGeometryDeletedListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象添加监听器
+     * @memberOf MapControl
+     * @param {object} event - event:{geometryAdded: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+     * @returns {Promise.<*>}
+     */
+    async addGeometryAddedListener(event){
+        try{
+            var success = await MC.addGeometryAddedListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.grometry_added',function (e) {
+                if(typeof event.geometryAdded === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    event.geometryAdded(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象添加监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometryAddedListener(){
+        try{
+            await MC. removeGeometryAddedListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象删除完成前监听器。
+     * @memberOf MapControl
+     * @param {object} event - event:{geometryDeleting: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+     * @returns {Promise.<*>}
+     */
+    async addGeometryDeletingListener(event){
+        try{
+            var success = await MC.addGeometryDeletingListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_deleting',function (e) {
+                if(typeof event.geometryDeleting === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    event.geometryDeleting(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象删除完成前监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometryDeletingListener(){
+        try{
+            await MC. removeGeometryDeletingListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象修改完成监听器
+     * @memberOf MapControl
+     * @param {object} event - event:{geometryModified: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+     * @returns {Promise.<*>}
+     */
+    async addGeometryModifiedListener(event){
+        try{
+            var success = await MC.addGeometryModifiedListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modified',function (e) {
+                if(typeof event.geometryModified === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    event.geometryModified(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象删除完成前监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometryModifiedListener(){
+        try{
+            await MC. removeGeometryModifiedListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象修改前监听器
+     * @memberOf MapControl
+     * @param event - event:{geometryModifying: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false.
+     * @returns {Promise.<*>}
+     */
+    async addGeometryModifyingListener(event){
+        try{
+            var success = await MC.addGeometryModifyingListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modifying',function (e) {
+                if(typeof event.geometryModifying === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    event.geometryModifying(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象修改完成监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometryModifyingListener(){
+        try{
+            await MC. removeGeometryModifyingListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象修改前监听器
+     * @memberOf MapControl
+     * @param events 
+     * @description events:{geometrySelected: e => {...},geometryMultiSelected e => {...}}
+       geometrySelected 单个集合对象被选中事件的回调函数,参数e为获取结果 e:{layer:--, id:--} layer:操作的图层,操作对象id。geometryMultiSelected 多个集合对象被选中事件的回调函数,参数e为获取结果数组:e:{geometries:[layer:--,id:--]}
+     * @returns {Promise.<*>}
+     */
+    async addGeometrySelectedListener(events){
+        try{
+            var success = await MC.addGeometrySelectedListener(this._SMMapControlId);
+            if(!success) return ;
+            //差异化
+            if(Platform.OS === 'ios'){
+                nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_selected',function (e) {
+                        if(typeof events.geometrySelected === 'function'){
+                            var layer = new Layer();
+                            layer._SMLayerId = e.layerId;
+                            e.layer = layer;
+                            events.geometrySelected(e);
+                        }else{
+                            console.error("Please set a callback to the first argument.");
+                        }
+                });
+                nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected',function (e) {
+                        if(typeof events.geometryMultiSelected === 'function'){
+                            e.geometries.map(function (geometry) {
+                                var layer = new Layer();
+                                layer._SMLayerId = geometry.layerId;
+                                geometry.layer = layer;
+                            })
+                            events.geometryMultiSelected(e);
+                         }else{
+                            console.error("Please set a callback to the first argument.");
+                         }
+                        });
+            }else{
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_selected',function (e) {
+                if(typeof events.geometrySelected === 'function'){
+                    var layer = new Layer();
+                    layer._SMLayerId = e.layerId;
+                    e.layer = layer;
+                    events.geometrySelected(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected',function (e) {
+                if(typeof events.geometryMultiSelected === 'function'){
+                    e.geometries.map(function (geometry) {
+                        var layer = new Layer();
+                        layer._SMLayerId = geometry.layerId;
+                        geometry.layer = layer;
+                    })
+                    events.geometryMultiSelected(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            }
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除对象选中监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeGeometrySelectedListener(){
+        try{
+            await MC. removeGeometrySelectedListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加对象修改前监听器
+     * @memberOf MapControl
+     * @param events 
+     * @description events:{lengthMeasured: e => {...},areaMeasured: e => {...},e => {...},angleMeasured: e => {...}}
+     * lengthMeasured 长度量算结果。 e:{curResult:--, curPoint:{x:--,y--}
+     * areaMeasured 面积量算结果。 e:{curResult:--, curPoint:{x:--,y--}
+     * angleMeasured 测量角度结果 通过设置Action.MEASUREANGLE实现测量角度。  e:{curAngle:--, curPoint:{x:--,y--}
+     * @returns {Promise.<*>}
+     */
+    async addMeasureListener(events){
+        try{
+            var success = await MC.addGeometryModifyingListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.length_measured',function (e) {
+                if(typeof events.lengthMeasured === 'function'){
+                    events.lengthMeasured(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.area_measured',function (e) {
+                if(typeof events.areaMeasured === 'function'){
+                    events.areaMeasured(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.angle_measured',function (e) {
+                if(typeof events.angleMeasured === 'function'){
+                    events.angleMeasured(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除量算监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeMeasureListener(){
+        try{
+            await MC. removeMeasureListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置Undo监听器。
+     * @memberOf MapControl
+     * @param event 
+     * @description event:{undoStateChange: e => {...}}  e:{canUndo:--,canRedo:--} 返回参数canUndo表示是否可取消,canRedo表示是否可重复
+     * @returns {Promise.<*>}
+     */
+    async addUndoStateChangeListener(event){
+        try{
+            var success = await MC.addUndoStateChangeListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.undo_state_change',function (e) {
+                if(typeof event.undoStateChange === 'function'){
+                    event.undo_state_change(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除Undo监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeUndoStateChangeListener(){
+        try{
+            await MC.removeUndoStateChangeListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置编辑状态监听器。
+     * @memberOf MapControl
+     * @param events 
+     * @description events:{addNodeEnable: e => {...},deleteNodeEnable: e => {...}}
+     * addNodeEnable: 添加节点有效。e:{isEnable:--}
+     * deleteNodeEnable: 删除节点有效。 e:{isEnable:--}
+     * @returns {Promise.<*>}
+     */
+    async setEditStatusListener(events){
+        try{
+            var success = await MC.setEditStatusListener(this._SMMapControlId);
+            if(!success) return ;
+
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.add_node_enable',function (e) {
+                if(typeof events.addNodeEnable === 'function'){
+                    events.addNodeEnable(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.delete_node_enable',function (e) {
+                if(typeof events.deleteNodeEnable === 'function'){
+                    events.deleteNodeEnable(e);
+                }else{
+                    console.error("Please set a callback to the first argument.");
+                }
+            });
+            return success;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加、删除节点事件的监听器。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removeEditStatusListener(){
+        try{
+            await MC.removeEditStatusListener(this._SMMapControlId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 添加标绘库。
+     * @memberOf MapControl
+     * @returns {Promise.<int>}
+     */
+    async addPlotLibrary(url){
+        try{
+            var libId = await MC.addPlotLibrary(this._SMMapControlId,url);
+            return libId;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 添加标绘库。
+     * @memberOf MapControl
+     * @returns {Promise.<void>}
+     */
+    async removePlotLibrary(libId){
+        try{
+            var isRemove = await MC.removePlotLibrary(this._SMMapControlId,libId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 设置标绘图案。
+     * @memberOf MapControl
+     * @returns {Promise.<int>}
+     */
+    async setPlotSymbol(libId,symbolCode){
+        try{
+            var isSet = await MC.setPlotSymbol(this._SMMapControlId,libId,symbolCode);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/MapView.html b/API Doc/MapView.html new file mode 100644 index 00000000..c91b04b9 --- /dev/null +++ b/API Doc/MapView.html @@ -0,0 +1,810 @@ + + + + + JSDoc: Class: MapView + + + + + + + + + + +
+ +

Class: MapView

+ + + + + + +
+ +
+ +

MapView

+ + +
+ +
+
+ + + + + +

new MapView()

+ + + + + +
+ 地图显示控件容器类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) addCallOut(callOut, pointName) → {Promise.<void>}

+ + + + + +
+ 添加callout层 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callOut + + +object + + + + callOut对象
pointName + + +string + + + + 点名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) addPoint(point2D, pointName) → {Promise.<Point2D>}

+ + + + + +
+ 在地图上添加一个点标记 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point2D + + +object + + + + 点标记
pointName + + +string + + + + 点标记名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point2D> + + +
+
+ + + + + + + + + + +

(static) getMapControl() → {Promise.<MapControl>}

+ + + + + +
+ 获取地图控件。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<MapControl> + + +
+
+ + + + + + + + + + +

(static) refresh() → {Promise.<void>}

+ + + + + +
+ 刷新地图 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) showCallOut() → {Promise.<void>}

+ + + + + +
+ 显示callout +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/MapView.js.html b/API Doc/MapView.js.html new file mode 100644 index 00000000..43ba2dbc --- /dev/null +++ b/API Doc/MapView.js.html @@ -0,0 +1,142 @@ + + + + + JSDoc: Source: MapView.js + + + + + + + + + + +
+ +

Source: MapView.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ Description: iOS中该类只是一个概念虚类,实际功能由mapControl完成。
+ **********************************************************************************/
+import { NativeModules,Platform } from 'react-native';
+let MV = NativeModules.JSMapView;
+import MapControl from './MapControl.js';
+import Point2D from './Point2D.js';
+
+/**
+ * @class MapView
+ * @description 地图显示控件容器类。
+ */
+export default class JSMapView{
+    /**
+     * 获取地图控件。
+     * @memberOf MapView
+     * @returns {Promise.<MapControl>}
+     */
+    async getMapControl(){
+        try{
+            var {mapControlId} =await MV.getMapControl(this._SMMapViewId);
+            var mapControl = new MapControl();
+            mapControl._SMMapControlId = mapControlId;
+            return mapControl;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 在地图上添加一个点标记
+     * @memberOf MapView
+     * @param {object} point2D - 点标记
+     * @param {string} pointName - 点标记名称
+     * @returns {Promise.<Point2D>}
+     */
+    async addPoint(point2D,pointName){
+        try{
+            var {eth_point2DId} = await MV.addPoint(this._SMMapViewId,point2D._SMPoint2DId,pointName);
+            var point2D = new Point2D();
+            point2D._SMPoint2DId = eth_point2DId;
+            return point2D;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 刷新地图
+     * @memberOf MapView
+     * @returns {Promise.<void>}
+     */
+    async refresh(){
+        try{
+            await MV.refresh(this._SMMapViewId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 添加callout层
+     * @memberOf MapView
+     * @param {object} callOut - callOut对象
+     * @param {string} pointName - 点名称
+     * @returns {Promise.<void>}
+     */
+    async addCallOut(callOut,pointName){
+        try{
+            await MV.addCallOut(this._SMMapViewId,callOut._SMCallOutId,pointName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 显示callout
+     * @memberOf MapView
+     * @returns {Promise.<void>}
+     */
+    async showCallOut(){
+        try{
+            await MV.showCallOut(this._SMMapViewId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Navigation2.html b/API Doc/Navigation2.html new file mode 100644 index 00000000..786fc222 --- /dev/null +++ b/API Doc/Navigation2.html @@ -0,0 +1,3602 @@ + + + + + JSDoc: Class: Navigation2 + + + + + + + + + + +
+ +

Class: Navigation2

+ + + + + + +
+ +
+ +

Navigation2

+ + +
+ +
+
+ + + + + + + + + + + +
+ 行业导航类,提供基于拓扑路网的路径分析与导引。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) cleanPath() → {Promise.<GeoLine>}

+ + + + + +
+ 清除路径分析结果。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<GeoLine> + + +
+
+ + + + + + + + + + +

(static) enablePanOnGuide(pan) → {Promise.<void>}

+ + + + + +
+ 引导过程中是否允许平移地图。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pan + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getBarrierEdges() → {Promise.<void>}

+ + + + + +
+ 获取障碍边集合 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getBarrierPoints() → {Promise.<array>}

+ + + + + +
+ 获取障碍点集合 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<array> + + +
+
+ + + + + + + + + + +

(static) getRoute() → {Promise.<void>}

+ + + + + +
+ 获取路径分析线路。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) isGuiding() → {Promise.<Promise.yes>}

+ + + + + +
+ 判断是否正在进行引导。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.yes> + + +
+
+ + + + + + + + + + +

(static) loadModel(path) → {Promise.<void>}

+ + + + + +
+ 加载内存文件。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + 内存文件路径。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) locateMap() → {Promise.<void>}

+ + + + + +
+ 导航中,小车在屏幕中居中显示 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) pauseGuide() → {Promise.<void>}

+ + + + + +
+ 暂停导航 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) resumeGuide() → {Promise.<void>}

+ + + + + +
+ 继续导航 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) routeAnalyst() → {Promise.<Promise.boolean>}

+ + + + + +
+ 路径分析 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + +

(static) setAltimetricPointDataset(value) → {Promise.<void>}

+ + + + + +
+ 设置高程点数据集。可选。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +DatasetVector + + + + 转向表数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setBarrierEdges(value) → {Promise.<void>}

+ + + + + +
+ value:障碍边集合(参数为null时,为清空障碍边);其包含的int值为网络数据集中的线数据的SmID值 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +array + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setBarrierNodes(value) → {Promise.<void>}

+ + + + + +
+ 设置障碍节点 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +array + + + + 障碍节点集合(其包含的值为网络数据集中的节点数据的SmID值,number类型)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setBarrierPoints(barrierPoints) → {Promise.<void>}

+ + + + + +
+ 设置障碍点 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
barrierPoints + + +array + + + + 障碍点集合(参数为null时,为清空障碍点)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDestinationPoint(x, y, map) → {Promise.<void>}

+ + + + + +
+ 设置导航终点 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + 终点横坐标
y + + 终点纵坐标
map + + 导航所属地图对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDistanceChangeListener(events) → {Promise}

+ + + + + +
+ 用法:await industryNavi.setDistanceChangeListener({distanceChange:(e) => {console.log(e.distance}}) +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
events + + 离终点的距离变化监听器回调函数对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) setGPSData(newGps) → {Promise.<void>}

+ + + + + +
+ 设置GPS数据。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
newGps + + +object + + + + GPS数据。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setIsAutoNavi(isAutoNavi) → {Promise.<void>}

+ + + + + +
+ 设置是否自动采集GPS,设置为false时,需用户自己调用setGPSData传入GPS数据。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isAutoNavi + + +boolean + + + + 是否自动采集GPS,默认自动采集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setNetworkDataset(datasetVector) → {Promise.<void>}

+ + + + + +
+ 设置用于分析的网络数据集。必选。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + +object + + + + 网络数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setPathVisible(visible) → {Promise.<void>}

+ + + + + +
+ 设置路径可见 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
visible + + +boolean + + + + 设置分析路径是否可见。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSpeedField(value) → {Promise.<void>}

+ + + + + +
+ 设置最高限速字段 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +string + + + + 速度字段名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setStartPoint(x, y, map) → {Promise.<void>}

+ + + + + +
+ 设置导航起点 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + 起点横坐标
y + + 起点纵坐标
map + + 导航所属地图对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setTurnDataset(value) → {Promise.<void>}

+ + + + + +
+ 设置转向表数据集。可选。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +DatasetVector + + + + 转向表数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) startGuide(guideMode) → {Promise.<Promise.boolean>}

+ + + + + +
+ 开始导航 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
guideMode + + 导航模式:1:真实导航;2:模拟导航
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + +

(static) stopGuide() → {Promise.<Promise.boolean>}

+ + + + + +
+ 停止引导。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/OverlayAnalyst.html b/API Doc/OverlayAnalyst.html new file mode 100644 index 00000000..98dd4d04 --- /dev/null +++ b/API Doc/OverlayAnalyst.html @@ -0,0 +1,1597 @@ + + + + + JSDoc: Class: OverlayAnalyst + + + + + + + + + + +
+ +

Class: OverlayAnalyst

+ + + + + + +
+ +
+ +

OverlayAnalyst

+ + +
+ +
+
+ + + + + +

new OverlayAnalyst()

+ + + + + +
+ 叠加分析类(静态类) +该类用于对输入的两个数据集或记录集之间进行各种叠加分析运算,如裁剪(clip)、擦除(erase)、合并(union)、同一(identity)、对称差(xOR)和更新(update)。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) clip(datasetVector, clipDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 对矢量数据集进行裁剪,将被裁减数据集(第一个数据集)中不在裁剪数据集(第二个数据集)内的对象裁剪并删除。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + +object + + + + 被裁减的数据集,也称第一数据集。该数据集的类型可以是点、线和面。
clipDatasetVector + + +object + + + + 用于裁剪的数据集,也称第二数据集。该数据集类型必须是面。
resultDatasetVector + + +object + + + + 存放裁剪结果的数据集。
paramter + + +object + + + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。此处该对象设置无效。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) erase(datasetVector, eraseDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 用于对数据集进行擦除方式的叠加分析,将第一个数据集中包含在第二个数据集内的对象裁剪并删除。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + +object + + + + 被擦除的数据集,也称第一数据集。该数据集类型为点、线和面类型。
eraseDatasetVector + + +object + + + + 用于擦除的数据集,也称第二数据集。该数据集类型必须是面数据集类型。
resultDatasetVector + + +object + + + + 存放分析结果的数据集。
paramter + + +object + + + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) identity(datasetVector, identityDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 用于对数据集进行同一方式的叠加分析,结果数据集中保留被同一运算的数据集的全部对象和被同一运算的数据集与用来进行同一运算的数据集相交的对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + 被同一运算的数据集,可以是点、线、面类型。
identityDatasetVector + + 用来进行同一运算的数据集,必须为面类型。
resultDatasetVector + + 存放分析结果的数据集。
paramter + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) intersect(datasetVector, intersectDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 进行相交方式的叠加分析,将被相交叠加分析的数据集不包含在用来相交叠加分析的数据集中的对象切割并删除。即两个数据集中重叠的部分将被输出到结果数据集中,其余部分将被排除。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + 被相交叠加分析的数据集,该数据集的类型可以是点、线、面数据集。
intersectDatasetVector + + 用来相交叠加分析的数据集,该数据集必须是面数据集。
resultDatasetVector + + 存放分析结果的数据集。
paramter + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) union(datasetVector, unionDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 用于对两个面数据集进行合并方式的叠加分析,结果数据集中保存被合并叠加分析的数据集和用于合并叠加分析的数据集中的全部对象,并且对相交部分进行求交和分割运算。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + 被合并叠加分析的数据集,必须是面数据集类型。
unionDatasetVector + + 用于合并叠加分析的数据集,必须是面数据集类型。
resultDatasetVector + + 存放分析结果的数据集。
paramter + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) update(datasetVector, updateDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 用于对两个面数据集进行更新方式的叠加分析,更新运算时用用于更新的数据集替换与被更新数据集重合的部分,是一个先擦除后粘贴的过程。 +用于更新叠加分析的数据集、被更新叠加分析的数据集以及结果数据集的地理坐标系必须一致。 +第一数据集与第二数据集的类型都必须是面数据集。结果数据集中保留了更新数据集的几何形状和属性信息。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + 被更新叠加分析的数据集,必须是面类型。
updateDatasetVector + + 用于更新叠加分析的数据集,必须是面数据集。
resultDatasetVector + + 存放分析结果的数据集。
paramter + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) xOR(datasetVector, xORDatasetVector, resultDatasetVector, paramter) → {Promise.<boolean>}

+ + + + + +
+ 对两个面数据集进行对称差运算。即交集取反运算。 +用于对称差分析的数据集、被对称差分析的数据集以及结果数据集的地理坐标系必须一致。 +对称差运算是两个数据集的异或运算。操作结果是,对于每一个面对象,去掉其与另一个数据集中的几何对象相交的部分,而保留剩下的部分。对称差运算的输出结果的属性表包含两个输入数据集的非系统属性字段。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + 被对称差分析的原数据集,必须是面数据集。
xORDatasetVector + + 用于对称差分析的数据集,必须是面数据集。
resultDatasetVector + + 存放分析结果的数据集
paramter + + 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/OverlayAnalyst.js.html b/API Doc/OverlayAnalyst.js.html new file mode 100644 index 00000000..1ff4368d --- /dev/null +++ b/API Doc/OverlayAnalyst.js.html @@ -0,0 +1,203 @@ + + + + + JSDoc: Source: OverlayAnalyst.js + + + + + + + + + + +
+ +

Source: OverlayAnalyst.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let OA = NativeModules.JSOverlayAnalyst;
+
+/**
+ * @Class OverlayAnalyst
+ * @description 叠加分析类(静态类)
+ * 该类用于对输入的两个数据集或记录集之间进行各种叠加分析运算,如裁剪(clip)、擦除(erase)、合并(union)、同一(identity)、对称差(xOR)和更新(update)。
+ */
+export default class OverlayAnalyst {
+    /**
+     * 对矢量数据集进行裁剪,将被裁减数据集(第一个数据集)中不在裁剪数据集(第二个数据集)内的对象裁剪并删除。
+     * @memberOf OverlayAnalyst
+     * @param {object} datasetVector - 被裁减的数据集,也称第一数据集。该数据集的类型可以是点、线和面。
+     * @param {object} clipDatasetVector - 用于裁剪的数据集,也称第二数据集。该数据集类型必须是面。
+     * @param {object} resultDatasetVector - 存放裁剪结果的数据集。
+     * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。此处该对象设置无效。
+     * @returns {Promise.<boolean>}
+     */
+    async clip(datasetVector,clipDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {clipped} = await OA.clip(datasetVector._SMDatasetVectorId,clipDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return clipped;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于对数据集进行擦除方式的叠加分析,将第一个数据集中包含在第二个数据集内的对象裁剪并删除。
+     * @memberOf OverlayAnalyst
+     * @param {object} datasetVector - 被擦除的数据集,也称第一数据集。该数据集类型为点、线和面类型。
+     * @param {object} eraseDatasetVector - 用于擦除的数据集,也称第二数据集。该数据集类型必须是面数据集类型。
+     * @param {object} resultDatasetVector - 存放分析结果的数据集。
+     * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async erase(datasetVector,eraseDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {erased} = await OA.erase(datasetVector._SMDatasetVectorId,eraseDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return erased;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于对数据集进行同一方式的叠加分析,结果数据集中保留被同一运算的数据集的全部对象和被同一运算的数据集与用来进行同一运算的数据集相交的对象。
+     * @memberOf OverlayAnalyst
+     * @param datasetVector - 被同一运算的数据集,可以是点、线、面类型。
+     * @param identityDatasetVector - 用来进行同一运算的数据集,必须为面类型。
+     * @param resultDatasetVector - 存放分析结果的数据集。
+     * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async identity(datasetVector,identityDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {identified} = await OA.identity(datasetVector._SMDatasetVectorId,identityDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return identified;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 进行相交方式的叠加分析,将被相交叠加分析的数据集不包含在用来相交叠加分析的数据集中的对象切割并删除。即两个数据集中重叠的部分将被输出到结果数据集中,其余部分将被排除。
+     * @memberOf OverlayAnalyst
+     * @param datasetVector - 被相交叠加分析的数据集,该数据集的类型可以是点、线、面数据集。
+     * @param intersectDatasetVector - 用来相交叠加分析的数据集,该数据集必须是面数据集。
+     * @param resultDatasetVector - 存放分析结果的数据集。
+     * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async intersect(datasetVector,intersectDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {intersected} = await OA.intersect(datasetVector._SMDatasetVectorId,intersectDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return intersected;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于对两个面数据集进行合并方式的叠加分析,结果数据集中保存被合并叠加分析的数据集和用于合并叠加分析的数据集中的全部对象,并且对相交部分进行求交和分割运算。
+     * @memberOf OverlayAnalyst
+     * @param datasetVector - 被合并叠加分析的数据集,必须是面数据集类型。
+     * @param unionDatasetVector - 用于合并叠加分析的数据集,必须是面数据集类型。
+     * @param resultDatasetVector - 存放分析结果的数据集。
+     * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async union(datasetVector,unionDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {unioned} = await OA.union(datasetVector._SMDatasetVectorId,unionDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return unioned;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 用于对两个面数据集进行更新方式的叠加分析,更新运算时用用于更新的数据集替换与被更新数据集重合的部分,是一个先擦除后粘贴的过程。
+     * 用于更新叠加分析的数据集、被更新叠加分析的数据集以及结果数据集的地理坐标系必须一致。
+     * 第一数据集与第二数据集的类型都必须是面数据集。结果数据集中保留了更新数据集的几何形状和属性信息。
+     * @memberOf OverlayAnalyst
+     * @param datasetVector - 被更新叠加分析的数据集,必须是面类型。
+     * @param updateDatasetVector - 用于更新叠加分析的数据集,必须是面数据集。
+     * @param resultDatasetVector - 存放分析结果的数据集。
+     * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async update(datasetVector,updateDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {updated} = await OA.update(datasetVector._SMDatasetVectorId,updateDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return updated;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 对两个面数据集进行对称差运算。即交集取反运算。
+     * 用于对称差分析的数据集、被对称差分析的数据集以及结果数据集的地理坐标系必须一致。
+     * 对称差运算是两个数据集的异或运算。操作结果是,对于每一个面对象,去掉其与另一个数据集中的几何对象相交的部分,而保留剩下的部分。对称差运算的输出结果的属性表包含两个输入数据集的非系统属性字段。
+     * @memberOf OverlayAnalyst
+     * @param datasetVector - 被对称差分析的原数据集,必须是面数据集。
+     * @param xORDatasetVector - 用于对称差分析的数据集,必须是面数据集。
+     * @param resultDatasetVector - 存放分析结果的数据集
+     * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。
+     * @returns {Promise.<boolean>}
+     */
+    async xOR(datasetVector,xORDatasetVector,resultDatasetVector,paramter){
+        try{
+            var {finished} = await OA.xOR(datasetVector._SMDatasetVectorId,xORDatasetVector._SMDatasetVectorId,
+                resultDatasetVector._SMDatasetVectorId,paramter._SMOverlayAnalystParameterId);
+            return finished;
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/OverlayAnalystParameter.html b/API Doc/OverlayAnalystParameter.html new file mode 100644 index 00000000..08026897 --- /dev/null +++ b/API Doc/OverlayAnalystParameter.html @@ -0,0 +1,1004 @@ + + + + + JSDoc: Class: OverlayAnalystParameter + + + + + + + + + + +
+ +

Class: OverlayAnalystParameter

+ + + + + + +
+ +
+ +

OverlayAnalystParameter

+ + +
+ +
+
+ + + + + +

new OverlayAnalystParameter()

+ + + + + +
+ 叠加分析参数类。 + 该类主要提供进行叠加分析时,输出结果数据集的字段选择。在矢量叠加分析中,至少涉及到三个数据集,其中一个数据集的类型可以是点、线、面等,被称作输入数据集(在SuperMap GIS 中称作第一数据集);另一个数据集是面数据集被称作叠加数据集(在SuperMap GIS 中称作第二数据集);还有一个数据集就是叠加结果数据集 ,包含叠加后数据的几何信息和属性信息。叠加结果数据集中的属性信息来自于第一数据集和第二数据集的属性表,在进行叠加分析的时候,用户可以根据自己的需要在这两个数据集的属性表中选择需要保留的属性字段。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<object>}

+ + + + + +
+ 创建一个OverlayAnalystParameter对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<object> + + +
+
+ + + + + + + + + + +

(static) getOperationRetainedFields() → {Promise.<array.<string>>}

+ + + + + +
+ 返回进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<array.<string>> + + +
+
+ + + + + + + + + + +

(static) getSourceRetainedFields() → {Promise.<Promise.fields>}

+ + + + + +
+ 返回进行叠加分析的第一数据集或记录集中需要保留的字段名称集合。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.fields> + + +
+
+ + + + + + + + + + +

(static) getTolerance() → {Promise.<void>}

+ + + + + +
+ 返回叠加分析的容限值。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setOperationRetainedFields(fields) → {Promise.<void>}

+ + + + + +
+ 设置进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + 进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSourceRetainedFields(fields) → {Promise.<void>}

+ + + + + +
+ 设置进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + 进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setTolerance(rate) → {Promise.<void>}

+ + + + + +
+ 设置叠加分析的容限值。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rate + + +number + + + + 叠加分析的容限值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/OverlayAnalystParameter.js.html b/API Doc/OverlayAnalystParameter.js.html new file mode 100644 index 00000000..5affd519 --- /dev/null +++ b/API Doc/OverlayAnalystParameter.js.html @@ -0,0 +1,166 @@ + + + + + JSDoc: Source: OverlayAnalystParameter.js + + + + + + + + + + +
+ +

Source: OverlayAnalystParameter.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let OAP = NativeModules.JSOverlayAnalystParameter;
+
+/**
+ * @class OverlayAnalystParameter
+ * @description 叠加分析参数类。
+    该类主要提供进行叠加分析时,输出结果数据集的字段选择。在矢量叠加分析中,至少涉及到三个数据集,其中一个数据集的类型可以是点、线、面等,被称作输入数据集(在SuperMap GIS 中称作第一数据集);另一个数据集是面数据集被称作叠加数据集(在SuperMap GIS 中称作第二数据集);还有一个数据集就是叠加结果数据集 ,包含叠加后数据的几何信息和属性信息。叠加结果数据集中的属性信息来自于第一数据集和第二数据集的属性表,在进行叠加分析的时候,用户可以根据自己的需要在这两个数据集的属性表中选择需要保留的属性字段。
+ */
+export default class OverlayAnalystParameter {
+    /**
+     * 创建一个OverlayAnalystParameter对象
+     * @memberOf OverlayAnalystParameter
+     * @returns {Promise.<object>}
+     */
+    async createObj(){
+        try{
+            var {overlayAnalystParameterId} = await OAP.createObj();
+            var overlayAnalystParameter = new OverlayAnalystParameter();
+            overlayAnalystParameter._SMOverlayAnalystParameterId = overlayAnalystParameterId;
+            return overlayAnalystParameter;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置叠加分析的容限值。
+     * @memberOf OverlayAnalystParameter
+     * @param {number} rate - 叠加分析的容限值。
+     * @returns {Promise.<void>}
+     */
+    async setTolerance(rate){
+        try{
+            await OAP.setTolerance(this._SMOverlayAnalystParameterId,rate);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回叠加分析的容限值。
+     * @memberOf OverlayAnalystParameter
+     * @returns {Promise.<void>}
+     */
+    async getTolerance(){
+        try{
+            var {tolerance} = await OAP.getTolerance(this._SMOverlayAnalystParameterId);
+            return tolerance;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+     * @memberOf OverlayAnalystParameter
+     * @returns {Promise.<array<string>>}
+     */
+    async getOperationRetainedFields(){
+        try{
+            var {fields} = await OAP.getOperationRetainedFields(this._SMOverlayAnalystParameterId);
+            return fields;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+     * @memberOf OverlayAnalystParameter
+     * @param fields - 进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+     * @returns {Promise.<void>}
+     */
+    async setOperationRetainedFields(fields){
+        try{
+            await OAP.setOperationRetainedFields(this._SMOverlayAnalystParameterId,fields);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回进行叠加分析的第一数据集或记录集中需要保留的字段名称集合。
+     * @memberOf OverlayAnalystParameter
+     * @returns {Promise.<Promise.fields>}
+     */
+    async getSourceRetainedFields(){
+        try{
+            var {fields} = await OAP.getSourceRetainedFields(this._SMOverlayAnalystParameterId);
+            return fields;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+     * @memberOf OverlayAnalystParameter
+     * @param fields - 进行叠加分析的第二数据集或记录集中需要保留的字段名称集合。
+     * @returns {Promise.<void>}
+     */
+    async setSourceRetainedFields(fields){
+        try{
+            await OAP.setSourceRetainedFields(this._SMOverlayAnalystParameterId,fields);
+        }catch(e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Point.html b/API Doc/Point.html new file mode 100644 index 00000000..98f64d5a --- /dev/null +++ b/API Doc/Point.html @@ -0,0 +1,330 @@ + + + + + JSDoc: Class: Point + + + + + + + + + + +
+ +

Class: Point

+ + + + + + +
+ +
+ +

Point

+ + +
+ +
+
+ + + + + +

new Point()

+ + + + + +
+ 像素点类。用于标示移动设备屏幕的像素点。(该类已经被废弃,计划下个大版本进行移除) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(x, y) → {Promise.<Point>}

+ + + + + +
+ 创建一个Point对象 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + 像素坐标 x 的值
y + + 像素坐标 y 的值
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Point.js.html b/API Doc/Point.js.html new file mode 100644 index 00000000..87e8e5b6 --- /dev/null +++ b/API Doc/Point.js.html @@ -0,0 +1,84 @@ + + + + + JSDoc: Source: Point.js + + + + + + + + + + +
+ +

Source: Point.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ Description:该类已经被废弃,计划下个大版本进行移除
+ **********************************************************************************/
+import { NativeModules } from 'react-native';
+let P = NativeModules.JSPoint;
+
+/**
+ * @class Point
+ * @deprecated
+ * @description 像素点类。用于标示移动设备屏幕的像素点。(该类已经被废弃,计划下个大版本进行移除)
+ */
+export default class Point{
+    /**
+     * 创建一个Point对象
+     * @memberOf Point
+     * @param x - 像素坐标 x 的值
+     * @param y - 像素坐标 y 的值
+     * @returns {Promise.<Point>}
+     */
+    async createObj(x,y){
+        try{
+            var {pointId} = await P.createObj(x,y);
+            var point = new Point();
+            point._SMPointId = pointId;
+            return point;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Point2D.html b/API Doc/Point2D.html new file mode 100644 index 00000000..d3b9321d --- /dev/null +++ b/API Doc/Point2D.html @@ -0,0 +1,266 @@ + + + + + JSDoc: Class: Point2D + + + + + + + + + + +
+ +

Class: Point2D

+ + + + + + +
+ +
+ +

Point2D

+ + +
+ +
+
+ + + + + +

new Point2D()

+ + + + + +
+ 点类。点类的的实例为点对象,用于表示坐标值为双精度的点对象,即其坐标值的范围为±5.0*1e-324到±1.7*1e308,有效位为15-16位。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<Point2D>}

+ + + + + +
+ 构造一个新的 Point2D 对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Point2D> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Point2D.js.html b/API Doc/Point2D.js.html new file mode 100644 index 00000000..4d4e66f5 --- /dev/null +++ b/API Doc/Point2D.js.html @@ -0,0 +1,88 @@ + + + + + JSDoc: Source: Point2D.js + + + + + + + + + + +
+ +

Source: Point2D.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let X = NativeModules.JSPoint2D;
+
+/**
+ * @class Point2D 
+ * @description 点类。点类的的实例为点对象,用于表示坐标值为双精度的点对象,即其坐标值的范围为±5.0*1e-324到±1.7*1e308,有效位为15-16位。
+ */
+export default class Point2D {
+    /**
+     * 构造一个新的 Point2D 对象。
+     * @memberOf Point2D
+     * @returns {Promise.<Point2D>}
+     */
+    async createObj(){
+        try{
+            if(typeof arguments[0] == 'number' && typeof arguments[1] == 'number'){
+                var {point2DId} = await X.createObjByXY(arguments[0],arguments[1]);
+                var point2D = new Point2D();
+                point2D._SMPoint2DId = point2DId;
+                return point2D;
+            }else{
+                var {point2DId} = await X.createObj();
+                var point2D = new Point2D();
+                point2D._SMPoint2DId = point2DId;
+                return point2D;
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/QueryParameter.html b/API Doc/QueryParameter.html new file mode 100644 index 00000000..faf6a9b4 --- /dev/null +++ b/API Doc/QueryParameter.html @@ -0,0 +1,1307 @@ + + + + + JSDoc: Class: QueryParameter + + + + + + + + + + +
+ +

Class: QueryParameter

+ + + + + + +
+ +
+ +

QueryParameter

+ + +
+ +
+
+ + + + + +

new QueryParameter()

+ + + + + +
+ 查询参数类。 + 用于描述一个条件查询的限制条件,如所包含的 SQL 语句,游标方式等。 + 条件查询,是查询满足一定条件的所有要素的记录,其查询得到的结果是记录集。查询参数类是用来设置条件查询的查询条件从而得到记录集。 + SQL查询,又称属性查询,即通过构建包含属性字段、运算符号和数值的 SQL 条件语句来选择记录,从而得到记录集。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<QueryParameter>}

+ + + + + +
+ 创建一个QueryParameter对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<QueryParameter> + + +
+
+ + + + + + + + + + +

(static) setAttributeFilter(attributeFilter) → {Promise.<void>}

+ + + + + +
+ 设置属性过滤器 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
attributeFilter + + +string + + + + 被过滤的字段
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setGroupBy(groups) → {Promise.<void>}

+ + + + + +
+ 设置Group聚合项 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
groups + + +Array.<string> + + + + 传入要聚合的属性
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setHasGeometry(has) → {Promise.<void>}

+ + + + + +
+ 设置查询结果是否包含矢量 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
has + + +boolean + + + + 是否包含矢量
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setOrderBy(fields) → {Promise.<void>}

+ + + + + +
+ 设置返回结果排序 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + +Array.<string> + + + + 设置排序的字段名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setResultFields(fields) → {Promise.<void>}

+ + + + + +
+ 设置结果集字段 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + +Array.<string> + + + + 设置返回的字段名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSpatialQueryMode(mode) → {Promise.<void>}

+ + + + + +
+ 设置空间查询对象模式 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + 传入空间查询模式
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSpatialQueryObject(geometry) → {Promise.<void>}

+ + + + + +
+ 设置空间查询对象 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geometry + + +object + + + + 传入空间查询对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/QueryParameter.js.html b/API Doc/QueryParameter.js.html new file mode 100644 index 00000000..e4433dde --- /dev/null +++ b/API Doc/QueryParameter.js.html @@ -0,0 +1,208 @@ + + + + + JSDoc: Source: QueryParameter.js + + + + + + + + + + +
+ +

Source: QueryParameter.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let QP = NativeModules.JSQueryParameter;
+const NAME_QUERYPARAMETER = "QueryParameter";
+
+/**
+ * @class QueryParameter 
+ * @description 查询参数类。
+  用于描述一个条件查询的限制条件,如所包含的 SQL 语句,游标方式等。
+  条件查询,是查询满足一定条件的所有要素的记录,其查询得到的结果是记录集。查询参数类是用来设置条件查询的查询条件从而得到记录集。
+  SQL查询,又称属性查询,即通过构建包含属性字段、运算符号和数值的 SQL 条件语句来选择记录,从而得到记录集。
+ */
+export default class QueryParameter {
+
+    /**
+     * 创建一个QueryParameter对象
+     * @memberOf QueryParameter
+     * @returns {Promise.<QueryParameter>}
+     */
+    async createObj(){
+        try{
+            var {queryParameterId} = await QP.createObj();
+            var queryParameter = new QueryParameter();
+            queryParameter._SMQueryParameterId = queryParameterId;
+            //Return records in batches. by default, 20 records
+            //first batch would be return(initial with "1")
+            queryParameter.size = 10;
+            queryParameter.batch = 1;
+            return queryParameter;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置属性过滤器
+     * @memberOf QueryParameter
+     * @param {string} attributeFilter - 被过滤的字段
+     * @returns {Promise.<void>}
+     */
+    async setAttributeFilter (attributeFilter){
+        try{
+            typeof attributeFilter == "string" &&
+                await QP.setAttributeFilter(this._SMQueryParameterId,attributeFilter);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置Group聚合项
+     * @memberOf QueryParameter
+     * @param {string[]} groups - 传入要聚合的属性
+     * @returns {Promise.<void>}
+     */
+    async setGroupBy(groups){
+        try{
+            if(testArray(groups)){
+                await QP.setGroupBy(this._SMQueryParameterId,groups);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询结果是否包含矢量
+     * @memberOf QueryParameter
+     * @param {boolean} has - 是否包含矢量
+     * @returns {Promise.<void>}
+     */
+    async setHasGeometry(has){
+        try{
+            await QP.setHasGeometry(this._SMQueryParameterId,has);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置结果集字段
+     * @memberOf QueryParameter
+     * @param {string[]} fields - 设置返回的字段名称
+     * @returns {Promise.<void>}
+     */
+    async setResultFields(fields){
+        try{
+            if(testArray(fields)){
+                await QP.setResultFields(this._SMQueryParameterId,fields);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置返回结果排序
+     * @memberOf QueryParameter
+     * @param {string[]} fields - 设置排序的字段名称
+     * @returns {Promise.<void>}
+     */
+    async setOrderBy(fields){
+        try{
+            if(testArray(fields)){
+                await QP.setOrderBy(this._SMQueryParameterId,fields);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置空间查询对象
+     * @memberOf QueryParameter
+     * @param {object} geometry - 传入空间查询对象
+     * @returns {Promise.<void>}
+     */
+    async setSpatialQueryObject(geometry){
+        try{
+            await QP.setSpatialQueryObject(this._SMQueryParameterId,geometry._SMGeometryId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *设置空间查询对象模式
+     * @memberOf QueryParameter
+     * @param mode - 传入空间查询模式
+     * @returns {Promise.<void>}
+     */
+    async setSpatialQueryMode(mode){
+        try{
+            console.log("QueryParameter:" + mode);
+            typeof mode == "number" && await QP.setSpatialQueryMode(this._SMQueryParameterId,mode);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+function testArray(arr) {
+    if(!(arr instanceof Array)){
+        console.error(NAME_QUERYPARAMETER + ":only accept a array as the args.");
+        return false;
+    }else if(arr.length < 1){
+        console.error(NAME_QUERYPARAMETER + ":this is an empty array.");
+        return false;
+    }else{
+        return true;
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/QueryService.html b/API Doc/QueryService.html new file mode 100644 index 00000000..7d52b164 --- /dev/null +++ b/API Doc/QueryService.html @@ -0,0 +1,768 @@ + + + + + JSDoc: Class: QueryService + + + + + + + + + + +
+ +

Class: QueryService

+ + + + + + +
+ +
+ +

QueryService

+ + +
+ +
+
+ + + + + +

new QueryService()

+ + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
QueryMode.SqlQuery + + 查询模式:SQL查询
QueryMode.FindNearest + + 查询模式:最近地物查询
QueryMode.DistanceQuery + + 查询模式:距离查询
QueryMode.SpatialQuery + + 查询模式:空间查询
QueryMode.BoundsQuery + + 范围查询:范围查询
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(url) → {Promise.<QueryService>}

+ + + + + +
+ 根据查询路径创建一个QueryService对象 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<QueryService> + + +
+
+ + + + + + + + + + +

(static) query(serviceQueryParameter, mode) → {Promise.<*>}

+ + + + + +
+ 对Rest地图服务进行查询。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceQueryParameter + + 查询参数{@ling QueryParameter}。
mode + + 查询模式QueryMode
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + +

(static) queryByUrl(url, serviceQueryParameter, mode) → {Promise.<*>}

+ + + + + +
+ 对Rest地图服务进行查询。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + 地图服务的全地址 :如:http://192.168.120.1:8090/iserver/services/map-world/rest/maps/World。
serviceQueryParameter + + 查询参数。
mode + + 查询模式。
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/QueryService.js.html b/API Doc/QueryService.js.html new file mode 100644 index 00000000..63fd52e8 --- /dev/null +++ b/API Doc/QueryService.js.html @@ -0,0 +1,136 @@ + + + + + JSDoc: Source: QueryService.js + + + + + + + + + + +
+ +

Source: QueryService.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let SS = NativeModules.JSQueryService;
+import ServiceBase from './ServiceBase.js';
+/**
+ * @class QueryService
+ * @param QueryMode.SqlQuery -  查询模式:SQL查询
+ * @param QueryMode.FindNearest -  查询模式:最近地物查询
+ * @param QueryMode.DistanceQuery - 查询模式:距离查询
+ * @param QueryMode.SpatialQuery - 查询模式:空间查询
+ * @param QueryMode.BoundsQuery - 范围查询:范围查询
+ *
+ */
+export default class QueryService extends ServiceBase{
+    constructor(){
+        super();
+        //同步子类Id和父类Id
+        Object.defineProperty(this,"_SMQueryServiceId",{
+                              get:function () {
+                              return this._SMServiceBaseId
+                              },
+                              set:function (_SMQueryServiceId) {
+                              this._SMServiceBaseId = _SMQueryServiceId;
+                              }
+                              })
+    }
+    /**
+     * 根据查询路径创建一个QueryService对象
+     * @memberOf QueryService
+     * @param url
+     * @returns {Promise.<QueryService>}
+     */
+    async createObj(url) {
+        try {
+            var {_queryServiceId_} = await SS.createObj(url);
+            var queryService = new QueryService();
+            queryService._SMQueryServiceId = _queryServiceId_;
+            return queryService;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 对Rest地图服务进行查询。
+     * @deprecated
+     * @memberOf QueryService
+     * @param serviceQueryParameter - 查询参数{@ling QueryParameter}。
+     * @param mode - 查询模式QueryMode
+     * @returns {Promise.<*>}
+     */
+    async query(serviceQueryParameter, mode) {
+        try {
+            await SS.query(this._SMQueryServiceId,
+                serviceQueryParameter._SMServiceQueryParameterId, mode);
+            return queryService;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 对Rest地图服务进行查询。
+     * @deprecated
+     * @memberOf QueryService
+     * @param url - 地图服务的全地址 :如:http://192.168.120.1:8090/iserver/services/map-world/rest/maps/World。
+     * @param serviceQueryParameter - 查询参数。
+     * @param mode - 查询模式。
+     * @returns {Promise.<*>}
+     */
+    async queryByUrl(url, serviceQueryParameter, mode) {
+        try {
+            await SS.queryByUrl(this._SMQueryServiceId, url,
+                serviceQueryParameter._SMServiceQueryParameterId, mode);
+            return queryService;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Rectangle2D.html b/API Doc/Rectangle2D.html new file mode 100644 index 00000000..a3ce41f1 --- /dev/null +++ b/API Doc/Rectangle2D.html @@ -0,0 +1,338 @@ + + + + + JSDoc: Class: Rectangle2D + + + + + + + + + + +
+ +

Class: Rectangle2D

+ + + + + + +
+ +
+ +

Rectangle2D

+ + +
+ +
+
+ + + + + +

new Rectangle2D()

+ + + + + +
+ 矩形类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(point2D, point2D) → {Promise.<*>}

+ + + + + +
+ 创建一个Rectangle2D矩形实例 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
point2D + + +object + + + + 左下点,可选
point2D + + +object + + + + 右上点,可选
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<*> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Rectangle2D.js.html b/API Doc/Rectangle2D.js.html new file mode 100644 index 00000000..3fbe36ff --- /dev/null +++ b/API Doc/Rectangle2D.js.html @@ -0,0 +1,95 @@ + + + + + JSDoc: Source: Rectangle2D.js + + + + + + + + + + +
+ +

Source: Rectangle2D.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let R = NativeModules.JSRectangle2D;
+import Point2D from './Point2D.js';
+
+/**
+ * @class Rectangle2D
+ * @description 矩形类。
+ */
+export default class Rectangle2D {
+    /**
+     * 创建一个Rectangle2D矩形实例
+     * @memberOf Rectangle2D
+     * @param {object} point2D - 左下点,可选
+     * @param {object} point2D - 右上点,可选
+     * @returns {Promise.<*>}
+     */
+    async createObj(){
+        try{
+            if(arguments[0] instanceof Point2D && arguments[1] instanceof Point2D){
+                console.log('create by two Point2D objects.');
+                var {rectangle2DId} = await R.createObjBy2Pt(arguments[0].point2DId,arguments[1].point2DId);
+                return this.returnObj(rectangle2DId);
+            }else{
+                console.log('create with nothing.');
+                var {rectangle2DId} = await R.createObj();
+                return this.returnObj(rectangle2DId);
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    returnObj(rectangle2DId){
+        var rectangle2D = new Rectangle2D();
+        rectangle2D._SMRectangle2DId = rectangle2DId;
+        return rectangle2D;
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Scene.html b/API Doc/Scene.html new file mode 100644 index 00000000..73662e76 --- /dev/null +++ b/API Doc/Scene.html @@ -0,0 +1,1438 @@ + + + + + JSDoc: Class: Scene + + + + + + + + + + +
+ +

Class: Scene

+ + + + + + +
+ +
+ +

Scene

+ + +
+ +
+
+ + + + + +

new Scene()

+ + + + + +
+ 三维场景类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) close() → {Promise.<void>}

+ + + + + +
+ 关闭当前场景 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) dispose() → {Promise.<void>}

+ + + + + +
+ 释放该对象所占用的资源 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) ensureVisible(visibleBounds) → {Promise.<void>}

+ + + + + +
+ 根据经纬度范围显示场景。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
visibleBounds + + +object + + + + rectangle2D对象,包含如下属性:{top:--,left:--,right:--,bottom:--}
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getWorkspace() → {Promise.<Workspace>}

+ + + + + +
+ 返回三维场景所关联的工作空间。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Workspace> + + +
+
+ + + + + + + + + + +

(static) open(iserverUrl,opt) → {Promise.<boolean>}

+ + + + + +
+ 根据提供的场景名称打开三维地图 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
iserverUrl, + + +string + + + + + + <optional>
+ + + + + +
sceneName [,password] - 只有一个参数时: 场景名称。 +两个参数时:(iserverUrl,sceneName) iserverUrl - 三维服务URL地址;sceneName - 场景名称。 +三个参数时:(iserverUrl,sceneName,passWord ) iserverUrl - 三维服务URL地址;sceneName - 场景名称; passWord - 场景密码,默认密码是“supermap”。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) pan(offsetLongitude, offsetLatitude) → {Promise.<void>}

+ + + + + +
+ 平移三维场景。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
offsetLongitude + + 指定的经向平移距离。
offsetLatitude + + 指定的纬向平移距离。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) refresh() → {Promise.<void>}

+ + + + + +
+ 刷新三维场景 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setWorkspace(workspace) → {Promise.<void>}

+ + + + + +
+ 设置工作空间 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
workspace + + +object + + + + 工作空间对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) viewEntire() → {Promise.<void>}

+ + + + + +
+ 全幅显示此场景。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) zoom(ratio) → {Promise.<void>}

+ + + + + +
+ 根据给定的缩放比例,对三维地图场景进行缩放操作 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ratio + + +double + + + + 指定的缩放比例数值。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Scene.js.html b/API Doc/Scene.js.html new file mode 100644 index 00000000..e015ee88 --- /dev/null +++ b/API Doc/Scene.js.html @@ -0,0 +1,218 @@ + + + + + JSDoc: Source: Scene.js + + + + + + + + + + +
+ +

Source: Scene.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let S = NativeModules.JSScene;
+import Workspace from './Workspace';
+/**
+ * @class Scene
+ * @description 三维场景类。
+ */
+export default class Scene {
+    /**
+     * 设置工作空间
+     * @memberOf Scene
+     * @param {object} workspace - 工作空间对象
+     * @returns {Promise.<void>}
+     */
+    async setWorkspace(workspace){
+        try{
+            await S.setWorkspace(this._SMSceneId,workspace._SMWorkspaceId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回三维场景所关联的工作空间。
+     * @memberOf Scene
+     * @returns {Promise.<Workspace>}
+     */
+    async getWorkspace(){
+        try{
+            var {workspaceId} = await S.setWorkspace(this._SMSceneId);
+            var workspace = new Workspace();
+            workspace._SMWorkspaceId = workspaceId;
+
+            return workspace;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据提供的场景名称打开三维地图
+     * @memberOf Scene
+     * @param {string} [iserverUrl,] sceneName [,password] - 只有一个参数时: 场景名称。
+     * 两个参数时:(iserverUrl,sceneName) iserverUrl - 三维服务URL地址;sceneName - 场景名称。
+     * 三个参数时:(iserverUrl,sceneName,passWord ) iserverUrl - 三维服务URL地址;sceneName - 场景名称; passWord - 场景密码,默认密码是“supermap”。
+     * @returns {Promise.<boolean>}
+     */
+    async open(){
+        try{
+            if(arguments.length == 1){
+                var {opened} = await S.open(this._SMSceneId,arguments[0]);
+                return opened;
+            }else if(arguments.length == 2){
+                var {opened} = await S.open2(this._SMSceneId,arguments[0],arguments[1]);
+                return opened;
+            }else if(arguments.length == 3){
+                var {opened} = await S.open3(this._SMSceneId,arguments[0],arguments[1],arguments[2]);
+                return opened;
+            }else{
+                throw new Error("Scene opened Error: Please input 1-3 arguments.read the specification please")
+            }
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据经纬度范围显示场景。
+     * @memberOf Scene
+     * @param {object} visibleBounds - rectangle2D对象,包含如下属性:{top:--,left:--,right:--,bottom:--}
+     * @returns {Promise.<void>}
+     */
+    async ensureVisible(visibleBounds){
+        try{
+            await S.ensureVisible(this._SMSceneId,visibleBounds);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 刷新三维场景
+     * @memberOf Scene
+     * @returns {Promise.<void>}
+     */
+    async refresh(){
+        try{
+            await S.refresh(this._SMSceneId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 平移三维场景。
+     * @memberOf Scene
+     * @param offsetLongitude - 指定的经向平移距离。
+     * @param offsetLatitude - 指定的纬向平移距离。
+     * @returns {Promise.<void>}
+     */
+    async pan(offsetLongitude,offsetLatitude){
+        try{
+            await S.pan(this._SMSceneId,offsetLongitude,offsetLatitude);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 全幅显示此场景。
+     * @memberOf Scene
+     * @returns {Promise.<void>}
+     */
+    async viewEntire(){
+        try{
+            await S.viewEntire(this._SMSceneId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据给定的缩放比例,对三维地图场景进行缩放操作
+     * @memberOf Scene
+     * @param {double} ratio - 指定的缩放比例数值。
+     * @returns {Promise.<void>}
+     */
+    async zoom(ratio){
+        try{
+            await S.zoom(this._SMSceneId,ratio);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 关闭当前场景
+     * @memberOf Scene
+     * @returns {Promise.<void>}
+     */
+    async close(){
+        try{
+            await S.close(this._SMSceneId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 释放该对象所占用的资源
+     * @memberOf Scene
+     * @returns {Promise.<void>}
+     */
+    async dispose(){
+        try{
+            await S.dispose(this._SMSceneId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Selection.html b/API Doc/Selection.html new file mode 100644 index 00000000..b3143b24 --- /dev/null +++ b/API Doc/Selection.html @@ -0,0 +1,819 @@ + + + + + JSDoc: Class: Selection + + + + + + + + + + +
+ +

Class: Selection

+ + + + + + +
+ +
+ +

Selection

+ + +
+ +
+
+ + + + + +

new Selection()

+ + + + + +
+ 选择集类。该类用于处理地图上被选中的对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) clear() → {Promise.<void>}

+ + + + + +
+ 清空选择对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) fromQueryResult(result) → {Promise.<Promise.fromRecordset>}

+ + + + + +
+ 从查询结果获取地图被选要素 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
result + + +object + + + + 经DataVector的query方法查询出的结果
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.fromRecordset> + + +
+
+ + + + + + + + + + +

(static) fromRecordset(recordset) → {Promise.<Promise.fromRecordset>}

+ + + + + +
+ 将记录集转换成Selection +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
recordset + + +object + + + + 记录集
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.fromRecordset> + + +
+
+ + + + + + + + + + +

(static) setStyle(geoStyle) → {Promise.<void>}

+ + + + + +
+ 设置样式风格 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geoStyle + + +object + + + + 样式风格
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) toRecordset() → {Promise.<Recordset>}

+ + + + + +
+ 转成recordset数据集 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Recordset> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Selection.js.html b/API Doc/Selection.js.html new file mode 100644 index 00000000..910e5aa2 --- /dev/null +++ b/API Doc/Selection.js.html @@ -0,0 +1,142 @@ + + + + + JSDoc: Source: Selection.js + + + + + + + + + + +
+ +

Source: Selection.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let S = NativeModules.JSSelection;
+import Recordset from './Recordset.js';
+
+/**
+ * @class Selection
+ * @description 选择集类。该类用于处理地图上被选中的对象。
+ */
+export default class Selection {
+    /**
+     * 将记录集转换成Selection
+     * @deprecated
+     * @memberOf Selection
+     * @param {object} recordset - 记录集
+     * @returns {Promise.<Promise.fromRecordset>}
+     */
+    async fromRecordset(recordset){
+        try{
+            let {fromRecordset} = await S.fromRecordset(this._SMSelectionId,recordset._SMRecordsetId);
+            return fromRecordset;
+        }catch(e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 设置样式风格
+     * @memberOf Selection
+     * @param {object} geoStyle - 样式风格
+     * @returns {Promise.<void>}
+     */
+    async setStyle(geoStyle){
+        try{
+            await S.setStyle(this._SMSelectionId,geoStyle._SMGeoStyleId);
+        }catch(e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 清空选择对象
+     * @memberOf Selection
+     * @returns {Promise.<void>}
+     */
+    async clear(){
+        try{
+            await S.clear(this._SMSelectionId);
+        }catch(e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 转成recordset数据集
+     * @deprecated
+     * @memberOf Selection
+     * @returns {Promise.<Recordset>}
+     */
+    async toRecordset(){
+        try{
+            var {recordsetId} = await S.toRecordset(this._SMSelectionId);
+            var recordset = new Recordset();
+            recordset._SMRecordsetId = recordsetId;
+            return recordset;
+        }catch(e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 从查询结果获取地图被选要素
+     * @deprecated
+     * @memberOf Selection
+     * @param {object} result - 经DataVector的query方法查询出的结果
+     * @returns {Promise.<Promise.fromRecordset>}
+     */
+    async fromQueryResult(result){
+        try{
+            let {fromRecordset} = await S.fromRecordset(this._SMSelectionId,result._SMRecordsetId);
+            return fromRecordset;
+        }catch(e){
+            console.log(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/ServiceBase.html b/API Doc/ServiceBase.html new file mode 100644 index 00000000..fbf03046 --- /dev/null +++ b/API Doc/ServiceBase.html @@ -0,0 +1,776 @@ + + + + + JSDoc: Class: ServiceBase + + + + + + + + + + +
+ +

Class: ServiceBase

+ + + + + + +
+ +
+ +

ServiceBase

+ + +
+ +
+
+ + + + + +

new ServiceBase()

+ + + + + +
+ iServer 所有服务的基类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) getUrl() → {Promise}

+ + + + + +
+ 获得URL远程路径 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) setResponseCallback(requestFailed, requestSuccess, receiveResponse, dataServiceFinished) → {Promise.<void>}

+ + + + + +
+ 设置相应回调 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
requestFailed + + +function + + + + 请求失败处理函数
requestSuccess + + +function + + + + 请求成功处理函数
receiveResponse + + +function + + + + 接受响应处理函数
dataServiceFinished + + +function + + + + 数据服务完成处理函数
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - +
+ + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setServerName(serverName) → {Promise.<void>}

+ + + + + +
+ 设置服务器名称 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serverName + + 服务器名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setUrl(url) → {Promise.<void>}

+ + + + + +
+ 设置URL远程路径 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + URL路径
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/ServiceBase.js.html b/API Doc/ServiceBase.js.html new file mode 100644 index 00000000..24030467 --- /dev/null +++ b/API Doc/ServiceBase.js.html @@ -0,0 +1,152 @@ + + + + + JSDoc: Source: ServiceBase.js + + + + + + + + + + +
+ +

Source: ServiceBase.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let SB = NativeModules.JSServiceBase;
+
+/**
+ * @class ServiceBase
+ * @description iServer 所有服务的基类。
+ */
+export default class ServiceBase {
+    /**
+     * 获得URL远程路径
+     * @memberOf ServiceBase
+     * @returns {Promise}
+     */
+    async getUrl(){
+        try{
+            var url = await SB.getUrl(this._SMServiceBaseId);
+            return url;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置URL远程路径
+     * @memberOf ServiceBase
+     * @param url - URL路径
+     * @returns {Promise.<void>}
+     */
+    async setUrl(url){
+        try{
+            await SB.setUrl(this._SMServiceBaseId,url);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置服务器名称
+     * @memberOf ServiceBase
+     * @param serverName - 服务器名称
+     * @returns {Promise.<void>}
+     */
+    async setServerName(serverName){
+        try{
+            await SB.setServerName(this._SMServiceBaseId,serverName);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置相应回调
+     * @memberOf ServiceBase
+     * @param {function} requestFailed - 请求失败处理函数
+     * @param {function} requestSuccess - 请求成功处理函数
+     * @param {function} receiveResponse - 接受响应处理函数
+     * @param {function} dataServiceFinished - 数据服务完成处理函数
+     * @returns {Promise.<void>} -
+     */
+    async setResponseCallback(requestFailed,requestSuccess,receiveResponse,dataServiceFinished){
+        try {
+            DeviceEventEmitter.addListener(this.REQUESTFAILED,function (e) {
+                if(typeof requestFailed == 'function'){
+                    requestFailed(e);
+                }else{
+                    console.error("Could not find the first argument.");
+                }
+            });
+            DeviceEventEmitter.addListener(this.REQUESTSUCCESS,function (e) {
+                if(typeof requestSuccess == 'function'){
+                    requestSuccess(e);
+                }else{
+                    console.error("Could not find the second argument.");
+                }
+            });
+            DeviceEventEmitter.addListener(this.RECEIVERESPONSE,function (e) {
+                if(typeof receiveResponse == 'function'){
+                    receiveResponse(e);
+                }else{
+                    console.error("Could not find the second argument.");
+                }
+            });
+            DeviceEventEmitter.addListener(this.DATASERVICEFINISHED,function (e) {
+                if(typeof dataServiceFinished == 'function'){
+                    dataServiceFinished(e);
+                }else{
+                    console.error("Could not find the second argument.");
+                }
+            });
+        }catch(e){
+            console.error(e);
+        }
+
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/ServiceQueryParameter.html b/API Doc/ServiceQueryParameter.html new file mode 100644 index 00000000..ef878aa8 --- /dev/null +++ b/API Doc/ServiceQueryParameter.html @@ -0,0 +1,2452 @@ + + + + + JSDoc: Class: ServiceQueryParameter + + + + + + + + + + +
+ +

Class: ServiceQueryParameter

+ + + + + + +
+ +
+ +

ServiceQueryParameter

+ + +
+ +
+
+ + + + + +

new ServiceQueryParameter()

+ + + + + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
QueryOptionType.ATTRIBUTE + + +number + + + + 查询结果中只有属性。
QueryOptionType.ATTRIBUTEANDGEOMETRY + + +number + + + + 查询结果中包含属性和几何对象。
QueryOptionType.GEOMETR + + +number + + + + 查询结果中只有几何对象。
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<ServiceQueryParameter>}

+ + + + + +
+ 创建一个ServiceQueryParameter参数 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<ServiceQueryParameter> + + +
+
+ + + + + + + + + + +

(static) getExpectRecordCount() → {Promise}

+ + + + + +
+ 获取期望返回的查询记录个数。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) getQueryBounds() → {Promise.<Rectangle2D>}

+ + + + + +
+ 获取查询范围。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Rectangle2D> + + +
+
+ + + + + + + + + + +

(static) getQueryDistance() → {Promise}

+ + + + + +
+ 返回查询的距离。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) getQueryGeometry() → {Promise.<Geometry>}

+ + + + + +
+ 返回查询的几何对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Geometry> + + +
+
+ + + + + + + + + + +

(static) getQueryLayerName() → {Promise}

+ + + + + +
+ 获取查询的图层名称。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) getQueryMapName() → {Promise}

+ + + + + +
+ 获取服务查询的地图的名称。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) getQueryOption() → {Promise}

+ + + + + +
+ 返回查询结果内容类型。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) getQueryServiceName() → {Promise}

+ + + + + +
+ 获取当前查询的服务的实例的服务名称。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

(static) setExpectRecordCount(count) → {Promise.<void>}

+ + + + + +
+ 设置期望返回的查询记录个数。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
count + + +number + + + + 设置期望返回的查询记录个数。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryBounds(rectangle2D) → {Promise.<void>}

+ + + + + +
+ 设置查询范围。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rectangle2D + + +object + + + + 查询范围。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryDistance(distance) → {Promise.<void>}

+ + + + + +
+ 设置查询的距离。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + 查询距离
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryGeometry(geometry) → {Promise.<void>}

+ + + + + +
+ 设置查询的几何对象。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geometry + + +object + + + + 要设置的几何对象。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryLayerName(queryLayerName) → {Promise.<void>}

+ + + + + +
+ 设置当前查询的图层的名称。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
queryLayerName + + +string + + + + 设置当前查询的图层的名称。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryMapName(mapName) → {Promise.<void>}

+ + + + + +
+ 设置查询地图的地图名称。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mapName + + +string + + + + 设置查询地图的地图名称。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryOption(queryOptionType) → {Promise.<void>}

+ + + + + +
+ 设置查询结果内容类型。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
queryOptionType + + +ServiceQueryParameter.QueryOptionType + + + + 查询结果内容类型
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setQueryServiceName(name) → {Promise.<void>}

+ + + + + +
+ 获取当前查询的服务的实例的服务名称。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + 当前查询的服务的实例的服务名称。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) toJson() → {Promise.<void>}

+ + + + + +
+ 转成Json格式对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/ServiceQueryParameter.js.html b/API Doc/ServiceQueryParameter.js.html new file mode 100644 index 00000000..b695c0d4 --- /dev/null +++ b/API Doc/ServiceQueryParameter.js.html @@ -0,0 +1,329 @@ + + + + + JSDoc: Source: ServiceQueryParameter.js + + + + + + + + + + +
+ +

Source: ServiceQueryParameter.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let SQP = NativeModules.JSServiceQueryParameter;
+import Rectangle2D from './Rectangle2D.js';
+import Geometry from './Geometry.js';
+
+/**
+ * @class ServiceQueryParameter
+ * @property {number} QueryOptionType.ATTRIBUTE - 查询结果中只有属性。
+ * @property {number} QueryOptionType.ATTRIBUTEANDGEOMETRY - 查询结果中包含属性和几何对象。
+ * @property {number} QueryOptionType.GEOMETR - 查询结果中只有几何对象。
+ */
+export default class ServiceQueryParameter {
+
+    /**
+     * 创建一个ServiceQueryParameter参数
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise.<ServiceQueryParameter>}
+     */
+    async createObj(){
+        try{
+            var {_serviceQueryParameterId_} = await SQP.createObj();
+            var serviceQueryParameter = new ServiceQueryParameter();
+            serviceQueryParameter._SMServiceQueryParameterId = _serviceQueryParameterId_;
+            return serviceQueryParameter;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询范围。
+     * @memberOf ServiceQueryParameter
+     * @param {object} rectangle2D - 查询范围。
+     * @returns {Promise.<void>}
+     */
+    async setQueryBounds(rectangle2D){
+        try{
+            await SQP.setQueryBounds(this._SMServiceQueryParameterId, rectangle2D._SMRectangle2DId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取查询范围。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise.<Rectangle2D>}
+     */
+    async getQueryBounds(){
+        try{
+            var {rectangle2DId} = await SQP.getQueryBounds(this._SMServiceQueryParameterId);
+            var rectangle2D = new Rectangle2D();
+            rectangle2D._SMRectangle2DId = rectangle2DId;
+            return rectangle2D;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询的距离。
+     * @memberOf ServiceQueryParameter
+     * @param {number} distance - 查询距离
+     * @returns {Promise.<void>}
+     */
+    async setQueryDistance(distance){
+        try{
+            await SQP.setQueryDistance(this._SMServiceQueryParameterId, distance);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回查询的距离。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getQueryDistance(){
+        try{
+            var distance = await SQP.getQueryDistance(this._SMServiceQueryParameterId);
+            return distance;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *返回查询的几何对象。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise.<Geometry>}
+     */
+    async getQueryGeometry(){
+        try{
+            var {geometryId} = await SQP.getQueryGeometry(this._SMServiceQueryParameterId);
+            var geometry = new Geometry();
+            geometry._SMGeometryId = geometryId;
+            return geometry;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询的几何对象。
+     * @memberOf ServiceQueryParameter
+     * @param {object} geometry - 要设置的几何对象。
+     * @returns {Promise.<void>}
+     */
+    async setQueryGeometry(geometry){
+        try{
+            await SQP.setQueryGeometry(this._SMServiceQueryParameterId, geometry._SMGeometryId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取查询的图层名称。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getQueryLayerName(){
+        try{
+            var name = await SQP.getQueryLayerName(this._SMServiceQueryParameterId);
+            return name;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置当前查询的图层的名称。
+     * @memberOf ServiceQueryParameter
+     * @param {string} queryLayerName - 设置当前查询的图层的名称。
+     * @returns {Promise.<void>}
+     */
+    async setQueryLayerName(queryLayerName){
+        try{
+            await SQP.setQueryLayerName(this._SMServiceQueryParameterId, queryLayerName);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取服务查询的地图的名称。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getQueryMapName(){
+        try{
+            var name = await SQP.getQueryMapName(this._SMServiceQueryParameterId);
+            return name;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询地图的地图名称。
+     * @memberOf ServiceQueryParameter
+     * @param {string} mapName - 设置查询地图的地图名称。
+     * @returns {Promise.<void>}
+     */
+    async setQueryMapName(mapName){
+        try{
+            await SQP.setQueryMapName(this._SMServiceQueryParameterId, mapName);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 返回查询结果内容类型。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getQueryOption(){
+        try{
+            var optionName = await SQP.getQueryOption(this._SMServiceQueryParameterId);
+            return optionName;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置查询结果内容类型。
+     * @memberOf ServiceQueryParameter
+     * @param {ServiceQueryParameter.QueryOptionType} queryOptionType - 查询结果内容类型
+     * @returns {Promise.<void>}
+     */
+    async setQueryOption(queryOptionType){
+        try{
+            await SQP.setQueryOption(this._SMServiceQueryParameterId, queryOptionType);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     *获取期望返回的查询记录个数。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getExpectRecordCount(){
+        try{
+            var count = await SQP.getExpectRecordCount(this._SMServiceQueryParameterId);
+            return count;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置期望返回的查询记录个数。
+     * @memberOf ServiceQueryParameter
+     * @param {number} count - 设置期望返回的查询记录个数。
+     * @returns {Promise.<void>}
+     */
+    async setExpectRecordCount(count){
+        try{
+            await SQP.setExpectRecordCount(this._SMServiceQueryParameterId, count);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取当前查询的服务的实例的服务名称。
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise}
+     */
+    async getQueryServiceName(){
+        try{
+            var serviceName = await SQP.getQueryServiceName(this._SMServiceQueryParameterId);
+            return serviceName;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取当前查询的服务的实例的服务名称。
+     * @memberOf ServiceQueryParameter
+     * @param {string} name - 当前查询的服务的实例的服务名称。
+     * @returns {Promise.<void>}
+     */
+    async setQueryServiceName(name){
+        try{
+            await SQP.setQueryServiceName(this._SMServiceQueryParameterId, name);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 转成Json格式对象
+     * @memberOf ServiceQueryParameter
+     * @returns {Promise.<void>}
+     */
+    async toJson(){
+        try{
+            var jsonString = await SQP.toJson(this._SMServiceQueryParameterId);
+            var jsonOBj = JSON.parse(jsonString);
+            return jsonOBj;
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Size2D.html b/API Doc/Size2D.html new file mode 100644 index 00000000..024090fd --- /dev/null +++ b/API Doc/Size2D.html @@ -0,0 +1,338 @@ + + + + + JSDoc: Class: Size2D + + + + + + + + + + +
+ +

Class: Size2D

+ + + + + + +
+ +
+ +

Size2D

+ + +
+ +
+
+ + + + + +

new Size2D()

+ + + + + +
+ 存储有序双精度数对。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj(w, h) → {Promise.<Size2D>}

+ + + + + +
+ 创建一个Size2D实例 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
w + + +number + + + + 宽度
h + + +number + + + + 高度
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Size2D> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Size2D.js.html b/API Doc/Size2D.js.html new file mode 100644 index 00000000..17a104eb --- /dev/null +++ b/API Doc/Size2D.js.html @@ -0,0 +1,83 @@ + + + + + JSDoc: Source: Size2D.js + + + + + + + + + + +
+ +

Source: Size2D.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let S = NativeModules.JSSize2D;
+
+/**
+ * @class Size2D
+ * @description 存储有序双精度数对。
+ */
+export default class Size2D {
+    /**
+     * 创建一个Size2D实例
+     * @memberOf Size2D
+     * @param {number} w - 宽度
+     * @param {number} h - 高度
+     * @returns {Promise.<Size2D>}
+     */
+    async createObj(w,h){
+        try{
+            var {size2DId} = await S.createObj(w,h);
+            var size2D = new Size2D();
+            size2D._SMSize2DId = size2DId;
+            return size2D;
+        }catch (e){
+            console.log(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Theme.html b/API Doc/Theme.html new file mode 100644 index 00000000..fb93d426 --- /dev/null +++ b/API Doc/Theme.html @@ -0,0 +1,613 @@ + + + + + JSDoc: Class: Theme + + + + + + + + + + +
+ +

Class: Theme

+ + + + + + +
+ +
+ +

Theme

+ + +
+ +
+
+ + + + + +

new Theme()

+ + + + + +
+ 专题图类,该类是所有专题图的基类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) makeThemeLabel(themeParam) → {Promise.<Theme>}

+ + + + + +
+ 参数对象:{datasetVector:,rangeExpression:分段字段表达式,rangeMode:分段模式,rangeParameter:分段参数,colorGradientType:颜色渐变模式} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
themeParam + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Theme> + + +
+
+ + + + + + + + + + +

(static) makeThemeRange(themeParam) → {Promise.<Theme>}

+ + + + + +
+ 参数对象:{datasetVector:,rangeExpression:分段字段表达式,rangeMode:分段模式,rangeParameter:分段参数,colorGradientType:颜色渐变模式} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
themeParam + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Theme> + + +
+
+ + + + + + + + + + +

(static) makeThemeUnique(themeParam) → {Promise.<AMQPManager>}

+ + + + + +
+ 参数对象:{datasetVector:,uniqueExpression:单值专题图字段表达式,colorGradientType:颜色渐变模式} +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
themeParam + + +Object + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<AMQPManager> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Theme.js.html b/API Doc/Theme.js.html new file mode 100644 index 00000000..01972bb8 --- /dev/null +++ b/API Doc/Theme.js.html @@ -0,0 +1,122 @@ + + + + + JSDoc: Source: Theme.js + + + + + + + + + + +
+ +

Source: Theme.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: will
+ E-mail: pridehao@gmail.com
+
+ **********************************************************************************/
+
+import {NativeModules} from 'react-native';
+let T = NativeModules.JSTheme;
+
+/**
+ * @class Theme
+ * @description 专题图类,该类是所有专题图的基类。
+ */
+export default class Theme {
+
+    /**
+     * 创建标签专题图。
+     * @memberOf Theme
+     * @param {Object} themeParam 
+     * @description 参数对象:{datasetVector:<DatasetVector>,rangeExpression:<string>分段字段表达式,rangeMode:<number>分段模式,rangeParameter:<number>分段参数,colorGradientType:<number>颜色渐变模式}
+     * @returns {Promise.<Theme>}
+     */
+    async makeThemeLabel(themeParam) {
+        try {
+            var {themeId} = await T.makeThemeLabel(themeParam.datasetVector._SMDatasetVectorId, themeParam.rangeExpression, themeParam.rangeMode, themeParam.rangeParameter, themeParam.colorGradientType);
+            var theme = new Theme();
+            theme._SMThemeId = themeId;
+            return theme;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+
+    /**
+     * 生成默认的单值专题图。
+     * @memberOf Theme
+     * @param {Object} themeParam 
+     * @description 参数对象:{datasetVector:<DatasetVector>,uniqueExpression:<string>单值专题图字段表达式,colorGradientType:<number>颜色渐变模式}
+     * @returns {Promise.<AMQPManager>}
+     */
+    async makeThemeUnique(themeParam) {
+        try {
+            var {themeId} = await T.makeThemeUnique(themeParam.datasetVector._SMDatasetVectorId, themeParam.uniqueExpression, themeParam.colorGradientType);
+            var theme = new Theme();
+            theme._SMThemeId = themeId;
+            return theme;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 生成默认的分段专题图。
+     * @memberOf Theme
+     * @param {Object} themeParam
+     * @description 参数对象:{datasetVector:<DatasetVector>,rangeExpression:<string>分段字段表达式,rangeMode:<number>分段模式,rangeParameter:<number>分段参数,colorGradientType:<number>颜色渐变模式}
+     * @returns {Promise.<Theme>}
+     */
+    async makeThemeRange(themeParam) {
+        try {
+            var {themeId} = await T.makeThemeRange(themeParam.datasetVector._SMDatasetVectorId, themeParam.rangeExpression, themeParam.rangeMode, themeParam.rangeParameter, themeParam.colorGradientType);
+            var theme = new Theme();
+            theme._SMThemeId = themeId;
+            return theme;
+        } catch (e) {
+            console.error(e);
+        }
+    }
+    
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Track.html b/API Doc/Track.html new file mode 100644 index 00000000..b47f4563 --- /dev/null +++ b/API Doc/Track.html @@ -0,0 +1,2113 @@ + + + + + JSDoc: Class: Track + + + + + + + + + + +
+ +

Class: Track

+ + + + + + +
+ +
+ +

Track

+ + +
+ +
+
+ + + + + +

new Track()

+ + + + + +
+ 轨迹记录类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createObj() → {Promise.<Track>}

+ + + + + +
+ 创建一个Track对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Track> + + +
+
+ + + + + + + + + + +

(static) getCustomLocation() → {Promise.<Promise.customLocation>}

+ + + + + +
+ 获取是否用户自定义定位点。(该方法只支持android设备) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.customLocation> + + +
+
+ + + + + + + + + + +

(static) getDataset() → {Promise.<Dataset>}

+ + + + + +
+ 获取轨迹数据集。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Dataset> + + +
+
+ + + + + + + + + + +

(static) getDistanceInterval() → {Promise.<Promise.distanceInterval>}

+ + + + + +
+ 获取距离间隔,单位为米,默认的距离间隔是5米。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.distanceInterval> + + +
+
+ + + + + + + + + + +

(static) getMatchDatasets() → {Promise.<Datasets>}

+ + + + + +
+ 获取匹配线数据集集合。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Datasets> + + +
+
+ + + + + + + + + + +

(static) getTimeInterval() → {Promise.<Promise.timeInterval>}

+ + + + + +
+ 获取时间间隔。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.timeInterval> + + +
+
+ + + + + + + + + + +

(static) isSpeedDirectionEnable() → {Promise.<Promise.isSpeedDirectionEnable>}

+ + + + + +
+ 获取当前是否使用速度和方位角模式。(该方法只支持android设备) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.isSpeedDirectionEnable> + + +
+
+ + + + + + + + + + +

(static) setCustomLocation(bCustomLocation) → {Promise.<void>}

+ + + + + +
+ 设置是否用户自定义定位点,默认为true。(该方法只支持android设备) +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bCustomLocation + + +boolean + + + + 是否用户自定义定位点。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDataset(datasetVector) → {Promise.<void>}

+ + + + + +
+ 设置轨迹数据集,用户使用轨迹功能时,要先使用创建轨迹数据集的方法创建数据集,然后调用该方法设置轨迹数据集。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasetVector + + +object + + + + 轨迹数据集。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setDistanceInterval(interval) → {Promise.<void>}

+ + + + + +
+ 设置距离间隔,单位为米,距离间隔值必须大于或等于3米,否则会自动处理为3米。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
interval + + +number + + + + 距离间隔。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setGPSData(jsonGpsData) → {Promise.<void>}

+ + + + + +
+ 设置GPSData数据,只有将setCustomLocation(boolean bCustomLocation)参数设置为true时,该接口才起作用。 +(该方法只支持android设备) +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
jsonGpsData + + +object + + + + 用户设置的gpsdata。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setMatchDatasets(datsets) → {Promise.<void>}

+ + + + + +
+ 设置匹配线数据集集合,为轨迹抓路功能使用,该数据集集合应为线数据集集合。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datsets + + +Array + + + + 设置匹配线数据集集合。
+ + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSpeedDirectionEnable(speedDirectionEnable) → {Promise.<void>}

+ + + + + +
+ 设置速度和方位角模式,支持转弯、高速、低速场景下记录轨迹点的稀疏和加密 +(该方法只支持android设备) +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speedDirectionEnable + + +number + + + + 距离间隔。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setTimeInterval(timeInterval) → {Promise.<void>}

+ + + + + +
+ 设置时间间隔,单位为秒,时间间隔值必须大于20秒,否则设置时间间隔失败。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
timeInterval + + +number + + + + 时间间隔。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) startTrack() → {Promise.<void>}

+ + + + + +
+ 开启轨迹功能。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) stopTrack() → {Promise.<void>}

+ + + + + +
+ 关闭轨迹功能。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Track.js.html b/API Doc/Track.js.html new file mode 100644 index 00000000..7cfa69d5 --- /dev/null +++ b/API Doc/Track.js.html @@ -0,0 +1,326 @@ + + + + + JSDoc: Source: Track.js + + + + + + + + + + +
+ +

Source: Track.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let T = NativeModules.JSTrack;
+import Dataset from './Dataset.js';
+import Datasets from './Datasets.js';
+
+/**
+ * @class Track
+ * @description 轨迹记录类。
+ */
+export default class Track {
+
+    /**
+     * 创建一个Track对象
+     * @memberOf Track
+     * @returns {Promise.<Track>}
+     */
+    async createObj(){
+        try{
+            var {_trackId_} = await T.createObj();
+            var track = new Track();
+            track._SMTrackId = _trackId_;
+            return track;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 创建轨迹数据集,创建出来的数据集为点数据集。
+     * @memberOf Track0
+     * @param {object} datasource - 轨迹数据集所属的数据源。
+     * @param {string} name - 数据集的名称。
+     * @returns {Promise.<Dataset>}
+     */
+    async createDataset(datasource,name){
+        try{
+            var {datasetId} = await T.createDataset(this._SMTrackId,datasource._SMDatasourceId,name);
+            var dataset = new Dataset();
+            dataset._SMDatasetId = datasetId;
+            return dataset;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取是否用户自定义定位点。(该方法只支持android设备)
+     * @memberOf Track
+     * @returns {Promise.<Promise.customLocation>}
+     */
+    async getCustomLocation(){
+        try{
+            var {customLocation} = await T.getCustomLocation(track._SMTrackId);
+            return customLocation;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取轨迹数据集。
+     * @memberOf Track
+     * @returns {Promise.<Dataset>}
+     */
+    async getDataset(){
+        try{
+            var {datasetId} = await T.getDataset(this._SMTrackId);
+            var dataset = new Dataset();
+            dataset._SMDatasetId = datasetId;
+            return dataset;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取距离间隔,单位为米,默认的距离间隔是5米。
+     * @memberOf Track
+     * @returns {Promise.<Promise.distanceInterval>}
+     */
+    async getDistanceInterval(){
+        try{
+            var {distanceInterval} = await T.getDistanceInterval(track._SMTrackId);
+            return distanceInterval;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取匹配线数据集集合。
+     * @memberOf Track
+     * @returns {Promise.<Datasets>}
+     */
+    async getMatchDatasets(){
+        try{
+            var {idArr} = await T.getMatchDatasets(this._SMTrackId);
+            if(idArr === false){
+                return false;
+            }
+            
+            var objArr = [];
+            for(var i=0; i<idArr.length; i++) {
+                var dataset = new Dataset();
+                dataset._SMDatasetId = idArr[i];
+                objArr.push(dataset);
+            }
+            return objArr;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取时间间隔。
+     * @memberOf Track
+     * @returns {Promise.<Promise.timeInterval>}
+     */
+    async getTimeInterval(){
+        try{
+            var {timeInterval} = await T.getTimeInterval(track._SMTrackId);
+            return timeInterval;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取当前是否使用速度和方位角模式。(该方法只支持android设备)
+     * @memberOf Track
+     * @returns {Promise.<Promise.isSpeedDirectionEnable>}
+     */
+    async isSpeedDirectionEnable(){
+        try{
+            var {isSpeedDirectionEnable} = await T.isSpeedDirectionEnable(track._SMTrackId);
+            return isSpeedDirectionEnable;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置是否用户自定义定位点,默认为true。(该方法只支持android设备)
+     * @memberOf Track
+     * @param {boolean} bCustomLocation - 是否用户自定义定位点。
+     * @returns {Promise.<void>}
+     */
+    async setCustomLocation(bCustomLocation){
+        try{
+            await T.setCustomLocation(track._SMTrackId,bCustomLocation);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置轨迹数据集,用户使用轨迹功能时,要先使用创建轨迹数据集的方法创建数据集,然后调用该方法设置轨迹数据集。
+     * @memberOf Track
+     * @param {object} datasetVector - 轨迹数据集。
+     * @returns {Promise.<void>}
+     */
+    async setDataset(dataset){
+        try{
+            await T.setDataset(track._SMTrackId,dataset._SMDatasetId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置距离间隔,单位为米,距离间隔值必须大于或等于3米,否则会自动处理为3米。
+     * @memberOf Track
+     * @param {number} interval - 距离间隔。
+     * @returns {Promise.<void>}
+     */
+    async setDistanceInterval(interval){
+        try{
+            await T.setDistanceInterval(track._SMTrackId,interval);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置GPSData数据,只有将setCustomLocation(boolean bCustomLocation)参数设置为true时,该接口才起作用。
+     *(该方法只支持android设备)
+     * @memberOf Track
+     * @param {object} jsonGpsData - 用户设置的gpsdata。
+     * @returns {Promise.<void>}
+     */
+    async setGPSData(jsonGpsData){
+        try{
+            await T.setGPSData(track._SMTrackId,jsonGpsData);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置匹配线数据集集合,为轨迹抓路功能使用,该数据集集合应为线数据集集合。
+     * @memberOf Track
+     * @deprecated
+     * @param {Array} datsets - 设置匹配线数据集集合。
+     * @returns {Promise.<void>}
+     */
+    async setMatchDatasets(datsets){
+        try{
+            //to do
+            await T.setMatchDatasets(track._SMTrackId,datsets._SMDatasetsId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置速度和方位角模式,支持转弯、高速、低速场景下记录轨迹点的稀疏和加密
+     *(该方法只支持android设备)
+     * @memberOf Track
+     * @param {number} speedDirectionEnable - 距离间隔。
+     * @returns {Promise.<void>}
+     */
+    async setSpeedDirectionEnable(speedDirectionEnable){
+        try{
+            await T.setSpeedDirectionEnable(track._SMTrackId,speedDirectionEnable);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置时间间隔,单位为秒,时间间隔值必须大于20秒,否则设置时间间隔失败。
+     * @memberOf Track
+     * @param {number} timeInterval - 时间间隔。
+     * @returns {Promise.<void>}
+     */
+    async setTimeInterval(timeInterval){
+        try{
+            await T.setTimeInterval(track._SMTrackId,timeInterval);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 开启轨迹功能。
+     * @memberOf Track
+     * @returns {Promise.<void>}
+     */
+    async startTrack(){
+        try{
+            await T.startTrack(track._SMTrackId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 关闭轨迹功能。
+     * @memberOf Track
+     * @returns {Promise.<void>}
+     */
+    async stopTrack(){
+        try{
+            await T.stopTrack(track._SMTrackId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/TrackingLayer.html b/API Doc/TrackingLayer.html new file mode 100644 index 00000000..585af758 --- /dev/null +++ b/API Doc/TrackingLayer.html @@ -0,0 +1,438 @@ + + + + + JSDoc: Class: TrackingLayer + + + + + + + + + + +
+ +

Class: TrackingLayer

+ + + + + + +
+ +
+ +

TrackingLayer

+ + +
+ +
+
+ + + + + +

new TrackingLayer()

+ + + + + +
+ 跟踪图层类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) add(geometry, tag) → {Promise.<void>}

+ + + + + +
+ 向当前跟踪图层中添加一个几何对象,并给出该几何对象的标签信息。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
geometry + + +object + + + + 矢量对象
tag + + +string + + + + 矢量对象的标签名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) clear() → {Promise.<void>}

+ + + + + +
+ 清空此跟踪图层中的所有几何对象。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/TrackingLayer.js.html b/API Doc/TrackingLayer.js.html new file mode 100644 index 00000000..7b6dd43c --- /dev/null +++ b/API Doc/TrackingLayer.js.html @@ -0,0 +1,94 @@ + + + + + JSDoc: Source: TrackingLayer.js + + + + + + + + + + +
+ +

Source: TrackingLayer.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules} from 'react-native';
+let TL = NativeModules.JSTrackingLayer;
+
+/**
+ * @class TrackingLayer
+ * @description 跟踪图层类。
+ */
+export default class TrackingLayer {
+    /**
+     * 向当前跟踪图层中添加一个几何对象,并给出该几何对象的标签信息。
+     * @memberOf TrackingLayer
+     * @param {object} geometry - 矢量对象
+     * @param {string} tag - 矢量对象的标签名称
+     * @returns {Promise.<void>}
+     */
+    async add(geometry,tag){
+        try{
+            var id = geometry._SMGeometryId;
+            await TL.add(this._SMTrackingLayerId,id,tag);
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 清空此跟踪图层中的所有几何对象。
+     * @memberOf TrackingLayer
+     * @returns {Promise.<void>}
+     */
+    async clear(){
+        try{
+            await TL.clear(this._SMTrackingLayerId);
+        }catch (e){
+            console.error(e);
+        }
+    }
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/TraditionalNavi.html b/API Doc/TraditionalNavi.html new file mode 100644 index 00000000..49f44b03 --- /dev/null +++ b/API Doc/TraditionalNavi.html @@ -0,0 +1,2326 @@ + + + + + JSDoc: Class: TraditionalNavi + + + + + + + + + + +
+ +

Class: TraditionalNavi

+ + + + + + +
+ +
+ +

TraditionalNavi

+ + +
+ +
+
+ + + + + +

new TraditionalNavi()

+ + + + + +
+ 导航类,导航类提供路径分析和引导功能。(该类对象只能通过mapControl类下方法获取) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) addWayPoint(x, y) → {Promise.<Promise.boolean>}

+ + + + + +
+ 添加途经点 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + 途经点x坐标
y + + +number + + + + 途经点y坐标
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + +

(static) cleanPath() → {Promise.<void>}

+ + + + + +
+ 清除路径分析的结果 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) connectNaviData(dataPath) → {Promise.<Promise.boolean>}

+ + + + + +
+ 链接导航路网数据 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
dataPath + + 数据存储路径
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + +

(static) enablePanOnGuide(bPan) → {Promise.<void>}

+ + + + + +
+ 引导过程中是否允许平移地图。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bPan + + 一个布尔值,用来指示在导航过程中是否允许平移地图,true,表示允许,false,表示不允许。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) getNaviPath() → {Promise.<Promise.array>}

+ + + + + +
+ 获取导航路径的详情 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - 返回一个导航路径上所有路径的NaviStep对象数组,每个pathInfo对象的结构为{point:{x:--,y:--},length:--,name:--,time:--,turnType:--} +
+ + + +
+
+ Type +
+
+ +Promise.<Promise.array> + + +
+
+ + + + + + + + + + +

(static) getRoute() → {Promise.<object>}

+ + + + + +
+ 获得路径分析线路。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<object> + + +
+
+ + + + + + + + + + +

(static) getTimeToDestination(speed) → {Promise.<number>}

+ + + + + +
+ 获取导航剩余时间 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + 当前行驶速度
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) isGuiding() → {Promise.<boolean>}

+ + + + + +
+ 当前是否在引导过程中。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) locateMap() → {Promise.<void>}

+ + + + + +
+ 导航中,将小车位置作为地图中心。 当允许导航中平移地图时,移动地图后,可以通过该接口使小车一直在地图中心显示。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) routeAnalyst(mode) → {Promise.<number>}

+ + + + + +
+ 执行路径分析。 +路径分析模式的值为[0,1,2,3],其分别表示推荐模式、时间最快模式、距离最短模式、和最少收费模式。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + 路径分析模式。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ 路径分析成功返回1,路径分析失败返回0,起点周围无道路返回-1,终点周围无道路返回-2。 +
+ + + +
+
+ Type +
+
+ +Promise.<number> + + +
+
+ + + + + + + + + + +

(static) setDestinationPoint(x, y, map) → {Promise.<void>}

+ + + + + +
+ 设置路径规划的终点。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + 终点经度坐标(度)。
y + + 终点纬度坐标(度)。
map + + 导航所属地图对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setGPSData(gpsData) → {Promise.<void>}

+ + + + + +
+ 设置GPS数据 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
gpsData + + +object + + + + gps数据
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setSpeechParam(speech) → {Promise.<Promise.speak>}

+ + + + + +
+ 设置导航指引信息控制,用于控制导航中是否播报引导信息 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speech + + +boolean + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.speak> + + +
+
+ + + + + + + + + + +

(static) setStartPoint(x, y, map) → {Promise.<void>}

+ + + + + +
+ 设置路径规划的起点。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + 起点经度坐标(度)。
y + + 起点纬度坐标(度)。
map + + 导航所属地图对象
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) startGuide(status) → {Promise.<void>}

+ + + + + +
+ 开始导航。 +引导状态的值为[0,1,2],其分别表示执行真实导航、执行模拟导航、执行定位点巡航。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
status + + 引导状态。
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) stopGuide() → {Promise.<Promise.boolean>}

+ + + + + +
+ 停止引导。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Promise.boolean> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/TraditionalNavi.js.html b/API Doc/TraditionalNavi.js.html new file mode 100644 index 00000000..891d8dd9 --- /dev/null +++ b/API Doc/TraditionalNavi.js.html @@ -0,0 +1,397 @@ + + + + + JSDoc: Source: TraditionalNavi.js + + + + + + + + + + +
+ +

Source: TraditionalNavi.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Wang zihao
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import {NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform} from 'react-native';
+let TN = NativeModules.JSNavigation;
+import GeoLine from './GeoLine';
+
+const nativeEvt = new NativeEventEmitter(TN);
+/**
+ * @class TraditionalNavi
+ * @description 导航类,导航类提供路径分析和引导功能。(该类对象只能通过mapControl类下方法获取)
+ */
+export default class TraditionalNavi {
+    /**
+     * 链接导航路网数据
+     * @memberOf TraditionalNavi
+     * @param dataPath - 数据存储路径
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async connectNaviData(dataPath){
+        try{
+            var {success} = await TN.connectNaviData(this._SMTraditionalNaviId,dataPath);
+            return success;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 执行路径分析。
+     * 路径分析模式的值为[0,1,2,3],其分别表示推荐模式、时间最快模式、距离最短模式、和最少收费模式。
+     * @memberOf TraditionalNavi
+     * @param mode - 路径分析模式。
+     * @returns {Promise.<number>} 路径分析成功返回1,路径分析失败返回0,起点周围无道路返回-1,终点周围无道路返回-2。
+     */
+    async routeAnalyst(mode){
+        try{
+            var {result} = await TN.routeAnalyst(this._SMTraditionalNaviId,mode);
+            return result;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 设置路径规划的起点。
+     * @memberOf TraditionalNavi
+     * @param x - 起点经度坐标(度)。
+     * @param y - 起点纬度坐标(度)。
+     * @param map - 导航所属地图对象
+     * @returns {Promise.<void>}
+     */
+    async setStartPoint(x,y,map){
+        try{
+            await TN.setStartPoint(this._SMTraditionalNaviId,x,y,map._SMMapId);
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 设置路径规划的终点。
+     * @memberOf TraditionalNavi
+     * @param x - 终点经度坐标(度)。
+     * @param y - 终点纬度坐标(度)。
+     * @param map - 导航所属地图对象
+     * @returns {Promise.<void>}
+     */
+    async setDestinationPoint(x,y,map){
+        try{
+            await TN.setDestinationPoint(this._SMTraditionalNaviId,x,y,map._SMMapId);
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 开始导航。
+     * 引导状态的值为[0,1,2],其分别表示执行真实导航、执行模拟导航、执行定位点巡航。
+     * @memberOf TraditionalNavi
+     * @param status  - 引导状态。
+     * @returns {Promise.<void>}
+     */
+    async startGuide(status){
+        try{
+            var {guiding} = await TN.startGuide(this._SMTraditionalNaviId,status);
+            return guiding;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 添加途经点
+     * @memberOf TraditionalNavi
+     * @param {number} x - 途经点x坐标
+     * @param {number} y - 途经点y坐标
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async addWayPoint(x,y){
+        try{
+            var {added} = await TN.addWayPoint(this._SMTraditionalNaviId,x,y);
+            return added;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 停止引导。
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<Promise.boolean>}
+     */
+    async stopGuide(){
+        try{
+            var {stopped} = await TN.stopGuide(this._SMTraditionalNaviId);
+            return stopped;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 设置导航指引信息控制,用于控制导航中是否播报引导信息
+     * @memberOf TraditionalNavi
+     * @param {boolean} speech
+     * @returns {Promise.<Promise.speak>}
+     */
+    async setSpeechParam(speech){
+        try{
+            var {speak} = await TN.setSpeechParam(this._SMTraditionalNaviId,speech);
+            return speak;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 设置GPS数据
+     * @memberOf TraditionalNavi
+     * @param {object} gpsData - gps数据
+     * @returns {Promise.<void>}
+     */
+    async setGPSData(gpsData){
+        try{
+            await TN.setGPSData(this._SMTraditionalNaviId,gpsData);
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 导航中,将小车位置作为地图中心。 当允许导航中平移地图时,移动地图后,可以通过该接口使小车一直在地图中心显示。
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<void>}
+     */
+    async locateMap(){
+        try{
+            await TN.locateMap(this._SMTraditionalNaviId);
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 当前是否在引导过程中。
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<boolean>}
+     */
+    async isGuiding(){
+        try{
+            var {guiding} = await TN.isGuiding(this._SMTraditionalNaviId);
+            return guiding;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 获取导航剩余时间
+     * @memberOf TraditionalNavi
+     * @param speed - 当前行驶速度
+     * @returns {Promise.<number>}
+     */
+    async getTimeToDestination(speed){
+        try{
+            var {time} = await TN.getTimeToDestination(this._SMTraditionalNaviId,speed);
+            return time;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+
+    /**
+     * 获得路径分析线路。
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<object>}
+     */
+    async getRoute(){
+        try{
+            var {geoLineId} = await TN.getRoute(this._SMTraditionalNaviId);
+            var geoLine = new GeoLine();
+            geoLine._SMGeoLineId = geoLineId;
+
+            return geoLine;
+        }catch (e){
+            console.log(e);
+        }
+    }
+
+    /**
+     * 引导过程中是否允许平移地图。
+     * @memberOf TraditionalNavi
+     * @param bPan - 一个布尔值,用来指示在导航过程中是否允许平移地图,true,表示允许,false,表示不允许。
+     * @returns {Promise.<void>}
+     */
+    async enablePanOnGuide(bPan){
+     try{
+            await TN.enablePanOnGuide(this._SMTraditionalNaviId,bPan);
+        }catch (e){
+            console.log(e);
+        }
+     }
+
+     /**
+     * 清除路径分析的结果
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<void>}
+     */
+    async cleanPath(){
+        try{
+            await TN.cleanPath(this._SMTraditionalNaviId);
+        }catch (e){
+            console.log(e);
+        }
+     }
+
+    /**
+     * 获取导航路径的详情
+     * @memberOf TraditionalNavi
+     * @returns {Promise.<Promise.array>} - 返回一个导航路径上所有路径的NaviStep对象数组,每个pathInfo对象的结构为{point:{x:--,y:--},length:--,name:--,time:--,turnType:--}
+     */
+    async getNaviPath() {
+        try {
+            var {naviPath} = await TN.getNaviPath(this._SMTraditionalNaviId);
+            return naviPath;
+        } catch (e) {
+            console.log(e);
+        }
+    }
+
+    /*
+     * 设置导航信息变化监听器。
+     * @param callback - 导航信息变化监听器回调函数。
+     * 用法:await industryNavi.setDistanceChangeListener(
+     *      {
+     *          startNavi:(e) => {console.log("start")},
+     *          naviInfoUpdate:(e) => {console.log(e.curRoadName + e.direction ....)},
+     *          arrivedDestination:(e) => {console.log("updated")},
+     *          stopNavi:(e) => {console.log("stop")},
+     *          adjustFailure:(e) => {console.log("failure")},
+     *          playNaviMessage:(e) => {console.log(e.message)},
+     *
+     *      }
+     * );
+     * 其中naviInfoUpdate回调中的参数是一个NaviInfo对象,其结构为:
+     *      {
+     *           curRoadName:--,
+     *           direction:--,
+     *           iconType:--,
+     *           nextRoadName:--,
+     *           routeRemainDis:--,
+     *           routeRemainTime:--,
+     *           segRemainDis:--
+     *      }
+     * @returns {Promise}
+     */
+    async addNaviInfoListener(events){
+        try{
+            var success = await TN.addNaviInfoListener(this._SMTraditionalNaviId);
+            if(success){
+                //差异化
+                if(Platform.OS === 'ios'){
+                    typeof events.startNavi !== 'function'  ||
+                    nativeEvt.addListener("com.supermap.RN.JSNavigation2.start_navi",function (e) {
+                                                   events.startNavi(e);
+                                                   });
+                    
+                    typeof events.naviInfoUpdate !== 'function'  ||
+                    nativeEvt.addListener("com.supermap.RN.JSNavigation2.navi_info_update",function (e) {
+                                                   events.naviInfoUpdate(e);
+                                                   });
+                    
+                    typeof events.arrivedDestination !== 'function'  ||
+                    nativeEvt.addListener("com.supermap.RN.JSNavigation2.arrived_destination",function (e) {
+                                                   events.arrivedDestination(e);
+                                                   });
+                    
+                    typeof events.stopNavi !== 'function'  ||
+                    nativeEvt.addListener("com.supermap.RN.JSNavigation2.stop_navi",function (e) {
+                                                   events.stopNavi(e);
+                                                   });
+                }else{
+                    
+                    typeof events.startNavi !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.start_navi",function (e) {
+                                                   events.startNavi(e);
+                                                   });
+                    
+                    typeof events.naviInfoUpdate !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.navi_info_update",function (e) {
+                                                   events.naviInfoUpdate(e);
+                                                   });
+                    
+                    typeof events.arrivedDestination !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.arrived_destination",function (e) {
+                                                   events.arrivedDestination(e);
+                                                   });
+                    
+                    typeof events.stopNavi !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.stop_navi",function (e) {
+                                                   events.stopNavi(e);
+                                                   });
+                    
+                    typeof events.adjustFailure !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.adjust_failure",function (e) {
+                                                   events.adjustFailure(e);
+                                                   });
+                    
+                    typeof events.playNaviMessage !== 'function'  ||
+                    DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.play_navi_massage",function (e) {
+                                                   events.playNaviMessage(e);
+                                                   });
+                }
+            }
+            return success;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/Workspace.html b/API Doc/Workspace.html new file mode 100644 index 00000000..8076992a --- /dev/null +++ b/API Doc/Workspace.html @@ -0,0 +1,2050 @@ + + + + + JSDoc: Class: Workspace + + + + + + + + + + +
+ +

Class: Workspace

+ + + + + + +
+ +
+ +

Workspace

+ + +
+ +
+
+ + + + + +

new Workspace()

+ + + + + +
+ 工作空间是用户的工作环境,主要完成数据的组织和管理,包括打开、关闭、创建、保存工作空间文件(SXW,SMW,SXWU,SMWU,DEFAULT)。工作空间 Workspace 是 SuperMap 中的一个重要的概念,工作空间存储了一个工程项目(同一个事务过程)中所有的数据源,地图的组织关系,工作空间通过其中的数据源集合对象 Datasources ,地图集合对象 Maps 来管理其下的数据源,地图。 +
+ + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
DEFAULT + + +number + + + + 默认SMWU类型。
SMWU + + +number + + + + SMWU工作空间,文件型工作空间。
SXWU + + +number + + + + SXWU工作空间。
UDB + + +number + + + + 数据库类型。
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) clearMap()

+ + + + + +
+ 清空所有地图 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) closeAllDatasource()

+ + + + + +
+ 关闭所有数据集 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) closeDatasource(datasourceName) → {Promise.<boolean>}

+ + + + + +
+ 关闭指定名称的数据集 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datasourceName + + 数据集名称
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<boolean> + + +
+
+ + + + + + + + + + +

(static) closeWorkspace() → {boolean}

+ + + + + +
+ 关闭工作空间 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) createDatasource(filePath, engineType) → {Promise.<Datasource>}

+ + + + + +
+ 创建数据集 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
filePath + + 指定创建数据集路径
engineType + + 数据集引擎类型
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Datasource> + + +
+
+ + + + + + + + + + +

(static) createObj() → {Promise.<Workspace>}

+ + + + + +
+ 创建workspace实例 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Workspace> + + +
+
+ + + + + + + + + + +

(static) getDatasources() → {Promise.<Datasources>}

+ + + + + +
+ 获得数据源集合 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Workspace.js:getDatasources() function has been deprecated. If you want to get datasource , please call the getDatasource() function
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Datasources> + + +
+
+ + + + + + + + + + +

(static) getMapName(mapIndex) → {string}

+ + + + + +
+ 根据地图序号获得地图名称 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mapIndex + + +number + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

(static) getMaps() → {Promise.<Maps>}

+ + + + + +
+ 获取工作空间下的Maps对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Maps类已不推荐使用
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<Maps> + + +
+
+ + + + + + + + + + +

(static) getSceneName(index)

+ + + + + +
+ 获取三维场景名称 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
index + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) open(workspaceConnectionInfo, passWord) → {Promise.<void>}

+ + + + + +
+ 根据定义好的工作空间连接信息对象,打开工作空间。 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
workspaceConnectionInfo + + +object + + + +
passWord + + +string + + + + 数据源密码(可选参数)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) openDatasource(jsonObject) → {Promise.<datasource>}

+ + + + + +
+ 打开数据源 jsonObject 获取网络数据源 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
jsonObject + + +object + + + + {engineType:引擎类型 ,server:文件/服务器路径 ,driver:驱动名称(可选参数)}
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<datasource> + + +
+
+ + + + + + + + + + +

(static) removeMap(mapName) → {boolean}

+ + + + + +
+ 移除地图 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mapName + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) saveWorkspace(server) → {boolean}

+ + + + + +
+ 保存工作空间 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
server + + +string + + + + 另存url(可选参数)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/Workspace.js.html b/API Doc/Workspace.js.html new file mode 100644 index 00000000..fce793dc --- /dev/null +++ b/API Doc/Workspace.js.html @@ -0,0 +1,384 @@ + + + + + JSDoc: Source: Workspace.js + + + + + + + + + + +
+ +

Source: Workspace.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+import { NativeModules } from 'react-native';
+let W = NativeModules.JSWorkspace;
+import DS from './Datasources.js';
+import Ds from './Datasource.js';
+import Maps from './Maps.js';
+import Map from './Map.js';
+import WorkspaceConnectionInfo from './WorkspaceConnectionInfo';
+import Datasource from './Datasource';
+
+/**
+ * @class Workspace
+ * @description 工作空间是用户的工作环境,主要完成数据的组织和管理,包括打开、关闭、创建、保存工作空间文件(SXW,SMW,SXWU,SMWU,DEFAULT)。工作空间 Workspace 是 SuperMap 中的一个重要的概念,工作空间存储了一个工程项目(同一个事务过程)中所有的数据源,地图的组织关系,工作空间通过其中的数据源集合对象 Datasources ,地图集合对象 Maps 来管理其下的数据源,地图。
+ * @property {number} DEFAULT - 默认SMWU类型。
+ * @property {number} SMWU - SMWU工作空间,文件型工作空间。
+ * @property {number} SXWU - SXWU工作空间。
+ * @property {number} UDB - 数据库类型。
+ */
+export default class Workspace{
+    /**
+     * 创建workspace实例
+     * @memberOf Workspace
+     * @returns {Promise.<Workspace>}
+     */
+    async createObj(){
+        try{
+            var {workspaceId} = await W.createObj();
+            var workspace = new Workspace();
+            workspace._SMWorkspaceId = workspaceId;
+            return workspace;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获得数据源集合
+     * @memberOf Workspace
+     * @deprecated Workspace.js:getDatasources() function has been deprecated. If you want to get datasource , please call the getDatasource() function
+     * @returns {Promise.<Datasources>}
+     */
+    async getDatasources(){
+        try {
+            var {datasourcesId} = await W.getDatasources(this._SMWorkspaceId);
+            console.debug("datasourcesId:"+datasourcesId);
+            var ds = new DS();
+            ds._SMDatasourcesId = datasourcesId;
+            return ds;
+        }catch (e){
+            console.error(e);
+        }
+    }
+    
+    /*
+     * 通过数据源链接信息打开数据源
+     * @memberOf Workspace
+     * @deprecated 可直接通过{@link Workspace.openDatasource}方法传参数,不在需要构建datasourceConnectionInfo对象。
+     * @param {object} datasourceConnectionInfo 数据源链接信息
+     * @returns {Promise.<Datasource>}
+     */
+ /*   async openDatasourceConnectionInfo(datasourceConnectionInfo){
+        try {
+            var {datasourceId} = await W.openDatasourceConnectionInfo(this.workspaceId,datasourceConnectionInfo.datasourceConnectionInfoId);
+            var ds = new Ds();
+            ds.datasourceId = datasourceId;
+            return ds;
+        }catch (e){
+            console.error(e);
+        }
+    } */
+
+    /**
+     * 通过序号或者名字(别名)获取数据源
+     * @memberOf Worksapce
+     * @param {number | string} index|name - 既可以是序号,也可以是数据源名称
+     * @returns {Promise.<Datasource>}
+     */
+    async getDatasource(index){
+        try{
+            var datasource = new Ds();
+            if(typeof index != 'string'){
+                //get datasource through index.
+                var {datasourceId} = await W.getDatasource(this._SMWorkspaceId,index);
+            }else{
+                //get datasource through datasource name(Alias).
+                var {datasourceId} = await W.getDatasourceByName(this._SMWorkspaceId,index);
+            }
+            datasource._SMDatasourceId = datasourceId;
+
+            return datasource;
+        }catch (e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据定义好的工作空间连接信息对象,打开工作空间。
+     * @memberOf Workspace
+     * @param {object} workspaceConnectionInfo
+     * @param {string} passWord - 数据源密码(可选参数)
+     * @returns {Promise.<void>}
+     */
+    async open(workspaceConnectionInfo,passWord){
+        try{
+            var WorkspaceConnectionInfoModule = new WorkspaceConnectionInfo();
+
+            if(typeof workspaceConnectionInfo === 'string'){
+                var wci = await WorkspaceConnectionInfoModule.createJSObj();
+                var str = workspaceConnectionInfo.split('.').pop();
+                console.log("工作空间类型字符串:" + str);
+                var type = this.workspaceType(str);
+                console.log("工作空间类型:" + type);
+                await wci.setType(type);
+                await wci.setServer(workspaceConnectionInfo);
+                if(passWord){
+                   await wci.setPassWord(passWord);
+                }
+                var {isOpen} = await W.open(this._SMWorkspaceId,wci._SMWorkspaceConnectionInfoId)
+                return isOpen;
+            }else{
+                var {isOpen} = await W.open(this._SMWorkspaceId,workspaceConnectionInfo._SMWorkspaceConnectionInfoId);
+                console.log('workspace open connectionInfo:'+isOpen);
+                return isOpen;
+            }
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取工作空间下的Maps对象
+     * @memberOf Worksapce
+     * @deprecated Maps类已不推荐使用
+     * @memberOf Workspace
+     * @returns {Promise.<Maps>}
+     */
+    async getMaps(){
+        try{
+            var {mapsId} = await W.getMaps(this._SMWorkspaceId);
+            var maps = new Maps();
+            maps._SMMapsId = mapsId;
+            return maps;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 根据地图序号获得地图名称
+     * @memberOf Workspace
+     * @param {number} mapIndex
+     * @returns {string}
+     */
+    async getMapName(mapIndex){
+        try{
+            var {mapName} = await W.getMapName(this._SMWorkspaceId,mapIndex);
+            return mapName;
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 打开数据源 jsonObject 获取网络数据源
+     * @memberOf Workspace
+     * @param {object} jsonObject {engineType:<int>引擎类型 ,server:<sring>文件/服务器路径 ,driver:<string>驱动名称(可选参数)}
+     * @returns {Promise.<datasource>}
+     */
+    
+    async openDatasource(jsonObject){
+        try{
+            if(jsonObject.webBBox){
+                var rect = jsonObject.webBBox;
+                if(typeof rect != 'string') jsonObject.webBBox = rect._SMRectangle2DId;
+            }
+            var {datasourceId} = await W.openDatasource(this._SMWorkspaceId,jsonObject);
+            var datasource = new Datasource();
+            datasource._SMDatasourceId = datasourceId;
+            return datasource;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /*
+     * 打开WMS协议类型数据源
+     * @memberOf Workspace
+     * @param {string} server
+     * @param {number} engineType
+     * @param {string} driver
+     * @param {string} version
+     * @param {string} visibleLayers
+     * @param {object} webBox
+     * @param {object} webCoordinate
+     * @returns {Promise.<void>}
+     */
+    /*
+    async openWMSDatasource(server,engineType,driver,version,visibleLayers,webBox,webCoordinate){
+        try{
+            await W.openWMSDatasource(this._SMWorkspaceId,server,engineType,driver,
+                version,visibleLayers,webBox,webCoordinate);
+        }catch(e){
+            console.error(e);
+        }
+    } */
+
+    /**
+     * 保存工作空间
+     * @memberOf Workspace
+     * @param {string} server - 另存url(可选参数)
+     * @returns {boolean}
+     */
+    async saveWorkspace(server){
+        try{
+            if(server){
+                var {saved} = await W.saveWorkspaceWithServer(this._SMWorkspaceId,server);
+            }else{
+                var {saved} = await W.saveWorkspace(this._SMWorkspaceId);
+            }
+            return saved;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 关闭工作空间
+     * @memberOf Workspace
+     * @returns {boolean}
+     */
+    async closeWorkspace(){
+        try{
+            var {closed} = await W.closeWorkspace(this._SMWorkspaceId);
+            return closed;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 创建数据集
+     * @memberOf Workspace
+     * @param filePath 指定创建数据集路径
+     * @param engineType 数据集引擎类型
+     * @returns {Promise.<Datasource>}
+     */
+    async createDatasource(filePath,engineType){
+        try{
+            var {datasourceId} = await W.createDatasource(this._SMWorkspaceId,filePath,engineType);
+            var datasource = new Ds();
+            datasource._SMDatasourceId = datasourceId;
+            return datasource;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 关闭指定名称的数据集
+     * @memberOf Workspace
+     * @param datasourceName 数据集名称
+     * @returns {Promise.<boolean>}
+     */
+    async closeDatasource(datasourceName){
+        try{
+            var {closed} = await W.closeDatasource(this._SMWorkspaceId,datasourceName);
+
+            return closed;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+
+    /**
+     * 关闭所有数据集
+     * @memberOf Workspace
+     */
+    async closeAllDatasource(){
+        try{
+            await W.closeAllDatasource(this._SMWorkspaceId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 移除地图
+     * @memberOf Workspace
+     * @param mapName
+     * @returns {boolean}
+     */
+    async removeMap(mapName){
+        try{
+            var {removed} = await W.removeMap(this._SMWorkspaceId,mapName);
+            return removed;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 清空所有地图
+     * @memberOf Workspace
+     */
+    async clearMap(){
+        try{
+            await W.clearMap(this._SMWorkspaceId);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 获取三维场景名称
+     * @memberOf Workspace
+     * @param index
+     */
+    async getSceneName(index){
+        try{
+            var {name} = await W.getSceneName(this._SMWorkspaceId,index);
+            return name;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/WorkspaceConnectionInfo.html b/API Doc/WorkspaceConnectionInfo.html new file mode 100644 index 00000000..f41e06bf --- /dev/null +++ b/API Doc/WorkspaceConnectionInfo.html @@ -0,0 +1,703 @@ + + + + + JSDoc: Class: WorkspaceConnectionInfo + + + + + + + + + + +
+ +

Class: WorkspaceConnectionInfo

+ + + + + + +
+ +
+ +

WorkspaceConnectionInfo

+ + +
+ +
+
+ + + + + +

new WorkspaceConnectionInfo()

+ + + + + +
+ 工作空间连接信息类。 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) createJSObj() → {Promise.<WorkspaceConnectionInfo>}

+ + + + + +
+ 创建一个WorkspaceConnectionInfo对象 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<WorkspaceConnectionInfo> + + +
+
+ + + + + + + + + + +

(static) setPassWord(path) → {Promise.<void>}

+ + + + + +
+ 设置数据源密码 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setServer(path) → {Promise.<void>}

+ + + + + +
+ 设置数据源路径 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + +

(static) setType(type) → {Promise.<void>}

+ + + + + +
+ 设置工作空间类型 +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + Workspace
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/WorkspaceConnectionInfo.js.html b/API Doc/WorkspaceConnectionInfo.js.html new file mode 100644 index 00000000..03c62aff --- /dev/null +++ b/API Doc/WorkspaceConnectionInfo.js.html @@ -0,0 +1,124 @@ + + + + + JSDoc: Source: WorkspaceConnectionInfo.js + + + + + + + + + + +
+ +

Source: WorkspaceConnectionInfo.js

+ + + + + + +
+
+
/*********************************************************************************
+ Copyright © SuperMap. All rights reserved.
+ Author: Will
+ E-mail: pridehao@gmail.com
+ 
+ **********************************************************************************/
+var {NativeModules}=require('react-native');
+let WCI=NativeModules.JSWorkspaceConnectionInfo;
+
+/**
+ * @class WorkspaceConnectionInfo
+ * @description 工作空间连接信息类。
+ */
+export default class WorkspaceConnectionInfo{
+    /**
+     * 创建一个WorkspaceConnectionInfo对象
+     * @memberOf WorkspaceConnectionInfo
+     * @returns {Promise.<WorkspaceConnectionInfo>}
+     */
+    async createJSObj(){
+        try{
+            var {ID}=await WCI.createJSObj();
+            var workspaceConnectionInfo = new WorkspaceConnectionInfo();
+            workspaceConnectionInfo._SMWorkspaceConnectionInfoId = ID;
+            return workspaceConnectionInfo;
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置工作空间类型
+     * @memberOf WorkspaceConnectionInfo
+     * @param {number} type - {@link Workspace}
+     * @returns {Promise.<void>}
+     */
+    async setType(type){
+        try{
+            await WCI.setType(this._SMWorkspaceConnectionInfoId,type);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+    /**
+     * 设置数据源路径
+     * @memberOf WorkspaceConnectionInfo
+     * @param path
+     * @returns {Promise.<void>}
+     */
+    async setServer(path){
+        try{
+            await WCI.setServer(this._SMWorkspaceConnectionInfoId,path);
+        }catch(e){
+            console.error(e);
+        }
+    }
+    
+    /**
+     * 设置数据源密码
+     * @memberOf WorkspaceConnectionInfo
+     * @param path
+     * @returns {Promise.<void>}
+     */
+    async setPassWord(passWord){
+        try{
+            await WCI.setPassWord(this._SMWorkspaceConnectionInfoId,passWord);
+        }catch(e){
+            console.error(e);
+        }
+    }
+
+}
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/API Doc/fonts/OpenSans-Bold-webfont.eot b/API Doc/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 00000000..5d20d916 Binary files /dev/null and b/API Doc/fonts/OpenSans-Bold-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-Bold-webfont.svg b/API Doc/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 00000000..3ed7be4b --- /dev/null +++ b/API Doc/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-Bold-webfont.woff b/API Doc/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 00000000..1205787b Binary files /dev/null and b/API Doc/fonts/OpenSans-Bold-webfont.woff differ diff --git a/API Doc/fonts/OpenSans-BoldItalic-webfont.eot b/API Doc/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 00000000..1f639a15 Binary files /dev/null and b/API Doc/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-BoldItalic-webfont.svg b/API Doc/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 00000000..6a2607b9 --- /dev/null +++ b/API Doc/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-BoldItalic-webfont.woff b/API Doc/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 00000000..ed760c06 Binary files /dev/null and b/API Doc/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/API Doc/fonts/OpenSans-Italic-webfont.eot b/API Doc/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 00000000..0c8a0ae0 Binary files /dev/null and b/API Doc/fonts/OpenSans-Italic-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-Italic-webfont.svg b/API Doc/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 00000000..e1075dcc --- /dev/null +++ b/API Doc/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-Italic-webfont.woff b/API Doc/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 00000000..ff652e64 Binary files /dev/null and b/API Doc/fonts/OpenSans-Italic-webfont.woff differ diff --git a/API Doc/fonts/OpenSans-Light-webfont.eot b/API Doc/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 00000000..14868406 Binary files /dev/null and b/API Doc/fonts/OpenSans-Light-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-Light-webfont.svg b/API Doc/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 00000000..11a472ca --- /dev/null +++ b/API Doc/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-Light-webfont.woff b/API Doc/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 00000000..e7860748 Binary files /dev/null and b/API Doc/fonts/OpenSans-Light-webfont.woff differ diff --git a/API Doc/fonts/OpenSans-LightItalic-webfont.eot b/API Doc/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 00000000..8f445929 Binary files /dev/null and b/API Doc/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-LightItalic-webfont.svg b/API Doc/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 00000000..431d7e35 --- /dev/null +++ b/API Doc/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-LightItalic-webfont.woff b/API Doc/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 00000000..43e8b9e6 Binary files /dev/null and b/API Doc/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/API Doc/fonts/OpenSans-Regular-webfont.eot b/API Doc/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 00000000..6bbc3cf5 Binary files /dev/null and b/API Doc/fonts/OpenSans-Regular-webfont.eot differ diff --git a/API Doc/fonts/OpenSans-Regular-webfont.svg b/API Doc/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 00000000..25a39523 --- /dev/null +++ b/API Doc/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/API Doc/fonts/OpenSans-Regular-webfont.woff b/API Doc/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 00000000..e231183d Binary files /dev/null and b/API Doc/fonts/OpenSans-Regular-webfont.woff differ diff --git a/API Doc/index.html b/API Doc/index.html new file mode 100644 index 00000000..59bf7157 --- /dev/null +++ b/API Doc/index.html @@ -0,0 +1,65 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/API Doc/scripts/linenumber.js b/API Doc/scripts/linenumber.js new file mode 100644 index 00000000..8d52f7ea --- /dev/null +++ b/API Doc/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/API Doc/scripts/prettify/Apache-License-2.0.txt b/API Doc/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/API Doc/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/API Doc/scripts/prettify/lang-css.js b/API Doc/scripts/prettify/lang-css.js new file mode 100644 index 00000000..041e1f59 --- /dev/null +++ b/API Doc/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/API Doc/scripts/prettify/prettify.js b/API Doc/scripts/prettify/prettify.js new file mode 100644 index 00000000..eef5ad7e --- /dev/null +++ b/API Doc/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p th:last-child { border-right: 1px solid #ddd; } + +.ancestors { color: #999; } +.ancestors a +{ + color: #999 !important; + text-decoration: none; +} + +.clear +{ + clear: both; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.details { margin-top: 14px; border-left: 2px solid #DDD; } +.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 70px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } +.details pre.prettyprint { margin: 0 } +.details .object-value { padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-size: 107%; + margin: 0; +} + +.prettyprint +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.prettyprint code +{ + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #4D4E53; +} + +.prettyprint code span.line +{ + display: inline-block; +} + +.prettyprint.linenums +{ + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol +{ + padding-left: 0; +} + +.prettyprint.linenums li +{ + border-left: 3px #ddd solid; +} + +.prettyprint.linenums li.selected, +.prettyprint.linenums li.selected * +{ + background-color: lightyellow; +} + +.prettyprint.linenums li * +{ + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; +} + +.params td.description > p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/API Doc/styles/prettify-jsdoc.css b/API Doc/styles/prettify-jsdoc.css new file mode 100644 index 00000000..5a2526e3 --- /dev/null +++ b/API Doc/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/API Doc/styles/prettify-tomorrow.css b/API Doc/styles/prettify-tomorrow.css new file mode 100644 index 00000000..b6f92a78 --- /dev/null +++ b/API Doc/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/NativeModule/.DS_Store b/NativeModule/.DS_Store deleted file mode 100644 index 11b55a7d..00000000 Binary files a/NativeModule/.DS_Store and /dev/null differ diff --git a/NativeModule/AMQPManager.js b/NativeModule/AMQPManager.js new file mode 100755 index 00000000..0958cab7 --- /dev/null +++ b/NativeModule/AMQPManager.js @@ -0,0 +1,99 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ + +import {NativeModules} from 'react-native'; +import AMQPSender from './AMQPSender.js'; +import AMQPReceiver from './AMQPReceiver.js'; +let APM = NativeModules.JSAMQPManager; + +/** + * @class AMQPManager + * @description AMQP 管理类。 + 负责队列,交换机,接收端,发送端的创建,以及绑定。使用前需要连接服务器。(暂不支持android设备) + */ +export default class AMQPManager{ + + /** + * 创建一个AMQPManager对象。 + * @memberOf AMQPManager + * @returns {Promise.} + */ + async createObj(){ + try{ + var {_AMQPManagerId} = await APM.createObj(); + var AMQPManagerObj = new AMQPManager(); + AMQPManagerObj._SMAMQPManagerId = _AMQPManagerId; + return AMQPManagerObj; + }catch(e){ + console.error(e); + } + } + /** + * 创建一个接收端。 + * @memberOf AMQPManager + * @param {string} queueName - 消息队列名称 + * @returns {Promise.} + */ + async newReceiver(queueName){ + try{ + var {AMQPReceiverId} = await APM.newReceiver(this._SMAMQPManagerId,queueName); + var newAPR = new AMQPReceiver(); + newAPR._SMAMQPReceiverId = AMQPReceiverId; + return newAPR; + }catch(e){ + console.error(e); + } + } + + /** + * 创建一个发送端 + * @memberOf AMQPManager + * @returns {Promise.} + */ + async newSender(){ + try{ + var {AMQPSenderId} = await APM.newSender(this._SMAMQPManagerId); + var newAPS = new AMQPSender(); + newAPS._SMAMQPSenderId = AMQPSenderId; + return newAPS; + }catch(e){ + console.error(e); + } + } + + /** + * 建立链接 + * @memberOf AMQPManager + * @param {object} paramObj - + {IP:ip地址, + Port:端口号,HostName:虚拟机主机名称, + UserName:账户,PassWord:密码, + ClientId:客户端ID} + * @returns {Promise.} + */ + async connection(paramObj){ + try{ + var {isConnection} = await APM.connection(this._SMAMQPManagerId,paramObj); + return isConnection; + }catch(e){ + console.error(e); + } + } + + /** + * 断开链接 + * @memberOf AMQPManager + * @returns {Promise.} + */ + async disconnection(){ + try{ + await APM.disconnection(this._SMAMQPManagerId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/AMQPReceiver.js b/NativeModule/AMQPReceiver.js new file mode 100755 index 00000000..32499dc6 --- /dev/null +++ b/NativeModule/AMQPReceiver.js @@ -0,0 +1,55 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ + +import {NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform} from 'react-native'; +let APR = NativeModules.JSAMQPReceiver; + +const nativeEvt = new NativeEventEmitter(APR); +/** + * @class AMQPReceiver + * @description AMQP消息接收类(该类不能创建实例,需通过AMQPManager.newReceiver()创建实例)。(暂不支持安卓设备) + */ +export default class AMQPReceiver{ + + /** + * 接收信息 + * @memberOf AMQPReceiver + * @param {string} queueNum - 消息队列序号(1-5,默认为1)。 + * @param {function} loadingMessage - 回调方法,用于处理接收到信息。 + * @returns {Promise.} + */ + async receiveMessage(queueNum,loadingMessage){ + try{ + switch(queueNum){ + case 1 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message1"; + break; + case 2 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message2"; + break; + case 3 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message3"; + break; + case 4 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message4"; + break; + case 5 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message5"; + break; + default : var str = "com.supermap.RN.JSAMQPReceiver.receive_message1"; + } + //差异化处理 + if(Platform.OS === 'ios'){ + nativeEvt.addListener(str,function (e) { + if(typeof loadingMessage === 'function'){ + loadingMessage(e.clientId,e.message); + }else{ + console.error("Please set a callback function to the first argument."); + } + }); + await APR.receiveMessage(this._SMAMQPReceiverId,str); + } + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/AMQPSender.js b/NativeModule/AMQPSender.js new file mode 100755 index 00000000..52b8c3a8 --- /dev/null +++ b/NativeModule/AMQPSender.js @@ -0,0 +1,33 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ + +import {NativeModules} from 'react-native'; +let APS = NativeModules.JSAMQPSender; + +/** + * @class AMQPSender + * @description AMQP 消息发送类。(该类不能创建实例,需通过AMQPManager.newSender()创建实例)。(暂不支持android设备) + */ +export default class AMQPSender{ + + /** + * 发送消息。 + * @memberOf AMQPSender + * @param {string} exchange - 交换器 + * @param {string} routingKey - 路由关键字 + * @param {string} message - 消息 + * @returns {Promise.} + */ + async sendMessage(exchange,routingKey,message){ + try{ + await APS.sendMessage(this._SMAMQPSenderId,exchange,routingKey,message); + }catch(e){ + console.error(e); + } + } + +} diff --git a/NativeModule/BarChart.js b/NativeModule/BarChart.js new file mode 100755 index 00000000..0e4a7cfd --- /dev/null +++ b/NativeModule/BarChart.js @@ -0,0 +1,164 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ + +import {NativeModules} from 'react-native'; +import ChartView from './ChartView.js'; +let BC = NativeModules.JSBarChart; +/** + * @class BarChart + * @description 柱状图类 + */ +export default class BarChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"barchartId",{ + get:function(){ + return this.chartviewId + }, + set:function (barchartId){ + this.chartviewId = barchartId; + } + }) + } + /** + * 设置数值是否按照X轴分布 + * @memberOf BarChart + * @param {boolean} b + * @returns {Promise.} + */ + async setValueAlongXAxis(b){ + try{ + await BC.setValueAlongXAxis(this.barchartId,b); + }catch(e){ + console.error(e); + } + } + /** + * 判断数值是否按照X轴分布 + * @memberOf BarChart + * @returns {Promise.} + */ + async isValueAlongXAxis(){ + try{ + var{isAlong} = await BC.isValueAlongXAxis(this.barchartId); + return isAlong; + }catch(e){ + console.error(e); + } + } + + /** + * 设置X坐标轴显示标签 + * @memberOf BarChart + * @param {object} xAxisLables - 数据数组 + * @returns {Promise.} + */ + async setXAxisLables(xAxisLables){ + try{ + await BC.setXAxisLables(this.barchartId,xAxisLables); + }catch(e){ + console.error(e); + } + } + + /** + * 获取X坐标轴显示标签 + * @memberOf ChartView + * @returns {Promise.} + */ + async getXAxisLables(){ + try{ + var {xAxisLables} = await BC.getXAxisLables(this.barchartId); + return xAxisLables; + }catch(e){ + console.error(e); + } + } + + /** + * 设置X坐标轴标题。 + * @memberOf ChartView + * @param {string} title - 标题 + * @returns {Promise.} + */ + async setXAxisTitle(title){ + try{ + await BC.setXAxisTitle(this.barchartId,title); + }catch(e){ + console.error(e); + } + } + + /** + * 获取X坐标轴标题。 + * @memberOf ChartView + * @returns {Promise.} + */ + async getXAxisTitle(){ + try{ + var {title} = await BC.getXAxisTitle(this.barchartId); + return title; + }catch(e){ + console.error(e); + } + } + + /** + * 设置Y坐标轴标题。 + * @memberOf ChartView + * @param {string} title - 标题 + * @returns {Promise.} + */ + async setYAxisTitle(title){ + try{ + await BC.setYAxisTitle(this.barchartId,title); + }catch(e){ + console.error(e); + } + } + + /** + * 获取Y坐标轴标题。 + * @memberOf ChartView + * @returns {Promise.} + */ + async getYAxisTitle(){ + try{ + var {title} = await BC.getYAxisTitle(this.barchartId); + return title; + }catch(e){ + console.error(e); + } + } + + /** + * 设置图表选中回调 + * @memberOf ChartView + * @returns {Promise.} + */ + async setChartOnSelected(){ + try{ + await BC.setChartOnSelected(this.barchartId); + }catch(e){ + console.error(e); + } + } + + /** + * 设置选中的对象ID + * @memberOf ChartView + * @param {number} geoId + * @returns {Promise.} + */ + async setSelectedGeometryID(geoId){ + try{ + await BC.setSelectedGeometryID(this.chartviewId,geoId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/BarChartData.js b/NativeModule/BarChartData.js new file mode 100755 index 00000000..7ebdbef7 --- /dev/null +++ b/NativeModule/BarChartData.js @@ -0,0 +1,89 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import {NativeModules} from 'react-native'; +let BCD = NativeModules.JSBarChartData; +import ChartData from './ChartData.js'; +import BarChartDataItem from './BarChartDataItem.js' +/** + * @class BarChartData + */ +export default class BarChartData extends ChartData{ + constructor(){ + super(); + Object.defineProperty(this,"barChartDataId",{ + get:function(){ + return this.chartDataId + }, + set:function(barChartDataId){ + this.chartDataId = barChartDataId; + } + }) + } + /** + * 创建一个BarChartData对象 + * @memberOf BarChartData + * @param {string}itemName - 图表名称 + * @param {object}values - 图表数据 + * @param {string}label - 图表标题 + * @param {int}color - 图表颜色 + * @param {int}geoId - ID + * @returns {Promise.} + */ + async createObj(itemName,values){ + try{ + var idArr = []; + for(var i =0;i<=values.length-1;i++){ + var id = values[i]._SMBarChartDataItemId; + idArr.push(id); + } + var {_barchartdataId} = await BCD.createObj(itemName,idArr); + var barChartData = new BarChartData(); + barChartData.barChartDataId = _barchartdataId; + return barChartData; + }catch(e){ + console.error(e); + } + } + /** + *  设置图柱子项的值 + * @memberOf BarChartData + * @param {array}values - 图饼子项值的集合 + * @returns {Promise.} + */ + async setValues(values){ + try{ + var idArr = []; + for(var i =0;i} + */ + async getValues(){ + try{ + var objArr = []; + var {values} = await BCD.getValues(this.barChartDataId); + for(var i =0;i} + */ + async createObj(value,colorArr,labelString,geoId){ + try{ + var {_SMBarChartDataItemId} = await BCDI.createObj(value,colorArr,labelString,geoId); + var barChartDataItem = new BarChartDataItem(); + barChartDataItem._SMBarChartDataItemId = _SMBarChartDataItemId; + return barChartDataItem; + }catch(e){ + console.error(e); + } + } + /** + *  设置图柱子项的值 + * @memberOf BarChartDataItem + * @param {number}value - 图柱子项的值 + * @returns {Promise.} + */ + async setValue(value){ + try{ + await BCDI.setValue(this._SMBarChartDataItemId,value); + }catch(e){ + console.error(e); + } + } + + /** + * 获取图柱子项的值 + * @memberOf BarChartDataItem + * @returns {Promise.} + */ + async getValues(){ + try{ + var {value} = await BCDI.getValues(this._SMBarChartDataItemId); + return value; + }catch(e){ + console.error(e); + } + } + + /** + *  设置关联polygon的id + * @memberOf BarChartDataItem + * @param {number}geoId - 关联polygon的id + * @returns {Promise.} + */ + async setGeometryID(geoId){ + try{ + await BCDI.setGeometryID(this._SMBarChartDataItemId,geoId); + }catch(e){ + console.error(e); + } + } + + /** + *  设置图柱子项的标题 + * @memberOf BarChartDataItem + * @param {string}labelString - 图柱子项的标题 + * @returns {Promise.} + */ + async setLabel(labelString){ + try{ + await BCDI.setLabel(this._SMBarChartDataItemId,labelString); + }catch(e){ + console.error(e); + } + } + + /** + * 获取图柱子项的标题 + * @memberOf BarChartDataItem + * @returns {Promise.} + */ + async getLabel(){ + try{ + var {label} = await BCDI.getLabel(this._SMBarChartDataItemId); + return label; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/BufferAnalyst.js b/NativeModule/BufferAnalyst.js new file mode 100755 index 00000000..706c2334 --- /dev/null +++ b/NativeModule/BufferAnalyst.js @@ -0,0 +1,82 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + ref:DatasetVector + **********************************************************************************/ +import {NativeModules} from 'react-native'; +let BA = NativeModules.JSBufferAnalyst; + +/** + * @class BufferAnalyst + * @description 缓冲区分析类。该类用于为点、线、面数据集(或记录集)创建缓冲区,包括单边缓冲区、多重缓冲区和线单边多重缓冲区。 + **/ +export default class BufferAnalyst { + + /** + * 创建矢量数据集缓冲区 + * @memberOf BufferAnalyst + * @param {Dataset} sourceDataSet - 源矢量数据集 + * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集 + * @param {BufferAnalystParameter} bufferAnalystParam - 缓冲区分析参数对象 + * @param {boolean} isUnion - 是否合并缓冲区 + * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性 + * @returns {Promise.} + */ + async createBuffer(sourceDataSet,resultDataSet,bufferAnalystParam,isUnion,isAttributeRetained){ + try{ + var {isCreate} = await BA.createBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,bufferAnalystParam._SMBufferAnalystParameterId,isUnion,isAttributeRetained); + + return isCreate; + }catch (e){ + console.error(e); + } + } + + /** + * 创建矢量数据集单边多重缓冲区 + * @memberOf BufferAnalyst + * @param {Dataset} sourceDataSet - 源矢量数据集 + * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集 + * @param {array} arrBufferRadius - 指定的多重缓冲区半径列表 + * @param {number} bufferRadiusUnit - 指定的缓冲区半径单位 + * @param {number} semicircleSegment - 指定的弧短拟合数 + * @param {boolean} isLeft - 是否生成左缓冲区 + * @param {boolean} isUnion - 是否合并缓冲区 + * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性 + * @param {boolean} isRing - 是否生成环装缓冲区 + * @returns {Promise.} + */ + async createLineOneSideMultiBuffer(sourceDataSet,resultDataSet,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isLeft,isUnion,isAttributeRetained,isRing){ + try{ + var {isCreate} = await BA.createLineOneSideMultiBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isLeft,isUnion,isAttributeRetained,isRing); + + return isCreate; + }catch (e){ + console.error(e); + } + } + + /** + * 创建矢量数据集多重缓冲区 + * @memberOf BufferAnalyst + * @param {Dataset} sourceDataSet - 源矢量数据集 + * @param {Dataset} sourceDataSet - 用于存储缓冲区分析结果的数据集 + * @param {array} arrBufferRadius - 指定的多重缓冲区半径列表 + * @param {number} bufferRadiusUnit - 指定的缓冲区半径单位 + * @param {number} semicircleSegment - 指定的弧短拟合数 + * @param {boolean} isUnion - 是否合并缓冲区 + * @param {boolean} isAttributeRetained - 是否保留进行缓冲区分析的对象的字段属性 + * @param {boolean} isRing - 是否生成环装缓冲区 + * @returns {Promise.} + */ + async createMultiBuffer(sourceDataSet,resultDataSet,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isUnion,isAttributeRetained,isRing){ + try{ + var {isCreate} = await BA.createMultiBuffer(sourceDataSet._SMDatasetVectorId,resultDataSet._SMDatasetVectorId,arrBufferRadius,bufferRadiusUnit,semicircleSegment,isUnion,isAttributeRetained,isRing); + + return isCreate; + }catch (e){ + console.error(e); + } + } +} diff --git a/NativeModule/BufferAnalystGeometry.js b/NativeModule/BufferAnalystGeometry.js old mode 100644 new mode 100755 index f6d0552f..9e8f8aaf --- a/NativeModule/BufferAnalystGeometry.js +++ b/NativeModule/BufferAnalystGeometry.js @@ -1,19 +1,38 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + ref:Geometry,BufferAnalystParameter,PrjCoordSys,GeoRegion + description:此方法ios/android 应该存在差异,待排查 + **********************************************************************************/ import {NativeModules} from 'react-native'; let BAG = NativeModules.JSBufferAnalystGeometry; import GeoRegion from './GeoRegion.js'; +/** + * @class BufferAnalyst + * @description 几何对象缓冲区分析类。 + **/ export default class BufferAnalystGeometry { + + /** + * (静态方法)根据给定的几何对象及缓冲区分析参数对象创建缓冲区。 + * @memberOf BufferAnalystGeometry + * @param {Geometry} geometry - 几何对象 + * @param {BufferAnalystParameter} bufferAnalystParameter - 缓冲区分析参数对象 + * @param {PrjCoordSys } prjCoordSys - 地图的投影坐标系 + * @returns {Promise.} + */ static async createBuffer(geometry,bufferAnalystParameter,prjCoordSys){ try{ - var {geoRegionId} = await BAG.createBuffer(this.bufferAnalystGeometryId, - geometry.geometryId,bufferAnalystParameter.bufferAnalystParameterId,prjCoordSys.prjCoordSysId); + var {geoRegionId} = await BAG.createBuffer(geometry._SMGeometryId,bufferAnalystParameter._SMBufferAnalystParameterId,prjCoordSys._SMPrjCoordSysId); var geoRegion = new GeoRegion(); - geoRegion.geoRegionId = geoRegionId; - console.log("geoRegion.geometryId:"+geoRegion.geometryId); - console.log("geoRegion.geoRegionId:" + geoRegion.geoRegionId); + geoRegion._SMGeoRegionId = geoRegionId; +// console.log("geoRegion.geometryId:"+geoRegion.geometryId); +// console.log("geoRegion.geoRegionId:" + geoRegion.geoRegionId); return geoRegion; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/BufferAnalystParameter.js b/NativeModule/BufferAnalystParameter.js old mode 100644 new mode 100755 index 378a2407..9eadecce --- a/NativeModule/BufferAnalystParameter.js +++ b/NativeModule/BufferAnalystParameter.js @@ -1,44 +1,226 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + ref:none + description:涉及枚举。 + **********************************************************************************/ import {NativeModules} from 'react-native'; let BAP = NativeModules.JSBufferAnalystParameter; +/** + * @class BufferAnalystParameter + * @description 缓冲区分析参数类,用于为缓冲区分析提供必要的参数信息。 + **/ export default class BufferAnalystParameter { static ENDTYPE = { ROUND:1, FLAT:2, } + + static RADIUSUNIT = { + MiliMeter:10, + CentiMeter:100, + DeciMeter:1000, + Meter:10000, + KiloMeter:10000000, + Yard:9144, + Inch:254, + Foot:3048, + Mile:16090000, + } + /** + * 构造BufferAnalystParameter对象 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ async createObj(){ try{ var {bufferAnalystParameterId} = await BAP.createObj(); var bufferAnalystParameter = new BufferAnalystParameter(); - bufferAnalystParameter.bufferAnalystParameterId = bufferAnalystParameterId; + bufferAnalystParameter._SMBufferAnalystParameterId = bufferAnalystParameterId; return bufferAnalystParameter; }catch (e){ console.error(e); } } + /** + * 设置缓冲区端点类型。 + * @memberOf BufferAnalystParameter + * @param {number} bufferEndType - 缓冲区端点类型 + * @returns {Promise.} + */ async setEndType(bufferEndType){ try{ - await BAP.setEndType(this.bufferAnalystParameterId,bufferEndType); + await BAP.setEndType(this._SMBufferAnalystParameterId,bufferEndType); + }catch (e){ + console.error(e); + } + } + + /** + * 获取缓冲区端点类型。 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ + async getEndType(){ + try{ + var {EndType} = await BAP.getEndType(this._SMBufferAnalystParameterId); + var endTypeStr = 'type'; + switch(EndType){ + case 1 : endTypeStr = 'ROUND'; + break; + case 2 : endTypeStr = 'FLAT'; + break; + default : throw new Error("Unknown EndType Type"); + } + return endTypeStr; }catch (e){ console.error(e); } } + /** + * 设置左缓冲区的距离。 + * @memberOf BufferAnalystParameter + * @param {number | string} distance - 左缓冲区的距离 + * @returns {Promise.} + */ async setLeftDistance(distance){ try{ - await BAP.setLeftDistance(this.bufferAnalystParameterId,distance); + if(typeof distance == 'number'){ + await BAP.setLeftDistance(this._SMBufferAnalystParameterId,distance); + }else{ + await BAP.setLeftDistanceByStr(this._SMBufferAnalystParameterId,distance); + } + }catch (e){ + console.error(e); + } + } + + /** + * 获取左缓冲区的距离。 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ + async getLeftDistance(){ + try{ + var {leftDistance} = await BAP.getLeftDistance(this._SMBufferAnalystParameterId); + return leftDistance; }catch (e){ console.error(e); } } + /** + * 设置右缓冲区的距离。 + * @memberOf BufferAnalystParameter + * @param {number | string} distance - 左缓冲区的距离 + * @returns {Promise.} + */ async setRightDistance(distance){ try{ - await BAP.setRightDistance(this.bufferAnalystParameterId,distance); + if(typeof distance == 'number'){ + await BAP.setRightDistance(this._SMBufferAnalystParameterId,distance); + }else{ + await BAP.setRightDistanceByStr(this._SMBufferAnalystParameterId,distance); + } + }catch (e){ + console.error(e); + } + } + + /** + * 获取右缓冲区的距离。 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ + async getRightDistance(){ + try{ + var {rightDistance} = await BAP.getRightDistance(this._SMBufferAnalystParameterId); + return rightDistance; + }catch (e){ + console.error(e); + } + } + + /** + * 设置缓冲区分析的半径单位。 + * @memberOf BufferAnalystParameter + * @param {number} radiusUnit - 缓冲区分析的半径单位 + * @returns {Promise.} + */ + async setRadiusUnit(radiusUnit){ + try{ + await BAP.setRadiusUnit(this._SMBufferAnalystParameterId,radiusUnit); + }catch (e){ + console.error(e); + } + } + + /** + * 获取缓冲区分析的半径单位。 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ + async getRadiusUnit(){ + try{ + var {radiusUnit} = await BAP.getRadiusUnit(this._SMBufferAnalystParameterId); + var radiusUnitStr = 'type'; + switch(EndType){ + case 10 : radiusUnitStr = 'MiliMeter'; + break; + case 100 : radiusUnitStr = 'CentiMeter'; + break; + case 1000 : radiusUnitStr = 'DeciMeter'; + break; + case 10000 : radiusUnitStr = 'Meter'; + break; + case 10000000 : radiusUnitStr = 'KiloMeter'; + break; + case 9144 : radiusUnitStr = 'Yard'; + break; + case 254 : radiusUnitStr = 'Inch'; + break; + case 3048 : radiusUnitStr = 'Foot'; + break; + case 16090000 : radiusUnitStr = 'Mile'; + break; + default : throw new Error("Unknown EndType Type"); + } + return radiusUnitStr; + }catch (e){ + console.error(e); + } + } + + /** + * 设置半圆弧线段个数,即用多少个线段来模拟一个半圆。 + * @memberOf BufferAnalystParameter + * @param {number} segment - 半圆弧线段个数 + * @returns {Promise.} + */ + async setSemicircleLineSegment(segment){ + try{ + await BAP.setSemicircleLineSegment(this._SMBufferAnalystParameterId,segment); + }catch (e){ + console.error(e); + } + } + + /** + * 获取半圆弧线段个数,即用多少个线段来模拟一个半圆。 + * @memberOf BufferAnalystParameter + * @returns {Promise.} + */ + async getSemicircleLineSegment(){ + try{ + var {segment} = await BAP.getSemicircleLineSegment(this._SMBufferAnalystParameterId); + return segment; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/CallOut.js b/NativeModule/CallOut.js old mode 100644 new mode 100755 index 4f154a61..62d034a1 --- a/NativeModule/CallOut.js +++ b/NativeModule/CallOut.js @@ -1,51 +1,250 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:N/A + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let C = NativeModules.JSCallOut; +const STARTPOINT = './resource/startpoint.png' +const DESTPOINT = './resource/destpoint.png' + +/** + * @class Callout + * @description 点标注类,最多支持500条记录的显示。 + * @property {number} TYPE(NONE) - 无对齐方式。 + * @property {number} TYPE(LEFT) - 左对齐。 + * @property {number} TYPE(TOP) - 上对齐。 + * @property {number} TYPE(RIGHT) - 右对齐。 + * @property {number} TYPE(BOTTOM) - 下对齐。 + * @property {number} TYPE(CENTER) - 中心对齐。 + * @property {number} TYPE(LEFTTOP) - 左上对齐。 + * @property {number} TYPE(RIGHTTOP) - 右上对齐。 + * @property {number} TYPE(LEFTBOTTOM) - 左下对齐。 + * @property {number} TYPE(RIGHTBOTTOM) - 右下对齐。 + */ export default class CallOut { - async createObj(mapView){ - try{ - var {callOutId} = await C.createObj(mapView.mapViewId); - var callOut = new CallOut(); - callOut.callOutId = callOutId; - return callOut; - }catch (e){ - console.error(e); - } + /** + * 创建Callout对象 + * @memberOf CallOut + * @param {object} mapControl + * @returns {Promise.} + */ + // async createObj(mapCtrl, colorArr, alignment) { + async createObj(mapView, colorArr, alignment) { + try { + if (arguments.length === 1) { + // var { callOutId } = await C.createObj(mapCtrl._SMMapControlId); + var { callOutId } = await C.createObj(mapView._SMMapViewId); + } else if (arguments.length === 3) { + // var { callOutId } = await C.createObjWithStyle(mapCtrl._SMMapControlId, colorArr, alignment); + var { callOutId } = await C.createObjWithStyle(mapView._SMMapViewId, colorArr, alignment); + } else { + throw new Error('input param number should be 1 or 3,please check your params'); + } + var callout = new CallOut(); + callout._SMCalloutId = callOutId; + return callout; + } catch (e) { + console.error(e); } - - async setStyle(){ - try{ - await C.setStyle(this.callOutId); - }catch (e){ - console.error(e); - } + } + + /** + * 在指定位置显示Callout + * @memberOf CallOut + * @param {object} point2D + * @returns {Promise.} + */ + async showAtPoint2d(point2D) { + try { + await C.showAtPoint2d(this._SMCalloutId, point2D.point2DId); + } catch (e) { + console.error(e); } - - async setCustomize(isSet){ - try{ - await C.setCustomize(this.callOutId,isSet); - }catch (e){ - console.error(e); - } + } + + /** + * 在指定位置显示Callout + * @memberOf CallOut + * @param {number} x + * @param {number} y + * @returns {Promise.} + */ + async showAtXY(x, y) { + try { + await C.showAtXY(this._SMCalloutId, x, y); + } catch (e) { + console.error(e); } - - /** - * - * @param point2D - */ - async setLocation(point2D){ - try{ - await C.setLocation(this.callOutId,point2D.point2DId); - }catch (e){ - console.error(e); - } + } + + /** + * 更新Callout标注位置 + * @memberOf CallOut + * @param {object} point2D + * @returns {Promise.} + */ + async updataPoint2d(point2D) { + try { + await C.updataByPoint2d(this._SMCalloutId, point2D.point2DId); + } catch (e) { + console.error(e); } - - async setContentView(imageViewId){ - try{ - await C.setContentView(this.callOutId,imageViewId); - }catch (e){ - console.error(e); - } + } + + /** + * 更新Callout标注位置 + * @memberOf CallOut + * @param {number} x + * @param {number} y + * @returns {Promise.} + */ + async updataXY(x, y) { + try { + await C.updataByXY(this._SMCalloutId, x, y); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Callout高度 + * @memberOf CallOut + * @param {number} height + * @returns {Promise.} + */ + async setHeight(height) { + try { + await C.setHeight(this._SMCalloutId, height); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Callout宽度 + * @memberOf CallOut + * @param {number} width + * @returns {Promise.} + */ + async setWidth(width) { + try { + await C.setWidth(this._SMCalloutId, width); + } catch (e) { + console.error(e); } + } + + /** + * 设置是否自定义背景 + * @param isSet + * @returns {Promise.} + */ + async setCustomize(isSet) { + try { + await C.setCustomize(this._SMCalloutId, isSet); + } catch (e) { + console.error(e); + } + } + + /** + * 设置位置 + * @param point2D / x, y + * @returns {Promise.} + */ + async setLocation() { + try { + if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') { + await C.setLocationByXY(this._SMCalloutId, arguments[0], arguments[1]); + } else { + await C.setLocation(this._SMCalloutId, arguments[0]._SMPoint2DId); + } + } catch (e) { + console.error(e); + } + } + + // /** + // * 设置位置 + // * @param x + // * @param y + // * @returns {Promise.} + // */ + // async setLocation(x, y) { + // try { + // await C.setLocation(this._SMCalloutId, x, y); + // } catch (e) { + // console.error(e); + // } + // } + + /** + * 设置图片 + * @param imagePath + * @returns {Promise.} + */ + async setContentView(imagePath) { + try { + await C.setContentView(this._SMCalloutId, imagePath); + } catch (e) { + console.error(e); + } + } + + static TYPE(type) { + var value; + switch (type) { + case 'NONE': + case 'none': + value = -1; + break; + case 'LEFT': + case 'left': + value = 0; + break; + case 'TOP': + case 'top': + value = 1; + break; + case 'RIGHT': + case 'right': + value = 2; + break; + case 'BOTTOM': + case 'bottom': + value = 3; + break; + case 'CENTER': + case 'center': + value = 4; + break; + case 'LEFTTOP': + case 'lefttop': + value = 5; + break; + case 'righttop': + case 'RIGHTTOP': + value = 6; + break; + case 'LEFTBOTTOM': + case 'leftbottom': + value = 7; + break; + case 'RIGHTBOTTOM': + case 'rightbottom': + value = 8; + break; + } + return value; + } +} + + +CallOut.Image = { + STARTPOINT, + DESTPOINT, } \ No newline at end of file diff --git a/NativeModule/Camera.js b/NativeModule/Camera.js new file mode 100755 index 00000000..71e86fa1 --- /dev/null +++ b/NativeModule/Camera.js @@ -0,0 +1,163 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: 三维相机对象类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let C = NativeModules.JSCamera; +/** + * @class Camera + */ +export default class Camera { + /** + * 创建Camera对象。 + * @memberOf Camera + * @returns {Camera} + */ + async createObj(lon, lat, alt, heading, tilt) { + try { + var { cameraId } = await C.createObj(lon, lat, alt, heading, tilt); + var camera = new Camera(); + camera._SMCameraId = cameraId; + return camera; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Camera的lon分量。 + * @memberOf Camera + * @returns {number} + */ + async getLon() { + try { + var { lon } = await C.getLon(this._SMCameraId); + return lon; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Camera的lat分量。 + * @memberOf Camera + * @returns {number} + */ + async getLat() { + try { + var { lat } = await C.getLat(this._SMCameraId); + return lat; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Camera的alt分量。 + * @memberOf Camera + * @returns {number} + */ + async getAlt() { + try { + var { alt } = await C.getAlt(this._SMCameraId); + return alt; + } catch (e) { + console.error(e); + } + } + + /** + * 设置Camera的lon分量。 + * @memberOf Camera + * @returns {number} + */ + async setLon(lon) { + try { + await C.setLon(this._SMCameraId,lon); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Camera的lat分量。 + * @memberOf Camera + * @returns {number} + */ + async setLat(lat) { + try { + await C.setLat(this._SMCameraId,lat); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Camera的alt分量。 + * @memberOf Camera + * @returns {number} + */ + async setAlt(alt) { + try { + await C.setAlt(this._SMCameraId,alt); + } catch (e) { + console.error(e); + } + } + + /** + * 获取Camera的方位角。 + * @memberOf Camera + * @returns {number} + */ + async getHeading() { + try { + var { heading } = await C.getHeading(this._SMCameraId); + return heading; + } catch (e) { + console.error(e); + } + } + + /** + * 设置Camera的方位角。 + * @memberOf Camera + * @returns {number} + */ + async setHeading(heading) { + try { + await C.setHeading(this._SMCameraId,heading); + } catch (e) { + console.error(e); + } + } + + /** + * 获取Camera的俯仰角。 + * @memberOf Camera + * @returns {number} + */ + async getTilt() { + try { + var { tilt } = await C.getTilt(this._SMCameraId); + return tilt; + } catch (e) { + console.error(e); + } + } + + /** + * 设置Camera的俯仰角。 + * @memberOf Camera + * @returns {number} + */ + async setTilt(tilt) { + try { + await C.setTilt(this._SMCameraId,tilt); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/ChartData.js b/NativeModule/ChartData.js new file mode 100755 index 00000000..1b3d4bc1 --- /dev/null +++ b/NativeModule/ChartData.js @@ -0,0 +1,56 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let CD = NativeModules.JSChartData; + +/** + * @class Layer + */ +export default class ChartData{ + /** + * 创建一个ChartData对象 + * @memberOf ChartData + * @param {string}label - 图表标题 + * @param {int}color - 图表颜色 + * @param {int}geoId - ID + * @returns {Promise.} + */ + async createObj(label,color,geoId){ + try{ + var {_chartdataId} = await CD.createObj(label,color,geoId); + var chartData = new ChartData(); + chartData.chartDataId = _chartdataId; + return chartData; + }catch(e){ + console.error(e); + } + } + /** + * 关联地图对应几何对象。 + * @memberOf ChartData + * @param {int}geoId - 地图对应几何对象Id + * @returns {Promise.} + */ + async setGeometryID(geoId){ + try{ + await CD.setGeometryID(this.chartDataId,geoId); + }catch(e){ + console.error(e); + } + } + + /** + * 设置每个条目的标签 + * @memberOf ChartView + * @param {string}label - 条目标签 + * @returns {Promise.} + */ + async setLabel(label){ + try{ + await CD.setLabel(this.chartDataId,label); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/ChartLegend.js b/NativeModule/ChartLegend.js new file mode 100755 index 00000000..56da3b01 --- /dev/null +++ b/NativeModule/ChartLegend.js @@ -0,0 +1,66 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let CL = NativeModules.JSChartLegend; + +/** + * @class Layer + */ +export default class ChartLegend{ + /** + * 设置图例竖直或者水平显示。 + * @memberOf ChartLegend + * @param {bool}b - 水平/竖直显示标识位 + * @returns {Promise.} + */ + async setOrient(b){ + try{ + await CL.setOrient(this.chartLegendId,b); + }catch(e){ + console.error(e); + } + } + /** + * 获取图例竖直或者水平显示。(该方法只支持iOS端) + * @memberOf ChartLegend + * @returns {Promise.} + */ + async isOrient(){ + try{ + var {orient} = await CL.isOrient(this.chartLegendId); + return orient; + }catch(e){ + console.error(e); + } + } + + /** + * 设置图例位置。 + * @memberOf ChartLegend + * @param {string}label - 条目标签 + * @returns {Promise.} + */ + async setAlignment(alignment){ + try{ + await CL.setAlignment(this.chartLegendId,alignment); + }catch(e){ + console.error(e); + } + } + + /** + * 获取图例位置。(该方法只支持iOS端) + * @memberOf ChartLegend + * @param {string}label - 条目标签 + * @returns {Promise.} + */ + async getAlignment(){ + try{ + var {alignment} = await CL.getAlignment(this.chartDataId); + return alignment; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/ChartPoint.js b/NativeModule/ChartPoint.js new file mode 100755 index 00000000..07cc9f0f --- /dev/null +++ b/NativeModule/ChartPoint.js @@ -0,0 +1,34 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let CP = NativeModules.JSChartPoint; + +/** + * @class Layer + */ +export default class ChartPoint{ + /** + * 创建一个ChartPoint对象 + * @memberOf ChartData + * @param {object}para - para {} + * @returns {Promise.} + */ + async createObj(weight,x,y){ + try{ + if(arguments.length==3){ + var {_chartpointId} = await CP.createObj(weight,x,y); + }else if(arguments.length==2){ + var {_chartpointId} = await CP.createObjByPoint(weight,x.point2DId); + }else{ + console('arguments number should be 3 or 2'); + return; + } + var chartPoint = new ChartPoint(); + chartPoint.chartPointId = _chartpointId; + return chartPoint; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/ChartView.js b/NativeModule/ChartView.js new file mode 100755 index 00000000..d4cb25a2 --- /dev/null +++ b/NativeModule/ChartView.js @@ -0,0 +1,116 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let CV = NativeModules.JSChartView; +import ChartLegend from './ChartLegend.js'; + +/** + * @class Layer + */ +export default class ChartView{ + /** + * 设置标题 + * @memberOf ChartView + * @param {string}Title - 图表标题 + * @returns {Promise.} + */ + async setTitle(Title){ + try{ + await CV.setTitle(this.chartviewId,Title); + }catch(e){ + console.error(e); + } + } + /** + * 获取标题 + * @memberOf ChartView + * @returns {Promise.} + */ + async getTitle(){ + try{ + var{title} = await CV.getTitle(this.chartviewId); + return title; + }catch(e){ + console.error(e); + } + } + + /** + * 获取统计图图例 + * @memberOf ChartView + * @returns {Promise.} + */ + async getLegend(){ + try{ + var {chartLegendId} = await CV.getLegend(this.chartviewId); + var chartLegend = new ChartLegend(); + chartLegend.chartLegendId = chartLegendId; + return chartLegend; + }catch(e){ + console.error(e); + } + } + + /** + * 接入统计数据 + * @memberOf ChartView + * @param {object}data - 统计数据 + * @returns {Promise.} + */ + async addChartData(data,timeTag){ + try{ + if(arguments.length==2){ + await CV.addChartDataWithTime(this.chartviewId,data,timeTag); + }else{ + await CV.addChartData(this.chartviewId,data); + } + }catch(e){ + console.error(e); + } + } + + /** + * 移除统计数据。 + * @memberOf ChartView + * @param {object} data - 统计数据 + * @returns {Promise.} + */ + async removeChartData(timeTag){ + try{ + if(arguments.length ==1){ + await CV.removeChartDataWithTimeTag(this.chartviewId,timeTag); + }else{ + await CV.removeAllData(this.chartviewId); + } + }catch(e){ + console.error(e); + } + } + + /** + * 销毁图表 + * @memberOf ChartView + * @returns {Promise.} + */ + async dispose(){ + try{ + await CV.dispose(this.chartviewId); + }catch(e){ + console.error(e); + } + } + + /** + * 更新图表 + * @memberOf ChartView + * @returns {Promise.} + */ + async update(){ + try{ + await CV.update(this.chartviewId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/Collector.js b/NativeModule/Collector.js new file mode 100755 index 00000000..56457c93 --- /dev/null +++ b/NativeModule/Collector.js @@ -0,0 +1,370 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules, NativeEventEmitter } from 'react-native' +let C = NativeModules.JSCollector +let GPSElementType = NativeModules.JSGPSElementType + +import Geometry from './Geometry' +import ElementLine from './ElementLine' +import ElementPoint from './ElementPoint' +import ElementPolygon from './ElementPolygon' +import Point2D from './Point2D' +import GeoStyle from './GeoStyle' + +const nativeEvt = new NativeEventEmitter(C) + +/** + * GPS式几何对象采集类 + * */ +export default class Collector { + async createObj() { + try { + let collectorId = await C.createObj() + let collector = new Collector() + collector._SMCollectorId = collectorId + return collector + } catch (e) { + console.error(e) + } + } + + /** + * 添加点,GPS获取的点 + * @param map + * + * @param point2D + * -------------------- + * @param x + * @param y + * + * @returns {Promise.} + */ + async addGPSPoint () { + try { + let result = false + if (arguments.length === 3) { + // let point2D = await new Point2D().createObj(arguments[1], arguments[2]) + // console.warn('addGPSPoint:' + result + ': ' + // + (await point2D.getX()) + ' | ' + (await point2D.getY())) + result = await C.addGPSPointByXY(this._SMCollectorId, arguments[0]._SMMapId, arguments[1], arguments[2]) + } else if (arguments.length === 2) { + result = await C.addGPSPointByPoint(this._SMCollectorId, arguments[0]._SMMapId, arguments[1]._SMPoint2DId) + } else { + result = await C.addGPSPoint(this._SMCollectorId) + } + + return result + } catch (e) { + console.error(e) + } + } + + /** + * 关闭GPS + * @returns {Promise.} + */ + async closeGPS () { + try { + await C.closeGPS(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 创建指定类型的采集对象 + * @param type + * @returns {Promise.} + */ + async createElement (type) { + try { + return await C.createElement(this._SMCollectorId, type) + } catch (e) { + console.error(e) + } + } + + /** + * 获取当前的几何对象 + * @returns {Promise.} + */ + async getCurGeometry () { + try { + let id = await C.getCurGeometry(this._SMCollectorId) + let geometry = new Geometry() + geometry._SMGeometryId = id + return geometry + } catch (e) { + console.error(e) + } + } + + /** + * 获取当前编辑节点的宽度,单位是10mm + * @returns {Promise} + */ + async getEditNodeWidth () { + try { + return await C.getEditNodeWidth(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取当前采集对象 + * @returns {Promise.} + */ + async getElement () { + try { + let { id, type } = await C.getElement(this._SMCollectorId) + let element + switch (type) { + case GPSElementType.POINT: + element = new ElementPoint() + element._SMElementId = id + break + case GPSElementType.LINE: + element = new ElementLine() + element._SMElementId = id + break + case GPSElementType.POLYGON: + element = new ElementPolygon() + element._SMElementId = id + break + } + return element + } catch (e) { + console.error(e) + } + } + + /** + * 获取当前位置 + * @returns {Promise.} + */ + async getGPSPoint () { + try { + let id = await C.getGPSPoint(this._SMCollectorId) + let point2D = new Point2D() + point2D._SMPoint2DId = id + return point2D + } catch (e) { + console.error(e) + } + } + + /** + * 获取绘制风格采集对象的绘制风格 + * @returns {Promise.} + */ + async getStyle () { + try { + let id = await C.getStyle(this._SMCollectorId) + let geoStyle = new GeoStyle() + geoStyle._SMGeoStyleId = id + return geoStyle + } catch (e) { + console.error(e) + } + } + + /** + * 获取是否采用手势打点 + * @returns {Promise} + * @constructor + */ + async IsSingleTapEnable () { + try { + return await C.IsSingleTapEnable(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 定位地图到当前位置 + * @returns {Promise.} + */ + async moveToCurrent () { + try { + await C.moveToCurrent(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 定位地图到当前位置 + * @returns {Promise} + */ + async openGPS () { + try { + return await C.openGPS(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 重做操作 + * @returns {Promise} + */ + async redo () { + try { + await C.redo(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置定位变化监听 + * @param handlers + * @returns {Promise.} + */ + async setCollectionChangedListener (handlers) { + try { + if(handlers){ + await C.setCollectionChangedListener(this._SMCollectorId) + } else{ + throw new Error("setGestureDetector need callback functions as first two argument!") + } + if(typeof handlers.collectionChanged === "function"){ + nativeEvt.addListener("com.supermap.RN.JSMapcontrol.collection_change",function (e) { + let point2D = new Point2D() + point2D._SMPoint2DId = e.pointId + handlers.collectionChanged({ + ...e, + point2D, + }) + }) + } + if(typeof handlers.onSensorChanged === "function"){ + nativeEvt.addListener("com.supermap.RN.JSMapcontrol.collection_sensor_change",function (e) { + handlers.onSensorChanged(e) + }) + } + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于存储采集数据的数据集 + * @param dataset + * @returns {Promise.} + */ + async setDataset (dataset) { + try { + await C.setDataset(this._SMCollectorId, dataset._SMDatasetId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置当前编辑节点的宽度,单位是10mm + * @param value + * @returns {Promise.} + */ + async setEditNodeWidth (value) { + try { + await C.setEditNodeWidth(this._SMCollectorId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置地图控件 + * @param mapControl + * @returns {Promise.} + */ + async setMapControl (mapControl) { + try { + await C.setMapControl(this._SMCollectorId, mapControl._SMMapControlId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置GPS式几何对象采集类关联的主控件 + * @param mapView + * @returns {Promise.} + */ + async setMapView (mapView) { + try { + await C.setMapView(this._SMCollectorId, mapView._SMMapViewId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置是否采用手势打点 + * @param value + * @returns {Promise.} + */ + async setSingleTapEnable (value) { + try { + await C.setSingleTapEnable(this._SMCollectorId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置采集对象的绘制风格 + * @param style + * @returns {Promise.} + */ + async setStyle (style) { + try { + await C.setStyle(this._SMCollectorId, style._SMGeoStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 显示提示信息 + * @param value + * @returns {Promise.} + */ + async showInfo (value) { + try { + await C.showInfo(this._SMCollectorId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 提交 + * @returns {Promise.>} + */ + async submit () { + try { + return await C.submit(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 回退操作 + * @returns {Promise.} + */ + async undo () { + try { + await C.undo(this._SMCollectorId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/CollectorElement.js b/NativeModule/CollectorElement.js new file mode 100755 index 00000000..edc3e993 --- /dev/null +++ b/NativeModule/CollectorElement.js @@ -0,0 +1,233 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native' +let CE = NativeModules.JSCollectorElement + +import Geometry from './Geometry' +import Rectangle2D from './Rectangle2D' + +/** + * 采集对象类 + * */ +export default class CollectorElement { + + /** + * 添加点 + * @param point2D + * @returns {Promise.} + */ + async addPoint (point2D) { + try { + await CE.addPoint(this._SMCollectorElementId, point2D._SMPoint2DId) + } catch (e) { + console.error(e) + } + } + + /** + * 通过 Geomotry 构造采集对象 + * @param geometry + * @returns {Promise} + */ + async fromGeometry (geometry) { + try { + return await CE.fromGeometry(this._SMCollectorElementId, geometry._SMGeometryId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的边框范围 + * @returns {Promise.} + */ + async getBounds () { + try { + let id = await CE.getBounds(this._SMCollectorElementId) + let rectangle2D = new Rectangle2D() + rectangle2D._SMRectangle2DId = id + return rectangle2D + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的 Geometry + * @returns {Promise.} + */ + async getGeometry () { + try { + let id = await CE.getGeometry(this._SMCollectorElementId) + let geometry = new Geometry() + geometry._SMGeometryId = id + return geometry + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的几何对象类型 + * @returns {Promise} + */ + async getGeometryType () { + try { + return await CE.getGeometryType(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的点串 + * @returns {Promise} + */ + async getGeoPoints () { + try { + return await CE.getGeoPoints(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的ID + * @returns {Promise.|number>} + */ + async getID () { + try { + return await CE.getID(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的名称 + * @returns {Promise.>|Promise.|Boolean>} + */ + async getName () { + try { + return await CE.getName(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的备注信息 + * @returns {Promise} + */ + async getNotes () { + try { + return await CE.getNotes(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取单击事件监听器 + * @returns {Promise.} + */ + async getOnClickListenner () { + try { + // await CE.getOnClickListenner(this._SMCollectorElementId) + // TODO 获取单击事件监听器 + } catch (e) { + console.error(e) + } + } + + /** + * 获取点串分组信息(仅适用于通过Geomotry构造的动态数据) + * @returns {Promise} + */ + async getPart () { + try { + return await CE.getPart(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取采集对象的类型 + * @returns {Promise.} + */ + async getType () { + try { + await CE.getType(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取用户数据 + * @returns {Promise} + */ + async getUserData () { + try { + return await CE.getUserData(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置采集对象的名称 + * @param valye + * @returns {Promise.} + */ + async setName (valye) { + try { + await CE.setName(this._SMCollectorElementId, valye) + } catch (e) { + console.error(e) + } + } + + /** + * 设置采集对象的备注信息 + * @param value + * @returns {Promise.} + */ + async setNotes (value) { + try { + await CE.setNotes(this._SMCollectorElementId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置点击监听器 + * @returns {Promise.} + */ + async setOnClickListenner () { + try { + // TODO 设置点击监听器 + // await CE.setOnClickListenner(this._SMCollectorElementId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用户数据 + * @param value + * @returns {Promise.} + */ + async setUserData (value) { + try { + await CE.setUserData(this._SMCollectorElementId, value) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/ColorScheme.js b/NativeModule/ColorScheme.js new file mode 100755 index 00000000..b8491f4b --- /dev/null +++ b/NativeModule/ColorScheme.js @@ -0,0 +1,107 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let CS = NativeModules.JSColorScheme; +/** + * @class PieChart + */ +export default class ColorScheme{ + /** + * 构造方法 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async createObj(){ + try{ + var {colorSchemeId} = await CS.createObj(); + var colorscheme = new ColorScheme(); + colorscheme.colorSchemeId = colorSchemeId; + return colorscheme; + }catch(e){ + console.error(e); + } + } + + /** + * 设置颜色 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async setColors(colorArr){ + try{ + await CS.setColors(this.colorSchemeId,colorArr); + }catch(e){ + console.error(e); + } + } + + /** + * 获取颜色 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async getColors(){ + try{ + var {colors} = await CS.getColors(this.colorSchemeId); + return colors; + }catch(e){ + console.error(e); + } + } + + /** + * 设置分段值 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async setSegmentValue(value){ + try{ + await CS.setSegmentValue(this.colorSchemeId,value); + }catch(e){ + console.error(e); + } + } + + /** + * 获取分段值 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async getSegmentValue(){ + try{ + var {segmentValue} = await CS.getSegmentValue(this.colorSchemeId); + return segmentValue; + }catch(e){ + console.error(e); + } + } + + + /** + * 设置分段标签 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async setSegmentLable(value){ + try{ + await CS.setSegmentLable(this.colorSchemeId,value); + }catch(e){ + console.error(e); + } + } + + /** + * 获取分段标签 + * @memberOf ColorScheme + * @returns {Promise.} + */ + async getSegmentLable(){ + try{ + var {segmentLable} = await CS.getSegmentLable(this.colorSchemeId); + return segmentLable; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/CoordSysTransParameter.js b/NativeModule/CoordSysTransParameter.js new file mode 100755 index 00000000..d0d875cd --- /dev/null +++ b/NativeModule/CoordSysTransParameter.js @@ -0,0 +1,26 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let CSTP = NativeModules.JSCoordSysTransParameter; + +/** + * 投影坐标系转换参数。通常包括平移、旋转和比例因子。 + */ +export default class CoordSysTransParameter { + async createObj() { + try { + let coordSysTransParameterId = await CSTP.createObj(); + let coordSysTransParameter = new CoordSysTransParameter(); + coordSysTransParameter._SMCoordSysTransParameterId = coordSysTransParameterId; + return coordSysTransParameter; + } catch (e) { + console.error(e); + } + } + + // TODO 添加方法 + +} diff --git a/NativeModule/CoordSysTranslator.js b/NativeModule/CoordSysTranslator.js new file mode 100755 index 00000000..8ce0294d --- /dev/null +++ b/NativeModule/CoordSysTranslator.js @@ -0,0 +1,115 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let CST = NativeModules.JSCoordSysTranslator; + +/** + * 投影转换类。 + * 主要用于投影坐标之间及投影坐标系之间的转换。 + */ +export default class CoordSysTranslator { + /** + * 根据源投影坐标系与目标投影坐标系对几何对象进行投影转换,结果将直接改变源几何对象 + * @param geometry + * @param sourcePrjCoordSys + * @param targetPrjCoordSys + * @param coordSysTransParameter + * @param coordSysTransMethod + * @returns {Promise.>} + */ + static async convertByGeometry (geometry, sourcePrjCoordSys, targetPrjCoordSys, coordSysTransParameter, coordSysTransMethod) { + try { + return await CST.convertByGeometry(geometry._SMGeometryId, sourcePrjCoordSys._SMPrjCoordSysId, + targetPrjCoordSys._SMPrjCoordSysId, coordSysTransParameter._SMCoordSysTransParameterId, + coordSysTransMethod); + } catch (e) { + console.error(e); + } + } + + /** + * 根据源投影坐标系与目标投影坐标系对坐标点串进行投影转换,结果将直接改变源坐标点串 + * @param point2DIds + * @param sourcePrjCoordSys + * @param targetPrjCoordSys + * @param coordSysTransParameter + * @param coordSysTransMethod + * @returns {Promise} + */ + static async convertByPoint2Ds(point2DIds = [], sourcePrjCoordSys, targetPrjCoordSys, coordSysTransParameter, coordSysTransMethod) { + try { + let arr = [] + point2DIds.forEach(obj => { + arr.push(obj._SMPoint2DId) + }) + return await CST.convertByPoint2Ds(arr, sourcePrjCoordSys._SMPrjCoordSysId, + targetPrjCoordSys._SMPrjCoordSysId, coordSysTransParameter._SMCoordSysTransParameterId, + coordSysTransMethod); + } catch (e) { + console.error(e); + } + } + + /** + * 根据源投影坐标系与目标投影坐标系对三维点集合对象进行投影转换,结果将直接改变源坐标点串 + * @param point3DIds + * @param sourcePrjCoordSys + * @param targetPrjCoordSys + * @param coordSysTransParameter + * @param coordSysTransMethod + * @returns {Promise} + */ + static async convertByPoint3Ds(point3DIds = [], sourcePrjCoordSys, targetPrjCoordSys, coordSysTransParameter, coordSysTransMethod) { + try { + let arr = [] + point3DIds.forEach(obj => { + arr.push(obj._SMPoint3DId) + }) + return await CST.convertByPoint3Ds(arr, sourcePrjCoordSys._SMPrjCoordSysId, + targetPrjCoordSys._SMPrjCoordSysId, coordSysTransParameter._SMCoordSysTransParameterId, + coordSysTransMethod); + } catch (e) { + console.error(e); + } + } + + /** + * 在同一地理坐标系下,该方法用于将指定的Point2Ds 类的点对象的地理坐标转换到投影坐标 + * @param point2DIds + * @param sourcePrjCoordSys + * @returns {Promise.} + */ + static async forward(point2DIds = [], sourcePrjCoordSys) { + try { + let arr = [] + point2DIds.forEach(obj => { + arr.push(obj._SMPoint2DId) + }) + return await CST.forward(arr, sourcePrjCoordSys._SMPrjCoordSysId); + } catch (e) { + console.error(e); + } + } + + /** + * 在同一投影坐标系下,该方法用于将指定的Point2Ds 类的点对象的投影坐标转换到地理坐标 + * @param point2DIds + * @param sourcePrjCoordSys + * @returns {Promise.>} + */ + static async inverse(point2DIds = [], sourcePrjCoordSys) { + try { + let arr = [] + point2DIds.forEach(obj => { + arr.push(obj._SMPoint2DId) + }) + return await CST.inverse(arr, sourcePrjCoordSys._SMPrjCoordSysId); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/CursorType.js b/NativeModule/CursorType.js old mode 100644 new mode 100755 diff --git a/NativeModule/DataDownloadService.js b/NativeModule/DataDownloadService.js old mode 100644 new mode 100755 index a5668694..f30c7a45 --- a/NativeModule/DataDownloadService.js +++ b/NativeModule/DataDownloadService.js @@ -1,20 +1,27 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + ref:ServiceBase + **********************************************************************************/ +import {NativeModules,Platform} from 'react-native'; let DDS = NativeModules.JSDataDownloadService; import ServiceBase from './ServiceBase.js'; /** * @class DataDownloadService + * @description 数据下载类,用于从iServer服务器上下载数据到本地。 */ export default class DataDownloadService extends ServiceBase{ + constructor(){ super(); - //同步子类Id和父类Id - Object.defineProperty(this,"_dataDownloadServiceId_",{ + Object.defineProperty(this,"_SMDataDownloadServiceId",{ get:function () { - return this._serviceBaseID_ + return this._SMServiceBaseId }, - set:function (_dataDownloadServiceId_) { - this._serviceBaseID_ = _dataDownloadServiceId_; + set:function (_SMDataDownloadServiceId) { + this._SMServiceBaseId = _SMDataDownloadServiceId; } }) } @@ -29,7 +36,10 @@ export default class DataDownloadService extends ServiceBase{ try{ var {_dataDownloadServiceId_} = await DDS.createObj(url); var dataDownloadService = new DataDownloadService(); - dataDownloadService._dataDownloadServiceId_ = _dataDownloadServiceId_; + dataDownloadService._SMDataDownloadServiceId = _dataDownloadServiceId_; + if(Platform.OS === 'ios'){ + dataDownloadService._SMDataDownloadServiceURL = url; + } return dataDownloadService; }catch(e){ console.error(e); @@ -46,7 +56,7 @@ export default class DataDownloadService extends ServiceBase{ */ async download(fullUrl,fromIndex,toIndex){ try{ - await DDS.download(dataDownloadService._dataDownloadServiceId_,fullUrl,fromIndex,toIndex); + await DDS.download(this._SMDataDownloadServiceId,fullUrl,fromIndex,toIndex); }catch(e){ console.error(e); } @@ -64,8 +74,11 @@ export default class DataDownloadService extends ServiceBase{ */ async downloadByName(serviceName,datasourceName,datasetName,fromIndex,toIndex){ try{ - await DDS.downloadByName(dataDownloadService._dataDownloadServiceId_, - serviceName,datasourceName,datasetName,fromIndex,toIndex); + if(Platform.OS === 'ios'){ + await DDS.downloadByName(this._SMDataDownloadServiceId,this._SMDataDownloadServiceURL,serviceName,datasourceName,datasetName,fromIndex,toIndex); + }else{ + await DDS.downloadByName(this._SMDataDownloadServiceId,serviceName,datasourceName,datasetName,fromIndex,toIndex); + } }catch(e){ console.error(e); } @@ -79,7 +92,7 @@ export default class DataDownloadService extends ServiceBase{ */ async downloadAll(fullUrl){ try{ - await DDS.downloadAll(dataDownloadService._dataDownloadServiceId_,fullUrl); + await DDS.downloadAll(this._SMDataDownloadServiceId,fullUrl); }catch(e){ console.error(e); } @@ -95,8 +108,11 @@ export default class DataDownloadService extends ServiceBase{ */ async downloadAllByName(serviceName,datasourceName,datasetName){ try{ - await DDS.downloadAllByName(dataDownloadService._dataDownloadServiceId_, - serviceName,datasourceName,datasetName); + if(Platform.OS === 'ios'){ + await DDS.downloadAllByName(this._SMDataDownloadServiceId,this._SMDataDownloadServiceURL,serviceName,datasourceName,datasetName); + }else{ + await DDS.downloadAllByName(this._SMDataDownloadServiceId,serviceName,datasourceName,datasetName); + } }catch(e){ console.error(e); } @@ -111,7 +127,7 @@ export default class DataDownloadService extends ServiceBase{ */ async downloadDataset(urlDatset,datasource){ try{ - await DDS.downloadDataset(dataDownloadService._dataDownloadServiceId_, + await DDS.downloadDataset(this._SMDataDownloadServiceId, urlDatset,datasource.datasourceId); }catch(e){ console.error(e); @@ -127,10 +143,10 @@ export default class DataDownloadService extends ServiceBase{ */ async updateDataset(urlDatset,dataset){ try{ - await DDS.updateDataset(dataDownloadService._dataDownloadServiceId_, + await DDS.updateDataset(this._SMDataDownloadServiceId, urlDatset,dataset.datasetId); }catch(e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/DataUploadService.js b/NativeModule/DataUploadService.js old mode 100644 new mode 100755 index cd4dc8de..6cceaff7 --- a/NativeModule/DataUploadService.js +++ b/NativeModule/DataUploadService.js @@ -1,21 +1,27 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let DUS = NativeModules.JSDataUploadService; import ServiceBase from './ServiceBase.js'; /** * @class DataUploadService + * @description 数据上传类,用于将本地数据上传到iServer服务器。 */ export default class DataUploadService extends ServiceBase{ constructor(){ super(); - //同步子类Id和父类Id - Object.defineProperty(this,"_dataUploadServiceId_",{ + Object.defineProperty(this,"_SMDataUploadServiceId",{ get:function () { - return this._serviceBaseID_ + return this._SMServiceBaseId }, - set:function (_dataUploadServiceId_) { - this._serviceBaseID_ = _dataUploadServiceId_; + set:function (_SMDataUploadServiceId) { + this._SMServiceBaseId = _SMDataUploadServiceId; } }) } @@ -30,7 +36,7 @@ export default class DataUploadService extends ServiceBase{ try{ var {_dataUploadServiceId_} = await DUS.createObj(url); var datauploadService = new DataUploadService(); - datauploadService._dataUploadServiceId_ = _dataUploadServiceId_; + datauploadService._SMDataUploadServiceId = _dataUploadServiceId_; return datauploadService; }catch(e){ console.error(e); @@ -47,7 +53,7 @@ export default class DataUploadService extends ServiceBase{ */ async addDataset(fullUrl,datasetName,datasetType){ try{ - await DUS.addDataset(this._dataUploadServiceId_,fullUrl,datasetName,datasetType); + await DUS.addDataset(this._SMDataUploadServiceId,fullUrl,datasetName,datasetType); }catch(e){ console.error(e); } @@ -65,7 +71,7 @@ export default class DataUploadService extends ServiceBase{ */ async cloneDataset(serviceName,datasourceName,destDatasetName,srcDatasourceName,srcDatasetName){ try{ - await DUS.cloneDataset(this._dataUploadServiceId_,serviceName, + await DUS.cloneDataset(this._SMDataUploadServiceId,serviceName, datasourceName,destDatasetName,srcDatasourceName,srcDatasetName); }catch(e){ console.error(e); @@ -81,7 +87,7 @@ export default class DataUploadService extends ServiceBase{ */ async addFeature(fullUrl,feature){ try{ - await DUS.addFeature(this._dataUploadServiceId_,fullUrl,feature._featureId_); + await DUS.addFeature(this._SMDataUploadServiceId,fullUrl,feature._SMFeatureId); }catch(e){ console.error(e); } @@ -98,8 +104,8 @@ export default class DataUploadService extends ServiceBase{ */ async addFeatureByName(serviceName,datasourceName,datasetName,feature){ try{ - await DUS.addFeatureByName(this._dataUploadServiceId_,serviceName,datasourceName, - datasetName,feature._featureId_); + await DUS.addFeatureByName(this._SMDataUploadServiceId,serviceName,datasourceName, + datasetName,feature._SMFeatureId); }catch(e){ console.error(e); } @@ -114,7 +120,7 @@ export default class DataUploadService extends ServiceBase{ */ async deleteFeature(fullUrl,featureIDs){ try{ - await DUS.deleteFeature(this._dataUploadServiceId_,fullUrl,featureIDs); + await DUS.deleteFeature(this._SMDataUploadServiceId,fullUrl,featureIDs); }catch(e){ console.error(e); } @@ -131,7 +137,7 @@ export default class DataUploadService extends ServiceBase{ */ async deleteFeatureByName(serviceName,datasourceName,datasetName,featureIDs){ try{ - await DUS.deleteFeatureByName(this._dataUploadServiceId_,serviceName, + await DUS.deleteFeatureByName(this._SMDataUploadServiceId,serviceName, datasourceName,datasetName,featureIDs); }catch(e){ console.error(e); @@ -148,7 +154,7 @@ export default class DataUploadService extends ServiceBase{ */ async modifyFeature(fullUrl,featureID,feature){ try{ - await DUS.modifyFeature(this._dataUploadServiceId_,fullUrl,featureID,feature._featureId_); + await DUS.modifyFeature(this._SMDataUploadServiceId,fullUrl,featureID,feature._SMFeatureId); }catch(e){ console.error(e); } @@ -166,15 +172,16 @@ export default class DataUploadService extends ServiceBase{ */ async modifyFeatureByName(serviceName,datasourceName,datasetName,featureID,feature){ try{ - await DUS.modifyFeatureByName(this._dataUploadServiceId_,serviceName, - datasourceName,datasetName,featureID,feature._featureId_); + await DUS.modifyFeatureByName(this._SMDataUploadServiceId,serviceName, + datasourceName,datasetName,featureID,feature._SMFeatureId); }catch(e){ console.error(e); } } /** - * 将本地数据集中修改、删除、新增的数据提交到服务器上对应的数据集中。提交时要求本地和服务器上都存在该数据集及其对应的属性数据集(属性数据集用于记录被修改和被删除的记录)。 同时本地数据集的版本不得高于服务器上的版本(即本地的Max[SmUserID]不大于服务器上的Max[SMID]),否则不能提交,需要先进行更新。目前数据集的类型支持点、线、面数据集。 如果提交失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。 + * 提交 + * @description 将本地数据集中修改、删除、新增的数据提交到服务器上对应的数据集中。提交时要求本地和服务器上都存在该数据集及其对应的属性数据集(属性数据集用于记录被修改和被删除的记录)。 同时本地数据集的版本不得高于服务器上的版本(即本地的Max[SmUserID]不大于服务器上的Max[SMID]),否则不能提交,需要先进行更新。目前数据集的类型支持点、线、面数据集。 如果提交失败,将调用ResponseCallback中的requestFaild()方法;如果成功,将调用requestSuccess()方法。 * @memberOf DataUploadService * @param {string} urlDataset - dataset在服务器上的地址。 * @param {objecg} dataset - 本地数据集,可以使点、线、面数据集。 @@ -182,7 +189,7 @@ export default class DataUploadService extends ServiceBase{ */ async commitDataset(urlDataset,dataset){ try{ - await DUS.commitDataset(this._dataUploadServiceId_,fullUrl,dataset.datasetId); + await DUS.commitDataset(this._SMDataUploadServiceId,fullUrl,dataset._SMDatasetId); }catch(e){ console.error(e); } @@ -196,7 +203,7 @@ export default class DataUploadService extends ServiceBase{ */ async deleteDataset(fullUrl){ try{ - await DUS.deleteDataset(this._dataUploadServiceId_,fullUrl); + await DUS.deleteDataset(this._SMDataUploadServiceId,fullUrl); }catch(e){ console.error(e); } @@ -212,9 +219,9 @@ export default class DataUploadService extends ServiceBase{ */ async deleteDatasetByName(serviceName,datasourceName,datasetName){ try{ - await DUS.deleteDatasetByName(this._dataUploadServiceId_,serviceName,datasourceName,datasetName); + await DUS.deleteDatasetByName(this._SMDataUploadServiceId,serviceName,datasourceName,datasetName); }catch(e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/Dataset.js b/NativeModule/Dataset.js old mode 100644 new mode 100755 index 924f7a0c..4ff7b5ff --- a/NativeModule/Dataset.js +++ b/NativeModule/Dataset.js @@ -1,15 +1,18 @@ -/** - * Created by will on 2016/6/17. - */ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + ref:PrjCoordSys + **********************************************************************************/ +import { NativeModules } from 'react-native'; let D = NativeModules.JSDataset; import Datasource from './Datasource.js'; import DatasetVector from './DatasetVector.js'; import PrjCoordSys from './PrjCoordSys.js'; /** - * @class Dataset - 所有数据集类型(如矢量数据集,栅格数据集等)的基类。提供各数据集共有的方法和事件。 - * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集和栅格数据集和影像数据集,以及为了处理特定问题而设计的如拓扑数据集,网络数据集等。数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,线数据集,面数据集等,各矢量数据集是空间特征和性质相同而组织在一起的数据的集合。而栅格数据集由像元阵列组成,在表现要素上比矢量数据集欠缺,但是可以很好的表现空间现象的位置关系。光栅数据集包括影像数据集和栅格数据集。 + * @class Dataset + * @description 所有数据集类型(如矢量数据集,栅格数据集等)的基类。提供各数据集共有的方法和事件。数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集和栅格数据集和影像数据集,以及为了处理特定问题而设计的如拓扑数据集,网络数据集等。数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,线数据集,面数据集等,各矢量数据集是空间特征和性质相同而组织在一起的数据的集合。而栅格数据集由像元阵列组成,在表现要素上比矢量数据集欠缺,但是可以很好的表现空间现象的位置关系。光栅数据集包括影像数据集和栅格数据集。 * * 在 SuperMap 中有十八种类型的数据集,但目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,纯属性表数据集和影像数据集。 * @property {number} TYPE.TABULAR - 纯属性数据集。 @@ -31,131 +34,272 @@ import PrjCoordSys from './PrjCoordSys.js'; * @property {number} TYPE.REGION3D - 三维面数据集。 * @property {number} TYPE.DEM - */ -export default class Dataset{ - - /** - * 转成DatasetVector对象 - * @memberOf Dataset - * @returns {Promise.} - */ - async toDatasetVector(){ - try{ - var {datasetVectorId} = await D.toDatasetVector(this.datasetId); - var datasetVector = new DatasetVector(); - datasetVector.datasetVectorId = datasetVectorId; - return datasetVector; - }catch(e){ - console.error(e); - } +export default class Dataset { + + /** + * 转成DatasetVector对象 + * @memberOf Dataset + * @returns {Promise.} + */ + async toDatasetVector() { + try { + var { datasetVectorId } = await D.toDatasetVector(this._SMDatasetId); + var datasetVector = new DatasetVector(); + datasetVector._SMDatasetVectorId = datasetVectorId; + return datasetVector; + } catch (e) { + console.error(e); } - - /** - * 返回数据集的投影信息。 - * 当该数据集的投影采用其所在数据源的投影时,该方法返回 null。 - * @memberOf Dataset - * @returns {Promise.} - */ - async getPrjCoordSys(){ - try{ - var {prjCoordSysId} = await D.getPrjCoordSys(this.datasetId); - var prjCoordSys = new PrjCoordSys(); - prjCoordSys.prjCoordSysId = prjCoordSysId; - return prjCoordSys; - }catch(e){ - console.error(e); - } + } + + /** + * 返回数据集的投影信息。 + * 当该数据集的投影采用其所在数据源的投影时,该方法返回 null。 + * @memberOf Dataset + * @returns {Promise.} + */ + async getPrjCoordSys() { + try { + var { prjCoordSysId } = await D.getPrjCoordSys(this._SMDatasetId); + var prjCoordSys = new PrjCoordSys(); + prjCoordSys._SMPrjCoordSysId = prjCoordSysId; + return prjCoordSys; + } catch (e) { + console.error(e); } - - /** - * 用于打开数据集,准备对数据集进行操作。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以先使用 isOpen 方法来判断一下数据集是否已经被打开。 - * @memberOf Dataset - * @returns {boolean} - */ - async openDataset(){ - try{ - var {opened} = await D.openDataset(this.datasetId); - return opened; - }catch(e){ - console.error(e); - } + } + + /** + * 用于打开数据集,准备对数据集进行操作。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以先使用 isOpen 方法来判断一下数据集是否已经被打开。 + * @memberOf Dataset + * @returns {boolean} + */ + async openDataset() { + try { + var { opened } = await D.openDataset(this._SMDatasetId); + return opened; + } catch (e) { + console.error(e); } - - /** - * 判断此数据集是否已经打开。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开数据集的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以通过该方法来判定数据集是否已被打开。 - * @memberOf Dataset - * @returns {boolean} - 如果此数据集已经被打开,返回 true;否则返回 false。 - */ - async isopen(){ - try{ - var {opened} = await D.isopen(this.datasetId); - return opened; - }catch(e){ - console.error(e); - } + } + + /** + * 判断此数据集是否已经打开。在数据源连接了数据,即数据源被打开之后,数据集默认是不打开数据集的,如果要对数据集的数据进行修改或其他操作,数据集必须是打开的,否则无法进行操作。可以通过该方法来判定数据集是否已被打开。 + * @memberOf Dataset + * @returns {boolean} - 如果此数据集已经被打开,返回 true;否则返回 false。 + */ + async isopen() { + try { + var { opened } = await D.isopen(this._SMDatasetId); + return opened; + } catch (e) { + console.error(e); } - - /** - * 返回此数据集的类型。目前版本支持的数据集类型包括纯属性表数据集、点数据集、线数据集、面数据集、文本数据集和影像数据集(DatasetImage)。 - * @memberOf Dataset - * @returns {Dataset.Type} - */ - async getType(){ - try{ - var {type} = await D.getType(this.datasetId); - return type; - }catch(e){ - console.error(e); - } + } + + /** + * 判断数据集是否只读 + * @returns {Promise.|Promise.>>} + */ + async isReadOnly() { + try { + return await D.isReadOnly(this._SMDatasetId); + } catch (e) { + console.error(e); } - - /** - * 返回此数据集对象所属数据源对象。 - * @memberOf Dataset - * @returns {Promise.} - */ - async getDatasource(){ - try{ - var {datasourceId} = await D.getDatasource(this.datasetId); - var datasource = new Datasource(); - datasource.datasourceId = datasourceId; - return datasource; - }catch(e){ - console.error(e); - } + } + + /** + * 获取数据集名称。 + * @memberOf Dataset + * @returns {string} + */ + async getName() { + try { + var { name } = await D.DSgetName(this._SMDatasetId); + return name; + } catch (e) { + console.error(e); } - - /** - * 返回此数据集数据存储时的编码方式。对数据集采用压缩编码方式,可以减少数据存储所占用的空间,降低数据传输时的网络负载和服务器的负载。矢量数据集支持的编码方式有Byte,Int16,Int24,Int32,SGL,LZW,DCT,也可以指定为不使用编码方式。光栅数据支持的编码方式有DCT,SGL,LZW 或不使用编码方式。具体请参见EncodeType类型。 - * @memberOf Dataset - * @returns {Promise.} - */ - async getEncodeType(){ - try{ - var {type} = await D.getEncodeType(this.datasetId); - return type; - }catch(e){ - console.error(e); - } + } + + /** + * 设置数据集名称。 + * @memberOf Dataset + * @returns {string} + */ + async setName(text) { + try { + await D.setName(this._SMDatasetId, text); + } catch (e) { + console.error(e); + } + } + + /** + * 设置数据集是否只读 + * @param value + * @returns {Promise.} + */ + async setReadOnly(value) { + try { + await D.setReadOnly(this._SMDatasetId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 返回此数据集的类型。目前版本支持的数据集类型包括纯属性表数据集、点数据集、线数据集、面数据集、文本数据集和影像数据集(DatasetImage)。 + * @memberOf Dataset + * @returns {Dataset.Type} + */ + async getType() { + try { + var { type } = await D.getType(this._SMDatasetId); + // var typeStr = 'type'; + // switch (type){ + // case 0 : typeStr = 'TABULAR'; + // break; + // case 1 : typeStr = 'POINT'; + // break; + // case 3 : typeStr = 'LINE'; + // break; + // case 4 : typeStr = 'Network'; + // break; + // case 5 : typeStr = 'REGION'; + // break; + // case 7 : typeStr = 'TEXT'; + // break; + // case 81 : typeStr = 'IMAGE'; + // break; + // case 83 : typeStr = 'Grid'; + // break; + // case 84 : typeStr = 'DEM'; + // break; + // case 84 : typeStr = 'DEM'; + // break; + // case 86 : typeStr = 'WMS'; + // break; + // case 87 : typeStr = 'WCS'; + // break; + // case 88 : typeStr = 'MBImage'; + // break; + // case 101 : typeStr = 'PointZ'; + // break; + // case 103 : typeStr = 'LineZ'; + // break; + // case 105 : typeStr = 'RegionZ'; + // break; + // case 106 : typeStr = 'VECTORMODEL'; + // break; + // case 139 : typeStr = 'TIN'; + // break; + // case 149 : typeStr = 'CAD'; + // break; + // case 151 : typeStr = 'WFS'; + // break; + // case 205 : typeStr = 'NETWORK3D'; + // break; + // default : throw new Error("Unknown Dataset Type"); + // } + // return typeStr; + return type + } catch (e) { + console.error(e); + } + } + + /** + * 返回此数据集对象所属数据源对象。 + * @memberOf Dataset + * @returns {Promise.} + */ + async getDatasource() { + try { + var { datasourceId } = await D.getDatasource(this._SMDatasetId); + var datasource = new Datasource(); + datasource._SMDatasourceId = datasourceId; + return datasource; + } catch (e) { + console.error(e); + } + } + + /** + * 返回此数据集数据存储时的编码方式。对数据集采用压缩编码方式,可以减少数据存储所占用的空间,降低数据传输时的网络负载和服务器的负载。矢量数据集支持的编码方式有Byte,Int16,Int24,Int32,SGL,LZW,DCT,也可以指定为不使用编码方式。光栅数据支持的编码方式有DCT,SGL,LZW 或不使用编码方式。具体请参见EncodeType类型。 + * @memberOf Dataset + * @returns {Promise.} + */ + async getEncodeType() { + try { + var { type } = await D.getEncodeType(this._SMDatasetId); + var typeStr = 'type'; + switch (type) { + case 0 : + typeStr = 'NONE'; + break; + case 1 : + typeStr = 'BYTE'; + break; + case 2 : + typeStr = 'INT16'; + break; + case 3 : + typeStr = 'INT24'; + break; + case 4 : + typeStr = 'INT32'; + break; + case 8 : + typeStr = 'DCT'; + break; + case 9 : + typeStr = 'SGL'; + break; + case 11 : + typeStr = 'LZW'; + break; + default : + throw new Error("Unknown Encode Type"); + } + return typeStr; + } catch (e) { + console.error(e); + } + } + + /** + * 用于关闭当前数据集 + * @returns {Promise.} + */ + async close() { + try { + await D.close(this._SMDatasetId); + } catch (e) { + console.error(e); } + } + } Dataset.TYPE = { - TABULAR:0, - POINT:1, - LINE:3, - REGION:5, - TEXT:7, - IMAGE:81, - CAD:149, - NETWORK:4, - NETWORK3D:205, - NdfVector:500, - GRID:83, - WMS:86, - WCS:87, - WFS:151, - POINT3D:101, - LINE3D:103, - REGION3D:105, - DEM:84 -}; \ No newline at end of file + TABULAR: 0, + POINT: 1, + LINE: 3, + REGION: 5, + TEXT: 7, + IMAGE: 81, + CAD: 149, + Network: 4, + NETWORK3D: 205, + NdfVector: 500, + GRID: 83, + WMS: 86, + WCS: 87, + WFS: 151, + POINT3D: 101, + LINE3D: 103, + REGION3D: 105, + DEM: 84 +}; diff --git a/NativeModule/DatasetVector.js b/NativeModule/DatasetVector.js old mode 100644 new mode 100755 index 794e1fad..8d3e01f7 --- a/NativeModule/DatasetVector.js +++ b/NativeModule/DatasetVector.js @@ -1,210 +1,374 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + Description:数据集类 + ref:rectangle2D + **********************************************************************************/ +import { NativeModules } from 'react-native'; let DV = NativeModules.JSDatasetVector; +import Dataset from './Dataset.js'; import Recordset from './Recordset.js'; import QueryParameter from './QueryParameter.js'; /** * @class DatasetVector + * @description 矢量数据集类。用于对矢量数据集进行描述,并对之进行相应的管理和操作。对矢量数据集的操作主要包括数据查询、修改、删除、建立索引等。 */ export default class DatasetVector { - async queryInBuffer(rectangle2D, cursorType) { - try { - var {recordsetId} = await DV.queryInBuffer(this.datasetVectorId, rectangle2D.rectangle2DId, cursorType); - var recordset = new Recordset(); - recordset.recordsetId = recordsetId; - return recordset; - } catch (e) { - console.error(e); - } + /* constructor(){ + super(); + Object.defineProperty(this,"datasetVectorId",{ + get:function(){ + return this.datasetId + }, + set:function(datasetVectorId){ + this.datasetId = datasetVectorId; + } + }) + }*/ + + /** + * 获取数据集名称。 + * @memberOf DatasetVector + * @returns {string} + */ + async getName() { + try { + let name = await DV.getName(this._SMDatasetVectorId); + return name + } catch (e) { + console.error(e); } - - /** - * 根据给定的参数来返回空的记录集或者返回包括所有记录的记录集对象。 - * @memberOf DatasetVector - * @deprecated - 弃用,所有recordset都使用json格式表达 - * @param isEmptyRecordset - * @param cursorType - * @returns {Promise.} - */ - async getRecordset(isEmptyRecordset, cursorType) { - try { - var {recordsetId} =await DV.getRecordset(this.datasetVectorId, isEmptyRecordset, cursorType); - var recordset = new Recordset(); - recordset.recordsetId = recordsetId; - return recordset; - } catch (e) { - console.error(e); - } + } + + /** + * 查询落在已知空间范围内的记录。 + * @memberOf DatasetVector + * @deprecated - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。 + * @param {Rectangle2D} rectangle2D + * @param {number} cursorType + * @returns {Promise.} + */ + async queryInBuffer(rectangle2D, cursorType) { + try { + var { recordsetId } = await DV.queryInBuffer(this._SMDatasetVectorId, rectangle2D._SMRectangle2DId, cursorType); + var recordset = new Recordset(); + recordset._SMRecordsetId = recordsetId; + return recordset; + } catch (e) { + console.error(e); } - - /** - * 通过设置查询条件对矢量数据集进行查询,该方法默认查询空间信息与属性信息。 - * @memberOf DatasetVector - * @param {object}queryParameter - 定义的查询条件。 - * @returns {Promise} - 返回查询结果对象:result:{geoJson:geoJson结果集数组,每次10条,queryParameterId:查询条件对象的引用,可用于重复查询,counts:总记录数,batch:返回的批次数量,size:每批次记录数(最大为10),recordsetId:记录集对象引用} - */ - async query(queryParameter) { - try { - var QueryParameterFac = new QueryParameter(); - var qp = await QueryParameterFac.createObj(); - - if (!queryParameter - // && (queryParameter.attributeFilter || queryParameter.groupBy || - // queryParameter.hasGeometry || queryParameter.resultFields || queryParameter.orderBy || - // queryParameter.spatialQueryMode) - ) { - qp.queryParameterId = "0"; - } else { - queryParameter.attributeFilter && await qp.setAttributeFilter(queryParameter.attributeFilter); - - queryParameter.groupBy && await qp.setGroupBy(queryParameter.groupBy); - - queryParameter.hasGeometry && await qp.setHasGeometry(queryParameter.hasGeometry); - - queryParameter.resultFields && await qp.setResultFields(queryParameter.resultFields); - - queryParameter.orderBy && await qp.setOrderBy(queryParameter.orderBy); - - queryParameter.spatialQueryObject && await qp.setSpatialQueryObject(queryParameter.spatialQueryObject); - - queryParameter.spatialQueryMode && await qp.setSpatialQueryMode(queryParameter.spatialQueryMode); - - if (queryParameter.size) qp.size = queryParameter.size; - if (queryParameter.batch) qp.batch = queryParameter.batch; - } - - - var result = await DV.query(this.datasetVectorId, qp.queryParameterId, - qp.size, qp.batch); - return result; - } catch (e) { - console.log(e); - } + } + + /** + * 根据给定的参数来返回空的记录集或者返回包括所有记录的记录集对象。 + * @memberOf DatasetVector + * @deprecated - 已弃用(所有recordset都使用json格式表达),此接口将在数个版本内移除,请慎用。 + * @param {boolean} isEmptyRecordset + * @param {number} cursorType + * @returns {Promise.} + */ + async getRecordset(isEmptyRecordset, cursorType) { + try { + var { recordsetId } = await DV.getRecordset(this._SMDatasetVectorId, isEmptyRecordset, cursorType); + var recordset = new Recordset(); + recordset._SMRecordsetId = recordsetId; + return recordset; + } catch (e) { + console.error(e); } + } + + /** + * 通过设置查询条件对矢量数据集进行查询,该方法默认查询空间信息与属性信息。 + * @memberOf DatasetVector + * @param {object}queryParameter - 定义的查询条件。 + * @returns {Promise} - 返回查询结果对象:result:{geoJson:geoJson结果集数组,每次10条,queryParameterId:查询条件对象的引用,可用于重复查询,counts:总记录数,batch:返回的批次数量,size:每批次记录数(最大为10),recordsetId:记录集对象引用} + */ + async query(queryParameter) { + try { + var QueryParameterFac = new QueryParameter(); + var qp = await QueryParameterFac.createObj(); + + if (!queryParameter + // && (queryParameter.attributeFilter || queryParameter.groupBy || + // queryParameter.hasGeometry || queryParameter.resultFields || queryParameter.orderBy || + // queryParameter.spatialQueryMode) + ) { + qp.queryParameterId = "0"; + } else { + queryParameter.attributeFilter && await qp.setAttributeFilter(queryParameter.attributeFilter); + + queryParameter.groupBy && await qp.setGroupBy(queryParameter.groupBy); + + queryParameter.hasGeometry && await qp.setHasGeometry(queryParameter.hasGeometry); + + queryParameter.resultFields && await qp.setResultFields(queryParameter.resultFields); + + queryParameter.orderBy && await qp.setOrderBy(queryParameter.orderBy); + + queryParameter.spatialQueryObject && await qp.setSpatialQueryObject(queryParameter.spatialQueryObject); + + queryParameter.spatialQueryMode && await qp.setSpatialQueryMode(queryParameter.spatialQueryMode); + + queryParameter.cursorType && await qp.setCursorType(queryParameter.cursorType); + + if (queryParameter.size) qp.size = queryParameter.size; + if (queryParameter.batch) qp.batch = queryParameter.batch; + } - /** - *根据给定的空间索引类型来为矢量数据集创建空间索引。 - * @memberOf DatasetVector - * @param {DatasetVector.SpatialIndeType} spatialIndexType - 指定的需要创建空间索引的类型 - * @returns {Promise.} - */ - async buildSpatialIndex(spatialIndexType) { - try { - var {built} =await DV.buildSpatialIndex(this.datasetVectorId, spatialIndexType); - return built; - } catch (e) { - console.error(e); - } + let result = await DV.query(this._SMDatasetVectorId, qp._SMQueryParameterId, + qp.size, qp.batch); + let geo = result.geoJson && JSON.parse(result.geoJson) || {} + Object.assign(result, { geo: geo }) + return result; + } catch (e) { + console.log(e); } - - /** - * 删除空间索引 - * @memberOf DatasetVector - * @returns {Promise.} - */ - async dropSpatialIndex() { - try { - var {dropped} =await DV.dropSpatialIndex(this.datasetVectorId); - return dropped; - } catch (e) { - console.error(e); - } + } + + async getFieldInfos() { + try { + let result = await DV.getFieldInfos(this._SMDatasetVectorId); + return result; + } catch (e) { + console.log(e); } - - /** - * 返回当前的空间索引类型 - * @memberOf DatasetVector - * @returns {Promise.} - */ - async getSpatialIndexType() { - try { - var {type} =await DV.getSpatialIndexType(this.datasetVectorId); - return type; - } catch (e) { - console.error(e); - } + } + + /** + *根据给定的空间索引类型来为矢量数据集创建空间索引。 + * @memberOf DatasetVector + * @param {DatasetVector.SpatialIndeType} spatialIndexType - 指定的需要创建空间索引的类型 + * @returns {Promise.} + */ + async buildSpatialIndex(spatialIndexType) { + try { + var { built } = await DV.buildSpatialIndex(this._SMDatasetVectorId, spatialIndexType); + return built; + } catch (e) { + console.error(e); } - - /** - * 计算数据集的空间范围 - * @memberOf DatasetVector - * @returns {Promise.} - */ - async computeBounds() { - try { - var {bounds} =await DV.computeBounds(this.datasetVectorId); - return bounds; - } catch (e) { - console.error(e); - } + } + + /** + * 删除空间索引 + * @memberOf DatasetVector + * @returns {Promise.} + */ + async dropSpatialIndex() { + try { + var { dropped } = await DV.dropSpatialIndex(this._SMDatasetVectorId); + return dropped; + } catch (e) { + console.error(e); } - - /** - *从GeoJSON字符串中获取几何对象,并将其存入数据集中 - *仅支持点、线、面和CAD数据集,获取点、线、面对象 - * @memberOf DatasetVector - * @param {boolean} hasAttributte - 是否包含属性值 - * @param {number} startID - 起始SmID - * @param {number} endID - 结束SmID - * @returns {Promise.} - */ - async toGeoJSON(hasAttributte, startID, endID) { - try { - var {geoJSON} =await DV.toGeoJSON(this.datasetVectorId); - var json = JSON.parse(geoJSON); - return geoJSON; - } catch (e) { - console.error(e); - } + } + + /** + * 返回当前的空间索引类型 + * @memberOf DatasetVector + * @returns {Promise.} + */ + async getSpatialIndexType() { + try { + var { type } = await DV.getSpatialIndexType(this._SMDatasetVectorId); + return type; + } catch (e) { + console.error(e); } - - /** - * 将数据集中指定起止SmID的对象,转换成GeoJSON格式的字符串 - *仅支持点、线、面和CAD数据集,转换点、线、面对象.hasAtrributte为true时,结果中包含属性值;hasAtrribute为false时,只有几何对象。 - * @memberOf DatasetVector - * @param {string} geoJson - json字符串 - * @returns {Promise.} - */ - async fromGeoJSON(geoJson) { - try { - var {done} =await DV.fromGeoJSON(this.datasetVectorId,geoJson); - return done; - } catch (e) { - console.error(e); - } + } + + /** + * 计算数据集的空间范围 + * @memberOf DatasetVector + * @returns {Promise.} + */ + async computeBounds() { + try { + var { bounds } = await DV.computeBounds(this._SMDatasetVectorId); + return bounds; + } catch (e) { + console.error(e); } - - /** - * 异步空间查询,查询指定空间范围内符合字段条件的记录; - * @memberOf DatasetVector - * @param {string} attributeFilter - 查询过滤字段 - * @param {object} geoRegion - 查询的区域 - * @param count - 返回的查询结果个数 - * @param {function} callback - 返回结果的处理函数,回调参数callback(e){},e为Recordset的geoJson格式对象的数组 - * @returns {Promise.} - */ - async queryByFilter(attributeFilter,geoRegion,count,callback) { - try { - var success = await DV.queryByFilter(this.datasetVectorId,attributeFilter,geoRegion.geometryId,count); - if(!success) return null; - - DeviceEventEmitter.addListener('com.supermap.RN.JSDatasetVector.query_by_filter', function(e) { - var features = []; - var records = []; - for(var i in e){ - features[i] = JSON.parse(e[i]); - records = records.concat(features[i]); - } - if(typeof callback == 'function'){ - callback(records); - }else{ - console.error("Please set a callback function as the fourth argument."); - } - }); - - } catch (e) { - console.error(e); + } + + /** + *从GeoJSON字符串中获取几何对象,并将其存入数据集中 + *仅支持点、线、面和CAD数据集,获取点、线、面对象 + * @memberOf DatasetVector + * @param {boolean} hasAttributte - 是否包含属性值 + * @param {number} startID - 起始SmID + * @param {number} endID - 结束SmID + * @returns {Promise.} + */ + async toGeoJSON(hasAttributte, startID, endID) { + try { + var { geoJSON } = await DV.toGeoJSON(this._SMDatasetVectorId, hasAttributte, startID, endID); + var json = JSON.parse(geoJSON); + return geoJSON; + } catch (e) { + console.error(e); + } + } + + /** + * 将数据集中指定起止SmID的对象,转换成GeoJSON格式的字符串 + *仅支持点、线、面和CAD数据集,转换点、线、面对象.hasAtrributte为true时,结果中包含属性值;hasAtrribute为false时,只有几何对象。 + * @memberOf DatasetVector + * @param {string} geoJson - json字符串 + * @returns {Promise.} + */ + async fromGeoJSON(geoJson) { + try { + var { done } = await DV.fromGeoJSON(this._SMDatasetVectorId, geoJson); + return done; + } catch (e) { + console.error(e); + } + } + + /** + * 异步空间查询,查询指定空间范围内符合字段条件的记录; + * @memberOf DatasetVector + * @param {string} attributeFilter - 查询过滤字段 + * @param {object} geoRegion - 查询的区域 + * @param count - 返回的查询结果个数 + * @param {function} callback - 返回结果的处理函数,回调参数callback(e){},e为Recordset的geoJson格式对象的数组 + * @returns {Promise.} + */ + async queryByFilter(attributeFilter, geoRegion, count, callback) { + try { + var success = await DV.queryByFilter(this._SMDatasetVectorId, attributeFilter, geoRegion.geometryId, count); + if (!success) return null; + + DeviceEventEmitter.addListener('com.supermap.RN.JSDatasetVector.query_by_filter', function (e) { + var features = []; + var records = []; + for (var i in e) { + features[i] = JSON.parse(e[i]); + records = records.concat(features[i]); + } + if (typeof callback == 'function') { + callback(records); + } else { + console.error("Please set a callback function as the fourth argument."); } + }); + + } catch (e) { + console.error(e); + } + } + + /** + * 通过查询语句获取所需几何对象ID集合 + * @memberOf Dataset + * @param {string} SQL - 查询语句 + * @returns {Promise.} + */ + async getSMID(SQL) { + try { + var { result } = await DV.getSMID(this._SMDatasetVectorId, SQL); + return result; + } catch (e) { + console.error(e); + } + } + + /** + * 通过查询语句获取字段内容 + * @memberOf Dataset + * @param {string} SQL - 查询语句 + * @param {string} fieldName - 字段名 + * @returns {Promise.} + */ + async getFieldValue(SQL, fieldName) { + try { + var { result } = await DV.getFieldValue(this._SMDatasetVectorId, SQL, fieldName); + return result; + } catch (e) { + console.error(e); + } + } + + /** + * 通过查询语句获取所需几何对象内点集合 + * @memberOf Dataset + * @param {string} SQL - 查询语句 + * @returns {Promise.} + */ + async getGeoInnerPoint(SQL) { + try { + var { result } = await DV.getGeoInnerPoint(this._SMDatasetVectorId, SQL); + return result; + } catch (e) { + console.error(e); + } + } + + async setFieldValuesByNames(infos = {}, position = -1) { + try { + let { result, editResult, updateResult } = await DV.setFieldValueByName(this._SMDatasetVectorId, position, infos); + return { result, editResult, updateResult } + } catch (e) { + console.error(e); + } + } + + /** + * 添加FieldInfo + * @param info + * @returns {Promise.<{index: Promise.index}>} + */ + async addFieldInfo(info = {}) { + try { + let { index } = await DV.addFieldInfo(this._SMDatasetVectorId, info); + return index + } catch (e) { + console.error(e); + } + } + + async editFieldInfo(key, info) { + try { + if (info instanceof Number) { + return await DV.editFieldInfoByIndex(this._SMDatasetVectorId, key, info); + } else { + return await DV.editFieldInfoByName(this._SMDatasetVectorId, key, info); + } + } catch (e) { + console.error(e); + } + } + + async removeFieldInfo(info) { + try { + if (info instanceof Number) { + let { result } = await DV.removeFieldInfoByIndex(this._SMDatasetVectorId, info); + return result + } else { + let { result } = await DV.removeFieldInfoByName(this._SMDatasetVectorId, info); + return result + } + } catch (e) { + console.error(e); + } + } + + async getChildDataset() { + try { + let id = await DV.getChildDataset(this._SMDatasetVectorId); + if (id) { + let dataset = new Dataset() + dataset._SMDatasetId = id + return dataset + } + return null + } catch (e) { + console.error(e); } + } } diff --git a/NativeModule/DatasetVectorInfo.js b/NativeModule/DatasetVectorInfo.js old mode 100644 new mode 100755 index 4f3ac82b..72c34c2f --- a/NativeModule/DatasetVectorInfo.js +++ b/NativeModule/DatasetVectorInfo.js @@ -1,25 +1,34 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let DVI = NativeModules.JSDatasetVectorInfo; /** * @class DatasetVectorInfo + * @description 矢量数据集信息类。 + 包括了矢量数据集的信息,如矢量数据集的名称,数据集的类型。 */ export default class DatasetVectorInfo { /** * 创建DatasetVectorInfo实例 - * @param name - DatasetVectorInfo名字 - * @param type - DatasetVectorInfo类型 + * @memberOf DatasetVectorInfo + * @param {string} name - 数据集的名称 + * @param {number} type - 数据集的类型 * @returns {Promise.} */ async createObjByNameType(name,type){ try{ var {datasetVectorInfoId} = await DVI.createObjByNameType(name,type); var datasetVectorInfo = new DatasetVectorInfo(); - datasetVectorInfo.datasetVectorInfoId = datasetVectorInfoId; + datasetVectorInfo._SMDatasetVectorInfoId = datasetVectorInfoId; return datasetVectorInfo; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/Datasets.js b/NativeModule/Datasets.js old mode 100644 new mode 100755 index fd9c2437..d5b5ee32 --- a/NativeModule/Datasets.js +++ b/NativeModule/Datasets.js @@ -1,6 +1,9 @@ -/** - * Created by will on 2016/6/17. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + Description: 该类作为辅助类,不对外开放,后期可能考虑移除。 + **********************************************************************************/ import {NativeModules} from 'react-native'; let D = NativeModules.JSDatasets; import Dataset from './Dataset.js'; @@ -9,51 +12,81 @@ import Recordset from './Recordset.js'; /** * @class Datasets - * @deprecated + * @description 数据集集合类。提供对数据集的管理功能,如创建、删除、重命名等操作。 */ export default class Datasets{ + + /** + * 返回指定序号的数据集。 + * @memberOf Datasets + * @param {number} index - 指定数据集的序号 + * @returns {Promise.} + */ async get(index){ - this._drepecated(); + // this._drepecated(); try{ var dataset = new Dataset(); if(typeof index != "string"){ - var {datasetId} = await D.get(this.datasetsId,index); + var {datasetId} = await D.get(this._SMDatasetsId,index); }else{ - var {datasetId} = await D.getByName(this.datasetsId,index); + var {datasetId} = await D.getByName(this._SMDatasetsId,index); } - dataset.datasetId = datasetId; + dataset._SMDatasetId = datasetId; return dataset; }catch(e){ console.error(e); } } + + async getCount(){ + // this._drepecated(); + try{ + var { count } = await D.getCount(this._SMDatasetsId); + return count; + }catch(e){ + console.error(e); + } + } + /** + * 返回一个数据源中未被使用的数据集的名称。 + * @memberOf Datasets + * @param {string} name - 数据集名称 + * @returns {Promise.} + */ async getAvailableDatasetName(name){ - this._drepecated(); + // this._drepecated(); try{ - var {datasetName} = await D.getAvailableDatasetName(this.datasetsId,name); + var {datasetName} = await D.getAvailableDatasetName(this._SMDatasetsId,name); return datasetName; }catch(e){ console.error(e); } } + + /** + * 根据指定的矢量数据集信息来创建矢量数据集。 + * @memberOf Datasets + * @param {DatasetVectorInfo} datasetVectorInfo - 矢量数据集信息 + * @returns {Promise.} + */ async create(datasetVectorInfo){ - this._drepecated(); + // this._drepecated(); try{ - var {datasetVectorId} = await D.create(this.datasetsId,datasetVectorInfo.datasetVectorInfoId); + var {datasetVectorId} = await D.create(this._SMDatasetsId,datasetVectorInfo._SMDatasetVectorInfoId); var datasetVector = new DatasetVector(); - datasetVector.datasetVectorId = datasetVectorId; + datasetVector._SMDatasetVectorId = datasetVectorId; return datasetVector; }catch(e){ console.error(e); } } - _drepecated(){ - console.warn("Datasets.js:This class has been deprecated. " + - "All its implements has been migrated to the Datasource class." + - "Relevant modifications refer to the API documents please"); - } -} \ No newline at end of file + // _drepecated(){ + // console.warn("Datasets.js:This class has been deprecated. " + + // "All its implements has been migrated to the Datasource class." + + // "Relevant modifications refer to the API documents please"); + // } +} diff --git a/NativeModule/Datasource.js b/NativeModule/Datasource.js old mode 100644 new mode 100755 index 5d7d32b8..3a2a1f3d --- a/NativeModule/Datasource.js +++ b/NativeModule/Datasource.js @@ -1,214 +1,280 @@ -/** - * Created by will on 2016/6/17. - */ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + Description:数据源类 + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let D = NativeModules.JSDatasource; -import Datasets from './Datasets'; +import Datasets from './Datasets.js'; import Dataset from './Dataset.js'; import DatasetVector from './DatasetVector.js'; import PrjCoordSys from './PrjCoordSys.js'; +import DatasourceConnectionInfo from './DatasourceConnectionInfo.js'; /** * @class Datasource + * @description 该类管理投影信息、数据源与数据库的连接信息和对其中的数据集的相关操作,如通过已有数据集复制生成新的数据集等。 * @property {number} EncodeType - 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT * @property {number} DatasourceEncrytionType - 数据集存储时的压缩编码方式 DEFAULT | AES */ -export default class Datasource{ - - /** - * 获取数据集集合 - * @memberOf Datasource - * @deprecated - 已弃用Datasets类 - * @returns {Promise.} - */ - async getDatasets(){ - console.warn("Datasource.js:getDatasets() function has been deprecated. If you want to get dataset , please call the getDataset() function"); - try{ - var {datasetsId} = await D.getDatasets(this.datasourceId); - var datasets = new Datasets(); - datasets.datasetsId = datasetsId; - - return datasets; - }catch(e){ - console.error(e); - } +export default class Datasource { + + async getAlias() { + try { + var { alias } = await D.getAlias(this._SMDatasourceId); + + return alias; + } catch (e) { + console.error(e); } - - /** - * 指定名称或序号来获取数据集 - * @memberOf Datasource - * @param {number | string} index|name - 既可以是序号,也可以是数据集名称 - * @returns {Promise.} - */ - async getDataset(arg){ - try{ - var dataset = new Dataset(); - if(typeof arg != "string"){ - var {datasetId} = await D.getDataset(this.datasourceId,arg); - }else{ - var {datasetId} = await D.getDatasetByName(this.datasourceId,arg); - } - dataset.datasetId = datasetId; - console.log("Datasource.js:----------------------datasetId:"+dataset.datasetId); - - return dataset; - }catch(e){ - console.error(e); - } + } + + /** + * 获取数据集集合。 + * @memberOf Datasource + * @deprecated - 已弃用,Datasets类不建议使用,后续版本即将移除此接口 + * @returns {Promise.} + */ + async getDatasets() { + console.warn("Datasource.js:getDatasets() function has been deprecated. If you want to get dataset , please call the getDataset() function"); + try { + var { datasetsId } = await D.getDatasets(this._SMDatasourceId); + var datasets = new Datasets(); + datasets._SMDatasetsId = datasetsId; + + return datasets; + } catch (e) { + console.error(e); } - - /** - * 检测所供名称是否可用于新建数据集 - * @memberOf Datasource - * @param {string} name - 待检测名称 - * @returns {Promise.} - */ - async getAvailableDatasetName(name){ - try{ - var {datasetName} = await D.getAvailableDatasetName(this.datasourceId,name); - return datasetName; - }catch(e){ - console.error(e); - } + } + + /** + * 指定名称或序号来获取数据集。 + * @memberOf Datasource + * @param {number | string} index|name - 既可以是序号,也可以是数据集名称 + * @returns {Promise.} + */ + async getDataset(arg) { + try { + var dataset = new Dataset(); + if (typeof arg != "string") { + var { datasetId } = await D.getDataset(this._SMDatasourceId, arg); + } else { + var { datasetId } = await D.getDatasetByName(this._SMDatasourceId, arg); + } + dataset._SMDatasetId = datasetId; + + return dataset; + } catch (e) { + console.error(e); } - - /** - * 根据指定的矢量数据集信息来创建矢量数据集。可传入一个datasetVectorInfo类对象,或直接传入数据集名称、数据集类型和编码类型三个参数。 - * @memberOf Datasource - * @param {object | string} datasetVectorInfo|datasetName - 数据集矢量信息对象 - * @param {number} datasetType - {@link Dataset} - * @param {number} encodeType - 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT - * @returns {Promise.} - */ - async createDatasetVector(nameOrInfoObj,datasetType,encodeType){ - try{ - if(arguments.length === 1){ - var {datasetVectorId} = await D.createDatasetVector(this.datasourceId,nameOrInfoObj.datasetVectorInfoId); - var datasetVector = new DatasetVector(); - datasetVector.datasetVectorId = datasetVectorId; - return datasetVector; - }else{ - var {datasetVectorId} = await D.createDatasetVectorDirectly(this.datasourceId,nameOrInfoObj,datasetType,encodeType); - var datasetVector = new DatasetVector(); - datasetVector.datasetVectorId = datasetVectorId; - return datasetVector; - } - }catch(e){ - console.error(e); - } + } + + /** + * 返回一个数据源中未被使用的数据集的名称。 + * @memberOf Datasource + * @param {string} name - 待检测名称 + * @returns {Promise.} + */ + async getAvailableDatasetName(name) { + try { + var { datasetName } = await D.getAvailableDatasetName(this._SMDatasourceId, name); + return datasetName; + } catch (e) { + console.error(e); } - - - /** - * 用于在相同或不同引擎数据源中复制数据集。 - * @memberOf Datasource - * @param {object} srcDataset - 要复制的源数据集。 - * @param {string} desDatasetName - 目标数据集的名称。 - * @param {Datasource.EncodeType}encodeType - 数据集的编码方式。 - * @returns {Promise.} - */ - async copyDataset(srcDataset,desDatasetName,encodeType){ - try{ - var {datasetId} = await D.copyDataset(this.datasourceId,srcDataset.datasetId,desDatasetName,encodeType | 0); - var dataset = new Dataset(); - dataset.datasetId = datasetId; - return dataset; - }catch(e){ - console.error(e); - } + } + + /** + * 根据指定的矢量数据集信息来创建矢量数据集。可传入一个datasetVectorInfo类对象,或直接传入数据集名称、数据集类型和编码类型三个参数。 + * @memberOf Datasource + * @param {object | string} datasetVectorInfo|datasetName - 数据集矢量信息对象 + * @param {number} datasetType - {@link Dataset} + * @param {number} encodeType - 数据集存储时的压缩编码方式 NONE | BYTE | INT16 | INT24 | INT32 | LZW | SGL | DCT + * @returns {Promise.} + */ + async createDatasetVector(nameOrInfoObj, datasetType, encodeType) { + try { + if (arguments.length === 1) { + var { datasetVectorId } = await D.createDatasetVector(this._SMDatasourceId, nameOrInfoObj._SMDatasetVectorInfoId); + var datasetVector = new DatasetVector(); + datasetVector._SMDatasetVectorId = datasetVectorId; + return datasetVector; + } else { + var { datasetVectorId } = await D.createDatasetVectorDirectly(this._SMDatasourceId, nameOrInfoObj, datasetType, encodeType); + var datasetVector = new DatasetVector(); + datasetVector._SMDatasetVectorId = datasetVectorId; + return datasetVector; + } + } catch (e) { + console.error(e); } - - /** - * 修改当前数据源的密码 - * @memberOf Datasource - * @param {number} oldPassword - 原始密码,不能为null - * @param {number} newPassword - 新密码,不能为null - * @param {Datasource.DatasourceEncrytionType} datasourceEncrytionType - * @returns {Promise.} 新密码使用的加密类型 - */ - async changepassword(oldPassword,newPassword,datasourceEncrytionType){ - try{ - if(!oldPassword || !newPassword) throw new Error("Datasource.js:原始密码和新密码不能为空。"); - var {changed} = await D.changepassword(this.datasourceId,oldPassword,newPassword, datasourceEncrytionType | 0); - return changed; - }catch(e){ - console.error(e); - } + } + + + /** + * 用于在相同或不同引擎数据源中复制数据集。 + * @memberOf Datasource + * @param {object} srcDataset - 要复制的源数据集。 + * @param {string} desDatasetName - 目标数据集的名称。 + * @param {Datasource.EncodeType}encodeType - 数据集的编码方式。 + * @returns {Promise.} + */ + async copyDataset(srcDataset, desDatasetName, encodeType) { + try { + var { datasetId } = await D.copyDataset(this._SMDatasourceId, srcDataset._SMDatasetId, desDatasetName, encodeType | 0); + var dataset = new Dataset(); + dataset.datasetId = datasetId; + return dataset; + } catch (e) { + console.error(e); } - - /** - * 返回数据源的投影信息。 - * @memberOf Datasource - * @returns {Promise.} - */ - async getPrjCoordSys(){ - try{ - var {prjCoordSysId} = await D.getPrjCoordSys(this.datasourceId); - var prjCoordSys = new PrjCoordSys(); - prjCoordSys.prjCoordSysId = prjCoordSysId; - return prjCoordSys; - }catch(e){ - console.error(e); - } + } + + /* + * 修改当前数据源的密码 + * @memberOf Datasource + * @param {number} oldPassword - 原始密码,不能为null + * @param {number} newPassword - 新密码,不能为null + * @param {Datasource.DatasourceEncrytionType} datasourceEncrytionType + * @returns {Promise.} 新密码使用的加密类型 + */ + /* async changepassword(oldPassword,newPassword,datasourceEncrytionType){ + try{ + if(!oldPassword || !newPassword) throw new Error("Datasource.js:原始密码和新密码不能为空。"); + var {changed} = await D.changepassword(this._SMDatasourceId,oldPassword,newPassword, datasourceEncrytionType | 0); + return changed; + }catch(e){ + console.error(e); + } + } */ + + /** + * 返回数据源的投影信息。 + * @memberOf Datasource + * @returns {Promise.} + */ + async getPrjCoordSys() { + try { + var { prjCoordSysId } = await D.getPrjCoordSys(this._SMDatasourceId); + var prjCoordSys = new PrjCoordSys(); + prjCoordSys._SMPrjCoordSysId = prjCoordSysId; + return prjCoordSys; + } catch (e) { + console.error(e); } - - /** - * 检查当前数据源中是否包含指定名称的数据集。 - * @memberOf Datasource - * @param {string} datasetName - 数据集名称 - * @returns {boolean} - */ - async containDataset(datasetName){ - try{ - var {contain} = await D.containDataset(this.datasourceId,datasetName); - return contain; - }catch(e){ - console.error(e); - } + } + + /** + * 检查当前数据源中是否包含指定名称的数据集。 + * @memberOf Datasource + * @param {string} datasetName - 数据集名称 + * @returns {Promise.} + */ + async containDataset(datasetName) { + try { + var { contain } = await D.containDataset(this._SMDatasourceId, datasetName); + return contain; + } catch (e) { + console.error(e); } - - /** - * 用于删除指定名称的数据集。 - * @memberOf Datasource - * @param {string} datasetName - 数据集名称 - * @returns {boolean} - */ - async deleteDataset(datasetName){ - try{ - var {deleted} = await D.deleteDataset(this.datasourceId,datasetName); - return deleted; - }catch(e){ - console.error(e); - } + } + + /** + * 用于删除指定名称的数据集。 + * @memberOf Datasource + * @param {string} datasetName - 数据集名称 + * @returns {Promise.} + */ + async deleteDataset(datasetName) { + try { + var { deleted } = await D.deleteDataset(this._SMDatasourceId, datasetName); + return deleted; + } catch (e) { + console.error(e); } - - /** - * 返回数据集集合中数据集的个数。 - * @memberOf Datasource - * @returns {number} - */ - async getDatasetCount(){ - try{ - var {count} = await D.getDatasetCount(this.datasourceId); - return count; - }catch(e){ - console.error(e); - } + } + + /** + * 返回数据集集合中数据集的个数。 + * @memberOf Datasource + * @returns {Promise.} + */ + async getDatasetCount() { + try { + var { count } = await D.getDatasetCount(this._SMDatasourceId); + return count; + } catch (e) { + console.error(e); } + } + + /** + * 返回数据源是否已打开 + * @returns {Promise.} + */ + async isOpened() { + try { + return await D.isOpened(this._SMDatasourceId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回数据源是否有改动 + * @returns {Promise.>} + */ + async isModified() { + try { + return await D.isModified(this._SMDatasourceId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回数据源是否以制度方式打开 + * @returns {Promise.>} + */ + async isReadOnly() { + try { + return await D.isReadOnly(this._SMDatasourceId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回此数据源的连接信息 + * @returns {Promise.>} + */ + async getConnectionInfo() { + try { + let id = await D.getConnectionInfo(this._SMDatasourceId); + let connInfo = new DatasourceConnectionInfo() + connInfo._SMDatasourceConnectionInfoId = id + return connInfo + } catch (e) { + console.error(e); + } + } } Datasource.EncodeType = { - NONE:0, - BYTE:1, - INT16:2, - INT24:3, - INT32:4, - DCT:8, - SGL:9, - LZW:11 + NONE: 0, + BYTE: 1, + INT16: 2, + INT24: 3, + INT32: 4, + DCT: 8, + SGL: 9, + LZW: 11 } Datasource.DatasourceEncrytionType = { - DEFAULT:0, - AES:1 -} \ No newline at end of file + DEFAULT: 0, + AES: 1 +} diff --git a/NativeModule/DatasourceConnectionInfo.js b/NativeModule/DatasourceConnectionInfo.js old mode 100644 new mode 100755 index 6ea150bb..2aa2dcfa --- a/NativeModule/DatasourceConnectionInfo.js +++ b/NativeModule/DatasourceConnectionInfo.js @@ -1,69 +1,110 @@ -/** - * Created by will on 2016/6/17. - */ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let DCI = NativeModules.JSDatasourceConnectionInfo; /** * @class DatasourceConnectionInfo + * @description 数据源连接信息类。 */ -export default class DatasourceConnectionInfo{ - /** - * 创建一个DatasourceConnectionInfo实例 - * @memberOf DatasourceConnectionInfo - * @returns {Promise.} - */ - async createObj(){ - try{ - var {datasourceConnectionInfoId} = await DCI.createObj(); - var datasourceConnectionInfo = new DatasourceConnectionInfo(); - datasourceConnectionInfo.datasourceConnectionInfoId=datasourceConnectionInfoId; - return datasourceConnectionInfo; - }catch (e){ - console.error(e); - } +export default class DatasourceConnectionInfo { + /** + * 创建一个DatasourceConnectionInfo实例 + * @memberOf DatasourceConnectionInfo + * @returns {Promise.} + */ + async createObj() { + try { + var { datasourceConnectionInfoId } = await DCI.createObj(); + var datasourceConnectionInfo = new DatasourceConnectionInfo(); + datasourceConnectionInfo._SMDatasourceConnectionInfoId = datasourceConnectionInfoId; + return datasourceConnectionInfo; + } catch (e) { + console.error(e); } - - /** - * 设置数据库服务器名或文件名。 - * 对于 UDB 文件,为其文件的名称,其中包括路径名称和文件的后缀名。特别地,此处的路径为绝对路径。 - * @memberOf DatasourceConnectionInfo - * @param {string} url - 数据库服务器名或文件名。 - * @returns {Promise.} - */ - async setServer(url){ - try{ - await DCI.setServer(this.datasourceConnectionInfoId,url); - }catch(e){ - console.error(e); - } + } + + /** + * 设置数据库服务器名或文件名。 + * @description 对于 UDB 文件,为其文件的名称,其中包括路径名称和文件的后缀名。特别地,此处的路径为绝对路径。 + * @memberOf DatasourceConnectionInfo + * @param {string} url - 数据库服务器名或文件名。 + * @returns {Promise.} + */ + async setServer(url) { + try { + await DCI.setServer(this._SMDatasourceConnectionInfoId, url); + } catch (e) { + console.error(e); } - - /** - * 返回数据源连接的引擎类型。对不同类型的空间数据源,需要不同的空间数据库引擎来存储和管理,对文件型数据源,即 UDB 数据源,需要 SDX+ for UDB,引擎类型为 UDB。目前版本支持的引擎类型包括 UDB 引擎(UDB),影像只读引擎(IMAGEPLUGINS)。 - * @memberOf DatasourceConnectionInfo - * @param {string} engineType - 数据源连接的引擎类型。BaiDu,BingMaps,GoogleMaps,OGC,OpenGLCache,OpenStreetMaps,Rest,SuperMapCloud,UDB - * @returns {Promise.} - */ - async setEngineType(engineType){ - try{ - await DCI.setEngineType(this.datasourceConnectionInfoId,engineType); - }catch(e){ - console.error(e); - } + } + + /** + * 设置数据源连接的引擎类型。 + * @description 对不同类型的空间数据源,需要不同的空间数据库引擎来存储和管理,对文件型数据源,即 UDB 数据源,需要 SDX+ for UDB,引擎类型为 UDB。目前版本支持的引擎类型包括 UDB 引擎(UDB),影像只读引擎(IMAGEPLUGINS)。 + * @memberOf DatasourceConnectionInfo + * @param {string} engineType - 数据源连接的引擎类型。BaiDu,BingMaps,GoogleMaps,OGC,OpenGLCache,OpenStreetMaps,Rest,SuperMapCloud,UDB + * @returns {Promise.} + */ + async setEngineType(engineType) { + try { + await DCI.setEngineType(this._SMDatasourceConnectionInfoId, engineType); + } catch (e) { + console.error(e); } - - /** - * 设置数据源别名 - * @memberOf DatasourceConnectionInfo - * @param {string} alias - 别名 - * @returns {Promise.} - */ - async setAlias(alias){ - try{ - await DCI.setAlias(this.datasourceConnectionInfoId,alias); - }catch(e){ - console.error(e); - } + } + + /** + * 设置数据源别名 + * @memberOf DatasourceConnectionInfo + * @param {string} alias - 别名 + * @returns {Promise.} + */ + async setAlias(alias) { + try { + await DCI.setAlias(this._SMDatasourceConnectionInfoId, alias); + } catch (e) { + console.error(e); + } + } + + /** + * 获取数据源别名 + * @returns {Promise} + */ + async getAlias() { + try { + return await DCI.getAlias(this._SMDatasourceConnectionInfoId); + } catch (e) { + console.error(e); + } + } + + /** + * 获取数据库服务器名或文件名 + * @returns {Promise} + */ + async getServer() { + try { + return await DCI.getServer(this._SMDatasourceConnectionInfoId); + } catch (e) { + console.error(e); + } + } + + /** + * 获取返回数据源连接的引擎类型 + * @returns {Promise} + */ + async getEngineType() { + try { + return await DCI.getEngineType(this._SMDatasourceConnectionInfoId); + } catch (e) { + console.error(e); } + } } diff --git a/NativeModule/Datasources.js b/NativeModule/Datasources.js old mode 100644 new mode 100755 index 4c0b4cb2..ea112c9f --- a/NativeModule/Datasources.js +++ b/NativeModule/Datasources.js @@ -1,7 +1,7 @@ /** * Created by will on 2016/6/17. */ -import {NativeModules} from 'react-native'; +import { NativeModules } from 'react-native'; let D = NativeModules.JSDatasources; import Datasource from './Datasource.js'; @@ -9,46 +9,72 @@ import Datasource from './Datasource.js'; * @deprecated * @class Datasources */ -export default class Datasources{ - /** - * @memberOf Datasources - * @param datasourceConnectionInfo - * @returns {Promise.} - */ - async open(datasourceConnectionInfo){ - this._drepecated(); - try{ - var {datasourceId} = await D.open(this.datasourcesId,datasourceConnectionInfo.datasourceConnectionInfoId); - console.log("datasourceId:"+datasourceId); - var datasource = new Datasource(); - datasource.datasourceId = datasourceId; - - return datasource; - }catch(e){ - console.error(e); - } +export default class Datasources { + /** + * @memberOf Datasources + * @param datasourceConnectionInfo + * @returns {Promise.} + */ + async open(datasourceConnectionInfo) { + //this._drepecated(); + try { + var { datasourceId } = await D.open(this._SMDatasourcesId, datasourceConnectionInfo._SMDatasourceConnectionInfoId); + console.log("datasourceId:" + datasourceId); + var datasource = new Datasource(); + datasource._SMDatasourceId = datasourceId; + + return datasource; + } catch (e) { + console.error(e); } - - async get(index){ - this._drepecated(); - try{ - var datasource = new Datasource(); - if(typeof index != 'string'){ - var {datasourceId} = await D.get(this.datasourcesId,index); - }else{ - var {datasourceId} = await D.getByName(this.datasourcesId,index); - } - datasource.datasourceId = datasourceId; - - return datasource; - }catch(e){ - console.error(e); - } + } + + async get(index) { + //this._drepecated(); + try { + var datasource = new Datasource(); + if (typeof index != 'string') { + var { datasourceId } = await D.get(this._SMDatasourcesId, index); + } else { + var { datasourceId } = await D.getByName(this._SMDatasourcesId, index); + } + datasource._SMDatasourceId = datasourceId; + + return datasource; + } catch (e) { + console.error(e); } - - _drepecated(){ - console.warn("Datasources.js:This class has been deprecated. " + - "All its implements has been migrated to the Workspace class." + - "Relevant modifications refer to the API documents please"); + } + + async getCount() { + try { + var { count } = await D.getCount(this._SMDatasourcesId); + return count; + } catch (e) { + console.error(e); + } + } + + async getAlias(index) { + try { + var { alias } = await D.getAlias(this._SMDatasourcesId, index); + return alias; + } catch (e) { + console.error(e); + } + } + + async renameDatasource(oldName, newName) { + try { + await D.renameDatasource(this._SMDatasourcesId, oldName, newName); + } catch (e) { + console.error(e); } -} \ No newline at end of file + } + + _drepecated() { + console.warn("Datasources.js:This is private class. " + + "All its implements has been migrated to the Workspace class." + + "Relevant modifications refer to the API documents please"); + } +} diff --git a/NativeModule/ElementLine.js b/NativeModule/ElementLine.js new file mode 100755 index 00000000..ae61d969 --- /dev/null +++ b/NativeModule/ElementLine.js @@ -0,0 +1,54 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let EL = NativeModules.JSElementLine; +import CollectorElement from './CollectorElement'; + +/** + * 线类型采集对象类 + */ +export default class ElementLine extends CollectorElement { + constructor() { + super(); + Object.defineProperty(this, "_ElementLineId", { + get: function () { + return this._SMCollectorElementId + }, + set: function (_ElementLineId) { + this._SMCollectorElementId = _ElementLineId; + } + }) + } + + /** + * ElementLine 对象构造方法 + * @returns {Promise.} + */ + async createObj() { + try { + let id = await EL.createObj(); + let geoLine = new ElementLine(); + geoLine._ElementLineId = id; + return geoLine; + } catch (e) { + console.error(e); + } + } + + /** + * 通过 Geomotry 构造线类型的采集对象 + * @param geometry + * @returns {Promise.} + */ + async fromGeometry(geometry) { + try { + return await EL.fromGeometry(this._ElementLineId, geometry._SMGeometryId); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/ElementPoint.js b/NativeModule/ElementPoint.js new file mode 100755 index 00000000..73faec8c --- /dev/null +++ b/NativeModule/ElementPoint.js @@ -0,0 +1,54 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let EP = NativeModules.JSElementPoint; +import CollectorElement from './CollectorElement'; + +/** + * 线类型采集对象类 + */ +export default class ElementPoint extends CollectorElement { + constructor() { + super(); + Object.defineProperty(this, "_ElementPointId", { + get: function () { + return this._SMCollectorElementId + }, + set: function (_ElementPointId) { + this._SMCollectorElementId = _ElementPointId; + } + }) + } + + /** + * ElementPoint 对象构造方法 + * @returns {Promise.} + */ + async createObj() { + try { + let id = await EP.createObj(); + let geoLine = new ElementPoint(); + geoLine._ElementPointId = id; + return geoLine; + } catch (e) { + console.error(e); + } + } + + /** + * 通过 Geomotry 构造点类型的采集对象 + * @param geometry + * @returns {Promise.} + */ + async fromGeometry(geometry) { + try { + return await EP.fromGeometry(this._ElementPointId, geometry._SMGeometryId); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/ElementPolygon.js b/NativeModule/ElementPolygon.js new file mode 100755 index 00000000..c51d848e --- /dev/null +++ b/NativeModule/ElementPolygon.js @@ -0,0 +1,54 @@ +/********************************************************************************* + 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.} + */ + 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.} + */ + async fromGeometry(geometry) { + try { + return await EPL.fromGeometry(this._ElementPolygonId, geometry._SMGeometryId); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/EngineType.js b/NativeModule/EngineType.js old mode 100644 new mode 100755 index a0689b06..500e9157 --- a/NativeModule/EngineType.js +++ b/NativeModule/EngineType.js @@ -1,7 +1,7 @@ /** * Created by will on 2017/3/10. */ -export const EngineType = { +export default { OGC: 23, UDB: 219, SuperMapCloud: 224, diff --git a/NativeModule/Environment.js b/NativeModule/Environment.js new file mode 100755 index 00000000..97342273 --- /dev/null +++ b/NativeModule/Environment.js @@ -0,0 +1,22 @@ +import { NativeModules } from 'react-native'; +let E = NativeModules.JSEnvironment; +export default class Environment { + + async setLicensePath(path) { + try { + var { isSet } = await E.setLicensePath(path); + return isSet + } catch (e) { + console.error(e); + } + } + + async initialization() { + try { + var { isInit } = await E.initialization(); + return isInit + } catch (e) { + console.error(e); + } + } +} \ No newline at end of file diff --git a/NativeModule/FacilityAnalyst.js b/NativeModule/FacilityAnalyst.js new file mode 100755 index 00000000..04104cb1 --- /dev/null +++ b/NativeModule/FacilityAnalyst.js @@ -0,0 +1,460 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let FA = NativeModules.JSFacilityAnalyst; + +import FacilityAnalystSetting from './FacilityAnalystSetting' +/** + * 设施网络分析类。它是网络分析功能类之一,主要用于进行各类连通性分析和追踪分析。 + */ +export default class FacilityAnalyst { + async createObj() { + try { + let facilityAnalystId = await FA.createObj(); + let facilityAnalyst = new FacilityAnalyst(); + facilityAnalyst._SMFacilityAnalystId = facilityAnalystId; + return facilityAnalyst; + } catch (e) { + console.error(e); + } + } + + /** + * 检查网络环路,返回构成环路的弧段 ID 数组 + * @returns {Promise.} + */ + async checkLoops () { + try { + let ids = await FA.checkLoops(this._SMFacilityAnalystId); + + return ids; + } catch (e) { + console.error(e); + } + } + + async dispose () { + try { + await FA.dispose(this._SMFacilityAnalystId); + } catch (e) { + console.error(e); + } + } + + /** + * 根据设施网络分析环境设置加载设施网络模型 + * @returns {Promise.<*>} + */ + async load () { + try { + let result = await FA.load(this._SMFacilityAnalystId); + return result; + } catch (e) { + console.error(e); + } + } + + /** + * 返回设施网络分析的环境 + * @returns {Promise.} + */ + async getAnalystSetting () { + try { + let settingId = await FA.getAnalystSetting(this._SMFacilityAnalystId); + let setting = new FacilityAnalystSetting(); + setting._SMFacilityAnalystSettingId = settingId + return setting; + } catch (e) { + console.error(e); + } + } + + /** + * 设置设施网络分析的环境 + * @param setting + * @returns {Promise.} + */ + async setAnalystSetting (setting) { + try { + console.log(this._SMFacilityAnalystId) + await FA.setAnalystSetting(this._SMFacilityAnalystId, setting._SMFacilityAnalystSettingId); + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 数组,查找这些弧段的共同上游弧段,返回弧段 ID 数组 + * @param edgeIDs + * @param isUncertainDirectionValid + * @returns {Promise} + */ + async findCommonAncestorsFromEdges (edgeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findCommonAncestorsFromEdges(this._SMFacilityAnalystId, edgeIDs, isUncertainDirectionValid); + return ids; + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 数组,查找这些结点的共同上游弧段,返回弧段 ID 数组 + * @param nodeIDs + * @param isUncertainDirectionValid + * @returns {Promise} + */ + async findCommonAncestorsFromNodes (nodeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findCommonAncestorsFromNodes(this._SMFacilityAnalystId, nodeIDs, isUncertainDirectionValid); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 数组,查找这些弧段的共同下游弧段,返回弧段 ID 数组 + * @param edgeIDs + * @param isUncertainDirectionValid + * @returns {Promise.} + */ + async findCommonCatchmentsFromEdges (edgeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findCommonCatchmentsFromEdges(this._SMFacilityAnalystId, edgeIDs, isUncertainDirectionValid); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据指定的结点 ID 数组,查找这些结点的共同下游弧段,返回弧段 ID 数组 + * @param nodeIDs + * @param isUncertainDirectionValid + * @returns {Promise} + */ + async findCommonCatchmentsFromNodes (nodeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findCommonCatchmentsFromNodes(this._SMFacilityAnalystId, nodeIDs, isUncertainDirectionValid); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 数组,查找与这些弧段相连通的弧段,返回弧段 ID 数组 + * @param edgeIDs + * @param isUncertainDirectionValid + * @returns {Promise} + */ + async findConnectedEdgesFromEdges (edgeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findConnectedEdgesFromEdges(this._SMFacilityAnalystId, edgeIDs, isUncertainDirectionValid); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 数组,查找与这些结点相连通弧段,返回弧段 ID 数组 + * @param nodeIDs + * @param isUncertainDirectionValid + * @returns {Promise} + */ + async findConnectedEdgesFromNodes (nodeIDs, isUncertainDirectionValid) { + try { + let ids = await FA.findConnectedEdgesFromNodes(this._SMFacilityAnalystId, nodeIDs, isUncertainDirectionValid); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 数组查找与这些弧段相连接的环路,返回构成环路的弧段 ID 数组 + * @param edgeIDs + * @returns {Promise} + */ + async findLoopsFromEdges (edgeIDs) { + try { + let ids = await FA.findLoopsFromEdges(this._SMFacilityAnalystId, edgeIDs); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 数组查找与这些结点相连接的环路,返回构成环路的弧段 ID 数组 + * @param nodeIDs + * @returns {Promise} + */ + async findLoopsFromNodes (nodeIDs) { + try { + let ids = await FA.findLoopsFromNodes(this._SMFacilityAnalystId, nodeIDs); + return ids + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络下游路径分析,根据给定的参与分析的弧段 ID,查询该弧段下游耗费最小的路径,返回该路径包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathDownFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findPathDownFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络下游路径分析,根据给定的参与分析的弧段 ID,查询该弧段下游耗费最小的路径,返回该路径包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathDownFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findPathDownFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络路径分析,即根据给定的起始和终止弧段 ID,查找其间耗费最小的路径,返回该路径包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathFromEdges (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findPathFromEdges(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络路径分析,即根据给定的起始和终止结点 ID,查找其间耗费最小的路径,返回该路径包含的弧段、结点及耗费。 + * @param startNodeId + * @param endNodeId + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathFromNodes (startNodeId, endNodeId, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes, message } = await FA.findPathFromNodes(this._SMFacilityAnalystId, startNodeId, endNodeId, weightName, isUncertainDirectionValid); + return { coast, edges, nodes, message } + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络上游路径分析,根据给定的弧段 ID,查询该弧段上游耗费最小的路径,返回该路径包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathUpFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findPathUpFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 设施网络上游路径分析,根据给定的结点 ID,查询该结点上游耗费最小的路径,返回该路径包含的弧段、结点及耗费 + * @param nodeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findPathUpFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findPathUpFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 查找汇,即从给定弧段出发,根据流向查找流出该弧段的下游汇点,并返回给定弧段到达该汇的最小耗费路径所包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findSinkFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findSinkFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 查找汇,即从给定结点出发,根据流向查找流出该结点的下游汇点,并返回给定结点到达该汇的最小耗费路径所包含的弧段、结点及耗费 + * @param nodeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findSinkFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findSinkFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 查找源,即从给定弧段出发,根据流向查找流向该弧段的网络源头,并返回该源到达给定弧段的最小耗费路径所包含的弧段、结点及耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findSourceFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findSourceFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 查找源,即从给定结点出发,根据流向查找流向该结点的网络源头,并返回该源到达给定结点的最小耗费路径所包含的弧段、结点及耗费 + * @param nodeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async findSourceFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.findSourceFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 数组,查找与这些弧段不相连通的弧段,返回弧段 ID 数组 + * @param edgeIDs + * @returns {Promise} + */ + async findUnconnectedEdgesFromEdges (edgeIDs) { + try { + let unconnectedEdges = await FA.findUnconnectedEdgesFromEdges(this._SMFacilityAnalystId, edgeIDs); + return unconnectedEdges + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 数组,查找与这些结点不相连通的弧段,返回弧段 ID 数组 + * @param nodeIDs + * @returns {Promise} + */ + async findUnconnectedEdgesFromNodes (nodeIDs) { + try { + let unconnectedEdges = await FA.findUnconnectedEdgesFromNodes(this._SMFacilityAnalystId, nodeIDs); + return unconnectedEdges + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 进行下游追踪,即查找给定弧段的下游,返回下游包含的弧段、结点及总耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async traceDownFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.traceDownFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 进行下游追踪,即查找给定结点的下游,返回下游包含的弧段、结点及总耗费 + * @param nodeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async traceDownFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.traceDownFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的弧段 ID 进行上游追踪,即查找给定弧段的上游,返回上游包含的弧段、结点及总耗费 + * @param edgeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async traceUpFromEdge (edgeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.traceUpFromEdge(this._SMFacilityAnalystId, edgeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的结点 ID 进行上游追踪,即查找给定结点的上游,返回上游包含的弧段、结点及总耗费 + * @param nodeID + * @param weightName + * @param isUncertainDirectionValid + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async traceUpFromNode (nodeID, weightName, isUncertainDirectionValid) { + try { + let { coast, edges, nodes } = await FA.traceUpFromNode(this._SMFacilityAnalystId, nodeID, weightName, isUncertainDirectionValid); + return { coast, edges, nodes } + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/FacilityAnalystSetting.js b/NativeModule/FacilityAnalystSetting.js new file mode 100755 index 00000000..eedec68d --- /dev/null +++ b/NativeModule/FacilityAnalystSetting.js @@ -0,0 +1,297 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let FAS = NativeModules.JSFacilityAnalystSetting; + +import DatasetVector from './DatasetVector' +import WeightFieldInfos from './WeightFieldInfos' +/** + * 设施网络分析环境设置类。 + * 该类用于提供设施网络分析时所需要的所有参数信息。 + * 设施网络分析环境设置类的各个参数的设置直接影响分析的结果。 + */ +export default class FacilityAnalystSetting { + async createObj() { + try { + let facilityAnalystSettingId = await FAS.createObj(); + let facilityAnalystSetting = new FacilityAnalystSetting(); + facilityAnalystSetting._SMFacilityAnalystSettingId = facilityAnalystSettingId; + return facilityAnalystSetting; + } catch (e) { + console.error(e); + } + } + + /** + * 返回障碍弧段的 ID 列表 + * @returns {Promise.>} + */ + async getBarrierEdges () { + try { + let wArr = await FAS.getBarrierEdges(this._SMFacilityAnalystSettingId); + return wArr; + } catch (e) { + console.error(e); + } + } + + /** + * 返回障碍结点的 ID 列表 + * @returns {Promise} + */ + async getBarrierNodes () { + try { + let wArr = await FAS.getBarrierNodes(this._SMFacilityAnalystSettingId); + return wArr; + } catch (e) { + console.error(e); + } + } + + /** + * 返回流向字段 + * @returns {Promise} + */ + async getDirectionField () { + try { + let directionField = await FAS.getDirectionField(this._SMFacilityAnalystSettingId); + return directionField; + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络数据集中标识弧段 ID 的字段 + * @returns {Promise} + */ + async getEdgeIDField () { + try { + let edgeIDField = await FAS.getEdgeIDField(this._SMFacilityAnalystSettingId); + return edgeIDField + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络数据集中标识弧段起始结点 ID 的字段 + * @returns {Promise} + */ + async getFNodeIDField () { + try { + let fNodeIDField = await FAS.getFNodeIDField(this._SMFacilityAnalystSettingId); + return fNodeIDField + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络数据集 + * @returns {Promise.} + */ + async getNetworkDataset () { + try { + let datasetVectorId = await FAS.getNetworkDataset(this._SMFacilityAnalystSettingId); + let datasetVector = new DatasetVector() + datasetVector._SMDatasetVectorId = datasetVectorId + + return datasetVector + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络数据集中标识网络结点 ID 的字段 + * @returns {Promise} + */ + async getNodeIDField () { + try { + let nodeIDField = await FAS.getNodeIDField(this._SMFacilityAnalystSettingId); + + return nodeIDField; + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络数据集中标识弧段终止结点 ID 的字段 + * @returns {Promise} + */ + async getTNodeIDField () { + try { + let tNodeIDField = await FAS.getTNodeIDField(this._SMFacilityAnalystSettingId); + + return tNodeIDField; + } catch (e) { + console.error(e); + } + } + + /** + * 返回点到弧段的距离容限 + * @returns {Promise.>} + */ + async getTolerance () { + try { + let tolerance = await FAS.getTolerance(this._SMFacilityAnalystSettingId); + + return tolerance; + } catch (e) { + console.error(e); + } + } + + /** + * 返回权值字段信息集合对象 + * @returns {Promise.} + */ + async getWeightFieldInfos () { + try { + let weightFieldInfosId = await FAS.getWeightFieldInfos(this._SMFacilityAnalystSettingId); + let weightFieldInfos = new WeightFieldInfos() + + weightFieldInfos._SMWeightFieldInfosId = weightFieldInfosId + + return weightFieldInfos; + } catch (e) { + console.error(e); + } + } + + /** + * 设置障碍弧段的 ID 列表 + * @param arr + * @returns {Promise.} + */ + async setBarrierEdges (arr) { + try { + await FAS.setBarrierEdges(this._SMFacilityAnalystSettingId, arr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置障碍结点的 ID 列表 + * @param arr + * @returns {Promise.} + */ + async setBarrierNodes (arr) { + try { + await FAS.setBarrierNodes(this._SMFacilityAnalystSettingId, arr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置流向字段 + * @param value + * @returns {Promise.} + */ + async setDirectionField (value) { + try { + await FAS.setDirectionField(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络数据集中标识弧段 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setEdgeIDField (value) { + try { + await FAS.setEdgeIDField(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络数据集中标识弧段起始结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setFNodeIDField (value) { + try { + await FAS.setFNodeIDField(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络数据集 + * @param datasetVector + * @returns {Promise.} + */ + async setNetworkDataset (datasetVector) { + try { + await FAS.setNetworkDataset(this._SMFacilityAnalystSettingId, datasetVector._SMDatasetVectorId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络数据集中标识网络结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setNodeIDField (value) { + try { + await FAS.setNodeIDField(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络数据集中标识弧段终止结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setTNodeIDField (value) { + try { + await FAS.setTNodeIDField(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置点到弧段的距离容限 + * @param value number + * @returns {Promise.} + */ + async setTolerance (value) { + try { + await FAS.setTolerance(this._SMFacilityAnalystSettingId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置权值字段信息集合对象。 + * @param value + * @returns {Promise.} + */ + async setWeightFieldInfos (weightInfos) { + try { + await FAS.setWeightFieldInfos(this._SMFacilityAnalystSettingId, weightInfos._SMWeightFieldInfosId); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/Feature.js b/NativeModule/Feature.js old mode 100644 new mode 100755 index e7b903d5..bbf73294 --- a/NativeModule/Feature.js +++ b/NativeModule/Feature.js @@ -1,13 +1,20 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let F = NativeModules.JSFeature; import Geometry from './Geometry.js'; /** * @class Feature + * @description 几何对象类,包含几何对象与属性信息。 */ export default class Feature { /** - * 根据指定的参数构造一个新的Feature对象。 + * Feature对象构造函数。 * @memberOf Feature * @param {array} fieldNames - 指定的属性名数组。 * @param {array} fieldValues - 指定的属性值数组。 @@ -15,25 +22,10 @@ export default class Feature { * @returns {Promise.} */ async createObj(fieldNames,fieldValues,geometry){ - if(typeof fieldNames !== 'array' || typeof fieldValues !== 'array'){ - console.error('Feature:Array type is required for fieldNames and fieldValues arguments.'); - } try{ - for(var fieldName in fieldNames){ - if(typeof fieldNames[fieldName] !== 'string'){ - console.error('Feature:fieldNames must be an Array of String type.'); - } - } - - for(var fieldValue in fieldValues){ - if(typeof fieldValues[fieldValue] !== 'string'){ - console.error('Feature:fieldValues must be an Array of String type.'); - } - } - - var {_featureId_} = await F.createObj(fieldNames,fieldValues,geometry.geometryId); + var {_featureId_} = await F.createObj(fieldNames,fieldValues,geometry._SMGeometryId); var feature = new Feature(); - feature._featureId_ = _featureId_; + feature._SMFeatureId = _featureId_; return feature; }catch (e){ console.error(e); @@ -43,11 +35,11 @@ export default class Feature { /** * 获取属性名数组。 * @memberOf Feature - * @returns {Promise} + * @returns {Promise.} */ async getFieldNames(){ try{ - var arr = F.getFieldNames(this._featureId_); + var arr = F.getFieldNames(this._SMFeatureId); return arr; }catch (e){ console.error(e); @@ -57,11 +49,11 @@ export default class Feature { /** * 获取属性值数组。 * @memberOf Feature - * @returns {Promise} + * @returns {Promise.} */ async getFieldValues(){ try{ - var arr = F.getFieldValues(this._featureId_); + var arr = F.getFieldValues(this._SMFeatureId); return arr; }catch (e){ console.error(e); @@ -75,9 +67,9 @@ export default class Feature { */ async getGeometry(){ try{ - var {geometryId} = await F.getGeometry(this._featureId_); + var {geometryId} = await F.getGeometry(this._SMFeatureId); var geometry = new Geometry(); - geometry.geometryId = geometryId; + geometry._SMGeometryId = geometryId; return geometry; }catch (e){ console.error(e); @@ -86,15 +78,16 @@ export default class Feature { /** * 将类对象转换成Json串。 + * @memberOf Feature * @returns {Promise.} */ async toJson(){ try{ - var jsonString = await F.toJson(this._featureId_); + var jsonString = await F.toJson(this._SMFeatureId); var jsonObj = JSON.parse(jsonString); return jsonObj; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/Feature3D.js b/NativeModule/Feature3D.js new file mode 100755 index 00000000..ee400de9 --- /dev/null +++ b/NativeModule/Feature3D.js @@ -0,0 +1,106 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: Feature3Ds-三维要素类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let F = NativeModules.JSFeature3D; +import Geometry3D from './Geometry3D'; +/** + * @class Feature3D + */ +export default class Feature3D { + + /** + * 获取/设置三维要素可见性。 + * @memberOf Feature3D + * @returns {Boolean} + */ + async visable(isVisable) { + try { + if (arguments.length >= 1) { + await F.setVisable(this._SMFeature3DId, isVisable); + var visable = isVisable; + } else { + var { visable } = await F.getVisable(this._SMFeature3DId); + } + return visable; + } catch (e) { + console.error(e); + } + } + + /** + * 获取三维要素对应三维几何对象。 + * @memberOf Feature3D + * @returns {Geometry3D} + */ + async getGeometry3D() { + try { + var {geometry3dId} = await F.getGeometry3D(this._SMFeature3DId); + var geometry3d = new Geometry3D(); + geometry3d._SMGeometry3DId = geometry3dId; + return geometry3d; + } catch (e) { + console.error(e); + } + } + + /** + * 返回三维要素对象的描述信息。 + * @memberOf Feature3D + * @returns {string} + */ + async getDescription() { + try { + var {description} = await F.getDescription(this._SMFeature3DId); + return description; + } catch (e) { + console.error(e); + } + } + + /** + * 返回三维要素对象指定字段索引对应的字段值。 + * @memberOf Feature3D + * @returns {string} + */ + async getFieldValueByIndex(index) { + try { + var {value} = await F.getFieldValueByIndex(this._SMFeature3DId,index); + return value; + } catch (e) { + console.error(e); + } + } + + /** + * 返回三维要素对象指定字段索引对应的字段值。 + * @memberOf Feature3D + * @returns {string} + */ + async getFieldValueByName(name) { + try { + var {value} = await F.getFieldValueByName(this._SMFeature3DId,name); + return value; + } catch (e) { + console.error(e); + } + } + + /** + * 返回三维要素对象指定字段索引对应的字段值。 + * @memberOf Feature3D + * @returns {number} + */ + async getID() { + try { + var {id} = await F.getID(this._SMFeature3DId); + return id; + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/Feature3Ds.js b/NativeModule/Feature3Ds.js new file mode 100755 index 00000000..70a5fcc0 --- /dev/null +++ b/NativeModule/Feature3Ds.js @@ -0,0 +1,66 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: Feature3Ds-三维要素集合类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let FS = NativeModules.JSFeature3Ds; +import Feature3D from './Feature3D'; +/** + * @class Feature3Ds + */ +export default class Feature3Ds { + /** + * 获取三维要素。 + * @memberOf Feature3Ds + * @returns {Object} + */ + async get(index) { + try { + var { objectId, type } = await FS.get(this._SMFeature3DsId, index); + var object = undefined; + if (type == 'feature3D') { + object = new Feature3D(); + object._SMFeature3DId = objectId; + } else if (type == 'feature3Ds') { + object = new Feature3Ds(); + object._SMFeature3DsId = objectId; + } + return object; + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的三维要素对象ID以及指定的查询选项,查找并返回三维要素对象。 + * @memberOf Feature3Ds + * @returns {Feature3D} + */ + async findFeature(index) { + try { + var {objectId} = await FS.findFeature(this._SMFeature3DsId, index); + var object = new Feature3D(); + object._SMFeature3DId = objectId; + return object; + } catch (e) { + console.error(e); + } + } + + /** + * 获取三维要素的个数。 + * @memberOf Feature3Ds + * @returns {Boolean} + */ + async getCount() { + try { + var { count } = await FS.getCount(this._SMFeature3DsId); + return count; + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/FeatureSet.js b/NativeModule/FeatureSet.js old mode 100644 new mode 100755 index 539cee0b..db772b21 --- a/NativeModule/FeatureSet.js +++ b/NativeModule/FeatureSet.js @@ -1,19 +1,27 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let FS = NativeModules.JSFeatureSet; import Geometry from './Geometry.js'; /** * @class FeatureSet + * @description 要素资源集合类。 */ export default class FeatureSet { /** - * 物理性删除指定要素集中的所有要素,即把要素从设备的物理存储介质上删除,无法恢复。 + * 删除要素 + * @description 物理性删除指定要素集中的所有要素,即把要素从设备的物理存储介质上删除,无法恢复。 * @memberOf FeatureSet * @returns {Promise.} */ async deleteAll(){ try{ - await FS.deleteAll(this._featureSetId_); + await FS.deleteAll(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -26,7 +34,7 @@ export default class FeatureSet { */ async delete(){ try{ - await FS.delete(this._featureSetId_); + await FS.delete(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -39,7 +47,7 @@ export default class FeatureSet { */ async getFeatureCount(){ try{ - var count = await FS.getFeatureCount(this._featureSetId_); + var count = await FS.getFeatureCount(this._SMFeatureSetId); return count; }catch (e){ console.error(e); @@ -54,7 +62,7 @@ export default class FeatureSet { */ async getFieldValue(fieldName){ try{ - var value = await FS.getFieldValue(this._featureSetId_,fieldName); + var value = await FS.getFieldValue(this._SMFeatureSetId,fieldName); return value; }catch (e){ console.error(e); @@ -68,9 +76,9 @@ export default class FeatureSet { */ async getGeometry(){ try{ - var {geometryId} = await FS.getGeometry(this._featureSetId_); + var {geometryId} = await FS.getGeometry(this._SMFeatureSetId); var geometry = new Geometry(); - geometry.geometryId = geometryId; + geometry._SMGeometryId = geometryId; return geometry; }catch (e){ console.error(e); @@ -84,7 +92,7 @@ export default class FeatureSet { */ async isReadOnly(){ try{ - await FS.isReadOnly(this._featureSetId_); + await FS.isReadOnly(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -97,7 +105,7 @@ export default class FeatureSet { */ async moveFirst(){ try{ - await FS.moveFirst(this._featureSetId_); + await FS.moveFirst(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -110,7 +118,7 @@ export default class FeatureSet { */ async moveLast(){ try{ - await FS.moveLast(this._featureSetId_); + await FS.moveLast(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -123,7 +131,7 @@ export default class FeatureSet { */ async moveNext(){ try{ - await FS.moveNext(this._featureSetId_); + await FS.moveNext(this._SMFeatureSetId); }catch (e){ console.error(e); } @@ -136,9 +144,9 @@ export default class FeatureSet { */ async movePrev(){ try{ - await FS.movePrev(this._featureSetId_); + await FS.movePrev(this._SMFeatureSetId); }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/GeoLine.js b/NativeModule/GeoLine.js old mode 100644 new mode 100755 index f374c172..4d98b7e7 --- a/NativeModule/GeoLine.js +++ b/NativeModule/GeoLine.js @@ -1,28 +1,34 @@ +/********************************************************************************* + 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(); - //同步子类Id和父类Id - Object.defineProperty(this,"geoLineId",{ + Object.defineProperty(this,"_SMGeoLineId",{ get:function () { - return this.geometryId + return this._SMGeometryId }, - set:function (geoLineId) { - this.geometryId = geoLineId; + set:function (_SMGeoLineId) { + this._SMGeometryId = _SMGeoLineId; } }) } /** - * create a GeoLine instance + * GeoLine 对象构造方法 * @memberOf GeoLine - * @param points an Array laden with point objects. For example: [ {x:1.1,y:1.2} , {x:2.3,y:3.4} ] + * @param {Array} points -点信息数组,eg: [ {x:1.1,y:1.2} , {x:2.3,y:3.4} ] * @returns {Promise.} */ async createObj(points){ @@ -32,12 +38,12 @@ export default class GeoLine extends Geometry{ }else{ var {geoLineId} = await GL.createObj(); } - geoLine = new GeoLine(); - geoLine.geoLineId = geoLineId; + let geoLine = new GeoLine(); + geoLine._SMGeoLineId = geoLineId; return geoLine; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/GeoLineM.js b/NativeModule/GeoLineM.js new file mode 100755 index 00000000..69bc75df --- /dev/null +++ b/NativeModule/GeoLineM.js @@ -0,0 +1,49 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let GLM = NativeModules.JSGeoLineM; +import Geometry from './Geometry.js'; + +/** + * @class GeoLine + * @description 线几何对象类。 + */ +export default class GeoLineM 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.} + */ + async createObj(points) { + try { + let geoLineMId + if (!!points && typeof points === "array") { + geoLineMId = await GLM.createObjByPts(); + } else { + geoLineMId = await GLM.createObj(); + } + let geoLine = new GeoLineM(); + geoLine._SMGeoLineId = geoLineMId; + return geoLine; + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/GeoPoint.js b/NativeModule/GeoPoint.js old mode 100644 new mode 100755 index 4b2bbba6..c3cba585 --- a/NativeModule/GeoPoint.js +++ b/NativeModule/GeoPoint.js @@ -1,20 +1,26 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let P = NativeModules.JSGeoPoint; import Geometry from './Geometry.js'; /** * @class GeoPoint + * @description 点几何对象类。 */ export default class GeoPoint extends Geometry{ constructor(){ super(); - //同步子类Id和父类Id - Object.defineProperty(this,"geoPointId",{ + Object.defineProperty(this,"_SMGeoPointId",{ get:function () { - return this.geometryId + return this._SMGeometryId }, - set:function (geoPointId) { - this.geometryId = geoPointId; + set:function (_SMGeoPointId) { + this._SMGeometryId = _SMGeoPointId; } }) } @@ -31,12 +37,12 @@ export default class GeoPoint extends Geometry{ if(typeof arguments[0] == 'number' && typeof arguments[1] == 'number'){ var {geoPointId} = await P.createObjByXY(arguments[0],arguments[1]); var geoPoint = new GeoPoint(); - geoPoint.geoPointId = geoPointId; + geoPoint._SMGeoPointId = geoPointId; return geoPoint; }else{ var {geoPointId} = await P.createObj(); var geoPoint = new GeoPoint(geoPointId); - geoPoint.geoPointId = geoPointId; + geoPoint._SMGeoPointId = geoPointId; return geoPoint; } }catch (e){ @@ -51,9 +57,8 @@ export default class GeoPoint extends Geometry{ */ async getX(){ try { - var {coordsX} = await P.getX(this.geoPointId); + var {coordsX} = await P.getX(this._SMGeoPointId); return coordsX; - console.log("coordsX"+coordsX); }catch (e){ console.error(e); } @@ -66,10 +71,10 @@ export default class GeoPoint extends Geometry{ */ async getY(){ try { - var {coordsY} = await P.getY(this.geoPointId); + var {coordsY} = await P.getY(this._SMGeoPointId); return coordsY; }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/GeoRegion.js b/NativeModule/GeoRegion.js old mode 100644 new mode 100755 index 9211139a..9d232efb --- a/NativeModule/GeoRegion.js +++ b/NativeModule/GeoRegion.js @@ -4,18 +4,18 @@ import Geometry from './Geometry.js'; /** * @class GeoRegion + * @description 面几何对象类。 */ export default class GeoRegion extends Geometry{ constructor(){ super(); - //同步子类Id和父类Id - Object.defineProperty(this,"geoRegionId",{ + Object.defineProperty(this,"_SMGeoRegionId",{ get:function () { - return this.geometryId + return this._SMGeometryId }, - set:function (geoRegionId) { - this.geometryId = geoRegionId; + set:function (_SMGeoRegionId) { + this._SMGeometryId = _SMGeoRegionId; } }); } -} \ No newline at end of file +} diff --git a/NativeModule/GeoStyle.js b/NativeModule/GeoStyle.js old mode 100644 new mode 100755 index ae3a6e59..2a1c60c7 --- a/NativeModule/GeoStyle.js +++ b/NativeModule/GeoStyle.js @@ -1,125 +1,250 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + ref:Size2d + **********************************************************************************/ +import { NativeModules } from 'react-native'; let G = NativeModules.JSGeoStyle; +import Size2D from './Size2D' + /** * @class GeoStyle + * @description 几何风格类。用于定义点状符号、线状符号、填充符号及其相关设置。对于文本对象只能设置文本风格,不能设置几何风格。 */ export default class GeoStyle { - /** - * 构造一个新的 GeoStyle 对象。 - * @memberOf GeoStyle - * @returns {Promise.} - */ - async createObj(){ - var {geoStyleId} =await G.createObj(); - var geoStyle = new GeoStyle(); - geoStyle.geoStyleId = geoStyleId; - return geoStyle; - }catch(e){ - console.log(e); + /** + * 构造一个新的 GeoStyle 对象。 + * @memberOf GeoStyle + * @returns {Promise.} + */ + async createObj() { + var { geoStyleId } = await G.createObj(); + var geoStyle = new GeoStyle(); + geoStyle._SMGeoStyleId = geoStyleId; + return geoStyle; + } + + catch(e) { + console.log(e); + } + + /** + * 设置线状符号型风格或点状符号的颜色。 + * @memberOf GeoStyle + * @param {number} r - rgb颜色的red值 + * @param {number} g - rgb颜色的green值 + * @param {number} b - rgb颜色的blue值 + * @returns {Promise.} + */ + async setLineColor(r, g, b) { + try { + await G.setLineColor(this._SMGeoStyleId, r, g, b); + } catch (e) { + console.error(e); } - - /** - * 设置线状符号型风格或点状符号的颜色。 - * @memberOf GeoStyle - * @param {number} r - rgb颜色的red值 - * @param {number} g - rgb颜色的green值 - * @param {number} b - rgb颜色的blue值 - * @returns {Promise.} - */ - async setLineColor(r,g,b){ - try{ - await G.setLineColor(this.geoStyleId,r,g,b); - }catch (e){ - console.error(e); - } + } + + /** + * 返回线状符号的编码。此编码用于唯一标识各线状符号。 + 线状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 + * @memberOf GeoStyle + * @param {number} symbolId - 一个用来设置线型符号的编码的整数值。 + * @returns {Promise.} + */ + async setLineSymbolID(symbolId) { + try { + await G.setLineSymbolID(this._SMGeoStyleId, symbolId); + } catch (e) { + console.error(e); } - - /** - * 返回线状符号的编码。此编码用于唯一标识各线状符号。 - 线状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 - * @memberOf GeoStyle - * @param {number} symbolId - 一个用来设置线型符号的编码的整数值。 - * @returns {Promise.} - */ - async setLineSymbolID(symbolId){ - try{ - await G.setLineSymbolID(this.geoStyleId,symbolId); - }catch (e){ - console.error(e); - } + } + + /** + * 设置线状符号的宽度。单位为毫米,精度到0.1。 + * @memberOf GeoStyle + * @param {number} lineWidth - 用来设置线状符号的宽度。 + * @returns {Promise.} + */ + async setLineWidth(lineWidth) { + try { + await G.setLineWidth(this._SMGeoStyleId, lineWidth); + } catch (e) { + console.error(e); } - - /** - * 设置线状符号的宽度。单位为毫米,精度到0.1。 - * @memberOf GeoStyle - * @param {number} lineWidth - 用来设置线状符号的宽度。 - * @returns {Promise.} - */ - async setLineWidth(lineWidth){ - try{ - await G.setLineWidth(this.geoStyleId,lineWidth); - }catch (e){ - console.error(e); - } + } + + /** + * 返回点状符号的编码。此编码用于唯一标识各点状符号。 + 点状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 + * @memberOf GeoStyle + * @param {number} markerSymbolId - 点状符号的编码。 + * @returns {Promise.} + */ + async setMarkerSymbolID(markerSymbolId) { + try { + await G.setMarkerSymbolID(this._SMGeoStyleId, markerSymbolId); + } catch (e) { + console.error(e); } - - /** - * 返回点状符号的编码。此编码用于唯一标识各点状符号。 - 点状符号可以用户自定义,也可以使用系统自带的符号库。使用系统自带符号库时,其相应的的编码参见开发指南 SuperMap Objects 资源库一览。 - * @memberOf GeoStyle - * @param {number} markerSymbolId - 点状符号的编码。 - * @returns {Promise.} - */ - async setMarkerSymbolID(markerSymbolId){ - try{ - await G.setMarkerSymbolID(this.geoStyleId,markerSymbolId); - }catch (e){ - console.error(e); - } + } + + /** + * 设置点状符号的大小,单位为毫米,精确到0.1毫米。其值必须大于等于0。如果为0,则表示不显示,如果是小于0,会抛出异常。 + * @memberOf GeoStyle + * @param {number} size2D - 用来设置点状符号的大小的值。 + * @returns {Promise.} + */ + async setMarkerSize(size2D) { + try { + await G.setMarkerSize(this._SMGeoStyleId, size2D._SMSize2DId); + } catch (e) { + console.error(e); } - - /** - * 设置点状符号的大小,单位为毫米,精确到0.1毫米。其值必须大于等于0。如果为0,则表示不显示,如果是小于0,会抛出异常。 - * @memberOf GeoStyle - * @param {number} size2D - 用来设置点状符号的大小的值。 - * @returns {Promise.} - */ - async setMarkerSize(size2D){ - try{ - await G.setMarkerSize(this.geoStyleId,size2D.size2DId); - }catch (e){ - console.error(e); - } + } + + /** + * 设置填充符号的前景色。 + * @memberOf GeoStyle + * @param {number} r - rgb颜色的red值 + * @param {number} g - rgb颜色的green值 + * @param {number} b - rgb颜色的blue值 + * @returns {Promise.} + */ + async setFillForeColor(r, g, b) { + try { + await G.setFillForeColor(this._SMGeoStyleId, r, g, b); + } catch (e) { + console.error(e); } - - /** - *设置填充符号的前景色。 - * @memberOf GeoStyle - * @param {number} r - rgb颜色的red值 - * @param {number} g - rgb颜色的green值 - * @param {number} b - rgb颜色的blue值 - * @returns {Promise.} - */ - async setFillForeColor(r,g,b){ - try{ - await G.setFillForeColor(this.geoStyleId,r,g,b); - }catch (e){ - console.error(e); - } + } + + /** + * 设置填充不透明度,合法值0-100的数值。 + * @memberOf GeoStyle + * @param {number} rate - 透明度比例 + * @returns {Promise.} + */ + async setFillOpaqueRate(rate) { + try { + await G.setFillOpaqueRate(this._SMGeoStyleId, rate) + } catch (e) { + console.error(e); } - - /** - * 设置填充不透明度,合法值0-100的数值。 - * @memberOf GeoStyle - * @param {number} rate - 透明度比例 - * @returns {Promise.} - */ - async setFillOpaqueRate(rate){ - try{ - await G.setFillOpaqueRate(this.geoStyleId,rate) - }catch (e){ - console.error(e); - } - } -} \ No newline at end of file + } + + /** + * 获取线状符号型风格或点状符号的颜色 + * @returns {Promise} + */ + async getLineColor() { + try { + return await G.getLineColor(this._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回线状符号的编码。此编码用于唯一标识各线状符号 + * @returns {Promise.} + */ + async getLineSymbolID() { + try { + return await G.setLineSymbolID(this._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 获取线状符号的宽度。单位为毫米,精度到0.1 + * @returns {Promise.} + */ + async getLineWidth() { + try { + return await G.getLineWidth(this._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回点状符号的编码。此编码用于唯一标识各点状符号 + * @returns {Promise} + */ + async getMarkerSymbolID() { + try { + return await G.getMarkerSymbolID(this._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回点状符号的大小,单位为毫米,精确到0.1毫米 + * @returns {Promise.} + */ + async getMarkerSize() { + try { + let id = await G.getMarkerSize(this._SMGeoStyleId); + let size2D = await new Size2D() + size2D._SMSize2DId = id + return size2D + } catch (e) { + console.error(e); + } + } + + /** + * 返回填充符号的前景色 + * @returns {Promise} + */ + async getFillForeColor() { + try { + return await G.getFillForeColor(this._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回填充不透明度,合法值0-100的数值 + * @returns {Promise.} + */ + async getFillOpaqueRate() { + try { + return await G.getFillOpaqueRate(this._SMGeoStyleId) + } catch (e) { + console.error(e); + } + } + + /** + * 返回点的颜色 + * @returns {Promise} + */ + async getPointColor() { + try { + return await G.getPointColor(this._SMGeoStyleId) + } catch (e) { + console.error(e); + } + } + + /** + * 设置点的颜色 + * @param r + * @param g + * @param b + * @returns {Promise.} + */ + async setPointColor(r, g, b) { + try { + await G.setPointColor(this._SMGeoStyleId, r, g, b); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/GeoText.js b/NativeModule/GeoText.js new file mode 100755 index 00000000..6efd9937 --- /dev/null +++ b/NativeModule/GeoText.js @@ -0,0 +1,183 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let GT = NativeModules.JSGeoText; + +import TextPart from './TextPart' +import TextStyle from './TextStyle' +/** + * 文本类,派生于 Geometry 类。 + * 该类主要用于对地物要素进行标识和必要的注记说明。 + * 文本对象由一个或多个部分组成,每个部分称为文本对象的一个子对象,每个子对象都是一个 TextPart 的实例。 + * 同一个文本对象的所有子对象都使用相同的文本风格,即使用该文本对象的文本风格进行显示。 + */ +export default class GeoText { + async createObj() { + try { + let geoTextId = await GT.createObj(); + let geoText = new GeoText(); + geoText._SMGeoTextId = geoTextId; + return geoText; + } catch (e) { + console.error(e); + } + } + + async createObjWithTextPart(textPart) { + try { + let geoTextId = await GT.createObjWithTextPart(textPart._SMTextPartId); + let geoText = new GeoText(); + geoText._SMGeoTextId = geoTextId; + return geoText; + } catch (e) { + console.error(e); + } + } + + async dispose () { + try { + await GT.dispose(this._SMGeoTextId); + } catch (e) { + console.error(e); + } + } + + /** + * 在文本对象中添加文本子对象 + * @param textPartId + * @returns {Promise.} + */ + async addPart(textPartId) { + try { + await GT.addPart(this._SMGeoTextId, textPartId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回此文本对象的指定序号的子对象 + * @returns {Promise} + */ + async getPart(index) { + try { + let textPartId = await GT.getRotation(this._SMGeoTextId, index); + let textPart = new TextPart(); + textPart._SMTextPartId = textPartId + return textPart; + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本对象的子对象个数 + * @returns {Promise.} + */ + async getPartCount() { + try { + let count = await GT.getPartCount(this._SMGeoTextId); + return count + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本对象的内容 + * @returns {Promise.|string>} + */ + async getText() { + try { + let text = await GT.getText(this._SMGeoTextId); + return text; + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本对象的文本风格 + * @returns {Promise.} + */ + async getTextStyle() { + try { + let textStyleId = await GT.getTextStyle(this._SMGeoTextId); + let textStyle = new TextStyle(); + textStyle._SMTextStyleId = textStyleId; + return textStyle; + } catch (e) { + console.error(e); + } + } + + /** + * 在此文本对象的指定位置插入一个文本子对象 + * @param index + * @param textPartId + * @returns {Promise.} + */ + async insertPart(index, textPart) { + try { + await GT.insertPart(this._SMGeoTextId, index, textPart._SMPoint2DId); + } catch (e) { + console.error(e); + } + } + + /** + * 判定该文本对象是否为空,即其子对象的个数是否为0 + * @returns {Promise.} + */ + async isEmpty() { + try { + let isEmpty = await GT.isEmpty(this._SMGeoTextId); + return isEmpty; + } catch (e) { + console.error(e); + } + } + + /** + * 删除此文本对象的指定序号的文本子对象 + * @param index + * @returns {Promise.} + */ + async removePart(index) { + try { + await GT.removePart(this._SMGeoTextId, index); + } catch (e) { + console.error(e); + } + } + + /** + * 修改此文本对象的指定序号的子对象,即用新的文本子对象来替换原来的文本子对象 + * @param index + * @param textPart + * @returns {Promise.} + */ + async setPart(index, textPart) { + try { + await GT.setPart(this._SMGeoTextId, index, textPart._SMPoint2DId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本对象的文本风格 + * @param textStyle + * @returns {Promise.} + */ + async setTextStyle(textStyle) { + try { + await GT.setTextStyle(this._SMGeoTextId, textStyle._SMPoint2DId); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/Geometry.js b/NativeModule/Geometry.js old mode 100644 new mode 100755 index 87153f72..e0d6f146 --- a/NativeModule/Geometry.js +++ b/NativeModule/Geometry.js @@ -1,44 +1,60 @@ -import {NativeModules} from 'react-native'; +import { NativeModules } from 'react-native'; let G = NativeModules.JSGeometry; import Point2D from './Point2D.js'; /** * @class Geometry - * 所有具体几何类型(GeoPoint, GeoLine, GeoRegion 等)的基类,提供了基本的几何类型的方法。 - + * @description 所有具体几何类型(GeoPoint, GeoLine, GeoRegion 等)的基类,提供了基本的几何类型的方法。 该类用于表示地理实体的空间特征,并提供相关的处理方法。根据地理实体的空间特征不同,分别用点(GeoPoint),线(GeoLine),面(GeoRegion)等加以描述。当该类的子类的对象实例被 dispose 后,再调用该类的方法会抛出 ObjectDisposedException。 - 用户自己创建的 Geometry 对象,例如 GeoPoint、GeoLine、GeoRegion 等对象,在执行完系列操作后,需要对其进行释放。 */ export default class Geometry { - /** - * 返回几何对象的内点。 - * @memberOf Geometry - * @returns {Promise.} - */ - async getInnerPoint(){ - try{ - var {point2DId} = await G.getInnerPoint(this.geometryId); - var point2D = new Point2D(); - point2D.point2DId = point2DId; - return point2D; - }catch (e){ - console.error(e); - } + /** + * 返回几何对象的内点。 + * @memberOf Geometry + * @returns {Promise.} + */ + async getInnerPoint() { + try { + let { point2DId } = await G.getInnerPoint(this._SMGeometryId); + let point2D = new Point2D(); + point2D._SMPoint2DId = point2DId; + return point2D; + } catch (e) { + console.error(e); } - - /** - * 设置几何对象的风格。几何风格是用于定义几何对象在显示时的符号、线型、填充模式等信息。 - * @memberOf Geometry - * @param {object} geoStyle - 用来设置几何对象风格的 GeoStyle 对象。 - * @returns {Promise.} - */ - async setStyle(geoStyle){ - try{ - var id = this.geometryId || this.geoPointId; - await G.setStyle(id,geoStyle.geoStyleId); - }catch (e){ - console.error(e); - } + } + + /** + * 设置几何对象的风格。几何风格是用于定义几何对象在显示时的符号、线型、填充模式等信息。 + * @memberOf Geometry + * @param {object} geoStyle - 用来设置几何对象风格的 GeoStyle 对象。 + * @returns {Promise.} + */ + async setStyle(geoStyle) { + try { + let id = this._SMGeometryId || this._SMGeoPointId; + await G.setStyle(id, geoStyle._SMGeoStyleId); + } catch (e) { + console.error(e); + } + } + + async getID() { + try { + let id = this._SMGeometryId || this._SMGeoPointId; + return await G.getID(id); + } catch (e) { + console.error(e); + } + } + + async getType() { + try { + let id = this._SMGeometryId || this._SMGeoPointId; + await G.getType(id); + } catch (e) { + console.error(e); } -} \ No newline at end of file + } +} diff --git a/NativeModule/Geometry3D.js b/NativeModule/Geometry3D.js new file mode 100755 index 00000000..7d61aacc --- /dev/null +++ b/NativeModule/Geometry3D.js @@ -0,0 +1,25 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: Feature3Ds-三维要素集合类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let G = NativeModules.JSGeometry3D; +/** + * @class Geometry3D + */ +export default class Geometry3D { + /** + * 获取三维要素。 + * @memberOf Geometry3D + * @returns {void} + */ + async setColor(r, g, b, a) { + try { + await G.setColor(this._SMFeature3DsId, r, g, b, a); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/GridHotChart.js b/NativeModule/GridHotChart.js new file mode 100755 index 00000000..10bc22ae --- /dev/null +++ b/NativeModule/GridHotChart.js @@ -0,0 +1,51 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let GHC = NativeModules.JSGridHotChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class GridHotChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"gridHotChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(gridHotChartId){ + this.chartviewId = gridHotChartId; + } + }); + } + /** + * 构造方法 + * @memberOf GridHotChart + * @param {MapControl} mapControl + * @returns {Promise.} + */ + async createObj(mapControl){ + try{ + var {gridHotChartId} = await GHC.createObj(mapControl._SMMapControlId); + var gridHotchart = new GridHotChart(); + gridHotchart.gridHotChartId = gridHotChartId; + return gridHotchart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置色带 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setColorScheme(colorScheme){ + try{ + await GHC.setColorScheme(this.gridHotChartId,colorScheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/HotChart.js b/NativeModule/HotChart.js new file mode 100755 index 00000000..e271269a --- /dev/null +++ b/NativeModule/HotChart.js @@ -0,0 +1,51 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let HC = NativeModules.JSHotChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class HotChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"hotChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(hotChartId){ + this.chartviewId = hotChartId; + } + }) + } + /** + * 构造方法 + * @memberOf HotChart + * @param {MapControl} mapControl + * @returns {Promise.} + */ + async createObj(mapControl){ + try{ + var {hotChartId} = await HC.createObj(mapControl.mapControlId); + var hotchart = new HotChart(); + hotchart.hotChartId = hotChartId; + return hotchart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置色带 + * @memberOf ChartView + * @returns {Promise.} + */ + async setColorScheme(colorScheme){ + try{ + await HC.setColorScheme(this.hotChartId,colorScheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/IndustryNavi.js b/NativeModule/IndustryNavi.js old mode 100644 new mode 100755 index 5fbdb69a..0e5549da --- a/NativeModule/IndustryNavi.js +++ b/NativeModule/IndustryNavi.js @@ -1,13 +1,17 @@ -/** - * Created by will on 2016/7/12. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules,DeviceEventEmitter} from 'react-native'; let N = NativeModules.JSNavigation2; import Dataset from './Dataset.js'; import GeoLine from './GeoLine'; /** - * @class Navigation2 - 行业导航类,提供基于拓扑路网的路径分析与导引。 + * @class Navigation2 + * @description 行业导航类,提供基于拓扑路网的路径分析与导引。 */ export default class Navigation2{ /** @@ -18,7 +22,7 @@ export default class Navigation2{ */ async setPathVisible(visible){ try{ - await N.setPathVisible(this.navigation2Id,visible); + await N.setPathVisible(this._SMNavigation2Id,visible); }catch (e){ console.error(e); } @@ -32,7 +36,7 @@ export default class Navigation2{ */ async setNetworkDataset(datasetVector){ try{ - await N.setNetworkDataset(this.navigation2Id,datasetVector.datasetVectorId); + await N.setNetworkDataset(this._SMNavigation2Id,datasetVector._SMDatasetVectorId); }catch (e){ console.error(e); } @@ -46,7 +50,7 @@ export default class Navigation2{ */ async loadModel(path){ try{ - await N.loadModel(this.navigation2Id,path); + await N.loadModel(this._SMNavigation2Id,path); }catch(e){ console.error(e); } @@ -62,7 +66,7 @@ export default class Navigation2{ */ async setStartPoint(x,y,map){ try{ - await N.setStartPoint(this.navigation2Id,x,y,map.mapId); + await N.setStartPoint(this._SMNavigation2Id,x,y,map._SMMapId); }catch(e){ console.error(e); } @@ -78,7 +82,7 @@ export default class Navigation2{ */ async setDestinationPoint(x,y,map){ try{ - await N.setDestinationPoint(this.navigation2Id,x,y,map.mapId); + await N.setDestinationPoint(this._SMNavigation2Id,x,y,map._SMMapId); }catch(e){ console.error(e); } @@ -91,7 +95,7 @@ export default class Navigation2{ */ async routeAnalyst(){ try{ - var {finished} = await N.routeAnalyst(this.navigation2Id); + var {finished} = await N.routeAnalyst(this._SMNavigation2Id); return finished; }catch(e){ console.error(e); @@ -106,7 +110,7 @@ export default class Navigation2{ */ async startGuide(guideMode){ try{ - var {isGuiding} = await N.startGuide(this.navigation2Id,guideMode); + var {isGuiding} = await N.startGuide(this._SMNavigation2Id,guideMode); return isGuiding; }catch(e){ console.error(e); @@ -122,7 +126,7 @@ export default class Navigation2{ */ async setTurnDataset(value){ try{ - await N.setTurnDataset(this.navigation2Id,value.datasetVectorId); + await N.setTurnDataset(this._SMNavigation2Id,value._SMDatasetVectorId); }catch(e){ console.error(e); } @@ -136,7 +140,7 @@ export default class Navigation2{ */ async setAltimetricPointDataset(value){ try{ - await N.setAltimetricPointDataset(this.navigation2Id,value.datasetVectorId); + await N.setAltimetricPointDataset(this._SMNavigation2Id,value._SMDatasetVectorId); }catch(e){ console.error(e); } @@ -149,9 +153,9 @@ export default class Navigation2{ */ async getRoute(){ try{ - var {geoLineId} = await N.getRoute(this.navigation2Id); + var {geoLineId} = await N.getRoute(this._SMNavigation2Id); var geoLine = new GeoLine(); - geoLine.geoLineId = geoLineId; + geoLine._SMGeoLineId = geoLineId; return geoLine; }catch(e){ console.error(e); @@ -165,7 +169,7 @@ export default class Navigation2{ */ async cleanPath(){ try{ - await N.cleanPath(this.navigation2Id); + await N.cleanPath(this._SMNavigation2Id); }catch(e){ console.error(e); } @@ -178,7 +182,7 @@ export default class Navigation2{ */ async pauseGuide(){ try{ - await N.pauseGuide(this.navigation2Id); + await N.pauseGuide(this._SMNavigation2Id); }catch(e){ console.error(e); } @@ -191,7 +195,7 @@ export default class Navigation2{ */ async resumeGuide(){ try{ - await N.resumeGuide(this.navigation2Id); + await N.resumeGuide(this._SMNavigation2Id); }catch(e){ console.error(e); } @@ -204,7 +208,7 @@ export default class Navigation2{ */ async stopGuide(){ try{ - var {stoped} = await N.stopGuide(this.navigation2Id); + var {stoped} = await N.stopGuide(this._SMNavigation2Id); return stoped }catch(e){ console.error(e); @@ -218,7 +222,7 @@ export default class Navigation2{ */ async isGuiding(){ try{ - var {yes} = await N.isGuiding(this.navigation2Id); + var {yes} = await N.isGuiding(this._SMNavigation2Id); return yes }catch(e){ console.error(e); @@ -233,7 +237,7 @@ export default class Navigation2{ */ async enablePanOnGuide(pan){ try{ - await N.enablePanOnGuide(this.navigation2Id,pan); + await N.enablePanOnGuide(this._SMNavigation2Id,pan); }catch(e){ console.error(e); } @@ -246,7 +250,7 @@ export default class Navigation2{ */ async locateMap(){ try{ - await N.locateMap(this.navigation2Id); + await N.locateMap(this._SMNavigation2Id); }catch(e){ console.error(e); } @@ -260,7 +264,7 @@ export default class Navigation2{ */ async setIsAutoNavi(isAutoNavi){ try{ - await N.setIsAutoNavi(this.navigation2Id,isAutoNavi); + await N.setIsAutoNavi(this._SMNavigation2Id,isAutoNavi); }catch(e){ console.error(e); } @@ -274,7 +278,7 @@ export default class Navigation2{ */ async setGPSData(newGps){ try{ - await N.setGPSData(this.navigation2Id,newGps); + await N.setGPSData(this._SMNavigation2Id,newGps); }catch(e){ console.error(e); } @@ -288,7 +292,7 @@ export default class Navigation2{ */ async setSpeedField(value){ try{ - await N.setSpeedField(this.navigation2Id,value); + await N.setSpeedField(this._SMNavigation2Id,value); }catch(e){ console.error(e); } @@ -301,7 +305,7 @@ export default class Navigation2{ */ async getBarrierPoints(){ try{ - var {barrierPoints} = await N.getBarrierPoints(this.navigation2Id); + var {barrierPoints} = await N.getBarrierPoints(this._SMNavigation2Id); return barrierPoints; }catch(e){ console.error(e); @@ -316,7 +320,7 @@ export default class Navigation2{ */ async setBarrierPoints(barrierPoints){ try{ - await N.setBarrierPoints(this.navigation2Id,barrierPoints); + await N.setBarrierPoints(this._SMNavigation2Id,barrierPoints); }catch(e){ console.error(e); } @@ -330,7 +334,7 @@ export default class Navigation2{ */ async setBarrierNodes(value){ try{ - await N.setBarrierNodes(this.navigation2Id,value); + await N.setBarrierNodes(this._SMNavigation2Id,value); }catch(e){ console.error(e); } @@ -344,7 +348,7 @@ export default class Navigation2{ */ async setBarrierEdges(value){ try{ - await N.setBarrierEdges(this.navigation2Id,value); + await N.setBarrierEdges(this._SMNavigation2Id,value); }catch(e){ console.error(e); } @@ -357,7 +361,7 @@ export default class Navigation2{ */ async getBarrierEdges(){ try{ - var {barrierEdges} = await N.getBarrierEdges(this.navigation2Id); + var {barrierEdges} = await N.getBarrierEdges(this._SMNavigation2Id); return barrierEdges; }catch(e){ console.error(e); @@ -367,12 +371,12 @@ export default class Navigation2{ /** * 设置离终点的距离变化监听器。 * @param events - 离终点的距离变化监听器回调函数对象。 - * 用法:await industryNavi.setDistanceChangeListener({distanceChange:(e) => {console.log(e.distance}}) + * @description 用法:await industryNavi.setDistanceChangeListener({distanceChange:(e) => {console.log(e.distance}}) * @returns {Promise} */ async setDistanceChangeListener(events){ try{ - var success = await N.setDistanceChangeListener(this.navigation2Id); + var success = await N.setDistanceChangeListener(this._SMNavigation2Id); if(success){ typeof events.distanceChange !== 'function' || DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.distance_change",function (e) { @@ -388,7 +392,7 @@ export default class Navigation2{ /** * 设置导航信息变化监听器 * @param callback - 导航信息变化监听器回调函数。 - * 用法:await industryNavi.setDistanceChangeListener( + * @description 用法:await industryNavi.setDistanceChangeListener( * { * startNavi:(e) => {console.log("start")}, * naviInfoUpdate:(e) => {console.log(e.curRoadName + e.direction ....)}, @@ -413,7 +417,7 @@ export default class Navigation2{ */ async addNaviInfoListener(events){ try{ - var success = await N.addNaviInfoListener(this.navigation2Id); + var success = await N.addNaviInfoListener(this._SMNavigation2Id); if(success){ typeof events.startNavi !== 'function' || DeviceEventEmitter.addListener("com.supermap.RN.JSNavigation2.start_navi",function (e) { @@ -450,4 +454,4 @@ export default class Navigation2{ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/InstrumentChart.js b/NativeModule/InstrumentChart.js new file mode 100755 index 00000000..5774bdb3 --- /dev/null +++ b/NativeModule/InstrumentChart.js @@ -0,0 +1,132 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let IC = NativeModules.JSInstrumentChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class InstrumentChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"instrumentChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(instrumentChartId){ + this.chartviewId = instrumentChartId; + } + }) + } + /** + * 构造方法 + * @memberOf GridHotChart + * @param {MapControl} mapControl + * @returns {Promise.} + */ + async createObj(){ + try{ + var {instrumentChartId} = await IC.createObj(); + var instrumentChart = new InstrumentChart(); + instrumentChart.instrumentChartId = instrumentChartId; + return instrumentChart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置仪表最小值 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setMinValue(minValue){ + try{ + await IC.setMinValue(this.instrumentChartId,minValue); + }catch(e){ + console.error(e); + } + } + + /** + * 获取仪表最小值 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async getMinValue(){ + try{ + var {minValue} = await IC.getMinValue(this.instrumentChartId); + return minValue; + }catch(e){ + console.error(e); + } + } + + /** + * 设置仪表最大值 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setMaxValue(maxValue){ + try{ + await IC.setMaxValue(this.instrumentChartId,maxValue); + }catch(e){ + console.error(e); + } + } + + /** + * 获取仪表最大值 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async getMaxValue(){ + try{ + var {maxValue} = await IC.getMaxValue(this.instrumentChartId); + return maxValue; + }catch(e){ + console.error(e); + } + } + + /** + * 设置仪表分段数 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setSegmentCount(count){ + try{ + await IC.setSegmentCount(this.instrumentChartId,count); + }catch(e){ + console.error(e); + } + } + + /** + * 获取仪表分段数 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async getSegmentCount(){ + try{ + var {count} = await IC.getSegmentCount(this.instrumentChartId); + return count; + }catch(e){ + console.error(e); + } + } + + /** + * 设置刻度调色板 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setColorScheme(scheme){ + try{ + await IC.setColorScheme(this.instrumentChartId,scheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/Layer.js b/NativeModule/Layer.js old mode 100644 new mode 100755 index 8cd7d6c1..a2f445c1 --- a/NativeModule/Layer.js +++ b/NativeModule/Layer.js @@ -1,162 +1,352 @@ -/** - * Created by will on 2016/7/5. - */ -import {NativeModules} from 'react-native'; -let L = NativeModules.JSLayer; -import Dataset from './Dataset.js'; -import Selection from './Selection.js'; -import LayerSetting from './LayerSetting.js'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native' +let L = NativeModules.JSLayer +let ThemeType = NativeModules.JSThemeType; +import Dataset from './Dataset.js' +import Recordset from './Recordset.js' +import Selection from './Selection.js' +import LayerSetting from './LayerSetting.js' +import LayerSettingVector from './LayerSettingVector.js' +import LayerSettingGrid from './LayerSettingGrid' +import LayerSettingImage from './LayerSettingImage' +import Theme from './Theme' +import ThemeLabel from './ThemeLabel' +import ThemeRange from './ThemeRange' +import ThemeUnique from './ThemeUnique' /** * @class Layer + * @description (该类的实例不可被创建,只可以通过在 Map 类中的 addLayer 方法来创建)该类提供了图层显示和控制等的便于地图管理的一系列方法。当数据集被加载到地图窗口中显示的时,就形成了一个图层,因此图层是数据集的可视化显示。一个图层是对一个数据集的引用或参考。通过对可视化的图层的编辑,可以对 相应的数据集的要素进行编辑。一个图层或多个图层叠加显示则形成了地图。图层分为普通图层和专题图层,矢量的普通图层中所有要素采用相同的渲染风格,栅格图层采用颜色表来显示其像元;而专题图层则采用指定类型的专题图风格来渲染其中的 要素或像元。 */ -export default class Layer{ - /** - * 设置图层是否处于可编辑状态。该方法控制是否对图层所引用的数据进行修改。 - * @memberOf Layer - * @param {boolean}editable - 图层是否处于可编辑状态。 - * @returns {Promise.} - */ - async setEditable(editable){ - try{ - await L.setEditable(this.layerId,editable); - }catch(e){ - console.error(e); - } - } +export default class Layer { - /** - * 返回图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该标识不区分大小写。 - * @memberOf Layer - * @param {index} index - 图层序号 - * @returns {Promise.} - */ - async getName(index){ - try{ - var {layerName} = await L.getName(this.layerId,index); - return layerName; - }catch(e){ - console.error(e); - } - } + constructor() { + } - /** - * 返回此图层对应的数据集对象。图层是对数据集的引用,因而,一个图层与一个数据集相对应。 - * @memberOf Layer - * @returns {Promise.} - */ - async getDataset(){ - try{ - var {datasetId} = await L.getDataset(this.layerId); - var dataset = new Dataset(); - dataset.datasetId = datasetId; - return dataset; - }catch(e){ - console.error(e); - } + /** + * 设置图层是否处于可编辑状态。该方法控制是否对图层所引用的数据进行修改。 + * @memberOf Layer + * @param {boolean} editable + * @returns {Promise.} + */ + async setEditable(editable) { + try { + await L.setEditable(this._SMLayerId, editable) + } catch (e) { + console.error(e) } - - /** - * 设置图层关联的数据集。 设置的数据集必须与当前地图属于同一工作空间,且数据集类型与原有数据集类型一致,否则会抛出异常。 - * @memberOf Layer - * @param {object} dataset - 图层关联的数据集 - * @returns {Promise.} - */ - async setDataset(dataset){ - try{ - await L.setDataset(this.layerId,dataset.datasetId); - }catch(e){ - console.error(e); - } + } + + /** + * 判断图层是否处于可编辑状态。 + * @memberOf Layer + * @returns {Promise.} + */ + async getEditable() { + try { + var { isEditable } = await L.getEditable(this._SMLayerId) + return isEditable + } catch (e) { + console.error(e) } - - /** - * 返回此图层中的选择集对象。选择集是个集合,其中包含选择的图层中的一个或多个要素。在选择集中的要素才可以被编辑。注意选择集只适用于矢量数据集,栅格数据集和影像数据集没有选择集。 - * @memberOf Layer - * @returns {Promise.} - */ - async getSelection(){ - try{ - var {selectionId,recordsetId} = await L.getSelection(this.layerId); - var selection = new Selection(); - selection.selectionId = selectionId; - selection.recordsetId = recordsetId; - return selection; - }catch(e){ - console.error(e); - } + } + + /** + * 返回图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该标识不区分大小写。 + * @memberOf Layer + * @returns {Promise.} + */ + async getName() { + try { + var { layerName } = await L.getName(this._SMLayerId) + return layerName + } catch (e) { + console.error(e) } + } + + /** + * 返回此图层对应的数据集对象。图层是对数据集的引用,因而,一个图层与一个数据集相对应。 + * @memberOf Layer + * @returns {Promise.} + */ + async getDataset() { + try { + var { datasetId } = await L.getDataset(this._SMLayerId) + if (datasetId) { + var dataset = new Dataset() + dataset._SMDatasetId = datasetId + return dataset + } else { + return null + } - /** - * 设置图层中对象是否可以选择。 - * @memberOf Layer - * @param {boolean} b - 指定图层中对象是否可以选择。 - * @returns {Promise.} - */ - async setSelectable(b){ - try{ - await L.setSelectable(this.layerId,b); - }catch(e){ - console.error(e); - } + } catch (e) { + console.error(e) } - - /** - * 获取此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 - * @memberOf Layer - * @param {boolean} b - 指定图层是否可见。 - * @returns {Promise.} - */ - async getVisible(b){ - try{ - var isVisible = await L.getVisible(this.layerId); - return isVisible; - }catch(e){ - console.error(e); - } + } + + /** + * 设置图层关联的数据集。 设置的数据集必须与当前地图属于同一工作空间,且数据集类型与原有数据集类型一致,否则会抛出异常(该方法暂不支持iOS设备)。 + * @memberOf Layer + * @param {object} dataset - 图层关联的数据集 + * @returns {Promise.} + */ + async setDataset(dataset) { + try { + await L.setDataset(this._SMLayerId, dataset._SMDatasetId) + } catch (e) { + console.error(e) } - - /** - * 设置此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 - * @memberOf Layer - * @param {boolean} b - 指定图层是否可见。 - * @returns {Promise.} - */ - async setVisible(b){ - try{ - await L.setVisible(this.layerId,b); - }catch(e){ - console.error(e); - } + } + + /** + * 返回此图层中的选择集对象。选择集是个集合,其中包含选择的图层中的一个或多个要素。在选择集中的要素才可以被编辑。注意选择集只适用于矢量数据集,栅格数据集和影像数据集没有选择集。 + * @memberOf Layer + * @returns {Promise.} + */ + async getSelection() { + try { + var { selectionId, recordsetId } = await L.getSelection(this._SMLayerId) + var selection = new Selection() + var recordset = new Recordset() + selection._SMSelectionId = selectionId + recordset._SMRecordsetId = recordsetId + + selection.recordset = recordset + return selection + } catch (e) { + console.error(e) } - - /** - * 返回普通图层的风格设置。LayerSettingVector 类用来对矢量数据图层风格进行设置和修改。 - * @memberOf Layer - * @returns {Promise.} - */ - async getAdditionalSetting(){ - try{ - var {_layerSettingId_} = await L.getAdditionalSetting(this.layerId); - var layerSetting = new LayerSetting(); - layerSetting._layerSettingId_ = _layerSettingId_; - return layerSetting; - }catch(e){ - console.error(e); - } + } + + /** + * 设置图层中对象是否可以选择。 + * @memberOf Layer + * @param {boolean} b + * @returns {Promise.} + */ + async setSelectable(b) { + try { + await L.setSelectable(this._SMLayerId, b) + } catch (e) { + console.error(e) } - - /** - * 设置普通图层的风格。普通图层风格的设置对矢量数据图层、栅格数据图层以及影像数据图层是不相同的。LayerSettingVector类用来对矢量数据图层的风格进行设置和修改。 - * @memberOf Layer - * @param {LayerSetting} layerSetting - 普通图层的风格设置.{@link LayerSetting} - * @returns {Promise.} - */ - async setAdditionalSetting(layerSetting){ - try{ - await L.setAdditionalSetting(this.layerId,layerSetting._layerSettingId_); - }catch(e){ - console.error(e); + } + + /** + * 返回图层中对象是否可以选择 + * @memberOf Layer + * @param {void} + * @returns {Promise.} + */ + async isSelectable() { + try { + var { selectable } = await L.isSelectable(this._SMLayerId) + return selectable + } catch (e) { + console.error(e) + } + } + + /** + * 获取此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 + * @memberOf Layer + * @returns {Promise.} + */ + async getVisible() { + try { + var isVisible = await L.getVisible(this._SMLayerId) + return isVisible + } catch (e) { + console.error(e) + } + } + + /** + * 设置此图层是否可见。true 表示此图层可见,false 表示图层不可见。当图层不可见时,其他所有的属性的设置将无效。 + * @memberOf Layer + * @param {boolean} b + * @returns {Promise.} + */ + async setVisible(b) { + try { + await L.setVisible(this._SMLayerId, b) + } catch (e) { + console.error(e) + } + } + + /** + * 获取此图层是否可捕捉 + * @returns {Promise} + */ + async isSnapable() { + try { + var isSnapable = await L.isSnapable(this._SMLayerId) + return isSnapable + } catch (e) { + console.error(e) + } + } + + /** + * 设置此图层是否可捕捉,false不可捕捉, true可捕捉 + * @param isSnapable + * @returns {Promise.} + */ + async setSnapable(isSnapable) { + try { + await L.setSnapable(this._SMLayerId, isSnapable) + } catch (e) { + console.error(e) + } + } + + /** + * 返回普通图层的风格设置。LayerSettingVector 类用来对矢量数据图层风格进行设置和修改。 + * @memberOf Layer + * @returns {Promise.} + */ + async getAdditionalSetting() { + try { + let layerSetting + let { _layerSettingId_, type } = await L.getAdditionalSetting(this._SMLayerId) + if (type === 0) { + layerSetting = new LayerSettingVector() + layerSetting._SMLayerSettingId = _layerSettingId_ + } else if (type === 1) { + //image + layerSetting = new LayerSettingImage() + layerSetting._SMLayerSettingId = _layerSettingId_ + } else { + //grid + layerSetting = new LayerSettingGrid() + layerSetting._SMLayerSettingId = _layerSettingId_ + } + return layerSetting + } catch (e) { + console.error(e) + } + } + + /** + * 设置普通图层的风格。普通图层风格的设置对矢量数据图层、栅格数据图层以及影像数据图层是不相同的。LayerSettingVector类用来对矢量数据图层的风格进行设置和修改。 + * @memberOf Layer + * @param {LayerSetting} layerSetting - 普通图层的风格设置.{@link LayerSetting} + * @returns {Promise.} + */ + async setAdditionalSetting(layerSetting) { + try { + await L.setAdditionalSetting(this._SMLayerId, layerSetting._SMLayerSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回选中的对象的集合 + * @param point2D + * @param tolerance + * @returns {Promise.} + */ + async hitTest(point2D, tolerance) { + try { + let { selectionId, recordsetId } = await L.hitTest(this._SMLayerId, point2D._SMPoint2DId, tolerance) + let selection = await new Selection() + selection._SMSelectionId = selectionId + let recordset = await new Recordset() + recordset._SMRecordsetId = recordsetId + + selection.recordset = recordset + return selection + } catch (e) { + console.error(e) + } + } + + /** + * 返回选中的对象的集合 + * @param point + * @param tolerance + * @returns {Promise.} + */ + async hitTestEx(point, tolerance) { + try { + let { selectionId, recordsetId } = await L.hitTestEx(this._SMLayerId, point._SMPointId, tolerance) + let selection = await new Selection() + selection._SMSelectionId = selectionId + let recordset = await new Recordset() + recordset._SMRecordsetId = recordsetId + + selection.recordset = recordset + return selection + } catch (e) { + console.error(e) + } + } + + /** + * 返回图层标题 + * @returns {Promise} + */ + async getCaption() { + try { + return await L.getCaption(this._SMLayerId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置图层标题 + * @param value + * @returns {Promise.} + */ + async setCaption(value) { + try { + await L.setCaption(this._SMLayerId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 获取专题图层的专题图对象 + * @returns {Promise.} + */ + async getTheme() { + try { + let mTheme = await L.getTheme(this._SMLayerId) // {themeId, type} + if (mTheme && mTheme.themeId) { + let theme; + switch (mTheme.type) { + case ThemeType.UNIQUE: + theme = new ThemeUnique() + break + case ThemeType.RANGE: + theme = new ThemeRange() + break + case ThemeType.LABEL: + theme = new ThemeLabel() + break + default: + theme = new Theme() + break } + theme._SMThemeId = mTheme.themeId + theme.type = mTheme.type + return theme + } else { + return null + } + } catch (e) { + console.error(e) } + } } diff --git a/NativeModule/Layer3D.js b/NativeModule/Layer3D.js new file mode 100755 index 00000000..e81f38b3 --- /dev/null +++ b/NativeModule/Layer3D.js @@ -0,0 +1,131 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: Layer3D-三维图层类; + **********************************************************************************/ +import { NativeModules, Platform } from 'react-native'; +let L = NativeModules.JSLayer3D; +/** + * @class Layer3D + */ +export default class Layer3D { + + /** + * 获取Layer3D名称。 + * @memberOf Layer3D + * @returns {Boolean} + */ + async getName() { + try { + var { layer3DName } = await L.getName(this._SMLayer3DId); + return layer3DName; + } catch (e) { + console.error(e); + } + } + + /** + *更新三维图层。 + * @memberOf Layer3D + * @returns {Boolean} + */ + async updateData() { + try { + await L.updateData(this._SMLayer3DId); + return true; + } catch (e) { + console.error(e); + } + } + + /** + * 设置图层的可见性 。 + * @memberOf Layer3D + * @param {boolean} visable - 可见性(可选参数,通过此参数区分get/set) + * @returns {Boolean} + */ + async setVisable(visable) { + try { + var { isVisable } = await L.setVisable(this._SMLayer3DId, visable); + return isVisable; + } catch (e) { + console.error(e); + } + } + + /** + * 获取图层对视口的可见性 。 + * @memberOf Layer3D + * @returns {Boolean} + */ + async getVisable() { + try { + var { isVisable } = await L.getVisable(this._SMLayer3DId) + return isVisable; + } catch (e) { + console.error(e); + } + } + + /** + * 获取或设置图层不可见释放内存。 + * @memberOf Layer3D + * @param {Boolean} release - 是否释放内存(可选参数,通过此参数区分get/set) + * @returns {Boolean} + */ + async releaseWhenInvisible(release) { + try { + if (arguments.length >= 1) { + await L.setRelease(this._SMLayer3DId, release); + var isRelease = release; + } else { + var { isRelease } = await L.getRelease(this._SMLayer3DId); + } + return isRelease; + } catch (e) { + console.error(e); + } + } + + /** + * 返回设置颜色的对象个数。 + * @memberOf Layer3D + * @returns {number} + */ + async getObjectsColorCount() { + try { + let { count } = await L.getObjectsColorCount(this._SMLayer3DId); + return count; + } catch (e) { + console.error(e); + } + } + + /** + * 设置指定OSGB模型ID队列的模型颜色。 + * @memberOf Layer3D + * @returns {void} + */ + async setObjectsColor(index, r, g, b, a) { + try { + await L.setObjectsColor(this._SMLayer3DId, index, r, g, b, a); + } catch (e) { + console.error(e); + } + } + + /** + * 设置指定OSGB模型ID队列的模型是否可见。 + * @memberOf Layer3D + * @returns {number} + */ + async setObjectsVisible(index,visable) { + try { + var { lon } = await L.setObjectsVisible(this._SMLayer3DId,index,visable); + return lon; + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/Layer3DOSGBFile.js b/NativeModule/Layer3DOSGBFile.js new file mode 100755 index 00000000..b7ceca16 --- /dev/null +++ b/NativeModule/Layer3DOSGBFile.js @@ -0,0 +1,40 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: 三维相机对象类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let L = NativeModules.JSLayer3DOSGBFile; +/** + * @class Layer3DOSGBFile + */ +export default class Layer3DOSGBFile { + /** + * 设置指定OSGB模型ID队列的模型颜色。 + * @memberOf Layer3DOSGBFile + * @returns {void} + */ + async setObjectsColor(index, r, g, b, a) { + try { + await L.setObjectsColor(this._SMLayer3DId, index, r, g, b, a); + } catch (e) { + console.error(e); + } + } + + /** + * 设置指定OSGB模型ID队列的模型是否可见。 + * @memberOf Layer3DOSGBFile + * @returns {number} + */ + async setObjectsVisible(index,visable) { + try { + var { lon } = await L.setObjectsVisible(this._SMLayer3DId,index,visable); + return lon; + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/Layer3Ds.js b/NativeModule/Layer3Ds.js new file mode 100755 index 00000000..7462e073 --- /dev/null +++ b/NativeModule/Layer3Ds.js @@ -0,0 +1,50 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: Layer3Ds-三维图层集合类,用于获取三维图层; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let LS = NativeModules.JSLayer3Ds; +import Layer3D from './Layer3D'; +/** + * @class Layer3Ds + */ +export default class Layer3Ds { + + /** + *返回此图层集合中指定名称的三维图层对象。 + * @memberOf Layer3Ds + * @param {number} index - 图层序号 + * @returns {Promise.} + */ + async get(index) { + try { + // if (typeof index == "string") { + // var { layerId } = await LS.getByName(this._SMLayer3DsId, index); + // } else { + // var { layerId } = await LS.getByIndex(this._SMLayer3DsId, index); + // } + var { layerId } = await LS.getByIndex(this._SMLayer3DsId, index); + var layer = new Layer3D(); + layer._SMLayer3DId = layerId; + return layer; + } catch (e) { + console.error(e); + } + } + + /** + * 返回此图层集合中三维图层对象的总数。 + * @memberOf Layer3Ds + * @returns {Promise.} + */ + async getCount() { + try { + var { count } = await LS.getCount(this._SMLayer3DsId); + return count; + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/LayerGroup.js b/NativeModule/LayerGroup.js new file mode 100755 index 00000000..c43cc241 --- /dev/null +++ b/NativeModule/LayerGroup.js @@ -0,0 +1,124 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ +import { NativeModules } from 'react-native' +let LG = NativeModules.JSLayerGroup +import Layer from './Layer.js' + +/** + * @class LayerGroup + * @description (该类的实例不可被创建,只可以通过在 Map 类中的 addLayerGroup 方法来创建)该类提供了图层组分类 + */ +export default class LayerGroup extends Layer { + constructor() { + super(); + Object.defineProperty(this, "_SMLayerGroupId", { + get: function () { + return this._SMLayerId + }, + set: function (_SMLayerGroupId) { + this._SMLayerId = _SMLayerGroupId; + } + }) + } + + async add(layer) { + try { + await LG.add(this._SMLayerId, layer._SMLayerId); + } catch (e) { + console.error(e); + } + } + + async addGroup(groupName) { + try { + let groupId = await LG.addGroup(this._SMLayerId, groupName); + let group = new LayerGroup(); + group._SMLayerId = groupId; + return group; + } catch (e) { + console.error(e); + } + } + + async getLayer(index) { + try { + let item = await LG.get(this._SMLayerId, index); + let layer + if (item) { + if (item.type === 'layerGroup') { + layer = new LayerGroup(); + } else { + layer = new Layer(); + } + layer._SMLayerId = item.id; + item.layer = layer + } + return item; + } catch (e) { + console.error(e); + } + } + + async getCount() { + try { + return await LG.getCount(this._SMLayerId); + } catch (e) { + console.error(e); + } + } + + async indexOf(layer) { + try { + return await LG.indexOf(this._SMLayerId, layer._SMLayerId); + } catch (e) { + console.error(e); + } + } + + async insert(layer, index) { + try { + await LG.insert(this._SMLayerId, layer._SMLayerId, index); + } catch (e) { + console.error(e); + } + } + + async insertGroup(index, groupName) { + try { + let id = await LG.insertGroup(this._SMLayerId, index, groupName); + let group = new LayerGroup() + group._SMLayerId = id + return group + } catch (e) { + console.error(e); + } + } + + async remove(layer) { + try { + return await LG.remove(this._SMLayerId, layer._SMLayerId); + } catch (e) { + console.error(e); + } + } + + async removeGroup(layer) { + try { + return await LG.removeGroup(this._SMLayerId, layer._SMLayerId); + } catch (e) { + console.error(e); + } + } + + async ungroup() { + try { + return await LG.ungroup(this._SMLayerId); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/LayerSetting.js b/NativeModule/LayerSetting.js old mode 100644 new mode 100755 index 6a943a6b..7418bfe3 --- a/NativeModule/LayerSetting.js +++ b/NativeModule/LayerSetting.js @@ -1,9 +1,15 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let LS = NativeModules.JSLayerSetting; -import LSV from './LayerSettingVector.js'; /** * @class LayerSetting + * @description 图层设置基类。(虚类) */ export default class LayerSetting { @@ -14,45 +20,10 @@ export default class LayerSetting { */ async getType(){ try{ - var layerSettingType = LS.getType(this._layerSettingId_); + var layerSettingType = await LS.getType(this._SMLayerSettingId); return layerSettingType; }catch(e){ console.error(e); } } - - /** - * 类型装换layerSetting 转layerSettingVector。 - * @memberOf LayerSetting - * @returns {Promise.} - */ - async toSubClass(){ - try{ - var layerSettingType = L.getType(this._layerSettingId_); - switch (layerSettingType){ - case 0 : - var {_layerSettingVectorId_} = LS.toLayerSettingVector(this._layerSettingId_); - var lsv = new LSV(); - lsv._layerSettingVectorId_ = _layerSettingVectorId_; - return lsv - break; - case 1 : -// var {_layerSettingImageId_} = LS.toLayerSettingImage(this._layerSettingId_); -// var lsi = new LSI(); -// lsi._layerSettingImageId_ = _layerSettingImageId_; -// return lsi -// break; - case 2 : -// var {_layerSettingGridId_} = LS.toLayerSettingGrid(this._layerSettingId_); -// var lsg = new LSG(); -// lsg._layerSettingGridId_ = _layerSettingGridId_; -// return lsg -// break; - default : - return 'plsase input lsv'; - } - }catch(e){ - console.error(e); - } - } } diff --git a/NativeModule/LayerSettingGrid.js b/NativeModule/LayerSettingGrid.js new file mode 100755 index 00000000..d8f8cf8b --- /dev/null +++ b/NativeModule/LayerSettingGrid.js @@ -0,0 +1,162 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ +import {NativeModules} from 'react-native' +let LSG = NativeModules.JSLayerSettingGrid +import GeoStyle from './GeoStyle.js' +import LayerSetting from './LayerSetting.js' + +/** + * @class LayerSettingGrid + * @description 栅格图层设置类。 + */ +export default class LayerSettingGrid extends LayerSetting{ + constructor(){ + super() + Object.defineProperty(this,"_SMLayerSettingGridId", { + get:function(){ + return this._SMLayerSettingId + }, + set:function(_SMLayerSettingGridId){ + this._SMLayerSettingId = _SMLayerSettingGridId + }, + }) + } + + /** + * 创建一个LayerSettingGrid实例 + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async createObj(){ + try{ + var {_layerSettingGridId_} = await LSG.createObj() + var layerSettingGrid = new LayerSettingGrid() + layerSettingGrid._SMLayerSettingGridId = _layerSettingGridId_ + return layerSettingGrid + } catch(e) { + console.error(e) + } + } + + /** + * 获取矢量图层的风格。 + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async getType() { + try{ + + var {type} = await LSG.getType(this._SMLayerSettingGridId) + var typeStr = 'type' + switch (type){ + case 0 : typeStr = 'Grid' + break + case 1 : typeStr = 'RASTER' + break + case 2 : typeStr = 'GRID' + break + default : throw new Error("Unknown LayerSetting Type") + } + return typeStr + } catch(e) { + console.error(e) + } + } + + /** + * 获取栅格图层特殊值 + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async getSpecialValue(){ + try{ + var { specialValue } = await LSG.getSpecialValue(this._SMLayerSettingGridId) + return specialValue + } catch(e) { + console.error(e) + } + } + + /** + * 设置栅格图层特殊值 + * @param specialValue + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async setSpecialValue(specialValue){ + try { + await LSG.setSpecialValue(this._SMLayerSettingGridId, specialValue) + } catch(e) { + console.error(e) + } + } + + /** + * 获取栅格图层指定的特殊值是否要透明显示 + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async isSpecialValueTransparent(){ + try { + var { isSpecialValueTransparent } = await LSG.isSpecialValueTransparent(this._SMLayerSettingGridId) + return isSpecialValueTransparent + } catch(e) { + console.error(e) + } + } + + /** + * 设置栅格图层特殊值 + * @param specialValueTransparent + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async setSpecialValueTransparent(specialValueTransparent){ + try { + await LSG.setSpecialValueTransparent(this._SMLayerSettingGridId, specialValueTransparent) + } catch(e) { + console.error(e) + } + } + + /** + * 获取栅格图层当前指定特殊值对应的像元要显示的颜色 + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async getSpecialValueColor(){ + try { + var { specialValueColor } = await LSG.isSpecialValueTransparent(this._SMLayerSettingGridId) + return specialValueColor + } catch(e) { + console.error(e) + } + } + + /** + * 设置栅格图层当前指定特殊值对应的像元要显示的颜色 + * @param r - red + * @param g - green + * @param b - blue + * @param a - alpha + * @memberOf LayerSettingGrid + * @returns {Promise.} + */ + async setSpecialValueTransparent(r, g, b, a){ + try { + await LSG.setSpecialValueTransparent(this._SMLayerSettingGridId, r, g, b, a) + } catch(e) { + console.error(e) + } + } +} + +LayerSettingGrid.TYPE = { + Grid:0, + RASTER:1, + GRID:2 +} diff --git a/NativeModule/LayerSettingImage.js b/NativeModule/LayerSettingImage.js new file mode 100755 index 00000000..9edd61aa --- /dev/null +++ b/NativeModule/LayerSettingImage.js @@ -0,0 +1,75 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ +import {NativeModules} from 'react-native'; +let LSI = NativeModules.JSLayerSettingImage; +import GeoStyle from './GeoStyle.js'; +import LayerSetting from './LayerSetting.js'; + +/** + * @class LayerSettingImage + * @description 影像图层设置类。 + */ +export default class LayerSettingImage extends LayerSetting{ + constructor(){ + super(); + Object.defineProperty(this,"_SMLayerSettingImageId",{ + get:function(){ + return this._SMLayerSettingId + }, + set:function(_SMLayerSettingImageId){ + this._SMLayerSettingId = _SMLayerSettingImageId; + } + }) + } + + /** + * 创建一个LayerSettingImage实例 + * @memberOf LayerSettingImage + * @returns {Promise.} + */ + async createObj(){ + try{ + var {_layerSettingImageId_} = await LSI.createObj(); + var layerSettingImage = new LayerSettingImage(); + layerSettingImage._SMLayerSettingImageId = _layerSettingImageId_ + return layerSettingImage; + }catch (e){ + console.error(e); + } + } + + /** + * 获取矢量图层的风格。 + * @memberOf LayerSettingImage + * @returns {Promise.} + */ + async getType(){ + try{ + + var {type} = await LSI.getType(this._SMLayerSettingImageId); + var typeStr = 'type'; + switch (type){ + case 0 : typeStr = 'Image'; + break; + case 1 : typeStr = 'RASTER'; + break; + case 2 : typeStr = 'GRID'; + break; + default : throw new Error("Unknown LayerSetting Type"); + } + return typeStr; + }catch (e){ + console.error(e); + } + } +} + +LayerSettingImage.TYPE = { + Image:0, + RASTER:1, + GRID:2 +} diff --git a/NativeModule/LayerSettingVector.js b/NativeModule/LayerSettingVector.js old mode 100644 new mode 100755 index 0ef2c63a..987a9dd9 --- a/NativeModule/LayerSettingVector.js +++ b/NativeModule/LayerSettingVector.js @@ -1,11 +1,31 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let LSV = NativeModules.JSLayerSettingVector; import GeoStyle from './GeoStyle.js'; +import LayerSetting from './LayerSetting.js'; /** * @class LayerSettingVector + * @description 矢量图层设置类。 */ -export default class LayerSettingVector { +export default class LayerSettingVector extends LayerSetting{ + constructor(){ + super(); + Object.defineProperty(this,"_SMLayerSettingVectorId",{ + get:function(){ + return this._SMLayerSettingId + }, + set:function(_SMLayerSettingVectorId){ + this._SMLayerSettingId = _SMLayerSettingVectorId; + } + }) + } + /** * 创建一个LayerSettingVector实例 * @memberOf LayerSettingVector @@ -15,7 +35,7 @@ export default class LayerSettingVector { try{ var {_layerSettingVectorId_} = await LSV.createObj(); var layerSettingVector = new LayerSettingVector(); - layerSettingVector._layerSettingVectorId_ = _layerSettingVectorId_ + layerSettingVector._SMLayerSettingVectorId = _layerSettingVectorId_ return layerSettingVector; }catch (e){ console.error(e); @@ -30,9 +50,9 @@ export default class LayerSettingVector { async getStyle(){ try{ - var {geoStyleId} = await LSV.getStyle(this._layerSettingVectorId_); + var {geoStyleId} = await LSV.getStyle(this._SMLayerSettingVectorId); var geoStyle = new GeoStyle(); - geoStyle.geoStyleId = geoStyleId; + geoStyle._SMGeoStyleId = geoStyleId; return geoStyle; }catch (e){ console.error(e); @@ -47,7 +67,7 @@ export default class LayerSettingVector { */ async setStyle(geoStyle){ try{ - await LSV.setStyle(this._layerSettingVectorId_,geoStyle.geoStyleId); + await LSV.setStyle(this._SMLayerSettingVectorId,geoStyle._SMGeoStyleId); }catch (e){ console.error(e); } @@ -61,8 +81,18 @@ export default class LayerSettingVector { async getType(){ try{ - var {type} = await LSV.getType(this._layerSettingVectorId_); - return type; + var {type} = await LSV.getType(this._SMLayerSettingVectorId); + var typeStr = 'type'; + switch (type){ + case 0 : typeStr = 'VECTOR'; + break; + case 1 : typeStr = 'RASTER'; + break; + case 2 : typeStr = 'GRID'; + break; + default : throw new Error("Unknown LayerSetting Type"); + } + return typeStr; }catch (e){ console.error(e); } diff --git a/NativeModule/Layers.js b/NativeModule/Layers.js old mode 100644 new mode 100755 index dc3ef470..a94ef486 --- a/NativeModule/Layers.js +++ b/NativeModule/Layers.js @@ -1,6 +1,9 @@ -/** - * Created by will on 2016/6/17. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let L = NativeModules.JSLayers; import Layer from './Layer.js'; @@ -20,7 +23,7 @@ export default class Layers{ async add(dataset,b){ this._drepecated(); try{ - await L.add(this.layersId,dataset.datasetId,b); + await L.add(this._SMLayersId,dataset._SMDatasetId,b); }catch (e){ console.error(e); } @@ -37,11 +40,11 @@ export default class Layers{ try{ var layer = new Layer(); if(typeof index == "string"){ - var {layerId} = await L.getByName(this.layersId,index); + var {layerId} = await L.getByName(this._SMLayersId,index); }else{ - var {layerId} = await L.get(this.layersId,index); + var {layerId} = await L.get(this._SMLayersId,index); } - layer.layerId = layerId; + layer._SMLayerId = layerId; return layer; }catch(e){ console.error(e); @@ -56,7 +59,7 @@ export default class Layers{ async getCount(){ this._drepecated(); try{ - var {count} = await L.getCount(this.layersId); + var {count} = await L.getCount(this._SMLayersId); return count; }catch(e){ console.error(e); @@ -69,4 +72,4 @@ export default class Layers{ "eg:Layers.get(index) now has been substituted by map.getLayer(index)." + "Relevant modifications refer to the API documents please"); } -} \ No newline at end of file +} diff --git a/NativeModule/Legend.js b/NativeModule/Legend.js deleted file mode 100644 index 2648c845..00000000 --- a/NativeModule/Legend.js +++ /dev/null @@ -1,23 +0,0 @@ -import {NativeModules} from 'react-native'; -let L = NativeModules.JSLegend; - -export default class Legend { - async createObjWithMap(map){ - try{ - var {legendId} = await L.createObjWithMap(map.mapId); - var legend = new Legend(); - legend.legendId = legendId; - return legend; - }catch (e){ - console.error(e); - } - } - - async show(enable){ - try{ - await L.show(this.legendId,enable); - }catch (e){ - console.error(e); - } - } -} diff --git a/NativeModule/LineChart.js b/NativeModule/LineChart.js new file mode 100755 index 00000000..6419ae30 --- /dev/null +++ b/NativeModule/LineChart.js @@ -0,0 +1,159 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let LC = NativeModules.JSLineChart; +import ChartView from './ChartView.js'; + +/** + * @class LineChart + */ +export default class LineChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"linechartId",{ + get:function (){ + return this.chartviewId + }, + set:function(linechartId){ + this.chartviewId = linechartId; + } + }) + } + /** + * 设置/获取数值是否按照X轴分布 + * @memberOf BarChart + * @param {boolean} b + * @returns {Promise.} + */ + async setAllowInteraction(b){ + try{ + await LC.setAllowInteraction(this.linechartId,b); + }catch(e){ + console.error(e); + } + } + /** + * 判断图层是否处于可编辑状态。 + * @memberOf ChartView + * @returns {Promise.} + */ + async isAllowInteraction(){ + try{ + var{isAllow} = await LC.isAllowInteraction(this.linechartId); + return isAllow; + }catch(e){ + console.error(e); + } + } + + /** + * 设置X坐标轴显示标签 + * @memberOf ChartView + * @param {object} xAxisLables - 数据数组 + * @returns {Promise.} + */ + async setXAxisLables(xAxisLables){ + try{ + await LC.setXAxisLables(this.linechartId,xAxisLables); + }catch(e){ + console.error(e); + } + } + + /** + * 获取X坐标轴显示标签 + * @memberOf ChartView + * @returns {Promise.} + */ + async getXAxisLables(){ + try{ + var {xAxisLables} = await LC.getXAxisLables(this.linechartId); + return xAxisLables; + }catch(e){ + console.error(e); + } + } + + /** + * 设置X坐标轴标题。 + * @memberOf ChartView + * @param {string} title - 标题 + * @returns {Promise.} + */ + async setXAxisTitle(title){ + try{ + await LC.setXAxisTitle(this.linechartId,title); + }catch(e){ + console.error(e); + } + } + + /** + * 获取X坐标轴标题。 + * @memberOf ChartView + * @returns {Promise.} + */ + async getXAxisTitle(){ + try{ + var {title} = await LC.getXAxisTitle(this.linechartId); + return title; + }catch(e){ + console.error(e); + } + } + + /** + * 设置Y坐标轴标题。 + * @memberOf ChartView + * @param {string} title - 标题 + * @returns {Promise.} + */ + async setYAxisTitle(title){ + try{ + await LC.setYAxisTitle(this.linechartId,title); + }catch(e){ + console.error(e); + } + } + + /** + * 获取Y坐标轴标题。 + * @memberOf ChartView + * @returns {Promise.} + */ + async getYAxisTitle(){ + try{ + var {title} = await LC.getYAxisTitle(this.linechartId); + return title; + }catch(e){ + console.error(e); + } + } + + /** + * 设置图表选中回调 + * @memberOf ChartView + * @returns {Promise.} + */ + async setChartOnSelected(){ + try{ + await LC.setChartOnSelected(this.linechartId); + }catch(e){ + console.error(e); + } + } + + /** + * 设置选中的对象ID + * @memberOf ChartView + * @returns {Promise.} + */ + async setSelectedGeometryID(geoId){ + try{ + await LC.setSelectedGeometryID(this.linechartId,geoId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/LineChartData.js b/NativeModule/LineChartData.js new file mode 100755 index 00000000..f89d9649 --- /dev/null +++ b/NativeModule/LineChartData.js @@ -0,0 +1,70 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let LCD = NativeModules.JSLineChartData; +import ChartData from './ChartData.js'; + +/** + * @class Layer + */ +export default class LineChartData extends ChartData{ + constructor(){ + super(); + Object.defineProperty(this,"lineChartDataId",{ + get:function(){ + return this.chartDataId + }, + set:function(lineChartDataId){ + this.chartDataId = lineChartDataId; + } + }) + } + /** + * 创建一个PieChartData对象 + * @memberOf LineChartData + * @param {string}itemName - 图表名称 + * @param {object}values - 图表数据 + * @param {string}label - 图表标题 + * @param {int}color - 图表颜色 + * @param {int}geoId - ID + * @returns {Promise.} + */ + async createObj(itemName,values,label,color,geoId){ + try{ + var {_linechartdataId} = await LCD.createObj(itemName,values,label,color,geoId); + var lineChartData = new LineChartData(); + lineChartData.lineChartDataId = _linechartdataId; + return lineChartData; + }catch(e){ + console.error(e); + } + } + /** + *  设置图饼子项的值 + * @memberOf LineChartData + * @param {int}value - 图饼子项的值 + * @returns {Promise.} + */ + async setValues(value){ + try{ + await LCD.setValues(this.pieChartDataId,value); + }catch(e){ + console.error(e); + } + } + + /** + * 获取图饼子项的值 + * @memberOf LineChartData + * @returns {Promise.} + */ + async getValues(){ + try{ + var {values} = await LCD.getValues(this.pieChartDataId); + return values; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/LocationAnalystParameter.js b/NativeModule/LocationAnalystParameter.js new file mode 100755 index 00000000..44b289e0 --- /dev/null +++ b/NativeModule/LocationAnalystParameter.js @@ -0,0 +1,182 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let LAP = NativeModules.JSLocationAnalystParameter; + +import SupplyCenters from './SupplyCenters' + +export default class LocationAnalystParameter { + + async createObj() { + try { + let locationAnalystParameterId = await await LAP.createObj(); + let transportationAnalyst = new LocationAnalystParameter(); + transportationAnalyst._SMLocationAnalystParameterId = locationAnalystParameterId; + return transportationAnalyst; + } catch (e) { + console.error(e); + } + } + + /** + * 返回期望用于最终设施选址的资源供给中心数量 + * @returns {Promise.<*>} + */ + async getExpectedSupplyCenterCount() { + try { + let count = await LAP.getExpectedSupplyCenterCount(this._SMLocationAnalystParameterId); + return count + } catch (e) { + console.error(e) + } + } + + /** + * 返回结点需求量字段 + * @returns {Promise} + */ + async getNodeDemandField() { + try { + let nodeDemandField = await LAP.getNodeDemandField(this._SMLocationAnalystParameterId); + return nodeDemandField + } catch (e) { + console.error(e) + } + } + + /** + * 返回障碍结点的坐标列表 + * @returns {Promise.} + */ + async getSupplyCenters() { + try { + let supplyCentersId = await LAP.getSupplyCenters(this._SMLocationAnalystParameterId); + let supplyCenters = new SupplyCenters() + supplyCenters._SMSupplyCentersId = supplyCentersId + return supplyCenters + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向权值字段,该字段是交通网络分析环境设置中指定的转向权值字段集合中的一员 + * @returns {Promise.} + */ + async getTurnWeightField() { + try { + let value = await LAP.getTurnWeightField(this._SMLocationAnalystParameterId); + return value + } catch (e) { + console.error(e) + } + } + + /** + * 返回权值字段信息的名称,即交通网络分析环境设置中指定的权值字段信息集合对象(WeightFieldInfos 类对象)中的某一个权值字段信息对象(WeightFieldInfo 类对象)的 setName() 方法值 + * @returns {Promise.} + */ + async getWeightName() { + try { + let value = await LAP.getWeightName(this._SMLocationAnalystParameterId); + return value + } catch (e) { + console.error(e) + } + } + + /** + * 返回是否从资源供给中心开始分配资源 + * @returns {Promise.} + */ + async isFromCenter() { + try { + let value = await LAP.isFromCenter(this._SMLocationAnalystParameterId); + return value + } catch (e) { + console.error(e) + } + } + + /** + * 设置期望用于最终设施选址的资源供给中心数量 + * @param value + * @returns {Promise.} + */ + async setExpectedSupplyCenterCount(value) { + try { + await LAP.setExpectedSupplyCenterCount(this._SMLocationAnalystParameterId, value); + } catch (e) { + console.error(e) + } + } + + /** + * 设置是否从资源供给中心开始分配资源 + * @param value + * @returns {Promise.} + */ + async setFromCenter(value) { + try { + await LAP.setFromCenter(this._SMLocationAnalystParameterId, value); + } catch (e) { + console.error(e) + } + } + + /** + * 设置结点需求量字段 + * @param value + * @returns {Promise.} + */ + async setNodeDemandField(value) { + try { + await LAP.setNodeDemandField(this._SMLocationAnalystParameterId, value); + } catch (e) { + console.error(e) + } + } + + /** + * 设置资源供给中心集合 + * @param supplyCenters + * @returns {Promise.} + */ + async setSupplyCenters(supplyCenters) { + try { + await LAP.setSupplyCenters(this._SMLocationAnalystParameterId, supplyCenters._SMSupplyCentersId); + } catch (e) { + console.error(e) + } + } + + /** + * 设置转向权值字段,该字段是交通网络分析环境设置中指定的转向权值字段集合中的一员 + * @param value + * @returns {Promise.} + */ + async setTurnWeightField(value) { + try { + await LAP.setTurnWeightField(this._SMLocationAnalystParameterId, value); + } catch (e) { + console.error(e) + } + } + + /** + * 设置权值字段信息的名称,即交通网络分析环境设置中指定的权值字段信息集合对象(WeightFieldInfos 类对象)中的某一个权值字段信息对象(WeightFieldInfo 类对象)的 setName() 方法值 + * @param value + * @returns {Promise.} + */ + async setWeightName(value) { + try { + await LAP.setWeightName(this._SMLocationAnalystParameterId, value); + } catch (e) { + console.error(e) + } + } + +} diff --git a/NativeModule/LocationManager.js b/NativeModule/LocationManager.js old mode 100644 new mode 100755 index 5771fe62..5c2ef123 --- a/NativeModule/LocationManager.js +++ b/NativeModule/LocationManager.js @@ -1,10 +1,18 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules,DeviceEventEmitter} from 'react-native'; let LM = NativeModules.JSLocationManager; /** * @class LocationManager + * @description 位置管理插件,目前仅支持从GPS设备中获取当前位置。 */ export default class LocationManager { + /** * 创建一个LocationManager实例 * @memberOf LocationManager @@ -14,7 +22,7 @@ export default class LocationManager { try{ var {_locationManagePluginId_} = await LM.createObj(); var loactionManager = new LocationManager(); - loactionManager._locationManagePluginId_ = _locationManagePluginId_; + loactionManager._SMLocationManagerId = _locationManagePluginId_; return loactionManager; }catch (e){ console.error(e); @@ -28,7 +36,7 @@ export default class LocationManager { */ async openGpsDevice(){ try{ - await LM.openGpsDevice(this._locationManagePluginId_); + await LM.openGpsDevice(this._SMLocationManagerId); }catch (e){ console.error(e); } @@ -41,7 +49,7 @@ export default class LocationManager { */ async closeGpsDevice(){ try{ - await LM.closeGpsDevice(this._locationManagePluginId_); + await LM.closeGpsDevice(this._SMLocationManagerId); }catch (e){ console.error(e); } @@ -51,7 +59,7 @@ export default class LocationManager { * 监听定位信息,获取定位数据 * @memberOf LocationManager * @param {function}_callback - 位置信息变化处理函数,回调参数保存e:{"oldGps":object,"newGps":object,isGPSPointValid:boolean} - * Gps对象数据(oldGps,newGps):{dAltitude:double,dBearing:double,dLatitude:double,dLongitude:double,dSpeed:double,lTime:string,nDay:number,nEasting:number,nFixMode:number,nHour:number,nMinute:number,nNorthing:number,nQualityIndicator:number,nSatellites:number,nSecond:number,nYear:number} + * @description Gps对象数据(oldGps,newGps):{dAltitude:double,dBearing:double,dLatitude:double,dLongitude:double,dSpeed:double,lTime:string,nDay:number,nEasting:number,nFixMode:number,nHour:number,nMinute:number,nNorthing:number,nQualityIndicator:number,nSatellites:number,nSecond:number,nYear:number} * @returns {Promise.} */ async getLocationInfo(_callback){ @@ -64,9 +72,9 @@ export default class LocationManager { console.error("Please set a callback in the first argument."); } }); - await LM.getLocationInfo(this._locationManagePluginId_); + await LM.getLocationInfo(this._SMLocationManagerId); }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/MQTTClientSide.js b/NativeModule/MQTTClientSide.js new file mode 100755 index 00000000..b98e3ae7 --- /dev/null +++ b/NativeModule/MQTTClientSide.js @@ -0,0 +1,172 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import {NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform} from 'react-native'; +let MTS = NativeModules.JSMQTTClientSide; + +const nativeEvt = new NativeEventEmitter(MTS); +/** + * @class MQTTClientSide + * @description MQTT连接客户端类。 + */ +export default class MQTTClientSide{ + /** + * 创建一个MQTTClientSide对象 + * @memberOf MQTTClientSide + * @returns {Promise.} + */ + async createObj(){ + try{ + var {_MQTTClientSideId} = await MTS.createObj(); + var MQTTClientSideObj = new MQTTClientSide(); + MQTTClientSideObj.MQTTClientSideId = _MQTTClientSideId; + return MQTTClientSideObj; + }catch(e){ + console.error(e); + } + } + /** + * 创建连接。 + * @memberOf MQTTClientSide + * @param {string} URI - 服务地址 + * @param {string} userName - 账户 + * @param {string} passWord - 密码 + * @param {string} clientId - 客户端ID + * @returns {Promise.} + */ + async create(URI,userName,passWord,clientId){ + try{ + var {isConnection} = await MTS.create(this.MQTTClientSideId,URI,userName,passWord,clientId); + return isConnection; + }catch(e){ + console.error(e); + } + } + + /** + * 向topic主题发送消息。 + * @memberOf MQTTClientSide + * @param {string} topic - 主题名称 + * @param {string} message - 消息 + * @returns {Promise.} + */ + async sendMessage(topic,message){ + try{ + var {send} = await MTS.sendMessage(this.MQTTClientSideId,topic,message); + return send; + }catch(e){ + console.error(e); + } + } + + /** + * 接收消息 + * @memberOf MQTTClientSide + * @param {number} queueNum - 队列序号(1-5,默认为1) + * @param {function} loadingMessage - loadingMessage (e){}(e.topic 订阅主题;e.messgae 收到的消息) + * @returns {Promise.} + */ + async receiveMessage(queueNum,loadingMessage){ + try{ + switch(queueNum){ + case 1 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message1"; + break; + case 2 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message2"; + break; + case 3 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message3"; + break; + case 4 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message4"; + break; + case 5 : var str = "com.supermap.RN.JSAMQPReceiver.receive_message5"; + break; + default : var str = "com.supermap.RN.JSAMQPReceiver.receive_message1"; + } + //差异化处理 + if(Platform.OS === 'ios'){ + nativeEvt.addListener(str,function (e) { + if(typeof loadingMessage === 'function'){ + loadingMessage(e.topic,e.message); + }else{ + console.error("Please set a callback function to the first argument."); + } + }); + await MTS.receiveMessage(this.MQTTClientSideId,str); + } + }catch(e){ + console.error(e); + } + } + + /** + * 订阅某一主题 + * @memberOf MQTTClientSide + * @param {string} topicName - 订阅主题 + * @param {number} qos - 传输质量 + * @returns {Promise.} + */ + async subscribe(topicName,qos){ + try{ + var {isSubscribe} = await MTS.subscribe(this.MQTTClientSideId,topicName,qos); + }catch(e){ + console.error(e); + } + } + + /** + * 取消某一主题的订阅 + * @memberOf MQTTClientSide + * @param {string} topicName - 订阅主题 + * @returns {Promise.} + */ + async unsubscribe(topic){ + try{ + var {unSubscribe} = await MTS.unsubscribe(this.MQTTClientSideId,topic); + return unSubscribe; + }catch(e){ + console.error(e); + } + } + + /** + * 挂起 + * @memberOf MQTTClientSide + * @returns {Promise.} + */ + async suspend(){ + try{ + await MTS.suspend(this.MQTTClientSideId); + }catch(e){ + console.error(e); + } + } + + /** + * 唤醒 + * @memberOf MQTTClientSide + * @returns {Promise.} + */ + async resume(){ + try{ + var{isResume} = await MTS.resume(this.MQTTClientSideId); + return isResume; + }catch(e){ + console.error(e); + } + } + + /** + * 取消连接,并销毁对象 + * @memberOf MQTTClientSide + * @returns {Promise.} + */ + async dispose(){ + try{ + await MTS.dispose(this.MQTTClientSideId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/Map.js b/NativeModule/Map.js old mode 100644 new mode 100755 index 4675ecf6..d2b8f848 --- a/NativeModule/Map.js +++ b/NativeModule/Map.js @@ -1,536 +1,784 @@ -/** - * Created by will on 2016/6/17. - */ -import { NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform } from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules, DeviceEventEmitter, NativeEventEmitter, Platform } from 'react-native'; let M = NativeModules.JSMap; import Layer from './Layer.js'; import Layers from './Layers.js'; +import LayerGroup from './LayerGroup.js'; import Point2D from './Point2D.js'; import Point from './Point.js'; import TrackingLayer from './TrackingLayer.js'; +import PrjCoordSys from './PrjCoordSys.js'; const nativeEvt = new NativeEventEmitter(M); /** * @class Map + * @description 地图类,负责地图显示环境的管理。 */ -export default class Map{ - - /** - * 设置当前地图所关联的工作空间。地图是对其所关联的工作空间中的数据的显示。 - * @memberOf Map - * @param {object} workspace - * @returns {Promise.} - */ - async setWorkspace(workspace){ - try{ - await M.setWorkspace(this.mapId,workspace.workspaceId); - }catch(e){ - console.error(e); - } +export default class Map { + + /** + * 设置当前地图所关联的工作空间。地图是对其所关联的工作空间中的数据的显示。 + * @memberOf Map + * @param {object} workspace + * @returns {Promise.} + */ + async setWorkspace(workspace) { + try { + await M.setWorkspace(this._SMMapId, workspace._SMWorkspaceId); + } catch (e) { + console.error(e); } - - /** - * 重新绘制当前地图。 - * @memberOf Map - * @returns {Promise.} - */ - async refresh(){ - try{ - await M.refresh(this.mapId); - }catch(e){ - console.error(e); - } + } + + /** + * 重新绘制当前地图。 + * @memberOf Map + * @returns {Promise.} + */ + async refresh() { + try { + await M.refresh(this._SMMapId); + } catch (e) { + console.error(e); } + } + + /** + * 返回此图层集合中指定索引或名称的图层对象。 + * @memberOf Map + * @param {number | string} layerIndex|layerName - 指定索引或名称 + * @returns {Promise.} + */ + async getLayer(layerIndex) { + try { + var layer = new Layer(); + if (typeof layerIndex === "string") { + var { layerId } = await M.getLayerByName(this._SMMapId, layerIndex); + } else { + var { layerId } = await M.getLayer(this._SMMapId, layerIndex); + } + layer._SMLayerId = layerId; + let dataset = await layer.getDataset() + if (!dataset) { // 该图层为Layer + layer = new LayerGroup(); + layer._SMLayerId = layerId; + } - /** - * 返回此图层集合中指定索引或名称的图层对象。 - * @memberOf Map - * @param {number | string} layerIndex|layerName - 指定索引或名称 - * @returns {Promise.} - */ - async getLayer(layerIndex){ - try{ - var layer = new Layer(); - if(typeof layerIndex == "string"){ - var {layerId} = await M.getLayerByName(this.mapId,layerIndex); - }else{ - var {layerId} = await M.getLayer(this.mapId,layerIndex); - } - layer.layerId = layerId; - return layer; - }catch(e){ - console.error(e); - } + return layer; + } catch (e) { + console.error(e); } - - /** - * 用于把一个数据集添加到此地图作为一个普通图层显示,即创建一个普通图层。 - * @memberOf Map - * @param {object} dataset - * @param {boolean} addToHead - * @returns {Promise.} - */ - async addDataset(dataset,addToHead){ - try{ - await M.addDataset(this.mapId,dataset.datasetId,addToHead); - }catch(e){ - console.error(e); - } + } + + /** + * 获取根据类型分组的图层 + * @returns {Promise} + */ + async getLayersWithType() { + try { + let layers = await M.getLayersWithType(this._SMMapId); + + return layers + } catch (e) { + console.error(e); } + } + + // /** + // * 根据类型查找图层, type = -1 时,返回全部类型 + // * @returns {Promise} + // */ + // async getLayersByType(type = -1) { + // try { + // let layers = await M.getLayersByType(this._SMMapId, type); + // for (let i = 0; i < layers.length; i++) { + // let layer = new Layer() + // layer._SMLayerId = layers[i].id + // layers[i].layer = layer + // } + // return layers + // } catch (e) { + // console.error(e); + // } + // } - /** - * 返回当前地图所包含的图层集合对象。 - * @memberOf Map - * @deprecated - * @returns {Promise.} - */ - async getLayers(){ - console.warn("Map.js:getLayers() function has been deprecated. If you want to get Layer , please call the getLayer() function"); - try{ - var {layersId} = await M.getLayers(this.mapId); - var layers = new Layers(); - layers.layersId = layersId; - return layers; - }catch(e){ - console.error(e); + /** + * 根据类型查找图层, type = -1 时,返回全部类型 + * @returns {Promise} + */ + async getLayersByType(type = -1) { + try { + let layers = await M.getLayersByType(this._SMMapId, type); + for (let i = 0; i < layers.length; i++) { + let layer + if (layers[i].type === 'layerGroup') { + layer = new LayerGroup() + } else { + layer = new Layer() } + layer._SMLayerId = layers[i].id + layers[i].layer = layer + } + return layers + } catch (e) { + console.error(e); } - - /** - * 返回此图层集合中图层对象的总数。 - * @memberOf Map - * @returns {Promise.} - */ - async getLayersCount(){ - try{ - var {count} = await M.getLayersCount(this.mapId); - return count; - }catch(e){ - console.error(e); - } + } + + /** + * 用于把一个数据集添加到此地图作为一个普通图层显示,即创建一个普通图层。(@deprecated) + * @memberOf Map + * @param {object} dataset + * @param {boolean} addToHead + * @returns {Promise.} + */ + async addDataset(dataset, addToHead) { + console.warn("Map.js:addDataset() function has been deprecated. If you want to add Layer , please call the addLayer() function"); + try { + await M.addDataset(this._SMMapId, dataset._SMDatasetId, addToHead); + } catch (e) { + console.error(e); } - - /** - * 打开指定名称的地图。 - * @memberOf Map - * @param {string} mapName - 地图名称 - * @returns {Promise.} - */ - async open(mapName){ - try{ - await M.open(this.mapId,mapName); - }catch(e){ - console.error(e); - } + } + + /** + * 返回当前地图所包含的图层集合对象。 + * @memberOf Map + * @deprecated + * @returns {Promise.} + */ + async getLayers() { + console.warn("Map.js:getLayers() function has been deprecated. If you want to get Layer , please call the getLayer() function"); + try { + var { layersId } = await M.getLayers(this._SMMapId); + var layers = new Layers(); + layers._SMLayersId = layersId; + return layers; + } catch (e) { + console.error(e); } - - /** - * 将地图中指定点的像素坐标转换为地图坐标。 - * @memberOf Map - * @param {object} point - * @returns {Promise.} - */ - async pixelToMap(point){ - try{ - var {point2DId,x,y} = await M.pixelToMap(this.mapId,point.pointId); - var point2D = new Point2D(); - point2D.point2DId = point2DId; - point2D.x = x; - point2D.y = y; - return point2D; - }catch(e){ - console.error(e); - } + } + + /** + * 返回此图层集合中图层对象的总数。 + * @memberOf Map + * @returns {Promise.} + */ + async getLayersCount() { + try { + var { count } = await M.getLayersCount(this._SMMapId); + return count; + } catch (e) { + console.error(e); } - - /** - * 将地图中指定点的地图坐标转换为像素坐标。 - * @memberOf Map - * @param {object} point2D - * @returns {Promise.} - */ - async mapToPixel(point2D){ - try{ - var {pointId,x,y} = await M.mapToPixel(this.mapId,point2D.point2DId); - var point = new Point(); - point.pointId = pointId; - point.x = x; - point.y = y; - return point; - }catch(e){ - console.error(e); - } + } + + /** + * 打开指定名称的地图。 + * @memberOf Map + * @param {string} mapName - 地图名称 + * @returns {Promise.} + */ + async open(mapName) { + try { + await M.open(this._SMMapId, mapName); + } catch (e) { + console.error(e); } - - /** - * 获取当前地图的显示范围的中心点。 - * @memberOf Map - * @param {object} point2D - * @returns {Promise.} - */ - async getCenter(){ - try{ - var {point2DId,x,y} = await M.getCenter(this.mapId); - var point2D = new Point2D(); - point2D.point2DId = point2DId; - point2D.x = x; - point2D.y = y; - return point2D; - }catch(e){ - console.error(e); - } + } + + /** + * 关闭当前地图。 + * @memberOf Map + * @returns {Promise.} + */ + async close() { + try { + await M.close(this._SMMapId); + } catch (e) { + console.error(e); } - - /** - * 设置当前地图的显示范围的中心点。 - * @memberOf Map - * @param {object} point2D - * @returns {Promise.} - */ - async setCenter(point2D){ - try{ - await M.setCenter(this.mapId,point2D.point2DId); - }catch(e){ - console.error(e); - } + } + + /** + * 将地图中指定点的像素坐标转换为地图坐标。 + * @memberOf Map + * @param {object} point + * @returns {Promise.} + */ + async pixelToMap(point) { + try { + var { point2DId, x, y } = await M.pixelToMap(this._SMMapId, point._SMPointId); + var point2D = new Point2D(); + point2D._SMPoint2DId = point2DId; + point2D.x = x; + point2D.y = y; + return point2D; + } catch (e) { + console.error(e); } - - /** - * 返回当前地图的跟踪图层。 - * @memberOf Map - * @returns {Promise.} - */ - async getTrackingLayer(){ - try{ - var {trackingLayerId} = await M.getTrackingLayer(this.mapId); - var trackingLayer = new TrackingLayer(); - trackingLayer.trackingLayerId = trackingLayerId; - return trackingLayer; - }catch(e){ - console.error(e); - } + } + + /** + * 将地图中指定点的地图坐标转换为像素坐标。 + * @memberOf Map + * @param {object} point2D + * @returns {Promise.} + */ + async mapToPixel(point2D) { + try { + var { pointId, x, y } = await M.mapToPixel(this._SMMapId, point2D._SMPoint2DId); + var point = new Point(); + point._SMPointId = pointId; + point.x = x; + point.y = y; + return point; + } catch (e) { + console.error(e); } - - /** - * 将当前地图另存为指定名称的地图 - * @memberOf Map - * @param {string} mapName 地图名称 - * @returns {Promise.} - */ - async saveAs(mapName){ - try{ - var {saved} = await M.saveAs(this.mapId,mapName); - return saved; - }catch(e){ - console.error(e); - } + } + + /** + * 获取当前地图的显示范围的中心点。 + * @memberOf Map + * @param {object} point2D + * @returns {Promise.} + */ + async getCenter() { + try { + var { point2DId, x, y } = await M.getCenter(this._SMMapId); + var point2D = new Point2D(); + point2D._SMPoint2DId = point2DId; + point2D.x = x; + point2D.y = y; + return point2D; + } catch (e) { + console.error(e); } - - /** - * 返回当前地图的空间范围。 - * @memberOf Map - * @returns {Promise.} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} - */ - async getBounds(){ - try{ - var {bound} = await M.getBounds(this.mapId); - return bound; - }catch(e){ - console.error(e); - } + } + + /** + * 设置当前地图的显示范围的中心点。 + * @memberOf Map + * @param {object} point2D + * @returns {Promise.} + */ + async setCenter(point2D) { + try { + await M.setCenter(this._SMMapId, point2D._SMPoint2DId); + } catch (e) { + console.error(e); } - - /** - * 返回当前地图的可见范围,也称显示范围。 - * @memberOf Map - * @returns {Promise.} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} - */ - async getViewBounds(){ - try{ - var {bound} = await M.getViewBounds(this.mapId); - return bound; - }catch(e){ - console.error(e); - } + } + + /** + * 返回当前地图的跟踪图层。 + * @memberOf Map + * @returns {Promise.} + */ + async getTrackingLayer() { + try { + var { trackingLayerId } = await M.getTrackingLayer(this._SMMapId); + var trackingLayer = new TrackingLayer(); + trackingLayer._SMTrackingLayerId = trackingLayerId; + return trackingLayer; + } catch (e) { + console.error(e); } - - /** - * 设置当前地图的可见范围,也称显示范围。 - * @memberOf Map - * @param {object} bounds - Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} - * @returns {Promise.} - */ - async setViewBounds(bounds){ - try{ - await M.setViewBounds(this.mapId,bounds); - }catch(e){ - console.error(e); - } + } + + /** + * 将当前地图保存/另存为指定名称的地图 + * @memberOf Map + * @param {string} mapName 地图名称(可选参数) + * @returns {Promise.} + */ + async save(mapName) { + try { + if (mapName) { + var { saved } = await M.saveAs(this._SMMapId, mapName); + } else { + var { saved } = await M.save(this._SMMapId); + } + return saved; + } catch (e) { + console.error(e); + return false } - - /** - * 返回是否允许地图动态投影显示(该接口为安卓端专有接口,iOS无此接口)。 - * @memberOf Map - * @param {object} bounds - * @returns {Promise.} - */ - async isDynamicProjection(){ - try{ - var {is} = await M.isDynamicProjection(this.mapId); - return is; - }catch(e){ - console.error(e); - } + } + + /** + * 返回当前地图的空间范围。 + * @memberOf Map + * @returns {Promise.} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} + */ + async getBounds() { + try { + var { bound } = await M.getBounds(this._SMMapId); + return bound; + } catch (e) { + console.error(e); } - - /** - * 设置地图是否动态投影显示,以及地图的投影坐标系 - * @memberOf Map - * @param {boolean} value - 地图是否动态投影 - * @returns {Promise.} - */ - async setDynamicProjection(value){ - try{ - await M.setDynamicProjection(this.mapId,value); - }catch(e){ - console.error(e); - } + } + + /** + * 返回当前地图的可见范围,也称显示范围。 + * @memberOf Map + * @returns {Promise.} - 返回Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} + */ + async getViewBounds() { + try { + var { bound } = await M.getViewBounds(this._SMMapId); + return bound; + } catch (e) { + console.error(e); } - - /** - * 获取用于接收地图加载完成的监听器。 - * @memberOf Map - * @param {function} onMapLoaded - 地图打开并显示完成后触发该方法。 - * @returns {Promise.} - */ - async setMapLoadedListener(onMapLoaded){ - try{ - var success = await M.setMapLoadedListener(this.mapId); - - if(!success) return ; - //差异化处理 - if(Platform.OS === 'ios'){ - - nativeEvt.addListener("com.supermap.RN.JSMap.map_loaded",function (e) { - if(typeof onMapLoaded === 'function'){ - onMapLoaded(); - }else{ - console.error("Please set a callback function to the first argument."); - } - }); - return - } - - DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_loaded",function (e) { - if(typeof onMapLoaded === 'function'){ - onMapLoaded(); - }else{ - console.error("Please set a callback function to the first argument."); - } - }); - }catch(e){ - console.error(e); - } + } + + /** + * 设置当前地图的可见范围,也称显示范围。 + * @memberOf Map + * @param {object} bounds - Bounds的JSON对象:如{top:0,bottom:0,left:0,right:0,height:0,width:0,center:{x,y}} + * @returns {Promise.} + */ + async setViewBounds(bounds) { + try { + await M.setViewBounds(this._SMMapId, bounds); + } catch (e) { + console.error(e); } - - /** - * 添加一个用于接收地图打开、关闭事件的监听器。 - * @memberOf Map - * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:mapOpened和mapClosed。两个属性的值均为function类型,分部作为打开地图和关闭地图监听事件的处理函数。例:{"mapOpened":()=>return console.log('map opened'),"mapClosed":()=> console.log('map closed')} - * @returns {Promise.} - */ - async setMapOperateListener(events){ - try{ - var success = await M.setMapOperateListener(this.mapId); - - if(!success) return ; - //差异化处理 - if(Platform.OS === 'ios'){ - - nativeEvt.addListener("com.supermap.RN.JSMap.map_opened",function (e) { - if(typeof events.mapOpened === 'function'){ - events.mapOpened(); - }else{ - console.error("Please set a callback to the property 'mapOpened' in the first argument."); - } - }); - - nativeEvt.addListener("com.supermap.RN.JSMap.map_closed",function (e) { - if(typeof events.mapClosed === 'function'){ - events.mapClosed(); - }else{ - console.error("Please set a callback to the property 'mapClosed' in the first argument."); - } - }); - return - } - - DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_opened",function (e) { - if(typeof events.mapOpened === 'function'){ - events.mapOpened(); - }else{ - console.error("Please set a callback to the property 'mapOpened' in the first argument."); - } - }); - - DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_closed",function (e) { - if(typeof events.mapClosed === 'function'){ - events.mapClosed(); - }else{ - console.error("Please set a callback to the property 'mapClosed' in the first argument."); - } - }); - }catch(e){ - console.error(e); - } + } + + /** + * 返回是否允许地图动态投影显示(该接口为安卓端专有接口,iOS无此接口)。 + * @memberOf Map + * @param {object} bounds + * @returns {Promise.} + */ + async isDynamicProjection() { + try { + var { is } = await M.isDynamicProjection(this._SMMapId); + return is; + } catch (e) { + console.error(e); } - - /** - * 将地图平移指定的距离。 - * @memberOf Map - * @param {double} offsetX - X 方向上的移动距离,单位为坐标单位。 - * @param {double} offsetY - Y 方向上的移动距离,单位为坐标单位。 - * @returns {Promise.} - */ - async pan(offsetX,offsetY){ - try{ - await M.pan(this.mapId,offsetX,offsetY); - }catch(e){ - console.error(e); - } + } + + /** + * 设置地图是否动态投影显示,以及地图的投影坐标系 + * @memberOf Map + * @param {boolean} value - 地图是否动态投影 + * @returns {Promise.} + */ + async setDynamicProjection(value) { + try { + await M.setDynamicProjection(this._SMMapId, value); + } catch (e) { + console.error(e); } - - /** - * 全幅显示此地图。 - * @memberOf Map - * @returns {Promise.} - */ - async viewEntire(){ - try{ - await M.viewEntire(this.mapId); - }catch(e){ - console.error(e); + } + + /** + * 获取用于接收地图加载完成的监听器。 + * @memberOf Map + * @param {function} onMapLoaded - 地图打开并显示完成后触发该方法。 + * @returns {Promise.} + */ + async setMapLoadedListener(onMapLoaded) { + try { + var success = await M.setMapLoadedListener(this._SMMapId); + + if (!success) return; + //差异化处理 + if (Platform.OS === 'ios') { + + nativeEvt.addListener("com.supermap.RN.JSMap.map_loaded", function (e) { + if (typeof onMapLoaded === 'function') { + onMapLoaded(); + } else { + console.error("Please set a callback function to the first argument."); + } + }); + return + } + + DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_loaded", function (e) { + if (typeof onMapLoaded === 'function') { + onMapLoaded(); + } else { + console.error("Please set a callback function to the first argument."); } + }); + } catch (e) { + console.error(e); } - - /** - * 将地图放大或缩小指定的比例。 - * @memberOf Map - * @param {double} ratio - 缩放地图比例,此值不可以为负。 - * @returns {Promise.} - */ - async zoom(ratio){ - try{ - if(ratio < 0) throw new Error("Ratio can`t be nagative."); - await M.zoom(this.mapId,ratio); - }catch(e){ - console.error(e); + } + + /** + * 添加一个用于接收地图打开、关闭事件的监听器。 + * @memberOf Map + * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:mapOpened和mapClosed。两个属性的值均为function类型,分部作为打开地图和关闭地图监听事件的处理函数。例:{"mapOpened":()=>return console.log('map opened'),"mapClosed":()=> console.log('map closed')} + * @returns {Promise.} + */ + async setMapOperateListener(events) { + try { + var success = await M.setMapOperateListener(this._SMMapId); + + if (!success) return; + //差异化处理 + if (Platform.OS === 'ios') { + + nativeEvt.addListener("com.supermap.RN.JSMap.map_opened", function (e) { + if (typeof events.mapOpened === 'function') { + events.mapOpened(); + } else { + console.error("Please set a callback to the property 'mapOpened' in the first argument."); + } + }); + + nativeEvt.addListener("com.supermap.RN.JSMap.map_closed", function (e) { + if (typeof events.mapClosed === 'function') { + events.mapClosed(); + } else { + console.error("Please set a callback to the property 'mapClosed' in the first argument."); + } + }); + return + } + + DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_opened", function (e) { + if (typeof events.mapOpened === 'function') { + events.mapOpened(); + } else { + console.error("Please set a callback to the property 'mapOpened' in the first argument."); } - } - - /** - * 用于把一个数据集添加到此图层集合作为一个普通图层显示,即创建一个普通图层。其风格由系统默认设置。 - * @memberOf Map - * @param dataset - 要添加到图层的数据集。 - * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。 - * @returns {Promise.} - */ - async addLayer(dataset,addToHead){ - try{ - var {layerId} = await M.addLayer(this.mapId,dataset.datasetId,addToHead); - var layer = new Layer(); - layer.layerId = layerId; - return layer; - }catch(e){ - console.error(e); + }); + + DeviceEventEmitter.addListener("com.supermap.RN.JSMap.map_closed", function (e) { + if (typeof events.mapClosed === 'function') { + events.mapClosed(); + } else { + console.error("Please set a callback to the property 'mapClosed' in the first argument."); } + }); + } catch (e) { + console.error(e); + } + } + + /** + * 将地图平移指定的距离。 + * @memberOf Map + * @param {double} offsetX - X 方向上的移动距离,单位为坐标单位。 + * @param {double} offsetY - Y 方向上的移动距离,单位为坐标单位。 + * @returns {Promise.} + */ + async pan(offsetX, offsetY) { + try { + await M.pan(this._SMMapId, offsetX, offsetY); + } catch (e) { + console.error(e); + } + } + + /** + * 全幅显示此地图。 + * @memberOf Map + * @returns {Promise.} + */ + async viewEntire() { + try { + await M.viewEntire(this._SMMapId); + } catch (e) { + console.error(e); + } + } + + /** + * 将地图放大或缩小指定的比例。 + * @memberOf Map + * @param {double} ratio - 缩放地图比例,此值不可以为负。 + * @returns {Promise.} + */ + async zoom(ratio) { + try { + if (ratio < 0) throw new Error("Ratio can`t be nagative."); + await M.zoom(this._SMMapId, ratio); + } catch (e) { + console.error(e); + } + } + + /** + * 获取地图比例尺。 + * @memberOf Map + * @returns {Promise.} + */ + async getScale() { + try { + let { scale } = await M.getScale(this._SMMapId); + return scale; + } catch (e) { + console.error(e); + } + } + + /** + * 设置地图比例尺。 + * @memberOf Map + * @param {double} scale - 缩放地图比例,此值不可以为负。 + * @returns {Promise.} + */ + async setScale(scale) { + try { + if (scale < 0) throw new Error("Scale can`t be nagative."); + await M.setScale(this._SMMapId, scale); + } catch (e) { + console.error(e); } + } + + /** + * 用于把一个数据集添加到此图层集合作为一个普通图层显示,即创建一个普通图层。其风格由系统默认设置。 + * @memberOf Map + * @param dataset - 要添加到图层的数据集。 + * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。 + * @returns {Promise.} + */ + async addLayer(dataset, addToHead) { + try { + var { layerId } = await M.addLayer(this._SMMapId, dataset._SMDatasetId, addToHead); + var layer = new Layer(); + layer._SMLayerId = layerId; + return layer; + } catch (e) { + console.error(e); + } + } - /** - * 用于将一个数据集添加到此图层集合作为一个专题图层显示,即创建一个专题图层,并指定专题图层的专题图对象。 - * @memberOf Map - * @param dataset - 要添加到图层的数据集。 - * @param theme - 指定此专题图层的专题图对象。 - * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。 - * @returns {Promise.} - */ - async addThemeLayer(dataset,theme,addToHead){ - try{ - var {layerId} = await M.addThemeLayer(this.mapId,dataset.datasetId,theme.themeId,addToHead); - var layer = new Layer(); - layer.layerId = layerId; - return layer; - }catch(e){ - console.error(e); + /** + * 新建一个图层组,并将图层集合添加到图层组中 + * @param layers + * @param groupName + * @returns {Promise.} + */ + async addLayerGroup(groupName, layers = []) { + try { + if (layers.length > 0) { + let layerIds = [] + for (let i = 0; i < layers.length; i++) { + layerIds.push(layers[i]._SMLayerId) } + var layerId = await M.addLayerGroupWithLayers(this._SMMapId, layerIds, groupName); + } else { + var layerId = await M.addLayerGroup(this._SMMapId, groupName); + } + var layer = new LayerGroup(); + layer._SMLayerId = layerId; + return layer; + } catch (e) { + console.error(e); } - - /** - * 用于把一个图层移除。 - * @memberOf Map - * @param index - 要移除图层的名字或序号。 - * @returns {Promise.} - */ - async removeLayer(index){ - try{ - if(typeof index === 'string'){ - var {layerId} = await M.removeLayerByName(this.mapId,index); - }else if(typeof index === 'number'){ - var {layerId} = await M.removeLayerByIndex(this.mapId,index); - }else{ - throw new Error ('index must be number or string!'); - } - var layer = new Layer(); - layer.layerId = layerId; - return layer; - }catch(e){ - console.error(e); - } + } + + /** + * 用于将一个数据集添加到此图层集合作为一个专题图层显示,即创建一个专题图层,并指定专题图层的专题图对象。 + * @memberOf Map + * @param dataset - 要添加到图层的数据集。 + * @param theme - 指定此专题图层的专题图对象。 + * @param addToHead - 指定新创建图层是否放在图层集合的最上面一层。当设置为 false 时,则将此新创建图层放在最底层。 + * @returns {Promise.} + */ + async addThemeLayer(dataset, theme, addToHead) { + try { + var { layerId } = await M.addThemeLayer(this._SMMapId, dataset._SMDatasetId, theme._SMThemeId, addToHead); + var layer = new Layer(); + layer._SMLayerId = layerId; + return layer; + } catch (e) { + console.error(e); } - - /** - * 判断地图是否包含某个名字的图层。 - * @memberOf Map - * @param name - 图层的名字。 - * @returns {Promise.} 找到指定图层则返回图层索引,否则返回-1 - */ - async contains(name){ - try{ - var {isContain} = await M.contains(this.mapId,name); - return isContain; - }catch(e){ - console.error(e); - } + } + + /** + * 用于把一个图层移除。 + * @memberOf Map + * @param index - 要移除图层的名字或序号。 + * @returns {Promise.} + */ + async removeLayer(index) { + try { + let result + if (typeof index === 'string') { + result = await M.removeLayerByName(this._SMMapId, index); + } else if (typeof index === 'number') { + result = await M.removeLayerByIndex(this._SMMapId, index); + } else { + throw new Error('index must be number or string!'); + } + return result; + } catch (e) { + console.error(e); } - - /** - * 图层下移一层(图层的索引从 0 开始,从顶层开始依次编号)。 - * @memberOf Map - * @param name - 图层的名字。 - * @returns {Promise.} - */ - async moveDown(name){ - try{ - var {moved} = await M.moveDown(this.mapId,name); - return moved; - }catch(e){ - console.error(e); - } + } + + /** + * 判断地图是否包含某个名字的图层。 + * @memberOf Map + * @param name - 图层的名字。 + * @returns {Promise.} 找到指定图层则返回图层索引,否则返回-1 + */ + async contains(name) { + try { + var { isContain } = await M.contains(this._SMMapId, name); + return isContain; + } catch (e) { + console.error(e); } - - /** - * 图层下移一层(图层的索引从 0 开始,从顶层开始依次编号)。 - * @memberOf Map - * @param name - 图层的名字。 - * @returns {Promise.} - */ - async moveUp(name){ - try{ - var {moved} = await M.moveUp(this.mapId,name); - return moved; - }catch(e){ - console.error(e); - } + } + + /** + * 判断地图是否包含某个名字的数据集。(比较Caption) + * @param name - 数据集名称 + * @param datasourceName - 数据源名称 + * @returns {Promise.} + */ + async containsCaption(name, datasourceName) { + try { + var { isContain } = await M.containsCaption(this._SMMapId, name, datasourceName); + return isContain; + } catch (e) { + console.error(e); + } + } + + /** + * 将指定位置的图层移动到另一个指定位置 + * @param from + * @param to + * @returns {Promise.} + */ + async moveTo(from, to) { + try { + return await M.moveTo(this._SMMapId, from, to); + } catch (e) { + console.error(e); + } + } + + /** + * 图层下移一层(图层的索引从 0 开始,从顶层开始依次编号)。 + * @memberOf Map + * @param name - 图层的名字。 + * @returns {Promise.} + */ + async moveDown(name) { + try { + var { moved } = await M.moveDown(this._SMMapId, name); + return moved; + } catch (e) { + console.error(e); + } + } + + /** + * 图层上移一层(图层的索引从 0 开始,从顶层开始依次编号)。 + * @memberOf Map + * @param name - 图层的名字。 + * @returns {Promise.} + */ + async moveUp(name) { + try { + var { moved } = await M.moveUp(this._SMMapId, name); + return moved; + } catch (e) { + console.error(e); + } + } + + /** + * 插入一个图层 + * @param index + * @param layer + * @returns {Promise.|List|void|List.>} + */ + async insert(index, layer) { + try { + return await M.insert(this._SMMapId, index, layer._SMLayerId); + } catch (e) { + console.error(e); } + } + + /** + * 判断当前地图是否被更改 + * @returns {Promise.} + */ + async isModified() { + try { + var { isModified } = await M.isModified(this._SMMapId); + return isModified; + } catch (e) { + console.error(e); + } + } + + /** + * 返回地图的投影坐标系统 + * @returns {Promise.} + */ + async getPrjCoordSys() { + try { + let prjCoordSysId = await M.getPrjCoordSys(this._SMMapId); + let prjCoordSys = new PrjCoordSys() + prjCoordSys._SMPrjCoordSysId = prjCoordSysId + return prjCoordSys; + } catch (e) { + console.error(e); + } + } + + /** + * 返回地图的名称 + * @returns {Promise.} + */ + async getName() { + try { + return await M.getName(this._SMMapId); + } catch (e) { + console.error(e); + } + } + + /** + * 获取地图XML + * @returns {Promise.} + */ + async toXML() { + try { + return await M.toXML(this._SMMapId); + } catch (e) { + console.error(e); + } + } + + /** + * 释放地图 + * @returns {Promise.} + */ + async dispose() { + try { + return await M.dispose(this._SMMapId); + } catch (e) { + console.error(e); + } + } + + } diff --git a/NativeModule/MapControl.js b/NativeModule/MapControl.js old mode 100644 new mode 100755 index d995ad9f..518caec0 --- a/NativeModule/MapControl.js +++ b/NativeModule/MapControl.js @@ -1,9 +1,12 @@ -/** - * Created by will on 2016/6/17. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ const LONGPRESS_EVENT = "com.supermap.RN.JSMapcontrol.long_press_event"; -import { NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform } from 'react-native'; +import { NativeModules, DeviceEventEmitter, NativeEventEmitter, Platform, Dimensions } from 'react-native'; let MC = NativeModules.JSMapControl; import Map from './Map.js'; import Navigation2 from './IndustryNavi.js'; @@ -13,6 +16,7 @@ import GeoRegion from './GeoRegion.js'; import GeoLine from './GeoLine.js'; import Geometry from './Geometry.js'; import Layer from './Layer.js'; +import Collector from './Collector'; const nativeEvt = new NativeEventEmitter(MC); @@ -26,844 +30,1158 @@ const nativeEvt = new NativeEventEmitter(MC); CREATEPOINT:在可编辑图层上点击式绘点。 CREATEPOLYLINE:在可编辑图层中点击式绘直线。 CREATEPOLYGON:在可编辑图层中点击式绘多边形。 + ERASE_REGION // 擦除面对象 + SPLIT_BY_LINE // 使用线切分 + UNION_REGION // 面与面合并 + COMPOSE_REGION // 面与面组合 + PATCH_HOLLOW_REGION // 切割岛洞多边形 + INTERSECT_REGION // 填充导洞对象 + FILL_HOLLOW_REGION // 求交面对象 + PATCH_POSOTIONAL_REGION // 多对象补洞 + MOVE_COMMON_NODE // 公共点编辑(协调编辑) + CREATE_POSITIONAL_REGION // 公共边构面 + SPLIT_BY_DRAWLINE // 面被线分割(手绘式) + DRAWREGION_HOLLOW_REGION // 手绘岛洞面(手绘式) + DRAWREGION_ERASE_REGION // 面被面擦除(手绘式) + SPLIT_BY_DRAWREGION // 面被面分割(手绘式) + MOVE_GEOMETRY // 平移对象 + MULTI_SELECT // 多选对象 + SWIPE // 卷帘模式 */ -export default class MapControl{ - - /** - * 返回在地图控件中显示的地图对象。 - * @memberOf MapControl - * @returns {Promise.} - */ - async getMap(){ - try{ - var {mapId} =await MC.getMap(this.mapControlId); - var map = new Map(); - map.mapId = mapId; - return map; - }catch(e){ - console.error(e); - } +export default class MapControl { + + /** + * 返回在地图控件中显示的地图对象。 + * @memberOf MapControl + * @returns {Promise.} + */ + async getMap() { + try { + var { mapId } = await MC.getMap(this._SMMapControlId); + var map = new Map(); + map._SMMapId = mapId; + return map; + } catch (e) { + console.error(e); } - - /** - * 设置地图控件中地图的当前操作状态。 - * @memberOf MapControl - * @param {number} actionType - * @returns {Promise.} - */ - async setAction(actionType){ - try{ - await MC.setAction(this.mapControlId,actionType); - }catch(e){ - console.error(e); - } + } + + /** + * 设置地图控件中地图的当前操作状态。 + * @memberOf MapControl + * @param {number} actionType + * @returns {Promise.} + */ + async setAction(actionType) { + try { + console.log(actionType) + await MC.setAction(this._SMMapControlId, actionType); + } catch (e) { + console.error(e); } - - /** - * 提交操作,对于采集而言,该接口将把采集的新几何对象写入到数据集,对于编辑,则是更新数据集中的正在编辑的对象。 - * @memberOf MapControl - * @returns {Promise.} - */ - async submit(){ - try{ - var submited = await MC.submit(this.mapControlId); - return submited; - }catch (e){ - console.error(e); - } + } + + /** + * 提交操作,对于采集而言,该接口将把采集的新几何对象写入到数据集,对于编辑,则是更新数据集中的正在编辑的对象。 + * @memberOf MapControl + * @returns {Promise.} + */ + async submit() { + try { + var submited = await MC.submit(this._SMMapControlId); + return submited; + } catch (e) { + console.error(e); } - - /** - * 监听编辑行为的变更事件 - * @memberOf MapControl - * @param {function} actionChange 编辑行为变更函数,回调事件参数:e:newAction,e:oldAction - */ - async addActionChangedListener(actionChange){ - try{ - DeviceEventEmitter.addListener('ActionChange', function(e) { - actionChange && actionChange(e); - }); - if(typeof actionChange == "function"){ - await MC.addActionChangedListener(this.mapControlId); - }else{ - throw new Error("addActionChangedListener need a callback function as first argument!"); - } - }catch (e){ - console.error(e); + } + + /** + * 监听编辑行为的变更事件(deprecated) + * @memberOf MapControl + * @param {function} actionChange 编辑行为变更函数,回调事件参数:e:newAction,e:oldAction + */ + /* + async addActionChangedListener(actionChange){ + try{ + DeviceEventEmitter.addListener('ActionChange', function(e) { + actionChange && actionChange(e); + }); + if(typeof actionChange == "function"){ + await MC.addActionChangedListener(this.mapControlId); + }else{ + throw new Error("addActionChangedListener need a callback function as first argument!"); + } + }catch (e){ + console.error(e); + } + } + */ + + + /** + * 移除动作变更监听器。(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeActionChangedListener(actionChange){ + try{ + await MC.removeActionChangedListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 手势监听 + * @memberOf MapControl + * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:longPressHandler和scrollHandler。两个属性的值均为function类型,分部作为长按与滚动监听事件的处理函数。 + * @returns {Promise.} + */ + async setGestureDetector(handlers) { + try { + if (handlers) { + await MC.setGestureDetector(this._SMMapControlId); + } else { + throw new Error("setGestureDetector need callback functions as first two argument!"); + } + //差异化 + if (Platform.OS === 'ios') { + if (typeof handlers.longPressHandler === "function") { + nativeEvt.addListener("com.supermap.RN.JSMapcontrol.long_press_event", function (e) { + // longPressHandler && longPressHandler(e); + handlers.longPressHandler(e); + }); } - } - - /** - * 移除动作变更监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeActionChangedListener(actionChange){ - try{ - await MC.removeActionChangedListener(this.mapControlId); - }catch (e){ - console.error(e); + + if (typeof handlers.singleTapHandler === "function") { + nativeEvt.addListener("com.supermap.RN.JSMapcontrol.single_tap_event", function (e) { + handlers.singleTapHandler(e); + }); } - } - - /** - * 监听导航事件 - * @memberOf MapControl - * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:longPressHandler和scrollHandler。两个属性的值均为function类型,分部作为长按与滚动监听事件的处理函数。 - * @returns {Promise.} - */ - async setGestureDetector(handlers){ - try{ - if(handlers){ - await MC.setGestureDetector(this.mapControlId); - }else{ - throw new Error("setGestureDetector need callback functions as first two argument!"); - } - //差异化 - if(Platform.OS === 'ios'){ - if(typeof handlers.longPressHandler === "function"){ - nativeEvt.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) { - // longPressHandler && longPressHandler(e); - handlers.longPressHandler(e); - }); - } - - if(typeof handlers.scrollHandler === "function"){ - nativeEvt.addListener('com.supermap.RN.JSMapcontrol.scroll_event',function (e) { - scrollHandler && scrollHandler(e); - }); - } - }else{ - if(typeof handlers.longPressHandler === "function"){ - DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) { - // longPressHandler && longPressHandler(e); - handlers.longPressHandler(e); - }); - } - - if(typeof handlers.scrollHandler === "function"){ - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.scroll_event',function (e) { - scrollHandler && scrollHandler(e); - }); - } - } - - }catch (e){ - console.error(e); + + if (typeof handlers.doubleTapHandler === "function") { + nativeEvt.addListener("com.supermap.RN.JSMapcontrol.double_tap_event", function (e) { + handlers.doubleTapHandler(e); + }); } - } - - async deleteGestureDetector(){ - try{ - await MC.deleteGestureDetector(this.mapControlId) - }catch (e){ - console.error(e); + + if (typeof handlers.touchBeganHandler === "function") { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.touch_began_event', function (e) { + handlers.touchBeganHandler(e); + }); } - } - - /** - * 监听地图参数变化,分别由边界变化sizeChanged,比例尺变化scaleChanged,角度变化angleChanged,中心点变化boundsChanged(iOS目前只支持比例尺变化监听与中心点变化监听)。 - * @memberOf MapControl - * @param events 该对象有下面四个函数类型的属性分别处理四种监听事件 - * {boundsChanged,scaleChanged,angleChanged,sizeChanged} - */ - async setMapParamChangedListener(events){ - try{ - boundsChanged = events.boundsChanged; - scaleChanged = events.scaleChanged; - angleChanged = events.angleChanged; - sizeChanged = events.sizeChanged; - - var success = await MC.setMapParamChangedListener(this.mapControlId); - console.debug("Listening map parameters changed."); - - if(!success) return; - //差异化处理 - if(Platform.OS === 'ios'){ - nativeEvt.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged',function (e) { - if(typeof boundsChanged == 'function'){ - events.boundsChanged(e); - }else{ - console.error("Please set a callback to the property 'boundsChanged' in the first argument."); - } - }); - nativeEvt.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged',function (e) { - if(typeof events.scaleChanged == 'function'){ - events.scaleChanged(e); - }else{ - console.error("Please set a callback to the property 'scaleChanged' in the first argument."); - } - }); - - return - } - - DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged',function (e) { - if(typeof boundsChanged == 'function'){ - events.boundsChanged(e); - }else{ - console.error("Please set a callback to the property 'boundsChanged' in the first argument."); - } - }); - DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged',function (e) { - if(typeof events.scaleChanged == 'function'){ - events.scaleChanged(e); - }else{ - console.error("Please set a callback to the property 'scaleChanged' in the first argument."); - } - }); - DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.AngleChanged',function (e) { - if(typeof events.angleChanged == 'function' ){ - events.angleChanged(e); - }else { - console.error("Please set a callback to the property 'angleChanged' in the first argument."); - } - }); - DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.SizeChanged',function (e) { - if(typeof events.sizeChanged == 'function' ){ - events.sizeChanged(e); - }else { - console.error("Please set a callback to the property 'sizeChanged' in the first argument."); - } - }); - }catch(e){ - console.error(e); + + if (typeof handlers.touchEndHandler === "function") { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.touch_end_event', function (e) { + handlers.touchEndHandler(e); + }); } - } - - /** - * 地图刷新监听器 - * @memberOf MapControl - * @param {function} callback - 刷新处理回调函数 - * @returns {Promise.} - */ - async setRefreshListener(callback){ - try{ - var success = await MC.setRefreshListener(this.mapControlId); - console.log("MapControl:test result:",success); - if(success){ - DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.refresh_event",function (e) { - // console.log("MapControl:监听到地图刷新"); - if(typeof callback == 'function'){ - callback(e); - }else{ - console.error("Please set a callback function as the first argument."); - } - }); - } - }catch(e){ - console.error(e); + + if (typeof handlers.scrollHandler === "function") { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.scroll_event', function (e) { + handlers.scrollHandler(e); + }); } - } - - /** - * 获得当前Geometry几何对象 - * @memberOf MapControl - * @returns {Promise.} - */ - async getCurrentGeometry(){ - try{ - var {geometryId,geoType} = await MC.getCurrentGeometry(this.mapControlId); - - if(geoType == "GeoPoint"){ - var geoPoint = new GeoPoint(); - geoPoint.geoPointId = geometryId; - }else if(geoType == "GeoRegion"){ - var geoRegion = new GeoRegion(); - geoRegion.geoRegionId = geometryId; - }else if(geoType == "GeoLine"){ - var geoLine = new GeoLine(); - geoLine.geoLineId = geometryId; - }else{ - var geometry = new Geometry(); - geometry.geometryId = geometryId; - } - return geoPoint || geoLine || geoRegion || geometry; - }catch (e){ - console.error(e); + } else { + if (typeof handlers.longPressHandler === "function") { + DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.long_press_event", function (e) { + // longPressHandler && longPressHandler(e); + handlers.longPressHandler(e); + }); } - } - - /** - * 获取导航控件 - * @memberOf MapControl - * @returns {Promise.} - */ - async getIndustryNavi(){ - try{ - var {navigation2Id} = await MC.getNavigation2(this.mapControlId); - var navigation2 = new Navigation2(); - navigation2.navigation2Id = navigation2Id; - return navigation2; - }catch (e){ - console.error(e); + + if (typeof handlers.singleTapHandler === "function") { + DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.single_tap_event", function (e) { + handlers.singleTapHandler(e); + }); } - } - - /** - * 设置横竖屏切换监听器。 - * @memberOf MapControl - * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:toHorizontalScreen和toVerticalScreen。两个属性的值均为function类型,分部作为横屏与竖屏监听事件的处理函数。 - * @returns {Promise.} - */ - async setConfigurationChangedListener(events){ - try{ - var success = await MC. setConfigurationChangedListener(); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_horizontal_screen',function (e) { - if(typeof events.toHorizontal_screen == 'function'){ - events.toHorizontalScreen(); - }else{ - console.error("Please set a callback to the property 'toHorizontalScreen' in the first argument."); - } - }); - DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_verticalscreen',function (e) { - if(typeof events.toVerticalScreen == 'function'){ - events.toVerticalScreen(); - }else{ - console.error("Please set a callback to the property 'toVerticalScreen' in the first argument."); - } - }); - - }catch (e){ - console.error(e); + + if (typeof handlers.doubleTapHandler === "function") { + DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.double_tap_event", function (e) { + handlers.doubleTapHandler(e); + }); } - } - - /** - * 获得传统导航控件 - * @memberOf MapControl - * @returns {Promise.} - */ - async getTraditionalNavi(){ - try{ - var {traditionalNaviId} = await MC.getTraditionalNavi(this.mapControlId); - var traditionalNavi= new TraditionalNavi(); - traditionalNavi.traditionalNaviId = traditionalNaviId; - return traditionalNavi; - }catch (e){ - console.error(e); + + if (typeof handlers.touchBeganHandler === "function") { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.touch_began_event', function (e) { + handlers.touchBeganHandler(e); + }); } - } - - /** - * 返回地图控件中地图的当前操作状态。 - * @memberOf MapControl - * @returns {Promise.} - */ - async getAction(){ - try{ - var {actionType} = await MC.getAction(this.mapControlId); - for( p in this.ACTION){ - if(this.ACTION[p] === actionType){ - console.log("MapControl.js:"+p); - return p; - }else{ - throw new Error("Unknown Type"); - } - } - }catch (e){ - console.error(e); + + if (typeof handlers.touchEndHandler === "function") { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.touch_end_event', function (e) { + handlers.touchEndHandler(e); + }); } - } - - /** - * 地图窗口上恢复上一步的操作。 - * @memberOf MapControl - * @returns {Promise.} - */ - async redo(){ - try{ - var {redone} = await MC.redo(this.mapControlId); - return redone; - }catch (e){ - console.error(e); + + if (typeof handlers.scrollHandler === "function") { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.scroll_event', function (e) { + handlers.scrollHandler(e); + }); } + } + + } catch (e) { + console.error(e); } - - /** - * 地图控件上撤消上一次的操作。 - * @memberOf MapControl - * @returns {Promise.} - */ - async undo(){ - try{ - var {undone} = await MC.undo(this.mapControlId); - return undone; - }catch (e){ - console.error(e); - } + } + + /** + * 移除手势监听 + * @memberOf MapControl + * @returns {Promise.} + */ + async deleteGestureDetector() { + try { + await MC.deleteGestureDetector(this._SMMapControlId) + } catch (e) { + console.error(e); } - - /** - * 取消操作,对于采集而言,新建的未提交的数据将被清除,对于编辑,将回到上一次提交保存的状态。 - * @memberOf MapControl - * @returns {Promise.} - */ - async cancel(){ - try{ - var {canceled} = await MC.cancel(this.mapControlId); - return canceled; - }catch (e){ - console.error(e); + } + + /** + * 监听地图参数变化,分别由边界变化sizeChanged,比例尺变化scaleChanged,角度变化angleChanged,中心点变化boundsChanged(iOS目前只支持比例尺变化监听与中心点变化监听)。 + * @memberOf MapControl + * @param events 该对象有下面四个函数类型的属性分别处理四种监听事件 + * {boundsChanged,scaleChanged,angleChanged,sizeChanged} + */ + async setMapParamChangedListener(events) { + try { + boundsChanged = events.boundsChanged; + scaleChanged = events.scaleChanged; + angleChanged = events.angleChanged; + sizeChanged = events.sizeChanged; + + var success = await MC.setMapParamChangedListener(this._SMMapControlId); + console.debug("Listening map parameters changed."); + + if (!success) return; + //差异化处理 + if (Platform.OS === 'ios') { + nativeEvt.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged', function (e) { + if (typeof boundsChanged == 'function') { + events.boundsChanged(e); + } else { + console.error("Please set a callback to the property 'boundsChanged' in the first argument."); + } + }); + nativeEvt.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged', function (e) { + if (typeof events.scaleChanged == 'function') { + events.scaleChanged(e); + } else { + console.error("Please set a callback to the property 'scaleChanged' in the first argument."); + } + }); + + return + } + + DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.BoundsChanged', function (e) { + if (typeof boundsChanged == 'function') { + events.boundsChanged(e); + } else { + console.error("Please set a callback to the property 'boundsChanged' in the first argument."); } - } - - /** - * 删除当前绘制出来的几何对象。 - * @memberOf MapControl - * @returns {Promise.} - */ - async deleteCurrentGeometry(){ - try{ - var {deleted} = await MC.deleteCurrentGeometry(this.mapControlId); - return deleted; - }catch (e){ - console.error(e); + }); + DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.ScaleChanged', function (e) { + if (typeof events.scaleChanged == 'function') { + events.scaleChanged(e); + } else { + console.error("Please set a callback to the property 'scaleChanged' in the first argument."); } - } - - /** - * 获取当前编辑图层 - * @memberOf MapControl - * @returns {Promise.} - */ - async getEditLayer(){ - try{ - var {layerId} = await MC.getEditLayer(this.mapControlId); - var layer = new Layer(); - layer.layerId = layerId; - return layer; - }catch (e){ - console.error(e); + }); + DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.AngleChanged', function (e) { + if (typeof events.angleChanged == 'function') { + events.angleChanged(e); + } else { + console.error("Please set a callback to the property 'angleChanged' in the first argument."); } - } - - /** - * 添加对象删除完成监听器。 - * @memberOf MapControl - * @param {object} event - event:{geometryDeleted: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,被删除对象id,删除结果canceled,ture为删除成功,否则为false. - * @returns {Promise.} - */ - async addGeometryDeletedListener(event){ - try{ - var success = await MC.addGeometryDeletedListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.geometry_deleted',function (e) { - if(typeof event.geometryDeleted === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - event.geometryDeleted(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); + }); + DeviceEventEmitter.addListener('Supermap.MapControl.MapParamChanged.SizeChanged', function (e) { + if (typeof events.sizeChanged == 'function') { + events.sizeChanged(e); + } else { + console.error("Please set a callback to the property 'sizeChanged' in the first argument."); } + }); + } catch (e) { + console.error(e); } - - /** - * 移除对象删除完成监听器 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometryDeletedListener(){ - try{ - await MC. removeGeometryDeletedListener(this.mapControlId); - }catch (e){ - console.error(e); - } + } + + /** + * 地图刷新监听器(deprecated) + * @memberOf MapControl + * @param {function} callback - 刷新处理回调函数 + * @returns {Promise.} + */ + + async setRefreshListener(callback) { + try { + var success = await MC.setRefreshListener(this._SMMapControlId); + console.log("MapControl:test result:", success); + if (success) { + DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.refresh_event", function (e) { + // console.log("MapControl:监听到地图刷新"); + if (typeof callback === 'function') { + callback(e); + } else { + console.error("Please set a callback function as the first argument."); + } + }); + } + } catch (e) { + console.error(e); } - - /** - * 添加对象添加监听器 - * @memberOf MapControl - * @param {object} event - event:{geometryAdded: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. - * @returns {Promise.<*>} - */ - async addGeometryAddedListener(event){ - try{ - var success = await MC.addGeometryAddedListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.grometry_added',function (e) { - if(typeof event.geometryAdded === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - event.geometryAdded(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); - } + } + + + /** + * 获得当前Geometry几何对象 + * @memberOf MapControl + * @returns {Promise.} + */ + async getCurrentGeometry() { + try { + var { geometryId, geoType } = await MC.getCurrentGeometry(this._SMMapControlId); + + if (geoType == "GeoPoint") { + var geoPoint = new GeoPoint(); + geoPoint._SMGeoPointId = geometryId; + } else if (geoType == "GeoRegion") { + var geoRegion = new GeoRegion(); + geoRegion._SMGeoRegionId = geometryId; + } else if (geoType == "GeoLine") { + var geoLine = new GeoLine(); + geoLine._SMGeoLineId = geometryId; + } else { + var geometry = new Geometry(); + geometry._SMGeometryId = geometryId; + } + return geoPoint || geoLine || geoRegion || geometry; + } catch (e) { + console.error(e); } - - /** - * 移除对象添加监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometryAddedListener(){ - try{ - await MC. removeGeometryAddedListener(this.mapControlId); - }catch (e){ - console.error(e); - } + } + + /** + * 获取导航控件 + * @memberOf MapControl + * @returns {Promise.} + */ + async getIndustryNavi() { + try { + var { navigation2Id } = await MC.getNavigation2(this._SMMapControlId); + var navigation2 = new Navigation2(); + navigation2._SMNavigation2Id = navigation2Id; + return navigation2; + } catch (e) { + console.error(e); } - - /** - * 添加对象删除完成前监听器。 - * @memberOf MapControl - * @param {object} event - event:{geometryDeleting: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. - * @returns {Promise.<*>} - */ - async addGeometryDeletingListener(event){ - try{ - var success = await MC.addGeometryDeletingListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_deleting',function (e) { - if(typeof event.geometryDeleting === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - event.geometryDeleting(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); - } + } + + /** + * 设置横竖屏切换监听器。(deprecated) + * @memberOf MapControl + * @param {object} events - 传入一个对象作为参数,该对象可以包含两个属性:toHorizontalScreen和toVerticalScreen。两个属性的值均为function类型,分部作为横屏与竖屏监听事件的处理函数。 + * @returns {Promise.} + */ + /* + async setConfigurationChangedListener(events){ + try{ + var success = await MC. setConfigurationChangedListener(); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_horizontal_screen',function (e) { + if(typeof events.toHorizontal_screen == 'function'){ + events.toHorizontalScreen(); + }else{ + console.error("Please set a callback to the property 'toHorizontalScreen' in the first argument."); + } + }); + DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.to_verticalscreen',function (e) { + if(typeof events.toVerticalScreen == 'function'){ + events.toVerticalScreen(); + }else{ + console.error("Please set a callback to the property 'toVerticalScreen' in the first argument."); + } + }); + + }catch (e){ + console.error(e); + } + } + */ + + /** + * 获得传统导航控件 + * @memberOf MapControl + * @returns {Promise.} + */ + async getTraditionalNavi() { + try { + var { traditionalNaviId } = await MC.getTraditionalNavi(this._SMMapControlId); + var traditionalNavi = new TraditionalNavi(); + traditionalNavi._SMTraditionalNaviId = traditionalNaviId; + return traditionalNavi; + } catch (e) { + console.error(e); } - - /** - * 移除对象删除完成前监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometryDeletingListener(){ - try{ - await MC. removeGeometryDeletingListener(this.mapControlId); - }catch (e){ - console.error(e); - } + } + + /** + * 返回地图控件中地图的当前操作状态。 + * @memberOf MapControl + * @returns {Promise.} + */ + async getAction() { + try { + var { actionType } = await MC.getAction(this._SMMapControlId); + var actionStr = 'type'; + switch (actionType) { + case 0 : + actionStr = 'NONEACTION'; + break; + case 1 : + actionStr = 'PAN'; + break; + case 8 : + actionStr = 'SELECT'; + break; + case 54 : + actionStr = 'VERTEXEDIT'; + break; + case 55 : + actionStr = 'VERTEXADD'; + break; + case 56 : + actionStr = 'DELETENODE'; + break; + case 16 : + actionStr = 'CREATEPOINT'; + break; + case 17 : + actionStr = 'CREATEPOLYLINE'; + break; + case 27 : + actionStr = 'CREATEPOLYGON'; + break; + case 1001 : + actionStr = 'MEASURELENGTH'; + break; + case 1002 : + actionStr = 'MEASUREAREA'; + break; + case 1003 : + actionStr = 'MEASUREANGLE'; + break; + case 199 : + actionStr = 'FREEDRAW'; + break; + case 3000 : + actionStr = 'CREATEPLOT'; + break; + case 201 : + actionStr = 'ERASE_REGION'; + break; + case 202 : + actionStr = 'SPLIT_BY_LINE'; + break; + case 203 : + actionStr = 'UNION_REGION'; + break; + case 204 : + actionStr = 'COMPOSE_REGION'; + break; + case 205 : + actionStr = 'PATCH_HOLLOW_REGION'; + break; + case 207 : + actionStr = 'INTERSECT_REGION'; + break; + case 206 : + actionStr = 'FILL_HOLLOW_REGION'; + break; + case 208 : + actionStr = 'PATCH_POSOTIONAL_REGION'; + break; + case 209 : + actionStr = 'MOVE_COMMON_NODE'; + break; + case 210 : + actionStr = 'CREATE_POSITIONAL_REGION'; + break; + case 215 : + actionStr = 'SPLIT_BY_DRAWLINE'; + break; + case 216 : + actionStr = 'DRAWREGION_HOLLOW_REGION'; + break; + case 217 : + actionStr = 'DRAWREGION_ERASE_REGION'; + break; + case 218 : + actionStr = 'SPLIT_BY_DRAWREGION'; + break; + case 301 : + actionStr = 'MOVE_GEOMETRY'; + break; + case 305 : + actionStr = 'MULTI_SELECT'; + break; + case 501 : + actionStr = 'SWIPE'; + break; + default : + throw new Error("Unknown Action Type"); + } + return actionStr; + } catch (e) { + console.error(e); } - - /** - * 添加对象修改完成监听器 - * @memberOf MapControl - * @param {object} event - event:{geometryModified: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. - * @returns {Promise.<*>} - */ - async addGeometryModifiedListener(event){ - try{ - var success = await MC.addGeometryModifiedListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modified',function (e) { - if(typeof event.geometryModified === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - event.geometryModified(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); - } + } + + /** + * 地图窗口上恢复上一步的操作。 + * @memberOf MapControl + * @returns {Promise.} + */ + async redo() { + try { + var { redone } = await MC.redo(this._SMMapControlId); + return redone; + } catch (e) { + console.error(e); } - - /** - * 移除对象删除完成前监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometryModifiedListener(){ - try{ - await MC. removeGeometryModifiedListener(this.mapControlId); - }catch (e){ - console.error(e); - } + } + + /** + * 地图控件上撤消上一次的操作。 + * @memberOf MapControl + * @returns {Promise.} + */ + async undo() { + try { + var { undone } = await MC.undo(this._SMMapControlId); + return undone; + } catch (e) { + console.error(e); } - - /** - * 添加对象修改前监听器 - * @memberOf MapControl - * @param event - event:{geometryModifying: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. - * @returns {Promise.<*>} - */ - async addGeometryModifyingListener(event){ - try{ - var success = await MC.addGeometryModifyingListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modifying',function (e) { - if(typeof event.geometryModifying === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - event.geometryModifying(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); - } + } + + /** + * 取消操作,对于采集而言,新建的未提交的数据将被清除,对于编辑,将回到上一次提交保存的状态。 + * @memberOf MapControl + * @returns {Promise.} + */ + async cancel() { + try { + var { canceled } = await MC.cancel(this._SMMapControlId); + return canceled; + } catch (e) { + console.error(e); } - - /** - * 移除对象修改完成监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometryModifyingListener(){ - try{ - await MC. removeGeometryModifyingListener(this.mapControlId); - }catch (e){ - console.error(e); - } + } + + /** + * 删除当前绘制出来的几何对象。 + * @memberOf MapControl + * @returns {Promise.} + */ + async deleteCurrentGeometry() { + try { + var { deleted } = await MC.deleteCurrentGeometry(this._SMMapControlId); + return deleted; + } catch (e) { + console.error(e); } - - /** - * 添加对象修改前监听器 - * @memberOf MapControl - * @param events - events:{geometrySelected: e => {...},geometryMultiSelected e => {...}} - * geometrySelected 单个集合对象被选中事件的回调函数,参数e为获取结果 e:{layer:--, id:--} layer:操作的图层,操作对象id. - * geometryMultiSelected 多个集合对象被选中事件的回调函数,参数e为获取结果数组:e:{geometries:[layer:--,id:--]} - * @returns {Promise.<*>} - */ - async addGeometrySelectedListener(events){ - try{ - var success = await MC.addGeometrySelectedListener(this.mapControlId); - if(!success) return ; - //差异化 - if(Platform.OS === 'ios'){ - nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_selected',function (e) { - if(typeof events.geometrySelected === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - events.geometrySelected(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected',function (e) { - if(typeof events.geometryMultiSelected === 'function'){ - e.geometries.map(function (geometry) { - var layer = new Layer(); - layer.layerId = geometry.layerId; - geometry.layer = layer; - }) - events.geometryMultiSelected(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - }else{ - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_selected',function (e) { - if(typeof events.geometrySelected === 'function'){ - var layer = new Layer(); - layer.layerId = e.layerId; - e.layer = layer; - events.geometrySelected(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected',function (e) { - if(typeof events.geometryMultiSelected === 'function'){ - e.geometries.map(function (geometry) { - var layer = new Layer(); - layer.layerId = geometry.layerId; - geometry.layer = layer; - }) - events.geometryMultiSelected(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - } - return success; - }catch (e){ - console.error(e); - } + } + + /** + * 获取当前编辑图层 + * @memberOf MapControl + * @returns {Promise.} + */ + async getEditLayer() { + try { + var { layerId } = await MC.getEditLayer(this._SMMapControlId); + var layer = new Layer(); + layer._SMLayerId = layerId; + return layer; + } catch (e) { + console.error(e); } - - /** - * 移除对象选中监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeGeometrySelectedListener(){ - try{ - await MC. removeGeometrySelectedListener(this.mapControlId); - }catch (e){ - console.error(e); + } + + /** + * 添加对象删除完成监听器。(deprecated) + * @memberOf MapControl + * @param {object} event - event:{geometryDeleted: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,被删除对象id,删除结果canceled,ture为删除成功,否则为false. + * @returns {Promise.} + */ + /* + async addGeometryDeletedListener(event){ + try{ + var success = await MC.addGeometryDeletedListener(this._SMMapControlId); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapControl.geometry_deleted',function (e) { + if(typeof event.geometryDeleted === 'function'){ + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + event.geometryDeleted(e); + }else{ + console.error("Please set a callback to the first argument."); + } + }); + return success; + }catch (e){ + console.error(e); + } + } + */ + + /** + * 移除对象删除完成监听器(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeGeometryDeletedListener(){ + try{ + await MC. removeGeometryDeletedListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 添加对象添加监听器 + * @memberOf MapControl + * @param {object} event - event:{geometryAdded: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. + * @returns {Promise.<*>} + */ + async addGeometryAddedListener(event) { + try { + var success = await MC.addGeometryAddedListener(this._SMMapControlId); + if (!success) return; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.grometry_added', function (e) { + if (typeof event.geometryAdded === 'function') { + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + event.geometryAdded(e); + } else { + console.error("Please set a callback to the first argument."); } + }); + return success; + } catch (e) { + console.error(e); } - - /** - * 添加对象修改前监听器 - * @memberOf MapControl - * @param events - events:{lengthMeasured: e => {...},areaMeasured: e => {...},e => {...},angleMeasured: e => {...}} - * lengthMeasured 长度量算结果。 e:{curResult:--, curPoint:{x:--,y--} + } + + /** + * 移除对象添加监听器。 + * @memberOf MapControl + * @returns {Promise.} + */ + async removeGeometryAddedListener() { + try { + await MC.removeGeometryAddedListener(this._SMMapControlId); + } catch (e) { + console.error(e); + } + } + + /** + * 添加对象删除完成前监听器。(deprecated) + * @memberOf MapControl + * @param {object} event - event:{geometryDeleting: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. + * @returns {Promise.<*>} + */ + /* + async addGeometryDeletingListener(event){ + try{ + var success = await MC.addGeometryDeletingListener(this._SMMapControlId); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_deleting',function (e) { + if(typeof event.geometryDeleting === 'function'){ + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + event.geometryDeleting(e); + }else{ + console.error("Please set a callback to the first argument."); + } + }); + return success; + }catch (e){ + console.error(e); + } + } + */ + + /** + * 移除对象删除完成前监听器。(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeGeometryDeletingListener(){ + try{ + await MC. removeGeometryDeletingListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 添加对象修改完成监听器(deprecated) + * @memberOf MapControl + * @param {object} event - event:{geometryModified: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. + * @returns {Promise.<*>} + */ + /* + async addGeometryModifiedListener(event){ + try{ + var success = await MC.addGeometryModifiedListener(this._SMMapControlId); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modified',function (e) { + if(typeof event.geometryModified === 'function'){ + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + event.geometryModified(e); + }else{ + console.error("Please set a callback to the first argument."); + } + }); + return success; + }catch (e){ + console.error(e); + } + } + */ + + /** + * 移除对象删除完成前监听器。(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeGeometryModifiedListener(){ + try{ + await MC. removeGeometryModifiedListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 添加对象修改前监听器(deprecated) + * @memberOf MapControl + * @param event - event:{geometryModifying: e => {...}} e:{layer:--, id:--,canceled:--} layer:操作的图层,操作对象id,操作结果canceled,ture为操作成功,否则为false. + * @returns {Promise.<*>} + */ + /* + async addGeometryModifyingListener(event){ + try{ + var success = await MC.addGeometryModifyingListener(this._SMMapControlId); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_modifying',function (e) { + if(typeof event.geometryModifying === 'function'){ + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + event.geometryModifying(e); + }else{ + console.error("Please set a callback to the first argument."); + } + }); + return success; + }catch (e){ + console.error(e); + } + } + */ + + /** + * 移除对象修改完成监听器。(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeGeometryModifyingListener(){ + try{ + await MC. removeGeometryModifyingListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 添加对象修改前监听器 + * @memberOf MapControl + * @param events - events:{geometrySelected: e => {...},geometryMultiSelected e => {...}} + * geometrySelected 单个集合对象被选中事件的回调函数,参数e为获取结果 e:{layer:--, id:--} layer:操作的图层,操作对象id. + * geometryMultiSelected 多个集合对象被选中事件的回调函数,参数e为获取结果数组:e:{geometries:[layer:--,id:--]} + * @returns {Promise.<*>} + */ + async addGeometrySelectedListener(events) { + try { + var success = await MC.addGeometrySelectedListener(this._SMMapControlId); + if (!success) return; + //差异化 + if (Platform.OS === 'ios') { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_selected', function (e) { + if (typeof events.geometrySelected === 'function') { + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + events.geometrySelected(e); + } else { + console.error("Please set a callback to the first argument."); + } + }); + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected', function (e) { + if (typeof events.geometryMultiSelected === 'function') { + e.geometries.map(function (geometry) { + var layer = new Layer(); + layer._SMLayerId = geometry.layerId; + geometry.layer = layer; + }) + events.geometryMultiSelected(e); + } else { + console.error("Please set a callback to the first argument."); + } + }); + } else { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_selected', function (e) { + if (typeof events.geometrySelected === 'function') { + var layer = new Layer(); + layer._SMLayerId = e.layerId; + e.layer = layer; + events.geometrySelected(e); + } else { + console.error("Please set a callback to the first argument."); + } + }); + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.geometry_multi_selected', function (e) { + if (typeof events.geometryMultiSelected === 'function') { + e.geometries.map(function (geometry) { + var layer = new Layer(); + layer._SMLayerId = geometry.layerId; + geometry.layer = layer; + }) + events.geometryMultiSelected(e); + } else { + console.error("Please set a callback to the first argument."); + } + }); + } + return success; + } catch (e) { + console.error(e); + } + } + + /** + * 移除对象选中监听器。 + * @memberOf MapControl + * @returns {Promise.} + */ + async removeGeometrySelectedListener() { + try { + await MC.removeGeometrySelectedListener(this._SMMapControlId); + } catch (e) { + console.error(e); + } + } + + /** + * 添加量算回调监听器 + * @memberOf MapControl + * @param events - events:{lengthMeasured: e => {...},areaMeasured: e => {...},e => {...},angleMeasured: e => {...}} + * lengthMeasured 长度量算结果。 e:{curResult:--, curPoint:{x:--,y--} * areaMeasured 面积量算结果。 e:{curResult:--, curPoint:{x:--,y--} * angleMeasured 测量角度结果 通过设置Action.MEASUREANGLE实现测量角度。 e:{curAngle:--, curPoint:{x:--,y--} - * @returns {Promise.<*>} - */ - async addMeasureListener(events){ - try{ - var success = await MC.addGeometryModifyingListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.length_measured',function (e) { - if(typeof events.lengthMeasured === 'function'){ - events.lengthMeasured(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.area_measured',function (e) { - if(typeof events.areaMeasured === 'function'){ - events.areaMeasured(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.angle_measured',function (e) { - if(typeof events.angleMeasured === 'function'){ - events.angleMeasured(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); + * @returns {Promise.<*>} + */ + async addMeasureListener(events) { + try { + var success = await MC.addMeasureListener(this._SMMapControlId); + if (!success) return; + if (Platform.OS === 'ios') { + if (typeof events.lengthMeasured === 'function') { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.length_measured', function (e) { + events.lengthMeasured(e); + }); } - } - - /** - * 移除量算监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeMeasureListener(){ - try{ - await MC. removeMeasureListener(this.mapControlId); - }catch (e){ - console.error(e); + if (typeof events.areaMeasured === 'function') { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.area_measured', function (e) { + events.areaMeasured(e); + }); } - } - - /** - * 设置Undo监听器。 - * @memberOf MapControl - * @param event - event:{undoStateChange: e => {...}} e:{canUndo:--,canRedo:--} 返回参数canUndo表示是否可取消,canRedo表示是否可重复 - * @returns {Promise.<*>} - */ - async addUndoStateChangeListener(event){ - try{ - var success = await MC.addUndoStateChangeListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.undo_state_change',function (e) { - if(typeof event.undoStateChange === 'function'){ - event.undo_state_change(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); + if (typeof events.angleMeasured === 'function') { + nativeEvt.addListener('com.supermap.RN.JSMapcontrol.angle_measured', function (e) { + events.angleMeasured(e); + }); } - } - - /** - * 移除Undo监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeUndoStateChangeListener(){ - try{ - await MC.removeUndoStateChangeListener(this.mapControlId); - }catch (e){ - console.error(e); + } else { + if (typeof events.lengthMeasured === 'function') { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.length_measured', function (e) { + events.lengthMeasured(e); + }); + } + if (typeof events.areaMeasured === 'function') { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.area_measured', function (e) { + events.areaMeasured(e); + }); + } + if (typeof events.angleMeasured === 'function') { + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.angle_measured', function (e) { + events.angleMeasured(e); + }); } + } + + return success; + } catch (e) { + console.error(e); } - - /** - * 设置编辑状态监听器。 - * @memberOf MapControl - * @param events - events:{addNodeEnable: e => {...},deleteNodeEnable: e => {...}} - * addNodeEnable: 添加节点有效。e:{isEnable:--} - * deleteNodeEnable: 删除节点有效。 e:{isEnable:--} - * @returns {Promise.<*>} - */ - async setEditStatusListener(events){ - try{ - var success = await MC.setEditStatusListener(this.mapControlId); - if(!success) return ; - - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.add_node_enable',function (e) { - if(typeof events.addNodeEnable === 'function'){ - events.addNodeEnable(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.delete_node_enable',function (e) { - if(typeof events.deleteNodeEnable === 'function'){ - events.deleteNodeEnable(e); - }else{ - console.error("Please set a callback to the first argument."); - } - }); - return success; - }catch (e){ - console.error(e); + } + + /** + * 移除量算监听器。 + * @memberOf MapControl + * @returns {Promise.} + */ + async removeMeasureListener() { + try { + return await MC.removeMeasureListener(this._SMMapControlId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Undo监听器。(deprecated) + * @memberOf MapControl + * @param event - event:{undoStateChange: e => {...}} e:{canUndo:--,canRedo:--} 返回参数canUndo表示是否可取消,canRedo表示是否可重复 + * @returns {Promise.<*>} + */ + /* + async addUndoStateChangeListener(event){ + try{ + var success = await MC.addUndoStateChangeListener(this._SMMapControlId); + if(!success) return ; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.undo_state_change',function (e) { + if(typeof event.undoStateChange === 'function'){ + event.undo_state_change(e); + }else{ + console.error("Please set a callback to the first argument."); + } + }); + return success; + }catch (e){ + console.error(e); + } + } + */ + + /** + * 移除Undo监听器。(deprecated) + * @memberOf MapControl + * @returns {Promise.} + */ + /* + async removeUndoStateChangeListener(){ + try{ + await MC.removeUndoStateChangeListener(this._SMMapControlId); + }catch (e){ + console.error(e); + } + } + */ + + /** + * 设置编辑状态监听器。 + * @memberOf MapControl + * @param events - events:{addNodeEnable: e => {...},deleteNodeEnable: e => {...}} + * addNodeEnable: 添加节点有效。e:{isEnable:--} + * deleteNodeEnable: 删除节点有效。 e:{isEnable:--} + * @returns {Promise.<*>} + */ + async setEditStatusListener(events) { + try { + var success = await MC.setEditStatusListener(this._SMMapControlId); + if (!success) return; + + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.add_node_enable', function (e) { + if (typeof events.addNodeEnable === 'function') { + events.addNodeEnable(e); + } else { + console.error("Please set a callback to the first argument."); + } + }); + DeviceEventEmitter.addListener('com.supermap.RN.JSMapcontrol.delete_node_enable', function (e) { + if (typeof events.deleteNodeEnable === 'function') { + events.deleteNodeEnable(e); + } else { + console.error("Please set a callback to the first argument."); } + }); + return success; + } catch (e) { + console.error(e); + } + } + + /** + * 添加、删除节点事件的监听器。 + * @memberOf MapControl + * @returns {Promise.} + */ + async removeEditStatusListener() { + try { + await MC.removeEditStatusListener(this._SMMapControlId); + } catch (e) { + console.error(e); + } + } + + /** + * 添加标绘库。 + * @memberOf MapControl + * @returns {Promise.} + */ + async addPlotLibrary(url) { + try { + var libId = await MC.addPlotLibrary(this._SMMapControlId, url); + return libId; + } catch (e) { + console.error(e); + } + } + + /** + * 添加标绘库。 + * @memberOf MapControl + * @returns {Promise.} + */ + async removePlotLibrary(libId) { + try { + var isRemove = await MC.removePlotLibrary(this._SMMapControlId, libId); + } catch (e) { + console.error(e); } + } + + /** + * 设置标绘图案。 + * @memberOf MapControl + * @returns {Promise.} + */ + async setPlotSymbol(libId, symbolCode) { + try { + var isSet = await MC.setPlotSymbol(this._SMMapControlId, libId, symbolCode); + } catch (e) { + console.error(e); + } + } + + /** + * 返回采集类 + * @returns {Promise.} + */ + async getCollector() { + try { + let id = await MC.getCollector(this._SMMapControlId); + let collector = new Collector() + collector._SMCollectorId = id + return collector + } catch (e) { + console.error(e); + } + } + + /** + * 将当前显示内容绘制到指定位图上, 并获取路径 + * @params params Object + * mapView Object + * width int + * height int + * quality int 0 - 100 + * type string png, jpg/jpeg, webp + * @returns {Promise.<{result: Promise.result, uri: Promise.uri}>} + */ + async outputMap(params = {}) { + try { + let paramss = {width: 2000, height: 2000, quality: 60, type: 'png', mapViewId: ''} + Object.assign(paramss, params, {mapViewId: params.mapView._SMMapViewId}) + let { result, uri } = await MC.outputMap(this._SMMapControlId, paramss.mapViewId, paramss.width, paramss.height, paramss.quality, paramss.type); + return { result, uri } + } catch (e) { + console.error(e); + } + } - /** - * 添加、删除节点事件的监听器。 - * @memberOf MapControl - * @returns {Promise.} - */ - async removeEditStatusListener(){ - try{ - await MC.removeEditStatusListener(this.mapControlId); - }catch (e){ - console.error(e); - } + /** + * 指定编辑几何对象 + * @param geoID + * @param layer + * @returns {Promise} + */ + async appointEditGeometry(geoID, layer) { + try { + return await MC.appointEditGeometry(this._SMMapControlId, geoID, layer._SMLayerId); + } catch (e) { + console.error(e); } -} + } -MapControl.ACTION = { - PAN:1, - VERTEXADD:55, - VERTEXDELETE:56, - SELECT:8, - VERTEXEDIT:54, - CREATEPOINT:16, - CREATEPOLYLINE:17, - CREATEPOLYGON:27, + /** + * 释放对象 + * @returns {Promise.} + */ + async dispose() { + try { + await MC.dispose(this._SMMapControlId); + } catch (e) { + console.error(e); + } + } + + // /** + // * 设置touch监听 + // * @returns {Promise.} + // */ + // async setOnTouchListener(events) { + // try { + // let success = await MC.setOnTouchListener(this._SMMapControlId); + // if (!success) return; + // nativeEvt.addListener('com.supermap.RN.JSMapcontrol.touch_up', function (e) { + // if (typeof events.onTouchUp === 'function') { + // events.onTouchUp(e); + // } else { + // console.error("Please set a callback to the first argument."); + // } + // }); + // } catch (e) { + // console.error(e); + // } + // } } diff --git a/NativeModule/MapView.js b/NativeModule/MapView.js old mode 100644 new mode 100755 index cad9a033..6468a66d --- a/NativeModule/MapView.js +++ b/NativeModule/MapView.js @@ -1,6 +1,9 @@ -/** - * Created by will on 2016/6/17. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + Description: iOS中该类只是一个概念虚类,实际功能由mapControl完成。 + **********************************************************************************/ import { NativeModules,Platform } from 'react-native'; let MV = NativeModules.JSMapView; import MapControl from './MapControl.js'; @@ -8,6 +11,7 @@ import Point2D from './Point2D.js'; /** * @class MapView + * @description 地图显示控件容器类。 */ export default class JSMapView{ static NAVIGATION_STARTPOINT = "startpoint"; @@ -20,9 +24,9 @@ export default class JSMapView{ */ async getMapControl(){ try{ - var {mapControlId} =await MV.getMapControl(this.mapViewId); + var {mapControlId} =await MV.getMapControl(this._SMMapViewId); var mapControl = new MapControl(); - mapControl.mapControlId = mapControlId; + mapControl._SMMapControlId = mapControlId; return mapControl; }catch (e){ console.error(e); @@ -38,9 +42,9 @@ export default class JSMapView{ */ async addPoint(point2D,pointName){ try{ - var {eth_point2DId} = await MV.addPoint(this.mapViewId,point2D.point2DId,pointName); + var {eth_point2DId} = await MV.addPoint(this._SMMapViewId,point2D._SMPoint2DId,pointName); var point2D = new Point2D(); - point2D.point2DId = eth_point2DId; + point2D._SMPoint2DId = eth_point2DId; return point2D; }catch (e){ console.error(e); @@ -54,7 +58,7 @@ export default class JSMapView{ */ async refresh(){ try{ - await MV.refresh(this.mapViewId); + await MV.refresh(this._SMMapViewId); }catch(e){ console.error(e); } @@ -69,7 +73,7 @@ export default class JSMapView{ */ async addCallOut(callOut,pointName){ try{ - await MV.addCallOut(this.mapViewId,callOut.callOutId,pointName); + await MV.addCallOut(this._SMMapViewId,callOut._SMCallOutId,pointName); }catch(e){ console.error(e); } @@ -82,9 +86,9 @@ export default class JSMapView{ */ async showCallOut(){ try{ - await MV.showCallOut(this.mapViewId); + await MV.showCallOut(this._SMMapViewId); }catch(e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/Maps.js b/NativeModule/Maps.js old mode 100644 new mode 100755 index ac20b322..929b61e1 --- a/NativeModule/Maps.js +++ b/NativeModule/Maps.js @@ -1,7 +1,9 @@ -/** - * Created by will on 2016/7/4. - */ - +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import { NativeModules } from 'react-native'; let M = NativeModules.JSMaps; @@ -11,17 +13,32 @@ let M = NativeModules.JSMaps; */ export default class Maps{ /** - * 根据序号返回地图 + * 根据序号返回地图名称 * @memberOf Maps * @param {number} index - 地图序号 * @returns {Promise.<*>} */ async get(index){ try{ - var {mapName} = await M.get(this.mapsId,index); + var {mapName} = await M.get(this._SMMapsId,index); return mapName; }catch(e){ console.error(e); } } -} \ No newline at end of file + + /** + * 获取地图数目 + * @memberOf Maps + * @returns {Promise.} + */ + async getCount(){ + try{ + var {count} = await M.getCount(this._SMMapsId); + return count; + }catch(e){ + console.error(e); + } + } + +} diff --git a/NativeModule/Navigation2.js b/NativeModule/Navigation2.js deleted file mode 100644 index 989f94a5..00000000 --- a/NativeModule/Navigation2.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Created by will on 2016/7/12. - */ -import {NativeModules} from 'react-native'; -let N = NativeModules.JSNavigation2; -import Dataset from './Dataset.js'; - -/** - * @class Navigation2 - 行业导航类,提供基于拓扑路网的路径分析与导引。 - */ -export default class Navigation2{ - /** - * 设置路径可见 - * @memberOf Navigation2 - * @param {boolean} visible - 设置分析路径是否可见。 - * @returns {Promise.} - */ - async setPathVisible(visible){ - try{ - await N.setPathVisible(this.navigation2Id,visible); - }catch (e){ - console.error(e); - } - } - - /** - * 设置用于分析的网络数据集。必选。 - * @memberOf Navigation2 - * @param {object} datasetVector - 网络数据集。 - * @returns {Promise.} - */ - async setNetworkDataset(datasetVector){ - try{ - await N.setNetworkDataset(this.navigation2Id,datasetVector.datasetVectorId); - }catch (e){ - console.error(e); - } - } - - /** - * 加载内存文件。 - * @memberOf Navigation2 - * @param {string} path - 内存文件路径。 - * @returns {Promise.} - */ - async loadModel(path){ - try{ - await N.loadModel(this.navigation2Id,path); - }catch(e){ - console.error(e); - } - } - - /** - * 设置导航起点 - * @memberOf Navigation2 - * @param x - 起点横坐标 - * @param y - 起点纵坐标 - * @returns {Promise.} - */ - async setStartPoint(x,y,map){ - try{ - console.log("科学计数法?"+ x); - await N.setStartPoint(this.navigation2Id,x,y,map.mapId); - }catch(e){ - console.error(e); - } - } - - /** - * 设置导航终点 - * @memberOf Navigation2 - * @param x - 终点横坐标 - * @param y - 终点纵坐标 - * @returns {Promise.} - */ - async setDestinationPoint(x,y,map){ - try{ - await N.setDestinationPoint(this.navigation2Id,x,y,map.mapId); - }catch(e){ - console.error(e); - } - } - - /** - * 路径分析 - * @returns {Promise.} - */ - async routeAnalyst(){ - try{ - var {finished} = await N.routeAnalyst(this.navigation2Id); - return finished; - }catch(e){ - console.error(e); - } - } - - /** - * 开始导航 - * @param guideMode - 导航模式:1:真实导航;2:模拟导航 - * @returns {Promise.} - */ - async startGuide(guideMode){ - try{ - var {isGuiding} = await N.startGuide(this.navigation2Id,guideMode); - return isGuiding; - }catch(e){ - console.error(e); - } - } -} \ No newline at end of file diff --git a/NativeModule/OnlineService.js b/NativeModule/OnlineService.js new file mode 100644 index 00000000..9226fafd --- /dev/null +++ b/NativeModule/OnlineService.js @@ -0,0 +1,111 @@ +import { NativeModules, DeviceEventEmitter, NativeEventEmitter, Platform } from 'react-native'; +import { EventConst } from './constains' +let OS = NativeModules.JSOnlineService; +const nativeEvt = new NativeEventEmitter(OS); + +//OnlinService +export default class OnlineService { + + // Onlin 下载数据文件 + // String path 文件保存路径 + // String username 用户名(用于登陆online) + // String passworld 密码 + // String filename 文件名称 + + async download(path, filename, handlers) { + try { + if (Platform.OS === 'ios' && handlers) { + if (typeof handlers.onProgress === 'function') { + nativeEvt.addListener(EventConst.ONLINE_SERVICE_DOWNLOADING, function (e) { + handlers.onProgress(e) + }) + } + if (typeof handlers.onComplete === 'function') { + nativeEvt.addListener(EventConst.ONLINE_SERVICE_DOWNLOADED, function (e) { + handlers.onComplete(e) + }) + } + if (typeof handlers.onFailure === 'function') { + nativeEvt.addListener(EventConst.ONLINE_SERVICE_DOWNLOADFAILURE, function (e) { + handlers.onFailure(e) + }) + } + } else if (Platform.OS === 'android' && handlers) { + if (typeof handlers.onProgress === "function") { + DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_DOWNLOADING, function (e) { + handlers.onProgress(e); + }); + } + if (typeof handlers.onComplete === "function") { + DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_DOWNLOADED, function (e) { + handlers.onComplete(e); + }); + } + if (typeof handlers.onFailure === "function") { + DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_DOWNLOADFAILURE, function (e) { + handlers.onFailure(e); + }); + } + } + OS.download(path, filename) + } catch (e) { + console.error(e); + } + } + async upload(path, filename) { + try { + if (Platform.OS === 'ios' && handlers) { + // if (typeof handlers.onProgress === 'function') { + // nativeEvt.addListener(EventConst.ONLINE_SERVICE_DOWNLOADING, function (e) { + // handlers.onProgress(e) + // }) + // } + if (typeof handlers.onComplete === 'function') { + nativeEvt.addListener(EventConst.ONLINE_SERVICE_UPLOADED, function (e) { + handlers.onComplete(e) + }) + } + if (typeof handlers.onFailure === 'function') { + nativeEvt.addListener(EventConst.ONLINE_SERVICE_UPLOADFAILURE, function (e) { + handlers.onFailure(e) + }) + } + } else if (Platform.OS === 'android' && handlers) { + // if (typeof handlers.onProgress === "function") { + // DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_DOWNLOADING, function (e) { + // handlers.onProgress(e); + // }); + // } + if (typeof handlers.onComplete === "function") { + DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_UPLOADED, function (e) { + handlers.onComplete(e); + }); + } + if (typeof handlers.onFailure === "function") { + DeviceEventEmitter.addListener(EventConst.ONLINE_SERVICE_UPLOADFAILURE, function (e) { + handlers.onFailure(e); + }); + } + } + OS.upload(path, filename) + } catch (e) { + console.error(e); + } + } + async login(username, passworld) { + try { + let result = await OS.login(username, passworld) + return result; + } catch (e) { + console.error(e); + } + } + async logout() { + try { + let result = await OS.logout() + return result; + } catch (e) { + console.error(e); + } + } +} \ No newline at end of file diff --git a/NativeModule/OverlayAnalyst.js b/NativeModule/OverlayAnalyst.js old mode 100644 new mode 100755 index 7cef13e0..8c45035b --- a/NativeModule/OverlayAnalyst.js +++ b/NativeModule/OverlayAnalyst.js @@ -1,146 +1,152 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let OA = NativeModules.JSOverlayAnalyst; /** * @Class OverlayAnalyst - * 叠加分析类(静态类) + * @description 叠加分析类(静态类) * 该类用于对输入的两个数据集或记录集之间进行各种叠加分析运算,如裁剪(clip)、擦除(erase)、合并(union)、同一(identity)、对称差(xOR)和更新(update)。 */ export default class OverlayAnalyst { - /** - * 对矢量数据集进行裁剪,将被裁减数据集(第一个数据集)中不在裁剪数据集(第二个数据集)内的对象裁剪并删除。 - * @memberOf OverlayAnalyst - * @param {object} datasetVector - 被裁减的数据集,也称第一数据集。该数据集的类型可以是点、线和面。 - * @param {object} clipDatasetVector - 用于裁剪的数据集,也称第二数据集。该数据集类型必须是面。 - * @param {object} resultDatasetVector - 存放裁剪结果的数据集。 - * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。此处该对象设置无效。 - * @returns {Promise.} - */ - async clip(datasetVector,clipDatasetVector,resultDatasetVector,paramter){ - try{ - var {clipped} = await OA.clip(datasetVector.datasetVectorId,clipDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return clipped; - }catch(e){ - console.error(e); - } + /** + * 对矢量数据集进行裁剪,将被裁减数据集(第一个数据集)中不在裁剪数据集(第二个数据集)内的对象裁剪并删除。 + * @memberOf OverlayAnalyst + * @param {object} datasetVector - 被裁减的数据集,也称第一数据集。该数据集的类型可以是点、线和面。 + * @param {object} clipDatasetVector - 用于裁剪的数据集,也称第二数据集。该数据集类型必须是面。 + * @param {object} resultDatasetVector - 存放裁剪结果的数据集。 + * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。此处该对象设置无效。 + * @returns {Promise.} + */ + async clip(datasetVector, clipDatasetVector, resultDatasetVector, paramter) { + try { + var { clipped } = await OA.clip(datasetVector._SMDatasetVectorId, clipDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return clipped; + } catch (e) { + console.error(e); } - - /** - * 用于对数据集进行擦除方式的叠加分析,将第一个数据集中包含在第二个数据集内的对象裁剪并删除。 - * @memberOf OverlayAnalyst - * @param {object} datasetVector - 被擦除的数据集,也称第一数据集。该数据集类型为点、线和面类型。 - * @param {object} eraseDatasetVector - 用于擦除的数据集,也称第二数据集。该数据集类型必须是面数据集类型。 - * @param {object} resultDatasetVector - 存放分析结果的数据集。 - * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async erase(datasetVector,eraseDatasetVector,resultDatasetVector,paramter){ - try{ - var {erased} = await OA.erase(datasetVector.datasetVectorId,eraseDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return erased; - }catch(e){ - console.error(e); - } + } + + /** + * 用于对数据集进行擦除方式的叠加分析,将第一个数据集中包含在第二个数据集内的对象裁剪并删除。 + * @memberOf OverlayAnalyst + * @param {object} datasetVector - 被擦除的数据集,也称第一数据集。该数据集类型为点、线和面类型。 + * @param {object} eraseDatasetVector - 用于擦除的数据集,也称第二数据集。该数据集类型必须是面数据集类型。 + * @param {object} resultDatasetVector - 存放分析结果的数据集。 + * @param {object} paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async erase(datasetVector, eraseDatasetVector, resultDatasetVector, paramter) { + try { + var { erased } = await OA.erase(datasetVector._SMDatasetVectorId, eraseDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return erased; + } catch (e) { + console.error(e); } - - /** - * 用于对数据集进行同一方式的叠加分析,结果数据集中保留被同一运算的数据集的全部对象和被同一运算的数据集与用来进行同一运算的数据集相交的对象。 - * @memberOf OverlayAnalyst - * @param datasetVector - 被同一运算的数据集,可以是点、线、面类型。 - * @param identityDatasetVector - 用来进行同一运算的数据集,必须为面类型。 - * @param resultDatasetVector - 存放分析结果的数据集。 - * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async identity(datasetVector,identityDatasetVector,resultDatasetVector,paramter){ - try{ - var {identified} = await OA.identity(datasetVector.datasetVectorId,identityDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return identified; - }catch(e){ - console.error(e); - } + } + + /** + * 用于对数据集进行同一方式的叠加分析,结果数据集中保留被同一运算的数据集的全部对象和被同一运算的数据集与用来进行同一运算的数据集相交的对象。 + * @memberOf OverlayAnalyst + * @param datasetVector - 被同一运算的数据集,可以是点、线、面类型。 + * @param identityDatasetVector - 用来进行同一运算的数据集,必须为面类型。 + * @param resultDatasetVector - 存放分析结果的数据集。 + * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async identity(datasetVector, identityDatasetVector, resultDatasetVector, paramter) { + try { + var { identified } = await OA.identity(datasetVector._SMDatasetVectorId, identityDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return identified; + } catch (e) { + console.error(e); } - - /** - * 进行相交方式的叠加分析,将被相交叠加分析的数据集不包含在用来相交叠加分析的数据集中的对象切割并删除。即两个数据集中重叠的部分将被输出到结果数据集中,其余部分将被排除。 - * @memberOf OverlayAnalyst - * @param datasetVector - 被相交叠加分析的数据集,该数据集的类型可以是点、线、面数据集。 - * @param intersectDatasetVector - 用来相交叠加分析的数据集,该数据集必须是面数据集。 - * @param resultDatasetVector - 存放分析结果的数据集。 - * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async intersect(datasetVector,intersectDatasetVector,resultDatasetVector,paramter){ - try{ - var {intersected} = await OA.intersect(datasetVector.datasetVectorId,intersectDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return intersected; - }catch(e){ - console.error(e); - } + } + + /** + * 进行相交方式的叠加分析,将被相交叠加分析的数据集不包含在用来相交叠加分析的数据集中的对象切割并删除。即两个数据集中重叠的部分将被输出到结果数据集中,其余部分将被排除。 + * @memberOf OverlayAnalyst + * @param datasetVector - 被相交叠加分析的数据集,该数据集的类型可以是点、线、面数据集。 + * @param intersectDatasetVector - 用来相交叠加分析的数据集,该数据集必须是面数据集。 + * @param resultDatasetVector - 存放分析结果的数据集。 + * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async intersect(datasetVector, intersectDatasetVector, resultDatasetVector, paramter) { + try { + var { intersected } = await OA.intersect(datasetVector._SMDatasetVectorId, intersectDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return intersected; + } catch (e) { + console.error(e); } - - /** - * 用于对两个面数据集进行合并方式的叠加分析,结果数据集中保存被合并叠加分析的数据集和用于合并叠加分析的数据集中的全部对象,并且对相交部分进行求交和分割运算。 - * @memberOf OverlayAnalyst - * @param datasetVector - 被合并叠加分析的数据集,必须是面数据集类型。 - * @param unionDatasetVector - 用于合并叠加分析的数据集,必须是面数据集类型。 - * @param resultDatasetVector - 存放分析结果的数据集。 - * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async union(datasetVector,unionDatasetVector,resultDatasetVector,paramter){ - try{ - var {unioned} = await OA.union(datasetVector.datasetVectorId,unionDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return unioned; - }catch(e){ - console.error(e); - } + } + + /** + * 用于对两个面数据集进行合并方式的叠加分析,结果数据集中保存被合并叠加分析的数据集和用于合并叠加分析的数据集中的全部对象,并且对相交部分进行求交和分割运算。 + * @memberOf OverlayAnalyst + * @param datasetVector - 被合并叠加分析的数据集,必须是面数据集类型。 + * @param unionDatasetVector - 用于合并叠加分析的数据集,必须是面数据集类型。 + * @param resultDatasetVector - 存放分析结果的数据集。 + * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async union(datasetVector, unionDatasetVector, resultDatasetVector, paramter) { + try { + var { unioned } = await OA.union(datasetVector._SMDatasetVectorId, unionDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return unioned; + } catch (e) { + console.error(e); } - - /** - * 用于对两个面数据集进行更新方式的叠加分析,更新运算时用用于更新的数据集替换与被更新数据集重合的部分,是一个先擦除后粘贴的过程。 - * 用于更新叠加分析的数据集、被更新叠加分析的数据集以及结果数据集的地理坐标系必须一致。 - * 第一数据集与第二数据集的类型都必须是面数据集。结果数据集中保留了更新数据集的几何形状和属性信息。 - * @memberOf OverlayAnalyst - * @param datasetVector - 被更新叠加分析的数据集,必须是面类型。 - * @param updateDatasetVector - 用于更新叠加分析的数据集,必须是面数据集。 - * @param resultDatasetVector - 存放分析结果的数据集。 - * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async update(datasetVector,updateDatasetVector,resultDatasetVector,paramter){ - try{ - var {updated} = await OA.update(datasetVector.datasetVectorId,updateDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return updated; - }catch(e){ - console.error(e); - } + } + + /** + * 用于对两个面数据集进行更新方式的叠加分析,更新运算时用用于更新的数据集替换与被更新数据集重合的部分,是一个先擦除后粘贴的过程。 + * 用于更新叠加分析的数据集、被更新叠加分析的数据集以及结果数据集的地理坐标系必须一致。 + * 第一数据集与第二数据集的类型都必须是面数据集。结果数据集中保留了更新数据集的几何形状和属性信息。 + * @memberOf OverlayAnalyst + * @param datasetVector - 被更新叠加分析的数据集,必须是面类型。 + * @param updateDatasetVector - 用于更新叠加分析的数据集,必须是面数据集。 + * @param resultDatasetVector - 存放分析结果的数据集。 + * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async update(datasetVector, updateDatasetVector, resultDatasetVector, paramter) { + try { + var { updated } = await OA.update(datasetVector._SMDatasetVectorId, updateDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return updated; + } catch (e) { + console.error(e); } - - /** - * 对两个面数据集进行对称差运算。即交集取反运算。 - * 用于对称差分析的数据集、被对称差分析的数据集以及结果数据集的地理坐标系必须一致。 - * 对称差运算是两个数据集的异或运算。操作结果是,对于每一个面对象,去掉其与另一个数据集中的几何对象相交的部分,而保留剩下的部分。对称差运算的输出结果的属性表包含两个输入数据集的非系统属性字段。 - * @memberOf OverlayAnalyst - * @param datasetVector - 被对称差分析的原数据集,必须是面数据集。 - * @param xORDatasetVector - 用于对称差分析的数据集,必须是面数据集。 - * @param resultDatasetVector - 存放分析结果的数据集 - * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 - * @returns {Promise.} - */ - async xOR(datasetVector,xORDatasetVector,resultDatasetVector,paramter){ - try{ - var {finished} = await OA.xOR(datasetVector.datasetVectorId,xORDatasetVector.datasetVectorId, - resultDatasetVector.datasetVectorId,paramter.overlayAnalystParameterId); - return finished; - }catch(e){ - console.error(e); - } + } + + /** + * 对两个面数据集进行对称差运算。即交集取反运算。 + * 用于对称差分析的数据集、被对称差分析的数据集以及结果数据集的地理坐标系必须一致。 + * 对称差运算是两个数据集的异或运算。操作结果是,对于每一个面对象,去掉其与另一个数据集中的几何对象相交的部分,而保留剩下的部分。对称差运算的输出结果的属性表包含两个输入数据集的非系统属性字段。 + * @memberOf OverlayAnalyst + * @param datasetVector - 被对称差分析的原数据集,必须是面数据集。 + * @param xORDatasetVector - 用于对称差分析的数据集,必须是面数据集。 + * @param resultDatasetVector - 存放分析结果的数据集 + * @param paramter - 叠加分析的参数对象,该对象用于设置分析时的保留字段等分析参数。 + * @returns {Promise.} + */ + async xOR(datasetVector, xORDatasetVector, resultDatasetVector, paramter) { + try { + var { finished } = await OA.xOR(datasetVector._SMDatasetVectorId, xORDatasetVector._SMDatasetVectorId, + resultDatasetVector._SMDatasetVectorId, paramter._SMOverlayAnalystParameterId); + return finished; + } catch (e) { + console.error(e); } -} \ No newline at end of file + } +} diff --git a/NativeModule/OverlayAnalystParameter.js b/NativeModule/OverlayAnalystParameter.js old mode 100644 new mode 100755 index e97db34e..577bcfa8 --- a/NativeModule/OverlayAnalystParameter.js +++ b/NativeModule/OverlayAnalystParameter.js @@ -1,3 +1,9 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let OAP = NativeModules.JSOverlayAnalystParameter; @@ -16,7 +22,7 @@ export default class OverlayAnalystParameter { try{ var {overlayAnalystParameterId} = await OAP.createObj(); var overlayAnalystParameter = new OverlayAnalystParameter(); - overlayAnalystParameter.overlayAnalystParameterId = overlayAnalystParameterId; + overlayAnalystParameter._SMOverlayAnalystParameterId = overlayAnalystParameterId; return overlayAnalystParameter; }catch(e){ console.error(e); @@ -31,7 +37,7 @@ export default class OverlayAnalystParameter { */ async setTolerance(rate){ try{ - await OAP.setTolerance(this.overlayAnalystParameterId,rate); + await OAP.setTolerance(this._SMOverlayAnalystParameterId,rate); }catch(e){ console.error(e); } @@ -44,7 +50,7 @@ export default class OverlayAnalystParameter { */ async getTolerance(){ try{ - var {tolerance} = await OAP.getTolerance(this.overlayAnalystParameterId); + var {tolerance} = await OAP.getTolerance(this._SMOverlayAnalystParameterId); return tolerance; }catch(e){ console.error(e); @@ -58,7 +64,7 @@ export default class OverlayAnalystParameter { */ async getOperationRetainedFields(){ try{ - var {fields} = await OAP.getOperationRetainedFields(this.overlayAnalystParameterId); + var {fields} = await OAP.getOperationRetainedFields(this._SMOverlayAnalystParameterId); return fields; }catch(e){ console.error(e); @@ -73,7 +79,7 @@ export default class OverlayAnalystParameter { */ async setOperationRetainedFields(fields){ try{ - await OAP.setOperationRetainedFields(this.overlayAnalystParameterId,fields); + await OAP.setOperationRetainedFields(this._SMOverlayAnalystParameterId,fields); }catch(e){ console.error(e); } @@ -86,7 +92,7 @@ export default class OverlayAnalystParameter { */ async getSourceRetainedFields(){ try{ - var {fields} = await OAP.getSourceRetainedFields(this.overlayAnalystParameterId); + var {fields} = await OAP.getSourceRetainedFields(this._SMOverlayAnalystParameterId); return fields; }catch(e){ console.error(e); @@ -101,9 +107,9 @@ export default class OverlayAnalystParameter { */ async setSourceRetainedFields(fields){ try{ - await OAP.setSourceRetainedFields(this.overlayAnalystParameterId,fields); + await OAP.setSourceRetainedFields(this._SMOverlayAnalystParameterId,fields); }catch(e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/PieChart.js b/NativeModule/PieChart.js new file mode 100755 index 00000000..7ba82e55 --- /dev/null +++ b/NativeModule/PieChart.js @@ -0,0 +1,48 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +import ChartView from './ChartView.js'; +let PC = NativeModules.JSPieChart; + +/** + * @class PieChart + */ +export default class PieChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"piechartId",{ + get:function(){ + return this.chartviewId + }, + set:function(piechartId){ + this.chartviewId = piechartId; + } + }) + } + /** + * 设置图表选中回调 + * @memberOf ChartView + * @returns {Promise.} + */ + async setChartOnSelected(){ + try{ + await PC.setChartOnSelected(this.piechartId); + }catch(e){ + console.error(e); + } + } + + /** + * 设置选中的对象ID + * @memberOf ChartView + * @returns {Promise.} + */ + async setSelectedGeometryID(geoId){ + try{ + await PC.setSelectedGeometryID(this.piechartId,geoId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/PieChartData.js b/NativeModule/PieChartData.js new file mode 100755 index 00000000..26f94a32 --- /dev/null +++ b/NativeModule/PieChartData.js @@ -0,0 +1,70 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let PCD = NativeModules.JSPieChartData; +import ChartData from './ChartData.js'; + +/** + * @class Layer + */ +export default class PieChartData extends ChartData{ + constructor(){ + super(); + Object.defineProperty(this,"pieChartDataId",{ + get:function(){ + return this.chartDataId + }, + set:function(pieChartDataId){ + this.chartDataId = pieChartDataId; + } + }) + } + /** + * 创建一个PieChartData对象 + * @memberOf PieChartData + * @param {string}itemName - 图表名称 + * @param {object}values - 图表数据 + * @param {string}label - 图表标题 + * @param {int}color - 图表颜色 + * @param {int}geoId - ID + * @returns {Promise.} + */ + async createObj(paraObj){ + try{ + var {_piechartdataId} = await PCD.createObj(paraObj); + var pieChartData = new PieChartData(); + pieChartData.pieChartDataId = _piechartdataId; + return pieChartData; + }catch(e){ + console.error(e); + } + } + /** + *  设置图饼子项的值 + * @memberOf PieChartData + * @param {int}value - 图饼子项的值 + * @returns {Promise.} + */ + async setValue(value){ + try{ + await PCD.setValue(this.pieChartDataId,value); + }catch(e){ + console.error(e); + } + } + + /** + * 获取图饼子项的值 + * @memberOf PieChartData + * @returns {Promise.} + */ + async getValue(){ + try{ + var {value} = await PCD.getValue(this.pieChartDataId); + return value; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/Point.js b/NativeModule/Point.js old mode 100644 new mode 100755 index ed9ce1e9..7633f0bc --- a/NativeModule/Point.js +++ b/NativeModule/Point.js @@ -1,11 +1,16 @@ -/** - * Created by will on 2016/7/13. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + Description:该类已经被废弃,计划下个大版本进行移除 + **********************************************************************************/ import { NativeModules } from 'react-native'; let P = NativeModules.JSPoint; /** - * @class Point - 像素点类。用于标示移动设备屏幕的像素点。 + * @class Point + * @deprecated + * @description 像素点类。用于标示移动设备屏幕的像素点。(该类已经被废弃,计划下个大版本进行移除) */ export default class Point{ /** @@ -18,10 +23,28 @@ export default class Point{ try{ var {pointId} = await P.createObj(x,y); var point = new Point(); - point.pointId = pointId; + point._SMPointId = pointId; return point; }catch (e){ console.error(e); } } -} \ No newline at end of file + + async getX() { + try{ + let x = await P.getX(this._SMPointId); + return x; + }catch (e){ + console.error(e); + } + } + + async getY() { + try{ + let y = await P.getY(this._SMPointId); + return y; + }catch (e){ + console.error(e); + } + } +} diff --git a/NativeModule/Point2D.js b/NativeModule/Point2D.js old mode 100644 new mode 100755 index 733bcf12..98dfccdc --- a/NativeModule/Point2D.js +++ b/NativeModule/Point2D.js @@ -1,30 +1,56 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let X = NativeModules.JSPoint2D; /** - * @class - 点类。点类的的实例为点对象,用于表示坐标值为双精度的点对象,即其坐标值的范围为±5.0*1e-324到±1.7*1e308,有效位为15-16位。 + * @class Point2D + * @description 点类。点类的的实例为点对象,用于表示坐标值为双精度的点对象,即其坐标值的范围为±5.0*1e-324到±1.7*1e308,有效位为15-16位。 */ export default class Point2D { - /** - * 构造一个新的 Point2D 对象。 - * @memberOf Point2D - * @returns {Promise.} - */ - async createObj(){ - try{ - if(typeof arguments[0] == 'number' && typeof arguments[1] == 'number'){ - var {point2DId} = await X.createObjByXY(arguments[0],arguments[1]); - var point2D = new Point2D(); - point2D.point2DId = point2DId; - return point2D; - }else{ - var {point2DId} = await X.createObj(); - var point2D = new Point2D(); - point2D.point2DId = point2DId; - return point2D; - } - }catch (e){ - console.error(e); - } + /** + * 构造一个新的 Point2D 对象。 + * @memberOf Point2D + * @returns {Promise.} + */ + async createObj() { + try { + if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') { + var { point2DId } = await X.createObjByXY(arguments[0], arguments[1]); + var point2D = new Point2D(); + point2D._SMPoint2DId = point2DId; + return point2D; + } else { + var { point2DId } = await X.createObj(); + var point2D = new Point2D(); + point2D._SMPoint2DId = point2DId; + return point2D; + } + } catch (e) { + console.error(e); } -} \ No newline at end of file + } + + + async getX() { + try { + let x = await X.getX(this._SMPoint2DId); + return x; + } catch (e) { + console.error(e); + } + } + + async getY() { + try { + let y = await X.getY(this._SMPoint2DId); + return y; + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/Point3D.js b/NativeModule/Point3D.js new file mode 100755 index 00000000..c8e51f78 --- /dev/null +++ b/NativeModule/Point3D.js @@ -0,0 +1,109 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + description: 三维点类; + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let P = NativeModules.JSPoint3D; +/** + * @class Point3D + */ +export default class Point3D { + /** + * 创建Point3D对象。 + * @memberOf Point3D + * @returns {Point3D} + */ + async createObj(x, y, z) { + try { + var { pointId } = await P.createObj(x, y, z); + var point = new Point3D(); + point._SMPoint3DId = pointId; + return point; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Point3D的X分量。 + * @memberOf Point3D + * @returns {number} + */ + async getX() { + try { + var { x } = await P.getX(this._SMPoint3DId); + return x; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Point3D的Y分量。 + * @memberOf Point3D + * @returns {number} + */ + async getY() { + try { + var { y } = await P.getY(this._SMPoint3DId); + return y; + } catch (e) { + console.error(e); + } + } + + /** + * 获取Point3D的Z分量。 + * @memberOf Point3D + * @returns {number} + */ + async getZ() { + try { + var { z } = await P.getZ(this._SMPoint3DId); + return z; + } catch (e) { + console.error(e); + } + } + + /** + * 设置Point3D的X分量。 + * @memberOf Point3D + * @returns {number} + */ + async setX(x) { + try { + await P.setX(this._SMPoint3DId,x); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Point3D的Y分量。 + * @memberOf Point3D + * @returns {number} + */ + async setY(y) { + try { + await P.setY(this._SMPoint3DId,y); + } catch (e) { + console.error(e); + } + } + + /** + * 设置Point3D的Z分量。 + * @memberOf Point3D + * @returns {number} + */ + async setZ(z) { + try { + await P.setZ(this._SMPoint3DId,z); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/PointDensityChart.js b/NativeModule/PointDensityChart.js new file mode 100755 index 00000000..e00b4497 --- /dev/null +++ b/NativeModule/PointDensityChart.js @@ -0,0 +1,51 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let PDC = NativeModules.JSPointDensityChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class PointDensityChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"pointDensityChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(pointDensityChartId){ + this.chartviewId = pointDensityChartId; + } + }) + } + /** + * 构造方法 + * @memberOf PointDensityChart + * @param {MapControl} mapControl + * @returns {Promise.} + */ + async createObj(mapControl){ + try{ + var {pointDensityChartId} = await PDC.createObj(mapControl._SMMapControlId); + var pointDensityChart = new PointDensityChart(); + pointDensityChart.pointDensityChartId = pointDensityChartId; + return pointDensityChart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置刻度调色板 + * @memberOf GridHotChart + * @returns {Promise.} + */ + async setColorScheme(scheme){ + try{ + await PDC.setColorScheme(this.pointDensityChartId,scheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/PointM.js b/NativeModule/PointM.js new file mode 100755 index 00000000..1bd24b03 --- /dev/null +++ b/NativeModule/PointM.js @@ -0,0 +1,62 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let X = NativeModules.JSPointM; + +/** + * 精度为 double 的路由点类。 + * 路由点是指具有线性度量值的点。M 代表路由点的度量值(Measure value)。 + */ +export default class PointM { + /** + * 构造一个新的 PointM 对象。 + * @memberOf PointM + * @returns {Promise.} + */ + async createObj() { + try { + let pointMId, pointM + if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number' && typeof arguments[2] === 'number') { + pointMId = await X.createObjByXYM(arguments[0], arguments[1], arguments[2]); + pointM = new PointM(); + pointM.SMPointMId = pointMId; + return pointM; + } else { + pointMId = await X.createObj(); + pointM = new PointM(); + pointM.SMPointMId = pointMId; + return pointM; + } + } catch (e) { + console.error(e); + } + } + + + async getX() { + try { + return await X.getX(this.SMPointMId); + } catch (e) { + console.error(e); + } + } + + async getY() { + try { + return await X.getY(this.SMPointMId); + } catch (e) { + console.error(e); + } + } + + async getM() { + try { + return await X.getM(this.SMPointMId); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/PolymerChart.js b/NativeModule/PolymerChart.js new file mode 100755 index 00000000..6185a055 --- /dev/null +++ b/NativeModule/PolymerChart.js @@ -0,0 +1,104 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let PC = NativeModules.JSPolymerChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class PolymerChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"polymerChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(polymerChartId){ + this.chartviewId = polymerChartId; + } + }) + } + /** + * 构造方法 + * @memberOf PolymerChart + * @param {MapControl} mapControl + * @returns {Promise.} + */ + async createObj(mapControl){ + try{ + var {polymerChartId} = await PC.createObj(mapControl._SMMapControlId); + var polymerChart = new PolymerChart(); + polymerChart.polymerChartId = polymerChartId; + return polymerChart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置聚合算法类型 1:聚类(默认) 2:网格 + * @memberOf PolymerChart + * @returns {Promise.} + */ + async setPolymerizationType(type){ + try{ + await PC.setPolymerizationType(this.polymerChartId,type); + }catch(e){ + console.error(e); + } + } + + /** + * 获取聚合算法类型 1:聚类(默认) 2:网格 + * @memberOf PolymerChart + * @returns {Promise.} + */ + async getPolymerizationType(){ + try{ + var {type} = await PC.getPolymerizationType(this.polymerChartId); + return type; + }catch(e){ + console.error(e); + } + } + + /** + * 设置未展开聚合点暗色 + * @memberOf PolymerChart + * @returns {Promise.} + */ + async setUnfoldColor(colorObj){ + try{ + await PC.setUnfoldColor(this.polymerChartId,colorObj); + }catch(e){ + console.error(e); + } + } + + /** + * 设置展开聚合点亮色 + * @memberOf PolymerChart + * @returns {Promise.} + */ + async setFoldColor(colorObj){ + try{ + await PC.setFoldColor(this.polymerChartId,colorObj); + }catch(e){ + console.error(e); + } + } + + /** + * 设置刻度调色板 + * @memberOf PolymerChart + * @returns {Promise.} + */ + async setColorScheme(scheme){ + try{ + await PC.setColorScheme(this.polymerChartId,scheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/PrjCoordSys.js b/NativeModule/PrjCoordSys.js old mode 100644 new mode 100755 index 8ad5bffc..8f3cf593 --- a/NativeModule/PrjCoordSys.js +++ b/NativeModule/PrjCoordSys.js @@ -1,9 +1,52 @@ -import {NativeModules} from 'react-native'; -let PCS = NativeModules.JSPrjCoordSys; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native' +let PCS = NativeModules.JSPrjCoordSys /** * @class PrjCoordSys + * @description 投影坐标系类。投影坐标系统由地图投影方式、投影参数、坐标单位和地理坐标系组成。 */ export default class PrjCoordSys { - -} \ No newline at end of file + /** + * 创建一个PrjCoordSys对象 + * @param {int} type 类型枚举值 + * @returns {Promise.} + */ + async createObj(type) { + try { + let _SMPrjCoordSysId + if (type) { + _SMPrjCoordSysId = await PCS.createObjWithType(type) + } else { + _SMPrjCoordSysId = await PCS.createObj() + } + let prjCoorSys = new PrjCoordSys() + prjCoorSys._SMPrjCoordSysId = _SMPrjCoordSysId + return prjCoorSys + } catch (e) { + console.error(e) + } + } + + async getType() { + try { + let type = await PCS.getType(this._SMPrjCoordSysId) + return type + } catch (e) { + console.error(e) + } + } + + async setType(type) { + try { + await PCS.setType(this._SMPrjCoordSysId, type) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/QueryParameter.js b/NativeModule/QueryParameter.js old mode 100644 new mode 100755 index 1a79207b..fcdce174 --- a/NativeModule/QueryParameter.js +++ b/NativeModule/QueryParameter.js @@ -1,13 +1,19 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let QP = NativeModules.JSQueryParameter; const NAME_QUERYPARAMETER = "QueryParameter"; /** - * @class QueryParameter - 查询参数类。 - * - * 用于描述一个条件查询的限制条件,如所包含的 SQL 语句,游标方式等。 - * - * 条件查询,是查询满足一定条件的所有要素的记录,其查询得到的结果是记录集。查询参数类是用来设置条件查询的查询条件从而得到记录集。SQL 查询,又称属性查询,即通过构建包含属性字段、运算符号和数值的 SQL 条件语句来选择记录,从而得到记录集。 + * @class QueryParameter + * @description 查询参数类。 + 用于描述一个条件查询的限制条件,如所包含的 SQL 语句,游标方式等。 + 条件查询,是查询满足一定条件的所有要素的记录,其查询得到的结果是记录集。查询参数类是用来设置条件查询的查询条件从而得到记录集。 + SQL查询,又称属性查询,即通过构建包含属性字段、运算符号和数值的 SQL 条件语句来选择记录,从而得到记录集。 */ export default class QueryParameter { /** @@ -35,7 +41,7 @@ export default class QueryParameter { try{ var {queryParameterId} = await QP.createObj(); var queryParameter = new QueryParameter(); - queryParameter.queryParameterId = queryParameterId; + queryParameter._SMQueryParameterId = queryParameterId; //Return records in batches. by default, 20 records //first batch would be return(initial with "1") queryParameter.size = 10; @@ -54,8 +60,8 @@ export default class QueryParameter { */ async setAttributeFilter (attributeFilter){ try{ - typeof attributeFilter == "string" && - await QP.setAttributeFilter(this.queryParameterId,attributeFilter); + typeof attributeFilter === "string" && + await QP.setAttributeFilter(this._SMQueryParameterId,attributeFilter); }catch (e){ console.error(e); } @@ -70,7 +76,7 @@ export default class QueryParameter { async setGroupBy(groups){ try{ if(testArray(groups)){ - await QP.setGroupBy(this.queryParameterId,groups); + await QP.setGroupBy(this._SMQueryParameterId,groups); } }catch (e){ console.error(e); @@ -85,7 +91,7 @@ export default class QueryParameter { */ async setHasGeometry(has){ try{ - await QP.setHasGeometry(this.queryParameterId,has); + await QP.setHasGeometry(this._SMQueryParameterId,has); }catch (e){ console.error(e); } @@ -100,7 +106,7 @@ export default class QueryParameter { async setResultFields(fields){ try{ if(testArray(fields)){ - await QP.setResultFields(this.queryParameterId,fields); + await QP.setResultFields(this._SMQueryParameterId,fields); } }catch (e){ console.error(e); @@ -116,7 +122,7 @@ export default class QueryParameter { async setOrderBy(fields){ try{ if(testArray(fields)){ - await QP.setOrderBy(this.queryParameterId,fields); + await QP.setOrderBy(this._SMQueryParameterId,fields); } }catch (e){ console.error(e); @@ -131,7 +137,7 @@ export default class QueryParameter { */ async setSpatialQueryObject(geometry){ try{ - await QP.setSpatialQueryObject(this.queryParameterId,geometry.geometryId); + await QP.setSpatialQueryObject(this._SMQueryParameterId,geometry._SMGeometryId); }catch (e){ console.error(e); } @@ -146,7 +152,21 @@ export default class QueryParameter { async setSpatialQueryMode(mode){ try{ console.log("QueryParameter:" + mode); - typeof mode == "number" && await QP.setSpatialQueryMode(this.queryParameterId,mode); + typeof mode === "number" && await QP.setSpatialQueryMode(this._SMQueryParameterId,mode); + }catch (e){ + console.error(e); + } + } + + /** + * 设置查询游标类型 CursorType + * @param cursorType + * @returns {Promise.} + */ + async setCursorType(cursorType){ + try{ + console.log("cursorType:" + cursorType); + typeof cursorType === "number" && await QP.setCursorType(this._SMQueryParameterId,cursorType); }catch (e){ console.error(e); } @@ -163,4 +183,4 @@ function testArray(arr) { }else{ return true; } -} \ No newline at end of file +} diff --git a/NativeModule/QueryService.js b/NativeModule/QueryService.js old mode 100644 new mode 100755 index aac6061a..e039621e --- a/NativeModule/QueryService.js +++ b/NativeModule/QueryService.js @@ -1,6 +1,12 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let SS = NativeModules.JSQueryService; - +import ServiceBase from './ServiceBase.js'; /** * @class QueryService * @param QueryMode.SqlQuery - 查询模式:SQL查询 @@ -10,8 +16,19 @@ let SS = NativeModules.JSQueryService; * @param QueryMode.BoundsQuery - 范围查询:范围查询 * */ -export default class QueryService { - +export default class QueryService extends ServiceBase{ + constructor(){ + super(); + //同步子类Id和父类Id + Object.defineProperty(this,"_SMQueryServiceId",{ + get:function () { + return this._SMServiceBaseId + }, + set:function (_SMQueryServiceId) { + this._SMServiceBaseId = _SMQueryServiceId; + } + }) + } /** * 根据查询路径创建一个QueryService对象 * @param url @@ -21,7 +38,7 @@ export default class QueryService { try { var {_queryServiceId_} = await SS.createObj(url); var queryService = new QueryService(); - queryService._queryServiceId_ = _queryServiceId_; + queryService._SMQueryServiceId = _queryServiceId_; return queryService; } catch (e) { console.error(e); @@ -36,8 +53,8 @@ export default class QueryService { */ async query(serviceQueryParameter, mode) { try { - await SS.query(this._queryServiceId_, - serviceQueryParameter._serviceQueryParameterId_, mode); + await SS.query(this._SMQueryServiceId, + serviceQueryParameter._SMServiceQueryParameterId, mode); return queryService; } catch (e) { console.error(e); @@ -53,8 +70,8 @@ export default class QueryService { */ async queryByUrl(url, serviceQueryParameter, mode) { try { - await SS.queryByUrl(this._queryServiceId_, url, - serviceQueryParameter._serviceQueryParameterId_, mode); + await SS.queryByUrl(this._SMQueryServiceId, url, + serviceQueryParameter._SMServiceQueryParameterId, mode); return queryService; } catch (e) { console.error(e); diff --git a/NativeModule/Recordset.js b/NativeModule/Recordset.js old mode 100644 new mode 100755 index 3eb9f19b..d0c93c70 --- a/NativeModule/Recordset.js +++ b/NativeModule/Recordset.js @@ -1,4 +1,10 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let R = NativeModules.JSRecordset; import Geometry from './Geometry.js'; import Dataset from './Dataset'; @@ -8,75 +14,196 @@ import Dataset from './Dataset'; * @deprecated */ export default class Recordset { - async getRecordCount(){ - try{ - var {recordCount} = await R.getRecordCount(this.recordsetId); - return recordCount; - }catch (e){ - console.error(e); - } + async getRecordCount() { + try { + var { recordCount } = await R.getRecordCount(this._SMRecordsetId); + return recordCount; + } catch (e) { + console.error(e); } - - async dispose(){ - try{ - await R.dispose(this.recordsetId); - }catch (e){ - console.error(e); - } + } + + async dispose() { + try { + await R.dispose(this._SMRecordsetId); + } catch (e) { + console.error(e); } - - async getGeometry(){ - try{ - var {geometryId} = await R.getGeometry(this.recordsetId); - var geometry = new Geometry(); - geometry.geometryId = geometryId; - return geometry; - }catch (e){ - console.error(e); - } + } + + async getGeometry() { + try { + var { geometryId } = await R.getGeometry(this._SMRecordsetId); + var geometry = new Geometry(); + geometry._SMGeometryId = geometryId; + return geometry; + } catch (e) { + console.error(e); } - - async isEOF(){ - try{ - var isEOF = await R.isEOF(this.recordsetId); - return isEOF; - }catch (e){ - console.error(e); - } + } + + async isEOF() { + try { + var isEOF = await R.isEOF(this._SMRecordsetId); + return isEOF; + } catch (e) { + console.error(e); } - - async getDataset(){ - try{ - var {datasetId} = await R.getDataset(this.recordsetId); - var dataset = new Dataset(); - dataset.datasetId = datasetId; - return dataset; - }catch (e){ - console.error(e); - } + } + + async getDataset() { + try { + var { datasetId } = await R.getDataset(this._SMRecordsetId); + var dataset = new Dataset(); + dataset._SMDatasetId = datasetId; + return dataset; + } catch (e) { + console.error(e); } - - async addNew(geometry){ - try{ - await R.addNew(this.recordsetId,geometry.geometryId); - }catch (e){ - console.error(e); - } + } + + async addNew(geometry) { + try { + await R.addNew(this._SMRecordsetId, geometry._SMGeometryId); + } catch (e) { + console.error(e); } - - async moveNext(){ - try{ - await R.moveNext(this.recordsetId); - }catch (e){ - console.error(e); - } + } + + async moveFirst() { + try { + let result = await R.moveFirst(this._SMRecordsetId); + return result; + } catch (e) { + console.error(e); } - - async update(){ - try{ - await R.update(this.recordsetId); - }catch (e){ - console.error(e); - } + } + + async moveNext() { + try { + await R.moveNext(this._SMRecordsetId); + } catch (e) { + console.error(e); + } + } + + async moveLast() { + try { + await R.moveLast(this._SMRecordsetId); + } catch (e) { + console.error(e); + } + } + + async movePrev() { + try { + await R.movePrev(this._SMRecordsetId); + } catch (e) { + console.error(e); + } + } + + async moveTo(index) { + try { + await R.moveTo(this._SMRecordsetId, index); + } catch (e) { + console.error(e); + } + } + + async edit() { + try { + let isEdit = await R.edit(this._SMRecordsetId); + return isEdit + } catch (e) { + console.error(e); + } + } + + async update() { + try { + let isUpdate = await R.update(this._SMRecordsetId); + return isUpdate + } catch (e) { + console.error(e); + } + } + + async getFieldCount() { + try { + let { count } = await R.getFieldCount(this._SMRecordsetId); + return count + } catch (e) { + console.error(e); + } + } + + async getFieldInfo() { + try { + return (await R.getFieldInfo(this._SMRecordsetId))[0]; + } catch (e) { + console.error(e); + } + } + + async getFieldInfosArray(count = 0, size = 20) { + try { + let arr = await R.getFieldInfosArray(this._SMRecordsetId, count, size); + return arr + } catch (e) { + console.error(e); + } + } + + async setFieldValueByName(info) { + try { + await R.setFieldValueByName(this._SMRecordsetId, info); + } catch (e) { + console.error(e); + } + } + + async setFieldValueByIndex(info) { + try { + await R.setFieldValueByIndex(this._SMRecordsetId, info); + } catch (e) { + console.error(e); + } + } + + async setFieldValuesByNames(infos = {}, position = -1) { + try { + let { result, editResult, updateResult } = await R.setFieldValueByName(this._SMRecordsetId, position, infos); + return { result, editResult, updateResult } + } catch (e) { + console.error(e); + } + } + + async setFieldValuesByIndexes(infos = {}) { + try { + let { result, editResult, updateResult } = await R.setFieldValueByIndex(this._SMRecordsetId, infos); + return { result, editResult, updateResult } + } catch (e) { + console.error(e); + } + } + + async addFieldInfo(info = {}) { + try { + let { index, editResult, updateResult } = await R.addFieldInfo(this._SMRecordsetId, info); + return { index, editResult, updateResult } + } catch (e) { + console.error(e); + } + } + + async deleteById(id) { + try { + return await R.deleteById(this._SMRecordsetId, id); + } catch (e) { + console.error(e); } + } + } diff --git a/NativeModule/Rectangle2D.js b/NativeModule/Rectangle2D.js old mode 100644 new mode 100755 index 52dfb6ca..858dab52 --- a/NativeModule/Rectangle2D.js +++ b/NativeModule/Rectangle2D.js @@ -1,15 +1,22 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let R = NativeModules.JSRectangle2D; import Point2D from './Point2D.js'; /** * @class Rectangle2D + * @description 矩形类。 */ export default class Rectangle2D { /** * 创建一个Rectangle2D矩形实例 * @memberOf Rectangle2D - * @param {object} point2D - 左上点,可选 + * @param {object} point2D - 左下点,可选 * @param {object} point2D - 右上点,可选 * @returns {Promise.<*>} */ @@ -31,7 +38,7 @@ export default class Rectangle2D { returnObj(rectangle2DId){ var rectangle2D = new Rectangle2D(); - rectangle2D.rectangle2DId = rectangle2DId; + rectangle2D._SMRectangle2DId = rectangle2DId; return rectangle2D; } -} \ No newline at end of file +} diff --git a/NativeModule/RelationalChartPoint.js b/NativeModule/RelationalChartPoint.js new file mode 100755 index 00000000..3235d642 --- /dev/null +++ b/NativeModule/RelationalChartPoint.js @@ -0,0 +1,108 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let RCP = NativeModules.JSRelationalChartPoint; +import ChartPoint from './ChartPoint.js'; + +/** + * @class Layer + */ +export default class RelationalChartPoint extends ChartPoint { + constructor(){ + super(); + Object.defineProperty(this,"_SMRelationalChartPointId",{ + get:function(){ + return this.chartPointId + }, + set:function(_SMRelationalChartPointId){ + this.chartPointId = _SMRelationalChartPointId; + } + }); + } + + /** + * 创建一个ChartPoint对象 + * @memberOf ChartData + * @param {object}para - para {} + * @returns {Promise.} + */ + async createObj(weight,x,y){ + try{ + if(arguments.length==3){ + var {_chartpointId} = await RCP.createObj(weight,x,y); + }else if(arguments.length==2){ + var {_chartpointId} = await RCP.createObjByPoint(weight,x.point2DId); + }else{ + console('arguments number should be 3 or 2'); + return; + } + var chartPoint = new RelationalChartPoint(); + chartPoint._SMRelationalChartPointId = _chartpointId; + return chartPoint; + }catch(e){ + console.error(e); + } + } + + /** + * 获取关系名称 + * @memberOf RelationalChartPoint + * @returns {Promise.} + */ + async getRelationalName(){ + try{ + var {name} = await RCP.getRelationalName(this._SMRelationalChartPointId); + return name; + }catch(e){ + console.error(e); + } + } + + /** + * 设置关系名称 + * @memberOf RelationalChartPoint + * @param {String} name + * @returns {Promise.} + */ + async setRelationalName(name){ + try{ + await RCP.setRelationalName(this._SMRelationalChartPointId,name); + }catch(e){ + console.error(e); + } + } + + /** + * 设置关系点 + * @memberOf RelationalChartPoint + * @param {Array} pointsArr + * @returns {Promise.} + */ + async setRelationalPoints(pointsArr){ + try{ + var idArr =[]; + for(var i=0;i} + */ + async addRelationalPoint(point){ + try{ + await RCP.addRelationalPoint(this._SMRelationalChartPointId,point._SMRelationalChartPointId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/RelationalPointChart.js b/NativeModule/RelationalPointChart.js new file mode 100755 index 00000000..1c386c2e --- /dev/null +++ b/NativeModule/RelationalPointChart.js @@ -0,0 +1,142 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let RPC = NativeModules.JSRelationalPointChart; +import ChartView from './ChartView.js'; +/** + * @class PieChart + */ +export default class RelationalPointChart extends ChartView{ + constructor(){ + super(); + Object.defineProperty(this,"relationalPointChartId",{ + get:function(){ + return this.chartviewId + }, + set:function(relationalPointChartId){ + this.chartviewId = relationalPointChartId; + } + }); + } + /** + * 构造方法 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async createObj(mapControl){ + try{ + var {relationalPointChartId} = await RPC.createObj(mapControl._SMMapControlId); + var relationalPointChart = new RelationalPointChart(); + relationalPointChart.relationalPointChartId = relationalPointChartId; + return relationalPointChart; + }catch(e){ + console.error(e); + } + } + + /** + * 设置是否开启动画效果 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setAnimation(b){ + try{ + await RPC.setAnimation(this.relationalPointChartId,b); + }catch(e){ + console.error(e); + } + } + + /** + * 获取是否开启动画效果(该方法只适用于iOS端) + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async isAnimation(){ + try{ + var {isAnimation} = await RPC.isAnimation(this.relationalPointChartId); + return isAnimation; + }catch(e){ + console.error(e); + } + } + + /** + * 设置动态效果Image + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setAnimationImage(url){ + try{ + await RPC.setAnimationImage(this.relationalPointChartId,url); + }catch(e){ + console.error(e); + } + } + + /** + * 设置子关系点颜色 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setChildRelationalPointColor(colorArr){ + try{ + await RPC.setChildRelationalPointColor(this.relationalPointChartId,colorArr); + }catch(e){ + console.error(e); + } + } + + /** + * 设置关系线终点颜色 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setEndPointColor(colorArr){ + try{ + await RPC.setEndPointColor(this.relationalPointChartId,colorArr); + }catch(e){ + console.error(e); + } + } + + /** + * 设置子关系点大小 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setChildPointSize(size){ + try{ + await RPC.setChildPointSize(this.relationalPointChartId,size); + }catch(e){ + console.error(e); + } + } + + /** + * 设置线宽 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setLineWidth(width){ + try{ + await RPC.setLineWidth(this.relationalPointChartId,width); + }catch(e){ + console.error(e); + } + } + + /** + * 设置刻度调色板 + * @memberOf RelationalPointChart + * @returns {Promise.} + */ + async setColorScheme(scheme){ + try{ + await RPC.setColorScheme(this.relationalPointChartId,scheme.colorSchemeId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/STOMPManager.js b/NativeModule/STOMPManager.js new file mode 100755 index 00000000..0b62bf47 --- /dev/null +++ b/NativeModule/STOMPManager.js @@ -0,0 +1,111 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let SPM = NativeModules.JSSTOMPManager; +import STOMPSender from './STOMPSender.js'; +import STOMPReceiver from './STOMPReceiver.js'; +/** + * @class STOMPManager + */ +export default class STOMPManager{ + /** + * 创建一个AMQPManager对象 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async createObj(){ + try{ + var {_STOMPManagerId} = await SPM.createObj(); + var STOMPManagerObj = new STOMPManager(); + STOMPManagerObj.STOMPManagerId = _STOMPManagerId; + return STOMPManagerObj; + }catch(e){ + console.error(e); + } + } + /** + * 初始化库。 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async initializeLibrary(){ + try{ + await SPM.initializeLibrary(); + }catch(e){ + console.error(e); + } + } + + /** + * 释放环境。不可重复释放。 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async shutdownLibrary(){ + try{ + await SPM.shutdownLibrary(); + }catch(e){ + console.error(e); + } + } + + /** + * 创建一个发送端 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async newSender(useTopic,name){ + try{ + var {STOMPSenderId} = await SPM.newSender(this.STOMPManagerId,useTopic,name); + var newSPS = new STOMPSender(); + newSPS.STOMPSenderId = STOMPSenderId; + return newSPS; + }catch(e){ + console.error(e); + } + } + + /** + * 创建一个接收端 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async newReceiver(useTopic,name,clientID){ + try{ + var {STOMPReceiverId} = await SPM.newReceiver(this.STOMPManagerId,useTopic,name,clientID); + var newSPR = new STOMPReceiver(); + newSPR.STOMPReceiverId = STOMPReceiverId; + return newSPS; + }catch(e){ + console.error(e); + } + } + + /** + * 建立链接 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async connection(URI,userName,passWord){ + try{ + var {isConnection} = await SPM.connection(this.STOMPManagerId,URI,userName,passWord); + return isConnection; + }catch(e){ + console.error(e); + } + } + + /** + * 断开链接 + * @memberOf STOMPManager + * @returns {Promise.} + */ + async disconnection(){ + try{ + await SPM.disconnection(this.STOMPManagerId); + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/STOMPReceiver.js b/NativeModule/STOMPReceiver.js new file mode 100755 index 00000000..ebd1d8fd --- /dev/null +++ b/NativeModule/STOMPReceiver.js @@ -0,0 +1,78 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform} from 'react-native'; +let SPR = NativeModules.JSSTOMPReceiver; + +const nativeEvt = new NativeEventEmitter(SPR); +/** + * @class STOMPReceiver + */ +export default class STOMPReceiver{ + /** + * 创建一个STOMPReceiver对象 + * @memberOf STOMPReceiver + * @returns {Promise.} + */ +/* async createObj(){ + try{ + var {_STOMPReceiverId} = await SPR.createObj(); + var STOMPReceiverObj = new STOMPReceiver(); + STOMPReceiverObj.STOMPReceiverId = _STOMPReceiverId; + return STOMPReceiverObj; + }catch(e){ + console.error(e); + } + } +*/ + /** + * 接收信息 + * @memberOf STOMPReceiver + * @returns {Promise.} + */ + async receiveMessage(queueNum,loadingMessage){ + try{ + switch(queueNum){ + case 1 : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message1"; + break; + case 2 : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message2"; + break; + case 3 : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message3"; + break; + case 4 : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message4"; + break; + case 5 : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message5"; + break; + default : var str = "com.supermap.RN.JSSTOMPReceiver.receive_message1"; + } + + //差异化处理 + if(Platform.OS === 'ios'){ + nativeEvt.addListener(str,function (e) { + if(typeof loadingMessage === 'function'){ + loadingMessage(e.message); + }else{ + console.error("Please set a callback function to the first argument."); + } + }); + await SPR.receiveMessage(this.STOMPReceiverId,str); + } + }catch(e){ + console.error(e); + } + } + + /** + * 释放对象 + * @memberOf STOMPReceiver + * @returns {Promise.} + */ + async dispose(){ + try{ + var {isDispose} = await SPR.dispose(this.STOMPReceiverId); + return isDispose; + }catch(e){ + console.error(e); + } + } +} diff --git a/NativeModule/STOMPSender.js b/NativeModule/STOMPSender.js new file mode 100755 index 00000000..fead7b6d --- /dev/null +++ b/NativeModule/STOMPSender.js @@ -0,0 +1,54 @@ +/** + * Created by will on 2016/7/5. + */ +import {NativeModules} from 'react-native'; +let SPS = NativeModules.JSSTOMPSender; + +/** + * @class STOMPSender + */ +export default class STOMPSender{ + /** + * 创建一个STOMPSender对象 + * @memberOf STOMPSender + * @returns {Promise.} + */ +/* async createObj(){ + try{ + var {_STOMPSenderId} = await SPS.createObj(); + var STOMPSenderObj = new STOMPSender(); + STOMPSenderObj.STOMPSenderId = _STOMPSenderId; + return STOMPSenderObj; + }catch(e){ + console.error(e); + } + } + */ + /** + * 发送消息。 + * @memberOf STOMPSender + * @param {string}message - 待发送消息 + * @returns {Promise.} + */ + async sendMessage(message){ + try{ + await SPS.sendMessage(this.STOMPSenderId,message); + }catch(e){ + console.error(e); + } + } + + /** + * 释放对象。 + * @memberOf STOMPSender + * @returns {Promise.} + */ + async dispose(){ + try{ + await SPS.dispose(this.STOMPSenderId); + }catch(e){ + console.error(e); + } + } + +} diff --git a/NativeModule/ScaleView.js b/NativeModule/ScaleView.js deleted file mode 100644 index bb9fdf9c..00000000 --- a/NativeModule/ScaleView.js +++ /dev/null @@ -1,65 +0,0 @@ -import {NativeModules} from 'react-native'; -let S = NativeModules.JSScaleView; - -export default class ScaleView { - async createObj(mapControl){ - try{ - var {scaleViewId} = await S.createObjWithMapControlId(mapControl.mapControlId); - var scaleView = new ScaleView(); - scaleView.scaleViewId = scaleViewId; - return scaleView; - }catch (e){ - console.error(e); - } - } - - async setLevelEnable(enable){ - try{ - await S.setLevelEnable(this.scaleViewId,enable); - }catch (e){ - console.error(e); - } - } - - async getLevelEnable(){ - try{ - var {levelEnable} = await S.getLevelEnable(this.scaleViewId); - return levelEnable; - }catch (e){ - console.error(e); - } - } - - async setShowEnable(enable){ - try{ - await S.setShowEnable(this.scaleViewId,enable); - }catch (e){ - console.error(e); - } - } - - async getShowEnable(){ - try{ - var {showEnable} = await S.getShowEnable(this.scaleViewId); - return showEnable; - }catch (e){ - console.error(e); - } - } - - async setxOffset(x){ - try{ - await S.setxOffset(this.scaleViewId,x); - }catch (e){ - console.error(e); - } - } - - async setyOffset(y){ - try{ - await S.setyOffset(this.scaleViewId,y); - }catch (e){ - console.error(e); - } - } -} diff --git a/NativeModule/Scene.js b/NativeModule/Scene.js old mode 100644 new mode 100755 index a2b93b08..7ebe2f0d --- a/NativeModule/Scene.js +++ b/NativeModule/Scene.js @@ -1,8 +1,16 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let S = NativeModules.JSScene; import Workspace from './Workspace'; +import Layer3Ds from './Layer3Ds'; /** * @class Scene + * @description 三维场景类。 */ export default class Scene { /** @@ -13,7 +21,7 @@ export default class Scene { */ async setWorkspace(workspace){ try{ - await S.setWorkspace(this.sceneId,workspace.workspaceId); + await S.setWorkspace(this._SMSceneId,workspace._SMWorkspaceId); }catch (e){ console.error(e); } @@ -26,9 +34,9 @@ export default class Scene { */ async getWorkspace(){ try{ - var {workspaceId} = await S.setWorkspace(this.sceneId); + var {workspaceId} = await S.setWorkspace(this._SMSceneId); var workspace = new Workspace(); - workspace.workspaceId = workspaceId; + workspace._SMWorkspaceId = workspaceId; return workspace; }catch (e){ @@ -36,6 +44,49 @@ export default class Scene { } } + /** + * 返回3D图层集合对象。 + * @memberOf Scene + * @returns {Promise.} + */ + async getLayer3Ds(){ + try{ + var {layer3dsId} = await S.getLayer3Ds(this._SMSceneId); + var layer3ds = new Layer3Ds(); + layer3ds._SMLayer3DsId = layer3dsId; + + return layer3ds; + }catch (e){ + console.error(e); + } + } + + /** + * 飞到point3d位置。 + * @memberOf Scene + * @returns {Promise.} + */ + async flyToPoint(point){ + try{ + await S.flyToPoint(this._SMSceneId,point._SMPoint3DId); + }catch (e){ + console.error(e); + } + } + + /** + * 飞到指定相机位置。 + * @memberOf Scene + * @returns {Promise.} + */ + async flyToCamera(camera,altitude,isDirect){ + try{ + await S.flyToCamera(this._SMSceneId,camera._SMCameraId,altitude,isDirect); + }catch (e){ + console.error(e); + } + } + /** * 根据提供的场景名称打开三维地图 * @memberOf Scene @@ -47,13 +98,13 @@ export default class Scene { async open(){ try{ if(arguments.length == 1){ - var {opened} = await S.open(this.sceneId,arguments[0]); + var {opened} = await S.open(this._SMSceneId,arguments[0]); return opened; }else if(arguments.length == 2){ - var {opened} = await S.open2(this.sceneId,arguments[0],arguments[1]); + var {opened} = await S.open1(this._SMSceneId,arguments[0],arguments[1]); return opened; }else if(arguments.length == 3){ - var {opened} = await S.open3(this.sceneId,arguments[0],arguments[1],arguments[2]); + var {opened} = await S.open2(this._SMSceneId,arguments[0],arguments[1],arguments[2]); return opened; }else{ throw new Error("Scene opened Error: Please input 1-3 arguments.read the specification please") @@ -71,7 +122,7 @@ export default class Scene { */ async ensureVisible(visibleBounds){ try{ - await S.ensureVisible(this.sceneId,visibleBounds); + await S.ensureVisible(this._SMSceneId,visibleBounds); }catch (e){ console.error(e); } @@ -84,7 +135,7 @@ export default class Scene { */ async refresh(){ try{ - await S.refresh(this.sceneId); + await S.refresh(this._SMSceneId); }catch (e){ console.error(e); } @@ -99,7 +150,7 @@ export default class Scene { */ async pan(offsetLongitude,offsetLatitude){ try{ - await S.refresh(this.sceneId,offsetLongitude,offsetLatitude); + await S.pan(this._SMSceneId,offsetLongitude,offsetLatitude); }catch (e){ console.error(e); } @@ -112,7 +163,7 @@ export default class Scene { */ async viewEntire(){ try{ - await S.viewEntire(); + await S.viewEntire(this._SMSceneId); }catch (e){ console.error(e); } @@ -126,7 +177,7 @@ export default class Scene { */ async zoom(ratio){ try{ - await S.zoom(ratio); + await S.zoom(this._SMSceneId,ratio); }catch (e){ console.error(e); } @@ -139,7 +190,7 @@ export default class Scene { */ async close(){ try{ - await S.close(); + await S.close(this._SMSceneId); }catch (e){ console.error(e); } @@ -152,9 +203,9 @@ export default class Scene { */ async dispose(){ try{ - await S.dispose(); + await S.dispose(this._SMSceneId); }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/SceneControl.js b/NativeModule/SceneControl.js old mode 100644 new mode 100755 index 87f3cae2..122cb5f9 --- a/NativeModule/SceneControl.js +++ b/NativeModule/SceneControl.js @@ -1,16 +1,43 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import {NativeModules,Platform} from 'react-native'; let SC = NativeModules.JSSceneControl; import Scene from './Scene'; +/** + * @class SceneControl + * @description 三维场景控件。 + */ export default class SceneControl { + + /** + * 获取场景对象。 + * @memberOf SceneControl + * @returns {Promise.} + */ async getScene(){ try{ var {sceneId} = await SC.getScene(this.sceneControlId); var scene = new Scene(); - scene.sceneId = sceneId; + scene._SMSceneId = sceneId; return scene; }catch (e){ + + console.error(e); + } + } + + async initWithViewCtrl(tag){ + try{ + if(Platform.OS === 'ios'){ + await SC.initWithViewCtrl(this.sceneControlId,tag); + } + }catch (e){ console.error(e); } } @@ -23,7 +50,9 @@ export default class SceneControl { throw new Error("setGestureDetector need callback functions as first two argument!"); } //差异化 + if(Platform.OS === 'ios'){ + /* if(typeof handlers.longPressHandler === "function"){ nativeEvt.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) { // longPressHandler && longPressHandler(e); @@ -36,6 +65,7 @@ export default class SceneControl { scrollHandler && scrollHandler(e); }); } + */ }else{ if(typeof handlers.longPressHandler === "function"){ DeviceEventEmitter.addListener("com.supermap.RN.JSMapcontrol.long_press_event",function (e) { @@ -55,4 +85,4 @@ export default class SceneControl { console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/Selection.js b/NativeModule/Selection.js old mode 100644 new mode 100755 index 1c3fc7ae..000021d4 --- a/NativeModule/Selection.js +++ b/NativeModule/Selection.js @@ -1,81 +1,147 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let S = NativeModules.JSSelection; import Recordset from './Recordset.js'; /** * @class Selection + * @description 选择集类。该类用于处理地图上被选中的对象。 */ export default class Selection { - /** - * 将记录集转换成Selection - * @memberOf Selection - * @param {object} recordset - 记录集 - * @returns {Promise.} - */ - async fromRecordset(recordset){ - try{ - let {fromRecordset} = await S.fromRecordset(this.selectionId,recordset.recordsetId); - return fromRecordset; - }catch(e){ - console.log(e); - } + /** + * 将记录集转换成Selection + * @deprecated + * @memberOf Selection + * @param {object} recordset - 记录集 + * @returns {Promise.} + */ + async fromRecordset(recordset) { + try { + let { fromRecordset } = await S.fromRecordset(this._SMSelectionId, recordset._SMRecordsetId); + return fromRecordset; + } catch (e) { + console.log(e); } - - /** - * 设置样式风格 - * @memberOf Selection - * @param {object} geoStyle - 样式风格 - * @returns {Promise.} - */ - async setStyle(geoStyle){ - try{ - await S.setStyle(this.selectionId,geoStyle.geoStyleId); - }catch(e){ - console.log(e); - } + } + + /** + * 设置样式风格 + * @memberOf Selection + * @param {object} geoStyle - 样式风格 + * @returns {Promise.} + */ + async setStyle(geoStyle) { + try { + await S.setStyle(this._SMSelectionId, geoStyle._SMGeoStyleId); + } catch (e) { + console.log(e); } - - /** - * 清空选择对象 - * @memberOf Selection - * @returns {Promise.} - */ - async clear(){ - try{ - await S.clear(this.selectionId); - }catch(e){ - console.log(e); - } + } + + /** + * 清空选择对象 + * @memberOf Selection + * @returns {Promise.} + */ + async clear() { + try { + await S.clear(this._SMSelectionId); + } catch (e) { + console.log(e); } - - /** - * 转成recordset数据集 - * @memberOf Selection - * @returns {Promise.} - */ - async toRecordset(){ - try{ - var {recordsetId} = await S.toRecordset(this.selectionId); - var recordset = new Recordset(); - recordset.recordsetId = recordsetId; - return recordset; - }catch(e){ - console.log(e); - } + } + + /** + * 转成recordset数据集 + * @deprecated + * @memberOf Selection + * @returns {Promise.} + */ + async toRecordset() { + try { + var { recordsetId } = await S.toRecordset(this._SMSelectionId); + var recordset = new Recordset(); + recordset._SMRecordsetId = recordsetId; + return recordset; + } catch (e) { + console.log(e); } - - /** - * 从查询结果获取地图被选要素 - * @memberOf Selection - * @param {object} result - 经DataVector的query方法查询出的结果 - * @returns {Promise.} - */ - async fromQueryResult(result){ - try{ - let {fromRecordset} = await S.fromRecordset(this.selectionId,result.recordsetId); - return fromRecordset; - }catch(e){ - console.log(e); - } + } + + /** + * 从查询结果获取地图被选要素 + * @deprecated + * @memberOf Selection + * @param {object} result - 经DataVector的query方法查询出的结果 + * @returns {Promise.} + */ + async fromQueryResult(result) { + try { + let { fromRecordset } = await S.fromRecordset(this._SMSelectionId, result._SMRecordsetId); + return fromRecordset; + } catch (e) { + console.log(e); + } + } + + /** + * 获取选中集合数量 + * @returns {Promise.} + */ + async getCount() { + try { + let { count } = await S.getCount(this._SMSelectionId) + return count + } catch (e) { + console.log(e); + } + } + + /** + * 用于向选择集中加入几何对象 + * @param id + * @returns {Promise.} + */ + async add(id) { + try { + let index = await S.add(this._SMSelectionId, id) + return index + } catch (e) { + console.log(e); + } + } + + /** + * 用于从选择集中删除一个几何对象,该几何对象由原来的呈选中状态变为非选中状态 + * @param id 要删除几何对象的 ID 号(即其属性数据中 SmID 字段的值) + * @returns {Promise.} + */ + async remove(id) { + try { + let result = await S.remove(this._SMSelectionId, id) + return result + } catch (e) { + console.log(e); + } + } + + /** + * 用于从选择集中删除指定的若干几何对象,这些几何对象由原来的选中状态变为非选中状态 + * @param index 要删除的第一个几何对象的序列号 + * @param count 要删除的几何对象的个数 + * @returns {Promise.|Promise|Promise.|Promise.|Promise.>|Promise.|Boolean|Promise.>} + */ + async removeRange(index, count) { + try { + let count = await S.removeRange(this._SMSelectionId, index, count) + return count + } catch (e) { + console.log(e); } -} \ No newline at end of file + } +} diff --git a/NativeModule/ServiceBase.js b/NativeModule/ServiceBase.js old mode 100644 new mode 100755 index 053e61de..79e046f8 --- a/NativeModule/ServiceBase.js +++ b/NativeModule/ServiceBase.js @@ -1,8 +1,15 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let SB = NativeModules.JSServiceBase; /** * @class ServiceBase + * @description iServer 所有服务的基类(*请注意该类所有方法仅支持android端,iOS端请不要调用此方法)。 */ export default class ServiceBase { @@ -18,7 +25,7 @@ export default class ServiceBase { */ async getUrl(){ try{ - var url = await SB.getUrl(this._serviceBaseId_); + var url = await SB.getUrl(this._SMServiceBaseId); return url; }catch(e){ console.error(e); @@ -33,7 +40,7 @@ export default class ServiceBase { */ async setUrl(url){ try{ - await SB.setUrl(this._serviceBaseId_,url); + await SB.setUrl(this._SMServiceBaseId,url); }catch(e){ console.error(e); } @@ -47,7 +54,7 @@ export default class ServiceBase { */ async setServerName(serverName){ try{ - await SB.setServerName(this._serviceBaseId_,serverName); + await SB.setServerName(this._SMServiceBaseId,serverName); }catch(e){ console.error(e); } @@ -97,4 +104,4 @@ export default class ServiceBase { } } -} \ No newline at end of file +} diff --git a/NativeModule/ServiceQueryParameter.js b/NativeModule/ServiceQueryParameter.js old mode 100644 new mode 100755 index 1b4cc50c..32971e5c --- a/NativeModule/ServiceQueryParameter.js +++ b/NativeModule/ServiceQueryParameter.js @@ -1,3 +1,9 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let SQP = NativeModules.JSServiceQueryParameter; import Rectangle2D from './Rectangle2D.js'; @@ -5,9 +11,9 @@ import Geometry from './Geometry.js'; /** * @class ServiceQueryParameter - * QueryOptionType.ATTRIBUTE - 查询结果中只有属性。 - * QueryOptionType.ATTRIBUTEANDGEOMETRY - 查询结果中包含属性和几何对象。 - * QueryOptionType.GEOMETR - 查询结果中只有几何对象。 + * @property {number} QueryOptionType.ATTRIBUTE - 查询结果中只有属性。 + * @property {number} QueryOptionType.ATTRIBUTEANDGEOMETRY - 查询结果中包含属性和几何对象。 + * @property {number} QueryOptionType.GEOMETR - 查询结果中只有几何对象。 */ export default class ServiceQueryParameter { @@ -20,7 +26,7 @@ export default class ServiceQueryParameter { try{ var {_serviceQueryParameterId_} = await SQP.createObj(); var serviceQueryParameter = new ServiceQueryParameter(); - serviceQueryParameter._serviceQueryParameterId_ = _serviceQueryParameterId_; + serviceQueryParameter._SMServiceQueryParameterId = _serviceQueryParameterId_; return serviceQueryParameter; }catch (e){ console.error(e); @@ -35,7 +41,7 @@ export default class ServiceQueryParameter { */ async setQueryBounds(rectangle2D){ try{ - await SQP.setQueryBounds(this._serviceQueryParameterId_, rectangle2D.rectangle2DId); + await SQP.setQueryBounds(this._SMServiceQueryParameterId, rectangle2D._SMRectangle2DId); }catch (e){ console.error(e); } @@ -48,9 +54,9 @@ export default class ServiceQueryParameter { */ async getQueryBounds(){ try{ - var {rectangle2DId} = await SQP.getQueryBounds(this._serviceQueryParameterId_); + var {rectangle2DId} = await SQP.getQueryBounds(this._SMServiceQueryParameterId); var rectangle2D = new Rectangle2D(); - rectangle2D.rectangle2DId = rectangle2DId; + rectangle2D._SMRectangle2DId = rectangle2DId; return rectangle2D; }catch (e){ console.error(e); @@ -65,7 +71,7 @@ export default class ServiceQueryParameter { */ async setQueryDistance(distance){ try{ - await SQP.setQueryDistance(this._serviceQueryParameterId_, distance); + await SQP.setQueryDistance(this._SMServiceQueryParameterId, distance); }catch (e){ console.error(e); } @@ -78,7 +84,7 @@ export default class ServiceQueryParameter { */ async getQueryDistance(){ try{ - var distance = await SQP.getQueryDistance(this._serviceQueryParameterId_); + var distance = await SQP.getQueryDistance(this._SMServiceQueryParameterId); return distance; }catch (e){ console.error(e); @@ -92,9 +98,9 @@ export default class ServiceQueryParameter { */ async getQueryGeometry(){ try{ - var {geometryId} = await SQP.getQueryGeometry(this._serviceQueryParameterId_); + var {geometryId} = await SQP.getQueryGeometry(this._SMServiceQueryParameterId); var geometry = new Geometry(); - geometry.geometryId = geometryId; + geometry._SMGeometryId = geometryId; return geometry; }catch (e){ console.error(e); @@ -109,7 +115,7 @@ export default class ServiceQueryParameter { */ async setQueryGeometry(geometry){ try{ - await SQP.setQueryGeometry(this._serviceQueryParameterId_, geometry.geometryId); + await SQP.setQueryGeometry(this._SMServiceQueryParameterId, geometry._SMGeometryId); }catch (e){ console.error(e); } @@ -122,7 +128,7 @@ export default class ServiceQueryParameter { */ async getQueryLayerName(){ try{ - var name = await SQP.getQueryLayerName(this._serviceQueryParameterId_); + var name = await SQP.getQueryLayerName(this._SMServiceQueryParameterId); return name; }catch (e){ console.error(e); @@ -137,7 +143,7 @@ export default class ServiceQueryParameter { */ async setQueryLayerName(queryLayerName){ try{ - await SQP.setQueryLayerName(this._serviceQueryParameterId_, queryLayerName); + await SQP.setQueryLayerName(this._SMServiceQueryParameterId, queryLayerName); }catch (e){ console.error(e); } @@ -150,7 +156,7 @@ export default class ServiceQueryParameter { */ async getQueryMapName(){ try{ - var name = await SQP.getQueryMapName(this._serviceQueryParameterId_); + var name = await SQP.getQueryMapName(this._SMServiceQueryParameterId); return name; }catch (e){ console.error(e); @@ -165,7 +171,7 @@ export default class ServiceQueryParameter { */ async setQueryMapName(mapName){ try{ - await SQP.setQueryMapName(this._serviceQueryParameterId_, mapName); + await SQP.setQueryMapName(this._SMServiceQueryParameterId, mapName); }catch (e){ console.error(e); } @@ -178,7 +184,7 @@ export default class ServiceQueryParameter { */ async getQueryOption(){ try{ - var optionName = await SQP.getQueryOption(this._serviceQueryParameterId_); + var optionName = await SQP.getQueryOption(this._SMServiceQueryParameterId); return optionName; }catch (e){ console.error(e); @@ -193,7 +199,7 @@ export default class ServiceQueryParameter { */ async setQueryOption(queryOptionType){ try{ - await SQP.setQueryOption(this._serviceQueryParameterId_, queryOptionType); + await SQP.setQueryOption(this._SMServiceQueryParameterId, queryOptionType); }catch (e){ console.error(e); } @@ -206,7 +212,7 @@ export default class ServiceQueryParameter { */ async getExpectRecordCount(){ try{ - var count = await SQP.getExpectRecordCount(this._serviceQueryParameterId_); + var count = await SQP.getExpectRecordCount(this._SMServiceQueryParameterId); return count; }catch (e){ console.error(e); @@ -221,7 +227,7 @@ export default class ServiceQueryParameter { */ async setExpectRecordCount(count){ try{ - await SQP.setExpectRecordCount(this._serviceQueryParameterId_, count); + await SQP.setExpectRecordCount(this._SMServiceQueryParameterId, count); }catch (e){ console.error(e); } @@ -234,7 +240,7 @@ export default class ServiceQueryParameter { */ async getQueryServiceName(){ try{ - var serviceName = await SQP.getQueryServiceName(this._serviceQueryParameterId_); + var serviceName = await SQP.getQueryServiceName(this._SMServiceQueryParameterId); return serviceName; }catch (e){ console.error(e); @@ -249,7 +255,7 @@ export default class ServiceQueryParameter { */ async setQueryServiceName(name){ try{ - await SQP.setQueryServiceName(this._serviceQueryParameterId_, name); + await SQP.setQueryServiceName(this._SMServiceQueryParameterId, name); }catch (e){ console.error(e); } @@ -262,7 +268,7 @@ export default class ServiceQueryParameter { */ async toJson(){ try{ - var jsonString = await SQP.toJson(this._serviceQueryParameterId_); + var jsonString = await SQP.toJson(this._SMServiceQueryParameterId); var jsonOBj = JSON.parse(jsonString); return jsonOBj; }catch (e){ @@ -275,4 +281,4 @@ ServiceQueryParameter.QueryOptionType = { ATTRIBUTE:0, ATTRIBUTEANDGEOMETRY:1, GEOMETRY:2 -}; \ No newline at end of file +}; diff --git a/NativeModule/Size2D.js b/NativeModule/Size2D.js old mode 100644 new mode 100755 index 3b69708d..4f66a459 --- a/NativeModule/Size2D.js +++ b/NativeModule/Size2D.js @@ -1,24 +1,165 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +import { NativeModules } from 'react-native'; let S = NativeModules.JSSize2D; /** * @class Size2D + * @description 存储有序双精度数对。 */ export default class Size2D { - /** - * 创建一个Size2D实例 - * @param {number} w - 宽度 - * @param {number} h - 高度 - * @returns {Promise.} - */ - async createObj(w,h){ - try{ - var {size2DId} = await S.createObj(w,h); - var size2D = new Size2D(); - size2D.size2DId = size2DId; - return size2D; - }catch (e){ - console.log(e); - } - } -} \ No newline at end of file + /** + * 创建一个Size2D实例 + * @param {number} w - 宽度 + * @param {number} h - 高度 + * @returns {Promise.} + */ + async createObj(w, h) { + try { + let size2DId = await S.createObj(w, h); + let size2D = new Size2D(); + size2D._SMSize2DId = size2DId; + return size2D; + } catch (e) { + console.log(e); + } + } + + /** + * 返回一个新的 Size2D 对象,其宽度和高度值为大于等于指定 Size2D 对象对应值的最小整数值,例如给定 Size2D(2.3,6.8),则生成的新的对象为 Size2D(3,7) + * @param size2D + * @returns {Promise.} + */ + async ceiling(size2D) { + try { + let size2DId = await S.ceiling(size2D._SMSize2DId); + let newSize2D = new Size2D(); + newSize2D._SMSize2DId = size2DId; + return newSize2D; + } catch (e) { + console.log(e); + } + } + + /** + * 返回当前 Size2D 对象的一个拷贝 + * @returns {Promise.} + */ + async clone() { + try { + let size2DId = await S.clone(this._SMSize2DId); + let size2D = new Size2D(); + size2D._SMSize2DId = size2DId; + return size2D; + } catch (e) { + console.log(e); + } + } + + /** + * 判定此 Size2D 是否与指定 Size2D 有相同的坐标 + * @param size2D + * @returns {Promise} + */ + async ceiling(size2D) { + try { + return await S.equals(this._SMSize2DId, size2D._SMSize2DId); + } catch (e) { + console.log(e); + } + } + + /** + * 返回此 Size2D 的垂直分量,即高度 + * @returns {Promise} + */ + async getHeight() { + try { + return await S.getHeight(this._SMSize2DId); + } catch (e) { + console.log(e); + } + } + + /** + * 返回此 Size2D 的水平分量,即宽度 + * @returns {Promise} + */ + async getWidth() { + try { + return await S.getWidth(this._SMSize2DId); + } catch (e) { + console.log(e); + } + } + + /** + * 判断当前 Size2D 对象是否为空,即是否宽度和高度均为 -1.7976931348623157e+308 + * @returns {Promise.|boolean|*>} + */ + async isEmpty() { + try { + return await S.isEmpty(this._SMSize2DId); + } catch (e) { + console.log(e); + } + } + + /** + * 返回一个新的 Size2D 对象,其宽度和高度值是通过对给定 Size2D 对象的对应值进行四舍五入得到,例如给定 Size2D(2.3,6.8), 则四舍五入后的新的对象为 Size2D(2,7) + * @returns {Promise.|boolean|*>|Promise.|boolean|*>} + */ + async round() { + try { + let id = await S.round(this._SMSize2DId); + let size2D = new Size2D() + size2D._SMSize2DId = id + return size2D + } catch (e) { + console.log(e); + } + } + + /** + * 设置此 Size2D 的垂直分量,即高度 + * @param value + * @returns {Promise.} + */ + async setHeight(value) { + try { + await S.setHeight(this._SMSize2DId, value); + } catch (e) { + console.log(e); + } + } + + /** + * 设置此 Size2D 的水平分量,即宽度 + * @param value + * @returns {Promise.} + */ + async setWidth(value) { + try { + await S.setWidth(this._SMSize2DId, value); + } catch (e) { + console.log(e); + } + } + + /** + * 返回一个此 Size2D 对象宽度和高度的格式化字符串 + * @param value + * @returns {Promise.} + */ + async toString() { + try { + return await S.toString(this._SMSize2DId); + } catch (e) { + console.log(e); + } + } +} diff --git a/NativeModule/SpeechManager.js b/NativeModule/SpeechManager.js new file mode 100755 index 00000000..ea13a319 --- /dev/null +++ b/NativeModule/SpeechManager.js @@ -0,0 +1,162 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ +import { NativeModules, NativeEventEmitter } from 'react-native' +let SM = NativeModules.JSSpeechManager +const nativeEvt = new NativeEventEmitter(SM) + +const BEGIN_OF_SPEECH = "com.supermap.RN.JSSpeechManager.begin_of_speech" +const END_OF_SPEECH = "com.supermap.RN.JSSpeechManager.end_of_speech" +const ERROR = "com.supermap.RN.JSSpeechManager.error" +const RESULT = "com.supermap.RN.JSSpeechManager.result" +const VOLUME_CHANGED = "com.supermap.RN.JSSpeechManager.volume_changed" + +/** + * 语音识别类 不支持多线程 + */ +export default class SpeechManager { + /** + * 初始化语音SDK组件(只能在主线程中调用),只需在应用启动时调用一次就够了 + * @returns {Promise.} + */ + async init() { + try { + await SM.init() + } catch (e) { + console.log(e) + } + } + + /** + * 通过此函数取消当前的会话 + * @returns {Promise.} + */ + async cancel() { + try { + await SM.cancel() + } catch (e) { + console.log(e) + } + } + + /** + * 在调用本函数进行销毁前,应先保证当前不在会话中,否则,本函数将尝试取消当前会话,并返回false,此时销毁失败 + * @returns {Promise.} + */ + async destroy() { + try { + await SM.destroy() + } catch (e) { + console.log(e) + } + } + + /** + * 通过此函数,获取当前SDK是否正在进行会话 + * @returns {Promise.} + */ + async isListening() { + try { + return await SM.isListening() + } catch (e) { + console.log(e) + } + } + + /** + * 设置音频保存路径:(目前支持音频文件格式为wav格式) 通过此参数,可以在识别完成后在本地保存一个音频文件 + * 是否必须设置:否 默认值:null (不保存音频文件) + * 值范围:有效的文件相对或绝对路径(含文件名 + * 例如:Environment.getExternalStorageDirectory() + "/msc/speech.wav" + * @param path + * @returns {Promise.} + */ + async setAudioPath(path) { + try { + await SM.setAudioPath(path) + } catch (e) { + console.log(e) + } + } + + /** + * 设置语音前端点:静音超时时间,即用户多长时间不说话则当做超时处理 + * 是否必须设置:否 默认值:听写5000,其他4000 值范围:[1000, 10000] + * @param time + * @returns {Promise.} + */ + async setVAD_BOS_Time(time) { + try { + await SM.setVAD_BOS_Time(time) + } catch (e) { + console.log(e) + } + } + + /** + * 设置语音后端点:后端点静音检测时间,即用户停止说话多长时间内即认为不再输入,自动停止录音 + * 是否必须设置:否 默认值:听写1800,其他700 值范围:[0, 10000] + * @param time + * @returns {Promise.} + */ + async setVAD_EOS_Time(time) { + try { + await SM.setVAD_EOS_Time(time) + } catch (e) { + console.log(e) + } + } + + /** + * 调用本函数告知SDK,当前会话音频已全部录入 + * @returns {Promise.} + */ + async stopListening() { + try { + await SM.stopListening() + } catch (e) { + console.log(e) + } + } + + /** + * 调用此函数,开始语音听写 + * @param handlers + * @returns {Promise.} + */ + async startListening(handlers) { + try { + await SM.startListening() + if (typeof handlers.onBeginOfSpeech === "function") { + nativeEvt.addListener(BEGIN_OF_SPEECH, function () { + handlers.onBeginOfSpeech() + }) + } + if (typeof handlers.onEndOfSpeech === "function") { + nativeEvt.addListener(END_OF_SPEECH, function () { + handlers.onEndOfSpeech() + }) + } + if (typeof handlers.onVolumeChanged === "function") { + nativeEvt.addListener(VOLUME_CHANGED, function (e) { + handlers.onVolumeChanged(e) + }) + } + if (typeof handlers.onError === "function") { + nativeEvt.addListener(ERROR, function (e) { + handlers.onError(e) + }) + } + if (typeof handlers.onResult === "function") { + nativeEvt.addListener(RESULT, function (e) { + handlers.onResult(e) + }) + } + } catch (e) { + console.log(e) + } + } +} diff --git a/NativeModule/SupplyCenter.js b/NativeModule/SupplyCenter.js new file mode 100755 index 00000000..2ca610c9 --- /dev/null +++ b/NativeModule/SupplyCenter.js @@ -0,0 +1,122 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let SC = NativeModules.JSSupplyCenter; + +export default class SupplyCenter { + + async createObj() { + try { + let supplyCenterId = await SC.createObj(); + let supplyCenter = new SupplyCenter(); + supplyCenter._SMSupplyCenterId = supplyCenterId; + return supplyCenter; + } catch (e) { + console.error(e); + } + } + + /** + * 返回资源供给中心点的 ID + * @returns {Promise.} + */ + async getID() { + try { + return await SC.getID(this._SMSupplyCenterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回资源供给中心的最大耗费(阻值) + * @returns {Promise.} + */ + async getMaxWeight() { + try { + return await SC.getMaxWeight(this._SMSupplyCenterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回资源供给中心的资源量 + * @returns {Promise.} + */ + async getResourceValue() { + try { + return await SC.getResourceValue(this._SMSupplyCenterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回网络分析中资源供给中心点的类型 + * @returns {Promise.} + */ + async getType() { + try { + return await SC.getType(this._SMSupplyCenterId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置资源供给中心点的 ID + * @param id + * @returns {Promise} + */ + async setID(id) { + try { + return await SC.setID(this._SMSupplyCenterId, id); + } catch (e) { + console.error(e); + } + } + + /** + * 设置资源供给中心的最大耗费(阻值) + * @param value + * @returns {Promise} + */ + async setMaxWeight(value) { + try { + return await SC.setMaxWeight(this._SMSupplyCenterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置资源供给中心的资源量 + * @param value + * @returns {Promise} + */ + async setResourceValue(value) { + try { + return await SC.setResourceValue(this._SMSupplyCenterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置网络分析中资源供给中心点的类型 + * @param value + * @returns {Promise} + */ + async setType(value) { + try { + return await SC.setType(this._SMSupplyCenterId, value); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/SupplyCenters.js b/NativeModule/SupplyCenters.js new file mode 100755 index 00000000..06bbfb04 --- /dev/null +++ b/NativeModule/SupplyCenters.js @@ -0,0 +1,154 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let SCs = NativeModules.JSSupplyCenters; + +import SupplyCenter from './SupplyCenter' + +export default class SupplyCenters { + + async createObj() { + try { + let supplyCentersId = await SCs.createObj(); + let supplyCenters = new SupplyCenters(); + supplyCenters._SMSupplyCentersId = supplyCentersId; + return supplyCenters; + } catch (e) { + console.error(e); + } + } + + /** + * 添加资源供给中心对象到此集合中,添加成功返回被添加对象的序号 + * @param supplyCenter + * @returns {Promise.<*>} + */ + async add(supplyCenter) { + try { + let index = await SCs.add(this._SMSupplyCentersId, supplyCenter._SMSupplyCenterId); + return index + } catch (e) { + console.error(e); + } + } + + /** + * 以数组形式向集合中添加资源供给中心对象,添加成功,返回添加的资源供给中心对象的个数 + * @param supplyCenterIds + * @returns {Promise.<*>} + */ + async addRange(supplyCenterIds = []) { + try { + let ids = [] + supplyCenterIds.forEach(obj => { + ids.push(obj._SMSupplyCenterId) + }) + let count = await SCs.addRange(this._SMSupplyCentersId, ids); + return count + } catch (e) { + console.error(e); + } + } + + /** + * 清空集合中的资源供给中心对象 + * @returns {Promise.} + */ + async clear() { + try { + await SCs.clear(this._SMSupplyCentersId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回此资源供给中心集合对象中指定序号的资源供给中心对象 + * @param index + * @returns {Promise.} + */ + async get(index) { + try { + let supplyCenterId = await SCs.get(this._SMSupplyCentersId, index); + let supplyCenter = new SupplyCenter() + supplyCenter._SMSupplyCenterId = supplyCenterId + return supplyCenter + } catch (e) { + console.error(e); + } + } + + /** + * 在资源供给中心集合中删除指定序号的资源供给中心对象 + * @param index + * @returns {Promise.} + */ + async remove(index) { + try { + return await SCs.remove(this._SMSupplyCentersId, index); + } catch (e) { + console.error(e); + } + } + + /** + * 在资源供给中心集合中从指定序号开始,删除指定个数的资源供给中心对 + * @param index + * @param count + * @returns {Promise.|Promise|Promise.|Promise.|Promise.>|Promise.|Boolean|Promise.>|*|{range, text}>} + */ + async removeRange(index = 0, count = 0) { + try { + let count = await SCs.removeRange(this._SMSupplyCentersId, index, count); + return count + } catch (e) { + console.error(e); + } + } + + /** + * 返回资源供给中心点的个数 + * @returns {Promise.|Promise.|Promise.|Promise.|Promise.|Promise.>>} + */ + async getCount() { + try { + let count = await SCs.getCount(this._SMSupplyCentersId); + return count + } catch (e) { + console.error(e); + } + } + + /** + * 设置此资源供给中心集合对象中指定序号的资源供给中心对象 + * @param index + * @param supplyCenter + * @returns {Promise.} + */ + async set(index, supplyCenter) { + try { + await SCs.set(this._SMSupplyCentersId, index, supplyCenter._SMSupplyCenterId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置此资源供给中心集合对象中指定序号的资源供给中心对象 + * @param index + * @param supplyCenter + * @returns {Promise.} + */ + async toArray(index, supplyCenter) { + try { + let arr = await SCs.toArray(this._SMSupplyCentersId); + return arr + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/SystemUtil.js b/NativeModule/SystemUtil.js old mode 100644 new mode 100755 index 4947a5c5..3956ad56 --- a/NativeModule/SystemUtil.js +++ b/NativeModule/SystemUtil.js @@ -1,23 +1,151 @@ /** * Created by will on 2016/7/13. */ -import { NativeModules } from 'react-native'; +import { NativeModules, Platform } from 'react-native'; let SU = NativeModules.JSSystemUtil; +let ZA = NativeModules.JSZipArchive; /** * @class Point - 像素点类。用于标示移动设备屏幕的像素点。 */ -export default class SystemUtil{ - /** - * 获取沙盒路径 - * @returns {Promise.} - */ - async getHomeDirectory(){ - try{ - var {homeDirectory} = await SU.getHomeDirectory(); - return homeDirectory; - }catch (e){ - console.error(e); - } +export default class SystemUtil { + /** + * 获取沙盒路径 + * @returns {Promise.} + */ + async getHomeDirectory() { + try { + var { homeDirectory } = await SU.getHomeDirectory(); + return homeDirectory; + } catch (e) { + console.error(e); } + } + + /** + * 获取文件夹中的目录内容 + * @param path + * @returns {Promise} + */ + async getDirectoryContent(path) { + try { + let directoryContent = await SU.getDirectoryContent(path); + return directoryContent; + } catch (e) { + console.error(e); + } + } + + /** + * 判断文件是否存在 + * @param path + * @returns {Promise} + */ + async fileIsExist(path) { + try { + let { isExist } = await SU.fileIsExist(path); + return isExist; + } catch (e) { + console.error(e); + } + } + + /** + * 判断文件是否存在在Home Directory中 + * @param path + * @returns {Promise} + */ + async fileIsExistInHomeDirectory(path) { + try { + let { isExist } = await SU.fileIsExistInHomeDirectory(path); + return isExist; + } catch (e) { + console.error(e); + } + } + + /** + * 创建文件目录 + * @param path - 绝对路径 + * @returns {Promise} + */ + async createDirectory(path) { + try { + return await SU.createDirectory(path); + } catch (e) { + console.error(e); + } + } + + /** + * 获取文件夹内容 + * @param path + * @returns {Promise} + */ + async getPathList(path) { + try { + let fileList = await SU.getPathList(path); + return fileList; + + } catch (e) { + console.error(e); + } + } + + /** + * 根据过滤条件获取文件夹内容 + * @param path + * @param filter {name: 文件名, type: 文件类型} + * @returns {Promise} + */ + async getPathListByFilter(path, filter) { + try { + let fileList = await SU.getPathListByFilter(path, filter); + return fileList; + + } catch (e) { + console.error(e); + } + } + + /** + * 判断是否是文件夹 + * @param path + * @returns {Promise.} + */ + async isDirectory(path) { + try { + let result = await SU.isDirectory(path); + return result; + } catch (e) { + console.error(e); + } + } + async unZipFile(zipfile,targetdir) { + try { + let result; + if (Platform.OS === 'ios') { + result = await ZA.unZipFile(zipfile,targetdir); + } else { + result = await SU.unZipFile(zipfile,targetdir); + } + return result; + } catch (e) { + console.error(e); + } + } + async deleteFile(zipfile) { + try { + let result; + if (Platform.OS === 'ios') { + result = await ZA.deleteFile(zipfile); + } else { + result = await SU.deleteFile(zipfile); + } + await result; + } catch (e) { + console.error(e); + } + } } + diff --git a/NativeModule/TextPart.js b/NativeModule/TextPart.js new file mode 100755 index 00000000..2ee925b9 --- /dev/null +++ b/NativeModule/TextPart.js @@ -0,0 +1,151 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let TP = NativeModules.JSTextPart; + +import Point2D from './Point2D' +/** + * 文本子对象类。 + * 用于表示文本对象的子对象,其存储子对象的文本,旋转角度,锚点等信息并提供对子对象进行处理的相关方法。 + * 当该类的实例已被 dispose() 方法释放后,再调用该类成员的时候,则会抛出 ObjectDisposedException 异常。 + */ +export default class TextPart { + async createObj() { + try { + let textPartId = await TP.createObj(); + let textPart = new TextPart(); + textPart._SMTextPartId = textPartId; + return textPart; + } catch (e) { + console.error(e); + } + } + async createObjWithPoint2D(text, point2D) { + try { + let textPartId = await TP.createObjWithPoint2D(text, point2D._SMPoint2DId); + let textPart = new TextPart(); + textPart._SMTextPartId = textPartId; + return textPart; + } catch (e) { + console.error(e); + } + } + + /** + * 检查网络环路,返回构成环路的弧段 ID 数组 + * @returns {Promise.} + */ + async getAnchorPoint () { + try { + let id = await TP.getAnchorPoint(this._SMTextPartId); + let point2D = new Point2D().createObj(); + point2D._SMPoint2DId = id; + + return point2D; + } catch (e) { + console.error(e); + } + } + + async dispose () { + try { + await TP.dispose(this._SMTextPartId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回此文本子对象的旋转角度 + * @returns {Promise} + */ + async getRotation() { + try { + let rotation = await TP.getRotation(this._SMTextPartId); + return rotation; + } catch (e) { + console.error(e); + } + } + + /** + * 返回此文本子对象的文本内容 + * @returns {Promise.} + */ + async getText() { + try { + let text = await TP.getText(this._SMTextPartId); + return text + } catch (e) { + console.error(e); + } + } + + /** + * 设置此文本子对象锚点的横坐标 + * @returns {Promise.>} + */ + async getX() { + try { + let x = await TP.getX(this._SMTextPartId); + return x + } catch (e) { + console.error(e); + } + } + + /** + * 置此文本子对象锚点的纵坐标 + * @returns {Promise.>} + */ + async getY() { + try { + let y = await TP.getY(this._SMTextPartId); + return y + } catch (e) { + console.error(e); + } + } + + /** + * 设置此文本子对象实例的锚点,其类型为 Point2D + * @param point2D + * @returns {Promise.} + */ + async setAnchorPoint(point2D) { + try { + await TP.setAnchorPoint(this._SMTextPartId, point2D._SMPoint2DId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置此文本子对象的旋转角度 + * @param value + * @returns {Promise} + */ + async setRotation(value) { + try { + await TP.setRotation(this._SMTextPartId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置此文本子对象的文本内容 + * @param value + * @returns {Promise.} + */ + async setText(value) { + try { + await TP.setText(this._SMTextPartId, value); + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/TextStyle.js b/NativeModule/TextStyle.js new file mode 100755 index 00000000..0c2139d9 --- /dev/null +++ b/NativeModule/TextStyle.js @@ -0,0 +1,590 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let TS = NativeModules.JSTextStyle; + + +/** + * 文本风格类。 + * 用于设置 GeoText 类对象的风格。当文本风格对象实例使用 dispose() 方法释放后再调用该对象成员,将抛出 ObjectDisposedException 异常。 + */ +export default class TextStyle { + async createObj() { + try { + let textStyleId = await TS.createObj(); + let textStyle = new TextStyle(); + textStyle._SMTextStyleId = textStyleId; + return textStyle; + } catch (e) { + console.error(e); + } + } + + /** + * 返回当前 TextStyle 对象的一个拷贝 + * @returns {Promise.} + */ + async clone () { + try { + let id = await TS.clone(this._SMTextStyleId); + let newTextStyle = new TextStyle(); + newTextStyle._SMTextStyleId = id; + + return newTextStyle; + } catch (e) { + console.error(e); + } + } + + async dispose () { + try { + await TS.dispose(this._SMTextStyleId); + } catch (e) { + console.error(e); + } + } + + /** + * 将指定的几何对象绘制成图片 + * @returns {Promise.} + */ + async drawToPNG() { + try { + // TODO 待做 + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本的对齐方式 + * @returns {Promise} + */ + async getAlignment() { + try { + let textAlignment = await TS.getAlignment(this._SMTextStyleId); + return textAlignment + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本的背景色 + * @returns {Promise.<{r: Promise.r, g: Promise.g, b: Promise.b, a: Promise.a}>} + */ + async getBackColor() { + try { + let { r, g, b, a } = await TS.getBackColor(this._SMTextStyleId); + return { r, g, b, a } + } catch (e) { + console.error(e); + } + } + + /** + * 获取背景半透明度 + * @returns {Promise} + */ + async getBackTransparency() { + try { + let backTransparency = await TS.getBackTransparency(this._SMTextStyleId); + return backTransparency + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本字体的高度 + * @returns {Promise} + */ + async getFontHeight() { + try { + let fontHeight = await TS.getFontHeight(this._SMTextStyleId); + return fontHeight + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本字体的名称 + * @returns {Promise} + */ + async getFontName() { + try { + let name = await TS.getFontName(this._SMTextStyleId); + return name + } catch (e) { + console.error(e); + } + } + + /** + * 获取注记字体的缩放比例 + * @returns {Promise.} + */ + async getFontScale() { + try { + let scale = await TS.getFontScale(this._SMTextStyleId); + return scale + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本的宽度 + * @returns {Promise} + */ + async getFontWidth() { + try { + let width = await TS.getFontWidth(this._SMTextStyleId); + return width + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本的前景色 + * @returns {Promise.<{r: Promise.r, g: Promise.g, b: Promise.b, a: Promise.a}>} + */ + async getForeColor() { + try { + let { r, g, b, a } = await TS.getForeColor(this._SMTextStyleId); + return { r, g, b, a } + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本是否采用斜体,true 表示采用斜体 + * @returns {Promise} + */ + async getItalic() { + try { + let isItalic = await TS.getItalic(this._SMTextStyleId); + return isItalic + } catch (e) { + console.error(e); + } + } + + /** + * 返回字体倾斜角度,正负度之间,以度为单位,精确到0.1度 + * @returns {Promise.<{coast: Promise.coast, edges: Promise.edges, nodes: Promise.nodes}>} + */ + async getItalicAngle() { + try { + let italicAngle = await TS.findPathFromEdges(this._SMTextStyleId); + return italicAngle + } catch (e) { + console.error(e); + } + } + + /** + * 返回是否以轮廓的方式来显示文本的背景 + * @returns {Promise} + */ + async getOutline() { + try { + let isOutline= await TS.getOutline(this._SMTextStyleId); + return isOutline + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本旋转的角度 + * @returns {Promise} + */ + async getRotation() { + try { + let rotation = await TS.getRotation(this._SMTextStyleId); + return rotation + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本是否有阴影 + * @returns {Promise} + */ + async getShadow() { + try { + let hasShadow = await TS.getShadow(this._SMTextStyleId); + return hasShadow + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本字体是否加删除线 + * @returns {Promise} + */ + async getStrikeout() { + try { + let strikeout = await TS.getStrikeout(this._SMTextStyleId); + return strikeout + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本字体是否加下划线 + * @returns {Promise} + */ + async getUnderline() { + try { + let underline = await TS.getUnderline(this._SMTextStyleId); + return underline + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本字体的磅数,表示粗体的具体数值 + * @returns {Promise} + * @deprecated + */ + async getWeight() { + try { + let value = await TS.getWeight(this._SMTextStyleId); + return value + } catch (e) { + console.error(e); + } + } + + /** + * 返回注记背景是否透明 + * @returns {Promise} + */ + async isBackOpaque() { + try { + let value = await TS.isBackOpaque(this._SMTextStyleId); + return value + } catch (e) { + console.error(e); + } + } + + /** + * 返回注记是否为粗体字 + * @returns {Promise} + */ + async isBold() { + try { + let isBold = await TS.isBold(this._SMTextStyleId); + return isBold + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本大小是否固定 + * @returns {Promise} + */ + async isSizeFixed() { + try { + let isSizeFixed = await TS.isSizeFixed(this._SMTextStyleId); + return isSizeFixed + } catch (e) { + console.error(e); + } + } + + /** + * 返回文本大小是否固定 + * @param textAlignment + * @returns {Promise.} + */ + async setAlignment(textAlignment) { + try { + await TS.setAlignment(this._SMTextStyleId, textAlignment); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本的背景色 + * @param r + * @param g + * @param b + * @param a + * @returns {Promise.} + */ + async setBackColor(r, g, b, a = 1) { + try { + await TS.setBackColor(this._SMTextStyleId, r, g, b, a); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本背景是否不透明,true 表示文本背景不透明 + * @param value + * @returns {Promise.} + */ + async setBackOpaque(value) { + try { + await TS.setBackOpaque(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置背景透明度 + * @param value + * @returns {Promise} + */ + async setBackTransparency(value) { + try { + await TS.setBackTransparency(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本是否为粗体字,true 表示为粗 + * @param value + * @returns {Promise.} + */ + async setBold(value) { + try { + await TS.setBold(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本字体的高度 + * @param value + * @returns {Promise.} + */ + async setFontHeight(value) { + try { + await TS.setFontHeight(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本字体的名称 + * @param value + * @returns {Promise} + */ + async setFontName(value) { + try { + await TS.setFontName(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置注记字体的缩放比例 + * @param value + * @returns {Promise} + */ + async setFontScale(value) { + try { + await TS.setFontScale(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本的宽度 + * @param value + * @returns {Promise} + */ + async setFontWidth(value) { + try { + await TS.setFontWidth(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本的前景色 + * @param r + * @param g + * @param b + * @param a + * @returns {Promise.} + */ + async setForeColor(r, g, b, a = 1) { + try { + await TS.setForeColor(this._SMTextStyleId, r, g, b, a); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本是否采用斜体,true 表示采用斜体 + * @param value + * @returns {Promise} + */ + async setItalic(value) { + try { + await TS.setItalic(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置字体倾斜角度,正负度之间,以度为单位,精确到0.1度 + * @param value + * @returns {Promise} + */ + async setItalicAngle(value) { + try { + await TS.setItalicAngle(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置是否以轮廓的方式来显示文本的背景 + * @param value + * @returns {Promise} + */ + async setOutline(value) { + try { + await TS.setOutline(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本旋转的角度 + * @param value + * @returns {Promise} + */ + async setRotation(value) { + try { + await TS.setRotation(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置背景透明度 + * @param value + * @returns {Promise} + */ + async setBackTransparency(value) { + try { + await TS.setBackTransparency(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本是否有阴影 + * @param value + * @returns {Promise} + */ + async setShadow(value) { + try { + await TS.setShadow(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本大小是否固定 + * @param value + * @returns {Promise} + */ + async setSizeFixed(value) { + try { + await TS.setSizeFixed(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本字体是否加删除线 + * @param value + * @returns {Promise} + */ + async setStrikeout(value) { + try { + await TS.setStrikeout(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本字体是否加下划线 + * @param value + * @returns {Promise} + */ + async setUnderline(value) { + try { + await TS.setUnderline(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置文本字体的磅数,表示粗体的具体数值 + * @param value + * @returns {Promise} + * @deprecated + */ + async setWeight(value) { + try { + await TS.setWeight(this._SMTextStyleId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 返回一个表示此文本风格类对象的格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + let value = await TS.toString(this._SMTextStyleId, value); + return value + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/Theme.js b/NativeModule/Theme.js old mode 100644 new mode 100755 index fb56afc2..6d3cd870 --- a/NativeModule/Theme.js +++ b/NativeModule/Theme.js @@ -1,67 +1,123 @@ -import {NativeModules} from 'react-native'; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will + E-mail: pridehao@gmail.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native'; let T = NativeModules.JSTheme; -export default class Theme { +// import ThemeUnique from './ThemeUnique' +// import ThemeRange from './ThemeRange' +// import ThemeLabel from './ThemeLabel' - async makeThemeLabel(themeParam) { - try { - var {themeId} = await T.makeThemeLabel(themeParam.datasetVector.datasetVectorId, themeParam.rangeExpression, themeParam.rangeMode, themeParam.rangeParameter, themeParam.colorGradientType); - var theme = new Theme(); - theme.themeId = themeId; - return theme; - } catch (e) { - console.error(e); - } +/** + * @class Theme + * @description 专题图类,该类是所有专题图的基类。 + */ +export default class Theme { + + /** + * 创建标签专题图。 + * @memberOf Theme + * @param {Object} themeParam + * @description 参数对象:{datasetVector:,rangeExpression:分段字段表达式,rangeMode:分段模式,rangeParameter:分段参数,colorGradientType:颜色渐变模式} + * @returns {Promise.} + */ + async makeThemeLabel(themeParam) { + try { + let { themeId } = await T.makeThemeLabel(themeParam.datasetVector._SMDatasetVectorId, themeParam.rangeExpression, themeParam.rangeMode, themeParam.rangeParameter, themeParam.colorGradientType); + let theme = new Theme(); + theme._SMThemeId = themeId; + return theme; + } catch (e) { + console.error(e); } - - async makeThemeUnique(themeParam) { - try { - var {themeId} = await T.makeThemeUnique(themeParam.datasetVector.datasetVectorId, themeParam.uniqueExpression, themeParam.colorGradientType); - var theme = new Theme(); - theme.themeId = themeId; - return theme; - } catch (e) { - console.error(e); - } + } + + /** + * 生成默认的单值专题图。 + * @memberOf Theme + * @param {Object} themeParam + * @description 参数对象:{datasetVector:,uniqueExpression:单值专题图字段表达式,colorGradientType:颜色渐变模式} + * @returns {Promise.} + */ + async makeThemeUnique(themeParam) { + try { + let { themeId } = await T.makeThemeUnique(themeParam.datasetVector._SMDatasetVectorId, themeParam.uniqueExpression, themeParam.colorGradientType); + let theme = new Theme(); + theme._SMThemeId = themeId; + return theme; + } catch (e) { + console.error(e); } + } + + /** + * 生成默认的分段专题图。 + * @memberOf Theme + * @param {Object} themeParam + * @description 参数对象:{datasetVector:,rangeExpression:分段字段表达式,rangeMode:分段模式,rangeParameter:分段参数,colorGradientType:颜色渐变模式} + * @returns {Promise.} + */ + async makeThemeRange(themeParam) { + try { + let { themeId } = await T.makeThemeRange(themeParam.datasetVector._SMDatasetVectorId, themeParam.rangeExpression, themeParam.rangeMode, themeParam.rangeParameter, themeParam.colorGradientType); + let theme = new Theme(); + theme._SMThemeId = themeId; + return theme; + } catch (e) { + console.error(e); + } + } + + async getType() { + try { + return await T.getType(this._SMThemeId) + } catch (e) { + console.error(e); + } + } + } Theme.RangeMode = { - NONE: 6, - EQUALINTERVAL: 0, - SQUAREROOT: 1, - STDDEVIATION: 2, - LOGARITHM: 3, - QUANTILE: 4, - CUSTOMINTERVAL: 5 + NONE: 6, + EQUALINTERVAL: 0, + SQUAREROOT: 1, + STDDEVIATION: 2, + LOGARITHM: 3, + QUANTILE: 4, + CUSTOMINTERVAL: 5 }; Theme.ColorGradientType = { - BLACKWHITE: 0, - REDWHITE: 1, - GREENWHITE: 2, - BLUEWHITE: 3, - YELLOWWHITE: 4, - PINKWHITE: 5, - CYANWHITE: 6, - REDBLACK: 7, - GREENBLACK: 8, - BLUEBLACK: 9, - YELLOWBLACK: 10, - PINKBLACK: 11, - CYANBLACK: 12, - YELLOWRED: 13, - YELLOWGREEN: 14, - YELLOWBLUE: 15, - GREENBLUE: 16, - GREENRED: 17, - BLUERED: 18, - PINKRED: 19, - PINKBLUE: 20, - CYANBLUE: 21, - CYANGREEN: 22, - RAINBOW: 23, - GREENORANGEVIOLET: 24, - TERRAIN: 25, - SPECTRUM: 26 -} \ No newline at end of file + BLACKWHITE: 0, + REDWHITE: 1, + GREENWHITE: 2, + BLUEWHITE: 3, + YELLOWWHITE: 4, + PINKWHITE: 5, + CYANWHITE: 6, + REDBLACK: 7, + GREENBLACK: 8, + BLUEBLACK: 9, + YELLOWBLACK: 10, + PINKBLACK: 11, + CYANBLACK: 12, + YELLOWRED: 13, + YELLOWGREEN: 14, + YELLOWBLUE: 15, + GREENBLUE: 16, + GREENRED: 17, + BLUERED: 18, + PINKRED: 19, + PINKBLUE: 20, + CYANBLUE: 21, + CYANGREEN: 22, + RAINBOW: 23, + GREENORANGEVIOLET: 24, + TERRAIN: 25, + SPECTRUM: 26 +} diff --git a/NativeModule/ThemeLabel.js b/NativeModule/ThemeLabel.js new file mode 100755 index 00000000..c86add34 --- /dev/null +++ b/NativeModule/ThemeLabel.js @@ -0,0 +1,268 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TL = NativeModules.JSThemeLabel + +import Theme from './Theme' +import TextStyle from './TextStyle' + +/** + * 标签专题图子项类 + */ +export default class ThemeLabel extends Theme { + + constructor() { + super() + Object.defineProperty(this, "_SMThemeLabelId", { + get: function () { + return this._SMThemeId + }, + set: function (_SMThemeLabelId) { + this._SMThemeId = _SMThemeLabelId; + } + }) + } + + async createObj(){ + try{ + let id = await TL.createObj(); + let themeLabel = new ThemeLabel(); + themeLabel._SMThemeId = id; + return themeLabel; + }catch (e){ + console.error(e); + } + } + + async createObjClone(theme) { + try { + let id = await TL.createObjClone(theme._SMThemeId); + let themeLabel = new ThemeLabel(); + themeLabel._SMThemeId = id; + return themeLabel; + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的矢量数据集、分段字段表达式、分段模式和相应的分段参数生成默认的标签专题图 + * @param datasetVector Object + * @param expression String + * @param rangeMode Number + * @param rangeParameter Number + * @param colorGradientType(option) + * @returns {Promise.} + */ + async makeDefault() { + try { + let id + if (arguments && arguments.length === 5) { + id = await TL.makeDefaultWithColorGradient(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2], arguments[3], arguments[4]) + } else { + id = await TL.makeDefault(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2], arguments[3]) + } + let themeRange = new ThemeLabel() + themeRange.__SMThemeId = id + return themeRange + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项的名称 + * @returns {Promise} + */ + async getCaption() { + try { + return await TL.getCaption(this._SMThemeId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项的分段起始值 + * @returns {Promise} + */ + async getEnd() { + try { + return await TL.getEnd(this._SMThemeId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项所对应的显示风格 + * @returns {Promise} + */ + async getStyle() { + try { + let textStyleId = await TL.getUniformStyle(this._SMThemeId) + let textStyle = new TextStyle() + textStyle._SMTextStyleId = textStyleId + return textStyle + } catch (e) { + console.error(e) + } + } + + /** + * 回标签专题图子项是否可见 + * @returns {Promise} + */ + async isVisible() { + try { + return await TL.isVisible(this._SMThemeId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的名称 + * @param value + * @returns {Promise.} + */ + async setCaption(value) { + try { + await TL.setCaption(this._SMThemeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的分段终止值 + * @param value + * @returns {Promise.} + */ + async setEnd(value) { + try { + await TL.setEnd(this._SMThemeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的分段起始值 + * @param value + * @returns {Promise.} + */ + async setStart(value) { + try { + await TL.setStart(this._SMThemeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项所对应的显示风格 + * @param textStyle + * @returns {Promise.} + */ + async setStyle(textStyle) { + try { + await TL.setStyle(this._SMThemeId, textStyle._SMTextStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项是否可见 + * @param value + * @returns {Promise.} + */ + async setVisible(value) { + try { + await TL.setVisible(this._SMThemeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + return await TL.toString(this._SMThemeId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置统一文本风格 + * @param style + * @returns {Promise} + */ + async setUniformStyle(style) { + try { + return await TL.setUniformStyle(this._SMThemeId, style._SMTextStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标注字段表达式 + * @param expression + * @returns {Promise.} + */ + async setLabelExpression(expression) { + try { + await TL.setLabelExpression(this._SMThemeId, expression) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段字段表达式 + * @param expression + * @returns {Promise.} + */ + async setRangeExpression(expression) { + try { + await TL.setRangeExpression(this._SMThemeId, expression) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标注字段表达式 + * @returns {Promise} + */ + async getLabelExpression() { + try { + return await TL.getLabelExpression(this._SMThemeId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段字段表达式 + * @returns {Promise} + */ + async getRangeExpression() { + try { + return await TL.getRangeExpression(this._SMThemeId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/ThemeLabelItem.js b/NativeModule/ThemeLabelItem.js new file mode 100755 index 00000000..6768419f --- /dev/null +++ b/NativeModule/ThemeLabelItem.js @@ -0,0 +1,156 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TLI = NativeModules.JSThemeLabelItem + +import TextStyle from './TextStyle' + +/** + * 标签专题图子项类 + */ +export default class ThemeLabelItem { + + async createObj() { + try { + let id = await TLI.createObj() + let themeLabelItem = new ThemeLabelItem() + themeLabelItem._SMThemeLabelItemId = id + return themeLabelItem + } catch (e) { + console.log(e) + } + } + + /** + * 返回标签专题图子项的名称 + * @returns {Promise} + */ + async getCaption() { + try { + return await TLI.getCaption(this._SMThemeLabelItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项的分段起始值 + * @returns {Promise} + */ + async getEnd() { + try { + return await TLI.getEnd(this._SMThemeLabelItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项所对应的显示风格 + * @returns {Promise} + */ + async getStyle() { + try { + let textStyleId = await TLI.getStyle(this._SMThemeLabelItemId) + let textStyle = new TextStyle() + textStyle._SMTextStyleId = textStyleId + return textStyle + } catch (e) { + console.error(e) + } + } + + /** + * 回标签专题图子项是否可见 + * @returns {Promise} + */ + async isVisible() { + try { + return await TLI.isVisible(this._SMThemeLabelItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的名称 + * @param value + * @returns {Promise.} + */ + async setCaption(value) { + try { + await TLI.setCaption(this._SMThemeLabelItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的分段终止值 + * @param value + * @returns {Promise.} + */ + async setEnd(value) { + try { + await TLI.setEnd(this._SMThemeLabelItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项的分段起始值 + * @param value + * @returns {Promise.} + */ + async setStart(value) { + try { + await TLI.setStart(this._SMThemeLabelItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项所对应的显示风格 + * @param textStyle + * @returns {Promise.} + */ + async setStyle(textStyle) { + try { + await TLI.setStyle(this._SMThemeLabelItemId, textStyle._SMTextStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置标签专题图子项是否可见 + * @param value + * @returns {Promise.} + */ + async setVisible(value) { + try { + await TLI.setVisible(this._SMThemeLabelItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回标签专题图子项格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + return await TLI.toString(this._SMThemeLabelItemId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/ThemeRange.js b/NativeModule/ThemeRange.js new file mode 100755 index 00000000..19eeb98f --- /dev/null +++ b/NativeModule/ThemeRange.js @@ -0,0 +1,348 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TR = NativeModules.JSThemeRange + +import Theme from './Theme' +import ThemeRangeItem from './ThemeRangeItem' + +/** + * 分段专题图子项类 + */ +export default class ThemeRange extends Theme { + + constructor(){ + super() + Object.defineProperty(this,"_SMThemeRangeId",{ + get:function () { + return this._SMThemeId + }, + set:function (_SMThemeRangeId) { + this._SMThemeId = _SMThemeRangeId; + } + }) + } + + async createObj(){ + try{ + let id = await TR.createObj(); + let themeRange = new ThemeRange(); + themeRange._SMThemeRangeId = id; + return themeRange; + }catch (e){ + console.error(e); + } + } + + async createObjClone(theme){ + try{ + let id = await TR.createObjClone(theme._SMThemeId); + let themeRange = new ThemeRange(); + themeRange._SMThemeRangeId = id; + return themeRange; + }catch (e){ + console.error(e); + } + } + + async dispose() { + try { + return await TR.dispose(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段字段表达式 + * @param value + * @returns {Promise} + */ + async setRangeExpression(value) { + try { + await TR.setRangeExpression(this._SMThemeRangeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段字段表达式 + * @param value + * @returns {Promise} + */ + async getRangeExpression() { + try { + return await TR.getRangeExpression(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 把一个分段专题图子项添加到分段列表的开头 + * @param item + * @returns {Promise} + */ + async addToHead(item) { + try { + return await TR.addToHead(this._SMThemeRangeId, item._SMThemeRangeItemId) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 把一个分段专题图子项添加到分段列表的尾部 + * @param item + * @returns {Promise} + */ + async addToTail(item) { + try { + return await TR.addToTail(this._SMThemeRangeId, item._SMThemeRangeItemId) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 返回分段专题图中分段的个数 + * @returns {Promise.|Promise.|Promise.|Promise.|Promise.|Promise.>>|Promise.|Promise.|Promise.>|Promise.|Promise.|Promise.|*>} + */ + async getCount() { + try { + return await TR.getCount(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回指定序号的分段专题图中单值专题图子项 + * @returns {Promise.|Promise.|Promise.|Promise.|Promise.|Promise.>>|Promise.|Promise.|Promise.>|Promise.|Promise.|Promise.|*>} + */ + async getItem(value) { + try { + let id = await TR.getItem(this._SMThemeRangeId, value) + let item = new ThemeRangeItem() + item._SMThemeRangeItemId = id + return item + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段专题图子项格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + return await TR.toString(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 根据给定的矢量数据集、分段字段表达式、分段模式、相应的分段参数和颜色渐变模式生成默认的分段专题图 + * @param datasetVector Object + * @param expression String + * @param rangeMode Number + * @param rangeParameter Number + * @param colorGradientType(option) + * @returns {Promise.} + */ + async makeDefault() { + try { + let id + if (arguments[4] && typeof arguments[4] === 'number') { + id = await TR.makeDefaultWithColorGradient(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2], arguments[3], arguments[4]) + } else { + id = await TR.makeDefault(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2], arguments[3]) + } + let themeRange = new ThemeRange() + themeRange._SMThemeRangeId = id + return themeRange + } catch (e) { + console.error(e) + } + } + + /** + * 设置范围分段专题图的舍入精度 + * @param value + * @returns {Promise.} + */ + async setPrecision(value) { + try { + await TR.setPrecision(this._SMThemeRangeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 对分段专题图中分段的风格进行反序显示 + * @returns {Promise.} + */ + async reverseStyle() { + try { + await TR.reverseStyle(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置是否固定偏移量 + * @param value + * @returns {Promise.} + */ + async setOffsetFixed(value) { + try { + await TR.setOffsetFixed(this._SMThemeRangeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置X偏移量 + * @param value + * @returns {Promise.} + */ + async setOffsetX(value) { + try { + await TR.setOffsetX(this._SMThemeRangeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回X偏移量 + * @returns {Promise.} + */ + async getOffsetX() { + try { + await TR.getOffsetX(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置Y偏移量 + * @param value + * @returns {Promise.} + */ + async setOffsetY(value) { + try { + await TR.setOffsetY(this._SMThemeRangeId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回Y偏移量 + * @returns {Promise.} + */ + async getOffsetY() { + try { + await TR.getOffsetY(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 根据给定的拆分分段值将一个指定序号的分段专题图子项拆分成两个具有各自风格和名称的分段专题图子项 + * @param index + * @param splitValue + * @param style1 + * @param caption1 + * @param style2 + * @param caption2 + * @returns {Promise.} + */ + async split(index, splitValue, style1, caption1, style2, caption2) { + try { + return await TR.split(this._SMThemeRangeId, index, splitValue, style1._SMGeoStyleId, caption1, style2._SMGeoStyleId, caption2) + } catch (e) { + console.error(e) + } + } + + /** + * 合并一个从指定序号起始的给定个数的分段专题图子项,并赋给合并后分段专题图子项显示风格和名称 + * @param index + * @param count + * @param style + * @param caption + * @returns {Promise.|Array|*>} + */ + async merge(index, count, style, caption) { + try { + return await TR.split(this._SMThemeRangeId, index, count, style._SMGeoStyleId, caption) + } catch (e) { + console.error(e) + } + } + + /** + * 返回是否固定偏移量 + * @returns {Promise} + */ + async isOffsetFixed() { + try { + return await TR.isOffsetFixed(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取自定义段长 + * @returns {Promise} + */ + async getCustomInterval() { + try { + return await TR.getCustomInterval(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 获取范围分段专题图的舍入精度 + * @returns {Promise} + */ + async getPrecision() { + try { + return await TR.getPrecision(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回当前的分段模式 + * @returns {Promise} + */ + async getRangeMode() { + try { + return await TR.getRangeMode(this._SMThemeRangeId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/ThemeRangeItem.js b/NativeModule/ThemeRangeItem.js new file mode 100755 index 00000000..0d532dda --- /dev/null +++ b/NativeModule/ThemeRangeItem.js @@ -0,0 +1,156 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TRI = NativeModules.JSThemeRangeItem + +import GeoStyle from './GeoStyle' + +/** + * 分段专题图子项类 + */ +export default class ThemeRangeItem { + + async createObj() { + try { + let id = await TRI.createObj() + let themeRangeItem = new ThemeRangeItem() + themeRangeItem._SMThemeRangeItemId = id + return themeRangeItem + } catch (e) { + console.log(e) + } + } + + /** + * 返回分段专题图子项的名称 + * @returns {Promise} + */ + async getCaption() { + try { + return await TRI.getCaption(this._SMThemeRangeItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段专题图子项的分段起始值 + * @returns {Promise} + */ + async getEnd() { + try { + return await TRI.getEnd(this._SMThemeRangeItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段专题图子项所对应的显示风格 + * @returns {Promise} + */ + async getStyle() { + try { + let geoStyleId = await TRI.getStyle(this._SMThemeRangeItemId) + let geoStyle = new GeoStyle() + geoStyle._SMGeoStyleId = geoStyleId + return geoStyle + } catch (e) { + console.error(e) + } + } + + /** + * 回分段专题图子项是否可见 + * @returns {Promise} + */ + async isVisible() { + try { + return await TRI.isVisible(this._SMThemeRangeItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段专题图子项的名称 + * @param value + * @returns {Promise.} + */ + async setCaption(value) { + try { + await TRI.setCaption(this._SMThemeRangeItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段专题图子项的分段终止值 + * @param value + * @returns {Promise.} + */ + async setEnd(value) { + try { + await TRI.setEnd(this._SMThemeRangeItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段专题图子项的分段起始值 + * @param value + * @returns {Promise.} + */ + async setStart(value) { + try { + await TRI.setStart(this._SMThemeRangeItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段专题图子项所对应的显示风格 + * @param geoStyle + * @returns {Promise.} + */ + async setStyle(geoStyle) { + try { + await TRI.setStyle(this._SMThemeRangeItemId, geoStyle._SMGeoStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置分段专题图子项是否可见 + * @param value + * @returns {Promise.} + */ + async setVisible(value) { + try { + await TRI.setVisible(this._SMThemeRangeItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回分段专题图子项格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + return await TRI.toString(this._SMThemeRangeItemId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/ThemeUnique.js b/NativeModule/ThemeUnique.js new file mode 100755 index 00000000..da31e0d4 --- /dev/null +++ b/NativeModule/ThemeUnique.js @@ -0,0 +1,227 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TU = NativeModules.JSThemeUnique + +import Theme from './Theme' +import ThemeUniqueItem from './ThemeUniqueItem' +import GeoStyle from './GeoStyle' + +/** + * 单值专题图子项类 + */ +export default class ThemeUnique extends Theme { + + constructor() { + super() + Object.defineProperty(this, "_SMThemeUniqueId", { + get: function () { + return this._SMThemeId + }, + set: function (_SMThemeUniqueId) { + this._SMThemeId = _SMThemeUniqueId; + } + }) + } + + async createObj() { + try { + let id = await TU.createObj(); + let themeUnique = new ThemeUnique(); + themeUnique._SMThemeUniqueId = id; + return themeUnique; + } catch (e) { + console.error(e); + } + } + + async createObjClone(theme) { + try { + let id = await TU.createObjClone(theme._SMThemeId); + let themeUnique = new ThemeUnique(); + themeUnique._SMThemeUniqueId = id; + return themeUnique; + } catch (e) { + console.error(e); + } + } + + async dispose() { + try { + if (!this._SMThemeUniqueId) return + return await TU.dispose(this._SMThemeUniqueId) + } catch (e) { + console.error(e) + } + } + + /** + * 根据给定的矢量数据集、单值专题图字段表达式和颜色渐变模式生成默认的单值专题图 + * @param datasetVector + * @param expression + * @param colorGradientType / colors (option) + * @returns {Promise.} + */ + async makeDefault() { + try { + let id + if (arguments[2] && typeof arguments[2] === 'number') { + id = await TU.makeDefaultWithColorGradient(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2]) + } else if (arguments[2] && arguments[2] instanceof Array) { + id = await TU.makeDefaultWithColors(arguments[0]._SMDatasetVectorId, arguments[1], arguments[2]) + } else { + id = await TU.makeDefault(arguments[0]._SMDatasetVectorId, arguments[1]) + } + let themeUnique = new ThemeUnique() + themeUnique._SMThemeUniqueId = id + return themeUnique + } catch (e) { + console.error(e) + } + } + + /** + * 删除单值专题图的子项 + * @returns {Promise.} + */ + async clear() { + try { + await TU.clear(this._SMThemeUniqueId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回单值专题图中分段的个数 + * @returns {Promise.<*>} + */ + async getCount() { + try { + return await TU.getCount(this._SMThemeUniqueId) + } catch (e) { + console.error(e) + } + } + + /** + * 把一个单值专题图子项添加到单值列表的开头 + * @param item + * @returns {Promise} + */ + async getItem(value) { + try { + let id = await TU.getItem(this._SMThemeUniqueId, value) + let item = new ThemeUniqueItem() + item._SMThemeUniqueItemId = id + return item + } catch (e) { + console.error(e) + return false + } + } + + /** + * 添加单值专题图子项 + * @param item + * @returns {Promise.<*>} + */ + async add(item) { + try { + return await TU.add(this._SMThemeUniqueId, item._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 删除一个指定序号的单值专题图子项 + * @param index + * @returns {Promise.<*>} + */ + async remove(index) { + try { + return await TU.remove(this._SMThemeUniqueId, index) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 将给定的单值专题图子项插入到指定序号的位置 + * @param index + * @param item + * @returns {Promise.<*>} + */ + async insert(index, item) { + try { + return await TU.insert(this._SMThemeUniqueId, index, item._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 返回单值专题图中指定分段字段值在当前分段序列中的序号 + * @param value + * @returns {Promise.<*>} + */ + async indexOf(value) { + try { + return await TU.indexOf(this._SMThemeUniqueId, value) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 返回单值专题图中指定分段字段值在当前分段序列中的序号 + * @returns {Promise.<*>} + */ + async getDefaultStyle() { + try { + let styleId = await TU.getDefaultStyle(this._SMThemeUniqueId) + let style = new GeoStyle() + style._SMGeoStyleId = styleId + return style + } catch (e) { + console.error(e) + return false + } + } + + /** + * 返回单值专题图字段表达式 + * @returns {Promise.<*>} + */ + async getUniqueExpression() { + try { + return await TU.getUniqueExpression(this._SMThemeUniqueId) + } catch (e) { + console.error(e) + return false + } + } + + /** + * 设置单值专题图字段表达式 + * @param expression + * @returns {Promise.<*>} + */ + async setUniqueExpression(expression) { + try { + await TU.setUniqueExpression(this._SMThemeUniqueId, expression) + } catch (e) { + console.error(e) + return false + } + } +} diff --git a/NativeModule/ThemeUniqueItem.js b/NativeModule/ThemeUniqueItem.js new file mode 100755 index 00000000..20d1c473 --- /dev/null +++ b/NativeModule/ThemeUniqueItem.js @@ -0,0 +1,143 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: yangshanglong + E-mail: yangshanglong@supermap.com + + **********************************************************************************/ + +import { NativeModules } from 'react-native' +let TUI = NativeModules.JSThemeUniqueItem + +import GeoStyle from './GeoStyle' + +/** + * 单值专题图子项类 + */ +export default class ThemeUniqueItem { + + async createObj() { + try { + let id = await TUI.createObj() + let themeUniqueItem = new ThemeUniqueItem() + themeUniqueItem._SMThemeUniqueItemId = id + return themeUniqueItem + } catch (e) { + console.log(e) + } + } + + /** + * 返回单值专题图子项的名称 + * @returns {Promise} + */ + async getCaption() { + try { + return await TUI.getCaption(this._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回单值专题图子项的单值 + * @returns {Promise} + */ + async getUnique() { + try { + return await TUI.getUnique(this._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回单值专题图子项所对应的显示风格 + * @returns {Promise} + */ + async getStyle() { + try { + let geoStyleId = await TUI.getStyle(this._SMThemeUniqueItemId) + let geoStyle = new GeoStyle() + geoStyle._SMGeoStyleId = geoStyleId + return geoStyle + } catch (e) { + console.error(e) + } + } + + /** + * 回单值专题图子项是否可见 + * @returns {Promise} + */ + async isVisible() { + try { + return await TUI.isVisible(this._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置单值专题图子项的名称 + * @param value + * @returns {Promise.} + */ + async setCaption(value) { + try { + await TUI.setCaption(this._SMThemeUniqueItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置单值专题图子项的单值 + * @param value + * @returns {Promise.} + */ + async setUnique(value) { + try { + await TUI.setUnique(this._SMThemeUniqueItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置单值专题图子项所对应的显示风格 + * @param geoStyle + * @returns {Promise.} + */ + async setStyle(geoStyle) { + try { + await TUI.setStyle(this._SMThemeUniqueItemId, geoStyle._SMGeoStyleId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置单值专题图子项是否可见 + * @param value + * @returns {Promise.} + */ + async setVisible(value) { + try { + await TUI.setVisible(this._SMThemeUniqueItemId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 返回单值专题图子项格式化字符串 + * @returns {Promise.} + */ + async toString() { + try { + return await TUI.toString(this._SMThemeUniqueItemId) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/TimeLine.js b/NativeModule/TimeLine.js new file mode 100755 index 00000000..bbf8ee7c --- /dev/null +++ b/NativeModule/TimeLine.js @@ -0,0 +1,336 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + Description:时间轴类 + + **********************************************************************************/ +import {NativeModules} from 'react-native'; +let TL = NativeModules.JSTimeLine; +import ChartView from './ChartView.js'; + +/** + * @class TimeLine + * @description 时间轴类,根据时间对数据进行展示的地图可视化图表 + */ +export default class TimeLine { + + /** + * 创建TimeLine对象 + * @memberOf TimeLine + * @param {number} reactTag - 视图对应的reactTag值 + * @returns {Promise.} + */ + async createObj(reactTag){ + var{_SMTimeLine} = TL.createObj(reactTag); + var timeLine = new TimeLine(); + timeLine._SMTimeLine = _SMTimeLine; + return timeLine; + } + + /** + * 设置滑块大小 + * @memberOf TimeLine + * @param {number} size + * @returns {Promise.} + */ + async setSliderSize(size){ + try{ + await TL.setSliderSize(this._SMTimeLine,size); + }catch(e){ + console.error(e); + } + } + + /** + * 获取滑块大小 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getSliderSize(){ + try{ + var{size} = await TL.getSliderSize(this._SMTimeLine); + return size; + }catch(e){ + console.error(e); + } + } + + /** + * 设置滑块风格 + * @memberOf TimeLine + * @param {string} url - 图片资源路径 + * @returns {Promise.} + */ + async setSliderImage(url){ + try{ + await TL.setSliderImage(this._SMTimeLine,url); + }catch(e){ + console.error(e); + } + } + + /** + * 获取滑块风格 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getSliderImage(){ + try{ + var {image} = await TL.getSliderImage(this._SMTimeLine); + return image; + }catch(e){ + console.error(e); + } + } + + /** + * 设置滑块选中风格 + * @memberOf TimeLine + * @param {string} url - 图片资源路径 + * @returns {Promise.} + */ + async setSliderSelectedImage(url){ + try{ + await TL.setSliderSelectedImage(this._SMTimeLine,url); + }catch(e){ + console.error(e); + } + } + + /** + * 获取滑块选中风格 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getSliderSelectedImage(){ + try{ + var {image} = await TL.getSliderSelectedImage(this._SMTimeLine); + return image; + }catch(e){ + console.error(e); + } + } + + /** + * 设置滑块标签字体大小 + * @memberOf TimeLine + * @param {number} size - 字体大小 + * @returns {Promise.} + */ + async setSliderLabelSize(size){ + try{ + await TL.setSliderLabelSize(this._SMTimeLine,size); + }catch(e){ + console.error(e); + } + } + + /** + * 获取滑块标签字体大小 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getSliderLabelSize(){ + try{ + var {size} = await TL.getSliderLabelSize(this._SMTimeLine); + return size; + }catch(e){ + console.error(e); + } + } + + /** + * 设置滑块标签字体颜色 + * @memberOf TimeLine + * @param {Arr} color - 字体颜色数组 + * @returns {Promise.} + */ + async setSliderLabelColor(color){ + try{ + await TL.setSliderLabelColor(this._SMTimeLine,color); + }catch(e){ + console.error(e); + } + } + + /** + * 获取滑块标签字体颜色 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getSliderLabelColor(){ + try{ + var {color} = await TL.getSliderLabelColor(this._SMTimeLine); + return color; + }catch(e){ + console.error(e); + } + } + + /** + * 设置时间轴风格 + * @memberOf TimeLine + * @param {Arr} color - 字体颜色数组 + * @returns {Promise.} + */ + async setTimeLineColor(color){ + try{ + await TL.setTimeLineColor(this._SMTimeLine,color); + }catch(e){ + console.error(e); + } + } + + /** + * 获取时间轴风格 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getTimeLineColor(){ + try{ + var {color} = await TL.getTimeLineColor(this._SMTimeLine); + return color; + }catch(e){ + console.error(e); + } + } + + /** + * 设置播放按钮风格 + * @memberOf TimeLine + * @param {string} url - 图片资源路径 + * @returns {Promise.} + */ + async setPlayImage(url){ + try{ + await TL.setPlayImage(this._SMTimeLine,url); + }catch(e){ + console.error(e); + } + } + + /** + * 获取播放按钮风格 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getPlayImage(){ + try{ + var {image} = await TL.getPlayImage(this._SMTimeLine); + return image; + }catch(e){ + console.error(e); + } + } + + /** + * 设置停止按钮风格 + * @memberOf TimeLine + * @param {string} url - 图片资源路径 + * @returns {Promise.} + */ + async setStopPlayImage(url){ + try{ + await TL.setStopPlayImage(this._SMTimeLine,url); + }catch(e){ + console.error(e); + } + } + + /** + * 获取停止按钮风格 + * @memberOf TimeLine + * @returns {Promise.} + */ + async getStopPlayImage(){ + try{ + var {image} = await TL.getStopPlayImage(this._SMTimeLine); + return image; + }catch(e){ + console.error(e); + } + } + + /** + * 设置时间轴是否水平放置 + * @memberOf TimeLine + * @param {boolean} b + * @returns {Promise.} + */ + async setHorizontal(b){ + try{ + await TL.setHorizontal(this._SMTimeLine,b); + }catch(e){ + console.error(e); + } + } + + /** + * 获取时间轴是否水平放置 + * @memberOf TimeLine + * @returns {Promise.} + */ + async isHorizontal(){ + try{ + var {bool} = await TL.isHorizontal(this._SMTimeLine); + return bool; + }catch(e){ + console.error(e); + } + } + + /** + * 添加关联图表 + * @memberOf TimeLine + * @param {ChartView} chart - 关联图表 + * @returns {Promise.} + */ + async addChart(chart){ + try{ + await TL.addChart(this._SMTimeLine,chart.chartviewId); + }catch(e){ + console.error(e); + } + } + + /** + * 移除关联图表 + * @memberOf TimeLine + * @returns {Promise.} + */ + async removeChart(chart){ + try{ + await TL.removeChart(this._SMTimeLine,chart.chartviewId); + }catch(e){ + console.error(e); + } + } + + /** + * 清空所有关联图表 + * @memberOf TimeLine + * @returns {Promise.} + */ + async clearChart(){ + try{ + await TL.clearChart(this._SMTimeLine); + }catch(e){ + console.error(e); + } + } + + /** + * 加载时间轴 + * @memberOf TimeLine + * @returns {Promise.} + */ + async load(){ + try{ + await TL.load(this._SMTimeLine); + }catch(e){ + console.error(e); + } + } + +} diff --git a/NativeModule/Track.js b/NativeModule/Track.js old mode 100644 new mode 100755 index f1dc7bd2..5ce67939 --- a/NativeModule/Track.js +++ b/NativeModule/Track.js @@ -1,3 +1,9 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let T = NativeModules.JSTrack; import Dataset from './Dataset.js'; @@ -5,6 +11,7 @@ import Datasets from './Datasets.js'; /** * @class Track + * @description 轨迹记录类。 */ export default class Track { @@ -17,7 +24,7 @@ export default class Track { try{ var {_trackId_} = await T.createObj(); var track = new Track(); - track._trackId_ = _trackId_; + track._SMTrackId = _trackId_; return track; }catch (e){ console.error(e); @@ -33,9 +40,9 @@ export default class Track { */ async createDataset(datasource,name){ try{ - var {datasetId} = await T.createDataset(this._trackId_,datasourceId,name); + var {datasetId} = await T.createDataset(this._SMTrackId,datasource._SMDatasourceId,name); var dataset = new Dataset(); - dataset.datasetId = datasetId; + dataset._SMDatasetId = datasetId; return dataset; }catch (e){ console.error(e); @@ -43,13 +50,13 @@ export default class Track { } /** - * 获取是否用户自定义定位点。 + * 获取是否用户自定义定位点。(该方法只支持android设备) * @memberOf Track * @returns {Promise.} */ async getCustomLocation(){ try{ - var {customLocation} = await T.getCustomLocation(track._trackId_); + var {customLocation} = await T.getCustomLocation(track._SMTrackId); return customLocation; }catch (e){ console.error(e); @@ -63,9 +70,9 @@ export default class Track { */ async getDataset(){ try{ - var {datasetId} = await T.getDataset(this._trackId_); + var {datasetId} = await T.getDataset(this._SMTrackId); var dataset = new Dataset(); - dataset.datasetId = datasetId; + dataset._SMDatasetId = datasetId; return dataset; }catch (e){ console.error(e); @@ -79,7 +86,7 @@ export default class Track { */ async getDistanceInterval(){ try{ - var {distanceInterval} = await T.getDistanceInterval(track._trackId_); + var {distanceInterval} = await T.getDistanceInterval(track._SMTrackId); return distanceInterval; }catch (e){ console.error(e); @@ -93,10 +100,18 @@ export default class Track { */ async getMatchDatasets(){ try{ - var {datasetsId} = await T.getMatchDatasets(this._trackId_); - var datasets = new Datasets(); - datasets.datasetsId = datasetsId; - return datasets; + var {idArr} = await T.getMatchDatasets(this._SMTrackId); + if(idArr === false){ + return false; + } + + var objArr = []; + for(var i=0; i} */ async isSpeedDirectionEnable(){ try{ - var {isSpeedDirectionEnable} = await T.isSpeedDirectionEnable(track._trackId_); + var {isSpeedDirectionEnable} = await T.isSpeedDirectionEnable(track._SMTrackId); return isSpeedDirectionEnable; }catch (e){ console.error(e); @@ -131,14 +146,14 @@ export default class Track { } /** - * 设置是否用户自定义定位点,默认为true。 + * 设置是否用户自定义定位点,默认为true。(该方法只支持android设备) * @memberOf Track * @param {boolean} bCustomLocation - 是否用户自定义定位点。 * @returns {Promise.} */ async setCustomLocation(bCustomLocation){ try{ - await T.setCustomLocation(track._trackId_,bCustomLocation); + await T.setCustomLocation(track._SMTrackId,bCustomLocation); }catch (e){ console.error(e); } @@ -147,12 +162,12 @@ export default class Track { /** * 设置轨迹数据集,用户使用轨迹功能时,要先使用创建轨迹数据集的方法创建数据集,然后调用该方法设置轨迹数据集。 * @memberOf Track - * @param {object} dataset - 轨迹数据集。 + * @param {object} datasetVector - 轨迹数据集。 * @returns {Promise.} */ async setDataset(dataset){ try{ - await T.setDataset(track._trackId_,dataset.datasetId); + await T.setDataset(track._SMTrackId,dataset._SMDatasetId); }catch (e){ console.error(e); } @@ -166,7 +181,7 @@ export default class Track { */ async setDistanceInterval(interval){ try{ - await T.setDistanceInterval(track._trackId_,interval); + await T.setDistanceInterval(track._SMTrackId,interval); }catch (e){ console.error(e); } @@ -174,13 +189,14 @@ export default class Track { /** * 设置GPSData数据,只有将setCustomLocation(boolean bCustomLocation)参数设置为true时,该接口才起作用。 + *(该方法只支持android设备) * @memberOf Track * @param {object} jsonGpsData - 用户设置的gpsdata。 * @returns {Promise.} */ async setGPSData(jsonGpsData){ try{ - await T.setGPSData(track._trackId_,jsonGpsData); + await T.setGPSData(track._SMTrackId,jsonGpsData); }catch (e){ console.error(e); } @@ -189,12 +205,14 @@ export default class Track { /** * 设置匹配线数据集集合,为轨迹抓路功能使用,该数据集集合应为线数据集集合。 * @memberOf Track - * @param {object} datsets - 设置匹配线数据集集合。 + * @deprecated + * @param {Array} datsets - 设置匹配线数据集集合。 * @returns {Promise.} */ async setMatchDatasets(datsets){ try{ - await T.setMatchDatasets(track._trackId_,datsets.datasetId); + //to do + await T.setMatchDatasets(track._SMTrackId,datsets._SMDatasetsId); }catch (e){ console.error(e); } @@ -202,13 +220,14 @@ export default class Track { /** * 设置速度和方位角模式,支持转弯、高速、低速场景下记录轨迹点的稀疏和加密 + *(该方法只支持android设备) * @memberOf Track * @param {number} speedDirectionEnable - 距离间隔。 * @returns {Promise.} */ async setSpeedDirectionEnable(speedDirectionEnable){ try{ - await T.setSpeedDirectionEnable(track._trackId_,speedDirectionEnable); + await T.setSpeedDirectionEnable(track._SMTrackId,speedDirectionEnable); }catch (e){ console.error(e); } @@ -217,12 +236,12 @@ export default class Track { /** * 设置时间间隔,单位为秒,时间间隔值必须大于20秒,否则设置时间间隔失败。 * @memberOf Track - * @param timeInterval - 时间间隔。 + * @param {number} timeInterval - 时间间隔。 * @returns {Promise.} */ async setTimeInterval(timeInterval){ try{ - await T.setTimeInterval(track._trackId_,timeInterval); + await T.setTimeInterval(track._SMTrackId,timeInterval); }catch (e){ console.error(e); } @@ -235,7 +254,7 @@ export default class Track { */ async startTrack(){ try{ - await T.startTrack(track._trackId_); + await T.startTrack(track._SMTrackId); }catch (e){ console.error(e); } @@ -248,9 +267,9 @@ export default class Track { */ async stopTrack(){ try{ - await T.stopTrack(track._trackId_); + await T.stopTrack(track._SMTrackId); }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/TrackingLayer.js b/NativeModule/TrackingLayer.js old mode 100644 new mode 100755 index 7630661b..fc8e2d8f --- a/NativeModule/TrackingLayer.js +++ b/NativeModule/TrackingLayer.js @@ -1,12 +1,19 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules} from 'react-native'; let TL = NativeModules.JSTrackingLayer; /** * @class TrackingLayer + * @description 跟踪图层类。 */ export default class TrackingLayer { /** - * 添加几何数据 + * 向当前跟踪图层中添加一个几何对象,并给出该几何对象的标签信息。 * @memberOf TrackingLayer * @param {object} geometry - 矢量对象 * @param {string} tag - 矢量对象的标签名称 @@ -14,23 +21,22 @@ export default class TrackingLayer { */ async add(geometry,tag){ try{ - var id = geometry.geometryId; - console.log('id:'+id); - await TL.add(this.trackingLayerId,id,tag); + var id = geometry._SMGeometryId; + await TL.add(this._SMTrackingLayerId,id,tag); }catch (e){ console.error(e); } } /** - * 清除追踪层的集合对象 + * 清空此跟踪图层中的所有几何对象。 * @returns {Promise.} */ async clear(){ try{ - await TL.clear(this.trackingLayerId); + await TL.clear(this._SMTrackingLayerId); }catch (e){ console.error(e); } } -} \ No newline at end of file +} diff --git a/NativeModule/TraditionalNavi.js b/NativeModule/TraditionalNavi.js old mode 100644 new mode 100755 index 8d735f6e..53207911 --- a/NativeModule/TraditionalNavi.js +++ b/NativeModule/TraditionalNavi.js @@ -1,3 +1,9 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Wang zihao + E-mail: pridehao@gmail.com + + **********************************************************************************/ import {NativeModules,DeviceEventEmitter,NativeEventEmitter,Platform} from 'react-native'; let TN = NativeModules.JSNavigation; import GeoLine from './GeoLine'; @@ -5,6 +11,7 @@ import GeoLine from './GeoLine'; const nativeEvt = new NativeEventEmitter(TN); /** * @class TraditionalNavi + * @description 导航类,导航类提供路径分析和引导功能。(该类对象只能通过mapControl类下方法获取) */ export default class TraditionalNavi { /** @@ -15,7 +22,7 @@ export default class TraditionalNavi { */ async connectNaviData(dataPath){ try{ - var {success} = await TN.connectNaviData(this.traditionalNaviId,dataPath); + var {success} = await TN.connectNaviData(this._SMTraditionalNaviId,dataPath); return success; }catch (e){ console.log(e); @@ -31,7 +38,7 @@ export default class TraditionalNavi { */ async routeAnalyst(mode){ try{ - var {result} = await TN.routeAnalyst(this.traditionalNaviId,mode); + var {result} = await TN.routeAnalyst(this._SMTraditionalNaviId,mode); return result; }catch (e){ console.log(e); @@ -48,7 +55,7 @@ export default class TraditionalNavi { */ async setStartPoint(x,y,map){ try{ - await TN.setStartPoint(this.traditionalNaviId,x,y,map.mapId); + await TN.setStartPoint(this._SMTraditionalNaviId,x,y,map._SMMapId); }catch (e){ console.log(e); } @@ -64,7 +71,7 @@ export default class TraditionalNavi { */ async setDestinationPoint(x,y,map){ try{ - await TN.setDestinationPoint(this.traditionalNaviId,x,y,map.mapId); + await TN.setDestinationPoint(this._SMTraditionalNaviId,x,y,map._SMMapId); }catch (e){ console.log(e); } @@ -79,7 +86,7 @@ export default class TraditionalNavi { */ async startGuide(status){ try{ - var {guiding} = await TN.startGuide(this.traditionalNaviId,status); + var {guiding} = await TN.startGuide(this._SMTraditionalNaviId,status); return guiding; }catch (e){ console.log(e); @@ -95,7 +102,7 @@ export default class TraditionalNavi { */ async addWayPoint(x,y){ try{ - var {added} = await TN.addWayPoint(this.traditionalNaviId,x,y); + var {added} = await TN.addWayPoint(this._SMTraditionalNaviId,x,y); return added; }catch (e){ console.log(e); @@ -109,7 +116,7 @@ export default class TraditionalNavi { */ async stopGuide(){ try{ - var {stopped} = await TN.stopGuide(this.traditionalNaviId); + var {stopped} = await TN.stopGuide(this._SMTraditionalNaviId); return stopped; }catch (e){ console.log(e); @@ -124,7 +131,7 @@ export default class TraditionalNavi { */ async setSpeechParam(speech){ try{ - var {speak} = await TN.setSpeechParam(this.traditionalNaviId,speech); + var {speak} = await TN.setSpeechParam(this._SMTraditionalNaviId,speech); return speak; }catch (e){ console.log(e); @@ -139,7 +146,7 @@ export default class TraditionalNavi { */ async setGPSData(gpsData){ try{ - await TN.setGPSData(this.traditionalNaviId,gpsData); + await TN.setGPSData(this._SMTraditionalNaviId,gpsData); }catch (e){ console.log(e); } @@ -152,7 +159,7 @@ export default class TraditionalNavi { */ async locateMap(){ try{ - await TN.locateMap(this.traditionalNaviId); + await TN.locateMap(this._SMTraditionalNaviId); }catch (e){ console.log(e); } @@ -165,7 +172,7 @@ export default class TraditionalNavi { */ async isGuiding(){ try{ - var {guiding} = await TN.isGuiding(this.traditionalNaviId); + var {guiding} = await TN.isGuiding(this._SMTraditionalNaviId); return guiding; }catch (e){ console.log(e); @@ -180,7 +187,7 @@ export default class TraditionalNavi { */ async getTimeToDestination(speed){ try{ - var {time} = await TN.getTimeToDestination(this.traditionalNaviId,speed); + var {time} = await TN.getTimeToDestination(this._SMTraditionalNaviId,speed); return time; }catch (e){ console.log(e); @@ -195,9 +202,9 @@ export default class TraditionalNavi { */ async getRoute(){ try{ - var {geoLineId} = await TN.getRoute(this.traditionalNaviId); + var {geoLineId} = await TN.getRoute(this._SMTraditionalNaviId); var geoLine = new GeoLine(); - geoLine.geoLineId = geoLineId; + geoLine._SMGeoLineId = geoLineId; return geoLine; }catch (e){ @@ -213,7 +220,7 @@ export default class TraditionalNavi { */ async enablePanOnGuide(bPan){ try{ - await TN.enablePanOnGuide(this.traditionalNaviId,bPan); + await TN.enablePanOnGuide(this._SMTraditionalNaviId,bPan); }catch (e){ console.log(e); } @@ -226,7 +233,7 @@ export default class TraditionalNavi { */ async cleanPath(){ try{ - await TN.cleanPath(this.traditionalNaviId); + await TN.cleanPath(this._SMTraditionalNaviId); }catch (e){ console.log(e); } @@ -238,14 +245,14 @@ export default class TraditionalNavi { */ async getNaviPath() { try { - var {naviPath} = await TN.getNaviPath(this.traditionalNaviId); + var {naviPath} = await TN.getNaviPath(this._SMTraditionalNaviId); return naviPath; } catch (e) { console.log(e); } } - /** + /* * 设置导航信息变化监听器。 * @param callback - 导航信息变化监听器回调函数。 * 用法:await industryNavi.setDistanceChangeListener( @@ -273,7 +280,7 @@ export default class TraditionalNavi { */ async addNaviInfoListener(events){ try{ - var success = await TN.addNaviInfoListener(this.navigation2Id); + var success = await TN.addNaviInfoListener(this._SMTraditionalNaviId); if(success){ //差异化 if(Platform.OS === 'ios'){ diff --git a/NativeModule/TransportationAnalyst.js b/NativeModule/TransportationAnalyst.js new file mode 100755 index 00000000..cf1858db --- /dev/null +++ b/NativeModule/TransportationAnalyst.js @@ -0,0 +1,281 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let TA = NativeModules.JSTransportationAnalyst; + +import TransportationAnalystSetting from './TransportationAnalystSetting' +import GeoLineM from './GeoLineM' + +export default class TransportationAnalyst { + + async createObj() { + try { + let transportationAnalystId = await TA.createObj(); + let transportationAnalyst = new TransportationAnalyst(); + transportationAnalyst._SMTransportationAnalystId = transportationAnalystId; + return transportationAnalyst; + } catch (e) { + console.error(e); + } + } + + async dispose() { + try { + await TA.dispose(this._SMTransportationAnalystId); + } catch (e) { + console.error(e); + } + } + + /** + * 创建内存文件 + * @param path + * @returns {Promise} + */ + async createModel(path) { + try { + return await TA.createModel(this._SMTransportationAnalystId, path); + } catch (e) { + console.error(e); + } + } + + /** + * 根据指定的参数进行最近设施查找分析,事件点为结点 ID + * @param transportationAnalystParameter + * @param eventID + * @param facilityCount + * @param isFromEvent + * @param maxWeight + * @returns {Promise} + */ + async findClosestFacilityByNode(transportationAnalystParameter, eventID, + facilityCount, isFromEvent, maxWeight) { + try { + return await TA.findClosestFacilityByNode(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, eventID, + facilityCount, isFromEvent, maxWeight); + } catch (e) { + console.error(e); + } + } + + /** + * 根据指定的参数进行最近设施查找分析,事件点为结点 ID + * @param transportationAnalystParameter + * @param eventID + * @param facilityCount + * @param isFromEvent + * @param maxWeight + * @returns {Promise} + */ + async findClosestFacilityByPoint2D(transportationAnalystParameter, point2D, + facilityCount, isFromEvent, maxWeight) { + try { + return await TA.findClosestFacilityByPoint2D(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, point2D._SMPoint2DId, + facilityCount, isFromEvent, maxWeight); + } catch (e) { + console.error(e); + } + } + + /** + * 根据给定的参数进行选址分区分析 + * @param locationAnalystParameter + * @returns {Promise} + */ + async findLocation(locationAnalystParameter) { + try { + return await TA.findLocation(this._SMTransportationAnalystId, locationAnalystParameter._SMLocationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 多旅行商(物流配送)分析,配送中心为结点 ID 数组 + * @param transportationAnalystParameter + * @param centerNodes + * @param hasLeastTotalCost + * @returns {Promise} + */ + async findMTSPPathByNodes(transportationAnalystParameter, centerNodes = [], hasLeastTotalCost = true) { + try { + return await TA.findMTSPPathByNodes(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, centerNodes, hasLeastTotalCost); + } catch (e) { + console.error(e); + } + } + + /** + * 多旅行商(物流配送)分析,配送中心为点坐标串 + * @param transportationAnalystParameter + * @param centerPoints [{x, y}, {x, y}] + * @param hasLeastTotalCost + * @returns {Promise} + */ + async findMTSPPathByPoint2Ds(transportationAnalystParameter, centerPoints = [], hasLeastTotalCost = false) { + try { + let { + pathGuideIds, routeIds, edges, + nodesArr, stopIndexesArr, + stopWeightsArr, weightsArr + } = await TA.findMTSPPathByPoint2Ds(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, centerPoints, hasLeastTotalCost); + + let routes = [] + if (routeIds) { + for (let i = 0; i < routeIds.length; i++) { + let route = new GeoLineM() + route._SMGeoLineId = routeIds[i] + routes.push(route) + } + } + + return { pathGuideIds, routes, edges, nodesArr, stopIndexesArr, stopWeightsArr, weightsArr } + } catch (e) { + console.error(e); + } + } + + /** + * 最佳路径分析 + * @param transportationAnalystParameter + * @param hasLeastTotalCost + * @returns {Promise} + */ + async findPath(transportationAnalystParameter, hasLeastTotalCost = false) { + try { + let { + pathGuideIds, routeIds, edges, + nodesArr, stopIndexesArr, + stopWeightsArr, weightsArr + } = await TA.findPath(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, hasLeastTotalCost); + + let routes = [] + if (routeIds) { + for (let i = 0; i < routeIds.length; i++) { + let route = new GeoLineM() + route._SMGeometryId = routeIds[i] + // route._SMGeoLineId = routeIds[i] + routes.push(route) + } + } + + return { pathGuideIds, routes, edges, nodesArr, stopIndexesArr, stopWeightsArr, weightsArr } + } catch (e) { + console.error(e); + } + } + + /** + * 服务区分析 + * @param transportationAnalystParameter + * @param weights + * @param isFromCenter + * @param isCenterMutuallyExclusive + * @returns {Promise} + */ + async findServiceArea(transportationAnalystParameter, weights = [], isFromCenter = true, isCenterMutuallyExclusive = true) { + try { + return await TA.findServiceArea(this._SMTransportationAnalystId, + transportationAnalystParameter._SMTransportationAnalystParameterId, weights, isFromCenter, hasLeastTotalCost); + } catch (e) { + console.error(e); + } + } + + /** + * 返回交通网络分析环境设置对象 + * @returns {Promise.>} + */ + async getAnalystSetting() { + try { + let settingId = await TA.getAnalystSetting(this._SMTransportationAnalystId) + let setting = await new TransportationAnalystSetting().createObj() + setting._SMTransportationAnalystSettingId = settingId + return setting + } catch (e) { + console.error(e); + } + } + + /** + * 加载网络模型 + * @returns {Promise.<*>} + */ + async load() { + try { + return await TA.load(this._SMTransportationAnalystId) + } catch (e) { + console.error(e); + } + } + + /** + * 加载内存文件 + * @param filePath + * @param networkDataset + * @returns {Promise.>} + */ + async loadModel(filePath, networkDataset) { + try { + return await TA.loadModel(this._SMTransportationAnalystId, filePath, networkDataset._SMDatasetVectorId) + } catch (e) { + console.error(e); + } + } + + /** + * 设置交通网络分析环境设置对象 + * @param transportationAnalystSetting + * @returns {Promise.} + */ + async setAnalystSetting(transportationAnalystSetting) { + try { + await TA.setAnalystSetting(this._SMTransportationAnalystId, transportationAnalystSetting._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e); + } + } + + /** + * 该方法用来更新弧段的权值 + * @param edgeID + * @param fromNodeID + * @param toNodeID + * @param weightName + * @param weight + * @returns {Promise.} + */ + async updateEdgeWeight(edgeID, fromNodeID, toNodeID, weightName, weight) { + try { + await TA.updateEdgeWeight(this._SMTransportationAnalystId, edgeID, fromNodeID, toNodeID, weightName, weight) + } catch (e) { + console.error(e); + } + } + + /** + * 该方法用来更新转向结点的权值 + * @param nodeID + * @param fromEdgeID + * @param toEdgeID + * @param weightName + * @param weight + * @returns {Promise.} + */ + async updateTurnNodeWeight(nodeID, fromEdgeID, toEdgeID, weightName, weight) { + try { + await TA.updateTurnNodeWeight(this._SMTransportationAnalystId, nodeID, fromEdgeID, toEdgeID, weightName, weight) + } catch (e) { + console.error(e) + } + } +} diff --git a/NativeModule/TransportationAnalystParameter.js b/NativeModule/TransportationAnalystParameter.js new file mode 100755 index 00000000..c5f27aa7 --- /dev/null +++ b/NativeModule/TransportationAnalystParameter.js @@ -0,0 +1,323 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let TAP = NativeModules.JSTransportationAnalystParameter; + +export default class TransportationAnalystParameter { + + async createObj() { + try { + let transportationAnalystParameterId = await TAP.createObj(); + let transportationAnalystParameter = new TransportationAnalystParameter(); + transportationAnalystParameter._SMTransportationAnalystParameterId = transportationAnalystParameterId; + return transportationAnalystParameter; + } catch (e) { + console.error(e); + } + } + + /** + * 返回障碍弧段 ID 列表 + * @returns {Promise.>|Promise.>} + */ + async getBarrierEdges() { + try { + return await TAP.getBarrierEdges(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回障碍结点 ID 列表 + * @returns {Promise} + */ + async getBarrierNodes() { + try { + return await TAP.getBarrierNodes(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回障碍结点的坐标列表 + * @returns {Promise.>} + */ + async getBarrierPoints() { + try { + return await TAP.getBarrierPoints(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析时途经结点 ID 的集合 + * @returns {Promise.} + */ + async getNodes() { + try { + return await TAP.getNodes(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析时途经点的集合 + * @returns {Promise} + */ + async getPoints() { + try { + return await TAP.getPoints(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回转向权值字段 + * @returns {Promise.>} + */ + async getTurnWeightField() { + try { + return await TAP.getTurnWeightField(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回权值字段信息的名称 + * @returns {Promise.>} + */ + async getWeightName() { + try { + return await TAP.getWeightName(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析结果中是否包含途经弧段集合 + * @returns {Promise} + */ + async isEdgesReturn() { + try { + return await TAP.isEdgesReturn(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析结果中是否包含途经结点的集合 + * @returns {Promise} + */ + async isNodesReturn() { + try { + return await TAP.isNodesReturn(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析结果中是否包含行驶导引集合 + * @returns {Promise} + */ + async isPathGuidesReturn() { + try { + return await TAP.isPathGuidesReturn(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析结果中是否包含路由(GeoLineM)对象的集合 + * @returns {Promise} + */ + async isRoutesReturn() { + try { + return await TAP.isRoutesReturn(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 返回分析结果中是否要包含站点索引的集合 + * @returns {Promise} + */ + async isStopIndexesReturn() { + try { + return await TAP.isStopIndexesReturn(this._SMTransportationAnalystParameterId); + } catch (e) { + console.error(e); + } + } + + /** + * 设置障碍弧段 ID 列表 + * @param arr + * @returns {Promise.} + */ + async setBarrierEdges(arr = []) { + try { + await TAP.setBarrierEdges(this._SMTransportationAnalystParameterId, arr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置障碍结点 ID 列表 + * @param arr + * @returns {Promise.} + */ + async setBarrierNodes(arr = []) { + try { + await TAP.setBarrierNodes(this._SMTransportationAnalystParameterId, arr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置障碍结点的坐标列表 + * @param points2DsArr + * @returns {Promise.} + */ + async setBarrierPoints(points2DsArr = []) { + try { + await TAP.setBarrierPoints(this._SMTransportationAnalystParameterId, points2DsArr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析结果中是否包含途经弧段的集合 + * @param value + * @returns {Promise.} + */ + async setEdgesReturn(value = true) { + try { + await TAP.setEdgesReturn(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析时途经结点 ID 的集合 + * @param value + * @returns {Promise.} + */ + async setNodes(value = []) { + try { + await TAP.setNodes(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析结果中是否包含结点的集合 + * @param value + * @returns {Promise.} + */ + async setNodesReturn(value = true) { + try { + await TAP.setNodesReturn(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析结果中是否包含行驶导引集合 + * @param value + * @returns {Promise.} + */ + async setPathGuidesReturn(value = true) { + try { + await TAP.setPathGuidesReturn(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析结果中是否包含路由(GeoLineM)对象的集合 + * @param value + * @returns {Promise.} + */ + async setRoutesReturn(value = true) { + try { + await TAP.setRoutesReturn(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析结果中是否要包含站点索引的集合 + * @param value + * @returns {Promise.} + */ + async setStopIndexesReturn(value = true) { + try { + await TAP.setStopIndexesReturn(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置分析时途经点的集合 + * @param points2DsArr + * @returns {Promise.} + */ + async setPoints(points2DsArr = []) { + try { + await TAP.setPoints(this._SMTransportationAnalystParameterId, points2DsArr); + } catch (e) { + console.error(e); + } + } + + /** + * 设置转向权值字段 + * @param value + * @returns {Promise.} + */ + async setTurnWeightField(value) { + try { + await TAP.setTurnWeightField(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置权值字段信息的名称,即交通网络分析环境设置(TransportationAnalystSetting)中的权值字段信息集合(WeightFieldInfos) + * 中的某一个权值字段信息对象(WeightFieldInfo)的 getName() 方法的返回值 + * @param value + * @returns {Promise.} + */ + async setWeightName(value) { + try { + await TAP.setWeightName(this._SMTransportationAnalystParameterId, value); + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/TransportationAnalystSetting.js b/NativeModule/TransportationAnalystSetting.js new file mode 100755 index 00000000..dc9f0582 --- /dev/null +++ b/NativeModule/TransportationAnalystSetting.js @@ -0,0 +1,575 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native' +let TAS = NativeModules.JSTransportationAnalystSetting + +import DatasetVector from './DatasetVector' +import WeightFieldInfos from './WeightFieldInfos' + +export default class TransportationAnalystSetting { + + async createObj() { + try { + let transportationAnalystSettingId = await TAS.createObj() + let transportationAnalystSetting = new TransportationAnalystSetting() + transportationAnalystSetting._SMTransportationAnalystSettingId = transportationAnalystSettingId + return transportationAnalystSetting + } catch (e) { + console.error(e) + } + } + + /** + * 返回障碍弧段 ID 列表 + * @returns {Promise.|Promise.>|Promise.>|Promise.>>} + */ + async getBarrierEdges() { + try { + return await TAS.getBarrierEdges(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回障碍结点 ID 列表 + * @returns {Promise} + */ + async getBarrierNodes() { + try { + return await TAS.getBarrierNodes(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回交通网络分析中弧段过滤表达式 + * @returns {Promise} + */ + async getEdgeFilter() { + try { + return await TAS.getEdgeFilter(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回网络数据集中标志弧段 ID 的字段 + * @returns {Promise} + */ + async getEdgeIDField() { + try { + return await TAS.getEdgeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回存储弧段名称的字段 + * @returns {Promise} + */ + async getEdgeNameField() { + try { + return await TAS.getEdgeNameField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回网络数据集中标志弧段起始结点 ID 的字段 + * @returns {Promise} + */ + async getFNodeIDField() { + try { + return await TAS.getFNodeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回用于表示正向单行线的字符串的数组 + * @returns {Promise} + */ + async getFTSingleWayRuleValues() { + try { + return await TAS.getFTSingleWayRuleValues(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回用于分析的网络数据集 + * @returns {Promise.} + */ + async getNetworkDataset() { + try { + let datasetVectorId = await TAS.getNetworkDataset(this._SMTransportationAnalystSettingId) + let datasetVector = new DatasetVector() + datasetVector._SMDatasetVectorId = datasetVectorId + return datasetVector + } catch (e) { + console.error(e) + } + } + + /** + * 返回网络数据集中标识结点 ID 的字段 + * @returns {Promise.<*>} + */ + async getNodeIDField() { + try { + return await TAS.getNodeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回存储结点名称的字段的字段名 + * @returns {Promise} + */ + async getNodeNameField() { + try { + return await TAS.getNodeNameField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回用于表示禁行线的字符串的数组 + * @returns {Promise} + */ + async getProhibitedWayRuleValues() { + try { + return await TAS.getProhibitedWayRuleValues(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回网络数据集中表示网络弧段的交通规则的字段 + * @returns {Promise} + */ + async getRuleField() { + try { + return await TAS.getRuleField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回用于表示逆向单行线的字符串的数组 + * @returns {Promise} + */ + async getTFSingleWayRuleValues() { + try { + return await TAS.getTFSingleWayRuleValues(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置障碍结点 ID 列表 + * @returns {Promise} + */ + async getTNodeIDField() { + try { + return await TAS.getTNodeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向表数据集 + * @returns {Promise.} + */ + async getTurnDataset() { + try { + let datasetVectorId = await TAS.getTurnDataset(this._SMTransportationAnalystSettingId) + let datasetVector = new DatasetVector() + datasetVector._SMDatasetVectorId = datasetVectorId + return datasetVector + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向起始弧段 ID 的字段 + * @returns {Promise} + */ + async getTurnFEdgeIDField() { + try { + return await TAS.getTurnFEdgeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向结点 ID 的字段 + * @returns {Promise} + */ + async getTurnNodeIDField() { + try { + return await TAS.getTurnNodeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向终止弧段 ID 的字段 + * @returns {Promise} + */ + async getTurnTEdgeIDField() { + try { + return await TAS.getTurnTEdgeIDField(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 返回转向权值字段集合 + * @returns {Promise} + */ + async getTurnWeightFields() { + try { + let weightFieldInfosId = await TAS.getTurnWeightFields(this._SMTransportationAnalystSettingId) + let weightFieldInfos = new WeightFieldInfos() + weightFieldInfos._SMWeightFieldInfosId = weightFieldInfosId + return weightFieldInfos + } catch (e) { + console.error(e) + } + } + + /** + * 返回用于表示双向通行线的字符串的数组 + * @returns {Promise} + */ + async getTwoWayRuleValues() { + try { + return await TAS.getTwoWayRuleValues(this._SMTransportationAnalystSettingId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置障碍结点 ID 列表 + * @returns {Promise.} + */ + async getWeightFieldInfos() { + try { + let weightFieldInfosId = await TAS.getWeightFieldInfos(this._SMTransportationAnalystSettingId) + let weightFieldInfos = new WeightFieldInfos() + weightFieldInfos._SMWeightFieldInfosId = weightFieldInfosId + return weightFieldInfos + } catch (e) { + console.error(e) + } + } + + /** + * 设置障碍弧段的 ID 列表 + * @param value + * @returns {Promise.} + */ + async setBarrierEdges(value = []) { + try { + await TAS.setBarrierEdges(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置障碍结点的 ID 列表 + * @param value + * @returns {Promise.} + */ + async setBarrierNodes(value = []) { + try { + await TAS.setBarrierNodes(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置交通网络分析中弧段过滤表达式 + * @param value + * @returns {Promise.} + */ + async setEdgeFilter(value) { + try { + await TAS.setEdgeFilter(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置网络数据集中标志弧段 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setEdgeIDField(value) { + try { + await TAS.setEdgeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置存储弧段名称的字段 + * @param value + * @returns {Promise.} + */ + async setEdgeNameField(value) { + try { + await TAS.setEdgeNameField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置网络数据集中标志弧段起始结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setFNodeIDField(value) { + try { + await TAS.setFNodeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于表示正向单行线的字符串的数组 + * @param value + * @returns {Promise.} + */ + async setFTSingleWayRuleValues(value = []) { + try { + await TAS.setFTSingleWayRuleValues(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于分析的网络数据集 + * @param datasetVector + * @returns {Promise.} + */ + async setNetworkDataset(datasetVector) { + try { + await TAS.setNetworkDataset(this._SMTransportationAnalystSettingId, datasetVector._SMDatasetVectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置网络数据集中标识结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setNodeIDField(value) { + try { + await TAS.setNodeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置存储结点名称的字段的字段名 + * @param value + * @returns {Promise.} + */ + async setNodeNameField(value) { + try { + await TAS.setNodeNameField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于表示禁行线的字符串的数组 + * @param value + * @returns {Promise.} + */ + async setProhibitedWayRuleValues(value = []) { + try { + await TAS.setProhibitedWayRuleValues(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置网络数据集中表示网络弧段的交通规则的字段 + * @param value + * @returns {Promise.} + */ + async setRuleField(value) { + try { + await TAS.setRuleField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于表示逆向单行线的字符串的数组 + * @param value + * @returns {Promise.} + */ + async setTFSingleWayRuleValues(value = []) { + try { + await TAS.setTFSingleWayRuleValues(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置网络数据集中标志弧段终止结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setTNodeIDField(value) { + try { + await TAS.setTNodeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置点到弧段的距离容限 + * @param value + * @returns {Promise.} + */ + async setTolerance(value) { + try { + await TAS.setTolerance(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置点到弧段的距离容限 + * @param value + * @returns {Promise.} + */ + async setTurnDataset(datasetVector) { + try { + await TAS.setTurnDataset(this._SMTransportationAnalystSettingId, datasetVector._SMDatasetVectorId) + } catch (e) { + console.error(e) + } + } + + /** + * 设置转向起始弧段 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setTurnFEdgeIDField(value) { + try { + await TAS.setTurnFEdgeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置转向结点 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setTurnNodeIDField(value) { + try { + await TAS.setTurnNodeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置转向终止弧段 ID 的字段 + * @param value + * @returns {Promise.} + */ + async setTurnTEdgeIDField(value) { + try { + await TAS.setTurnTEdgeIDField(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置转向权值字段集合 + * @param value + * @returns {Promise.} + */ + async setTurnWeightFields(value = []) { + try { + await TAS.setTurnWeightFields(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置用于表示双向通行线的字符串的数组 + * @param value + * @returns {Promise.} + */ + async setTwoWayRuleValues(value = []) { + try { + await TAS.setTwoWayRuleValues(this._SMTransportationAnalystSettingId, value) + } catch (e) { + console.error(e) + } + } + + /** + * 设置权值字段信息集合对象 + * @param weightFieldInfos + * @returns {Promise.} + */ + async setWeightFieldInfos(weightFieldInfos) { + try { + await TAS.setWeightFieldInfos(this._SMTransportationAnalystSettingId, weightFieldInfos._SMWeightFieldInfosId) + } catch (e) { + console.error(e) + } + } + +} diff --git a/NativeModule/WeightFieldInfo.js b/NativeModule/WeightFieldInfo.js new file mode 100755 index 00000000..bc3787d8 --- /dev/null +++ b/NativeModule/WeightFieldInfo.js @@ -0,0 +1,121 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let WFI = NativeModules.JSWeightFieldInfo; + + +/** + * 权值字段信息类。 + * 存储了网络分析中权值字段的相关信息,包括正向权值字段与反向权值字段。权值字段是表示花费的权重值的字段。 + * 正向权值字段值表示沿弧段的起点到终点所需的耗费。反向权值字段值表示沿弧段的终点到起点所需的耗费。 + */ +export default class WeightFieldInfo { + async createObj() { + try { + let weightFieldInfoId = await WFI.createObj(); + let weightFieldInfo = new WeightFieldInfo(); + weightFieldInfo._SMWeightFieldInfoId = weightFieldInfoId; + return weightFieldInfo; + } catch (e) { + console.error(e); + } + } + + /** + * 返回正向权值字段 + * @returns {Promise.} + */ + async getFTWeightField () { + try { + let ftWeightField = await WFI.getFTWeightField(this._SMWeightFieldInfoId); + + return ftWeightField; + } catch (e) { + console.error(e); + } + } + + /** + * 返回权值字段信息的名称 + * @returns {Promise.>} + */ + async getName () { + try { + let name = await WFI.getName(this._SMWeightFieldInfoId); + + return name; + } catch (e) { + console.error(e); + } + } + + /** + * 返回反向权值字段 + * @returns {Promise} + */ + async getTFWeightField () { + try { + let tfWeightField = await WFI.getTFWeightField(this._SMWeightFieldInfoId); + + return tfWeightField; + } catch (e) { + console.error(e); + } + } + + /** + * 设置正向权值字段 + * @param value + * @returns {Promise.} + */ + async setFTWeightField (value) { + try { + await WFI.setFTWeightField(this._SMWeightFieldInfoId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置权值字段信息的名称 + * @param value + * @returns {Promise.} + */ + async setName (value) { + try { + await WFI.setName(this._SMWeightFieldInfoId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置反向权值字段 + * @param value + * @returns {Promise.} + */ + async setTFWeightField (value) { + try { + await WFI.setTFWeightField(this._SMWeightFieldInfoId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 设置反向权值字段 + * @returns {Promise.|Promise>} + */ + async getFTWeightField () { + try { + let ftWeightField = await WFI.getFTWeightField(this._SMWeightFieldInfoId); + + return ftWeightField; + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/WeightFieldInfos.js b/NativeModule/WeightFieldInfos.js new file mode 100755 index 00000000..c28231a0 --- /dev/null +++ b/NativeModule/WeightFieldInfos.js @@ -0,0 +1,131 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Yang Shanglong + E-mail: yangshanglong@supermap.com + **********************************************************************************/ +import { NativeModules } from 'react-native'; +let WFIs = NativeModules.JSWeightFieldInfos; + +import WeightFieldInfo from './WeightFieldInfo' +/** + * 权值字段信息集合类。该类是权值字段信息对象(WeightFieldInfo)的集合,用于对权值字段信息对象进行管理,如添加、删除、获取指定名称或索引的权值字段信息对象等 + */ +export default class JSWeightFieldInfos { + async createObj() { + try { + let weightFieldInfosId = await WFIs.createObj(); + let weightFieldInfos = new JSWeightFieldInfos(); + weightFieldInfos._SMWeightFieldInfosId = weightFieldInfosId; + return weightFieldInfos; + } catch (e) { + console.error(e); + } + } + + /** + * 用于在权值字段信息集合中加入一个元素 + * @param weightFieldInfo + * @returns {Promise.} + */ + async add(weightFieldInfo) { + try { + await WFIs.add(this._SMWeightFieldInfosId, weightFieldInfo._SMWeightFieldInfoId); + } catch (e) { + console.error(e); + } + } + + /** + * 用于从权值字段信息集合移除全部权值字段信息对象 + * @returns {Promise.<*>} + */ + async clear () { + try { + await WFIs.clear(this._SMWeightFieldInfosId); + } catch (e) { + console.error(e); + } + } + + /** + * 根据名称/序号返回权值字段信息集合对象中的权值字段信息对象 + * @param key + * @returns {Promise.} + */ + async get (key) { + try { + let weightFieldInfoId + if (key instanceof Number) { + weightFieldInfoId = await WFIs.getByIndex(this._SMWeightFieldInfosId, key); + } else { + weightFieldInfoId = await WFIs.getByName(this._SMWeightFieldInfosId, key); + } + let weightFieldInfo = new WeightFieldInfo(); + weightFieldInfo._SMWeightFieldInfoId = weightFieldInfoId; + + return weightFieldInfo; + } catch (e) { + console.error(e); + } + } + + /** + * 返回给定的权值字段信息集合中元素的总数 + * @returns {Promise.|Promise.|Promise.>} + */ + async getCount () { + try { + let count = await WFIs.getCount(this._SMWeightFieldInfosId); + return count + } catch (e) { + console.error(e); + } + } + + /** + * 设置权值字段信息的名称 + * @param value + * @returns {Promise.} + */ + async setName (value) { + try { + await WFIs.setName(this._SMWeightFieldInfosId, value); + } catch (e) { + console.error(e); + } + } + + /** + * 根据指定的名称,返回权值字段信息对象的序号 + * @param index + * @returns {Promise.} + */ + async indexOf (index) { + try { + let index = await WFIs.indexOf(this._SMWeightFieldInfosId, index); + return index + } catch (e) { + console.error(e); + } + } + + /** + * 从权值字段信息集合中移除指定名称/序号的项 + * @param index + * @returns {Promise} + */ + async remove (key) { + try { + let result + if (key instanceof Number) { + result = await WFIs.removeByIndex(this._SMWeightFieldInfosId, key); + } else { + result = await WFIs.removeByName(this._SMWeightFieldInfosId, key); + } + + return result; + } catch (e) { + console.error(e); + } + } +} diff --git a/NativeModule/Workspace.js b/NativeModule/Workspace.js old mode 100644 new mode 100755 index 30ee9916..601daa4f --- a/NativeModule/Workspace.js +++ b/NativeModule/Workspace.js @@ -1,8 +1,12 @@ -/** - * Created by will on 2016/6/17. - */ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ import { NativeModules } from 'react-native'; let W = NativeModules.JSWorkspace; +let WT = NativeModules.JSWorkspaceType; import DS from './Datasources.js'; import Ds from './Datasource.js'; import Maps from './Maps.js'; @@ -12,336 +16,406 @@ import Datasource from './Datasource'; /** * @class Workspace + * @description 工作空间是用户的工作环境,主要完成数据的组织和管理,包括打开、关闭、创建、保存工作空间文件(SXW,SMW,SXWU,SMWU,DEFAULT)。工作空间 Workspace 是 SuperMap 中的一个重要的概念,工作空间存储了一个工程项目(同一个事务过程)中所有的数据源,地图的组织关系,工作空间通过其中的数据源集合对象 Datasources ,地图集合对象 Maps 来管理其下的数据源,地图。 * @property {number} DEFAULT - 默认SMWU类型。 * @property {number} SMWU - SMWU工作空间,文件型工作空间。 * @property {number} SXWU - SXWU工作空间。 * @property {number} UDB - 数据库类型。 */ -export default class Workspace{ - /** - * 创建一个原生层workspace实例 - * @memberOf Workspace - * @returns {Promise.} - */ - async createObj(){ - try{ - var {workspaceId} = await W.createObj(); - var workspace = new Workspace(); - workspace.workspaceId = workspaceId; - return workspace; - }catch(e){ - console.error(e); - } +export default class Workspace { + /** + * 创建workspace实例 + * @memberOf Workspace + * @returns {Promise.} + */ + async createObj() { + try { + var { workspaceId } = await W.createObj(); + var workspace = new Workspace(); + workspace._SMWorkspaceId = workspaceId; + return workspace; + } catch (e) { + console.error(e); } - - /** - * 获得数据源集合 - * @memberOf Workspace - * @deprecated Workspace.js:getDatasources() function has been deprecated. If you want to get datasource , please call the getDatasource() function - * @returns {Promise.} - */ - async getDatasources(){ - try { - var {datasourcesId} = await W.getDatasources(this.workspaceId); - console.debug("datasourcesId:"+datasourcesId); - var ds = new DS(); - ds.datasourcesId = datasourcesId; - return ds; - }catch (e){ - console.error(e); - } + } + + /** + * 获得数据源集合(内部方法,不开放接口) + * @memberOf Workspace + * @deprecated Workspace.js:getDatasources() function has been deprecated. If you want to get datasource , please call the getDatasource() function + * @returns {Promise.} + */ + async getDatasources() { + try { + var { datasourcesId } = await W.getDatasources(this._SMWorkspaceId); + console.debug("datasourcesId:" + datasourcesId); + var ds = new DS(); + ds._SMDatasourcesId = datasourcesId; + return ds; + } catch (e) { + console.error(e); } - - /** - * 通过数据源链接信息打开数据源 - * @memberOf Workspace - * @deprecated 可直接通过{@link Workspace.openDatasource}方法传参数,不在需要构建datasourceConnectionInfo对象。 - * @param {object} datasourceConnectionInfo 数据源链接信息 - * @returns {Promise.} - */ - async openDatasourceConnectionInfo(datasourceConnectionInfo){ - try { - var {datasourceId} = await W.openDatasourceConnectionInfo(this.workspaceId,datasourceConnectionInfo.datasourceConnectionInfoId); - var ds = new Ds(); - ds.datasourceId = datasourceId; - return ds; - }catch (e){ - console.error(e); - } + } + + /** + * 重命名数据源 + * @param oldName + * @param newName + * @returns {Promise.} + */ + async renameDatasource(oldName, newName) { + try { + await W.renameDatasource(this._SMWorkspaceId, oldName, newName); + } catch (e) { + console.error(e); } - - /** - * 通过序号或者名字(别名)获取数据源 - * @memberOf Worksapce - * @param {number | string} index|name - 既可以是序号,也可以是数据源名称 - * @returns {Promise.} - */ - async getDatasource(index){ - try{ - var datasource = new Ds(); - if(typeof index != 'string'){ - //get datasource through index. - var {datasourceId} = await W.getDatasource(this.workspaceId,index); - }else{ - //get datasource through datasource name(Alias). - var {datasourceId} = await W.getDatasourceByName(this.workspaceId,index); - } - datasource.datasourceId = datasourceId; - - return datasource; - }catch (e){ - console.error(e); - } + } + + /* + * 通过数据源链接信息打开数据源 + * @memberOf Workspace + * @deprecated 可直接通过{@link Workspace.openDatasource}方法传参数,不在需要构建datasourceConnectionInfo对象。 + * @param {object} datasourceConnectionInfo 数据源链接信息 + * @returns {Promise.} + */ + /* async openDatasourceConnectionInfo(datasourceConnectionInfo){ + try { + var {datasourceId} = await W.openDatasourceConnectionInfo(this.workspaceId,datasourceConnectionInfo.datasourceConnectionInfoId); + var ds = new Ds(); + ds.datasourceId = datasourceId; + return ds; + }catch (e){ + console.error(e); + } + } */ + + /** + * 通过序号或者名字(别名)获取数据源 + * @memberOf Worksapce + * @param {number | string} index|name - 既可以是序号,也可以是数据源名称 + * @returns {Promise.} + */ + async getDatasource(index) { + try { + var datasource = new Ds(); + if (typeof index != 'string') { + //get datasource through index. + var { datasourceId } = await W.getDatasource(this._SMWorkspaceId, index); + } else { + //get datasource through datasource name(Alias). + var { datasourceId } = await W.getDatasourceByName(this._SMWorkspaceId, index); + } + datasource._SMDatasourceId = datasourceId; + + return datasource; + } catch (e) { + console.error(e); } - - /** - * 根据定义好的工作空间连接信息对象,打开工作空间。 - * @memberOf Workspace - * @param {object} workspaceConnectionInfo - * @returns {Promise.} - */ - async open(workspaceConnectionInfo){ - try{ - var WorkspaceConnectionInfoModule = new WorkspaceConnectionInfo(); - - if(typeof workspaceConnectionInfo === 'string'){ - var wci = await WorkspaceConnectionInfoModule.createJSObj(); - var str = workspaceConnectionInfo.split('.').pop(); - console.log("工作空间类型字符串:" + str); - var type = this.workspaceType(str); - console.log("工作空间类型:" + type); - await wci.setType(type); - await wci.setServer(workspaceConnectionInfo); - - var {isOpen} = await W.open(this.workspaceId,wci.workspaceConnectionInfoId) - return isOpen; - }else{ - var {isOpen} = await W.open(this.workspaceId,workspaceConnectionInfo.workspaceConnectionInfoId); - console.log('workspace open connectionInfo:'+isOpen); - return isOpen; - } - }catch(e){ - console.error(e); + } + + /** + * 根据定义好的工作空间连接信息对象,打开工作空间。 + * @memberOf Workspace + * @param {object} workspaceConnectionInfo + * @param {string} passWord - 数据源密码(可选参数) + * @returns {Promise.} + */ + async open(workspaceConnectionInfo, passWord) { + try { + var WorkspaceConnectionInfoModule = new WorkspaceConnectionInfo(); + + if (typeof workspaceConnectionInfo === 'string') { + var wci = await WorkspaceConnectionInfoModule.createJSObj(); + var str = workspaceConnectionInfo.split('.').pop(); + console.log("工作空间类型字符串:" + str); + var type = this.workspaceType(str); + console.log("工作空间类型:" + type); + await wci.setType(type); + await wci.setServer(workspaceConnectionInfo); + if (passWord) { + await wci.setPassWord(passWord); } + var { isOpen } = await W.open(this._SMWorkspaceId, wci._SMWorkspaceConnectionInfoId) + return isOpen; + } else { + var { isOpen } = await W.open(this._SMWorkspaceId, workspaceConnectionInfo._SMWorkspaceConnectionInfoId); + console.log('workspace open connectionInfo:' + isOpen); + return isOpen; + } + } catch (e) { + console.error(e); } - - /** - * 获取工作空间下的Maps对象 - * @memberOf Worksapce - * @deprecated Maps类已不推荐使用 - * @memberOf Workspace - * @returns {Promise.} - */ - async getMaps(){ - try{ - var {mapsId} = await W.getMaps(this.workspaceId); - var maps = new Maps(); - maps.mapsId = mapsId; - return maps; - }catch(e){ - console.error(e); - } + } + + /** + * 获取工作空间下的Maps对象 + * @memberOf Worksapce + * @deprecated Maps类已不推荐使用 + * @memberOf Workspace + * @returns {Promise.} + */ + async getMaps() { + try { + var { mapsId } = await W.getMaps(this._SMWorkspaceId); + var maps = new Maps(); + maps._SMMapsId = mapsId; + return maps; + } catch (e) { + console.error(e); } - - /** - * 根据地图序号获得地图名称 - * @memberOf Workspace - * @param {number} mapIndex - * @returns {string} - */ - async getMapName(mapIndex){ - try{ - var {mapName} = await W.getMapName(this.workspaceId,mapIndex); - return mapName; - }catch(e){ - console.error(e); - } + } + + /** + * 根据地图序号获得地图名称 + * @memberOf Workspace + * @param {number} mapIndex + * @returns {string} + */ + async getMapName(mapIndex) { + try { + var { mapName } = await W.getMapName(this._SMWorkspaceId, mapIndex); + return mapName; + } catch (e) { + console.error(e); } - - /** - * 打开数据源 jsonObject 获取网络数据源 - * @memberOf Workspace - * @param {object} jsonObject {engineType:引擎类型 ,server:文件/服务器路径 ,driver:驱动名称(可选参数)} - * @returns {Promise.} - */ - - async openDatasource(jsonObject){ - try{ - if(jsonObject.webBBox){ - var rect = jsonObject.webBBox; - if(typeof rect != 'string') jsonObject.webBBox = rect.rectangle2DId; - } - var {datasourceId} = await W.openDatasource(this.workspaceId,jsonObject); - var datasource = new Datasource(); - datasource.datasourceId = datasourceId; - return datasource; - }catch(e){ - console.error(e); - } + } + + /** + * 打开数据源 jsonObject 获取网络数据源 + * @memberOf Workspace + * @param {object} jsonObject {engineType:引擎类型 ,server:文件/服务器路径 ,driver:驱动名称(可选参数)} + * @returns {Promise.} + */ + + async openDatasource(jsonObject) { + try { + if (jsonObject.webBBox) { + var rect = jsonObject.webBBox; + if (typeof rect !== 'string') jsonObject.webBBox = rect._SMRectangle2DId; + } + var { datasourceId } = await W.openDatasource(this._SMWorkspaceId, jsonObject); + var datasource = new Datasource(); + datasource._SMDatasourceId = datasourceId; + return datasource; + } catch (e) { + console.error(e); } - - /** - * 打开WMS协议类型数据源 - * @memberOf Workspace - * @param {string} server - * @param {number} engineType - * @param {string} driver - * @param {string} version - * @param {string} visibleLayers - * @param {object} webBox - * @param {object} webCoordinate - * @returns {Promise.} - */ - async openWMSDatasource(server,engineType,driver,version,visibleLayers,webBox,webCoordinate){ - try{ - await W.openWMSDatasource(this.workspaceId,server,engineType,driver, - version,visibleLayers,webBox,webCoordinate); - }catch(e){ - console.error(e); - } + } + + /* + * 打开WMS协议类型数据源 + * @memberOf Workspace + * @param {string} server + * @param {number} engineType + * @param {string} driver + * @param {string} version + * @param {string} visibleLayers + * @param {object} webBox + * @param {object} webCoordinate + * @returns {Promise.} + */ + /* + async openWMSDatasource(server,engineType,driver,version,visibleLayers,webBox,webCoordinate){ + try{ + await W.openWMSDatasource(this._SMWorkspaceId,server,engineType,driver, + version,visibleLayers,webBox,webCoordinate); + }catch(e){ + console.error(e); + } + } */ + + /** + * 保存工作空间 + * @memberOf Workspace + * @param {object} info - {path: 另存url(可选参数), caption: 工作空间名称} + * @returns {boolean} + */ + async saveWorkspace(info) { + try { + if (info && typeof info === 'object' && Object.getOwnPropertyNames(info).length > 0) { + var { saved } = await W.saveWorkspaceWithInfo(this._SMWorkspaceId, info.path, info.caption, info.type || WT.SMWU); + } else { + var { saved } = await W.saveWorkspace(this._SMWorkspaceId); + } + return saved; + } catch (e) { + console.error(e); } - - /** - * 保存工作空间 - * @memberOf Workspace - * @returns {boolean} - */ - async saveWorkspace(){ - try{ - var {saved} = await W.saveWorkspace(this.workspaceId); - return saved; - }catch(e){ - console.error(e); - } + } + + /** + * 关闭工作空间 + * @memberOf Workspace + * @returns {boolean} + */ + async closeWorkspace() { + try { + var { closed } = await W.closeWorkspace(this._SMWorkspaceId); + return closed; + } catch (e) { + console.error(e); } - - /** - * 关闭工作空间 - * @memberOf Workspace - * @returns {boolean} - */ - async closeWorkspace(){ - try{ - var {closed} = await W.closeWorkspace(this.workspaceId); - return closed; - }catch(e){ - console.error(e); - } + } + + /** + * 创建数据集 + * @memberOf Workspace + * @param filePath 指定创建数据集路径 + * @param engineType 数据集引擎类型 + * @returns {Promise.} + */ + async createDatasource(filePath, engineType) { + try { + let datasourceId = await W.createDatasource(this._SMWorkspaceId, filePath, engineType); + if (datasourceId) { + let datasource = new Ds(); + datasource._SMDatasourceId = datasourceId; + return datasource; + } else { + return null + } + } catch (e) { + console.error(e); } - - /** - * 创建数据集 - * @memberOf Workspace - * @param filePath 指定创建数据集路径 - * @param engineType 数据集引擎类型 - * @returns {Promise.} - */ - async createDatasource(filePath,engineType){ - try{ - var {datasourceId} = await W.createDatasource(this.workspaceId,filePath,engineType); - var datasource = new Ds(); - datasource.datasourceId = datasourceId; - return datasource; - }catch(e){ - console.error(e); - } + } + + /** + * 关闭指定名称的数据源 + * @memberOf Workspace + * @param datasourceName 数据源名称 + * @returns {Promise.} + */ + async closeDatasource(datasourceName) { + try { + var { closed } = await W.closeDatasource(this._SMWorkspaceId, datasourceName); + + return closed; + } catch (e) { + console.error(e); } - - /** - * 关闭指定名称的数据集 - * @memberOf Workspace - * @param datasourceName 数据集名称 - * @returns {Promise.} - */ - async closeDatasource(datasourceName){ - try{ - var {closed} = await W.closeDatasource(this.workspaceId,datasourceName); - - return closed; - }catch(e){ - console.error(e); - } + } + + /** + * 关闭所有数据集 + * @memberOf Workspace + */ + async closeAllDatasource() { + try { + await W.closeAllDatasource(this._SMWorkspaceId); + } catch (e) { + console.error(e); } - - - /** - * 关闭所有数据集 - * @memberOf Workspace - */ - async closeAllDatasource(){ - try{ - await W.closeAllDatasource(this.workspaceId); - }catch(e){ - console.error(e); - } + } + + /** + * 移除地图 + * @memberOf Workspace + * @param mapName + * @returns {boolean} + */ + async removeMap(mapName) { + try { + var { removed } = await W.removeMap(this._SMWorkspaceId, mapName); + return removed; + } catch (e) { + console.error(e); } - - /** - * 移除地图 - * @memberOf Workspace - * @param mapName - * @returns {boolean} - */ - async removeMap(mapName){ - try{ - var {removed} = await W.removeMap(this.workspaceId,mapName); - return removed; - }catch(e){ - console.error(e); - } + } + + /** + * 清空所有地图 + * @memberOf Workspace + */ + async clearMap() { + try { + await W.clearMap(this._SMWorkspaceId); + } catch (e) { + console.error(e); } - - /** - * 清空所有地图 - * @memberOf Workspace - */ - async clearMap(){ - try{ - await W.clearMap(this.workspaceId); - }catch(e){ - console.error(e); - } + } + + async getSceneName(index) { + try { + var { name } = await W.getSceneName(this._SMWorkspaceId, index); + return name; + } catch (e) { + console.error(e); + } + } + + async isModified() { + try { + let { isModified } = await W.isModified(this._SMWorkspaceId); + return isModified + } catch (e) { + console.error(e); } + } + + async getConnectionInfo() { + try { + let infoId = await W.getConnectionInfo(this._SMWorkspaceId); + let wcInfo = new WorkspaceConnectionInfo() + wcInfo._SMWorkspaceConnectionInfoId = infoId + return wcInfo + } catch (e) { + console.error(e); + } + } - async getSceneName(index){ - try{ - var {name} = await W.getSceneName(this.workspaceId,index); - return name; - }catch(e){ - console.error(e); - } + async getSceneCount() { + try { + return await W.getSceneCount(this._SMWorkspaceId); + } catch (e) { + console.error(e); + } + } + + workspaceType = (type) => { + var value; + switch (type) { + case 'SMWU': + case 'smwu': + value = 9; + break; + case 'SXWU': + case 'sxwu': + value = 8; + break; + case 'SMW': + case 'smw': + value = 5; + break; + case 'SXW': + case 'sxw': + value = 4; + break; + case 'UDB': + case 'udb': + value = 219; + break; + default: + value = 1; + break; } + return value; + } + async dispose() { + try { + return await W.dispose(this._SMWorkspaceId); + } catch (e) { + console.error(e); + } + } - workspaceType = (type) => { - var value; - switch (type){ - case 'SMWU': - case 'smwu': - value = 9; - break; - case 'SXWU': - case 'sxwu': - value = 8; - break; - case 'SMW': - case 'smw': - value = 5; - break; - case 'SXW': - case 'sxw': - value = 4; - break; - case 'UDB': - case 'udb': - value = 219; - break; - default: - value = 1; - break; - } - return value; + async addMap(name, mapXML) { + try { + return await W.addMap(this._SMWorkspaceId, name, mapXML); + } catch (e) { + console.error(e); } + } } Workspace.SMWU = 9; diff --git a/NativeModule/WorkspaceConnectionInfo.js b/NativeModule/WorkspaceConnectionInfo.js old mode 100644 new mode 100755 index 93af2dc5..083ed1f2 --- a/NativeModule/WorkspaceConnectionInfo.js +++ b/NativeModule/WorkspaceConnectionInfo.js @@ -1,55 +1,164 @@ -/** - * Created by will on 2016/5/17. - */ -var {NativeModules}=require('react-native'); -let WCI=NativeModules.JSWorkspaceConnectionInfo; +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Will + E-mail: pridehao@gmail.com + + **********************************************************************************/ +var { NativeModules } = require('react-native'); +let WCI = NativeModules.JSWorkspaceConnectionInfo; /** * @class WorkspaceConnectionInfo + * @description 工作空间连接信息类。 */ -export default class WorkspaceConnectionInfo{ - /** - * 创建一个WorkspaceConnectionInfo对象 - * @memberOf WorkspaceConnectionInfo - * @returns {Promise.} - */ - async createJSObj(){ - try{ - var {ID}=await WCI.createJSObj(); - var workspaceConnectionInfo = new WorkspaceConnectionInfo(); - workspaceConnectionInfo.workspaceConnectionInfoId = ID; - return workspaceConnectionInfo; - }catch(e){ - console.error(e); - } +export default class WorkspaceConnectionInfo { + /** + * 创建一个WorkspaceConnectionInfo对象 + * @memberOf WorkspaceConnectionInfo + * @returns {Promise.} + */ + async createJSObj() { + try { + var { ID } = await WCI.createJSObj(); + var workspaceConnectionInfo = new WorkspaceConnectionInfo(); + workspaceConnectionInfo._SMWorkspaceConnectionInfoId = ID; + return workspaceConnectionInfo; + } catch (e) { + console.error(e); } - - /** - * 设置工作空间类型 - * @memberOf WorkspaceConnectionInfo - * @param {number} type - {@link Workspace} - * @returns {Promise.} - */ - async setType(type){ - try{ - await WCI.setType(this.workspaceConnectionInfoId,type); - }catch(e){ - console.error(e); - } + } + + /** + * 设置工作空间类型 + * @memberOf WorkspaceConnectionInfo + * @param {number} type - {@link Workspace} + * @returns {Promise.} + */ + async setType(type) { + try { + await WCI.setType(this._SMWorkspaceConnectionInfoId, type); + } catch (e) { + console.error(e); } - - /** - * 设置数据源路径 - * @memberOf WorkspaceConnectionInfo - * @param path - * @returns {Promise.} - */ - async setServer(path){ - try{ - await WCI.setServer(this.workspaceConnectionInfoId,path); - }catch(e){ - console.error(e); - } + } + + /** + * 设置工作空间路径 + * @memberOf WorkspaceConnectionInfo + * @param path + * @returns {Promise.} + */ + async setServer(path) { + try { + await WCI.setServer(this._SMWorkspaceConnectionInfoId, path); + } catch (e) { + console.error(e); } - -} \ No newline at end of file + } + + /** + * 设置工作空间密码 + * @memberOf WorkspaceConnectionInfo + * @param path + * @returns {Promise.} + */ + async setPassWord(passWord) { + try { + await WCI.setPassWord(this._SMWorkspaceConnectionInfoId, passWord); + } catch (e) { + console.error(e); + } + } + + /** + * 设置工作空间名称 + * @param name + * @returns {Promise.} + */ + async setName(name) { + try { + await WCI.setName(this._SMWorkspaceConnectionInfoId, name); + } catch (e) { + console.error(e); + } + } + + /** + * 设置登录数据库的用户名 + * @param name + * @returns {Promise.} + */ + async setUser(name) { + try { + await WCI.setUser(this._SMWorkspaceConnectionInfoId, name); + } catch (e) { + console.error(e); + } + } + + /** + * 获取工作空间名称 + * @returns {Promise.<*>} + */ + async getName() { + try { + let { Name } = await WCI.getName(this._SMWorkspaceConnectionInfoId); + return Name; + } catch (e) { + console.error(e); + } + } + + /** + * 获取工作空间密码 + * @returns {Promise.<*>} + */ + async getPassword() { + try { + let { Password } = await WCI.getPassword(this._SMWorkspaceConnectionInfoId); + return Password; + } catch (e) { + console.error(e); + } + } + + /** + * 获取工作空间文件名 + * @returns {Promise.<*>} + */ + async getServer() { + try { + let { Server } = await WCI.getServer(this._SMWorkspaceConnectionInfoId); + return Server; + } catch (e) { + console.error(e); + } + } + + /** + * 获取工作空间用户名 + * @returns {Promise.<*>} + */ + async getUser() { + try { + let { User } = await WCI.getUser(this._SMWorkspaceConnectionInfoId); + return User; + } catch (e) { + console.error(e); + } + } + + /** + * 获取工作空间类型 + * @returns {Promise.<*>} + */ + async getType() { + try { + let { Type } = await WCI.getType(this._SMWorkspaceConnectionInfoId); + return Type; + } catch (e) { + console.error(e); + } + } + +} diff --git a/NativeModule/components/SMBarChartViewUI.js b/NativeModule/components/SMBarChartViewUI.js new file mode 100755 index 00000000..d9d2cd86 --- /dev/null +++ b/NativeModule/components/SMBarChartViewUI.js @@ -0,0 +1,31 @@ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; + +class SMBarChartView extends Component{ + static propTypes = { + data:PropTypes.array, + title:PropTypes.string, + textSize:PropTypes.number, + isValueAlongXAxis:PropTypes.bool, + axisTitleSize:PropTypes.number, + axisLableSize:PropTypes.number, + xAxisTitle:PropTypes.string, + yAxisTitle:PropTypes.string, + hightLightColor:PropTypes.array, + ...ViewPropTypes, + }; + + + render(){ + var props = {...this.props}; + return + } +} + +var RCTBarChartView = requireNativeComponent('RCTBarChartView',SMBarChartView); + +export default RCTBarChartView; diff --git a/NativeModule/components/SMCallOut.js b/NativeModule/components/SMCallOut.js old mode 100644 new mode 100755 index 3eb493bc..6bfb440f --- a/NativeModule/components/SMCallOut.js +++ b/NativeModule/components/SMCallOut.js @@ -2,7 +2,11 @@ * Created by will on 2016/7/27. */ let React = require('react'); -let {requireNativeComponent,View}=require('react-native'); +let {requireNativeComponent, + View, + ViewPropTypes, +} = require('react-native'); +import PropTypes from 'prop-types'; class SMCallOut extends React.Component{ constructor(){ @@ -15,8 +19,8 @@ class SMCallOut extends React.Component{ } static propTypes = { - viewId:React.PropTypes.number, - ...View.propTypes, + viewId: PropTypes.number, + ...ViewPropTypes, }; _onChange = (event) => { diff --git a/NativeModule/components/SMDsCreatePage.js b/NativeModule/components/SMDsCreatePage.js new file mode 100755 index 00000000..caec06ea --- /dev/null +++ b/NativeModule/components/SMDsCreatePage.js @@ -0,0 +1,106 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:数据源创建页面。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + Text, + View, + StyleSheet, + Dimensions, + TouchableHighlight, +} from 'react-native' + +import ModalDropDown from './SMModalDropdown'; +import InputComponent from './SMInputComponent.js' + +export default class DsCreatePage extends Component{ + + render() { + return( + + *新创建的数据源将存储至当前工作空间同级目录* + + + + + + 保存 + + + + + ); + } + +}; + +var styles = StyleSheet.create({ + container: { + backgroundColor:'#F5FCFF', + display:'flex', + flexDirection:'column', + justifyContent:'space-around', + }, + innerContainer: { + height:250, + backgroundColor:'#F5FCFF', + display:'flex', + flexDirection:'column', + justifyContent:'space-between', + }, + tips: { + height:40, + alignSelf:'center', + backgroundColor:'transparent', + }, + inputContainerStyle: { + height:40, + + }, + dropStyle:{ + alignSelf:'center', + width:0.8*Dimensions.get('window').width, + height:40, + backgroundColor:'#F5FCFF', + borderColor: 'rgba(59,55,56,0.3)', + borderWidth: 1, + borderRadius:3, + }, + dropTextStyle: { + marginVertical: 11, + backgroundColor:'#F5FCFF', + fontSize: 18, + textAlignVertical: 'center', + color:'rgba(59,55,56,0.5)', + alignSelf:'center', + }, + dropdownStyle: { + width: 0.8*Dimensions.get('window').width, + height: 120, + borderColor: 'rgba(59,55,56,0.3)', + borderWidth: 2, + borderRadius: 3, + }, + saveButton:{ + alignSelf:'center', + padding:10, + width:75, + height:40, + backgroundColor:'#F5FCFF', + borderColor: 'rgba(59,55,56,0.3)', + borderWidth: 1, + borderRadius:3, + }, + saveButtonText:{ + alignSelf:'center', + }, +}); \ No newline at end of file diff --git a/NativeModule/components/SMDsMapInfoComponent.js b/NativeModule/components/SMDsMapInfoComponent.js new file mode 100755 index 00000000..11547048 --- /dev/null +++ b/NativeModule/components/SMDsMapInfoComponent.js @@ -0,0 +1,51 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * @flow + */ + +import React, { Component } from 'react'; +import { + StyleSheet, + View, + PixelRatio, +} from 'react-native'; + +import ScrollPage from './SMScrollPage.js'; +import ScrollPageOneBtn from './SMScrollPageOneButton.js'; + +export default class DsMapInfoComponent extends Component { + render() { + return ( + + + + + + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + backgroundColor: '#F5FCFF', + }, + welcome: { + fontSize: 20, + textAlign: 'center', + margin: 10, + }, + instructions: { + textAlign: 'center', + color: '#333333', + marginBottom: 5, + }, + separator: { + height: 1 / PixelRatio.get(), + backgroundColor: '#bbbbbb', + marginLeft: 15, + }, +}); \ No newline at end of file diff --git a/NativeModule/components/SMInnerListComponent.js b/NativeModule/components/SMInnerListComponent.js new file mode 100755 index 00000000..e4011a52 --- /dev/null +++ b/NativeModule/components/SMInnerListComponent.js @@ -0,0 +1,95 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:内层list控件。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + Dimensions, + Image, + FlatList, + PixelRatio, +} from 'react-native'; + +//imobile类引入 +import workspaceModule from '../Workspace.js'; +import dataSources from '../Datasources.js'; +import dataSource from '../Datasource.js'; +import dataSet from '../Dataset.js'; + +export default class InnerListComponent extends Component { + constructor(props){ + super(props); + var dataArr = []; + var index = props.index; + var workspace = props.workspace; + (async function ( ) { + var dataSources = await workspace.getDatasources(); + var dataSource = await dataSources.get(index); + var dSetCount = await dataSource.getDatasetCount(); + for(var i=0;i<=dSetCount-1;i++){ + var dataset = await dataSource.getDataset(i); + var name = await dataset.getName(); + var dataItem = {key:'_SMDset'+i,Text:name,Image:require('../resource/datasetList.png')}; + dataArr.push(dataItem); + } + + this.setState({ + data: dataArr, + }); + }).bind(this)(); + + this.state = { + data: false, + }; + } + +//item渲染方法 + _renderItem=({item})=>( + + + {item.Text} + + ); + +//分割线组件 + _separator=()=>{ + return + } + + render() { + return ( + + ); + } +} + +const styles = StyleSheet.create({ + itemContainer: { + display: 'flex', + flexDirection: 'row', + justifyContent: 'flex-start', + width: Dimensions.get('window').width, + height: 50, + }, + itemImage: { + width:35, + height:40, + marginTop:5, + marginBottom:5, + marginLeft:70, + backgroundColor:'transparent', + }, + itemText: { + marginLeft:10, + lineHeight:50, + } +}); \ No newline at end of file diff --git a/NativeModule/components/SMInputComponent.js b/NativeModule/components/SMInputComponent.js new file mode 100755 index 00000000..c0a40483 --- /dev/null +++ b/NativeModule/components/SMInputComponent.js @@ -0,0 +1,52 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:title&input控件,可选参数:backgroundColor;titleText;password;changeText + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + Text, + View, + TextInput, + StyleSheet, + Dimensions, +} from 'react-native' + +export default class InputComponent extends Component{ + render() { + return( + + {this.props.titleText} + + + ); + } + +}; + +var styles = StyleSheet.create({ + container: { + backgroundColor:'#F5FCFF', + display:'flex', + flexDirection:'column', + justifyContent:'space-between', + }, + title: { + lineHeight:40, + width: 0.8*Dimensions.get('window').width, + alignSelf:'center', + backgroundColor:'transparent', + }, + textInputStyle: { + alignSelf:'center', + backgroundColor:'white', + height: 40, + width: 0.8*Dimensions.get('window').width, + borderColor: 'rgba(59,55,56,0.3)', + borderWidth: 1, + borderRadius:3, + }, +}); diff --git a/NativeModule/components/SMInstrumentChartViewUI.js b/NativeModule/components/SMInstrumentChartViewUI.js new file mode 100755 index 00000000..27230aad --- /dev/null +++ b/NativeModule/components/SMInstrumentChartViewUI.js @@ -0,0 +1,37 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:仪表盘。 + + **********************************************************************************/ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; + +class SMInstrumentChartView extends Component{ + static propTypes = { + isShowCurValue:PropTypes.bool, + minValue:PropTypes.number, + maxValue:PropTypes.number, + splitCount:PropTypes.number, + startAngle:PropTypes.number, + endAngle:PropTypes.number, + backgroundColor:PropTypes.array, + gradient:PropTypes.string, + ...ViewPropTypes, + }; + + + render(){ + var props = {...this.props}; + return + } +} + +var RCTInstrumentChartView = requireNativeComponent('RCTInstrumentChartView',SMInstrumentChartView); + +export default SMInstrumentChartView; diff --git a/NativeModule/components/SMLayerListViewUI.js b/NativeModule/components/SMLayerListViewUI.js old mode 100644 new mode 100755 index bcee3cce..644b1469 --- a/NativeModule/components/SMLayerListViewUI.js +++ b/NativeModule/components/SMLayerListViewUI.js @@ -1,14 +1,19 @@ /** * Created by will on 2016/9/22. */ -let React = require('react'); -let {requireNativeComponent,View}=require('react-native'); +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + View, + ViewPropTypes, +} from 'react-native'; -class SMLayerListView extends React.Component{ +class SMLayerListView extends Component{ static propTypes = { - bindMapId:React.PropTypes.string, - ...View.propTypes, + bindMapId:PropTypes.string, + ...ViewPropTypes, }; render(){ diff --git a/NativeModule/components/SMLegendViewUI.js b/NativeModule/components/SMLegendViewUI.js old mode 100644 new mode 100755 index b359d3d2..02545d82 --- a/NativeModule/components/SMLegendViewUI.js +++ b/NativeModule/components/SMLegendViewUI.js @@ -1,13 +1,17 @@ /** * Created by will on 2016/9/7. */ -let React = require('react'); -let {requireNativeComponent,View}=require('react-native'); +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; -class SMLegendView extends React.Component{ +class SMLegendView extends Component{ static propTypes = { - mapId:React.PropTypes.string, - ...View.propTypes, + mapId:PropTypes.string, + ...ViewPropTypes, }; _refresh = (event) => { diff --git a/NativeModule/components/SMLineChartViewUI.js b/NativeModule/components/SMLineChartViewUI.js new file mode 100755 index 00000000..efe61574 --- /dev/null +++ b/NativeModule/components/SMLineChartViewUI.js @@ -0,0 +1,39 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:折线图。 + + **********************************************************************************/ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; + +class SMLineChartView extends Component{ + static propTypes = { + title:PropTypes.string, + textSize:PropTypes.number, + axisTitleSize:PropTypes.number, + axisLableSize:PropTypes.number, + xAxisTitle:PropTypes.string, + yAxisTitle:PropTypes.string, + allowsUserInteraction:PropTypes.bool, + hightLightColor:PropTypes.array, + geoId:PropTypes.number, + chartDatas:PropTypes.array, + ...ViewPropTypes, + }; + + + render(){ + var props = {...this.props}; + return + } +} + +var RCTLineChartView = requireNativeComponent('RCTLineChartView',SMLineChartView); + +export default SMLineChartView; diff --git a/NativeModule/components/SMMapListComponent.js b/NativeModule/components/SMMapListComponent.js new file mode 100755 index 00000000..8a029ce7 --- /dev/null +++ b/NativeModule/components/SMMapListComponent.js @@ -0,0 +1,94 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:maplist控件。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + Dimensions, + Image, + FlatList, + PixelRatio, +} from 'react-native'; + +//imobile类引入 +import workspaceModule from '../Workspace.js'; +import dataSources from '../Datasources.js'; +import dataSource from '../Datasource.js'; +import dataSet from '../Dataset.js'; + +export default class InnerListComponent extends Component { + constructor(props){ + super(props); + this.state = { + data: false, + }; + + var dataArr = []; + var workspace = props.workspace; + (async function ( ) { + var maps = await workspace.getMaps(); + var mapcount = await maps.getCount(); + for(var i=0;i<=mapcount-1;i++){ + var mapname = await maps.get(i); + var dataItem = {key:'_SMMap'+i,Text:mapname,Image:require('../resource/map_1.png')}; + dataArr.push(dataItem); + } + + this.setState({ + data: dataArr, + }); + }).bind(this)(); + + + } + +//item渲染方法 + _renderItem=({item})=>( + + + {item.Text} + + ); + +//分割线组件 + _separator=()=>{ + return + } + + render() { + return ( + + ); + } +} + +const styles = StyleSheet.create({ + itemContainer: { + display: 'flex', + flexDirection: 'row', + justifyContent: 'flex-start', + width: Dimensions.get('window').width, + height: 50, + }, + itemImage: { + width:35, + height:40, + marginTop:5, + marginBottom:5, + marginLeft:25, + backgroundColor:'transparent', + }, + itemText: { + marginLeft:10, + lineHeight:50, + } +}); \ No newline at end of file diff --git a/NativeModule/components/SMMapViewUI.js b/NativeModule/components/SMMapViewUI.js old mode 100644 new mode 100755 index dcc328eb..502fe14e --- a/NativeModule/components/SMMapViewUI.js +++ b/NativeModule/components/SMMapViewUI.js @@ -1,20 +1,25 @@ -/** - * Created by will on 2016/6/15. - */ -let React = require('react'); -let { - requireNativeComponent, - View, - StyleSheet, - Image, - NativeModules, - PixelRatio /*像素转换工具*/ - }=require('react-native'); -let resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource'); /*解析静态图片工具*/ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: will Chen (Created on 2016/6/15) + E-mail: pridehao@gmail.com + Description:地图主控件 + + **********************************************************************************/ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + View, + StyleSheet, + Image, + NativeModules, + PixelRatio, /*像素转换工具*/ + ViewPropTypes, +} from 'react-native'; import MapView from '../MapView.js'; import Point2D from '../Point2D.js'; import Point from '../Point.js'; - +let resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource'); /*解析静态图片工具*/ let MC = NativeModules.JSMapControl; let MV = NativeModules.JSMapView; /** @@ -24,7 +29,7 @@ let MV = NativeModules.JSMapView; const STARTPOINT = require('./../resource/startpoint.png'); const DESTPOINT = require('./../resource/destpoint.png'); -class SMMapView extends React.Component{ +class SMMapView extends Component{ state = { startPoint:{}, callouts:[], @@ -50,7 +55,7 @@ class SMMapView extends React.Component{ console.log("has onGetInstance:"+event.nativeEvent.mapViewId); this.mapView = new MapView(); - this.mapView.mapViewId = event.nativeEvent.mapViewId; + this.mapView._SMMapViewId = event.nativeEvent.mapViewId; this.props.onGetInstance(this.mapView); (async function () { @@ -136,10 +141,10 @@ class SMMapView extends React.Component{ } static propTypes = { - onGetInstance:React.PropTypes.func, - callouts:React.PropTypes.array, - addCalloutByLongPress:React.PropTypes.bool, - ...View.propTypes, + onGetInstance:PropTypes.func, + callouts:PropTypes.array, + addCalloutByLongPress:PropTypes.bool, + ...ViewPropTypes, }; static defaultProps = { @@ -181,6 +186,11 @@ var RCTMapView = requireNativeComponent('RCTMapView',SMMapView,{nativeOnly:{ onChange:true, }}); +SMMapView.Image = { + STARTPOINT, + DESTPOINT, +} + var styles = StyleSheet.create({ views: { flex: 1, @@ -201,4 +211,4 @@ var styles = StyleSheet.create({ } }); -export default SMMapView; \ No newline at end of file +export default SMMapView; diff --git a/NativeModule/components/SMModalDropdown.js b/NativeModule/components/SMModalDropdown.js new file mode 100755 index 00000000..261e0038 --- /dev/null +++ b/NativeModule/components/SMModalDropdown.js @@ -0,0 +1,425 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:下拉选框第三方组件 react-native-modal-dropdown(MIT协议)。 + + react-native-modal-dropdown: + Author:sohobloo + HomePage:https://github.com/sohobloo/react-native-modal-dropdown + **********************************************************************************/ + +'use strict'; +import PropTypes from 'prop-types'; +import React, { + Component +} from 'react'; + +import { + StyleSheet, + Dimensions, + View, + Text, + ListView, + TouchableWithoutFeedback, + TouchableNativeFeedback, + TouchableOpacity, + TouchableHighlight, + Modal, + ActivityIndicator, +} from 'react-native'; + +const TOUCHABLE_ELEMENTS = ['TouchableHighlight', 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback']; + +export default class ModalDropdown extends Component { + static propTypes = { + disabled: PropTypes.bool, + defaultIndex: PropTypes.number, + defaultValue: PropTypes.string, + options: PropTypes.array, + + accessible: PropTypes.bool, + animated: PropTypes.bool, + showsVerticalScrollIndicator: PropTypes.bool, + keyboardShouldPersistTaps: PropTypes.oneOf(['always', 'never', 'handled', false, true]), + + style: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + textStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + dropdownStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + dropdownTextStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + dropdownTextHighlightStyle: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]), + + adjustFrame: PropTypes.func, + renderRow: PropTypes.func, + renderSeparator: PropTypes.func, + + onDropdownWillShow: PropTypes.func, + onDropdownWillHide: PropTypes.func, + onSelect: PropTypes.func + }; + + static defaultProps = { + disabled: false, + defaultIndex: -1, + defaultValue: 'Please select...', + options: null, + animated: true, + showsVerticalScrollIndicator: true, + keyboardShouldPersistTaps: 'never' + }; + + constructor(props) { + super(props); + + this._button = null; + this._buttonFrame = null; + this._nextValue = null; + this._nextIndex = null; + + this.state = { + disabled: props.disabled, + accessible: !!props.accessible, + loading: props.options === null || props.options === undefined, + showDropdown: false, + buttonText: props.defaultValue, + selectedIndex: props.defaultIndex + }; + } + + componentWillReceiveProps(nextProps) { + var buttonText = this._nextValue == null ? this.state.buttonText : this._nextValue.toString(); + var selectedIndex = this._nextIndex == null ? this.state.selectedIndex : this._nextIndex; + if (selectedIndex < 0) { + selectedIndex = nextProps.defaultIndex; + if (selectedIndex < 0) { + buttonText = nextProps.defaultValue; + } + } + this._nextValue = null; + this._nextIndex = null; + + this.setState({ + disabled: nextProps.disabled, + loading: nextProps.options == null, + buttonText: buttonText, + selectedIndex: selectedIndex + }); + } + + render() { + return ( + + {this._renderButton()} + {this._renderModal()} + + ); + } + + _updatePosition(callback) { + if (this._button && this._button.measure) { + this._button.measure((fx, fy, width, height, px, py) => { + this._buttonFrame = {x: px, y: py, w: width, h: height}; + callback && callback(); + }); + } + } + + show() { + this._updatePosition(() => { + this.setState({ + showDropdown: true + }); + }); + } + + hide() { + this.setState({ + showDropdown: false + }); + } + + select(idx) { + var value = this.props.defaultValue; + if (idx == null || this.props.options == null || idx >= this.props.options.length) { + idx = this.props.defaultIndex; + } + + if (idx >= 0) { + value = this.props.options[idx].toString(); + } + + this._nextValue = value; + this._nextIndex = idx; + + this.setState({ + buttonText: value, + selectedIndex: idx + }); + } + + _renderButton() { + return ( + this._button = button} + disabled={this.props.disabled} + accessible={this.props.accessible} + onPress={this._onButtonPress.bind(this)}> + { + this.props.children || + ( + + + {this.state.buttonText} + + + ) + } + + ); + } + + _onButtonPress() { + if (!this.props.onDropdownWillShow || + this.props.onDropdownWillShow() !== false) { + this.show(); + } + } + + _renderModal() { + if (this.state.showDropdown && this._buttonFrame) { + let frameStyle = this._calcPosition(); + let animationType = this.props.animated ? 'fade' : 'none'; + return ( + + + + + {this.state.loading ? this._renderLoading() : this._renderDropdown()} + + + + + ); + } + } + + _calcPosition() { + let dimensions = Dimensions.get('window'); + let windowWidth = dimensions.width; + let windowHeight = dimensions.height; + + let dropdownHeight = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).height) || + StyleSheet.flatten(styles.dropdown).height; + + let bottomSpace = windowHeight - this._buttonFrame.y - this._buttonFrame.h; + let rightSpace = windowWidth - this._buttonFrame.x; + let showInBottom = bottomSpace >= dropdownHeight || bottomSpace >= this._buttonFrame.y; + let showInLeft = rightSpace >= this._buttonFrame.x; + + var style = { + height: dropdownHeight, + top: showInBottom ? this._buttonFrame.y + this._buttonFrame.h : Math.max(0, this._buttonFrame.y - dropdownHeight), + }; + + if (showInLeft) { + style.left = this._buttonFrame.x; + } else { + let dropdownWidth = (this.props.dropdownStyle && StyleSheet.flatten(this.props.dropdownStyle).width) || + (this.props.style && StyleSheet.flatten(this.props.style).width) || -1; + if (dropdownWidth !== -1) { + style.width = dropdownWidth; + } + style.right = rightSpace - this._buttonFrame.w; + } + + if (this.props.adjustFrame) { + style = this.props.adjustFrame(style) || style; + } + + return style; + } + + _onRequestClose() { + if (!this.props.onDropdownWillHide || + this.props.onDropdownWillHide() !== false) { + this.hide(); + } + } + + _onModalPress() { + if (!this.props.onDropdownWillHide || + this.props.onDropdownWillHide() !== false) { + this.hide(); + } + } + + _renderLoading() { + return ( + + ); + } + + _renderDropdown() { + return ( + + ); + } + + get _dataSource() { + let ds = new ListView.DataSource({ + rowHasChanged: (r1, r2) => r1 !== r2 + }); + return ds.cloneWithRows(this.props.options); + } + + _renderRow(rowData, sectionID, rowID, highlightRow) { + let key = `row_${rowID}`; + let highlighted = rowID == this.state.selectedIndex; + let row = !this.props.renderRow ? + ( + {rowData} + ) : + this.props.renderRow(rowData, rowID, highlighted); + let preservedProps = { + key: key, + accessible: this.props.accessible, + onPress: () => this._onRowPress(rowData, sectionID, rowID, highlightRow), + }; + if (TOUCHABLE_ELEMENTS.find(name => name == row.type.displayName)) { + var props = {...row.props}; + props.key = preservedProps.key; + props.onPress = preservedProps.onPress; + switch (row.type.displayName) { + case 'TouchableHighlight': + { + return ( + + {row.props.children} + + ); + } + break; + case 'TouchableOpacity': + { + return ( + + {row.props.children} + + ); + } + break; + case 'TouchableWithoutFeedback': + { + return ( + + {row.props.children} + + ); + } + break; + case 'TouchableNativeFeedback': + { + return ( + + {row.props.children} + + ); + } + break; + default: + break; + } + } + return ( + + {row} + + ); + } + + _onRowPress(rowData, sectionID, rowID, highlightRow) { + if (!this.props.onSelect || + this.props.onSelect(rowID, rowData) !== false) { + highlightRow(sectionID, rowID); + this._nextValue = rowData; + this._nextIndex = rowID; + this.setState({ + buttonText: rowData.toString(), + selectedIndex: rowID + }); + } + if (!this.props.onDropdownWillHide || + this.props.onDropdownWillHide() !== false) { + this.setState({ + showDropdown: false + }); + } + } + + _renderSeparator(sectionID, rowID, adjacentRowHighlighted) { + let key = `spr_${rowID}`; + return (); + } +} + +const styles = StyleSheet.create({ + button: { + justifyContent: 'center' + }, + buttonText: { + fontSize: 12 + }, + modal: { + flexGrow: 1 + }, + dropdown: { + position: 'absolute', + height: (33 + StyleSheet.hairlineWidth) * 5, + borderWidth: StyleSheet.hairlineWidth, + borderColor: 'lightgray', + borderRadius: 2, + backgroundColor: 'white', + justifyContent: 'center' + }, + loading: { + alignSelf: 'center' + }, + list: { + //flexGrow: 1, + }, + rowText: { + paddingHorizontal: 6, + paddingVertical: 10, + fontSize: 11, + color: 'gray', + backgroundColor: 'white', + textAlignVertical: 'center' + }, + highlightedRowText: { + color: 'black' + }, + separator: { + height: StyleSheet.hairlineWidth, + backgroundColor: 'lightgray' + } +}); diff --git a/NativeModule/components/SMOuterListComponent.js b/NativeModule/components/SMOuterListComponent.js new file mode 100755 index 00000000..bf26d316 --- /dev/null +++ b/NativeModule/components/SMOuterListComponent.js @@ -0,0 +1,66 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:内层list控件。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import { + View, + FlatList, + PixelRatio, +} from 'react-native'; + +//imobile类引入 +import workspaceModule from '../Workspace.js'; +import dataSources from '../Datasources.js'; +//子组件倒入 +import OuterListItem from './SMOuterListItem.js'; + +export default class OuterListComponent extends Component { + constructor(props){ + super(props); + + this.state = { + data: false, + }; + + //数据获取 + var dataArr = []; + var workspace = props.workspace; + (async function ( ) { + var dataSources = await workspace.getDatasources(); + var count = await dataSources.getCount(); + for (var i=0; i<=count-1;i++){ + var dsName = await dataSources.getAlias(i); + var dataItem = {key:'_SMDs'+i,Text:dsName,Image:require('../resource/DsList.png'),Index:i}; + dataArr.push(dataItem); + } + + this.setState({ + data: dataArr, + }); + }).bind(this)(); + + + } +//item渲染方法 + _renderItem=({item})=>( + + ); + +//分割线组件 + _separator=()=>{ + return + } + + render() { + return ( + + ); + } +} \ No newline at end of file diff --git a/NativeModule/components/SMOuterListItem.js b/NativeModule/components/SMOuterListItem.js new file mode 100755 index 00000000..0c36dbc4 --- /dev/null +++ b/NativeModule/components/SMOuterListItem.js @@ -0,0 +1,75 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * @flow + */ + +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + TouchableHighlight, + Dimensions, + Image +} from 'react-native'; + +import InnerListComponent from './SMInnerListComponent.js'; + +export default class OuterListItem extends Component { + constructor(props){ + super(props); + this.state={highLight:false, + }; + } + + _onPress = ()=>{ + this.setState({highLight:!this.state.highLight}); + } + render() { + return ( + + + + + {this.props.Text} + + + {this.state.highLight && } + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor:'transparent', + }, + touchableSubView: { + backgroundColor: 'transparent', + display: 'flex', + flexDirection: 'row', + }, + touchableContainer: { + display: 'flex', + flexDirection: 'row', + justifyContent: 'flex-start', + width: Dimensions.get('window').width, + height: 50, + backgroundColor:'transparent', + }, + itemImage: { + width:35, + height:40, + marginTop:5, + marginBottom:5, + marginLeft:25, + backgroundColor:'transparent', + }, + itemText: { + marginLeft:10, + lineHeight:50, + backgroundColor:'transparent', + } +}); \ No newline at end of file diff --git a/NativeModule/components/SMPage.js b/NativeModule/components/SMPage.js new file mode 100755 index 00000000..553593a2 --- /dev/null +++ b/NativeModule/components/SMPage.js @@ -0,0 +1,73 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:视图控件(搜索控件子控件)。 + + **********************************************************************************/ +'use strict'; + +var ReactNative = require('react-native'); +var React = require('react'); +var { + ScrollView, + StyleSheet, + View, +} = ReactNative; + +var SMTitle = require('./SMTitle'); + +var SMPage = React.createClass({ + + propTypes: { + keyboardShouldPersistTaps: React.PropTypes.bool, + noScroll: React.PropTypes.bool, + noSpacer: React.PropTypes.bool, + }, + + render: function() { + var ContentWrapper; + var wrapperProps = {}; + if (this.props.noScroll) { + ContentWrapper = View; + } else { + ContentWrapper = ScrollView; + wrapperProps.keyboardShouldPersistTaps = true; + wrapperProps.keyboardDismissMode = 'interactive'; + } + var title = this.props.title ? + : + null; + var spacer = this.props.noSpacer ? null : ; + return ( + + {title} + + {this.props.children} + {spacer} + + + ); + }, +}); + +var styles = StyleSheet.create({ + container: { + borderRadius: 4, + borderWidth: 0.5, + borderColor: '#d6d7da', + backgroundColor: '#F7F7F7', + paddingTop: 15, + flex: 1, + }, + spacer: { + height: 270, + }, + wrapper: { + flex: 1, + }, +}); + +module.exports = SMPage; diff --git a/NativeModule/components/SMPieChartViewUI.js b/NativeModule/components/SMPieChartViewUI.js new file mode 100755 index 00000000..62e2c40e --- /dev/null +++ b/NativeModule/components/SMPieChartViewUI.js @@ -0,0 +1,36 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:饼状图。 + + **********************************************************************************/ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; + +class SMPieChartView extends Component{ + static propTypes = { + title:PropTypes.string, + textSize:PropTypes.number, + radious:PropTypes.number, + center:PropTypes.array, + geoId:PropTypes.number, + textColor:PropTypes.array, + chartDatas:PropTypes.array, + ...ViewPropTypes, + }; + + + render(){ + var props = {...this.props}; + return + } +} + +var RCTPieChartView = requireNativeComponent('RCTPieChartView',SMPieChartView); + +export default SMPieChartView; diff --git a/NativeModule/components/SMPlotViewUI.js b/NativeModule/components/SMPlotViewUI.js new file mode 100755 index 00000000..1ba86754 --- /dev/null +++ b/NativeModule/components/SMPlotViewUI.js @@ -0,0 +1,174 @@ + /** + * Created by wangzihao on 2017/6/8. + */ + +'use strict'; +import PropTypes from 'prop-types'; +import React,{Component} from 'react'; +import { + Image, + View, + Text, + TouchableHighlight, + FlatList, + StyleSheet, + Dimensions, +} from 'react-native'; + +var itemData = [ + {key:'_SMPlot1',id:10,imageSource:require('./../plotImage/10.png')}, + {key:'_SMPlot2',id:14,imageSource:require('./../plotImage/14.png')}, + {key:'_SMPlot3',id:56,imageSource:require('./../plotImage/56.png')}, + {key:'_SMPlot4',id:10100,imageSource:require('./../plotImage/10100.png')}, + {key:'_SMPlot5',id:30307,imageSource:require('./../plotImage/30307.png')}, + {key:'_SMPlot6',id:30308,imageSource:require('./../plotImage/30308.png')}, + {key:'_SMPlot7',id:30502,imageSource:require('./../plotImage/30502.png')}, + {key:'_SMPlot8',id:30709,imageSource:require('./../plotImage/30709.png')}, + {key:'_SMPlot9',id:40503,imageSource:require('./../plotImage/40503.png')}, + {key:'_SMPlot10',id:70100,imageSource:require('./../plotImage/70100.png')}, + {key:'_SMPlot11',id:80102,imageSource:require('./../plotImage/80102.png')}, + {key:'_SMPlot12',id:80106,imageSource:require('./../plotImage/80106.png')}, + {key:'_SMPlot13',id:80400,imageSource:require('./../plotImage/80400.png')}, + {key:'_SMPlot14',id:80201,imageSource:require('./../plotImage/80201.png')}, + {key:'_SMPlot15',id:1001,imageSource:require('./../plotImage/1001.png')}, + {key:'_SMPlot16',id:1002,imageSource:require('./../plotImage/1002.png')}, + {key:'_SMPlot17',id:1003,imageSource:require('./../plotImage/1003.png')}, + {key:'_SMPlot18',id:1004,imageSource:require('./../plotImage/1004.png')}, + {key:'_SMPlot19',id:1005,imageSource:require('./../plotImage/1005.png')}, + {key:'_SMPlot21',id:1006,imageSource:require('./../plotImage/1006.png')}, + {key:'_SMPlot22',id:1007,imageSource:require('./../plotImage/1007.png')}, + {key:'_SMPlot23',id:1008,imageSource:require('./../plotImage/1008.png')}, + {key:'_SMPlot24',id:1009,imageSource:require('./../plotImage/1009.png')}, +]; +export default class SMPlotView extends Component{ + constructor(props) { + super(props); + } + + render() { + var num + return ( + + this._flatList = flatList} + ItemSeparatorComponent={this._separator} + renderItem={this._renderItem} + // numColumns ={Dimensions.get('window').width/45} + // columnWrapperStyle={{borderWidth:2,borderColor:'black',paddingLeft:20}} + horizontal={true} + data={itemData}/> + + ); + } + + _renderItem = (Obj) => { + console.log(Obj.item.id); + return ( + this._buttonPress(Obj.item.id)}> + + + + {Obj.item.id} + + + + ); +} + +_buttonPress = (id) => { + var libId = this.props.libId; + (async function () { + await (this.props.mapCtr).setAction(3000); + await (this.props.mapCtr).setPlotSymbol(libId,id); + }).bind(this)(); +} + +_separator = () => { + return ; +} + +} + +/* +var SMPlotView =React.createClass({ + getInitialState: function() { + var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); + return { + dataSource:ds.cloneWithRows(this._genRows({})), + }; + }, + _pressData: ({}: {[key: number]: boolean}), + componentWillMount: function() { + this._pressData = {}; + }, + render: function() { + return ( + + ); + }, + _renderRow: function(rowData: string,sectionID: number, rowID: number) { + var imgSource = THUMB_URLS[rowID][1]; + var id = THUMB_URLS[rowID][0]; + return ( + this._buttonPress(id)}> + + + + + { + id + } + + + + + ); + }, + _genRows: function(pressData: {[key: number]:boolean}): Array { + var dataBlob = []; + for (var ii = 0; ii < THUMB_URLS.length;ii++) { + dataBlob.push('单元格 ' + ii); + } + return dataBlob; + }, + _buttonPress: function(id1){ + (this.props.mapCtr).setAction(3000); + (this.props.mapCtr).setPlotSymbol(this.props.libId,id1); + }, + }); +var styles =StyleSheet.create({ + list: { + marginTop:5, + alignContent:'space-around', + flexDirection: 'row', + flexWrap: 'wrap' + }, + row: { + justifyContent: 'center', + padding: 5, + margin: 3, + width: 85, + height: 85, + backgroundColor: '#F6F6F6', + alignItems: 'center', + borderWidth: 1, + borderRadius: 5, + borderColor: '#CCC' + }, + thumb: { + width: 45, + height: 45 + }, + text: { + flex: 1, + marginTop: 5, + fontWeight: 'bold' + }, + }); +module.exports = SMPlotView; +*/ diff --git a/NativeModule/components/SMScaleViewUI.js b/NativeModule/components/SMScaleViewUI.js old mode 100644 new mode 100755 index 88d13eea..c84583cf --- a/NativeModule/components/SMScaleViewUI.js +++ b/NativeModule/components/SMScaleViewUI.js @@ -1,19 +1,23 @@ /** * Created by will on 2016/10/8. */ -let React = require('react'); -let {requireNativeComponent,View}=require('react-native'); +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { + requireNativeComponent, + ViewPropTypes, +} from 'react-native'; -class SMScaleView extends React.Component{ +class SMScaleView extends Component{ static propTypes = { - mapId:React.PropTypes.string, - ...View.propTypes, + mapControlId:PropTypes.string, + ...ViewPropTypes, }; render(){ var props = {...this.props}; - return + return } } diff --git a/NativeModule/components/SMSceneViewUI.js b/NativeModule/components/SMSceneViewUI.js old mode 100644 new mode 100755 index 65e38f42..f5c7838f --- a/NativeModule/components/SMSceneViewUI.js +++ b/NativeModule/components/SMSceneViewUI.js @@ -1,15 +1,17 @@ /** * Created by will on 2017/3/22. */ -let React = require('react'); -let { +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import { requireNativeComponent, View, StyleSheet, -}=require('react-native'); + ViewPropTypes, +} from 'react-native'; import SceneControl from './../SceneControl'; -class SMSceneView extends React.Component{ +class SMSceneView extends Component{ _onChange = (event) => { if(!this.props.onGetScene){ @@ -25,8 +27,8 @@ class SMSceneView extends React.Component{ }; static propTypes = { - onGetScene:React.PropTypes.func, - ...View.propTypes, + onGetScene:PropTypes.func, + ...ViewPropTypes, }; render(){ diff --git a/NativeModule/components/SMScrollPage.js b/NativeModule/components/SMScrollPage.js new file mode 100755 index 00000000..4e8c7434 --- /dev/null +++ b/NativeModule/components/SMScrollPage.js @@ -0,0 +1,80 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:横向滑动组件,提供backgrouColor;width; + pageOneImageOne;pageOneImageTwo;pageOneText; + pageTwoButtonOneText;pageTwoButtonTwoText;pageTwoButtonThreeText; + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + ScrollView, + View, + StyleSheet, + Dimensions, + PixelRatio, +} from 'react-native' + +import SMScrollPageTwoButton from './SMScrollPageTwoButton'; +import SMScrollPageOneButton from './SMScrollPageOneButton'; + +export default class ScrollPage extends Component{ + render() { + return( + + + + + + + + + + + + + + ); + } + +}; + +var styles = StyleSheet.create({ + container: { + backgroundColor:'#F5FCFF' + }, + scrollViewStyle: { + backgroundColor:'transparent', + }, + pageOneStyle: { + backgroundColor:'transparent', + height:60, + }, + pageTwoStyle: { + backgroundColor:'transparent', + height:60, + display:'flex', + flexDirection:'row', + justifyContent:'space-around', + }, + separator: { + height: 1 / PixelRatio.get(), + backgroundColor: '#bbbbbb', + marginLeft: 15, + }, +}); \ No newline at end of file diff --git a/NativeModule/components/SMScrollPageOneButton.js b/NativeModule/components/SMScrollPageOneButton.js new file mode 100755 index 00000000..39e9cc4f --- /dev/null +++ b/NativeModule/components/SMScrollPageOneButton.js @@ -0,0 +1,76 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:SMScrollPage子组件,提供imageOne;imageTwo;text;backgroundColor; + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + Image, + Text, + View, + StyleSheet, + TouchableHighlight +} from 'react-native' + +export default class ScrollPageOneButton extends Component{ + render(){ + return( + + + + + + { this.props.text } + + + + + + ); + } +}; + +var styles = StyleSheet.create({ + pageOneButton: { + margin:0, + backgroundColor:'#F5FCFF', + }, + buttonOuterView: { + margin:0, + backgroundColor:'transparent', + display:'flex', + flexDirection:'row', + justifyContent:'space-between', + }, + buttonInnerView: { + margin:0, + backgroundColor:'transparent', + display:'flex', + flexDirection:'row', + justifyContent:'space-between', + }, + pageOneImage:{ + width:50, + height:50, + marginTop:5, + marginBottom:5, + marginLeft:30, + backgroundColor:'transparent', + alignSelf:'center', + }, + pageOneImageTwo:{ + width:50, + height:50, + marginTop:5, + marginBottom:5, + backgroundColor:'transparent', + }, + pageOneText:{ + marginLeft:5, + alignSelf:'center', + backgroundColor:'transparent', + }, +}); \ No newline at end of file diff --git a/NativeModule/components/SMScrollPageTwoButton.js b/NativeModule/components/SMScrollPageTwoButton.js new file mode 100755 index 00000000..2ca2af4d --- /dev/null +++ b/NativeModule/components/SMScrollPageTwoButton.js @@ -0,0 +1,59 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:底层组件 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + Image, + Text, + View, + StyleSheet, + TouchableHighlight +} from 'react-native' + +export default class ScrollPageTwoButton extends Component{ + render(){ + return( + + + + + {this.props.text} + + + + ); + } +}; + +var styles = StyleSheet.create({ + buttonStyle:{ + display:'flex', + flexDirection:'column', + height:60, + alignSelf:'center', + justifyContent:'space-between', + backgroundColor:'#F5FCFF', + }, + innerContainer:{ + backgroundColor:'transparent', + }, + imageStyle:{ + height:28, + width:28, + margin:1, + alignSelf:'center', + backgroundColor:'transparent', + }, + textStyle:{ + height:28, + margin:1, + alignItems:'center', + justifyContent: 'center', + backgroundColor:'transparent', + } +}); \ No newline at end of file diff --git a/NativeModule/components/SMSearchViewUI.js b/NativeModule/components/SMSearchViewUI.js new file mode 100755 index 00000000..02bc1fc0 --- /dev/null +++ b/NativeModule/components/SMSearchViewUI.js @@ -0,0 +1,173 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:搜索控件,显示搜索结果。 + + **********************************************************************************/ + +'use strict'; + var ReactNative =require('react-native'); + var React = require('react'); + var { + AppRegistry, + PixelRatio, + Image, + ListView, + TouchableHighlight, + StyleSheet, + Text, + View, + Dimensions, + } = ReactNative; + + var SMPage = require('./SMPage'); + +var THUMB_URLS11 = ['中国', + '韩国', + '日本', + '美国', + '加拿大', + '俄罗斯', + '西班牙', + '葡萄牙', + '挪威', + '冰岛', + '丹麦', + '名字很长很长很长的国家']; + + var SMSearchView = React.createClass({ + statics: { + title: '搜索结果', + }, + + getInitialState: function() { + var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); + return { + dataSource: ds.cloneWithRows(this._genRows({})), + }; + }, + + _pressData: ({}: {[key: number]: boolean}), + + componentWillMount: function() { + this._pressData = {}; + }, + + + render: function() { + return ( + + + + ); + }, + + _renderRow: function(rowData: string, sectionID: number, rowID: number) { + //var rowHash = Math.abs(hashCode(rowData)); + var imgSource = this.props.imageSource ? this.props.imageSource[rowID] : THUMB_URLS[rowID]; + return ( + this._pressRow(rowID)}> + + + + {this.props.titleName ? this.props.titleName[rowID] : THUMB_URLS11[rowID]} + + + + + {rowData} + + + + + + + ); + }, + + _genRows: function(pressData: {[key: number]: boolean}): Array { + var dataBlob = this.props.data ? this.props.data : []; + if(dataBlob.length<=0){ + //var dataBlob = []; + for (var ii = 0; ii < 12; ii++) { + var pressedText = pressData[ii] ? ' (pressed)' : ''; + dataBlob.push('超长文本支持' + ii + pressedText +'!'); + } + } + return dataBlob; + }, + + _pressRow: function(rowID: number) { + this._pressData[rowID] = !this._pressData[rowID]; + this.setState({dataSource: this.state.dataSource.cloneWithRows( + this._genRows(this._pressData) + )}); + }, +}); + +var THUMB_URLS = [require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png'), + require('./../plotImage/star.png')]; + +/* eslint no-bitwise: 0 */ + var hashCode = function(str) { + var hash = 15; + for (var ii = str.length - 1; ii >= 0; ii--) { + hash = ((hash << 5) - hash) + str.charCodeAt(ii); + } + return hash; +}; + +var styles = StyleSheet.create({ + list: { + width:Dimensions.get('window').width, + height: 100, + }, + text: { + marginLeft:15, + fontSize:18, + }, + contentText: { + marginLeft:15, + fontSize:25, + textAlign:'center', + justifyContent: 'center', + }, + row: { + width:Dimensions.get('window').width, + backgroundColor: 'white', + justifyContent: 'center', + paddingHorizontal: 15, + paddingVertical: 8, + display:'flex', + flexDirection:'column', + }, + description: { + display:'flex', + flexDirection:'row', + }, + separator: { + height: 1 / PixelRatio.get(), + backgroundColor: '#bbbbbb', + marginLeft: 15, + }, + }); + +module.exports = SMSearchView; diff --git a/NativeModule/components/SMTimeLineViewUI.js b/NativeModule/components/SMTimeLineViewUI.js new file mode 100755 index 00000000..0308c373 --- /dev/null +++ b/NativeModule/components/SMTimeLineViewUI.js @@ -0,0 +1,29 @@ +/** + * Created by will on 2016/9/7. + */ +let React = require('react'); +let { + requireNativeComponent, + View, + ViewPropTypes, +}=require('react-native'); + +class SMTimeLineView extends React.Component{ + static propTypes = { + mapId:React.PropTypes.string, + ...ViewPropTypes, + }; + + _refresh = (event) => { + console.log(event.nativeEvent.enableRedraw); + } + + render(){ + var props = {...this.props}; + return + } +} + +var RCTLegendView = requireNativeComponent('RCTLegendView',SMLegendView); + +export default SMLegendView; diff --git a/NativeModule/components/SMTitle.js b/NativeModule/components/SMTitle.js new file mode 100755 index 00000000..ab61cb09 --- /dev/null +++ b/NativeModule/components/SMTitle.js @@ -0,0 +1,84 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:标题控件(搜索控件子控件)。 + + **********************************************************************************/ +'use strict'; + +var ReactNative =require('react-native'); +var React = require('react'); +var { + PanResponder, + StyleSheet, + Text, + View, +} = ReactNative; + +var SMTitle = React.createClass({ + + _panResponder: {}, + + componentWillMount: function() { + this._panResponder = PanResponder.create({ + onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, + onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder, + onPanResponderGrant: this._handlePanResponderGrant, + onPanResponderMove: this._handlePanResponderMove, + onPanResponderRelease: this._handlePanResponderEnd, + onPanResponderTerminate: this._handlePanResponderEnd, + }); + }, + + render: function() { + return ( + + + {this.props.title} + + + ); + }, + + _handleStartShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { + return true; + }, + + _handleMoveShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { + return true; + }, + _handlePanResponderGrant: function(e: Object, gestureState: Object) { + console.log('press'); + }, + _handlePanResponderMove: function(e: Object, gestureState: Object) { + if(gestureState.dy<-0.5){ + console.log('手势上滑'); + }else if(gestureState.dy>0.5){ + console.log('手势下滑'); + } +// this._circleStyles.style.left = this._previousLeft + gestureState.dx; +// this._circleStyles.style.top = this._previousTop + gestureState.dy; +// this._updateNativeStyles(); + }, + _handlePanResponderEnd: function(e: Object, gestureState: Object) { + console.log('end'); + }, + +}); + +var styles = StyleSheet.create({ + container: { + margin: 10, + height: 50, + padding: 0, + backgroundColor: '#F7F7F7', + }, + text: { + fontSize: 19, + fontWeight: '500', + textAlign:'center', + }, +}); + +module.exports = SMTitle; diff --git a/NativeModule/components/SMTitlePage.js b/NativeModule/components/SMTitlePage.js new file mode 100755 index 00000000..f96c2942 --- /dev/null +++ b/NativeModule/components/SMTitlePage.js @@ -0,0 +1,74 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:Title控件,提供text;width;backgroundColor三种属性参数。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + Dimensions, + TouchableHighlight, + Image, +} from 'react-native'; + +export default class TitlePage extends Component { + + render() { + return ( + + {this.props.backBtnDisplay && + + + } + + + {this.props.text ? this.props.text : 'TitleText'} + + + + ); + } +} + + + +const styles = StyleSheet.create({ + containerS: { + display: 'flex', + flexDirection:'row', + alignItems: 'center', + height:60, + width: Dimensions.get('window').width, + borderBottomWidth: 1, + borderBottomColor:'#bbbbbb', + backgroundColor: '#F5FCFF', + }, + textContainer:{ + height:60, + width: Dimensions.get('window').width-27*2, + justifyContent: 'center', + alignItems: 'center', + }, + instructions: { + textAlign: 'center', + color: '#333333', + backgroundColor: 'transparent', + }, + backBtn: { + marginLeft:5, + height:22, + width:22, + backgroundColor:'transparent', + borderRadius:11, + }, + btnImage: { + height:20, + width:20, + margin:1, + }, +}); \ No newline at end of file diff --git a/NativeModule/components/SMWorkspaceManagerComponent.js b/NativeModule/components/SMWorkspaceManagerComponent.js new file mode 100755 index 00000000..79486ef5 --- /dev/null +++ b/NativeModule/components/SMWorkspaceManagerComponent.js @@ -0,0 +1,239 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * @flow + */ + +import React, { Component } from 'react'; +import { + AppRegistry, + StyleSheet, + Text, + View, + Alert, + Platform, +} from 'react-native'; + +//imobile类引入 +import workspaceModule from '../Workspace.js'; +import util from '../utility/utility.js'; + +//视图类引入 +import TitlePage from './SMTitlePage.js'; +import ScrollPage from './SMScrollPage.js'; +import WorkspaceSaveAsPage from './SMWorkspaceSaveAsPage.js'; +import DsMapInfo from './SMDsMapInfoComponent.js'; +import DsCreatePage from './SMDsCreatePage.js'; +import DsListComponent from './SMOuterListComponent.js'; +import MapListComponent from './SMMapListComponent.js'; +//android need +import Environment from '../Environment.js'; + +export default class WorkspaceManagerComponent extends Component { + constructor(props){ + super(props); + + var paths = props.path.split('/'); + var nameWithType = paths[paths.length-1]; + + this.state = {title:{display:true,text:'工作空间管理',backBtnDisplay:true,clickBtn:this._quit}, + scrollPage:{display:true,text:nameWithType}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }; + + var workspaceM = new workspaceModule(); + (async function () { + //------------------------util只适用于iOS------------------------//!! + var filePath; + if(Platform.OS==='ios'){ + filePath = await util.appendingHomeDirectory(props.path); + }else{ + filePath = props.path; + var environmentModule = new Environment(); + await environmentModule.setLicensePath('/SuperMap/license/'); + await environmentModule.initialization(); + } + var workspace = await workspaceM.createObj(); + await workspace.open(filePath); + this.setState({ + coreData:{workspace:workspace,filePath: filePath,fileName:nameWithType,workspaceOpen:true}, + }); + }).bind(this)(); + } + + _toWsInfoPage = ()=>{ + //this is scrollPage one btn,it means show workspace map&datasource info. + var fileName = this.state.coreData.fileName; + var nameArr = fileName.split('.'); + var nameWithoutType = nameArr[0]; + + this.setState({ + title:{display:true,text:nameWithoutType,backBtnDisplay:true,clickBtn:this._toMainPage,}, + scrollPage:{display:false}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:true}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }); + } + + _wsSaveBtnPress = ()=>{ + //this is scrollPage Two btn One,it means save workspace. + if(this.state.coreData.workspace){ + (async function(){ + var isSave = await this.state.coreData.workspace.saveWorkspace(); + if(isSave){ + Alert.alert( + '保存工作空间成功', + ); + }else{ + Alert.alert( + '保存工作空间失败', + ); + } + }).bind(this)(); + } + } + + _toSaveAsPage = ()=>{ + this.setState({ + title:{display:true,text:'另存工作空间为',backBtnDisplay:false}, + scrollPage:{display:false}, + wsSaveAsPage:{display:true}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }); + } + + _wsCloseBtnPress = ()=>{ + //this is scrollPage Two btn Three,it means close workspace + (async function () { + if(! this.state.coreData.workspaceOpen){ + return + } + var workspace = this.state.coreData.workspace; + var filePath = this.state.coreData.filePath; + var fileName = this.state.coreData.fileName; + var isClose = await workspace.closeWorkspace(); + console.log('isClose:'+isClose); + this.setState({ + coreData:{workspace:workspace,filePath: filePath,fileName:fileName,workspaceOpen:!isClose}, + title:{display:true,text:'工作空间管理',backBtnDisplay:true,clickBtn:this._quit}, + scrollPage:{display:true,text:'未命名工作空间'}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }); + }).bind(this)(); + } + + _toDsCreatePage = ()=>{ + this.setState({ + title:{display:true,text:'新建数据源',backBtnDisplay:true,clickBtn:this._toWsInfoPage,}, + scrollPage:{display:false}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:true}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }); + } + + _toDsList =()=>{ + // this is Ds&map info scroll pageOne btn press ,it means to show dsListView. + this.setState({ + title:{display:true,text:'数据源',backBtnDisplay:true,clickBtn:this._toWsInfoPage}, + scrollPage:{display:false}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:true}, + mapListPage:{display:false}, + }); + } + + _toMapList =()=>{ + this.setState({ + title:{display:true,text:'地图',backBtnDisplay:true,clickBtn:this._toWsInfoPage}, + scrollPage:{display:false}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:true}, + }); + } + + _toMainPage = ()=>{ + var scrollText; + var open = this.state.coreData.workspaceOpen; + if(open){ + scrollText = this.state.coreData.fileName; + }else{ + scrollText = '未命名工作空间'; + } + this.setState({ + title:{display:true,text:'工作空间管理',backBtnDisplay:true,clickBtn:this._quit}, + scrollPage:{display:true,text:scrollText}, + wsSaveAsPage:{display:false}, + dmInfoPage:{display:false}, + dsCreatePage:{display:false}, + dsListPage:{display:false}, + mapListPage:{display:false}, + }); + } + +//WorkspaceSaveAsPage 回调函数,可以用于返回另存workspace的id(目前未实现) + _workSpaceIdCallback = (isSaveAs)=>{ + this._toMainPage; + } + +//外部回调方法,提供给外部通知点击了退出按钮 + _quit = ()=>{ + //this.props.quitCallback('quit'); + } + + render() { + return ( + + {this.state.title.display && } + {this.state.scrollPage.display && } + {this.state.wsSaveAsPage.display && } + {this.state.dmInfoPage.display && } + {this.state.dsCreatePage.display && } + {this.state.dsListPage.display && } + {this.state.mapListPage.display && } + + ); + } +} + +const styles = StyleSheet.create({ + container: { + display:'flex', + flexDirection:'column', + }, + welcome: { + fontSize: 20, + textAlign: 'center', + margin: 10, + }, + instructions: { + textAlign: 'center', + color: '#333333', + marginBottom: 5, + }, +}); + +AppRegistry.registerComponent('reactNativeLearnProject', () => reactNativeLearnProject); diff --git a/NativeModule/components/SMWorkspaceSaveAsPage.js b/NativeModule/components/SMWorkspaceSaveAsPage.js new file mode 100755 index 00000000..351a5156 --- /dev/null +++ b/NativeModule/components/SMWorkspaceSaveAsPage.js @@ -0,0 +1,127 @@ +/********************************************************************************* + Copyright © SuperMap. All rights reserved. + Author: Zihao Wang + E-mail: pridehao@gmail.com + Description:工作空间另存控件。 + + **********************************************************************************/ + +import React, { Component } from 'react'; +import{ + Text, + View, + StyleSheet, + TouchableHighlight +} from 'react-native' + +import InputComponent from './SMInputComponent.js' + +let name =''; +let password =''; +let passwordConfirm =''; + +export default class WorkspaceSaveAsPage extends Component{ + constructor(props){ + super(props); + // this._saveAs = this._saveAs.bind(this); + } + + _nameChanged = (newText)=>{ + name = newText; + } + + _passwordChanged = (newText)=>{ + password = newText; + } + + _passwordConfirmChanged = (newText)=>{ + passwordConfirm = newText; + } + + _saveAs = ()=>{ + if(name.length>0 && password.length>0 && password===passwordConfirm){ + var homeDirectory; + var workspace = this.props.workspace; + var oldFilePath = this.props.filePath; + var oldFileName = this.props.fileName; + var isContain = oldFilePath.indexOf(oldFileName); + if(isContain>=0){ + homeDirectory = oldFilePath.slice(0,isContain); + } + var newFileName = name +'.smwu'; + var newFilePath = homeDirectory + newFileName; + + (async function ( ) { + var isSaveAs = await workspace.saveWorkspace(newFilePath); + console.log('save As :'+isSaveAs);//--------------------无法进行密码保存-------------------! + this.props.callBack(isSaveAs); + }).bind(this)() + }else{ + console.log('save failed, please check your save as name and password!'); + } + } + + render() { + return( + + *工作空间将另存至原工作空间同级目录* + + + + + + {/*onPress-> this.props.clickBtnOne 若作为控件使用BtnOne应修改此处*/} + 保存 + + + 取消 + + + + + ); + } + +}; + +var styles = StyleSheet.create({ + container: { + backgroundColor:'#F5FCFF', + display:'flex', + flexDirection:'column', + justifyContent:'space-around', + }, + tips: { + lineHeight:40, + alignSelf:'center', + backgroundColor:'transparent', + }, + inputContainerStyle: { + height:400, + display:'flex', + flexDirection:'column', + justifyContent:'space-between', + backgroundColor: 'transparent', + }, + buttonContainer: { + alignSelf:'center', + height:40, + width:200, + display:'flex', + flexDirection: 'row', + justifyContent:'space-between', + backgroundColor:'transparent', + }, + button:{ + padding:10, + width:75, + height:40, + backgroundColor:'#F5FCFF', + borderColor: 'rgba(59,55,56,0.3)', + borderWidth: 1, + borderRadius:3, + }, + saveButtonText:{ + alignSelf:'center', + }, +}); diff --git a/NativeModule/constains/EventConst.js b/NativeModule/constains/EventConst.js new file mode 100644 index 00000000..df1ce012 --- /dev/null +++ b/NativeModule/constains/EventConst.js @@ -0,0 +1,9 @@ +export default { + COLLECTION_CHANGE : "com.supermap.RN.JSMapcontrol.collection_change", + COLLECTION_SENSER_CHANGE : "com.supermap.RN.JSMapcontrol.collection_sensor_change", + ONLINE_SERVICE_DOWNLOADING : "com.supermap.RN.JSMapcontrol.online_service_downloading", + ONLINE_SERVICE_DOWNLOADED :"com.supermap.RN.JSMapcontrol.online_service_downloaded", + ONLINE_SERVICE_LOGIN : "com.supermap.RN.JSMapcontrol.online_service_login", + ONLINE_SERVICE_LOGOUT : "com.supermap.RN.JSMapcontrol.online_service_logout", + ONLINE_SERVICE_DOWNLOADFAILURE : "com.supermap.RN.JSMapcontrol.online_service_downloadfailure", +} \ No newline at end of file diff --git a/NativeModule/constains/index.js b/NativeModule/constains/index.js new file mode 100644 index 00000000..a15b4389 --- /dev/null +++ b/NativeModule/constains/index.js @@ -0,0 +1,5 @@ +import EventConst from './EventConst' + +export { + EventConst, +} \ No newline at end of file diff --git a/NativeModule/plotImage/10.png b/NativeModule/plotImage/10.png new file mode 100755 index 00000000..4a9cf466 Binary files /dev/null and b/NativeModule/plotImage/10.png differ diff --git a/NativeModule/plotImage/1001.png b/NativeModule/plotImage/1001.png new file mode 100755 index 00000000..d65a69d6 Binary files /dev/null and b/NativeModule/plotImage/1001.png differ diff --git a/NativeModule/plotImage/1002.png b/NativeModule/plotImage/1002.png new file mode 100755 index 00000000..ab63c3ed Binary files /dev/null and b/NativeModule/plotImage/1002.png differ diff --git a/NativeModule/plotImage/1003.png b/NativeModule/plotImage/1003.png new file mode 100755 index 00000000..1ec99bd2 Binary files /dev/null and b/NativeModule/plotImage/1003.png differ diff --git a/NativeModule/plotImage/1004.png b/NativeModule/plotImage/1004.png new file mode 100755 index 00000000..1bd6bb6f Binary files /dev/null and b/NativeModule/plotImage/1004.png differ diff --git a/NativeModule/plotImage/1005.png b/NativeModule/plotImage/1005.png new file mode 100755 index 00000000..3de3cbdb Binary files /dev/null and b/NativeModule/plotImage/1005.png differ diff --git a/NativeModule/plotImage/1006.png b/NativeModule/plotImage/1006.png new file mode 100755 index 00000000..53efcda1 Binary files /dev/null and b/NativeModule/plotImage/1006.png differ diff --git a/NativeModule/plotImage/1007.png b/NativeModule/plotImage/1007.png new file mode 100755 index 00000000..582a35c9 Binary files /dev/null and b/NativeModule/plotImage/1007.png differ diff --git a/NativeModule/plotImage/1008.png b/NativeModule/plotImage/1008.png new file mode 100755 index 00000000..b388f5b0 Binary files /dev/null and b/NativeModule/plotImage/1008.png differ diff --git a/NativeModule/plotImage/1009.png b/NativeModule/plotImage/1009.png new file mode 100755 index 00000000..9c2ce692 Binary files /dev/null and b/NativeModule/plotImage/1009.png differ diff --git a/NativeModule/plotImage/10100.png b/NativeModule/plotImage/10100.png new file mode 100755 index 00000000..c8bae6c3 Binary files /dev/null and b/NativeModule/plotImage/10100.png differ diff --git a/NativeModule/plotImage/14.png b/NativeModule/plotImage/14.png new file mode 100755 index 00000000..6b3f0b8f Binary files /dev/null and b/NativeModule/plotImage/14.png differ diff --git a/NativeModule/plotImage/30304.png b/NativeModule/plotImage/30304.png new file mode 100755 index 00000000..ccc08afd Binary files /dev/null and b/NativeModule/plotImage/30304.png differ diff --git a/NativeModule/plotImage/30307.png b/NativeModule/plotImage/30307.png new file mode 100755 index 00000000..f5c3ed3b Binary files /dev/null and b/NativeModule/plotImage/30307.png differ diff --git a/NativeModule/plotImage/30308.png b/NativeModule/plotImage/30308.png new file mode 100755 index 00000000..f7ab4c91 Binary files /dev/null and b/NativeModule/plotImage/30308.png differ diff --git a/NativeModule/plotImage/30502.png b/NativeModule/plotImage/30502.png new file mode 100755 index 00000000..94844ba9 Binary files /dev/null and b/NativeModule/plotImage/30502.png differ diff --git a/NativeModule/plotImage/30709.png b/NativeModule/plotImage/30709.png new file mode 100755 index 00000000..8108c132 Binary files /dev/null and b/NativeModule/plotImage/30709.png differ diff --git a/NativeModule/plotImage/40503.png b/NativeModule/plotImage/40503.png new file mode 100755 index 00000000..a1b8e037 Binary files /dev/null and b/NativeModule/plotImage/40503.png differ diff --git a/NativeModule/plotImage/56.png b/NativeModule/plotImage/56.png new file mode 100755 index 00000000..41005c27 Binary files /dev/null and b/NativeModule/plotImage/56.png differ diff --git a/NativeModule/plotImage/70100.png b/NativeModule/plotImage/70100.png new file mode 100755 index 00000000..61ed6995 Binary files /dev/null and b/NativeModule/plotImage/70100.png differ diff --git a/NativeModule/plotImage/80102.png b/NativeModule/plotImage/80102.png new file mode 100755 index 00000000..2dc56aa1 Binary files /dev/null and b/NativeModule/plotImage/80102.png differ diff --git a/NativeModule/plotImage/80106.png b/NativeModule/plotImage/80106.png new file mode 100755 index 00000000..5858bb5b Binary files /dev/null and b/NativeModule/plotImage/80106.png differ diff --git a/NativeModule/plotImage/80201.png b/NativeModule/plotImage/80201.png new file mode 100755 index 00000000..f087d7c9 Binary files /dev/null and b/NativeModule/plotImage/80201.png differ diff --git a/NativeModule/plotImage/80400.png b/NativeModule/plotImage/80400.png new file mode 100755 index 00000000..1c3daf09 Binary files /dev/null and b/NativeModule/plotImage/80400.png differ diff --git a/NativeModule/plotImage/star.png b/NativeModule/plotImage/star.png new file mode 100755 index 00000000..cbd8f517 Binary files /dev/null and b/NativeModule/plotImage/star.png differ diff --git a/NativeModule/resource/DsList.png b/NativeModule/resource/DsList.png new file mode 100755 index 00000000..0501f2ab Binary files /dev/null and b/NativeModule/resource/DsList.png differ diff --git a/NativeModule/resource/DsList_1.png b/NativeModule/resource/DsList_1.png new file mode 100755 index 00000000..ec7c8875 Binary files /dev/null and b/NativeModule/resource/DsList_1.png differ diff --git a/NativeModule/resource/arrow.png b/NativeModule/resource/arrow.png new file mode 100755 index 00000000..2c383b8e Binary files /dev/null and b/NativeModule/resource/arrow.png differ diff --git a/NativeModule/resource/datasetList.png b/NativeModule/resource/datasetList.png new file mode 100755 index 00000000..1c051646 Binary files /dev/null and b/NativeModule/resource/datasetList.png differ diff --git a/NativeModule/resource/datasource.png b/NativeModule/resource/datasource.png new file mode 100755 index 00000000..083abebc Binary files /dev/null and b/NativeModule/resource/datasource.png differ diff --git a/NativeModule/resource/destpoint.png b/NativeModule/resource/destpoint.png old mode 100644 new mode 100755 diff --git a/NativeModule/resource/file.png b/NativeModule/resource/file.png new file mode 100755 index 00000000..9a257147 Binary files /dev/null and b/NativeModule/resource/file.png differ diff --git a/NativeModule/resource/leftArrow.png b/NativeModule/resource/leftArrow.png new file mode 100755 index 00000000..fa8572e8 Binary files /dev/null and b/NativeModule/resource/leftArrow.png differ diff --git a/NativeModule/resource/line.png b/NativeModule/resource/line.png new file mode 100755 index 00000000..5246682a Binary files /dev/null and b/NativeModule/resource/line.png differ diff --git a/NativeModule/resource/map.png b/NativeModule/resource/map.png new file mode 100755 index 00000000..e3aab084 Binary files /dev/null and b/NativeModule/resource/map.png differ diff --git a/NativeModule/resource/map_1.png b/NativeModule/resource/map_1.png new file mode 100755 index 00000000..2c2ac7e0 Binary files /dev/null and b/NativeModule/resource/map_1.png differ diff --git a/NativeModule/resource/star.png b/NativeModule/resource/star.png new file mode 100755 index 00000000..dced509c Binary files /dev/null and b/NativeModule/resource/star.png differ diff --git a/NativeModule/resource/startpoint.png b/NativeModule/resource/startpoint.png old mode 100644 new mode 100755 diff --git a/NativeModule/utility/.DS_Store b/NativeModule/utility/.DS_Store deleted file mode 100644 index 5008ddfc..00000000 Binary files a/NativeModule/utility/.DS_Store and /dev/null differ diff --git a/NativeModule/utility/utility.js b/NativeModule/utility/utility.js old mode 100644 new mode 100755 index e634b597..be85e25c --- a/NativeModule/utility/utility.js +++ b/NativeModule/utility/utility.js @@ -11,18 +11,55 @@ import Point from '../Point'; import SystemUtil from '../SystemUtil'; +const util = new SystemUtil(); exports.Point2Map = async function (map,x, y) { - var pointFac = new Point(); - var point = await pointFac.createObj(x,y); - var mapPoint = await map.pixelToMap(point); + let pointFac = new Point(); + let point = await pointFac.createObj(x,y); + let mapPoint = await map.pixelToMap(point); return mapPoint; } -exports.appendingHomeDirectory = async function (path) { - var util = new SystemUtil(); - var homeDirectory = await util.getHomeDirectory(); - var newPath = homeDirectory + path; +exports.appendingHomeDirectory = async function (path = '') { + let homeDirectory = await util.getHomeDirectory(); + let newPath = homeDirectory + path; return newPath; } + +exports.getDirectoryContent = async function (path) { + let directories = await util.getDirectoryContent(path); + return directories; +} + +exports.fileIsExist = async function (path) { + let isExist = await util.fileIsExist(path); + return isExist; +} + +exports.fileIsExistInHomeDirectory = async function (path) { + let isExist = await util.fileIsExistInHomeDirectory(path); + return isExist; +} + +exports.createDirectory = async function (path) { + return await util.createDirectory(path); +} + +exports.getPathList = async function (path) { + return await util.getPathList(path); +} + +exports.isDirectory = async function (path) { + return await util.isDirectory(path); +} + +exports.getPathListByFilter = async function (path, {name = '', type = ''}) { + return await util.getPathListByFilter(path, {name, type}); +} +exports.unZipFile = async function (zipfile,targetdir) { + return await util.unZipFile(zipfile, targetdir); +} +exports.deleteFile = async function (file) { + return await util.deleteFile(file); +} \ No newline at end of file diff --git a/README.md b/README.md index 2e52ef25..444997c3 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,32 @@ -# imobile_for_javascript +# imobile_for_reactnative · [![npm version](https://badge.fury.io/js/imobile_for_reactnative.svg)](https://badge.fury.io/js/imobile_for_reactnative) + +iMobile for ReactNative, 是SuperMap iMobile推出的一款基于React-Native框架的移动应用开发工具,基于该开发工具,用户可以 +使用JavaScript XML开发语言,开发出在Android和iOS操作系统下运行的原声移动GIS应用,入门门槛低,一次开发,处处运行。 ## Getting started -`$ npm install imobile_for_javascript --save` +iMobile for ReactNative is based on ReactNative.Please ensure that you have initialized the RN project before executing the following command and that it is already under the project path. + +`$ npm install imobile_for_reactnative --save` ### Mostly automatic installation -`$ react-native link imobile_for_javascript` +`$ react-native link imobile_for_reactnative` ### Manual installation #### iOS -Supermap SDK base on RN for IOS is coming soon... - -1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` -2. Go to `node_modules` ➜ `imobile_for_javascript` and add `Supermap.xcodeproj` -3. In XCode, in the project navigator, select your project. Add `libSupermap.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` -4. Run your project (`Cmd+R`)< +1. In XCode, in the project navigator, click `General` ➜ `Linked Frameworks and Libraries`,add Frameworks and c++ library required by iMobile. +2. Add SuperMap.framework and MessageQueue.framework. +3. Add bundle file and license. +4. Write and run your project (`Cmd+R`). #### Android -1. Open up `android/app/src/main/java/[...]/MainActivity.java` - - Add `import com.supermap.rnsupermap.SupermapPackage;` to the imports at the top of the file - - Add `new SupermapPackage()` to the list returned by the `getPackages()` method -2. Append the following lines to `android/settings.gradle`: - ``` - include ':supermap' - project(':supermap').projectDir = new File(rootProject.projectDir, '../node_modules/supermap/android') - ``` -3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: - ``` - compile project(':supermap') - ``` +1. Add license. +2. Write and run your project (`^+R`). ## Usage @@ -42,15 +35,15 @@ For this Example.After install the pack we offered, You will easily make a proj 1. Setup the liscense file into the path "./Supermap/licsence". 2. Setup the Sample Data into a specified path that will be refer as a argument in the function setServer() of WorkspaceConnection object in the next step; -3. type the follow codes in an initiated React Native Project +3. type the follow codes in an initiated React Native Project "App.js". ```javascript ... import { Workspace, - SMMapView, -} from 'imobile_for_javascript'; + SMMapView, +} from 'imobile_for_reactnative'; class XXX extends Component { @@ -117,7 +110,5 @@ const styles = StyleSheet.create({ }, }); -AppRegistry.registerComponent('XXX', () => XXX); - ``` - \ No newline at end of file + diff --git a/android/.DS_Store b/android/.DS_Store deleted file mode 100644 index cb0e930f..00000000 Binary files a/android/.DS_Store and /dev/null differ diff --git a/android/.classpath b/android/.classpath new file mode 100644 index 00000000..c93a0ddb --- /dev/null +++ b/android/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/android/.idea/codeStyles/Project.xml b/android/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..30aa626c --- /dev/null +++ b/android/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml deleted file mode 100644 index 96cc43ef..00000000 --- a/android/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/.idea/copyright/profiles_settings.xml b/android/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf33..00000000 --- a/android/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index 1b97cc94..e7ff7830 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -5,11 +5,12 @@ @@ -24,36 +25,10 @@ - - - - - - - - - - - + - - - - - 1.7 - - - - - - - \ No newline at end of file diff --git a/android/.idea/workspace.xml b/android/.idea/workspace.xml index 92ac4c7d..9a66a64a 100644 --- a/android/.idea/workspace.xml +++ b/android/.idea/workspace.xml @@ -1,9 +1,7 @@ - - - + - - - - @@ -24,16 +17,45 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -41,29 +63,90 @@ + + + removelayer + getAlias + Netwo + facility + Navigation2 + networkanalyst + + + $PROJECT_DIR$ + + + + + + - -