@developmentseed/deck.gl-raster 0.6.1 → 0.7.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/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/layer-utils.d.ts +2 -2
- package/dist/layer-utils.d.ts.map +1 -1
- package/dist/layer-utils.js.map +1 -1
- package/dist/mesh-layer/mesh-layer.d.ts +4 -1
- package/dist/mesh-layer/mesh-layer.d.ts.map +1 -1
- package/dist/mesh-layer/mesh-layer.js +28 -0
- package/dist/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/multi-raster-tileset/index.d.ts +2 -2
- package/dist/multi-raster-tileset/index.d.ts.map +1 -1
- package/dist/multi-raster-tileset/index.js +1 -1
- package/dist/multi-raster-tileset/index.js.map +1 -1
- package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts +21 -21
- package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts.map +1 -1
- package/dist/multi-raster-tileset/multi-tileset-descriptor.js +11 -11
- package/dist/multi-raster-tileset/multi-tileset-descriptor.js.map +1 -1
- package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts +4 -4
- package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts.map +1 -1
- package/dist/multi-raster-tileset/secondary-tile-resolver.js +2 -2
- package/dist/multi-raster-tileset/secondary-tile-resolver.js.map +1 -1
- package/dist/raster-layer.d.ts +21 -3
- package/dist/raster-layer.d.ts.map +1 -1
- package/dist/raster-layer.js +6 -17
- package/dist/raster-layer.js.map +1 -1
- package/dist/raster-tile-layer/raster-tile-layer.d.ts +23 -7
- package/dist/raster-tile-layer/raster-tile-layer.d.ts.map +1 -1
- package/dist/raster-tile-layer/raster-tile-layer.js +61 -17
- package/dist/raster-tile-layer/raster-tile-layer.js.map +1 -1
- package/dist/raster-tileset/affine-tileset-level.d.ts +7 -7
- package/dist/raster-tileset/affine-tileset-level.d.ts.map +1 -1
- package/dist/raster-tileset/affine-tileset-level.js +2 -2
- package/dist/raster-tileset/affine-tileset.d.ts +3 -3
- package/dist/raster-tileset/affine-tileset.d.ts.map +1 -1
- package/dist/raster-tileset/affine-tileset.js +1 -1
- package/dist/raster-tileset/bounding-volume-cache.d.ts +62 -0
- package/dist/raster-tileset/bounding-volume-cache.d.ts.map +1 -0
- package/dist/raster-tileset/bounding-volume-cache.js +70 -0
- package/dist/raster-tileset/bounding-volume-cache.js.map +1 -0
- package/dist/raster-tileset/index.d.ts +3 -2
- package/dist/raster-tileset/index.d.ts.map +1 -1
- package/dist/raster-tileset/index.js +1 -0
- package/dist/raster-tileset/index.js.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.d.ts +55 -21
- package/dist/raster-tileset/raster-tile-traversal.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.js +46 -29
- package/dist/raster-tileset/raster-tile-traversal.js.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.d.ts +61 -6
- package/dist/raster-tileset/raster-tileset-2d.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.js +39 -2
- package/dist/raster-tileset/raster-tileset-2d.js.map +1 -1
- package/dist/raster-tileset/sort-by-distance.d.ts +41 -0
- package/dist/raster-tileset/sort-by-distance.d.ts.map +1 -0
- package/dist/raster-tileset/sort-by-distance.js +72 -0
- package/dist/raster-tileset/sort-by-distance.js.map +1 -0
- package/dist/raster-tileset/tile-matrix-set.d.ts +4 -4
- package/dist/raster-tileset/tile-matrix-set.d.ts.map +1 -1
- package/dist/raster-tileset/tile-matrix-set.js +1 -1
- package/dist/raster-tileset/tile-matrix-set.js.map +1 -1
- package/dist/raster-tileset/tileset-interface.d.ts +5 -5
- package/dist/raster-tileset/tileset-interface.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CompositeLayerProps, DefaultProps, Layer } from "@deck.gl/core";
|
|
2
2
|
import { CompositeLayer } from "@deck.gl/core";
|
|
3
|
-
import type { TileLayerProps, _TileLoadProps as TileLoadProps } from "@deck.gl/geo-layers";
|
|
3
|
+
import type { _Tile2DHeader as Tile2DHeader, TileLayerProps, _TileLoadProps as TileLoadProps } from "@deck.gl/geo-layers";
|
|
4
4
|
import type { Device } from "@luma.gl/core";
|
|
5
5
|
import type { RenderTileResult } from "../raster-layer.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { RasterTilesetDescriptor } from "../raster-tileset/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* Minimum interface returned by `getTileData`.
|
|
9
9
|
*
|
|
@@ -39,14 +39,14 @@ export type GetTileDataOptions = {
|
|
|
39
39
|
/**
|
|
40
40
|
* Props for {@link RasterTileLayer}.
|
|
41
41
|
*/
|
|
42
|
-
export type RasterTileLayerProps<DataT extends MinimalTileData = MinimalTileData> = CompositeLayerProps & Pick<TileLayerProps, "
|
|
42
|
+
export type RasterTileLayerProps<DataT extends MinimalTileData = MinimalTileData> = CompositeLayerProps & Pick<TileLayerProps, "debounceTime" | "extent" | "maxCacheByteSize" | "maxCacheSize" | "maxRequests" | "maxZoom" | "minZoom" | "onTileError" | "onTileLoad" | "onTileUnload" | "onViewportLoad" | "refinementStrategy" | "tileSize" | "zoomOffset"> & {
|
|
43
43
|
/**
|
|
44
44
|
* Tile pyramid + CRS projection descriptor.
|
|
45
45
|
*
|
|
46
46
|
* Subclasses may supply this via state by overriding the protected
|
|
47
47
|
* `_tilesetDescriptor()` method.
|
|
48
48
|
*/
|
|
49
|
-
tilesetDescriptor?:
|
|
49
|
+
tilesetDescriptor?: RasterTilesetDescriptor;
|
|
50
50
|
/**
|
|
51
51
|
* Load data for one tile. Runs once per (x, y, z); the resulting `DataT`
|
|
52
52
|
* is cached by the underlying TileLayer.
|
|
@@ -105,7 +105,7 @@ type RasterTileLayerBaseProps<DataT extends MinimalTileData> = Omit<RasterTileLa
|
|
|
105
105
|
type RasterTileLayerDefaultExtraProps<DataT extends MinimalTileData> = Pick<RasterTileLayerProps<DataT>, "tilesetDescriptor" | "getTileData" | "renderTile">;
|
|
106
106
|
/**
|
|
107
107
|
* Base layer that renders a tiled raster source driven by a generic
|
|
108
|
-
* {@link
|
|
108
|
+
* {@link RasterTilesetDescriptor}.
|
|
109
109
|
*
|
|
110
110
|
* Usable directly (provide `tilesetDescriptor`, `getTileData`, and `renderTile`
|
|
111
111
|
* as props) or as a base class (override the protected `_tilesetDescriptor`,
|
|
@@ -120,7 +120,7 @@ export declare class RasterTileLayer<DataT extends MinimalTileData = MinimalTile
|
|
|
120
120
|
static layerName: string;
|
|
121
121
|
static defaultProps: DefaultProps<RasterTileLayerProps<MinimalTileData>>;
|
|
122
122
|
/**
|
|
123
|
-
* The currently effective {@link
|
|
123
|
+
* The currently effective {@link RasterTilesetDescriptor}.
|
|
124
124
|
*
|
|
125
125
|
* Subclasses override this to return a descriptor built from their own
|
|
126
126
|
* async-parsed state. Returns `undefined` while the source is still
|
|
@@ -132,7 +132,7 @@ export declare class RasterTileLayer<DataT extends MinimalTileData = MinimalTile
|
|
|
132
132
|
* brings it in; for subclass use this method is overridden and the cast
|
|
133
133
|
* is never reached.
|
|
134
134
|
*/
|
|
135
|
-
protected _tilesetDescriptor():
|
|
135
|
+
protected _tilesetDescriptor(): RasterTilesetDescriptor | undefined;
|
|
136
136
|
/**
|
|
137
137
|
* The currently effective tile-fetch callback.
|
|
138
138
|
*
|
|
@@ -148,6 +148,22 @@ export declare class RasterTileLayer<DataT extends MinimalTileData = MinimalTile
|
|
|
148
148
|
* any inferred default. Returns `undefined` when no callback is available.
|
|
149
149
|
*/
|
|
150
150
|
protected _renderTileCallback(): RasterTileLayerProps<DataT>["renderTile"];
|
|
151
|
+
/**
|
|
152
|
+
* Hook for rendering per-tile debug overlay sub-layers.
|
|
153
|
+
*
|
|
154
|
+
* Called once per tile from `_renderSubLayers` only when `props.debug` is
|
|
155
|
+
* `true`. The hook fires both before data has arrived (`data` is `null`) and
|
|
156
|
+
* after (`data` is the fetched `DataT`), so the default outline can render
|
|
157
|
+
* during loading.
|
|
158
|
+
*
|
|
159
|
+
* Default behavior renders the primary tile boundary via
|
|
160
|
+
* {@link renderDebugTileOutline} using the active descriptor. Subclasses can
|
|
161
|
+
* override to replace, extend (via `super._renderDebug(...)`), or suppress
|
|
162
|
+
* the default — for example, a multi-source layer can replace the default
|
|
163
|
+
* with per-band tile outlines and tiered metadata labels once `data` is
|
|
164
|
+
* available.
|
|
165
|
+
*/
|
|
166
|
+
protected _renderDebug(tile: Tile2DHeader<DataT>, _data: DataT | null): Layer[];
|
|
151
167
|
renderLayers(): Layer | null;
|
|
152
168
|
private _renderTileLayer;
|
|
153
169
|
private _wrapGetTileData;
|
|
@@ -1 +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,
|
|
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,EACV,aAAa,IAAI,YAAY,EAC7B,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,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;A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AAoB,CAAC,KAAK,CAAC,EAC3B,mBAAmB,GAAG,aAAa,GAAG,YAAY,CACnD,CAAC;AAEF;;;;GAIG;AACH,KAAK,gCAAgC,CAAC,KAAK,SAAS,eAAe,IAAI,IAAI,CACzE,oBAAoB,CAAC,KAAK,CAAC,EAC3B,mBAAmB,GAAG,aAAa,GAAG,YAAY,CACnD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAe,CAC1B,KAAK,SAAS,eAAe,GAAG,eAAe,EAC/C,UAAU,SAAS,MAAM,GAAG,gCAAgC,CAAC,KAAK,CAAC,CACnE,SAAQ,cAAc,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;IACpE,OAAgB,SAAS,SAAqB;IAC9C,OAAgB,YAAY,sDAAgB;IAE5C;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,kBAAkB,IAAI,uBAAuB,GAAG,SAAS;IAKnE;;;;;;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;IAI1E;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,YAAY,CACpB,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,EACzB,KAAK,EAAE,KAAK,GAAG,IAAI,GAClB,KAAK,EAAE;IAeD,YAAY,IAAI,KAAK,GAAG,IAAI;IAYrC,OAAO,CAAC,gBAAgB;YAmFV,gBAAgB;IAiB9B,OAAO,CAAC,gBAAgB;CA6EzB"}
|
|
@@ -12,7 +12,7 @@ const defaultProps = {
|
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Base layer that renders a tiled raster source driven by a generic
|
|
15
|
-
* {@link
|
|
15
|
+
* {@link RasterTilesetDescriptor}.
|
|
16
16
|
*
|
|
17
17
|
* Usable directly (provide `tilesetDescriptor`, `getTileData`, and `renderTile`
|
|
18
18
|
* as props) or as a base class (override the protected `_tilesetDescriptor`,
|
|
@@ -27,7 +27,7 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
27
27
|
static layerName = "RasterTileLayer";
|
|
28
28
|
static defaultProps = defaultProps;
|
|
29
29
|
/**
|
|
30
|
-
* The currently effective {@link
|
|
30
|
+
* The currently effective {@link RasterTilesetDescriptor}.
|
|
31
31
|
*
|
|
32
32
|
* Subclasses override this to return a descriptor built from their own
|
|
33
33
|
* async-parsed state. Returns `undefined` while the source is still
|
|
@@ -62,6 +62,31 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
62
62
|
_renderTileCallback() {
|
|
63
63
|
return this.props.renderTile;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Hook for rendering per-tile debug overlay sub-layers.
|
|
67
|
+
*
|
|
68
|
+
* Called once per tile from `_renderSubLayers` only when `props.debug` is
|
|
69
|
+
* `true`. The hook fires both before data has arrived (`data` is `null`) and
|
|
70
|
+
* after (`data` is the fetched `DataT`), so the default outline can render
|
|
71
|
+
* during loading.
|
|
72
|
+
*
|
|
73
|
+
* Default behavior renders the primary tile boundary via
|
|
74
|
+
* {@link renderDebugTileOutline} using the active descriptor. Subclasses can
|
|
75
|
+
* override to replace, extend (via `super._renderDebug(...)`), or suppress
|
|
76
|
+
* the default — for example, a multi-source layer can replace the default
|
|
77
|
+
* with per-band tile outlines and tiered metadata labels once `data` is
|
|
78
|
+
* available.
|
|
79
|
+
*/
|
|
80
|
+
_renderDebug(tile, _data) {
|
|
81
|
+
const descriptor = this._tilesetDescriptor();
|
|
82
|
+
if (!descriptor) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
// Tiles built by RasterTileset2D are augmented with RasterTileMetadata
|
|
86
|
+
// (projectedBbox/Corners, tileWidth/Height) at construction time. The cast
|
|
87
|
+
// makes that runtime augmentation visible to the typed helper.
|
|
88
|
+
return renderDebugTileOutline(`${this.id}-${tile.id}-bounds`, tile, descriptor.projectTo4326);
|
|
89
|
+
}
|
|
65
90
|
renderLayers() {
|
|
66
91
|
const descriptor = this._tilesetDescriptor();
|
|
67
92
|
const getTileData = this._getTileDataCallback();
|
|
@@ -72,12 +97,31 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
72
97
|
return this._renderTileLayer(descriptor, getTileData, renderTile);
|
|
73
98
|
}
|
|
74
99
|
_renderTileLayer(descriptor, getTileData, renderTile) {
|
|
100
|
+
// Capture the device once so the inner `TilesetFactory` can read
|
|
101
|
+
// its current effective device-pixel ratio per `getTileIndices`
|
|
102
|
+
// call. The ratio is sampled lazily so window-drag-between-displays
|
|
103
|
+
// (or runtime changes to `useDevicePixels`) take effect on the next
|
|
104
|
+
// traversal. See dev-docs/lod-and-pixel-matching.md § (A).
|
|
105
|
+
//
|
|
106
|
+
// We compute drawingBuffer/CSS rather than using
|
|
107
|
+
// `cssToDeviceRatio()` (deprecated) or the `devicePixelRatio`
|
|
108
|
+
// property (always reflects the system value, ignoring
|
|
109
|
+
// `Deck.useDevicePixels`). The drawing-buffer ratio is the
|
|
110
|
+
// *effective* DPR Deck is rendering at.
|
|
111
|
+
const device = this.context.device;
|
|
75
112
|
class TilesetFactory extends RasterTileset2D {
|
|
76
113
|
constructor(opts) {
|
|
77
|
-
super(opts, descriptor
|
|
114
|
+
super(opts, descriptor, {
|
|
115
|
+
getPixelRatio: () => {
|
|
116
|
+
const ctx = device.getDefaultCanvasContext();
|
|
117
|
+
const [drawingBufferWidth] = ctx.getDrawingBufferSize();
|
|
118
|
+
const [cssWidth] = ctx.getCSSSize();
|
|
119
|
+
return cssWidth ? drawingBufferWidth / cssWidth : 1;
|
|
120
|
+
},
|
|
121
|
+
});
|
|
78
122
|
}
|
|
79
123
|
}
|
|
80
|
-
const { tileSize, zoomOffset, maxZoom, minZoom, extent, debounceTime, maxCacheSize, maxCacheByteSize, maxRequests, refinementStrategy, updateTriggers, } = this.props;
|
|
124
|
+
const { tileSize, zoomOffset, maxZoom, minZoom, extent, debounceTime, maxCacheSize, maxCacheByteSize, maxRequests, refinementStrategy, updateTriggers, onTileError, onTileLoad, onTileUnload, onViewportLoad, } = this.props;
|
|
81
125
|
return new TileLayer({
|
|
82
126
|
id: `raster-tile-layer-${this.id}`,
|
|
83
127
|
TilesetClass: TilesetFactory,
|
|
@@ -96,6 +140,10 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
96
140
|
maxCacheByteSize,
|
|
97
141
|
maxRequests,
|
|
98
142
|
refinementStrategy,
|
|
143
|
+
onTileError,
|
|
144
|
+
onTileLoad,
|
|
145
|
+
onTileUnload,
|
|
146
|
+
onViewportLoad,
|
|
99
147
|
});
|
|
100
148
|
}
|
|
101
149
|
async _wrapGetTileData(tile, getTileData) {
|
|
@@ -113,22 +161,18 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
113
161
|
_renderSubLayers(props, descriptor, renderTile) {
|
|
114
162
|
const { maxError, debug, debugOpacity } = this.props;
|
|
115
163
|
const tile = props.tile;
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
164
|
+
const debugLayers = debug
|
|
165
|
+
? this._renderDebug(tile, props.data ?? null)
|
|
166
|
+
: [];
|
|
120
167
|
if (!props.data) {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
const { x, y, z } = tile.index;
|
|
124
|
-
const level = descriptor.levels[z];
|
|
125
|
-
if (!level) {
|
|
126
|
-
return layers;
|
|
168
|
+
return debugLayers;
|
|
127
169
|
}
|
|
128
|
-
|
|
170
|
+
// Access forwardTransform/inverseTransform from tile metadata so that
|
|
171
|
+
// reference equality holds across renders.
|
|
172
|
+
const { forwardTransform, inverseTransform } = tile;
|
|
129
173
|
const tileResult = renderTile(props.data);
|
|
130
174
|
if (!tileResult) {
|
|
131
|
-
return
|
|
175
|
+
return debugLayers;
|
|
132
176
|
}
|
|
133
177
|
const { image, renderPipeline } = tileResult;
|
|
134
178
|
const { width, height } = props.data;
|
|
@@ -173,7 +217,7 @@ export class RasterTileLayer extends CompositeLayer {
|
|
|
173
217
|
debugOpacity,
|
|
174
218
|
...deckProjectionProps,
|
|
175
219
|
}));
|
|
176
|
-
return [rasterLayer, ...
|
|
220
|
+
return [rasterLayer, ...debugLayers];
|
|
177
221
|
}
|
|
178
222
|
}
|
|
179
223
|
//# sourceMappingURL=raster-tile-layer.js.map
|
|
@@ -1 +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;
|
|
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;AAqHxE,MAAM,YAAY,GAAuC;IACvD,GAAG,SAAS,CAAC,YAAY;IACzB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,YA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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,WAAW,CAAC,CAAC;IACvC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Affine } from "@developmentseed/affine";
|
|
2
|
-
import type {
|
|
3
|
-
import type { Bounds, Corners } from "./types.js";
|
|
2
|
+
import type { RasterTilesetLevel } from "./tileset-interface.js";
|
|
3
|
+
import type { Bounds, Corners, ProjectionFunction } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Constructor options for {@link AffineTilesetLevel}.
|
|
6
6
|
*/
|
|
@@ -19,15 +19,15 @@ export interface AffineTilesetLevelOptions {
|
|
|
19
19
|
mpu: number;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* A {@link
|
|
22
|
+
* A {@link RasterTilesetLevel} described by a single affine transform plus tile and
|
|
23
23
|
* array sizes.
|
|
24
24
|
*
|
|
25
25
|
* This handles axis-aligned, rotated, skewed, and non-square-pixel grids
|
|
26
26
|
* uniformly. Sources that fit this shape (tiled GeoTIFF overviews, GeoZarr
|
|
27
27
|
* multiscales) can construct one of these per resolution level instead of
|
|
28
|
-
* implementing {@link
|
|
28
|
+
* implementing {@link RasterTilesetLevel} manually.
|
|
29
29
|
*/
|
|
30
|
-
export declare class AffineTilesetLevel implements
|
|
30
|
+
export declare class AffineTilesetLevel implements RasterTilesetLevel {
|
|
31
31
|
readonly tileWidth: number;
|
|
32
32
|
readonly tileHeight: number;
|
|
33
33
|
readonly matrixWidth: number;
|
|
@@ -43,8 +43,8 @@ export declare class AffineTilesetLevel implements TilesetLevel {
|
|
|
43
43
|
constructor(options: AffineTilesetLevelOptions);
|
|
44
44
|
projectedTileCorners(col: number, row: number): Corners;
|
|
45
45
|
tileTransform(col: number, row: number): {
|
|
46
|
-
forwardTransform:
|
|
47
|
-
inverseTransform:
|
|
46
|
+
forwardTransform: ProjectionFunction;
|
|
47
|
+
inverseTransform: ProjectionFunction;
|
|
48
48
|
};
|
|
49
49
|
crsBoundsToTileRange(projectedMinX: number, projectedMinY: number, projectedMaxX: number, projectedMaxY: number): {
|
|
50
50
|
minCol: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affine-tileset-level.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/affine-tileset-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"affine-tileset-level.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/affine-tileset-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB;IAC3D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,OAAO,EAAE,yBAAyB;IA6B9C,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAavD,aAAa,CACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV;QACD,gBAAgB,EAAE,kBAAkB,CAAC;QACrC,gBAAgB,EAAE,kBAAkB,CAAC;KACtC;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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as affine from "@developmentseed/affine";
|
|
2
2
|
/**
|
|
3
|
-
* A {@link
|
|
3
|
+
* A {@link RasterTilesetLevel} described by a single affine transform plus tile and
|
|
4
4
|
* array sizes.
|
|
5
5
|
*
|
|
6
6
|
* This handles axis-aligned, rotated, skewed, and non-square-pixel grids
|
|
7
7
|
* uniformly. Sources that fit this shape (tiled GeoTIFF overviews, GeoZarr
|
|
8
8
|
* multiscales) can construct one of these per resolution level instead of
|
|
9
|
-
* implementing {@link
|
|
9
|
+
* implementing {@link RasterTilesetLevel} manually.
|
|
10
10
|
*/
|
|
11
11
|
export class AffineTilesetLevel {
|
|
12
12
|
tileWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AffineTilesetLevel } from "./affine-tileset-level.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RasterTilesetDescriptor } from "./tileset-interface.js";
|
|
3
3
|
import type { Bounds, ProjectionFunction } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Constructor options for {@link AffineTileset}.
|
|
@@ -17,12 +17,12 @@ export interface AffineTilesetOptions {
|
|
|
17
17
|
projectFrom4326: ProjectionFunction;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* A {@link
|
|
20
|
+
* A {@link RasterTilesetDescriptor} backed by per-level affine transforms.
|
|
21
21
|
*
|
|
22
22
|
* Derives `projectedBounds` from the coarsest level's array. Everything else
|
|
23
23
|
* is passed through from the constructor options.
|
|
24
24
|
*/
|
|
25
|
-
export declare class AffineTileset implements
|
|
25
|
+
export declare class AffineTileset implements RasterTilesetDescriptor {
|
|
26
26
|
readonly levels: AffineTilesetLevel[];
|
|
27
27
|
readonly projectTo3857: ProjectionFunction;
|
|
28
28
|
readonly projectFrom3857: ProjectionFunction;
|
|
@@ -1 +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,
|
|
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,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,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,uBAAuB;IAC3D,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A {@link
|
|
2
|
+
* A {@link RasterTilesetDescriptor} backed by per-level affine transforms.
|
|
3
3
|
*
|
|
4
4
|
* Derives `projectedBounds` from the coarsest level's array. Everything else
|
|
5
5
|
* is passed through from the constructor options.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { OrientedBoundingBox } from "@math.gl/culling";
|
|
2
|
+
import type { Bounds, ZRange } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A memoized tile bounding volume, tagged with the elevation range it was
|
|
5
|
+
* computed for (so a `zRange` change can invalidate it).
|
|
6
|
+
*/
|
|
7
|
+
export interface BoundingVolumeCacheEntry {
|
|
8
|
+
zRange: ZRange;
|
|
9
|
+
boundingVolume: OrientedBoundingBox;
|
|
10
|
+
commonSpaceBounds: Bounds;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Options for {@link BoundingVolumeCache}.
|
|
14
|
+
*/
|
|
15
|
+
export interface BoundingVolumeCacheOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Soft cap on the number of cached tile bounding volumes. When a
|
|
18
|
+
* `getTileIndices` traversal begins and the cache holds more than this many
|
|
19
|
+
* entries, the least-recently-used entries are dropped down to roughly half.
|
|
20
|
+
* Eviction never runs mid-traversal (only via {@link BoundingVolumeCache.sweep}),
|
|
21
|
+
* so a single frame is never starved of an entry it computed earlier that
|
|
22
|
+
* same frame. `0` makes every traversal start from an empty cache.
|
|
23
|
+
*
|
|
24
|
+
* @default 65_536
|
|
25
|
+
*/
|
|
26
|
+
maxEntries?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* An LRU cache of tile bounding volumes keyed by `"z/x/y"`.
|
|
30
|
+
*
|
|
31
|
+
* The raster tile traversal recomputes a tile's bounding volume (several proj4
|
|
32
|
+
* reprojections plus an oriented-bounding-box fit) only on a cache miss; on a
|
|
33
|
+
* hit it returns the stored volume. A tile's bounding volume depends only on
|
|
34
|
+
* `(z, x, y, zRange)` for a given tileset descriptor, so it is safe to memoize
|
|
35
|
+
* across `getTileIndices` calls (i.e. across animation frames).
|
|
36
|
+
*
|
|
37
|
+
* NOTE: this assumes a non-Globe traversal (`project === null`) — the only kind
|
|
38
|
+
* `RasterTileNode.getBoundingVolume` currently supports. If Globe-view bounding
|
|
39
|
+
* volumes are ever implemented, the cache key will need a viewport/resolution
|
|
40
|
+
* component.
|
|
41
|
+
*/
|
|
42
|
+
export declare class BoundingVolumeCache {
|
|
43
|
+
private entries;
|
|
44
|
+
private maxEntries;
|
|
45
|
+
constructor({ maxEntries, }?: BoundingVolumeCacheOptions);
|
|
46
|
+
/** Number of cached entries. */
|
|
47
|
+
get size(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Look up the cached bounding volume for tile `(z, x, y)`. On a hit the entry
|
|
50
|
+
* is marked most-recently-used. Returns `undefined` on a miss.
|
|
51
|
+
*/
|
|
52
|
+
get(z: number, x: number, y: number): BoundingVolumeCacheEntry | undefined;
|
|
53
|
+
/** Store the bounding volume for tile `(z, x, y)` as most-recently-used. */
|
|
54
|
+
set(z: number, x: number, y: number, entry: BoundingVolumeCacheEntry): void;
|
|
55
|
+
/**
|
|
56
|
+
* If the cache is over its soft cap, drop least-recently-used entries down to
|
|
57
|
+
* roughly half of `maxEntries`. No-op when at or under the cap. Call once at
|
|
58
|
+
* the start of a traversal, never mid-traversal.
|
|
59
|
+
*/
|
|
60
|
+
sweep(): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=bounding-volume-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounding-volume-cache.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/bounding-volume-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,mBAAmB,CAAC;IACpC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID;;;;;;;;;;;;;GAaG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,UAAU,CAAS;gBAEf,EACV,UAAgC,GACjC,GAAE,0BAA+B;IAIlC,gCAAgC;IAChC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAY1E,4EAA4E;IAC5E,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,GAAG,IAAI;IAM3E;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAiBd"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const DEFAULT_MAX_ENTRIES = 65_536;
|
|
2
|
+
/**
|
|
3
|
+
* An LRU cache of tile bounding volumes keyed by `"z/x/y"`.
|
|
4
|
+
*
|
|
5
|
+
* The raster tile traversal recomputes a tile's bounding volume (several proj4
|
|
6
|
+
* reprojections plus an oriented-bounding-box fit) only on a cache miss; on a
|
|
7
|
+
* hit it returns the stored volume. A tile's bounding volume depends only on
|
|
8
|
+
* `(z, x, y, zRange)` for a given tileset descriptor, so it is safe to memoize
|
|
9
|
+
* across `getTileIndices` calls (i.e. across animation frames).
|
|
10
|
+
*
|
|
11
|
+
* NOTE: this assumes a non-Globe traversal (`project === null`) — the only kind
|
|
12
|
+
* `RasterTileNode.getBoundingVolume` currently supports. If Globe-view bounding
|
|
13
|
+
* volumes are ever implemented, the cache key will need a viewport/resolution
|
|
14
|
+
* component.
|
|
15
|
+
*/
|
|
16
|
+
export class BoundingVolumeCache {
|
|
17
|
+
entries = new Map();
|
|
18
|
+
maxEntries;
|
|
19
|
+
constructor({ maxEntries = DEFAULT_MAX_ENTRIES, } = {}) {
|
|
20
|
+
this.maxEntries = Math.max(0, maxEntries);
|
|
21
|
+
}
|
|
22
|
+
/** Number of cached entries. */
|
|
23
|
+
get size() {
|
|
24
|
+
return this.entries.size;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Look up the cached bounding volume for tile `(z, x, y)`. On a hit the entry
|
|
28
|
+
* is marked most-recently-used. Returns `undefined` on a miss.
|
|
29
|
+
*/
|
|
30
|
+
get(z, x, y) {
|
|
31
|
+
const key = `${z}/${x}/${y}`;
|
|
32
|
+
const entry = this.entries.get(key);
|
|
33
|
+
if (entry === undefined) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
// Re-insert to move the key to the most-recently-used end of the Map.
|
|
37
|
+
this.entries.delete(key);
|
|
38
|
+
this.entries.set(key, entry);
|
|
39
|
+
return entry;
|
|
40
|
+
}
|
|
41
|
+
/** Store the bounding volume for tile `(z, x, y)` as most-recently-used. */
|
|
42
|
+
set(z, x, y, entry) {
|
|
43
|
+
const key = `${z}/${x}/${y}`;
|
|
44
|
+
this.entries.delete(key);
|
|
45
|
+
this.entries.set(key, entry);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* If the cache is over its soft cap, drop least-recently-used entries down to
|
|
49
|
+
* roughly half of `maxEntries`. No-op when at or under the cap. Call once at
|
|
50
|
+
* the start of a traversal, never mid-traversal.
|
|
51
|
+
*/
|
|
52
|
+
sweep() {
|
|
53
|
+
if (this.entries.size <= this.maxEntries) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const target = Math.floor(this.maxEntries / 2);
|
|
57
|
+
const excess = this.entries.size - target;
|
|
58
|
+
const keysToDelete = [];
|
|
59
|
+
for (const key of this.entries.keys()) {
|
|
60
|
+
keysToDelete.push(key);
|
|
61
|
+
if (keysToDelete.length >= excess) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const key of keysToDelete) {
|
|
66
|
+
this.entries.delete(key);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=bounding-volume-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounding-volume-cache.js","sourceRoot":"","sources":["../../src/raster-tileset/bounding-volume-cache.ts"],"names":[],"mappings":"AA+BA,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,mBAAmB;IACtB,OAAO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,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;QAC1C,MAAM,YAAY,GAAa,EAAE,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvB,IAAI,YAAY,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC;gBAClC,MAAM;YACR,CAAC;QACH,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -2,9 +2,10 @@ export type { AffineTilesetOptions } from "./affine-tileset.js";
|
|
|
2
2
|
export { AffineTileset } from "./affine-tileset.js";
|
|
3
3
|
export type { AffineTilesetLevelOptions } from "./affine-tileset-level.js";
|
|
4
4
|
export { AffineTilesetLevel } from "./affine-tileset-level.js";
|
|
5
|
-
export type {
|
|
5
|
+
export type { RasterTileMetadata } from "./raster-tileset-2d.js";
|
|
6
6
|
export { RasterTileset2D } from "./raster-tileset-2d.js";
|
|
7
|
+
export { sortItemsByDistanceFromViewportCenter } from "./sort-by-distance.js";
|
|
7
8
|
export { TileMatrixSetAdaptor } from "./tile-matrix-set.js";
|
|
8
|
-
export type {
|
|
9
|
+
export type { RasterTilesetDescriptor, RasterTilesetLevel, } from "./tileset-interface.js";
|
|
9
10
|
export type { Bounds, CornerBounds, Corners, ProjectionFunction, } from "./types.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,MAAM,EACN,YAAY,EACZ,OAAO,EACP,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AffineTileset } from "./affine-tileset.js";
|
|
2
2
|
export { AffineTilesetLevel } from "./affine-tileset-level.js";
|
|
3
3
|
export { RasterTileset2D } from "./raster-tileset-2d.js";
|
|
4
|
+
export { sortItemsByDistanceFromViewportCenter } from "./sort-by-distance.js";
|
|
4
5
|
export { TileMatrixSetAdaptor } from "./tile-matrix-set.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/raster-tileset/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/raster-tileset/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|