import BaseServer from '../BaseServer'
import { Zondy } from '../../base'
/**
* 地形缓存服务,基地址:/igs/rest/services/{folder}/{serviceName}/TerrainServer
* @class TerrainServer
* @moduleEx ServiceModule
* @extends BaseServer
* @param {Object} options 构造参数
* @param {String} [options.url = 无] 服务基地址
* @example
* //初始化TerrainServer服务对象
* // ES5引入方式
* const { TerrainServer } = Zondy.Service
* // ES6引入方式
* import { TerrainServer } from "@mapgis/webclient-common"
* terrainServer = new TerrainServer({
* //服务基地址
* url: 'http://localhost:8089/igs/rest/services/tdt_dem_clip2/TerrainServer'
* })
*/
class TerrainServer extends BaseServer {
constructor(options) {
super(options)
}
/**
* @function TerrainServer.prototype.getLayerJSON
* @description 获取地形缓存layer.json,后端接口:/igs/rest/services/{serviceName}/TerrainServer/layer.json
* @param options 查询参数
* @param {Function} [options.success = 无] 查询成功回调函数,若使用Promise方式则不必填写
* @param {Function} [options.failure = 无] 查询失败回调函数,若使用Promise方式则不必填写
* @return {Promise<Object>}
* @example
* //回调方式
* terrainServer.getLayerJSON({
* success: function (result) {
* console.log('请求成功:', result)
* }
* })
* //promise方式
* terrainServer.getLayerJSON({
* }).then(function (result) {
* console.log('请求成功:', result);
* }).catch(function (result) {
* console.log('请求失败:', result);
* });
*/
getLayerJSON(options) {
// 设置PATH PARAMETERS校验
const checkPathOpts = {}
// 设置QUERY PARAMETERS校验
const checkQueryOpts = {}
// 调用基类的查询信息方法
return this._queryByParameters(
options,
checkPathOpts,
checkQueryOpts,
// 拼装返回基地址
function (url) {
return `${url}/layer.json`
}
)
}
}
Zondy.Service.TerrainServer = TerrainServer
export default TerrainServer