-
Notifications
You must be signed in to change notification settings - Fork 288
Expand file tree
/
Copy pathChartService.js
More file actions
146 lines (135 loc) · 6.37 KB
/
ChartService.js
File metadata and controls
146 lines (135 loc) · 6.37 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
/* Copyright© 2000 - 2025 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 { DataFormat } from '@supermapgis/iclient-common/REST';
import { ServiceBase } from './ServiceBase';
import { CommontypesConversion } from '../core/CommontypesConversion';
import { ChartService as CommonChartService } from '@supermapgis/iclient-common/iServer/ChartService';
/**
* @class ChartService
* @deprecatedclassinstance L.supermap.chartService
* @classdesc 海图服务类。海图是一种以海洋水域及沿岸地物为主要绘制对象的地图,为航海的安全性提供必备的数据基础。<br>
* 此类提供方法:获取海图物标信息、查询海图服务。海图物标信息指的是描述各产品规范的物标的基本信息,包括物标的名称、类型及与该物标相关的属性等。
* @category iServer Map Chart
* @modulecategory Services
* @extends {ServiceBase}
* @example
* new ChartService(url,{
* fieldNameFormatter: function(fieldName){
* return fieldName + 'test'
* }
* }).queryChart(param,function(result){
* //doSomething
* })
* @param {string} url - 服务地址。
* @param {string} [dataUrl] - 数据服务地址。
* @param {Object} options - 参数。
* @param {string} [options.proxy] - 服务代理地址。
* @param {boolean} [options.withCredentials] - 请求是否携带凭据。默认情况下,仅同源请求包含凭据。
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
* @param {Object} [options.headers] - 请求头。
* @param {function} [options.fieldNameFormatter] - 对查询返回结果的字段名进行自定义。
* @usage
*/
export var ChartService = ServiceBase.extend({
initialize: function (url, dataUrl, options) {
ServiceBase.prototype.initialize.call(this, url, dataUrl, options);
this._chartServiceBase = new CommonChartService(url, dataUrl,options);
},
/**
* @function ChartService.prototype.queryChart
* @description 查询海图服务。
* @param {ChartQueryParameters} params - 海图查询参数类。
* @param {RequestCallback} [callback] - 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
* @returns {Promise} Promise 对象。
*/
queryChart: function (params, callback, resultFormat) {
params = this._processParams(params);
return this._chartServiceBase.queryChart(params, callback, resultFormat);
},
/**
* @function ChartService.prototype.getChartFeatureInfo
* @description 获取海图物标信息。
* @param {RequestCallback} [callback] - 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getChartFeatureInfo: function (callback) {
return this._chartServiceBase.getChartFeatureInfo(callback);
},
/**
* @function ChartService.prototype.getChartAcronymClassify
* @version 11.2.0
* @description 获取海图产品规范物标分组信息服务。
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getChartAcronymClassify(callback) {
return this._chartServiceBase.getChartAcronymClassify(callback);
},
/**
* @function ChartService.prototype.getChartWaterDepth
* @version 12.1.0
* @description 获取海图水深信息。
* @param {ChartWaterDepthParameter} params - 海图水深查询所需参数类。
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getChartWaterDepth(params, callback) {
return this._chartServiceBase.getChartWaterDepth(params, callback);
},
/**
* @function ChartService.prototype.getWaterLevel
* @version 12.1.0
* @description 获取S104海图水位和时间信息。
* @param {ChartWaterLevelParameter} params - S104海图水位和时间查询所需参数类。
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getWaterLevel(params, callback) {
params = this._processParams(params);
return this._chartServiceBase.getWaterLevel(params, callback);
},
/**
* @function ChartService.prototype.getWLTimeRange
* @version 12.1.0
* @description 获取S104海图时间范围。
* @param {ChartWLTimeRangeParameter} params - S104海图时间范围查询所需参数类。
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getWLTimeRange(params, callback) {
params = this._processParams(params);
return this._chartServiceBase.getWLTimeRange(params, callback);
},
/**
* @function ChartService.prototype.getChartMaritimePcInfo
* @description 展示海图S100图示目录支持的版本和其参数信息。
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
* @returns {Promise} Promise 对象。
*/
getChartMaritimePcInfo(callback) {
return this._chartServiceBase.getChartMaritimePcInfo(callback);
},
_processParams: function (params) {
if (!params) {
return {};
}
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
if (params.chartQueryFilterParameters && !L.Util.isArray(params.chartQueryFilterParameters)) {
params.chartQueryFilterParameters = [params.chartQueryFilterParameters];
}
if (params.bounds) {
params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
}
return params;
},
_processFormat: function (resultFormat) {
return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
}
});
export var chartService = function (url, options) {
return new ChartService(url, options);
};