@deck.gl/geo-layers 8.9.0-alpha.5 → 8.9.0-beta.2
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/dist.dev.js +25764 -66606
- package/dist/es5/geo-cell-layer/GeoCellLayer.js.map +1 -1
- package/dist/es5/geohash-layer/geohash-layer.js.map +1 -1
- package/dist/es5/great-circle-layer/great-circle-layer.js.map +1 -1
- package/dist/es5/h3-layers/h3-cluster-layer.js +2 -2
- package/dist/es5/h3-layers/h3-cluster-layer.js.map +1 -1
- package/dist/es5/h3-layers/h3-hexagon-layer.js.map +1 -1
- package/dist/es5/index.js +4 -8
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/mesh-layer/mesh-layer-fragment.glsl.js +1 -1
- package/dist/es5/mesh-layer/mesh-layer-vertex.glsl.js +1 -1
- package/dist/es5/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/es5/mvt-layer/coordinate-transform.js.map +1 -1
- package/dist/es5/mvt-layer/mvt-layer.js +9 -9
- package/dist/es5/mvt-layer/mvt-layer.js.map +1 -1
- package/dist/es5/quadkey-layer/quadkey-layer.js.map +1 -1
- package/dist/es5/s2-layer/s2-layer.js.map +1 -1
- package/dist/es5/terrain-layer/terrain-layer.js +6 -9
- package/dist/es5/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/es5/tile-3d-layer/tile-3d-layer.js +9 -8
- package/dist/es5/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/es5/tile-layer/tile-layer.js +32 -14
- package/dist/es5/tile-layer/tile-layer.js.map +1 -1
- package/dist/es5/tileset-2d/index.js +66 -0
- package/dist/es5/tileset-2d/index.js.map +1 -0
- package/dist/es5/tileset-2d/memoize.js +47 -0
- package/dist/es5/tileset-2d/memoize.js.map +1 -0
- package/dist/es5/{tile-layer → tileset-2d}/tile-2d-header.js +3 -5
- package/dist/es5/tileset-2d/tile-2d-header.js.map +1 -0
- package/dist/es5/{tile-layer → tileset-2d}/tile-2d-traversal.js +0 -0
- package/dist/es5/tileset-2d/tile-2d-traversal.js.map +1 -0
- package/dist/es5/{tile-layer → tileset-2d}/tileset-2d.js +166 -121
- package/dist/es5/tileset-2d/tileset-2d.js.map +1 -0
- package/dist/es5/{tile-layer → tileset-2d}/types.js +0 -0
- package/dist/es5/{tile-layer → tileset-2d}/types.js.map +0 -0
- package/dist/es5/{tile-layer → tileset-2d}/utils.js +17 -18
- package/dist/es5/tileset-2d/utils.js.map +1 -0
- package/dist/es5/trips-layer/trips-layer.js.map +1 -1
- package/dist/esm/geo-cell-layer/GeoCellLayer.js.map +1 -1
- package/dist/esm/geohash-layer/geohash-layer.js.map +1 -1
- package/dist/esm/great-circle-layer/great-circle-layer.js.map +1 -1
- package/dist/esm/h3-layers/h3-cluster-layer.js +1 -1
- package/dist/esm/h3-layers/h3-cluster-layer.js.map +1 -1
- package/dist/esm/h3-layers/h3-hexagon-layer.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js +1 -1
- package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js +1 -1
- package/dist/esm/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/esm/mvt-layer/coordinate-transform.js.map +1 -1
- package/dist/esm/mvt-layer/mvt-layer.js +3 -3
- package/dist/esm/mvt-layer/mvt-layer.js.map +1 -1
- package/dist/esm/quadkey-layer/quadkey-layer.js.map +1 -1
- package/dist/esm/s2-layer/s2-layer.js.map +1 -1
- package/dist/esm/terrain-layer/terrain-layer.js +2 -5
- package/dist/esm/terrain-layer/terrain-layer.js.map +1 -1
- package/dist/esm/tile-3d-layer/tile-3d-layer.js +9 -10
- package/dist/esm/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/esm/tile-layer/tile-layer.js +16 -6
- package/dist/esm/tile-layer/tile-layer.js.map +1 -1
- package/dist/esm/tileset-2d/index.js +4 -0
- package/dist/esm/tileset-2d/index.js.map +1 -0
- package/dist/esm/tileset-2d/memoize.js +40 -0
- package/dist/esm/tileset-2d/memoize.js.map +1 -0
- package/dist/esm/{tile-layer → tileset-2d}/tile-2d-header.js +2 -3
- package/dist/esm/tileset-2d/tile-2d-header.js.map +1 -0
- package/dist/esm/{tile-layer → tileset-2d}/tile-2d-traversal.js +0 -0
- package/dist/esm/tileset-2d/tile-2d-traversal.js.map +1 -0
- package/dist/esm/{tile-layer → tileset-2d}/tileset-2d.js +48 -16
- package/dist/esm/tileset-2d/tileset-2d.js.map +1 -0
- package/dist/esm/{tile-layer → tileset-2d}/types.js +0 -0
- package/dist/esm/{tile-layer → tileset-2d}/types.js.map +0 -0
- package/dist/esm/{tile-layer → tileset-2d}/utils.js +16 -20
- package/dist/esm/tileset-2d/utils.js.map +1 -0
- package/dist/esm/trips-layer/trips-layer.js.map +1 -1
- package/dist.min.js +188 -6
- package/package.json +11 -11
- package/src/geo-cell-layer/GeoCellLayer.ts +2 -2
- package/src/geohash-layer/geohash-layer.ts +4 -4
- package/src/great-circle-layer/great-circle-layer.ts +2 -2
- package/src/h3-layers/h3-cluster-layer.ts +2 -2
- package/src/h3-layers/h3-hexagon-layer.ts +4 -1
- package/src/index.ts +9 -5
- package/src/mesh-layer/mesh-layer.ts +1 -1
- package/src/mvt-layer/coordinate-transform.ts +1 -1
- package/src/mvt-layer/mvt-layer.ts +18 -11
- package/src/quadkey-layer/quadkey-layer.ts +1 -1
- package/src/s2-layer/s2-layer.ts +1 -1
- package/src/terrain-layer/terrain-layer.ts +11 -9
- package/src/tile-3d-layer/tile-3d-layer.ts +13 -11
- package/src/tile-layer/tile-layer.ts +23 -11
- package/src/tileset-2d/index.ts +25 -0
- package/src/tileset-2d/memoize.ts +45 -0
- package/src/{tile-layer → tileset-2d}/tile-2d-header.ts +4 -4
- package/src/{tile-layer → tileset-2d}/tile-2d-traversal.ts +3 -1
- package/src/{tile-layer → tileset-2d}/tileset-2d.ts +91 -39
- package/src/{tile-layer → tileset-2d}/types.ts +0 -0
- package/src/{tile-layer → tileset-2d}/utils.ts +26 -12
- package/src/trips-layer/trips-layer.ts +1 -1
- package/typed/geo-cell-layer/GeoCellLayer.d.ts +2 -2
- package/typed/geo-cell-layer/GeoCellLayer.d.ts.map +1 -1
- package/typed/geo-cell-layer/GeoCellLayer.js +49 -0
- package/typed/geohash-layer/geohash-layer.d.ts +3 -3
- package/typed/geohash-layer/geohash-layer.d.ts.map +1 -1
- package/typed/great-circle-layer/great-circle-layer.d.ts +3 -2
- package/typed/great-circle-layer/great-circle-layer.d.ts.map +1 -1
- package/typed/great-circle-layer/great-circle-layer.js +29 -0
- package/typed/h3-layers/h3-cluster-layer.d.ts +1 -1
- package/typed/h3-layers/h3-cluster-layer.d.ts.map +1 -1
- package/typed/h3-layers/h3-cluster-layer.js +33 -0
- package/typed/h3-layers/h3-hexagon-layer.d.ts +1 -1
- package/typed/h3-layers/h3-hexagon-layer.d.ts.map +1 -1
- package/typed/h3-layers/h3-hexagon-layer.js +251 -0
- package/typed/index.d.ts +5 -5
- package/typed/index.d.ts.map +1 -1
- package/typed/index.js +33 -0
- package/typed/mesh-layer/mesh-layer-fragment.glsl.js +55 -0
- package/typed/mesh-layer/mesh-layer-vertex.glsl.js +80 -0
- package/typed/mesh-layer/mesh-layer.d.ts +1 -1
- package/typed/mesh-layer/mesh-layer.d.ts.map +1 -1
- package/typed/mesh-layer/mesh-layer.js +110 -0
- package/typed/mvt-layer/coordinate-transform.d.ts +1 -1
- package/typed/mvt-layer/coordinate-transform.d.ts.map +1 -1
- package/typed/mvt-layer/coordinate-transform.js +41 -0
- package/typed/mvt-layer/find-index-binary.js +96 -0
- package/typed/mvt-layer/mvt-layer.d.ts +3 -4
- package/typed/mvt-layer/mvt-layer.d.ts.map +1 -1
- package/typed/mvt-layer/mvt-layer.js +297 -0
- package/typed/quadkey-layer/quadkey-layer.d.ts +1 -1
- package/typed/quadkey-layer/quadkey-layer.d.ts.map +1 -1
- package/typed/quadkey-layer/quadkey-layer.js +18 -0
- package/typed/quadkey-layer/quadkey-utils.js +26 -0
- package/typed/s2-layer/s2-geometry.js +123 -0
- package/typed/s2-layer/s2-layer.d.ts +1 -1
- package/typed/s2-layer/s2-layer.d.ts.map +1 -1
- package/typed/s2-layer/s2-layer.js +37 -0
- package/typed/s2-layer/s2-utils.js +88 -0
- package/typed/terrain-layer/terrain-layer.d.ts +8 -5
- package/typed/terrain-layer/terrain-layer.d.ts.map +1 -1
- package/typed/terrain-layer/terrain-layer.js +226 -0
- package/typed/tile-3d-layer/tile-3d-layer.d.ts +3 -3
- package/typed/tile-3d-layer/tile-3d-layer.d.ts.map +1 -1
- package/typed/tile-3d-layer/tile-3d-layer.js +294 -0
- package/typed/tile-layer/tile-2d-header.js +113 -0
- package/typed/tile-layer/tile-2d-traversal.js +181 -0
- package/typed/tile-layer/tile-layer.d.ts +6 -7
- package/typed/tile-layer/tile-layer.d.ts.map +1 -1
- package/typed/tile-layer/tile-layer.js +192 -0
- package/typed/tile-layer/tileset-2d.d.ts.map +1 -1
- package/typed/tile-layer/tileset-2d.js +399 -0
- package/typed/tile-layer/types.js +1 -0
- package/typed/tile-layer/utils.d.ts +1 -1
- package/typed/tile-layer/utils.d.ts.map +1 -1
- package/typed/tile-layer/utils.js +197 -0
- package/typed/tileset-2d/index.d.ts +7 -0
- package/typed/tileset-2d/index.d.ts.map +1 -0
- package/typed/tileset-2d/memoize.d.ts +7 -0
- package/typed/tileset-2d/memoize.d.ts.map +1 -0
- package/typed/tileset-2d/tile-2d-header.d.ts +39 -0
- package/typed/tileset-2d/tile-2d-header.d.ts.map +1 -0
- package/typed/tileset-2d/tile-2d-traversal.d.ts +4 -0
- package/typed/tileset-2d/tile-2d-traversal.d.ts.map +1 -0
- package/typed/tileset-2d/tileset-2d.d.ts +121 -0
- package/typed/tileset-2d/tileset-2d.d.ts.map +1 -0
- package/typed/tileset-2d/types.d.ts +30 -0
- package/typed/tileset-2d/types.d.ts.map +1 -0
- package/typed/tileset-2d/utils.d.ts +52 -0
- package/typed/tileset-2d/utils.d.ts.map +1 -0
- package/typed/trips-layer/trips-layer.d.ts +1 -1
- package/typed/trips-layer/trips-layer.d.ts.map +1 -1
- package/typed/trips-layer/trips-layer.js +92 -0
- package/dist/es5/tile-layer/tile-2d-header.js.map +0 -1
- package/dist/es5/tile-layer/tile-2d-traversal.js.map +0 -1
- package/dist/es5/tile-layer/tileset-2d.js.map +0 -1
- package/dist/es5/tile-layer/utils.js.map +0 -1
- package/dist/esm/tile-layer/tile-2d-header.js.map +0 -1
- package/dist/esm/tile-layer/tile-2d-traversal.js.map +0 -1
- package/dist/esm/tile-layer/tileset-2d.js.map +0 -1
- package/dist/esm/tile-layer/utils.js.map +0 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {Viewport} from '@deck.gl/core';
|
|
2
|
+
|
|
3
3
|
import {RequestScheduler} from '@loaders.gl/loader-utils';
|
|
4
4
|
import {Matrix4, equals} from '@math.gl/core';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import {Tile2DHeader} from './tile-2d-header';
|
|
7
|
+
|
|
8
|
+
import {getTileIndices, tileToBoundingBox, getCullBounds} from './utils';
|
|
6
9
|
import {Bounds, TileIndex, ZRange} from './types';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
10
|
+
import {TileLoadProps} from './types';
|
|
11
|
+
import {memoize} from './memoize';
|
|
9
12
|
|
|
10
13
|
// bit masks
|
|
11
14
|
const TILE_STATE_VISITED = 1;
|
|
@@ -35,9 +38,9 @@ export const STRATEGY_DEFAULT = 'best-available';
|
|
|
35
38
|
|
|
36
39
|
export type RefinementStrategyFunction = (tiles: Tile2DHeader[]) => void;
|
|
37
40
|
export type RefinementStrategy =
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
+
| 'never'
|
|
42
|
+
| 'no-overlap'
|
|
43
|
+
| 'best-available'
|
|
41
44
|
| RefinementStrategyFunction;
|
|
42
45
|
|
|
43
46
|
const DEFAULT_CACHE_SCALE = 5;
|
|
@@ -48,30 +51,71 @@ const STRATEGIES = {
|
|
|
48
51
|
[STRATEGY_NEVER]: () => {}
|
|
49
52
|
};
|
|
50
53
|
|
|
51
|
-
export type Tileset2DProps =
|
|
52
|
-
|
|
53
|
-
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
export type Tileset2DProps<DataT = any> = {
|
|
55
|
+
/** `getTileData` is called to retrieve the data of each tile. */
|
|
56
|
+
getTileData: (props: TileLoadProps) => Promise<DataT> | DataT;
|
|
57
|
+
|
|
58
|
+
/** The bounding box of the layer's data. */
|
|
59
|
+
extent?: number[] | null;
|
|
60
|
+
/** The pixel dimension of the tiles, usually a power of 2. */
|
|
61
|
+
tileSize?: number;
|
|
62
|
+
/** The max zoom level of the layer's data. @default null */
|
|
63
|
+
maxZoom?: number | null;
|
|
64
|
+
/** The min zoom level of the layer's data. @default 0 */
|
|
65
|
+
minZoom?: number | null;
|
|
66
|
+
/** The maximum number of tiles that can be cached. */
|
|
67
|
+
maxCacheSize?: number | null;
|
|
68
|
+
/** The maximum memory used for caching tiles. @default null */
|
|
69
|
+
maxCacheByteSize?: number | null;
|
|
70
|
+
/** How the tile layer refines the visibility of tiles. @default 'best-available' */
|
|
71
|
+
refinementStrategy?: RefinementStrategy;
|
|
72
|
+
/** Range of minimum and maximum heights in the tile. */
|
|
73
|
+
zRange?: ZRange | null;
|
|
74
|
+
/** The maximum number of concurrent getTileData calls. @default 6 */
|
|
75
|
+
maxRequests?: number;
|
|
76
|
+
/** Changes the zoom level at which the tiles are fetched. Needs to be an integer. @default 0 */
|
|
77
|
+
zoomOffset?: number;
|
|
78
|
+
|
|
79
|
+
/** Called when a tile successfully loads. */
|
|
80
|
+
onTileLoad?: (tile: Tile2DHeader<DataT>) => void;
|
|
81
|
+
/** Called when a tile is cleared from cache. */
|
|
82
|
+
onTileUnload?: (tile: Tile2DHeader<DataT>) => void;
|
|
83
|
+
/** Called when a tile failed to load. */
|
|
84
|
+
onTileError?: (err: any, tile: Tile2DHeader<DataT>) => void;
|
|
85
|
+
|
|
86
|
+
// onTileLoad: (tile: Tile2DHeader) => void;
|
|
87
|
+
// onTileUnload: (tile: Tile2DHeader) => void;
|
|
88
|
+
// onTileError: (error: any, tile: Tile2DHeader) => void;
|
|
89
|
+
/** Called when all tiles in the current viewport are loaded. */
|
|
90
|
+
// sonViewportLoad?: ((tiles: Tile2DHeader<DataT>[]) => void) | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const DEFAULT_TILESET2D_PROPS: Omit<Required<Tileset2DProps>, 'getTileData'> = {
|
|
94
|
+
extent: null,
|
|
95
|
+
tileSize: 512,
|
|
96
|
+
|
|
97
|
+
maxZoom: null,
|
|
98
|
+
minZoom: null,
|
|
99
|
+
maxCacheSize: null,
|
|
100
|
+
maxCacheByteSize: null,
|
|
101
|
+
refinementStrategy: 'best-available',
|
|
102
|
+
zRange: null,
|
|
103
|
+
maxRequests: 6,
|
|
104
|
+
zoomOffset: 0,
|
|
105
|
+
|
|
106
|
+
// onTileLoad: (tile: Tile2DHeader) => void, // onTileUnload: (tile: Tile2DHeader) => void, // onTileError: (error: any, tile: Tile2DHeader) => void, /** Called when all tiles in the current viewport are loaded. */
|
|
107
|
+
// onViewportLoad: ((tiles: Tile2DHeader<DataT>[]) => void) | null,
|
|
108
|
+
onTileLoad: () => {},
|
|
109
|
+
onTileUnload: () => {},
|
|
110
|
+
onTileError: () => {}
|
|
67
111
|
};
|
|
68
112
|
|
|
69
113
|
/**
|
|
70
114
|
* Manages loading and purging of tile data. This class caches recently visited tiles
|
|
71
115
|
* and only creates new tiles if they are present.
|
|
72
116
|
*/
|
|
73
|
-
export
|
|
74
|
-
private opts: Tileset2DProps
|
|
117
|
+
export class Tileset2D {
|
|
118
|
+
private opts: Required<Tileset2DProps>;
|
|
75
119
|
private _requestScheduler: RequestScheduler;
|
|
76
120
|
private _cache: Map<string, Tile2DHeader>;
|
|
77
121
|
private _dirty: boolean;
|
|
@@ -95,10 +139,10 @@ export default class Tileset2D {
|
|
|
95
139
|
* Cache size defaults to 5 * number of tiles in the current viewport
|
|
96
140
|
*/
|
|
97
141
|
constructor(opts: Tileset2DProps) {
|
|
98
|
-
this.opts = opts;
|
|
142
|
+
this.opts = {...DEFAULT_TILESET2D_PROPS, ...opts};
|
|
99
143
|
|
|
100
144
|
this.onTileLoad = tile => {
|
|
101
|
-
this.opts.onTileLoad(tile);
|
|
145
|
+
this.opts.onTileLoad?.(tile);
|
|
102
146
|
if (this.opts.maxCacheByteSize) {
|
|
103
147
|
this._cacheByteSize += tile.byteLength;
|
|
104
148
|
this._resizeCache();
|
|
@@ -107,7 +151,7 @@ export default class Tileset2D {
|
|
|
107
151
|
|
|
108
152
|
this._requestScheduler = new RequestScheduler({
|
|
109
153
|
maxRequests: opts.maxRequests,
|
|
110
|
-
throttleRequests: opts.maxRequests > 0
|
|
154
|
+
throttleRequests: Boolean(opts.maxRequests && opts.maxRequests > 0)
|
|
111
155
|
});
|
|
112
156
|
|
|
113
157
|
// Maps tile id in string {z}-{x}-{y} to a Tile object
|
|
@@ -242,19 +286,27 @@ export default class Tileset2D {
|
|
|
242
286
|
}
|
|
243
287
|
|
|
244
288
|
if (cullRect && this._viewport) {
|
|
245
|
-
const
|
|
289
|
+
const boundsArr = this._getCullBounds({
|
|
246
290
|
viewport: this._viewport,
|
|
247
291
|
z: this._zRange,
|
|
248
292
|
cullRect
|
|
249
293
|
});
|
|
250
294
|
const {bbox} = tile;
|
|
251
|
-
|
|
252
|
-
|
|
295
|
+
for (const [minX, minY, maxX, maxY] of boundsArr) {
|
|
296
|
+
let overlaps;
|
|
297
|
+
if ('west' in bbox) {
|
|
298
|
+
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
299
|
+
} else {
|
|
300
|
+
// top/bottom could be swapped depending on the indexing system
|
|
301
|
+
const y0 = Math.min(bbox.top, bbox.bottom);
|
|
302
|
+
const y1 = Math.max(bbox.top, bbox.bottom);
|
|
303
|
+
overlaps = bbox.left < maxX && bbox.right > minX && y0 < maxY && y1 > minY;
|
|
304
|
+
}
|
|
305
|
+
if (overlaps) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
253
308
|
}
|
|
254
|
-
|
|
255
|
-
const y0 = Math.min(bbox.top, bbox.bottom);
|
|
256
|
-
const y1 = Math.max(bbox.top, bbox.bottom);
|
|
257
|
-
return bbox.left < maxX && bbox.right > minX && y0 < maxY && y1 > minY;
|
|
309
|
+
return false;
|
|
258
310
|
}
|
|
259
311
|
return true;
|
|
260
312
|
}
|
|
@@ -358,7 +410,7 @@ export default class Tileset2D {
|
|
|
358
410
|
private _getCullBounds = memoize(getCullBounds);
|
|
359
411
|
|
|
360
412
|
private _pruneRequests(): void {
|
|
361
|
-
const {maxRequests} = this.opts;
|
|
413
|
+
const {maxRequests = 0} = this.opts;
|
|
362
414
|
|
|
363
415
|
const abortCandidates: Tile2DHeader[] = [];
|
|
364
416
|
let ongoingRequestCount = 0;
|
|
@@ -419,11 +471,11 @@ export default class Tileset2D {
|
|
|
419
471
|
|
|
420
472
|
if (overflown) {
|
|
421
473
|
for (const [id, tile] of _cache) {
|
|
422
|
-
if (!tile.isVisible) {
|
|
474
|
+
if (!tile.isVisible && !tile.isSelected) {
|
|
423
475
|
// delete tile
|
|
424
476
|
this._cacheByteSize -= opts.maxCacheByteSize ? tile.byteLength : 0;
|
|
425
477
|
_cache.delete(id);
|
|
426
|
-
this.opts.onTileUnload(tile);
|
|
478
|
+
this.opts.onTileUnload?.(tile);
|
|
427
479
|
}
|
|
428
480
|
if (_cache.size <= maxCacheSize && this._cacheByteSize <= maxCacheByteSize) {
|
|
429
481
|
break;
|
|
File without changes
|
|
@@ -6,14 +6,16 @@ import {Bounds, GeoBoundingBox, TileBoundingBox, TileIndex, ZRange} from './type
|
|
|
6
6
|
const TILE_SIZE = 512;
|
|
7
7
|
const DEFAULT_EXTENT: Bounds = [-Infinity, -Infinity, Infinity, Infinity];
|
|
8
8
|
|
|
9
|
+
export type URLTemplate = string | string[] | null;
|
|
10
|
+
|
|
9
11
|
export const urlType = {
|
|
10
|
-
type: '
|
|
11
|
-
value: null,
|
|
12
|
+
type: 'object' as const,
|
|
13
|
+
value: null as URLTemplate,
|
|
12
14
|
validate: (value, propType) =>
|
|
13
15
|
(propType.optional && value === null) ||
|
|
14
16
|
typeof value === 'string' ||
|
|
15
17
|
(Array.isArray(value) && value.every(url => typeof url === 'string')),
|
|
16
|
-
|
|
18
|
+
equal: (value1, value2) => {
|
|
17
19
|
if (value1 === value2) {
|
|
18
20
|
return true;
|
|
19
21
|
}
|
|
@@ -62,7 +64,7 @@ function stringHash(s: string): number {
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
export function getURLFromTemplate(
|
|
65
|
-
template:
|
|
67
|
+
template: URLTemplate,
|
|
66
68
|
tile: {
|
|
67
69
|
index: TileIndex;
|
|
68
70
|
id: string;
|
|
@@ -130,7 +132,7 @@ function getBoundingBox(viewport: Viewport, zRange: number[] | null, extent: Bou
|
|
|
130
132
|
/** Get culling bounds in world space */
|
|
131
133
|
export function getCullBounds({
|
|
132
134
|
viewport,
|
|
133
|
-
z,
|
|
135
|
+
z = 0,
|
|
134
136
|
cullRect
|
|
135
137
|
}: {
|
|
136
138
|
/** Current viewport */
|
|
@@ -139,13 +141,25 @@ export function getCullBounds({
|
|
|
139
141
|
z: ZRange | number | undefined;
|
|
140
142
|
/** Culling rectangle in screen space */
|
|
141
143
|
cullRect: {x: number; y: number; width: number; height: number};
|
|
142
|
-
}): [number, number, number, number] {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
}): [number, number, number, number][] {
|
|
145
|
+
const subViewports = viewport.subViewports || [viewport];
|
|
146
|
+
return subViewports.map(v => getCullBoundsInViewport(v, z, cullRect));
|
|
147
|
+
}
|
|
146
148
|
|
|
149
|
+
function getCullBoundsInViewport(
|
|
150
|
+
/** Current viewport */
|
|
151
|
+
viewport: Viewport,
|
|
152
|
+
/** At altitude */
|
|
153
|
+
z: ZRange | number,
|
|
154
|
+
/** Culling rectangle in screen space */
|
|
155
|
+
cullRect: {x: number; y: number; width: number; height: number}
|
|
156
|
+
): [number, number, number, number] {
|
|
147
157
|
if (!Array.isArray(z)) {
|
|
148
|
-
const
|
|
158
|
+
const x = cullRect.x - viewport.x;
|
|
159
|
+
const y = cullRect.y - viewport.y;
|
|
160
|
+
const {width, height} = cullRect;
|
|
161
|
+
|
|
162
|
+
const unprojectOption = {targetZ: z};
|
|
149
163
|
|
|
150
164
|
const topLeft = viewport.unproject([x, y], unprojectOption);
|
|
151
165
|
const topRight = viewport.unproject([x + width, y], unprojectOption);
|
|
@@ -160,8 +174,8 @@ export function getCullBounds({
|
|
|
160
174
|
];
|
|
161
175
|
}
|
|
162
176
|
|
|
163
|
-
const bounds0 =
|
|
164
|
-
const bounds1 =
|
|
177
|
+
const bounds0 = getCullBoundsInViewport(viewport, z[0], cullRect);
|
|
178
|
+
const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
|
|
165
179
|
|
|
166
180
|
return [
|
|
167
181
|
Math.min(bounds0[0], bounds1[0]),
|
|
@@ -56,7 +56,7 @@ type _TripsLayerProps<DataT = any> = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
/** Render animated paths that represent vehicle trips. */
|
|
59
|
-
export default class TripsLayer<DataT = any, ExtraProps = {}> extends PathLayer<
|
|
59
|
+
export default class TripsLayer<DataT = any, ExtraProps extends {} = {}> extends PathLayer<
|
|
60
60
|
DataT,
|
|
61
61
|
Required<_TripsLayerProps> & ExtraProps
|
|
62
62
|
> {
|
|
@@ -2,9 +2,9 @@ import { CompositeLayer, CompositeLayerProps, Layer, LayersList, DefaultProps }
|
|
|
2
2
|
import { PolygonLayerProps } from '@deck.gl/layers/typed';
|
|
3
3
|
/** All properties supported by GeoCellLayer. */
|
|
4
4
|
export declare type GeoCellLayerProps<DataT = any> = PolygonLayerProps<DataT> & CompositeLayerProps<DataT>;
|
|
5
|
-
export default class GeoCellLayer<DataT = any, ExtraProps = {}> extends CompositeLayer<Required<GeoCellLayerProps<DataT>> & ExtraProps> {
|
|
5
|
+
export default class GeoCellLayer<DataT = any, ExtraProps extends {} = {}> extends CompositeLayer<Required<GeoCellLayerProps<DataT>> & ExtraProps> {
|
|
6
6
|
static layerName: string;
|
|
7
|
-
static defaultProps: DefaultProps
|
|
7
|
+
static defaultProps: DefaultProps;
|
|
8
8
|
/** Implement to generate props to create geometry. */
|
|
9
9
|
indexToBounds(): Partial<GeoCellLayer['props']> | null;
|
|
10
10
|
renderLayers(): Layer | null | LayersList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoCellLayer.d.ts","sourceRoot":"","sources":["../../src/geo-cell-layer/GeoCellLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAe,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAMhE,gDAAgD;AAChD,oBAAY,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAEnG,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,EAAE,CAAE,SAAQ,cAAc,
|
|
1
|
+
{"version":3,"file":"GeoCellLayer.d.ts","sourceRoot":"","sources":["../../src/geo-cell-layer/GeoCellLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAe,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAMhE,gDAAgD;AAChD,oBAAY,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAEnG,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,cAAc,CAC/F,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAChD;IACC,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAgB;IAEjD,sDAAsD;IACtD,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI;IAItD,YAAY,IAAI,KAAK,GAAG,IAAI,GAAG,UAAU;CA+D1C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
2
|
+
import { PolygonLayer } from '@deck.gl/layers';
|
|
3
|
+
const defaultProps = {
|
|
4
|
+
...PolygonLayer.defaultProps
|
|
5
|
+
};
|
|
6
|
+
export default class GeoCellLayer extends CompositeLayer {
|
|
7
|
+
/** Implement to generate props to create geometry. */
|
|
8
|
+
indexToBounds() {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
renderLayers() {
|
|
12
|
+
// Rendering props underlying layer
|
|
13
|
+
const { elevationScale, extruded, wireframe, filled, stroked, lineWidthUnits, lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels, lineJointRounded, lineMiterLimit, lineDashJustified, getElevation, getFillColor, getLineColor, getLineWidth } = this.props;
|
|
14
|
+
// Accessor props for underlying layers
|
|
15
|
+
const { updateTriggers, material, transitions } = this.props;
|
|
16
|
+
// Filled Polygon Layer
|
|
17
|
+
const CellLayer = this.getSubLayerClass('cell', PolygonLayer);
|
|
18
|
+
return new CellLayer({
|
|
19
|
+
filled,
|
|
20
|
+
wireframe,
|
|
21
|
+
extruded,
|
|
22
|
+
elevationScale,
|
|
23
|
+
stroked,
|
|
24
|
+
lineWidthUnits,
|
|
25
|
+
lineWidthScale,
|
|
26
|
+
lineWidthMinPixels,
|
|
27
|
+
lineWidthMaxPixels,
|
|
28
|
+
lineJointRounded,
|
|
29
|
+
lineMiterLimit,
|
|
30
|
+
lineDashJustified,
|
|
31
|
+
material,
|
|
32
|
+
transitions,
|
|
33
|
+
getElevation,
|
|
34
|
+
getFillColor,
|
|
35
|
+
getLineColor,
|
|
36
|
+
getLineWidth
|
|
37
|
+
}, this.getSubLayerProps({
|
|
38
|
+
id: 'cell',
|
|
39
|
+
updateTriggers: updateTriggers && {
|
|
40
|
+
getElevation: updateTriggers.getElevation,
|
|
41
|
+
getFillColor: updateTriggers.getFillColor,
|
|
42
|
+
getLineColor: updateTriggers.getLineColor,
|
|
43
|
+
getLineWidth: updateTriggers.getLineWidth
|
|
44
|
+
}
|
|
45
|
+
}), this.indexToBounds());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
GeoCellLayer.layerName = 'GeoCellLayer';
|
|
49
|
+
GeoCellLayer.defaultProps = defaultProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessorFunction } from '@deck.gl/core/typed';
|
|
1
|
+
import { AccessorFunction, DefaultProps } from '@deck.gl/core/typed';
|
|
2
2
|
import GeoCellLayer from '../geo-cell-layer/GeoCellLayer';
|
|
3
3
|
/**
|
|
4
4
|
* Properties of `GeohashLayer`.
|
|
@@ -12,9 +12,9 @@ declare type GeohashLayerProps<DataT = any> = {
|
|
|
12
12
|
getGeohash?: AccessorFunction<DataT, string>;
|
|
13
13
|
};
|
|
14
14
|
/** Render filled and/or stroked polygons based on the [Geohash](https://en.wikipedia.org/wiki/Geohash) geospatial indexing system. */
|
|
15
|
-
export default class GeohashLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<DataT, Required<GeohashLayerProps> & ExtraProps> {
|
|
15
|
+
export default class GeohashLayer<DataT = any, ExtraProps extends {} = {}> extends GeoCellLayer<DataT, Required<GeohashLayerProps> & ExtraProps> {
|
|
16
16
|
static layerName: string;
|
|
17
|
-
static defaultProps: any
|
|
17
|
+
static defaultProps: DefaultProps<GeohashLayerProps<any>>;
|
|
18
18
|
indexToBounds(): Partial<GeoCellLayer['props']> | null;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geohash-layer.d.ts","sourceRoot":"","sources":["../../src/geohash-layer/geohash-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"geohash-layer.d.ts","sourceRoot":"","sources":["../../src/geohash-layer/geohash-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC7D,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAO1D;;GAEG;AACH,aAAK,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,sIAAsI;AACtI,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,YAAY,CAC7F,KAAK,EACL,QAAQ,CAAC,iBAAiB,CAAC,GAAG,UAAU,CACzC;IACC,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,uCAAgB;IAEnC,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI;CAUvD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DefaultProps } from '@deck.gl/core/typed';
|
|
1
2
|
import { ArcLayer, ArcLayerProps } from '@deck.gl/layers/typed';
|
|
2
3
|
/** All properties supported by GreatCircleLayer. */
|
|
3
4
|
export declare type GreatCircleLayerProps<DataT = any> = ArcLayerProps<DataT>;
|
|
4
5
|
/** @deprecated Use ArcLayer with `greatCircle: true` instead */
|
|
5
|
-
export default class GreatCircleLayer<DataT = any, ExtraProps = {}> extends ArcLayer<DataT, ExtraProps> {
|
|
6
|
+
export default class GreatCircleLayer<DataT = any, ExtraProps extends {} = {}> extends ArcLayer<DataT, ExtraProps> {
|
|
6
7
|
static layerName: string;
|
|
7
|
-
static defaultProps: any
|
|
8
|
+
static defaultProps: DefaultProps<ArcLayerProps<any>>;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=great-circle-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"great-circle-layer.d.ts","sourceRoot":"","sources":["../../src/great-circle-layer/great-circle-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"great-circle-layer.d.ts","sourceRoot":"","sources":["../../src/great-circle-layer/great-circle-layer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAOxD,oDAAoD;AACpD,oBAAY,qBAAqB,CAAC,KAAK,GAAG,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AAItE,gEAAgE;AAChE,MAAM,CAAC,OAAO,OAAO,gBAAgB,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,QAAQ,CAC7F,KAAK,EACL,UAAU,CACX;IACC,MAAM,CAAC,SAAS,SAAsB;IACtC,MAAM,CAAC,YAAY,mCAAgB;CACpC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
// in the Software without restriction, including without limitation the rights
|
|
6
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
// furnished to do so, subject to the following conditions:
|
|
9
|
+
//
|
|
10
|
+
// The above copyright notice and this permission notice shall be included in
|
|
11
|
+
// all copies or substantial portions of the Software.
|
|
12
|
+
//
|
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
// THE SOFTWARE.
|
|
20
|
+
import { ArcLayer } from '@deck.gl/layers';
|
|
21
|
+
// This layer has been merged into the core ArcLayer
|
|
22
|
+
// Keeping for backward-compatibility
|
|
23
|
+
export default class GreatCircleLayer extends ArcLayer {
|
|
24
|
+
}
|
|
25
|
+
GreatCircleLayer.layerName = 'GreatCircleLayer';
|
|
26
|
+
GreatCircleLayer.defaultProps = {
|
|
27
|
+
getHeight: { type: 'accessor', value: 0 },
|
|
28
|
+
greatCircle: true
|
|
29
|
+
};
|
|
@@ -12,7 +12,7 @@ declare type _H3ClusterLayerProps<DataT> = {
|
|
|
12
12
|
*/
|
|
13
13
|
getHexagons?: AccessorFunction<DataT, H3IndexInput[]>;
|
|
14
14
|
};
|
|
15
|
-
export default class H3ClusterLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<DataT, Required<_H3ClusterLayerProps<DataT>> & ExtraProps> {
|
|
15
|
+
export default class H3ClusterLayer<DataT = any, ExtraProps extends {} = {}> extends GeoCellLayer<DataT, Required<_H3ClusterLayerProps<DataT>> & ExtraProps> {
|
|
16
16
|
static layerName: string;
|
|
17
17
|
static defaultProps: DefaultProps<H3ClusterLayerProps<any>>;
|
|
18
18
|
initializeState(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h3-cluster-layer.d.ts","sourceRoot":"","sources":["../../src/h3-layers/h3-cluster-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAC,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,gBAAgB,EAAkB,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE/F,OAAO,YAAY,EAAE,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAM/E,kDAAkD;AAClD,oBAAY,mBAAmB,CAAC,KAAK,GAAG,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,GACxE,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAE3B,0CAA0C;AAC1C,aAAK,oBAAoB,CAAC,KAAK,IAAI;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,cAAc,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,EAAE,CAAE,SAAQ,YAAY,
|
|
1
|
+
{"version":3,"file":"h3-cluster-layer.d.ts","sourceRoot":"","sources":["../../src/h3-layers/h3-cluster-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAC,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,gBAAgB,EAAkB,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE/F,OAAO,YAAY,EAAE,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAM/E,kDAAkD;AAClD,oBAAY,mBAAmB,CAAC,KAAK,GAAG,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,GACxE,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAE3B,0CAA0C;AAC1C,aAAK,oBAAoB,CAAC,KAAK,IAAI;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,cAAc,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,YAAY,CAC/F,KAAK,EACL,QAAQ,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CACnD;IACC,MAAM,CAAC,SAAS,SAAoB;IACpC,MAAM,CAAC,YAAY,yCAAgB;IAEnC,eAAe,IAAI,IAAI;IAIvB,WAAW,CAAC,EAAC,KAAK,EAAE,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAuB/D,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;CAMhD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { h3SetToMultiPolygon } from 'h3-js';
|
|
2
|
+
import { createIterable } from '@deck.gl/core';
|
|
3
|
+
import GeoCellLayer from '../geo-cell-layer/GeoCellLayer';
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
getHexagons: { type: 'accessor', value: d => d.hexagons }
|
|
6
|
+
};
|
|
7
|
+
export default class H3ClusterLayer extends GeoCellLayer {
|
|
8
|
+
updateState({ props, oldProps, changeFlags }) {
|
|
9
|
+
if (changeFlags.dataChanged ||
|
|
10
|
+
(changeFlags.updateTriggers && changeFlags.updateTriggers.getHexagons)) {
|
|
11
|
+
const { data, getHexagons } = props;
|
|
12
|
+
const polygons = [];
|
|
13
|
+
const { iterable, objectInfo } = createIterable(data);
|
|
14
|
+
for (const object of iterable) {
|
|
15
|
+
objectInfo.index++;
|
|
16
|
+
const hexagons = getHexagons(object, objectInfo);
|
|
17
|
+
const multiPolygon = h3SetToMultiPolygon(hexagons, true);
|
|
18
|
+
for (const polygon of multiPolygon) {
|
|
19
|
+
polygons.push(this.getSubLayerRow({ polygon }, object, objectInfo.index));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
this.setState({ polygons });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
indexToBounds() {
|
|
26
|
+
return {
|
|
27
|
+
data: this.state.polygons,
|
|
28
|
+
getPolygon: d => d.polygon
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
H3ClusterLayer.defaultProps = defaultProps;
|
|
33
|
+
H3ClusterLayer.layerName = 'H3ClusterLayer';
|
|
@@ -36,7 +36,7 @@ declare type _H3HexagonLayerProps<DataT> = {
|
|
|
36
36
|
/**
|
|
37
37
|
* Render hexagons from the [H3](https://h3geo.org/) geospatial indexing system.
|
|
38
38
|
*/
|
|
39
|
-
export default class H3HexagonLayer<DataT = any, ExtraPropsT = {}> extends CompositeLayer<ExtraPropsT & Required<_H3HexagonLayerProps<DataT> & Required<PolygonLayerProps<DataT>>>> {
|
|
39
|
+
export default class H3HexagonLayer<DataT = any, ExtraPropsT extends {} = {}> extends CompositeLayer<ExtraPropsT & Required<_H3HexagonLayerProps<DataT> & Required<PolygonLayerProps<DataT>>>> {
|
|
40
40
|
static defaultProps: DefaultProps<H3HexagonLayerProps<any>>;
|
|
41
41
|
static layerName: string;
|
|
42
42
|
static _checkH3Lib: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h3-hexagon-layer.d.ts","sourceRoot":"","sources":["../../src/h3-layers/h3-hexagon-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,OAAO,EACR,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EAEnB,KAAK,EACL,UAAU,EACV,gBAAgB,EAEhB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAA4B,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAQ7E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAU/E;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAcvF;AAqDD,iDAAiD;AACjD,oBAAY,mBAAmB,CAAC,KAAK,GAAG,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,GACxE,iBAAiB,CAAC,KAAK,CAAC,GACxB,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAE7B,wCAAwC;AACxC,aAAK,oBAAoB,CAAC,KAAK,IAAI;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc,
|
|
1
|
+
{"version":3,"file":"h3-hexagon-layer.d.ts","sourceRoot":"","sources":["../../src/h3-layers/h3-hexagon-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,OAAO,EACR,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EAEnB,KAAK,EACL,UAAU,EACV,gBAAgB,EAEhB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAA4B,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAQ7E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAU/E;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAcvF;AAqDD,iDAAiD;AACjD,oBAAY,mBAAmB,CAAC,KAAK,GAAG,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,GACxE,iBAAiB,CAAC,KAAK,CAAC,GACxB,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAE7B,wCAAwC;AACxC,aAAK,oBAAoB,CAAC,KAAK,IAAI;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc,CACjC,KAAK,GAAG,GAAG,EACX,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,cAAc,CACtB,WAAW,GAAG,QAAQ,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CACzF;IACC,MAAM,CAAC,YAAY,yCAAgB;IACnC,MAAM,CAAC,SAAS,SAAoB;IAGpC,MAAM,CAAC,WAAW,aAAY;IAE9B,eAAe;IAQf,KAAK,EAAG;QACN,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;KACvB,CAAC;IAEF,iBAAiB,CAAC,EAAC,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,OAAO;IAMjE,WAAW,CAAC,EAAC,KAAK,EAAE,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAa/D,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,eAAe;IAuCvB,YAAY,IAAI,KAAK,GAAG,IAAI,GAAG,UAAU;IAIzC,OAAO,CAAC,gBAAgB;IAsDxB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,kBAAkB;CAuB3B"}
|