@gisatcz/deckgl-geolib 1.11.0-dev.2 → 1.11.0-dev.4
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 +21 -128
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +4 -4
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/types/cogbitmaplayer/CogBitmapLayer.d.ts +31 -6
- package/dist/esm/index.js +21 -128
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +4 -4
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/cogbitmaplayer/CogBitmapLayer.d.ts +31 -6
- package/package.json +1 -1
- package/src/cogbitmaplayer/CogBitmapLayer.ts +41 -165
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var core = require('@deck.gl/core');
|
|
4
4
|
var geoLayers = require('@deck.gl/geo-layers');
|
|
5
5
|
var layers = require('@deck.gl/layers');
|
|
6
|
+
var extensions = require('@deck.gl/extensions');
|
|
6
7
|
var chroma = require('chroma-js');
|
|
7
8
|
var schema = require('@loaders.gl/schema');
|
|
8
9
|
var loaderUtils = require('@loaders.gl/loader-utils');
|
|
@@ -15493,7 +15494,6 @@ const urlType$1 = {
|
|
|
15493
15494
|
return true;
|
|
15494
15495
|
},
|
|
15495
15496
|
};
|
|
15496
|
-
const DUMMY_DATA$1 = [1];
|
|
15497
15497
|
const defaultProps$1 = Object.assign(Object.assign({}, geoLayers.TileLayer.defaultProps), {
|
|
15498
15498
|
// Image url that encodes height data
|
|
15499
15499
|
// elevationData: urlType,
|
|
@@ -15507,7 +15507,7 @@ const defaultProps$1 = Object.assign(Object.assign({}, geoLayers.TileLayer.defau
|
|
|
15507
15507
|
}, rasterData: urlType$1,
|
|
15508
15508
|
// Color to use if texture is unavailable
|
|
15509
15509
|
// color: { type: 'color', value: [255, 255, 255] },
|
|
15510
|
-
blurredTexture: true, clampToTerrain:
|
|
15510
|
+
blurredTexture: true, opacity: 1, clampToTerrain: false,
|
|
15511
15511
|
// Object to decode height data, from (r, g, b) to height in meters
|
|
15512
15512
|
// elevationDecoder: {
|
|
15513
15513
|
// type: 'object',
|
|
@@ -15557,7 +15557,6 @@ class CogBitmapLayer extends core.CompositeLayer {
|
|
|
15557
15557
|
// this.tileSize = this.terrainCogTiles.getTileSize(cog);
|
|
15558
15558
|
const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
|
|
15559
15559
|
[this.minZoom, this.maxZoom] = zoomRange;
|
|
15560
|
-
console.log(cog);
|
|
15561
15560
|
this.setState({ initialized: true });
|
|
15562
15561
|
});
|
|
15563
15562
|
}
|
|
@@ -15584,8 +15583,9 @@ class CogBitmapLayer extends core.CompositeLayer {
|
|
|
15584
15583
|
}
|
|
15585
15584
|
getTiledBitmapData(tile) {
|
|
15586
15585
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15587
|
-
|
|
15588
|
-
|
|
15586
|
+
// const {
|
|
15587
|
+
// rasterData, fetch,
|
|
15588
|
+
// } = this.props;
|
|
15589
15589
|
const { viewport } = this.context;
|
|
15590
15590
|
let bottomLeft = [0, 0];
|
|
15591
15591
|
let topRight = [0, 0];
|
|
@@ -15599,157 +15599,49 @@ class CogBitmapLayer extends core.CompositeLayer {
|
|
|
15599
15599
|
bottomLeft = [bbox.left, bbox.bottom];
|
|
15600
15600
|
topRight = [bbox.right, bbox.top];
|
|
15601
15601
|
}
|
|
15602
|
-
|
|
15602
|
+
[bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
|
|
15603
15603
|
// TODO - pass signal to getTile
|
|
15604
15604
|
// abort request if signal is aborted
|
|
15605
|
-
|
|
15606
|
-
return Promise.all([cogBitmap]);
|
|
15605
|
+
return yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
|
|
15607
15606
|
});
|
|
15608
15607
|
}
|
|
15609
15608
|
renderSubLayers(props) {
|
|
15610
|
-
console.log('rendering sub layer and consoling props');
|
|
15611
15609
|
const SubLayerClass = this.getSubLayerClass('image', layers.BitmapLayer);
|
|
15612
|
-
|
|
15613
|
-
console.log(this.props);
|
|
15614
|
-
const { bounds, blurredTexture, clampToTerrain } = this.props;
|
|
15610
|
+
const { blurredTexture, opacity, clampToTerrain } = this.props;
|
|
15615
15611
|
const { data } = props;
|
|
15616
15612
|
if (!data) {
|
|
15617
15613
|
return null;
|
|
15618
15614
|
}
|
|
15619
|
-
// const [raster, texture] = data;
|
|
15620
|
-
const [image] = data;
|
|
15621
15615
|
const { bbox: { west, south, east, north, }, } = props.tile;
|
|
15622
|
-
return new SubLayerClass(Object.assign(Object.assign({}, props), { tileSize: 256 }), {
|
|
15623
|
-
data: DUMMY_DATA$1,
|
|
15624
|
-
// data: null,
|
|
15625
|
-
image,
|
|
15626
|
-
// texture,
|
|
15627
|
-
_instanced: false,
|
|
15628
|
-
// coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
15629
|
-
// getPosition: (d) => [0, 0, 0],
|
|
15630
|
-
bounds: [west, south, east, north],
|
|
15631
|
-
// bounds,
|
|
15632
|
-
opacity: 1,
|
|
15633
|
-
textureParameters: {
|
|
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: {
|
|
15634
15617
|
minFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15635
15618
|
magFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15636
|
-
},
|
|
15637
|
-
//
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
});
|
|
15619
|
+
},
|
|
15620
|
+
// TODO check if works!!!
|
|
15621
|
+
extensions: clampToTerrain ? [new extensions._TerrainExtension()] : [] }, ((clampToTerrain === null || clampToTerrain === void 0 ? void 0 : clampToTerrain.terrainDrawMode)
|
|
15622
|
+
? { terrainDrawMode: clampToTerrain.terrainDrawMode }
|
|
15623
|
+
: {})));
|
|
15642
15624
|
}
|
|
15643
|
-
// Update zRange of viewport
|
|
15644
|
-
onViewportLoad(tiles) {
|
|
15645
|
-
if (!tiles) {
|
|
15646
|
-
return;
|
|
15647
|
-
}
|
|
15648
|
-
const { zRange } = this.state;
|
|
15649
|
-
const ranges = tiles
|
|
15650
|
-
.map((tile) => tile.content)
|
|
15651
|
-
.filter((x) => x && x[0])
|
|
15652
|
-
.map((arr) => {
|
|
15653
|
-
var _a, _b;
|
|
15654
|
-
// @ts-ignore
|
|
15655
|
-
const bounds = (_b = (_a = arr[0]) === null || _a === void 0 ? void 0 : _a.header) === null || _b === void 0 ? void 0 : _b.boundingBox;
|
|
15656
|
-
return bounds === null || bounds === void 0 ? void 0 : bounds.map((bound) => bound[2]);
|
|
15657
|
-
});
|
|
15658
|
-
if (ranges.length === 0) {
|
|
15659
|
-
return;
|
|
15660
|
-
}
|
|
15661
|
-
const minZ = Math.min(...ranges.map((x) => x[0]));
|
|
15662
|
-
const maxZ = Math.max(...ranges.map((x) => x[1]));
|
|
15663
|
-
if (!zRange || minZ < zRange[0] || maxZ > zRange[1]) {
|
|
15664
|
-
this.setState({ zRange: [Number.isFinite(minZ) ? minZ : 0, Number.isFinite(maxZ) ? maxZ : 0] });
|
|
15665
|
-
}
|
|
15666
|
-
}
|
|
15667
|
-
// constructor(id:string, url:string, options:GeoImageOptions) {
|
|
15668
|
-
// super({});
|
|
15669
|
-
// this.id = id;
|
|
15670
|
-
// // this.state = {
|
|
15671
|
-
// // initialized: false,
|
|
15672
|
-
// // };
|
|
15673
|
-
// // this._isLoaded = false;
|
|
15674
|
-
// this.cogTiles = new CogTiles(options);
|
|
15675
|
-
// this.blurredTexture = options.blurredTexture;
|
|
15676
|
-
// this.url = url;
|
|
15677
|
-
// // setTimeout(() => {
|
|
15678
|
-
// // this.init(url);
|
|
15679
|
-
// // }, 500);
|
|
15680
|
-
// }
|
|
15681
|
-
//
|
|
15682
|
-
// initializeState() {
|
|
15683
|
-
// this.state = {
|
|
15684
|
-
// initialized: false,
|
|
15685
|
-
// };
|
|
15686
|
-
//
|
|
15687
|
-
// this.init(this.url);
|
|
15688
|
-
// }
|
|
15689
|
-
//
|
|
15690
|
-
// async init(url:string) {
|
|
15691
|
-
// const cog = await this.cogTiles.initializeCog(url);
|
|
15692
|
-
// this.setState({ initialized: true });
|
|
15693
|
-
// this.tileSize = this.cogTiles.getTileSize(cog);
|
|
15694
|
-
// const zoomRange = this.cogTiles.getZoomRange(cog);
|
|
15695
|
-
// [this.minZoom, this.maxZoom] = zoomRange;
|
|
15696
|
-
// }
|
|
15697
|
-
//
|
|
15698
15625
|
renderLayers() {
|
|
15699
|
-
const { rasterData, blurredTexture, clampToTerrain, tileSize,
|
|
15700
|
-
console.log('render bitmap layers');
|
|
15701
|
-
// console.log(this.state);
|
|
15626
|
+
const { rasterData, blurredTexture, opacity, clampToTerrain, tileSize, maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, } = this.props;
|
|
15702
15627
|
if (this.state.isTiled && this.state.initialized) {
|
|
15703
|
-
console.log('start rendering tile layer');
|
|
15704
15628
|
return new geoLayers.TileLayer(this.getSubLayerProps({
|
|
15705
15629
|
id: 'tiles',
|
|
15706
15630
|
}), {
|
|
15707
15631
|
getTileData: this.getTiledBitmapData.bind(this),
|
|
15708
|
-
// getTileData: (tileData: any) => this.state.bitmapCogTiles.getTile(
|
|
15709
|
-
// tileData.index.x,
|
|
15710
|
-
// tileData.index.y,
|
|
15711
|
-
// tileData.index.z,
|
|
15712
|
-
// ),
|
|
15713
15632
|
renderSubLayers: this.renderSubLayers.bind(this),
|
|
15714
|
-
// renderSubLayers: (props: any) => {
|
|
15715
|
-
// const {
|
|
15716
|
-
// bbox: {
|
|
15717
|
-
// west, south, east, north,
|
|
15718
|
-
// },
|
|
15719
|
-
// } = props.tile;
|
|
15720
|
-
// // MK proc to tady funguje jen s 0?
|
|
15721
|
-
// console.log(props.data[0]);
|
|
15722
|
-
// return new BitmapLayer(props, {
|
|
15723
|
-
// data: DUMMY_DATA,
|
|
15724
|
-
// image: props.data[0],
|
|
15725
|
-
// bounds: [west, south, east, north],
|
|
15726
|
-
// opacity: 1, // 0.6
|
|
15727
|
-
// textureParameters: {
|
|
15728
|
-
// minFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15729
|
-
// magFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15730
|
-
// },
|
|
15731
|
-
// // extensions: this.cogTiles?.options?.clampToTerrain ? [new TerrainExtension()] : [],
|
|
15732
|
-
// // ...(this.cogTiles?.options?.clampToTerrain?.terrainDrawMode
|
|
15733
|
-
// // ? { terrainDrawMode: this.cogTiles?.options?.clampToTerrain.terrainDrawMode }
|
|
15734
|
-
// // : {}),
|
|
15735
|
-
// });
|
|
15736
|
-
// },
|
|
15737
15633
|
updateTriggers: {
|
|
15738
15634
|
getTileData: {
|
|
15739
15635
|
rasterData: urlTemplateToUpdateTrigger$1(rasterData),
|
|
15740
|
-
blurredTexture,
|
|
15636
|
+
// blurredTexture,
|
|
15637
|
+
// opacity,
|
|
15741
15638
|
clampToTerrain,
|
|
15742
|
-
// texture: urlTemplateToUpdateTrigger(texture),
|
|
15743
|
-
// meshMaxError,
|
|
15744
|
-
// elevationDecoder,
|
|
15745
15639
|
},
|
|
15746
15640
|
},
|
|
15747
|
-
|
|
15748
|
-
zRange: this.state.zRange || null,
|
|
15641
|
+
extent: this.state.bitmapCogTiles.cog ? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
|
|
15749
15642
|
tileSize,
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
extent,
|
|
15643
|
+
minZoom: this.minZoom,
|
|
15644
|
+
maxZoom: this.maxZoom,
|
|
15753
15645
|
maxRequests,
|
|
15754
15646
|
onTileLoad,
|
|
15755
15647
|
onTileUnload,
|
|
@@ -15759,6 +15651,7 @@ class CogBitmapLayer extends core.CompositeLayer {
|
|
|
15759
15651
|
refinementStrategy,
|
|
15760
15652
|
});
|
|
15761
15653
|
}
|
|
15654
|
+
return null;
|
|
15762
15655
|
}
|
|
15763
15656
|
}
|
|
15764
15657
|
CogBitmapLayer.defaultProps = defaultProps$1;
|