@gisatcz/deckgl-geolib 1.11.0-dev.6 → 1.11.0-dev.8

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/cjs/index.js CHANGED
@@ -15523,13 +15523,6 @@ const defaultProps$1 = Object.assign(Object.assign({}, geoLayers.TileLayer.defau
15523
15523
  // },
15524
15524
  // Supply url to local terrain worker bundle. Only required if running offline and cannot access CDN.
15525
15525
  workerUrl: '' });
15526
- // Turns array of templates into a single string to work around shallow change
15527
- function urlTemplateToUpdateTrigger$1(template) {
15528
- if (Array.isArray(template)) {
15529
- return template.join(';');
15530
- }
15531
- return template || '';
15532
- }
15533
15526
  /** Render bitmap texture from cog raster images. */
15534
15527
  class CogBitmapLayer extends core.CompositeLayer {
15535
15528
  // private _isLoaded: boolean;
@@ -15550,16 +15543,15 @@ class CogBitmapLayer extends core.CompositeLayer {
15550
15543
  bitmapCogTiles: new CogTiles(this.props.cogBitmapOptions),
15551
15544
  initialized: false,
15552
15545
  });
15553
- yield this.init(this.rasterUrl);
15546
+ yield this.init();
15554
15547
  });
15555
15548
  }
15556
- init(rasterUrl) {
15549
+ init() {
15557
15550
  return __awaiter(this, void 0, void 0, function* () {
15558
15551
  const cog = yield this.state.bitmapCogTiles.initializeCog(this.props.rasterData);
15559
- // this.tileSize = this.terrainCogTiles.getTileSize(cog);
15560
15552
  const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
15561
- [this.minZoom, this.maxZoom] = zoomRange;
15562
- this.setState({ initialized: true });
15553
+ const [minZoom, maxZoom] = zoomRange;
15554
+ this.setState({ initialized: true, minZoom, maxZoom });
15563
15555
  });
15564
15556
  }
15565
15557
  updateState({ props, oldProps }) {
@@ -15567,8 +15559,8 @@ class CogBitmapLayer extends core.CompositeLayer {
15567
15559
  if (rasterDataChanged) {
15568
15560
  const { rasterData } = props;
15569
15561
  const isTiled = rasterData
15570
- && (Array.isArray(rasterData)
15571
- || (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled;
15562
+ && ((Array.isArray(rasterData)
15563
+ || (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled);
15572
15564
  this.setState({ isTiled });
15573
15565
  }
15574
15566
  // Reloading for single terrain mesh
@@ -15585,26 +15577,10 @@ class CogBitmapLayer extends core.CompositeLayer {
15585
15577
  }
15586
15578
  getTiledBitmapData(tile) {
15587
15579
  return __awaiter(this, void 0, void 0, function* () {
15588
- // const {
15589
- // rasterData, fetch,
15590
- // } = this.props;
15591
- const { viewport } = this.context;
15592
- let bottomLeft = [0, 0];
15593
- let topRight = [0, 0];
15594
- if (viewport.isGeospatial) {
15595
- const bbox = tile.bbox;
15596
- bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
15597
- topRight = viewport.projectFlat([bbox.east, bbox.north]);
15598
- }
15599
- else {
15600
- const bbox = tile.bbox;
15601
- bottomLeft = [bbox.left, bbox.bottom];
15602
- topRight = [bbox.right, bbox.top];
15603
- }
15604
- [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
15605
15580
  // TODO - pass signal to getTile
15606
15581
  // abort request if signal is aborted
15607
- return yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
15582
+ const tileData = yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
15583
+ return tileData;
15608
15584
  });
15609
15585
  }
15610
15586
  renderSubLayers(props) {
@@ -15616,7 +15592,7 @@ class CogBitmapLayer extends core.CompositeLayer {
15616
15592
  return null;
15617
15593
  }
15618
15594
  const { bbox: { west, south, east, north, }, } = props.tile;
15619
- return new SubLayerClass(Object.assign(Object.assign({}, props), { tileSize: 256 }), Object.assign({ data: null, image: data, _instanced: false, bounds: [west, south, east, north], opacity, textureParameters: {
15595
+ return new SubLayerClass(Object.assign(Object.assign({}, props), { tileSize: this.state.bitmapCogTiles.tileSize }), Object.assign({ data: null, image: data, _instanced: false, bounds: [west, south, east, north], opacity, textureParameters: {
15620
15596
  minFilter: blurredTexture ? 'linear' : 'nearest',
15621
15597
  magFilter: blurredTexture ? 'linear' : 'nearest',
15622
15598
  },
@@ -15626,8 +15602,11 @@ class CogBitmapLayer extends core.CompositeLayer {
15626
15602
  : {})));
15627
15603
  }
15628
15604
  renderLayers() {
15629
- const { rasterData, blurredTexture, opacity, clampToTerrain, tileSize, maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, } = this.props;
15605
+ const { rasterData, blurredTexture, opacity, clampToTerrain,
15606
+ // tileSize,
15607
+ maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, cogBitmapOptions, } = this.props;
15630
15608
  if (this.state.isTiled && this.state.initialized) {
15609
+ const { tileSize } = this.state.bitmapCogTiles;
15631
15610
  return new geoLayers.TileLayer(this.getSubLayerProps({
15632
15611
  id: 'tiles',
15633
15612
  }), {
@@ -15635,17 +15614,18 @@ class CogBitmapLayer extends core.CompositeLayer {
15635
15614
  renderSubLayers: this.renderSubLayers.bind(this),
15636
15615
  updateTriggers: {
15637
15616
  getTileData: {
15638
- rasterData: urlTemplateToUpdateTrigger$1(rasterData),
15617
+ // rasterData: urlTemplateToUpdateTrigger(rasterData),
15639
15618
  // blurredTexture,
15640
15619
  // opacity,
15620
+ // cogBitmapOptions,
15641
15621
  clampToTerrain,
15642
15622
  },
15643
15623
  },
15644
15624
  extent: this.state.bitmapCogTiles.cog
15645
15625
  ? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
15646
15626
  tileSize,
15647
- minZoom: this.minZoom,
15648
- maxZoom: this.maxZoom,
15627
+ minZoom: this.state.minZoom,
15628
+ maxZoom: this.state.maxZoom,
15649
15629
  maxRequests,
15650
15630
  onTileLoad,
15651
15631
  onTileUnload,