Class: LayerInfoService

LayerInfoService

图层信息类。支持获取图层信息、创建新的临时图层、修改现有的临时图层、传递子图层显示控制参数等。

new LayerInfoService(url, options)

Usage
import { LayerInfoService } from '@supermapgis/iclient-leaflet';

new LayerInfoService(url, options);
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.LayerInfoService({paramsNames});
  // 弃用的写法

  L.supermap.layerInfoService(url, options);
</script>
leaflet/services/LayerInfoService.js, line 8
Name Type Description
url string

地图服务地址,如 http://{ip}:{port}/iserver/services/map-world/rest/maps/World 。

options Object

参数。

Name Type Description
proxy string 可选

服务代理地址。

withCredentials boolean 可选

请求是否携带凭据。默认情况下,仅同源请求包含凭据。

crossOrigin boolean 可选

是否允许跨域请求。

headers Object 可选

请求头。

Example
new LayerInfoService(url).getLayersInfo(function(result){
  //doSomething
})

Extends

LayerInfoService -> ServiceBase -> L.Evented

Events

inherited destroy

leaflet/services/ServiceBase.js, line 58

资源释放成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

inherited initialized

leaflet/services/ServiceBase.js, line 45

构造函数构造成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

Methods

inherited destroy()

leaflet/services/ServiceBase.js, line 53

释放资源,将引用的资源属性置空。

getLayersInfo(callback){Promise}

leaflet/services/LayerInfoService.js, line 34

获取图层信息。

Name Type Description
callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getLayersLegendInfo(callback){Promise}

leaflet/services/LayerInfoService.js, line 44

获取地图的图例信息。

Name Type Description
callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Version:
  • 11.1.1
Returns:
Type Description
Promise Promise 对象。

setLayerInfo(params, callback){Promise}

leaflet/services/LayerInfoService.js, line 55

设置图层信息服务。可以实现临时图层中子图层的修改。

Name Type Description
params SetLayerInfoParameters

设置图层信息参数类。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

setLayersInfo(params, callback){Promise}

leaflet/services/LayerInfoService.js, line 67

设置图层信息。可以实现创建新的临时图层和修改现有的临时图层。

Name Type Description
params SetLayersInfoParameters

设置图层信息参数类。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

setLayerStatus(params, callback){Promise}

leaflet/services/LayerInfoService.js, line 79

负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。

Name Type Description
params SetLayerStatusParameters

子图层显示控制参数类。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。