forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddressMatchService.js
More file actions
66 lines (61 loc) · 2.18 KB
/
AddressMatchService.js
File metadata and controls
66 lines (61 loc) · 2.18 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
import mapboxgl from 'mapbox-gl';
import '../core/Base';
import {ServiceBase} from './ServiceBase';
import {AddressMatchService as CommonAddressMatchService} from '@supermap/iclient-common';
/**
* @class mapboxgl.supermap.AddressMatchService
* @category iServer AddressMatch
* @classdesc 地址匹配服务
* @example
* new mapboxgl.supermap.AddressMatchService(url,options)
* .code(function(result){
* //doSomething
* })
* @param url - {string} 与客户端交互的服务地址。
* @param options -{Object} 交互时所需可选参数。
* @extends mapboxgl.supermap.ServiceBase
*/
export class AddressMatchService extends ServiceBase {
constructor(url, options) {
super(url, options);
}
/**
* @function mapboxgl.supermap.AddressMatchService.prototype.code
* @description 获取正向地址匹配结果。
* @param params - {Object} 正向匹配参数。
* @param callback - {function} 请求结果的回调函数。
*/
code(params, callback) {
var me = this;
var addressMatchService = new CommonAddressMatchService(me.url, {
proxy: me.options.proxy,
serverType: me.options.serverType,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
addressMatchService.code(me.url + '/geocoding', params);
}
/**
* @function mapboxgl.supermap.AddressMatchService.prototype.decode
* @description 获取反向地址匹配结果。
* @param params -{Object} 反向匹配参数。
* @param callback -{function}请求结果的回调函数。
*/
decode(params, callback) {
var me = this;
var addressMatchService = new CommonAddressMatchService(me.url, {
proxy: me.options.proxy,
serverType: me.options.serverType,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
addressMatchService.decode(me.url + '/geodecoding', params);
}
}
mapboxgl.supermap.AddressMatchService = AddressMatchService;