Skip to content

Class: Tile

这里是一个内部的瓦片实现,他主要是为了统各地图类库的瓦片相关操作 我们常规需要的是在某个地图类库下某个瓦片的 xyz 以及其对应投影下 的瓦片范围(常规情况使用世界坐标,部分类库可能直接使用像素位置并且在每一帧更新), 并且在此我们需要维护瓦片的状态。

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Tile(tileID, options?): Tile

Parameters

NameType
tileIDTileID
optionsTileOptions

Returns

Tile

Defined in

gl-core/src/tile/Tile.ts:83

Properties

aborted

aborted: boolean

瓦片 是否取消请求

Defined in

gl-core/src/tile/Tile.ts:24


reloadCallback

reloadCallback: any

瓦片重加载回调

Defined in

gl-core/src/tile/Tile.ts:29


actor

actor: any

worker 执行器

Defined in

gl-core/src/tile/Tile.ts:34


tileID

tileID: TileID

瓦片 ID

Defined in

gl-core/src/tile/Tile.ts:39


state

state: TileState

瓦片数据加载状态

Defined in

gl-core/src/tile/Tile.ts:44


errorCount

errorCount: number = 0

瓦片加载失败的次数

Defined in

gl-core/src/tile/Tile.ts:49


maxErrorCount

maxErrorCount: number = 3

允许的瓦片最大失败次数

Defined in

gl-core/src/tile/Tile.ts:54


tileBounds

tileBounds: ProjTileBounds

瓦片的世界范围

Defined in

gl-core/src/tile/Tile.ts:59


tileSize

tileSize: number

瓦片尺寸

Defined in

gl-core/src/tile/Tile.ts:64


uses

uses: number = 0

瓦片使用次数(在多个 render 共享 source 时,瓦片只能在为被任何渲染器使用时才能被销毁)

Defined in

gl-core/src/tile/Tile.ts:69


tileMeshs

tileMeshs: Map<string, default>

Defined in

gl-core/src/tile/Tile.ts:71


geometries

geometries: Map<string, Geometry>

Defined in

gl-core/src/tile/Tile.ts:73


request

request: Map<string, any>

Defined in

gl-core/src/tile/Tile.ts:75

Accessors

textures

get textures(): Map<number, Texture<TextureOptions>>

Returns

Map<number, Texture<TextureOptions>>

Defined in

gl-core/src/tile/Tile.ts:118


tileCenter

get tileCenter(): number[]

Returns

number[]

Defined in

gl-core/src/tile/Tile.ts:122

Methods

hasData

hasData(): boolean

瓦片是否已经加载到数据

Returns

boolean

Defined in

gl-core/src/tile/Tile.ts:96


wasRequested

wasRequested(): boolean

瓦片是否已经请求过

Returns

boolean

Defined in

gl-core/src/tile/Tile.ts:103


isLoaded

isLoaded(): boolean

瓦片是否加载完成

Returns

boolean

Defined in

gl-core/src/tile/Tile.ts:110


getMesh

getMesh(passId): undefined | default

Parameters

NameType
passIdany

Returns

undefined | default

Defined in

gl-core/src/tile/Tile.ts:114


updateGeometry

updateGeometry(passId, bbox, renderer, force?): undefined | Geometry

更新瓦片顶点信息

Parameters

NameType
passIdstring
bboxProjTileBounds
rendererRenderer
force?boolean

Returns

undefined | Geometry

Defined in

gl-core/src/tile/Tile.ts:133


createMesh

createMesh(passId, bbox, renderer, program, force?): undefined | default

创建 TileMesh

Parameters

NameTypeDescription
passIdstring在多个 render pass 共享 tile 时我们可能需要针对多个 pass 创建渲染资源 在 mapbox 这种共享 gl 上下文的一般我们不需要重建,但是对于 maptalks 这种每个图层一个 gl 上下文的我们需要针对每个 gl上下文绑定资源
bboxProjTileBounds
rendererRenderer
programProgram
force?boolean

Returns

undefined | default

Defined in

gl-core/src/tile/Tile.ts:193


setTextures

setTextures(renderer, index, image, parseOptions, userData?): void

创建纹理

Parameters

NameType
rendererRenderer
indexnumber
imageany
parseOptionsParseOptionsType
userData?any

Returns

void

Defined in

gl-core/src/tile/Tile.ts:214


getBounds

getBounds(): ProjTileBounds

获取瓦片世界坐标系下的范围

Returns

ProjTileBounds

Defined in

gl-core/src/tile/Tile.ts:270


copy

copy(tile): Tile

Parameters

NameType
tileTile

Returns

Tile

Defined in

gl-core/src/tile/Tile.ts:274


destroy

destroy(): void

释放瓦片资源

Returns

void

Defined in

gl-core/src/tile/Tile.ts:286

Released under the MIT License.