@developmentseed/deck.gl-raster 0.6.0-alpha.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gpu-modules/color/black-is-zero.d.ts +3 -2
- package/dist/gpu-modules/color/black-is-zero.d.ts.map +1 -1
- package/dist/gpu-modules/color/black-is-zero.js +3 -2
- package/dist/gpu-modules/color/black-is-zero.js.map +1 -1
- package/dist/gpu-modules/color/cielab.d.ts +3 -2
- package/dist/gpu-modules/color/cielab.d.ts.map +1 -1
- package/dist/gpu-modules/color/cielab.js +3 -2
- package/dist/gpu-modules/color/cielab.js.map +1 -1
- package/dist/gpu-modules/color/cmyk.d.ts +3 -2
- package/dist/gpu-modules/color/cmyk.d.ts.map +1 -1
- package/dist/gpu-modules/color/cmyk.js +3 -2
- package/dist/gpu-modules/color/cmyk.js.map +1 -1
- package/dist/gpu-modules/color/index.d.ts +5 -5
- package/dist/gpu-modules/color/index.d.ts.map +1 -1
- package/dist/gpu-modules/color/index.js +5 -5
- package/dist/gpu-modules/color/index.js.map +1 -1
- package/dist/gpu-modules/color/white-is-zero.d.ts +3 -2
- package/dist/gpu-modules/color/white-is-zero.d.ts.map +1 -1
- package/dist/gpu-modules/color/white-is-zero.js +3 -2
- package/dist/gpu-modules/color/white-is-zero.js.map +1 -1
- package/dist/gpu-modules/color/ycbcr.d.ts +4 -2
- package/dist/gpu-modules/color/ycbcr.d.ts.map +1 -1
- package/dist/gpu-modules/color/ycbcr.js +4 -2
- package/dist/gpu-modules/color/ycbcr.js.map +1 -1
- package/dist/gpu-modules/colormap.d.ts +3 -1
- package/dist/gpu-modules/colormap.d.ts.map +1 -1
- package/dist/gpu-modules/colormap.js +4 -1
- package/dist/gpu-modules/colormap.js.map +1 -1
- package/dist/gpu-modules/create-texture.d.ts +5 -2
- package/dist/gpu-modules/create-texture.d.ts.map +1 -1
- package/dist/gpu-modules/create-texture.js +3 -2
- package/dist/gpu-modules/create-texture.js.map +1 -1
- package/dist/gpu-modules/cutline-bbox.d.ts +2 -1
- package/dist/gpu-modules/cutline-bbox.d.ts.map +1 -1
- package/dist/gpu-modules/cutline-bbox.js.map +1 -1
- package/dist/gpu-modules/filter-nodata.d.ts +6 -0
- package/dist/gpu-modules/filter-nodata.d.ts.map +1 -1
- package/dist/gpu-modules/filter-nodata.js.map +1 -1
- package/dist/gpu-modules/index.d.ts +5 -5
- package/dist/gpu-modules/index.d.ts.map +1 -1
- package/dist/gpu-modules/index.js +4 -4
- package/dist/gpu-modules/index.js.map +1 -1
- package/dist/gpu-modules/mask-texture.d.ts +8 -2
- package/dist/gpu-modules/mask-texture.d.ts.map +1 -1
- package/dist/gpu-modules/mask-texture.js +6 -5
- package/dist/gpu-modules/mask-texture.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layer-utils.d.ts +1 -1
- package/dist/layer-utils.d.ts.map +1 -1
- package/dist/raster-layer.d.ts +1 -1
- package/dist/raster-layer.d.ts.map +1 -1
- package/dist/raster-layer.js +1 -1
- package/dist/raster-layer.js.map +1 -1
- package/dist/raster-tile-layer/constants.d.ts +11 -0
- package/dist/raster-tile-layer/constants.d.ts.map +1 -0
- package/dist/raster-tile-layer/constants.js +11 -0
- package/dist/raster-tile-layer/constants.js.map +1 -0
- package/dist/raster-tile-layer/index.d.ts +2 -0
- package/dist/raster-tile-layer/index.d.ts.map +1 -0
- package/dist/raster-tile-layer/index.js +2 -0
- package/dist/raster-tile-layer/index.js.map +1 -0
- package/dist/raster-tile-layer/raster-tile-layer.d.ts +157 -0
- package/dist/raster-tile-layer/raster-tile-layer.d.ts.map +1 -0
- package/dist/raster-tile-layer/raster-tile-layer.js +175 -0
- package/dist/raster-tile-layer/raster-tile-layer.js.map +1 -0
- package/dist/raster-tileset/affine-tileset-level.d.ts +56 -0
- package/dist/raster-tileset/affine-tileset-level.d.ts.map +1 -0
- package/dist/raster-tileset/affine-tileset-level.js +101 -0
- package/dist/raster-tileset/affine-tileset-level.js.map +1 -0
- package/dist/raster-tileset/affine-tileset.d.ts +34 -0
- package/dist/raster-tileset/affine-tileset.d.ts.map +1 -0
- package/dist/raster-tileset/affine-tileset.js +26 -0
- package/dist/raster-tileset/affine-tileset.js.map +1 -0
- package/dist/raster-tileset/index.d.ts +4 -0
- package/dist/raster-tileset/index.d.ts.map +1 -1
- package/dist/raster-tileset/index.js +2 -0
- package/dist/raster-tileset/index.js.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.d.ts +22 -0
- package/dist/raster-tileset/raster-tile-traversal.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.js +76 -15
- package/dist/raster-tileset/raster-tile-traversal.js.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.d.ts +14 -6
- package/dist/raster-tileset/raster-tileset-2d.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.js +20 -7
- package/dist/raster-tileset/raster-tileset-2d.js.map +1 -1
- package/dist/raster-tileset/tile-matrix-set.d.ts +7 -3
- package/dist/raster-tileset/tile-matrix-set.d.ts.map +1 -1
- package/dist/raster-tileset/tile-matrix-set.js +20 -2
- package/dist/raster-tileset/tile-matrix-set.js.map +1 -1
- package/dist/raster-tileset/tileset-interface.d.ts +28 -0
- package/dist/raster-tileset/tileset-interface.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Size of deck.gl's common coordinate space in world units.
|
|
2
|
+
*
|
|
3
|
+
* At zoom 0, one tile covers the whole world (512×512 units); at zoom z, each
|
|
4
|
+
* tile is 512/2^z units.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TILE_SIZE = 512;
|
|
7
|
+
/** Size of the globe in web mercator meters. */
|
|
8
|
+
export declare const WEB_MERCATOR_METER_CIRCUMFERENCE = 40075016.686;
|
|
9
|
+
/** Scale factor for converting EPSG:3857 meters into deck.gl world units (512×512). */
|
|
10
|
+
export declare const WEB_MERCATOR_TO_WORLD_SCALE: number;
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/raster-tile-layer/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B,gDAAgD;AAChD,eAAO,MAAM,gCAAgC,eAAe,CAAC;AAE7D,uFAAuF;AACvF,eAAO,MAAM,2BAA2B,QACM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Size of deck.gl's common coordinate space in world units.
|
|
2
|
+
*
|
|
3
|
+
* At zoom 0, one tile covers the whole world (512×512 units); at zoom z, each
|
|
4
|
+
* tile is 512/2^z units.
|
|
5
|
+
*/
|
|
6
|
+
export const TILE_SIZE = 512;
|
|
7
|
+
/** Size of the globe in web mercator meters. */
|
|
8
|
+
export const WEB_MERCATOR_METER_CIRCUMFERENCE = 40075016.686;
|
|
9
|
+
/** Scale factor for converting EPSG:3857 meters into deck.gl world units (512×512). */
|
|
10
|
+
export const WEB_MERCATOR_TO_WORLD_SCALE = TILE_SIZE / WEB_MERCATOR_METER_CIRCUMFERENCE;
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/raster-tile-layer/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAE7B,gDAAgD;AAChD,MAAM,CAAC,MAAM,gCAAgC,GAAG,YAAY,CAAC;AAE7D,uFAAuF;AACvF,MAAM,CAAC,MAAM,2BAA2B,GACtC,SAAS,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/raster-tile-layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/raster-tile-layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,GAEhB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { CompositeLayerProps, DefaultProps, Layer } from "@deck.gl/core";
|
|
2
|
+
import { CompositeLayer } from "@deck.gl/core";
|
|
3
|
+
import type { TileLayerProps, _TileLoadProps as TileLoadProps } from "@deck.gl/geo-layers";
|
|
4
|
+
import type { Device } from "@luma.gl/core";
|
|
5
|
+
import type { RenderTileResult } from "../raster-layer.js";
|
|
6
|
+
import type { TilesetDescriptor } from "../raster-tileset/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Minimum interface returned by `getTileData`.
|
|
9
|
+
*
|
|
10
|
+
* `null` is permitted to describe failed tile loads that do not produce any
|
|
11
|
+
* data, which then do not render any layer.
|
|
12
|
+
*/
|
|
13
|
+
export type MinimalTileData = null | {
|
|
14
|
+
/** Tile height in pixels. */
|
|
15
|
+
height: number;
|
|
16
|
+
/** Tile width in pixels. */
|
|
17
|
+
width: number;
|
|
18
|
+
/**
|
|
19
|
+
* Byte length of the tile data, used by deck.gl's TileLayer for
|
|
20
|
+
* byte-based cache eviction when `maxCacheByteSize` is set. Optional.
|
|
21
|
+
*/
|
|
22
|
+
byteLength?: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Options passed to a user-supplied `getTileData` callback.
|
|
26
|
+
*/
|
|
27
|
+
export type GetTileDataOptions = {
|
|
28
|
+
/**
|
|
29
|
+
* The luma.gl Device. Always populated by the base layer from
|
|
30
|
+
* `this.context.device`.
|
|
31
|
+
*/
|
|
32
|
+
device: Device;
|
|
33
|
+
/**
|
|
34
|
+
* Combined AbortSignal: the layer's `signal` prop composed with the
|
|
35
|
+
* TileLayer's per-tile lifecycle signal. Fires when either aborts.
|
|
36
|
+
*/
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Props for {@link RasterTileLayer}.
|
|
41
|
+
*/
|
|
42
|
+
export type RasterTileLayerProps<DataT extends MinimalTileData = MinimalTileData> = CompositeLayerProps & Pick<TileLayerProps, "tileSize" | "zoomOffset" | "maxZoom" | "minZoom" | "extent" | "debounceTime" | "maxCacheSize" | "maxCacheByteSize" | "maxRequests" | "refinementStrategy"> & {
|
|
43
|
+
/**
|
|
44
|
+
* Tile pyramid + CRS projection descriptor.
|
|
45
|
+
*
|
|
46
|
+
* Subclasses may supply this via state by overriding the protected
|
|
47
|
+
* `_tilesetDescriptor()` method.
|
|
48
|
+
*/
|
|
49
|
+
tilesetDescriptor?: TilesetDescriptor;
|
|
50
|
+
/**
|
|
51
|
+
* Load data for one tile. Runs once per (x, y, z); the resulting `DataT`
|
|
52
|
+
* is cached by the underlying TileLayer.
|
|
53
|
+
*
|
|
54
|
+
* Subclasses may supply this via state by overriding
|
|
55
|
+
* `_getTileDataCallback()`.
|
|
56
|
+
*/
|
|
57
|
+
getTileData?: (tile: TileLoadProps, options: GetTileDataOptions) => Promise<DataT>;
|
|
58
|
+
/**
|
|
59
|
+
* Turn cached tile data into a render result (image and/or shader
|
|
60
|
+
* pipeline). Called on every render; does not re-fetch.
|
|
61
|
+
*
|
|
62
|
+
* To invalidate the inner TileLayer's rendered sub-layers when a
|
|
63
|
+
* dependency changes (e.g. a colormap choice), pass
|
|
64
|
+
* `updateTriggers: { renderTile: [dep1, dep2] }` on the layer props.
|
|
65
|
+
*
|
|
66
|
+
* Subclasses may supply this via state by overriding `_renderTileCallback()`.
|
|
67
|
+
*/
|
|
68
|
+
renderTile?: (data: DataT) => RenderTileResult;
|
|
69
|
+
/**
|
|
70
|
+
* Maximum reprojection error in pixels for mesh refinement.
|
|
71
|
+
* Lower values create denser meshes.
|
|
72
|
+
* @default 0.125
|
|
73
|
+
*/
|
|
74
|
+
maxError?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Show triangulation mesh + tile outlines.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
debug?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Opacity of the debug mesh overlay (0–1).
|
|
82
|
+
* @default 0.5
|
|
83
|
+
*/
|
|
84
|
+
debugOpacity?: number;
|
|
85
|
+
/**
|
|
86
|
+
* AbortSignal applied to every tile fetch, composed with TileLayer's
|
|
87
|
+
* per-tile signal.
|
|
88
|
+
*/
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Base-class prop shape that excludes the overridable fields.
|
|
93
|
+
*
|
|
94
|
+
* The three overridable fields (`tilesetDescriptor`, `getTileData`,
|
|
95
|
+
* `renderTile`) are declared by `ExtraProps` instead — either via the generic
|
|
96
|
+
* default (for direct use) or by a subclass that provides its own signatures
|
|
97
|
+
* (e.g. `COGLayer`'s `getTileData(image, options)`).
|
|
98
|
+
*/
|
|
99
|
+
type RasterTileLayerBaseProps<DataT extends MinimalTileData> = Omit<RasterTileLayerProps<DataT>, "tilesetDescriptor" | "getTileData" | "renderTile">;
|
|
100
|
+
/**
|
|
101
|
+
* Default `ExtraProps` for direct use of `RasterTileLayer`: brings the three
|
|
102
|
+
* overridable fields back in with the generic signatures. Subclasses supply
|
|
103
|
+
* their own `ExtraProps` to override these.
|
|
104
|
+
*/
|
|
105
|
+
type RasterTileLayerDefaultExtraProps<DataT extends MinimalTileData> = Pick<RasterTileLayerProps<DataT>, "tilesetDescriptor" | "getTileData" | "renderTile">;
|
|
106
|
+
/**
|
|
107
|
+
* Base layer that renders a tiled raster source driven by a generic
|
|
108
|
+
* {@link TilesetDescriptor}.
|
|
109
|
+
*
|
|
110
|
+
* Usable directly (provide `tilesetDescriptor`, `getTileData`, and `renderTile`
|
|
111
|
+
* as props) or as a base class (override the protected `_tilesetDescriptor`,
|
|
112
|
+
* `_getTileDataCallback`, `_renderTileCallback` accessors to source them from
|
|
113
|
+
* state).
|
|
114
|
+
*
|
|
115
|
+
* The generic `ExtraProps` parameter lets a subclass redeclare any of the
|
|
116
|
+
* overridable fields with a domain-specific signature (e.g. `COGLayer`'s
|
|
117
|
+
* `getTileData(image, options)`).
|
|
118
|
+
*/
|
|
119
|
+
export declare class RasterTileLayer<DataT extends MinimalTileData = MinimalTileData, ExtraProps extends object = RasterTileLayerDefaultExtraProps<DataT>> extends CompositeLayer<RasterTileLayerBaseProps<DataT> & ExtraProps> {
|
|
120
|
+
static layerName: string;
|
|
121
|
+
static defaultProps: DefaultProps<RasterTileLayerProps<MinimalTileData>>;
|
|
122
|
+
/**
|
|
123
|
+
* The currently effective {@link TilesetDescriptor}.
|
|
124
|
+
*
|
|
125
|
+
* Subclasses override this to return a descriptor built from their own
|
|
126
|
+
* async-parsed state. Returns `undefined` while the source is still
|
|
127
|
+
* loading; `renderLayers()` returns `null` in that case.
|
|
128
|
+
*
|
|
129
|
+
* The inline cast to `RasterTileLayerProps<DataT>` is required because
|
|
130
|
+
* `tilesetDescriptor` is declared on `ExtraProps`, not on the base's
|
|
131
|
+
* `RasterTileLayerBaseProps`. For direct use the default `ExtraProps`
|
|
132
|
+
* brings it in; for subclass use this method is overridden and the cast
|
|
133
|
+
* is never reached.
|
|
134
|
+
*/
|
|
135
|
+
protected _tilesetDescriptor(): TilesetDescriptor | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* The currently effective tile-fetch callback.
|
|
138
|
+
*
|
|
139
|
+
* Subclasses override this to adapt their user-facing `getTileData`
|
|
140
|
+
* signature into the base's `(tile, options) => Promise<DataT>` shape.
|
|
141
|
+
* Returns `undefined` when the callback is not yet available.
|
|
142
|
+
*/
|
|
143
|
+
protected _getTileDataCallback(): RasterTileLayerProps<DataT>["getTileData"];
|
|
144
|
+
/**
|
|
145
|
+
* The currently effective per-tile render callback.
|
|
146
|
+
*
|
|
147
|
+
* Subclasses override this to thread their user-facing `renderTile` and
|
|
148
|
+
* any inferred default. Returns `undefined` when no callback is available.
|
|
149
|
+
*/
|
|
150
|
+
protected _renderTileCallback(): RasterTileLayerProps<DataT>["renderTile"];
|
|
151
|
+
renderLayers(): Layer | null;
|
|
152
|
+
private _renderTileLayer;
|
|
153
|
+
private _wrapGetTileData;
|
|
154
|
+
private _renderSubLayers;
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=raster-tile-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raster-tile-layer.d.ts","sourceRoot":"","sources":["../../src/raster-tile-layer/raster-tile-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,KAAK,EAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,IAAI,aAAa,EAEhC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKpE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG;IACnC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE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AC,wBAAwB,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;IACpE,OAAgB,SAAS,SAAqB;IAC9C,OAAgB,YAAY,sDAAgB;IAE5C;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,kBAAkB,IAAI,iBAAiB,GAAG,SAAS;IAK7D;;;;;;OAMG;IACH,SAAS,CAAC,oBAAoB,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;IAI5E;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC;IAIjE,YAAY,IAAI,KAAK,GAAG,IAAI;IAYrC,OAAO,CAAC,gBAAgB;YAwDV,gBAAgB;IAiB9B,OAAO,CAAC,gBAAgB;CAmFzB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { CompositeLayer } from "@deck.gl/core";
|
|
2
|
+
import { TileLayer } from "@deck.gl/geo-layers";
|
|
3
|
+
import { renderDebugTileOutline } from "../layer-utils.js";
|
|
4
|
+
import { RasterLayer } from "../raster-layer.js";
|
|
5
|
+
import { RasterTileset2D } from "../raster-tileset/index.js";
|
|
6
|
+
import { TILE_SIZE, WEB_MERCATOR_TO_WORLD_SCALE } from "./constants.js";
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
...TileLayer.defaultProps,
|
|
9
|
+
maxError: 0.125,
|
|
10
|
+
debug: false,
|
|
11
|
+
debugOpacity: 0.5,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Base layer that renders a tiled raster source driven by a generic
|
|
15
|
+
* {@link TilesetDescriptor}.
|
|
16
|
+
*
|
|
17
|
+
* Usable directly (provide `tilesetDescriptor`, `getTileData`, and `renderTile`
|
|
18
|
+
* as props) or as a base class (override the protected `_tilesetDescriptor`,
|
|
19
|
+
* `_getTileDataCallback`, `_renderTileCallback` accessors to source them from
|
|
20
|
+
* state).
|
|
21
|
+
*
|
|
22
|
+
* The generic `ExtraProps` parameter lets a subclass redeclare any of the
|
|
23
|
+
* overridable fields with a domain-specific signature (e.g. `COGLayer`'s
|
|
24
|
+
* `getTileData(image, options)`).
|
|
25
|
+
*/
|
|
26
|
+
export class RasterTileLayer extends CompositeLayer {
|
|
27
|
+
static layerName = "RasterTileLayer";
|
|
28
|
+
static defaultProps = defaultProps;
|
|
29
|
+
/**
|
|
30
|
+
* The currently effective {@link TilesetDescriptor}.
|
|
31
|
+
*
|
|
32
|
+
* Subclasses override this to return a descriptor built from their own
|
|
33
|
+
* async-parsed state. Returns `undefined` while the source is still
|
|
34
|
+
* loading; `renderLayers()` returns `null` in that case.
|
|
35
|
+
*
|
|
36
|
+
* The inline cast to `RasterTileLayerProps<DataT>` is required because
|
|
37
|
+
* `tilesetDescriptor` is declared on `ExtraProps`, not on the base's
|
|
38
|
+
* `RasterTileLayerBaseProps`. For direct use the default `ExtraProps`
|
|
39
|
+
* brings it in; for subclass use this method is overridden and the cast
|
|
40
|
+
* is never reached.
|
|
41
|
+
*/
|
|
42
|
+
_tilesetDescriptor() {
|
|
43
|
+
return this.props
|
|
44
|
+
.tilesetDescriptor;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The currently effective tile-fetch callback.
|
|
48
|
+
*
|
|
49
|
+
* Subclasses override this to adapt their user-facing `getTileData`
|
|
50
|
+
* signature into the base's `(tile, options) => Promise<DataT>` shape.
|
|
51
|
+
* Returns `undefined` when the callback is not yet available.
|
|
52
|
+
*/
|
|
53
|
+
_getTileDataCallback() {
|
|
54
|
+
return this.props.getTileData;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The currently effective per-tile render callback.
|
|
58
|
+
*
|
|
59
|
+
* Subclasses override this to thread their user-facing `renderTile` and
|
|
60
|
+
* any inferred default. Returns `undefined` when no callback is available.
|
|
61
|
+
*/
|
|
62
|
+
_renderTileCallback() {
|
|
63
|
+
return this.props.renderTile;
|
|
64
|
+
}
|
|
65
|
+
renderLayers() {
|
|
66
|
+
const descriptor = this._tilesetDescriptor();
|
|
67
|
+
const getTileData = this._getTileDataCallback();
|
|
68
|
+
const renderTile = this._renderTileCallback();
|
|
69
|
+
if (!descriptor || !getTileData || !renderTile) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return this._renderTileLayer(descriptor, getTileData, renderTile);
|
|
73
|
+
}
|
|
74
|
+
_renderTileLayer(descriptor, getTileData, renderTile) {
|
|
75
|
+
class TilesetFactory extends RasterTileset2D {
|
|
76
|
+
constructor(opts) {
|
|
77
|
+
super(opts, descriptor);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const { tileSize, zoomOffset, maxZoom, minZoom, extent, debounceTime, maxCacheSize, maxCacheByteSize, maxRequests, refinementStrategy, updateTriggers, } = this.props;
|
|
81
|
+
return new TileLayer({
|
|
82
|
+
id: `raster-tile-layer-${this.id}`,
|
|
83
|
+
TilesetClass: TilesetFactory,
|
|
84
|
+
getTileData: (tile) => this._wrapGetTileData(tile, getTileData),
|
|
85
|
+
renderSubLayers: (props) => this._renderSubLayers(props, descriptor, renderTile),
|
|
86
|
+
updateTriggers: {
|
|
87
|
+
renderSubLayers: updateTriggers?.renderTile,
|
|
88
|
+
},
|
|
89
|
+
tileSize,
|
|
90
|
+
zoomOffset,
|
|
91
|
+
maxZoom,
|
|
92
|
+
minZoom,
|
|
93
|
+
extent,
|
|
94
|
+
debounceTime,
|
|
95
|
+
maxCacheSize,
|
|
96
|
+
maxCacheByteSize,
|
|
97
|
+
maxRequests,
|
|
98
|
+
refinementStrategy,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async _wrapGetTileData(tile, getTileData) {
|
|
102
|
+
const { signal: tileSignal } = tile;
|
|
103
|
+
const userSignal = this.props.signal;
|
|
104
|
+
const signal = userSignal && tileSignal
|
|
105
|
+
? AbortSignal.any([userSignal, tileSignal])
|
|
106
|
+
: (userSignal ?? tileSignal);
|
|
107
|
+
const options = {
|
|
108
|
+
device: this.context.device,
|
|
109
|
+
signal,
|
|
110
|
+
};
|
|
111
|
+
return getTileData(tile, options);
|
|
112
|
+
}
|
|
113
|
+
_renderSubLayers(props, descriptor, renderTile) {
|
|
114
|
+
const { maxError, debug, debugOpacity } = this.props;
|
|
115
|
+
const tile = props.tile;
|
|
116
|
+
const layers = [];
|
|
117
|
+
if (debug) {
|
|
118
|
+
layers.push(...renderDebugTileOutline(`${this.id}-${tile.id}-bounds`, tile, descriptor.projectTo4326));
|
|
119
|
+
}
|
|
120
|
+
if (!props.data) {
|
|
121
|
+
return layers;
|
|
122
|
+
}
|
|
123
|
+
const { x, y, z } = tile.index;
|
|
124
|
+
const level = descriptor.levels[z];
|
|
125
|
+
if (!level) {
|
|
126
|
+
return layers;
|
|
127
|
+
}
|
|
128
|
+
const { forwardTransform, inverseTransform } = level.tileTransform(x, y);
|
|
129
|
+
const { image, renderPipeline } = renderTile(props.data);
|
|
130
|
+
const { width, height } = props.data;
|
|
131
|
+
const isGlobe = this.context.viewport.resolution !== undefined;
|
|
132
|
+
const reprojectionFns = isGlobe
|
|
133
|
+
? {
|
|
134
|
+
forwardTransform,
|
|
135
|
+
inverseTransform,
|
|
136
|
+
forwardReproject: descriptor.projectTo4326,
|
|
137
|
+
inverseReproject: descriptor.projectFrom4326,
|
|
138
|
+
}
|
|
139
|
+
: {
|
|
140
|
+
forwardTransform,
|
|
141
|
+
inverseTransform,
|
|
142
|
+
forwardReproject: descriptor.projectTo3857,
|
|
143
|
+
inverseReproject: descriptor.projectFrom3857,
|
|
144
|
+
};
|
|
145
|
+
const deckProjectionProps = isGlobe
|
|
146
|
+
? {}
|
|
147
|
+
: {
|
|
148
|
+
coordinateSystem: "cartesian",
|
|
149
|
+
coordinateOrigin: [TILE_SIZE / 2, TILE_SIZE / 2, 0],
|
|
150
|
+
// biome-ignore format: array
|
|
151
|
+
modelMatrix: [
|
|
152
|
+
WEB_MERCATOR_TO_WORLD_SCALE, 0, 0, 0,
|
|
153
|
+
0, WEB_MERCATOR_TO_WORLD_SCALE, 0, 0,
|
|
154
|
+
0, 0, 1, 0,
|
|
155
|
+
0, 0, 0, 1,
|
|
156
|
+
],
|
|
157
|
+
};
|
|
158
|
+
const rasterLayer = new RasterLayer(this.getSubLayerProps({
|
|
159
|
+
id: `${props.id}-raster`,
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
// Passing `image: undefined` explicitly would trip isAsyncPropLoading
|
|
163
|
+
// and cause a transient black flash (see issue #376).
|
|
164
|
+
...(image !== undefined && { image }),
|
|
165
|
+
renderPipeline,
|
|
166
|
+
maxError,
|
|
167
|
+
reprojectionFns,
|
|
168
|
+
debug,
|
|
169
|
+
debugOpacity,
|
|
170
|
+
...deckProjectionProps,
|
|
171
|
+
}));
|
|
172
|
+
return [rasterLayer, ...layers];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=raster-tile-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raster-tile-layer.js","sourceRoot":"","sources":["../../src/raster-tile-layer/raster-tile-layer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAiHxE,MAAM,YAAY,GAAuC;IACvD,GAAG,SAAS,CAAC,YAAY;IACzB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,YAAY,EAAE,GAAG;CAClB,CAAC;AAyBF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAGX,SAAQ,cAA4D;IACpE,MAAM,CAAU,SAAS,G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EAAE,CAAC,CAAC;gBACnD,6BAA6B;gBAC7B,WAAW,EAAE;oBACX,2BAA2B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;oBACpC,CAAC,EAAE,2BAA2B,EAAE,CAAC,EAAE,CAAC;oBACpC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;oBACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;iBACX;aACF,CAAC;QAEN,MAAM,WAAW,GAAG,IAAI,WAAW,CACjC,IAAI,CAAC,gBAAgB,CAAC;YACpB,EAAE,EAAE,GAAG,KAAK,CAAC,EAAE,SAAS;YACxB,KAAK;YACL,MAAM;YACN,sEAAsE;YACtE,sDAAsD;YACtD,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;YACrC,cAAc;YACd,QAAQ;YACR,eAAe;YACf,KAAK;YACL,YAAY;YACZ,GAAG,mBAAmB;SACvB,CAAC,CACH,CAAC;QACF,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC;IAClC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Affine } from "@developmentseed/affine";
|
|
2
|
+
import type { TilesetLevel } from "./tileset-interface.js";
|
|
3
|
+
import type { Bounds, Corners } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Constructor options for {@link AffineTilesetLevel}.
|
|
6
|
+
*/
|
|
7
|
+
export interface AffineTilesetLevelOptions {
|
|
8
|
+
/** Pixel → CRS affine transform for this resolution level. */
|
|
9
|
+
affine: Affine;
|
|
10
|
+
/** Full level width, in pixels. */
|
|
11
|
+
arrayWidth: number;
|
|
12
|
+
/** Full level height, in pixels. */
|
|
13
|
+
arrayHeight: number;
|
|
14
|
+
/** Tile width, in pixels. */
|
|
15
|
+
tileWidth: number;
|
|
16
|
+
/** Tile height, in pixels. */
|
|
17
|
+
tileHeight: number;
|
|
18
|
+
/** Meters per CRS unit (1 for metric CRSes, ≈111000 for WGS84). */
|
|
19
|
+
mpu: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A {@link TilesetLevel} described by a single affine transform plus tile and
|
|
23
|
+
* array sizes.
|
|
24
|
+
*
|
|
25
|
+
* This handles axis-aligned, rotated, skewed, and non-square-pixel grids
|
|
26
|
+
* uniformly. Sources that fit this shape (tiled GeoTIFF overviews, GeoZarr
|
|
27
|
+
* multiscales) can construct one of these per resolution level instead of
|
|
28
|
+
* implementing {@link TilesetLevel} manually.
|
|
29
|
+
*/
|
|
30
|
+
export declare class AffineTilesetLevel implements TilesetLevel {
|
|
31
|
+
readonly tileWidth: number;
|
|
32
|
+
readonly tileHeight: number;
|
|
33
|
+
readonly matrixWidth: number;
|
|
34
|
+
readonly matrixHeight: number;
|
|
35
|
+
readonly metersPerPixel: number;
|
|
36
|
+
/**
|
|
37
|
+
* Source-CRS bounding box of the level's array `[minX, minY, maxX, maxY]`.
|
|
38
|
+
* Computed from the affine applied to the four array corners.
|
|
39
|
+
*/
|
|
40
|
+
readonly projectedBounds: Bounds;
|
|
41
|
+
private readonly _affine;
|
|
42
|
+
private readonly _invAffine;
|
|
43
|
+
constructor(options: AffineTilesetLevelOptions);
|
|
44
|
+
projectedTileCorners(col: number, row: number): Corners;
|
|
45
|
+
tileTransform(col: number, row: number): {
|
|
46
|
+
forwardTransform: (x: number, y: number) => [number, number];
|
|
47
|
+
inverseTransform: (x: number, y: number) => [number, number];
|
|
48
|
+
};
|
|
49
|
+
crsBoundsToTileRange(projectedMinX: number, projectedMinY: number, projectedMaxX: number, projectedMaxY: number): {
|
|
50
|
+
minCol: number;
|
|
51
|
+
maxCol: number;
|
|
52
|
+
minRow: number;
|
|
53
|
+
maxRow: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=affine-tileset-level.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine-tileset-level.d.ts","sourceRoot":"","sources":["../../src/raster-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AAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9D;IAaD,oBAAoB,CAClB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAmCtE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as affine from "@developmentseed/affine";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link TilesetLevel} described by a single affine transform plus tile and
|
|
4
|
+
* array sizes.
|
|
5
|
+
*
|
|
6
|
+
* This handles axis-aligned, rotated, skewed, and non-square-pixel grids
|
|
7
|
+
* uniformly. Sources that fit this shape (tiled GeoTIFF overviews, GeoZarr
|
|
8
|
+
* multiscales) can construct one of these per resolution level instead of
|
|
9
|
+
* implementing {@link TilesetLevel} manually.
|
|
10
|
+
*/
|
|
11
|
+
export class AffineTilesetLevel {
|
|
12
|
+
tileWidth;
|
|
13
|
+
tileHeight;
|
|
14
|
+
matrixWidth;
|
|
15
|
+
matrixHeight;
|
|
16
|
+
metersPerPixel;
|
|
17
|
+
/**
|
|
18
|
+
* Source-CRS bounding box of the level's array `[minX, minY, maxX, maxY]`.
|
|
19
|
+
* Computed from the affine applied to the four array corners.
|
|
20
|
+
*/
|
|
21
|
+
projectedBounds;
|
|
22
|
+
_affine;
|
|
23
|
+
_invAffine;
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this._affine = options.affine;
|
|
26
|
+
this._invAffine = affine.invert(options.affine);
|
|
27
|
+
this.tileWidth = options.tileWidth;
|
|
28
|
+
this.tileHeight = options.tileHeight;
|
|
29
|
+
this.matrixWidth = Math.ceil(options.arrayWidth / options.tileWidth);
|
|
30
|
+
this.matrixHeight = Math.ceil(options.arrayHeight / options.tileHeight);
|
|
31
|
+
// Geometric mean of the two pixel-edge scales handles non-square pixels.
|
|
32
|
+
const a = affine.a(options.affine);
|
|
33
|
+
const e = affine.e(options.affine);
|
|
34
|
+
this.metersPerPixel = Math.sqrt(Math.abs(a * e)) * options.mpu;
|
|
35
|
+
const corners = [
|
|
36
|
+
affine.apply(options.affine, 0, 0),
|
|
37
|
+
affine.apply(options.affine, options.arrayWidth, 0),
|
|
38
|
+
affine.apply(options.affine, 0, options.arrayHeight),
|
|
39
|
+
affine.apply(options.affine, options.arrayWidth, options.arrayHeight),
|
|
40
|
+
];
|
|
41
|
+
const xs = corners.map(([x]) => x);
|
|
42
|
+
const ys = corners.map(([, y]) => y);
|
|
43
|
+
this.projectedBounds = [
|
|
44
|
+
Math.min(...xs),
|
|
45
|
+
Math.min(...ys),
|
|
46
|
+
Math.max(...xs),
|
|
47
|
+
Math.max(...ys),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
projectedTileCorners(col, row) {
|
|
51
|
+
const tw = this.tileWidth;
|
|
52
|
+
const th = this.tileHeight;
|
|
53
|
+
const af = this._affine;
|
|
54
|
+
return {
|
|
55
|
+
topLeft: affine.apply(af, col * tw, row * th),
|
|
56
|
+
topRight: affine.apply(af, (col + 1) * tw, row * th),
|
|
57
|
+
bottomLeft: affine.apply(af, col * tw, (row + 1) * th),
|
|
58
|
+
bottomRight: affine.apply(af, (col + 1) * tw, (row + 1) * th),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
tileTransform(col, row) {
|
|
62
|
+
const tileOffset = affine.translation(col * this.tileWidth, row * this.tileHeight);
|
|
63
|
+
const tileAffine = affine.compose(this._affine, tileOffset);
|
|
64
|
+
const invTileAffine = affine.invert(tileAffine);
|
|
65
|
+
return {
|
|
66
|
+
forwardTransform: (x, y) => affine.apply(tileAffine, x, y),
|
|
67
|
+
inverseTransform: (x, y) => affine.apply(invTileAffine, x, y),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
crsBoundsToTileRange(projectedMinX, projectedMinY, projectedMaxX, projectedMaxY) {
|
|
71
|
+
// Map all four CRS corners through the inverse affine to get pixel coords,
|
|
72
|
+
// then take the bbox in pixel space (handles rotation correctly).
|
|
73
|
+
const inv = this._invAffine;
|
|
74
|
+
const pixelCorners = [
|
|
75
|
+
affine.apply(inv, projectedMinX, projectedMinY),
|
|
76
|
+
affine.apply(inv, projectedMaxX, projectedMinY),
|
|
77
|
+
affine.apply(inv, projectedMinX, projectedMaxY),
|
|
78
|
+
affine.apply(inv, projectedMaxX, projectedMaxY),
|
|
79
|
+
];
|
|
80
|
+
const xs = pixelCorners.map(([px]) => px);
|
|
81
|
+
const ys = pixelCorners.map(([, py]) => py);
|
|
82
|
+
const pixMinX = Math.min(...xs);
|
|
83
|
+
const pixMaxX = Math.max(...xs);
|
|
84
|
+
const pixMinY = Math.min(...ys);
|
|
85
|
+
const pixMaxY = Math.max(...ys);
|
|
86
|
+
const tw = this.tileWidth;
|
|
87
|
+
const th = this.tileHeight;
|
|
88
|
+
const maxColIdx = this.matrixWidth - 1;
|
|
89
|
+
const maxRowIdx = this.matrixHeight - 1;
|
|
90
|
+
// Asymmetric clamping: only clamp minCol/minRow up from below and
|
|
91
|
+
// maxCol/maxRow down from above. If the bbox lies entirely outside the
|
|
92
|
+
// array, this produces an empty range (min > max) so the consumer's
|
|
93
|
+
// `for (i = min; i <= max; i++)` loop does nothing.
|
|
94
|
+
const minCol = Math.max(0, Math.floor(pixMinX / tw));
|
|
95
|
+
const maxCol = Math.min(maxColIdx, Math.floor(pixMaxX / tw));
|
|
96
|
+
const minRow = Math.max(0, Math.floor(pixMinY / th));
|
|
97
|
+
const maxRow = Math.min(maxRowIdx, Math.floor(pixMaxY / th));
|
|
98
|
+
return { minCol, maxCol, minRow, maxRow };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=affine-tileset-level.js.map
|
|
@@ -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,CAAC,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC;QAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AffineTilesetLevel } from "./affine-tileset-level.js";
|
|
2
|
+
import type { TilesetDescriptor } from "./tileset-interface.js";
|
|
3
|
+
import type { Bounds, ProjectionFunction } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Constructor options for {@link AffineTileset}.
|
|
6
|
+
*/
|
|
7
|
+
export interface AffineTilesetOptions {
|
|
8
|
+
/** Resolution levels, ordered coarsest first. */
|
|
9
|
+
levels: AffineTilesetLevel[];
|
|
10
|
+
/** Forward projection function from source CRS to EPSG:3857. */
|
|
11
|
+
projectTo3857: ProjectionFunction;
|
|
12
|
+
/** Inverse projection function from EPSG:3857 to source CRS. */
|
|
13
|
+
projectFrom3857: ProjectionFunction;
|
|
14
|
+
/** Forward projection function from source CRS to EPSG:4326. */
|
|
15
|
+
projectTo4326: ProjectionFunction;
|
|
16
|
+
/** Inverse projection function from EPSG:4326 to source CRS. */
|
|
17
|
+
projectFrom4326: ProjectionFunction;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A {@link TilesetDescriptor} backed by per-level affine transforms.
|
|
21
|
+
*
|
|
22
|
+
* Derives `projectedBounds` from the coarsest level's array. Everything else
|
|
23
|
+
* is passed through from the constructor options.
|
|
24
|
+
*/
|
|
25
|
+
export declare class AffineTileset implements TilesetDescriptor {
|
|
26
|
+
readonly levels: AffineTilesetLevel[];
|
|
27
|
+
readonly projectTo3857: ProjectionFunction;
|
|
28
|
+
readonly projectFrom3857: ProjectionFunction;
|
|
29
|
+
readonly projectTo4326: ProjectionFunction;
|
|
30
|
+
readonly projectFrom4326: ProjectionFunction;
|
|
31
|
+
readonly projectedBounds: Bounds;
|
|
32
|
+
constructor(options: AffineTilesetOptions);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=affine-tileset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine-tileset.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/affine-tileset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,gEAAgE;IAChE,aAAa,EAAE,kBAAkB,CAAC;IAClC,gEAAgE;IAChE,eAAe,EAAE,kBAAkB,CAAC;IACpC,gEAAgE;IAChE,aAAa,EAAE,kBAAkB,CAAC;IAClC,gEAAgE;IAChE,eAAe,EAAE,kBAAkB,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACrD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAErB,OAAO,EAAE,oBAAoB;CAW1C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A {@link TilesetDescriptor} backed by per-level affine transforms.
|
|
3
|
+
*
|
|
4
|
+
* Derives `projectedBounds` from the coarsest level's array. Everything else
|
|
5
|
+
* is passed through from the constructor options.
|
|
6
|
+
*/
|
|
7
|
+
export class AffineTileset {
|
|
8
|
+
levels;
|
|
9
|
+
projectTo3857;
|
|
10
|
+
projectFrom3857;
|
|
11
|
+
projectTo4326;
|
|
12
|
+
projectFrom4326;
|
|
13
|
+
projectedBounds;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
if (options.levels.length === 0) {
|
|
16
|
+
throw new Error("AffineTileset requires at least one level");
|
|
17
|
+
}
|
|
18
|
+
this.levels = options.levels;
|
|
19
|
+
this.projectTo3857 = options.projectTo3857;
|
|
20
|
+
this.projectFrom3857 = options.projectFrom3857;
|
|
21
|
+
this.projectTo4326 = options.projectTo4326;
|
|
22
|
+
this.projectFrom4326 = options.projectFrom4326;
|
|
23
|
+
this.projectedBounds = options.levels[0].projectedBounds;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=affine-tileset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine-tileset.js","sourceRoot":"","sources":["../../src/raster-tileset/affine-tileset.ts"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACf,MAAM,CAAuB;IAC7B,aAAa,CAAqB;IAClC,eAAe,CAAqB;IACpC,aAAa,CAAqB;IAClC,eAAe,CAAqB;IACpC,eAAe,CAAS;IAEjC,YAAY,OAA6B;QACvC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,eAAe,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type { AffineTilesetOptions } from "./affine-tileset.js";
|
|
2
|
+
export { AffineTileset } from "./affine-tileset.js";
|
|
3
|
+
export type { AffineTilesetLevelOptions } from "./affine-tileset-level.js";
|
|
4
|
+
export { AffineTilesetLevel } from "./affine-tileset-level.js";
|
|
1
5
|
export type { TileMetadata } from "./raster-tileset-2d.js";
|
|
2
6
|
export { RasterTileset2D } from "./raster-tileset-2d.js";
|
|
3
7
|
export { TileMatrixSetAdaptor } from "./tile-matrix-set.js";
|