Class: TileDebug

ol/source/TileDebug~TileDebug


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

伪瓦片数据源,不从服务器获取瓦片,而是渲染瓦片网格/投影的网格轮廓以及每个瓦片的坐标。参见 examples/canvas-tiles 示例。

new TileDebug(options)

Name Type Description
projection ProjectionLike (defaults to 'EPSG:3857')

可选投影。

tileGrid TileGrid | undefined

瓦片网格。

wrapX boolean (defaults to true)

是否水平环绕世界。

zDirection number | NearestDirection函数 (defaults to 0)

使用默认配置调试 VectorTile 数据源时设置为 1。选择在整数缩放级别之间使用更高还是更低缩放级别的瓦片。参见 getZForResolution

source TileSource | undefined

瓦片数据源。这允许从另一个数据源复制 projectiontileGridwrapXzDirection。如果同时指定了 source 和单独的选项,单独的选项将优先。

template string (defaults to 'z:{z} x:{x} y:{y}')

瓦片标注模板。应包含 {x}{y}{-y},以及 {z} 占位符。

color string (defaults to 'grey')

用于填充文本和描边每个瓦片网格线的 CSS 颜色。

触发事件:

Extends

Methods

增加修订计数器并分发 'change' 事件。

移除数据源中所有缓存的重投影瓦片。下一个渲染周期将创建新的瓦片。

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

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

getKeys(){Array.<string>} inherited

获取对象属性名列表。

返回值:
属性名列表。

getProjection(){Projection | null} inherited

获取数据源的投影。

返回值:
投影。

getProperties(){NoInfer.<Properties>} inherited

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

返回值:
对象。

getRevision(){number} inherited

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

返回值:
版本号。

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

返回值:
状态。

getTileGrid(){TileGrid | null} inherited

返回瓦片数据源的瓦片网格。

返回值:
瓦片网格。

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 传入。

setProperties(values, silent) inherited

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

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

值。

silent boolean | undefined

更新但不触发事件。

setTileGridForProjection(projection, tilegrid) inherited

设置在将瓦片重投影到给定投影时使用的瓦片网格, 而不是默认的瓦片网格rojection.

当无法创建默认瓦片网格(例如投影未定义范围)或出于优化原因(自定义瓦片尺寸、分辨率等)时,这可能很有用。

Name Type Description
projection ProjectionLike

投影。

tilegrid TileGrid

用于投影的瓦片网格。

Name Type Description
url UrlLike

新 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

取消设置但不触发事件。