@supermapgis/iclient-ol 11.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +56 -0
  2. package/control/ChangeTileVersion.js +438 -0
  3. package/control/Logo.js +99 -0
  4. package/control/ScaleLine.js +164 -0
  5. package/control/index.js +6 -0
  6. package/core/MapExtend.js +49 -0
  7. package/core/StyleUtils.js +1253 -0
  8. package/core/Util.js +478 -0
  9. package/core/index.js +6 -0
  10. package/css/ChangeTileVersion.css +347 -0
  11. package/css/index.js +5 -0
  12. package/dist/iclient-openlayers-es6.js +121806 -0
  13. package/dist/iclient-openlayers-es6.min.js +8 -0
  14. package/dist/iclient-openlayers.css +668 -0
  15. package/dist/iclient-openlayers.js +132335 -0
  16. package/dist/iclient-openlayers.min.css +8 -0
  17. package/dist/iclient-openlayers.min.js +8 -0
  18. package/index.js +9 -0
  19. package/mapping/BaiduMap.js +121 -0
  20. package/mapping/ImageSuperMapRest.js +252 -0
  21. package/mapping/ImageTileSuperMapRest.js +99 -0
  22. package/mapping/InitMap.js +125 -0
  23. package/mapping/SuperMapCloud.js +56 -0
  24. package/mapping/Tianditu.js +152 -0
  25. package/mapping/TileSuperMapRest.js +358 -0
  26. package/mapping/WebMap.js +5185 -0
  27. package/mapping/index.js +11 -0
  28. package/mapping/webmap/Util.js +176 -0
  29. package/mapping/webmap/config/MunicipalCenter.json +1 -0
  30. package/mapping/webmap/config/ProvinceCenter.json +1 -0
  31. package/mapping/webmap/config/SampleDataInfo.json +55 -0
  32. package/namespace.js +150 -0
  33. package/overlay/DataFlow.js +114 -0
  34. package/overlay/FGB.js +97 -0
  35. package/overlay/Graph.js +436 -0
  36. package/overlay/GraphMap.js +91 -0
  37. package/overlay/Graphic.js +587 -0
  38. package/overlay/HeatMap.js +444 -0
  39. package/overlay/Label.js +964 -0
  40. package/overlay/Mapv.js +146 -0
  41. package/overlay/Range.js +127 -0
  42. package/overlay/RankSymbol.js +94 -0
  43. package/overlay/Turf.js +298 -0
  44. package/overlay/Unique.js +123 -0
  45. package/overlay/VectorTileSuperMapRest.js +466 -0
  46. package/overlay/graphic/CanvasRenderer.js +177 -0
  47. package/overlay/graphic/CloverShape.js +133 -0
  48. package/overlay/graphic/Graphic.js +174 -0
  49. package/overlay/graphic/HitCloverShape.js +63 -0
  50. package/overlay/graphic/WebGLRenderer.js +356 -0
  51. package/overlay/graphic/index.js +9 -0
  52. package/overlay/index.js +21 -0
  53. package/overlay/mapv/MapvCanvasLayer.js +104 -0
  54. package/overlay/mapv/MapvLayer.js +410 -0
  55. package/overlay/mapv/index.js +5 -0
  56. package/overlay/theme/GeoFeature.js +275 -0
  57. package/overlay/theme/Theme.js +585 -0
  58. package/overlay/theme/ThemeFeature.js +46 -0
  59. package/overlay/theme/index.js +6 -0
  60. package/overlay/vectortile/DeafultCanvasStyle.js +125 -0
  61. package/overlay/vectortile/MapboxStyles.js +375 -0
  62. package/overlay/vectortile/StyleMap.js +252 -0
  63. package/overlay/vectortile/VectorTileStyles.js +554 -0
  64. package/overlay/vectortile/index.js +7 -0
  65. package/overlay/vectortile/olExtends.js +382 -0
  66. package/package.json +29 -0
  67. package/services/AddressMatchService.js +60 -0
  68. package/services/ChartService.js +74 -0
  69. package/services/DataFlowService.js +118 -0
  70. package/services/DatasetService.js +104 -0
  71. package/services/DatasourceService.js +76 -0
  72. package/services/FeatureService.js +196 -0
  73. package/services/FieldService.js +53 -0
  74. package/services/GeoprocessingService.js +156 -0
  75. package/services/GridCellInfosService.js +53 -0
  76. package/services/ImageCollectionService.js +92 -0
  77. package/services/ImageService.js +69 -0
  78. package/services/KnowledgeGraphService.js +82 -0
  79. package/services/LayerInfoService.js +85 -0
  80. package/services/MapService.js +85 -0
  81. package/services/MeasureService.js +77 -0
  82. package/services/NetworkAnalyst3DService.js +88 -0
  83. package/services/NetworkAnalystService.js +252 -0
  84. package/services/ProcessingService.js +478 -0
  85. package/services/QueryService.js +116 -0
  86. package/services/ServiceBase.js +26 -0
  87. package/services/SpatialAnalystService.js +432 -0
  88. package/services/ThemeService.js +50 -0
  89. package/services/TrafficTransferAnalystService.js +88 -0
  90. package/services/WebPrintingJobService.js +112 -0
  91. package/services/index.js +27 -0
@@ -0,0 +1,104 @@
1
+ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
+ * This program are made available under the terms of the Apache License, Version 2.0
3
+ * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
+ import { ServiceBase } from './ServiceBase';
5
+ import { DatasetService as CommonDatasetService } from '@supermapgis/iclient-common/iServer/DatasetService';
6
+ import { CreateDatasetParameters } from '@supermapgis/iclient-common/iServer/CreateDatasetParameters';
7
+ import { UpdateDatasetParameters } from '@supermapgis/iclient-common/iServer/UpdateDatasetParameters';
8
+
9
+ /**
10
+ * @class DatasetService
11
+ * @category iServer Data Dataset
12
+ * @classdesc 数据集服务类。
13
+ * @modulecategory Services
14
+ * @param {string} url - 服务地址。
15
+ * @param {Object} options - 参数。
16
+ * @param {string} [options.proxy] - 服务代理地址。
17
+ * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
18
+ * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
19
+ * @param {Object} [options.headers] - 请求头。
20
+ * @extends {ServiceBase}
21
+ * @usage
22
+ */
23
+ export class DatasetService extends ServiceBase {
24
+
25
+ constructor(url, options) {
26
+ super(url, options);
27
+ this._datasetService = new CommonDatasetService(this.url, {
28
+ proxy: this.options.proxy,
29
+ withCredentials: this.options.withCredentials,
30
+ crossOrigin: this.options.crossOrigin,
31
+ headers: this.options.headers
32
+ });
33
+ }
34
+
35
+ /**
36
+ * @function DatasetService.prototype.getDatasets
37
+ * @description 数据集查询服务。
38
+ * @param {string} datasourceName - 数据源名称。
39
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
40
+ * @returns {Promise} Promise 对象。
41
+ */
42
+ getDatasets(datasourceName, callback) {
43
+ if (!datasourceName) {
44
+ return;
45
+ }
46
+ return this._datasetService.getDatasetsService(datasourceName, callback);
47
+ }
48
+
49
+ /**
50
+ * @function DatasetService.prototype.getDataset
51
+ * @description 数据集查询服务。
52
+ * @param {string} datasourceName - 数据源名称。
53
+ * @param {string} datasetName - 数据集名称。
54
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
55
+ * @returns {Promise} Promise 对象。
56
+ */
57
+ getDataset(datasourceName, datasetName, callback) {
58
+ if (!datasourceName || !datasetName) {
59
+ return;
60
+ }
61
+ return this._datasetService.getDatasetService(datasourceName, datasetName, callback);
62
+ }
63
+
64
+ /**
65
+ * @function DatasetService.prototype.setDataset
66
+ * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
67
+ * @param {CreateDatasetParameters | UpdateDatasetParameters } params - 数据集创建参数类或数据集信息更改参数类。
68
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
69
+ * @returns {Promise} Promise 对象。
70
+ */
71
+ setDataset(params, callback) {
72
+ if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
73
+ return;
74
+ }else if (params instanceof CreateDatasetParameters) {
75
+ var datasetParams = {
76
+ "datasetType": params.datasetType,
77
+ "datasetName": params.datasetName,
78
+ "datasourceName": params.datasourceName
79
+ }
80
+ }else if(params instanceof UpdateDatasetParameters){
81
+ datasetParams = {
82
+ "datasetName": params.datasetName,
83
+ "datasourceName": params.datasourceName,
84
+ "isFileCache": params.isFileCache,
85
+ "description": params.description,
86
+ "prjCoordSys": params.prjCoordSys,
87
+ "charset": params.charset
88
+ }
89
+ }
90
+ return this._datasetService.setDatasetService(datasetParams, callback);
91
+ }
92
+
93
+ /**
94
+ * @function DatasetService.prototype.deleteDataset
95
+ * @description 指定数据源下的数据集删除服务。
96
+ * @param {string} datasourceName - 数据源名称。
97
+ * @param {string} datasetName - 数据集名称。
98
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
99
+ * @returns {Promise} Promise 对象。
100
+ */
101
+ deleteDataset(datasourceName, datasetName, callback) {
102
+ return this._datasetService.deleteDatasetService(datasourceName, datasetName, callback);
103
+ }
104
+ }
@@ -0,0 +1,76 @@
1
+ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
+ * This program are made available under the terms of the Apache License, Version 2.0
3
+ * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
+ import {ServiceBase} from './ServiceBase';
5
+ import {DatasourceService as CommonDatasourceService} from '@supermapgis/iclient-common/iServer/DatasourceService';
6
+ import { SetDatasourceParameters } from '@supermapgis/iclient-common/iServer/SetDatasourceParameters';
7
+
8
+ /**
9
+ * @class DatasourceService
10
+ * @category iServer Data Datasource
11
+ * @classdesc 数据源服务类。
12
+ * @modulecategory Services
13
+ * @param {string} url - 服务地址。
14
+ * @param {Object} options - 参数。
15
+ * @param {string} [options.proxy] - 服务代理地址。
16
+ * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
17
+ * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
18
+ * @param {Object} [options.headers] - 请求头。
19
+ * @extends {ServiceBase}
20
+ * @usage
21
+ */
22
+ export class DatasourceService extends ServiceBase {
23
+
24
+ constructor(url, options) {
25
+ super(url, options);
26
+ this._datasourceService = new CommonDatasourceService(this.url, {
27
+ proxy: this.proxy,
28
+ withCredentials: this.withCredentials,
29
+ crossOrigin: this.crossOrigin,
30
+ headers: this.headers
31
+ });
32
+ }
33
+
34
+ /**
35
+ * @function DatasourceService.prototype.getDatasources
36
+ * @description 数据源集查询服务。
37
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
38
+ */
39
+ getDatasources(callback) {
40
+ return this._datasourceService.getDatasourcesService(callback);
41
+ }
42
+
43
+ /**
44
+ * @function DatasourceService.prototype.getDatasource
45
+ * @description 数据源信息查询服务。
46
+ * @param {string} datasourceName - 数据源名称。
47
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
48
+ * @returns {Promise} Promise 对象。
49
+ */
50
+ getDatasource(datasourceName, callback) {
51
+ if (!datasourceName) {
52
+ return;
53
+ }
54
+ return this._datasourceService.getDatasourceService(datasourceName, callback);
55
+ }
56
+
57
+ /**
58
+ * @function DatasourceService.prototype.setDatasource
59
+ * @description 数据源信息设置服务。可实现更改当前数据源信息。
60
+ * @param {SetDatasourceParameters} params - 数据源信息设置参数类。
61
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
62
+ * @returns {Promise} Promise 对象。
63
+ */
64
+ setDatasource(params, callback) {
65
+ if (!(params instanceof SetDatasourceParameters)) {
66
+ return;
67
+ }
68
+ const datasourceParams = {
69
+ description: params.description,
70
+ coordUnit: params.coordUnit,
71
+ distanceUnit: params.distanceUnit,
72
+ datasourceName: params.datasourceName
73
+ };
74
+ return this._datasourceService.setDatasourceService(datasourceParams, callback);
75
+ }
76
+ }
@@ -0,0 +1,196 @@
1
+ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
+ * This program are made available under the terms of the Apache License, Version 2.0
3
+ * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
+ import { Util as CommonUtil } from '@supermapgis/iclient-common/commontypes/Util';
5
+ import { DataFormat } from '@supermapgis/iclient-common/REST';
6
+ import { EditFeaturesService } from '@supermapgis/iclient-common/iServer/EditFeaturesService';
7
+ import { FeatureService as CommonFeatureService } from '@supermapgis/iclient-common/iServer/FeatureService';
8
+ import { Util } from '../core/Util';
9
+ import { ServiceBase } from './ServiceBase';
10
+ import GeoJSON from 'ol/format/GeoJSON';
11
+
12
+ /**
13
+ * @class FeatureService
14
+ * @constructs FeatureService
15
+ * @category iServer Data Feature
16
+ * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
17
+ * @modulecategory Services
18
+ * @example
19
+ * new FeatureService(url).getFeaturesByIDs(param,function(result){
20
+ * //doSomething
21
+ * })
22
+ * @param {string} url - 服务地址。
23
+ * @param {Object} options - 参数。
24
+ * @param {string} [options.proxy] - 服务代理地址。
25
+ * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
26
+ * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
27
+ * @param {Object} [options.headers] - 请求头。
28
+ * @extends {ServiceBase}
29
+ * @usage
30
+ */
31
+ export class FeatureService extends ServiceBase {
32
+ constructor(url, options) {
33
+ super(url, options);
34
+ this._featureService = new CommonFeatureService(url, options);
35
+ }
36
+
37
+ /**
38
+ * @function FeatureService.prototype.getFeaturesByIDs
39
+ * @description 数据集 ID 查询服务。
40
+ * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
41
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
42
+ * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
43
+ * @returns {Promise} Promise 对象。
44
+ */
45
+ getFeaturesByIDs(params, callback, resultFormat) {
46
+ params = this._processParams(params);
47
+ return this._featureService.getFeaturesByIDs(params, callback, resultFormat);
48
+ }
49
+
50
+ /**
51
+ * @function FeatureService.prototype.getFeaturesByBounds
52
+ * @description 数据集 Bounds 查询服务。
53
+ * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
54
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
55
+ * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
56
+ * @returns {Promise} Promise 对象。
57
+ */
58
+ getFeaturesByBounds(params, callback, resultFormat) {
59
+ params = this._processParams(params);
60
+ return this._featureService.getFeaturesByBounds(params, callback, resultFormat);
61
+ }
62
+
63
+ /**
64
+ * @function FeatureService.prototype.getFeaturesByBuffer
65
+ * @description 数据集 Buffer 查询服务。
66
+ * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
67
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
68
+ * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
69
+ * @returns {Promise} Promise 对象。
70
+ */
71
+ getFeaturesByBuffer(params, callback, resultFormat) {
72
+ params = this._processParams(params);
73
+ return this._featureService.getFeaturesByBuffer(params, callback, resultFormat);
74
+ }
75
+
76
+ /**
77
+ * @function FeatureService.prototype.getFeaturesBySQL
78
+ * @description 数据集 SQL 查询服务。
79
+ * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
80
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
81
+ * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
82
+ * @returns {Promise} Promise 对象。
83
+ */
84
+ getFeaturesBySQL(params, callback, resultFormat) {
85
+ params = this._processParams(params);
86
+ return this._featureService.getFeaturesBySQL(params, callback, resultFormat);
87
+ }
88
+
89
+ /**
90
+ * @function FeatureService.prototype.getFeaturesByGeometry
91
+ * @description 数据集几何查询服务类。
92
+ * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
93
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
94
+ * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
95
+ * @returns {Promise} Promise 对象。
96
+ */
97
+ getFeaturesByGeometry(params, callback, resultFormat) {
98
+ params = this._processParams(params);
99
+ return this._featureService.getFeaturesByGeometry(params, callback, resultFormat);
100
+ }
101
+
102
+ /**
103
+ * @function FeatureService.prototype.editFeatures
104
+ * @description 地物编辑服务。
105
+ * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
106
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
107
+ * @returns {Promise} Promise 对象。
108
+ */
109
+ editFeatures(params, callback) {
110
+ if (!params || !params.dataSourceName || !params.dataSetName) {
111
+ return;
112
+ }
113
+ var me = this,
114
+ url = me.url,
115
+ dataSourceName = params.dataSourceName,
116
+ dataSetName = params.dataSetName;
117
+ url = CommonUtil.urlPathAppend(url, 'datasources/' + dataSourceName + '/datasets/' + dataSetName);
118
+
119
+ var editFeatureService = new EditFeaturesService(url, {
120
+ proxy: me.options.proxy,
121
+ withCredentials: me.options.withCredentials,
122
+ crossOrigin: me.options.crossOrigin,
123
+ headers: me.options.headers
124
+ });
125
+ return editFeatureService.processAsync(me._processParams(params), callback);
126
+ }
127
+
128
+ /**
129
+ * @function FeatureService.prototype.getMetadata
130
+ * @description 地理要素元信息。
131
+ * @version 11.1.1
132
+ * @param {Object} params - 包括数据源名称、数据集名称、要素ID。
133
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
134
+ * @returns {Promise} Promise 对象。
135
+ */
136
+ getMetadata(params, callback) {
137
+ return this._featureService.getMetadata(params, callback);
138
+ }
139
+
140
+ _processParams(params) {
141
+ if (!params) {
142
+ return {};
143
+ }
144
+ var me = this;
145
+ params.returnContent = params.returnContent == null ? true : params.returnContent;
146
+ params.fromIndex = params.fromIndex ? params.fromIndex : 0;
147
+ params.toIndex = params.toIndex ? params.toIndex : -1;
148
+ if (params.bounds) {
149
+ params.bounds = Util.toSuperMapBounds(params.bounds);
150
+ }
151
+ if (params.geometry) {
152
+ params.geometry = Util.toSuperMapGeometry(JSON.parse(new GeoJSON().writeGeometry(params.geometry)));
153
+ }
154
+ if (params.editType) {
155
+ params.editType = params.editType.toLowerCase();
156
+ }
157
+ if (params.features) {
158
+ var features = [];
159
+ if (Util.isArray(params.features)) {
160
+ params.features.map(function (feature) {
161
+ features.push(me._createServerFeature(feature));
162
+ return feature;
163
+ });
164
+ } else {
165
+ features.push(me._createServerFeature(params.features));
166
+ }
167
+ params.features = features;
168
+ }
169
+ return params;
170
+ }
171
+
172
+ _createServerFeature(geoFeature) {
173
+ var feature = {},
174
+ fieldNames = [],
175
+ fieldValues = [];
176
+ var properties = geoFeature.getProperties();
177
+ for (var key in properties) {
178
+ if (key === geoFeature.getGeometryName()) {
179
+ continue;
180
+ }
181
+ fieldNames.push(key);
182
+ fieldValues.push(properties[key]);
183
+ }
184
+ feature.fieldNames = fieldNames;
185
+ feature.fieldValues = fieldValues;
186
+ if (geoFeature.getId()) {
187
+ feature.id = geoFeature.getId();
188
+ }
189
+ feature.geometry = Util.toSuperMapGeometry(new GeoJSON().writeFeatureObject(geoFeature));
190
+ return feature;
191
+ }
192
+
193
+ _processFormat(resultFormat) {
194
+ return resultFormat ? resultFormat : DataFormat.GEOJSON;
195
+ }
196
+ }
@@ -0,0 +1,53 @@
1
+ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
+ * This program are made available under the terms of the Apache License, Version 2.0
3
+ * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
+ import {ServiceBase} from './ServiceBase';
5
+ import { FieldService as CommonFieldService } from '@supermapgis/iclient-common/iServer/FieldService';
6
+
7
+ /**
8
+ * @class FieldService
9
+ * @category iServer Data Field
10
+ * @classdesc 字段服务类。
11
+ * @example
12
+ * new FieldService(url).getFields(function(result){
13
+ * //doSomething
14
+ * });
15
+ * @modulecategory Services
16
+ * @param {string} url - 服务地址。
17
+ * @param {Object} options - 参数。
18
+ * @param {string} [options.proxy] - 服务代理地址。
19
+ * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
20
+ * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
21
+ * @param {Object} [options.headers] - 请求头。
22
+ * @extends {ServiceBase}
23
+ * @usage
24
+ */
25
+ export class FieldService extends ServiceBase {
26
+
27
+ constructor(url, options) {
28
+ super(url, options);
29
+ this._fieldService = new CommonFieldService(url, options);
30
+ }
31
+
32
+ /**
33
+ * @function FieldService.prototype.getFields
34
+ * @description 字段查询服务。
35
+ * @param {FieldParameters} params - 字段信息查询参数类。
36
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
37
+ * @returns {Promise} Promise 对象。
38
+ */
39
+ getFields(params, callback) {
40
+ return this._fieldService.getFields(params, callback);
41
+ }
42
+
43
+ /**
44
+ * @function FieldService.prototype.getFieldStatisticsInfo
45
+ * @description 字段统计服务。
46
+ * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
47
+ * @param {RequestCallback} callback - 回调函数。
48
+ * @returns {Promise} Promise 对象。
49
+ */
50
+ getFieldStatisticsInfo(params, callback) {
51
+ return this._fieldService.getFieldStatisticsInfo(params, callback);
52
+ }
53
+ }
@@ -0,0 +1,156 @@
1
+ import { GeoprocessingService as CommonGeoprocessingService } from '@supermapgis/iclient-common/iServer/GeoprocessingService';
2
+ import { ServiceBase } from './ServiceBase';
3
+
4
+ /**
5
+ * @class GeoprocessingService
6
+ * @classdesc 处理自动化服务接口类。
7
+ * @modulecategory Services
8
+ * @version 10.1.0
9
+ * @category iServer ProcessingAutomationService
10
+ * @extends {ServiceBase}
11
+ * @example
12
+ * //为了安全访问受保护的处理自动化服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
13
+ * SecurityManager.registerToken(serviceUrl, token);
14
+ * var geoprocessingService = new geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
15
+ geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
16
+ console.log(serverResult.result);
17
+ var jobID = serverResult.result.jobID;
18
+ var options = {
19
+ interval: 5000,
20
+ statusCallback: function(state) {
21
+ console.log("Job Status: ", state);
22
+ }
23
+ };
24
+ geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
25
+ console.log(serverResult);
26
+ });
27
+ })
28
+ * @param {string} url - 服务地址。
29
+ * @param {Object} options - 参数。
30
+ * @usage
31
+ */
32
+ export class GeoprocessingService extends ServiceBase {
33
+ constructor(url, options) {
34
+ super(url, options);
35
+ this.headers = true;
36
+ this.crossOrigin = true;
37
+ this.withCredentials = true;
38
+ this.proxy = true;
39
+ this._geoprocessingJobsService = new CommonGeoprocessingService(this.url, {
40
+ proxy: this.options.proxy,
41
+ withCredentials: this.options.withCredentials,
42
+ crossOrigin: this.options.crossOrigin,
43
+ headers: this.options.headers
44
+ });
45
+ }
46
+
47
+ /**
48
+ * @function GeoprocessingService.prototype.getTools
49
+ * @description 获取处理自动化工具列表。
50
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
51
+ * @returns {Promise} Promise 对象。
52
+ */
53
+ getTools(callback) {
54
+ return this._geoprocessingJobsService.getTools(callback);
55
+ }
56
+
57
+ /**
58
+ * @function GeoprocessingService.prototype.getTool
59
+ * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
60
+ * @param {string} identifier - 处理自动化工具ID。
61
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
62
+ * @returns {Promise} Promise 对象。
63
+ */
64
+ getTool(identifier, callback) {
65
+ return this._geoprocessingJobsService.getTool(identifier, callback);
66
+ }
67
+
68
+ /**
69
+ * @function GeoprocessingService.prototype.execute
70
+ * @description 同步执行处理自动化工具。
71
+ * @param {string} identifier - 处理自动化工具ID。
72
+ * @param {Object} parameter - 处理自动化工具的输入参数。
73
+ * @param {Object} environment - 处理自动化工具的环境参数。
74
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
75
+ * @returns {Promise} Promise 对象。
76
+ */
77
+ execute(identifier, parameter, environment, callback) {
78
+ return this._geoprocessingJobsService.execute(identifier, parameter, environment, callback);
79
+ }
80
+
81
+ /**
82
+ * @function GeoprocessingService.prototype.submitJob
83
+ * @description 异步执行处理自动化工具。
84
+ * @param {string} identifier - 处理自动化工具ID。
85
+ * @param {Object} parameter - 处理自动化工具的输入参数。
86
+ * @param {Object} environment - 处理自动化工具的环境参数。
87
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
88
+ * @returns {Promise} Promise 对象。
89
+ */
90
+ submitJob(identifier, parameter, environment, callback) {
91
+ return this._geoprocessingJobsService.submitJob(identifier, parameter, environment, callback);
92
+ }
93
+
94
+ /**
95
+ * @function GeoprocessingService.prototype.waitForJobCompletion
96
+ * @description 获取处理自动化异步执行状态信息。
97
+ * @param {string} jobId - 处理自动化任务ID。
98
+ * @param {string} identifier - 处理自动化工具ID。
99
+ * @param {Object} options - 状态信息参数。
100
+ * @param {number} options.interval - 定时器时间间隔。
101
+ * @param {function} options.statusCallback - 回调函数。
102
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
103
+ * @returns {Promise} Promise 对象。
104
+ */
105
+ waitForJobCompletion(jobId, identifier, options, callback) {
106
+ return this._geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options, callback);
107
+ }
108
+
109
+ /**
110
+ * @function GeoprocessingService.prototype.getJobInfo
111
+ * @description 获取处理自动化任务的执行信息。
112
+ * @param {string} identifier - 处理自动化工具ID。
113
+ * @param {string} jobId - 处理自动化任务ID。
114
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
115
+ * @returns {Promise} Promise 对象。
116
+ */
117
+ getJobInfo(identifier, jobId, callback) {
118
+ return this._geoprocessingJobsService.getJobInfo(identifier, jobId, callback);
119
+ }
120
+
121
+ /**
122
+ * @function GeoprocessingService.prototype.cancelJob
123
+ * @description 取消处理自动化任务的异步执行。
124
+ * @param {string} identifier - 处理自动化工具ID。
125
+ * @param {string} jobId - 处理自动化任务ID。
126
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
127
+ * @returns {Promise} Promise 对象。
128
+ */
129
+ cancelJob(identifier, jobId, callback) {
130
+ return this._geoprocessingJobsService.cancelJob(identifier, jobId, callback);
131
+ }
132
+
133
+ /**
134
+ * @function GeoprocessingService.prototype.getJobs
135
+ * @description 获取处理自动化服务任务列表。
136
+ * @param {string} identifier - 处理自动化工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
137
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
138
+ * @returns {Promise} Promise 对象。
139
+ */
140
+ getJobs(identifier, callback) {
141
+ return this._geoprocessingJobsService.getJobs(identifier, callback);
142
+ }
143
+
144
+ /**
145
+ * @function GeoprocessingService.prototype.getResults
146
+ * @description 处理自动化工具异步执行的结果,支持结果过滤。
147
+ * @param {string} identifier - 处理自动化工具ID。
148
+ * @param {string} jobId - 处理自动化任务ID。
149
+ * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
150
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
151
+ * @returns {Promise} Promise 对象。
152
+ */
153
+ getResults(identifier, jobId, filter, callback) {
154
+ return this._geoprocessingJobsService.getResults(identifier, jobId, filter, callback);
155
+ }
156
+ }
@@ -0,0 +1,53 @@
1
+ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
+ * This program are made available under the terms of the Apache License, Version 2.0
3
+ * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
+ import {ServiceBase} from './ServiceBase';
5
+ import { GetGridCellInfosService } from '@supermapgis/iclient-common/iServer/GetGridCellInfosService';
6
+
7
+ /**
8
+ /**
9
+ * @class GridCellInfosService
10
+ * @category iServer Data Grid
11
+ * @classdesc 数据栅格查询服务。
12
+ * @modulecategory Services
13
+ * @extends {ServiceBase}
14
+ * @example
15
+ * new GridCellInfosService(url)
16
+ * .getGridCellInfos(param,function(result){
17
+ * //doSomething
18
+ * })
19
+ * @param {string} url - 服务地址。请求地图服务,URL 应为:
20
+ * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World。
21
+ * @param {Object} options - 参数。
22
+ * @param {string} [options.proxy] - 服务代理地址。
23
+ * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
24
+ * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
25
+ * @param {Object} [options.headers] - 请求头。
26
+ * @usage
27
+ */
28
+ export class GridCellInfosService extends ServiceBase {
29
+
30
+ constructor(url, options) {
31
+ super(url, options);
32
+ this._gridCellQueryService = new GetGridCellInfosService(this.url, {
33
+ proxy: this.options.proxy,
34
+ withCredentials: this.options.withCredentials,
35
+ crossOrigin: this.options.crossOrigin,
36
+ headers: this.options.headers
37
+ });
38
+ }
39
+
40
+ /**
41
+ * @function GridCellInfosService.prototype.getGridCellInfos
42
+ * @description 获取某一地理位置所对应的栅格单元信息。
43
+ * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
44
+ * @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
45
+ * @returns {Promise} Promise 对象。
46
+ */
47
+ getGridCellInfos(params, callback) {
48
+ if (!params) {
49
+ return null;
50
+ }
51
+ return this._gridCellQueryService.processAsync(params, callback);
52
+ }
53
+ }