@gisatcz/deckgl-geolib 1.3.1-dev.0 → 1.3.1-dev.1

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.
@@ -1,10 +1,15 @@
1
1
  import { CompositeLayer } from '@deck.gl/core';
2
- import { GeoImageOptions } from '../geoimage/geoimage';
2
+ import CogTiles from '../cogtiles/cogtiles.ts';
3
+ import { GeoImageOptions } from '../geoimage/geoimage.ts';
3
4
  declare class CogBitmapLayer extends CompositeLayer<any> {
4
5
  static layerName: string;
5
6
  id: string;
6
7
  url: string;
7
8
  static displayName: string;
9
+ cogTiles: CogTiles;
10
+ tileSize: number;
11
+ minZoom: number;
12
+ maxZoom: number;
8
13
  constructor(id: string, url: string, options: GeoImageOptions);
9
14
  initializeState(): void;
10
15
  init(url: string): Promise<void>;
@@ -1,7 +1,13 @@
1
1
  import { CompositeLayer } from '@deck.gl/core';
2
- import { GeoImageOptions } from '../geoimage/geoimage';
2
+ import CogTiles from '../cogtiles/cogtiles.ts';
3
+ import { GeoImageOptions } from '../geoimage/geoimage.ts';
3
4
  declare class CogTerrainLayer extends CompositeLayer<any> {
4
5
  static layerName: string;
6
+ terrainCogTiles: CogTiles;
7
+ bitmapCogTiles: CogTiles;
8
+ tileSize: number;
9
+ minZoom: number;
10
+ maxZoom: number;
5
11
  bitmapUrl: string;
6
12
  urlType: 'none' | 'tile' | 'cog';
7
13
  id: string;
@@ -1,6 +1,6 @@
1
1
  import { CogTiff, CogTiffImage } from '@cogeotiff/core';
2
- import LZWDecoder from './lzw';
3
- import GeoImage, { GeoImageOptions } from '../geoimage/geoimage';
2
+ import LZWDecoder from './lzw.js';
3
+ import GeoImage, { GeoImageOptions } from '../geoimage/geoimage.ts';
4
4
  declare class CogTiles {
5
5
  cog: CogTiff;
6
6
  zoomRange: number[];
@@ -1,7 +1,7 @@
1
- import CogBitmapLayer from './cogbitmaplayer/CogBitmapLayer';
2
- import CogTerrainLayer from './cogterrainlayer/CogTerrainLayer';
3
- import cogtiles from './cogtiles/cogtiles';
4
- import GeoImage from './geoimage/geoimage';
1
+ import CogBitmapLayer from './cogbitmaplayer/CogBitmapLayer.ts';
2
+ import CogTerrainLayer from './cogterrainlayer/CogTerrainLayer.ts';
3
+ import cogtiles from './cogtiles/cogtiles.ts';
4
+ import GeoImage from './geoimage/geoimage.ts';
5
5
  declare const _default: {
6
6
  CogBitmapLayer: typeof CogBitmapLayer;
7
7
  CogTerrainLayer: typeof CogTerrainLayer;
package/dist/esm/index.js CHANGED
@@ -109668,10 +109668,6 @@ class CogTiles {
109668
109668
  }
109669
109669
  }
109670
109670
 
109671
- let cogTiles;
109672
- let tileSize$1;
109673
- let minZoom$1;
109674
- let maxZoom$1;
109675
109671
  // let needsRerender: boolean = false;
109676
109672
  // let extent = [0, 0, 0, 0]
109677
109673
  class CogBitmapLayer extends CompositeLayer {
@@ -109684,7 +109680,7 @@ class CogBitmapLayer extends CompositeLayer {
109684
109680
  // initialized: false,
109685
109681
  // };
109686
109682
  // this._isLoaded = false;
109687
- cogTiles = new CogTiles(options);
109683
+ this.cogTiles = new CogTiles(options);
109688
109684
  this.url = url;
109689
109685
  // setTimeout(() => {
109690
109686
  // this.init(url);
@@ -109698,11 +109694,11 @@ class CogBitmapLayer extends CompositeLayer {
109698
109694
  }
109699
109695
  init(url) {
109700
109696
  return __awaiter(this, void 0, void 0, function* () {
109701
- const cog = yield cogTiles.initializeCog(url);
109697
+ const cog = yield this.cogTiles.initializeCog(url);
109702
109698
  this.setState({ initialized: true });
109703
- tileSize$1 = cogTiles.getTileSize(cog);
109704
- const zoomRange = cogTiles.getZoomRange(cog);
109705
- [minZoom$1, maxZoom$1] = zoomRange;
109699
+ this.tileSize = this.cogTiles.getTileSize(cog);
109700
+ const zoomRange = this.cogTiles.getZoomRange(cog);
109701
+ [this.minZoom, this.maxZoom] = zoomRange;
109706
109702
  // console.log(zoomRange)
109707
109703
  // extent = cogTiles.getBoundsAsLatLon(cog)
109708
109704
  // console.log(extent)
@@ -109710,15 +109706,15 @@ class CogBitmapLayer extends CompositeLayer {
109710
109706
  });
109711
109707
  }
109712
109708
  renderLayers() {
109713
- if (cogTiles.cog) {
109709
+ if (this.cogTiles.cog) {
109714
109710
  const layer = new TileLayer({
109715
109711
  id: `${this.id}-${String(performance.now())}`,
109716
- getTileData: (tileData) => cogTiles.getTile(tileData.index.x, tileData.index.y, tileData.index.z),
109717
- minZoom: minZoom$1,
109718
- maxZoom: maxZoom$1,
109719
- tileSize: tileSize$1,
109712
+ getTileData: (tileData) => this.cogTiles.getTile(tileData.index.x, tileData.index.y, tileData.index.z),
109713
+ minZoom: this.minZoom,
109714
+ maxZoom: this.maxZoom,
109715
+ tileSize: this.tileSize,
109720
109716
  maxRequests: 6,
109721
- extent: cogTiles.cog ? cogTiles.getBoundsAsLatLon(cogTiles.cog) : null,
109717
+ extent: this.cogTiles.cog ? this.cogTiles.getBoundsAsLatLon(this.cogTiles.cog) : null,
109722
109718
  renderSubLayers: (props) => {
109723
109719
  const { bbox: { west, south, east, north, }, } = props.tile;
109724
109720
  return new BitmapLayer(props, {
@@ -109754,12 +109750,6 @@ function getTileUrl(service, x, y, z) {
109754
109750
  return url;
109755
109751
  }
109756
109752
 
109757
- let terrainCogTiles;
109758
- let bitmapCogTiles;
109759
- let tileSize;
109760
- let minZoom;
109761
- let maxZoom;
109762
- // let needsRerender: boolean = false;
109763
109753
  class CogTerrainLayer extends CompositeLayer {
109764
109754
  constructor(id, terrainUrl, terrainOptions, bitmapUrl, bitmapOptions) {
109765
109755
  super({});
@@ -109772,15 +109762,15 @@ class CogTerrainLayer extends CompositeLayer {
109772
109762
  this.urlType = 'tile';
109773
109763
  }
109774
109764
  else if (isCogUrl(bitmapUrl)) {
109775
- bitmapCogTiles = new CogTiles(bitmapOptions);
109776
- bitmapCogTiles.initializeCog(bitmapUrl);
109765
+ this.bitmapCogTiles = new CogTiles(bitmapOptions);
109766
+ this.bitmapCogTiles.initializeCog(bitmapUrl);
109777
109767
  this.urlType = 'cog';
109778
109768
  }
109779
109769
  else {
109780
109770
  console.warn('URL needs to point to a valid cog file, or needs to be in the {x}{y}{z} format.');
109781
109771
  }
109782
109772
  }
109783
- terrainCogTiles = new CogTiles(terrainOptions);
109773
+ this.terrainCogTiles = new CogTiles(terrainOptions);
109784
109774
  // this.init(terrainUrl);
109785
109775
  this.terrainUrl = terrainUrl;
109786
109776
  }
@@ -109794,15 +109784,15 @@ class CogTerrainLayer extends CompositeLayer {
109794
109784
  init(terrainUrl) {
109795
109785
  return __awaiter(this, void 0, void 0, function* () {
109796
109786
  // console.log("LAYER INITIALIZE STATE");
109797
- const cog = yield terrainCogTiles.initializeCog(terrainUrl);
109798
- tileSize = terrainCogTiles.getTileSize(cog);
109799
- const zoomRange = terrainCogTiles.getZoomRange(cog);
109800
- [minZoom, maxZoom] = zoomRange;
109787
+ const cog = yield this.terrainCogTiles.initializeCog(terrainUrl);
109788
+ this.tileSize = this.terrainCogTiles.getTileSize(cog);
109789
+ const zoomRange = this.terrainCogTiles.getZoomRange(cog);
109790
+ [this.minZoom, this.maxZoom] = zoomRange;
109801
109791
  this.setState({ initialized: true });
109802
109792
  });
109803
109793
  }
109804
109794
  renderLayers() {
109805
- if (terrainCogTiles.cog) {
109795
+ if (this.terrainCogTiles.cog) {
109806
109796
  // console.log("LAYER RENDER");
109807
109797
  let bitmapTile;
109808
109798
  // let zoomOffset = 0
@@ -109812,13 +109802,13 @@ class CogTerrainLayer extends CompositeLayer {
109812
109802
  const layer = new TileLayer({
109813
109803
  id: `${this.id}-${String(performance.now())}`,
109814
109804
  zoomOffset: -1,
109815
- getTileData: (tileData) => terrainCogTiles.getTile(tileData.index.x, tileData.index.y, tileData.index.z),
109816
- minZoom,
109817
- maxZoom,
109818
- tileSize,
109805
+ getTileData: (tileData) => this.terrainCogTiles.getTile(tileData.index.x, tileData.index.y, tileData.index.z),
109806
+ minZoom: this.minZoom,
109807
+ maxZoom: this.maxZoom,
109808
+ tileSize: this.tileSize,
109819
109809
  maxRequests: 6,
109820
109810
  refinementStrategy: 'best-available',
109821
- extent: terrainCogTiles.getBoundsAsLatLon(terrainCogTiles.cog),
109811
+ extent: this.terrainCogTiles.getBoundsAsLatLon(this.terrainCogTiles.cog),
109822
109812
  renderSubLayers: (props) => {
109823
109813
  if (props.data && (props.tile.index.x !== undefined)) {
109824
109814
  switch (this.urlType) {
@@ -109826,7 +109816,7 @@ class CogTerrainLayer extends CompositeLayer {
109826
109816
  bitmapTile = getTileUrl(this.bitmapUrl, props.tile.index.x, props.tile.index.y, props.tile.index.z);
109827
109817
  break;
109828
109818
  case 'cog':
109829
- bitmapTile = bitmapCogTiles.getTile(props.tile.index.x, props.tile.index.y, props.tile.index.z);
109819
+ bitmapTile = this.bitmapCogTiles.getTile(props.tile.index.x, props.tile.index.y, props.tile.index.z);
109830
109820
  break;
109831
109821
  default:
109832
109822
  bitmapTile = null;
@@ -109847,8 +109837,8 @@ class CogTerrainLayer extends CompositeLayer {
109847
109837
  props.tile.bbox.east,
109848
109838
  props.tile.bbox.north,
109849
109839
  ],
109850
- minZoom,
109851
- maxZoom,
109840
+ minZoom: this.minZoom,
109841
+ maxZoom: this.maxZoom,
109852
109842
  loadOptions: {
109853
109843
  terrain: {
109854
109844
  skirtHeight: 2000,