forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessingService.js
More file actions
465 lines (426 loc) · 19.7 KB
/
ProcessingService.js
File metadata and controls
465 lines (426 loc) · 19.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
/* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
* This program are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
import L from 'leaflet';
import '../core/Base';
import { ServiceBase } from './ServiceBase';
import { CommontypesConversion } from '../core/CommontypesConversion';
import { ProcessingService as CommonProcessingService } from '@supermap/iclient-common/iServer/ProcessingService';
/**
* @class ProcessingService
* @deprecatedclassinstance L.supermap.processingService
* @classdesc 分布式分析服务类。
* @category iServer ProcessingService
* @modulecategory Services
* @extends ServiceBase
* @example
* new ProcessingService(url)
* .getKernelDensityJobs(function(result){
* //doSomething
* })
* @param {string} url - 服务地址。
* @param {Object} options - 参数。
* @param {string} [options.proxy] - 服务代理地址。
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
* @param {Object} [options.headers] - 请求头。
* @usage
*/
export var ProcessingService = ServiceBase.extend({
initialize: function(url, options) {
options = options || {};
L.setOptions(this, options);
ServiceBase.prototype.initialize.call(this, url, options);
this.kernelDensityJobs = {};
this.summaryMeshJobs = {};
this.queryJobs = {};
this.summaryRegionJobs = {};
this.vectorClipJobs = {};
this.overlayGeoJobs = {};
this.buffersJobs = {};
this.topologyValidatorJobs = {};
this.summaryAttributesJobs = {};
this._processingService = new CommonProcessingService(url, options);
},
/**
* @function ProcessingService.prototype.getKernelDensityJobs
* @description 获取密度分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getKernelDensityJobs: function(callback, resultFormat) {
this._processingService.getKernelDensityJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getKernelDensityJob
* @description 获取指定 ID 的密度分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getKernelDensityJob: function(id, callback, resultFormat) {
this._processingService.getKernelDensityJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addKernelDensityJob
* @description 新建密度分析。
* @param {KernelDensityJobParameter} params - 密度分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addKernelDensityJob: function(params, callback, seconds, resultFormat) {
let processParams = this._processParams(params);
this._processingService.addKernelDensityJob(processParams, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getKernelDensityJobState
* @description 获取密度分析的状态。
* @param {string} id - 密度分析 ID。
* @returns {Object} 密度分析的状态。
*/
getKernelDensityJobState: function(id) {
return this._processingService.getKernelDensityJobState(id);
},
/**
* @function ProcessingService.prototype.getSummaryMeshJobs
* @description 获取点聚合分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryMeshJobs: function(callback, resultFormat) {
this._processingService.getSummaryMeshJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryMeshJob
* @description 获取指定 ID 的点聚合分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryMeshJob: function(id, callback, resultFormat) {
this._processingService.getSummaryMeshJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addSummaryMeshJob
* @description 新建点聚合分析。
* @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addSummaryMeshJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addSummaryMeshJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryMeshJobState
* @description 获取点聚合分析的状态。
* @param {string} id - 点聚合分析的 ID。
* @returns {Object} 点聚合分析的状态。
*/
getSummaryMeshJobState: function(id) {
return this._processingService.getSummaryMeshJobState(id);
},
/**
* @function ProcessingService.prototype.getQueryJobs
* @description 获取单对象查询分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getQueryJobs: function(callback, resultFormat) {
this._processingService.getQueryJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getQueryJob
* @description 获取指定 ID 的单对象查询分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getQueryJob: function(id, callback, resultFormat) {
this._processingService.getQueryJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addQueryJob
* @description 新建单对象查询分析。
* @param {SingleObjectQueryJobsParameter} params - 单对象空间查询分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addQueryJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addQueryJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getQueryJobState
* @description 获取单对象查询分析的状态。
* @param {string} id - 单对象查询分析的 ID。
* @returns {Object} 单对象查询分析的状态。
*/
getQueryJobState: function(id) {
return this._processingService.getQueryJobState(id);
},
/**
* @function ProcessingService.prototype.getSummaryRegionJobs
* @description 获取区域汇总分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryRegionJobs: function(callback, resultFormat) {
this._processingService.getSummaryRegionJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryRegionJob
* @description 获取指定 ID 的区域汇总分析。
* @param {string} id - 区域汇总分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryRegionJob: function(id, callback, resultFormat) {
this._processingService.getSummaryRegionJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addSummaryRegionJob
* @description 新建区域汇总分析。
* @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addSummaryRegionJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addSummaryRegionJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryRegionJobState
* @description 获取区域汇总分析的状态。
* @param {string} id - 区域汇总分析的 ID。
* @returns {Object} 区域汇总分析的状态。
*/
getSummaryRegionJobState: function(id) {
return this._processingService.getSummaryRegionJobState(id);
},
/**
* @function ProcessingService.prototype.getVectorClipJobs
* @description 获取矢量裁剪分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getVectorClipJobs: function(callback, resultFormat) {
this._processingService.getVectorClipJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getVectorClipJob
* @description 获取指定 ID 的矢量裁剪分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getVectorClipJob: function(id, callback, resultFormat) {
this._processingService.getVectorClipJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addVectorClipJob
* @description 新建矢量裁剪分析。
* @param {VectorClipJobsParameter} params - 矢量裁剪分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addVectorClipJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addVectorClipJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getVectorClipJobState
* @description 获取矢量裁剪分析的状态。
* @param {string} id - 矢量裁剪分析的 ID。
* @returns {Object} 矢量裁剪分析的状态。
*/
getVectorClipJobState: function(id) {
return this._processingService.getVectorClipJobState(id);
},
/**
* @function ProcessingService.prototype.getOverlayGeoJobs
* @description 获取叠加分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getOverlayGeoJobs: function(callback, resultFormat) {
this._processingService.getOverlayGeoJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getOverlayGeoJob
* @description 获取指定 ID 的叠加分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getOverlayGeoJob: function(id, callback, resultFormat) {
this._processingService.getOverlayGeoJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addOverlayGeoJob
* @description 新建叠加分析。
* @param {OverlayGeoJobParameter} params - 叠加分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addOverlayGeoJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addOverlayGeoJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getoverlayGeoJobState
* @description 获取叠加分析的状态。
* @param {string} id - 叠加分析的 ID。
* @returns {Object} 叠加分析的状态。
*/
getoverlayGeoJobState: function(id) {
return this._processingService.getoverlayGeoJobState(id);
},
/**
* @function ProcessingService.prototype.getBuffersJobs
* @description 获取缓冲区分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getBuffersJobs: function(callback, resultFormat) {
this._processingService.getBuffersJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getBuffersJob
* @description 获取指定 ID 的缓冲区分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getBuffersJob: function(id, callback, resultFormat) {
this._processingService.getBuffersJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addBuffersJob
* @description 新建缓冲区分析。
* @param {BuffersAnalystJobsParameter} params - 缓冲区分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addBuffersJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addBuffersJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getBuffersJobState
* @description 获取缓冲区分析的状态。
* @param {string} id - 缓冲区分析的 ID。
* @returns {Object} 缓冲区分析的状态
*/
getBuffersJobState: function(id) {
return this._processingService.getBuffersJobState(id);
},
/**
* @function ProcessingService.prototype.getTopologyValidatorJobs
* @description 获取拓扑检查分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getTopologyValidatorJobs: function(callback, resultFormat) {
this._processingService.getTopologyValidatorJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getTopologyValidatorJob
* @description 获取指定 ID 的拓扑检查分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getTopologyValidatorJob: function(id, callback, resultFormat) {
this._processingService.getTopologyValidatorJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addTopologyValidatorJob
* @description 新建拓扑检查分析。
* @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addTopologyValidatorJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addTopologyValidatorJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getTopologyValidatorJobState
* @description 获取拓扑检查分析的状态。
* @param {string} id - 拓扑检查分析的 ID。
* @returns {Object} 拓扑检查分析的状态。
*/
getTopologyValidatorJobState: function(id) {
return this._processingService.getTopologyValidatorJobState(id);
},
/**
* @function ProcessingService.prototype.getSummaryAttributesJobs
* @description 获取属性汇总分析的列表。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryAttributesJobs: function(callback, resultFormat) {
this._processingService.getSummaryAttributesJobs(callback, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryAttributesJob
* @description 获取指定 ID 的属性汇总分析。
* @param {string} id - 空间分析的 ID。
* @param {RequestCallback} callback - 回调函数。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
getSummaryAttributesJob: function(id, callback, resultFormat) {
this._processingService.getSummaryAttributesJob(id, callback, resultFormat);
},
/**
* @function ProcessingService.prototype.addSummaryAttributesJob
* @description 新建属性汇总分析。
* @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
* @param {RequestCallback} callback - 回调函数。
* @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
*/
addSummaryAttributesJob: function(params, callback, seconds, resultFormat) {
params = this._processParams(params);
this._processingService.addSummaryAttributesJob(params, callback, seconds, resultFormat);
},
/**
* @function ProcessingService.prototype.getSummaryAttributesJobState
* @description 获取属性汇总分析的状态。
* @param {string} id - 属性汇总分析的 ID。
* @returns {Object} 属性汇总分析的状态。
*/
getSummaryAttributesJobState: function(id) {
return this._processingService.getSummaryAttributesJobState(id);
},
_processParams: function(params) {
if (!params) {
return {};
}
if (params.bounds) {
params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
}
if (params.query) {
params.query = CommontypesConversion.toSuperMapBounds(params.query);
}
if (params.geometryQuery) {
params.geometryQuery = CommontypesConversion.toProcessingParam(params.geometryQuery);
}
if (params.geometryClip) {
params.geometryClip = CommontypesConversion.toProcessingParam(params.geometryClip);
}
return params;
}
});
export var processingService = function(url, options) {
return new ProcessingService(url, options);
};