@gisatcz/deckgl-geolib 1.11.0-dev.5 → 1.11.0-dev.7

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
@@ -15216,6 +15216,9 @@ function getDelatinTileMesh(meshMaxError, width, height, terrain) {
15216
15216
 
15217
15217
  const EARTH_CIRCUMFERENCE = 40075000.0;
15218
15218
  const EARTH_HALF_CIRCUMFERENCE = 20037500.0;
15219
+ const CogTilesGeoImageOptionsDefaults = {
15220
+ blurredTexture: true,
15221
+ };
15219
15222
  class CogTiles {
15220
15223
  constructor(options) {
15221
15224
  this.zoomRange = [0, 0];
@@ -15224,7 +15227,7 @@ class CogTiles {
15224
15227
  this.loaded = false;
15225
15228
  this.geo = new GeoImage();
15226
15229
  this.lzw = new LZWDecoder$1();
15227
- this.options = options;
15230
+ this.options = Object.assign(Object.assign({}, CogTilesGeoImageOptionsDefaults), options);
15228
15231
  }
15229
15232
  initializeCog(url) {
15230
15233
  return __awaiter(this, void 0, void 0, function* () {
@@ -15537,7 +15540,6 @@ class CogBitmapLayer extends core.CompositeLayer {
15537
15540
  //
15538
15541
  // tileSize: number;
15539
15542
  //
15540
- // blurredTexture: boolean;
15541
15543
  initializeState(context) {
15542
15544
  const _super = Object.create(null, {
15543
15545
  initializeState: { get: () => super.initializeState }
@@ -15548,16 +15550,15 @@ class CogBitmapLayer extends core.CompositeLayer {
15548
15550
  bitmapCogTiles: new CogTiles(this.props.cogBitmapOptions),
15549
15551
  initialized: false,
15550
15552
  });
15551
- yield this.init(this.rasterUrl);
15553
+ yield this.init();
15552
15554
  });
15553
15555
  }
15554
- init(rasterUrl) {
15556
+ init() {
15555
15557
  return __awaiter(this, void 0, void 0, function* () {
15556
15558
  const cog = yield this.state.bitmapCogTiles.initializeCog(this.props.rasterData);
15557
- // this.tileSize = this.terrainCogTiles.getTileSize(cog);
15558
15559
  const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
15559
- [this.minZoom, this.maxZoom] = zoomRange;
15560
- this.setState({ initialized: true });
15560
+ const [minZoom, maxZoom] = zoomRange;
15561
+ this.setState({ initialized: true, minZoom, maxZoom });
15561
15562
  });
15562
15563
  }
15563
15564
  updateState({ props, oldProps }) {
@@ -15565,8 +15566,8 @@ class CogBitmapLayer extends core.CompositeLayer {
15565
15566
  if (rasterDataChanged) {
15566
15567
  const { rasterData } = props;
15567
15568
  const isTiled = rasterData
15568
- && (Array.isArray(rasterData)
15569
- || (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled;
15569
+ && ((Array.isArray(rasterData)
15570
+ || (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled);
15570
15571
  this.setState({ isTiled });
15571
15572
  }
15572
15573
  // Reloading for single terrain mesh
@@ -15583,37 +15584,22 @@ class CogBitmapLayer extends core.CompositeLayer {
15583
15584
  }
15584
15585
  getTiledBitmapData(tile) {
15585
15586
  return __awaiter(this, void 0, void 0, function* () {
15586
- // const {
15587
- // rasterData, fetch,
15588
- // } = this.props;
15589
- const { viewport } = this.context;
15590
- let bottomLeft = [0, 0];
15591
- let topRight = [0, 0];
15592
- if (viewport.isGeospatial) {
15593
- const bbox = tile.bbox;
15594
- bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
15595
- topRight = viewport.projectFlat([bbox.east, bbox.north]);
15596
- }
15597
- else {
15598
- const bbox = tile.bbox;
15599
- bottomLeft = [bbox.left, bbox.bottom];
15600
- topRight = [bbox.right, bbox.top];
15601
- }
15602
- [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
15603
15587
  // TODO - pass signal to getTile
15604
15588
  // abort request if signal is aborted
15605
- return yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
15589
+ const tileData = yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
15590
+ return tileData;
15606
15591
  });
15607
15592
  }
15608
15593
  renderSubLayers(props) {
15609
15594
  const SubLayerClass = this.getSubLayerClass('image', layers.BitmapLayer);
15610
- const { blurredTexture, opacity, clampToTerrain } = this.props;
15595
+ const { blurredTexture } = this.state.bitmapCogTiles.options;
15596
+ const { opacity, clampToTerrain } = this.props;
15611
15597
  const { data } = props;
15612
15598
  if (!data) {
15613
15599
  return null;
15614
15600
  }
15615
15601
  const { bbox: { west, south, east, north, }, } = props.tile;
15616
- 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: {
15602
+ 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: {
15617
15603
  minFilter: blurredTexture ? 'linear' : 'nearest',
15618
15604
  magFilter: blurredTexture ? 'linear' : 'nearest',
15619
15605
  },
@@ -15623,8 +15609,11 @@ class CogBitmapLayer extends core.CompositeLayer {
15623
15609
  : {})));
15624
15610
  }
15625
15611
  renderLayers() {
15626
- const { rasterData, blurredTexture, opacity, clampToTerrain, tileSize, maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, } = this.props;
15612
+ const { rasterData, blurredTexture, opacity, clampToTerrain,
15613
+ // tileSize,
15614
+ maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, cogBitmapOptions, } = this.props;
15627
15615
  if (this.state.isTiled && this.state.initialized) {
15616
+ const { tileSize } = this.state.bitmapCogTiles;
15628
15617
  return new geoLayers.TileLayer(this.getSubLayerProps({
15629
15618
  id: 'tiles',
15630
15619
  }), {
@@ -15635,13 +15624,15 @@ class CogBitmapLayer extends core.CompositeLayer {
15635
15624
  rasterData: urlTemplateToUpdateTrigger$1(rasterData),
15636
15625
  // blurredTexture,
15637
15626
  // opacity,
15627
+ cogBitmapOptions,
15638
15628
  clampToTerrain,
15639
15629
  },
15640
15630
  },
15641
- extent: this.state.bitmapCogTiles.cog ? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
15631
+ extent: this.state.bitmapCogTiles.cog
15632
+ ? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
15642
15633
  tileSize,
15643
- minZoom: this.minZoom,
15644
- maxZoom: this.maxZoom,
15634
+ minZoom: this.state.minZoom,
15635
+ maxZoom: this.state.maxZoom,
15645
15636
  maxRequests,
15646
15637
  onTileLoad,
15647
15638
  onTileUnload,