Class: OGCMap

ol/source/OGCMap~OGCMap


import OGCMap from 'ol/source/OGCMap.js';

提供单个非瓦片图像的 OGC Maps 服务器的数据源。

new OGCMap(options)

Name Type Description
attributions AttributionLike | undefined

归属信息。

crossOrigin null | string | undefined 已加载图像的 crossOrigin 属性。注意如果要使用 Canvas 渲染器访问像素数据,必须提供 crossOrigin 值。详见 https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image。
referrerPolicy ReferrerPolicy | undefined

已加载图像的 referrerPolicy 属性。

hidpi boolean (defaults to true)

从远程服务器请求图像时使用 ol/Map#pixelRatio 值。

imageLoad函数 Load函数 | undefined

给定 URL 加载图像的可选函数。

interpolate boolean (defaults to true)

重采样时是否使用插值。默认情况下, 重采样时使用线性插值。设置为 false 可使用 the nearest neighbor instead.

params 对象。<string, *> | undefined

OGC Maps 请求参数。默认不需要任何参数。widthheightbboxcrsbbox-crs 将动态设置。

projection ProjectionLike | undefined

投影。默认为视图投影。

ratio number (defaults to 1.5)

比率。1 表示图像请求为地图视口的大小,2 表示地图视口宽高的两倍,以此类推。必须为 1 或更高。

resolutions Array.<number> | undefined

分辨率列表。 如果指定,则仅对这些分辨率发起请求。

url string | undefined

OGC Maps 服务 URL。

触发事件:

Extends

Methods

dispatchEvent(event){boolean | undefined} inherited

分发事件并调用所有监听此类型事件的监听器。事件参数可以是一个字符串或一个 具有 type 属性的对象。

Name Type Description
event BaseEvent | string

事件对象。

返回值:
如果有人在事件对象上调用了 preventDefault 或任何监听器返回 false,则返回 false

获取一个值。

Name Type Description
key string

键名。

返回值:
值。

获取数据源的归属函数。

返回值:
Attribution function.

getAttributionsCollapsible(){boolean} inherited

返回值:
归属信息是否可折叠。

getImageLoad函数(){Load函数}

返回image load function of the source.

返回值:
The image load function.

getKeys(){Array.<string>} inherited

获取对象属性名列表。

返回值:
属性名列表。

getParams(){Object}

获取用户提供的参数,即通过"params"选项传递给构造函数的参数,可能已通过 updateParams 方法更新。

返回值:
参数。

getProjection(){Projection | null} inherited

获取数据源的投影。

返回值:
投影。

getProperties(){NoInfer.<Properties>} inherited

获取包含所有属性名和值的对象。

返回值:
对象。

getRevision(){number} inherited

获取此对象的版本号。 每次对象被修改时,其版本号将递增。

返回值:
版本号。

获取数据源的状态,可能的状态参见 State。

返回值:
状态。

getUrl(){string | undefined}

返回URL used for this OGC Maps source.

返回值:
URL.

on(type, listener){EventsKey | Array<EventsKey>} inherited

监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

once(type, listener){EventsKey | Array<EventsKey>} inherited

仅监听一次特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

刷新数据源。数据源将被清除,并从服务器重新加载数据。

set(key, value, silent) inherited

设置一个值。

Name Type Description
key string

键名。

value *

值。

silent boolean | undefined

更新但不触发事件。

setAttributions(attributions) inherited

设置数据源的归属信息。

Name Type Description
attributions AttributionLike | undefined

归属信息。可以作为字符串、Array<string>、Attribution 或 undefined 传入。

setImageLoad函数(imageLoad函数)

设置image load function of the source.

Name Type Description
imageLoad函数 Load函数

图像加载函数。

setParams(params)

设置用户提供的参数。

Name Type Description
params Object

参数。

setProperties(values, silent) inherited

设置一组键值对。 注意,这会更改任何现有属性并添加新属性(不会移除任何现有属性)。

Name Type Description
values Partial.<NoInfer.<Properties>>

值。

silent boolean | undefined

更新但不触发事件。

setUrl(url)

设置用于请求的 URL。

Name Type Description
url string | undefined

URL.

un(type, listener) inherited

取消监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

unset(key, silent) inherited

取消设置一个属性。

Name Type Description
key string

键名。

silent boolean | undefined

取消设置但不触发事件。

updateParams(params)

更新用户提供的参数。

Name Type Description
params Object

参数。