forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageService.js
More file actions
102 lines (97 loc) · 3.99 KB
/
ImageService.js
File metadata and controls
102 lines (97 loc) · 3.99 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
/* Copyright© 2000 - 2021 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 { ServiceBase } from './ServiceBase';
import '../core/Base';
import { ImageService as CommonMatchImageService } from '@supermap/iclient-common';
/**
* @class L.supermap.ImageService
* @version 10.2.0
* @constructs L.supermap.ImageService
* @classdesc 影像服务类
* @category iServer Image
* @extends {L.supermap.ServiceBase}
* @example
* L.supermap.ImageService(url,options)
* .getCollections(function(result){
* //doSomething
* })
* @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
* @param {Object} options - 参数。
* @param {string} [options.proxy] - 服务代理地址。
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
* @param {Object} [options.headers] - 请求头。
*/
export var ImageService = ServiceBase.extend({
initialize: function (url, options) {
ServiceBase.prototype.initialize.call(this, url, options);
},
/**
* @function L.supermap.ImageService.prototype.getCollections
* @description 返回当前影像服务中的影像集合列表(Collections)。
* @param {RequestCallback} callback - 请求结果的回调函数。
*/
getCollections: function (callback) {
var me = this;
var ImageService = new CommonMatchImageService(this.url, {
proxy: me.options.proxy,
withCredentials: me.options.withCredentials,
crossOrigin: me.options.crossOrigin,
headers: me.options.headers,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
ImageService.getCollections();
},
/**
* @function L.supermap.ImageService.prototype.getCollectionByID
* @description ID值等于`collectionId`参数值的影像集合(Collection)。 ID值用于在服务中唯一标识该影像集合。
* @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
* @param {RequestCallback} callback - 请求结果的回调函数。
*/
getCollectionByID: function (collectionId, callback) {
var me = this;
var ImageService = new CommonMatchImageService(me.url, {
proxy: me.options.proxy,
withCredentials: me.options.withCredentials,
crossOrigin: me.options.crossOrigin,
headers: me.options.headers,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
ImageService.getCollectionByID(collectionId);
},
/**
* @function L.supermap.ImageService.prototype.search
* @description 查询与过滤条件匹配的影像数据。
* @param {SuperMap.ImageSearchParameter} [itemSearch] 查询参数
* @param {RequestCallback} callback - 请求结果的回调函数。
*/
search: function (itemSearch, callback) {
var me = this;
var ImageService = new CommonMatchImageService(me.url, {
proxy: me.options.proxy,
withCredentials: me.options.withCredentials,
crossOrigin: me.options.crossOrigin,
headers: me.options.headers,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
ImageService.search(itemSearch);
}
});
export var imageService = function (url, options) {
return new ImageService(url, options);
};
L.supermap.imageService = imageService;