@deck.gl/geo-layers 9.2.0-alpha.3 → 9.2.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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "deck.gl layers supporting geospatial use cases and GIS formats",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "9.2.0-alpha.3",
6
+ "version": "9.2.0-beta.2",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -46,13 +46,13 @@
46
46
  "@loaders.gl/terrain": "^4.2.0",
47
47
  "@loaders.gl/tiles": "^4.2.0",
48
48
  "@loaders.gl/wms": "^4.2.0",
49
- "@luma.gl/gltf": "^9.2.0-alpha.5",
50
- "@luma.gl/shadertools": "^9.2.0-alpha.5",
49
+ "@luma.gl/gltf": "^9.2.0",
50
+ "@luma.gl/shadertools": "^9.2.0",
51
51
  "@math.gl/core": "^4.1.0",
52
52
  "@math.gl/culling": "^4.1.0",
53
53
  "@math.gl/web-mercator": "^4.1.0",
54
54
  "@types/geojson": "^7946.0.8",
55
- "a5-js": "^0.4.0",
55
+ "a5-js": "^0.5.0",
56
56
  "h3-js": "^4.1.0",
57
57
  "long": "^3.2.0"
58
58
  },
@@ -62,8 +62,8 @@
62
62
  "@deck.gl/layers": "^9.1.0",
63
63
  "@deck.gl/mesh-layers": "^9.1.0",
64
64
  "@loaders.gl/core": "^4.2.0",
65
- "@luma.gl/core": "^9.2.0-alpha.5",
66
- "@luma.gl/engine": "^9.2.0-alpha.5"
65
+ "@luma.gl/core": "^9.2.0",
66
+ "@luma.gl/engine": "^9.2.0"
67
67
  },
68
- "gitHead": "f34ff252c38397cd37d7d443e16ba906fda7d3c9"
68
+ "gitHead": "d4804c69863b62a32dda0d1942ab209000f2ffdf"
69
69
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {AccessorFunction, DefaultProps} from '@deck.gl/core';
6
6
  import GeoCellLayer, {GeoCellLayerProps} from '../geo-cell-layer/GeoCellLayer';
7
- import {cellToBoundary, hexToBigInt} from 'a5-js';
7
+ import {cellToBoundary, hexToU64} from 'a5-js';
8
8
  import {flattenPolygon} from '../h3-layers/h3-utils';
9
9
 
10
10
  const defaultProps: DefaultProps<A5LayerProps> = {
@@ -43,7 +43,7 @@ export default class A5Layer<DataT = any, ExtraProps extends {} = {}> extends Ge
43
43
  getPolygon: (x: DataT, objectInfo) => {
44
44
  const pentagon = getPentagon(x, objectInfo);
45
45
  const boundary = cellToBoundary(
46
- typeof pentagon === 'string' ? hexToBigInt(pentagon) : pentagon,
46
+ typeof pentagon === 'string' ? hexToU64(pentagon) : pentagon,
47
47
  {closedRing: true, segments: 'auto'}
48
48
  );
49
49
  return flattenPolygon(boundary);
@@ -26,6 +26,7 @@ import {
26
26
  Tileset2DProps
27
27
  } from '../tileset-2d/index';
28
28
  import {urlType, URLTemplate, getURLFromTemplate} from '../tileset-2d/index';
29
+ import {Matrix4} from '@math.gl/core';
29
30
 
30
31
  const defaultProps: DefaultProps<TileLayerProps> = {
31
32
  TilesetClass: Tileset2D,
@@ -401,6 +402,11 @@ export default class TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends
401
402
 
402
403
  filterSubLayer({layer, cullRect}: FilterContext) {
403
404
  const {tile} = (layer as Layer<{tile: Tile2DHeader}>).props;
404
- return this.state.tileset!.isTileVisible(tile, cullRect);
405
+ const {modelMatrix} = this.props;
406
+ return this.state.tileset!.isTileVisible(
407
+ tile,
408
+ cullRect,
409
+ modelMatrix ? new Matrix4(modelMatrix) : null
410
+ );
405
411
  }
406
412
  }
@@ -9,7 +9,7 @@ import {Matrix4, equals, NumericArray} from '@math.gl/core';
9
9
 
10
10
  import {Tile2DHeader} from './tile-2d-header';
11
11
 
12
- import {getTileIndices, tileToBoundingBox, getCullBounds} from './utils';
12
+ import {getTileIndices, tileToBoundingBox, getCullBounds, transformBox} from './utils';
13
13
  import {Bounds, TileIndex, ZRange} from './types';
14
14
  import {TileLoadProps} from './types';
15
15
  import {memoize} from './memoize';
@@ -291,7 +291,8 @@ export class Tileset2D {
291
291
  // eslint-disable-next-line complexity
292
292
  isTileVisible(
293
293
  tile: Tile2DHeader,
294
- cullRect?: {x: number; y: number; width: number; height: number}
294
+ cullRect?: {x: number; y: number; width: number; height: number},
295
+ modelMatrix?: Matrix4 | null
295
296
  ): boolean {
296
297
  if (!tile.isVisible) {
297
298
  return false;
@@ -303,12 +304,19 @@ export class Tileset2D {
303
304
  z: this._zRange,
304
305
  cullRect
305
306
  });
306
- const {bbox} = tile;
307
+ let {bbox} = tile;
307
308
  for (const [minX, minY, maxX, maxY] of boundsArr) {
308
309
  let overlaps;
309
310
  if ('west' in bbox) {
310
311
  overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
311
312
  } else {
313
+ if (modelMatrix && !Matrix4.IDENTITY.equals(modelMatrix)) {
314
+ const [left, top, right, bottom] = transformBox(
315
+ [bbox.left, bbox.top, bbox.right, bbox.bottom],
316
+ modelMatrix
317
+ );
318
+ bbox = {left, top, right, bottom};
319
+ }
312
320
  // top/bottom could be swapped depending on the indexing system
313
321
  const y0 = Math.min(bbox.top, bbox.bottom);
314
322
  const y1 = Math.max(bbox.top, bbox.bottom);
@@ -39,7 +39,7 @@ export const urlType = {
39
39
  }
40
40
  };
41
41
 
42
- function transformBox(bbox: Bounds, modelMatrix: Matrix4): Bounds {
42
+ export function transformBox(bbox: Bounds, modelMatrix: Matrix4): Bounds {
43
43
  const transformedCoords = [
44
44
  // top-left
45
45
  modelMatrix.transformAsPoint([bbox[0], bbox[1]]),