@gisatcz/deckgl-geolib 1.11.0-dev.6 → 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 +16 -29
- 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 +9 -5
- package/dist/esm/index.js +16 -29
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/cogbitmaplayer/CogBitmapLayer.d.ts +9 -5
- package/package.json +1 -1
- package/src/cogbitmaplayer/CogBitmapLayer.ts +27 -41
|
@@ -17,8 +17,6 @@ export type ClampToTerrainOptions = {
|
|
|
17
17
|
terrainDrawMode?: string;
|
|
18
18
|
};
|
|
19
19
|
type MeshAndTexture = [MeshAttributes | null, TextureSource | null];
|
|
20
|
-
/** All properties supported by CogBitmapLayer */
|
|
21
|
-
export type CogBitmapLayerProps = _CogBitmapLayerProps & TileLayerProps<MeshAndTexture> & CompositeLayerProps;
|
|
22
20
|
/** Props added by the CogBitmapLayer */
|
|
23
21
|
type _CogBitmapLayerProps = {
|
|
24
22
|
/** Image url that encodes raster data. * */
|
|
@@ -33,26 +31,31 @@ type _CogBitmapLayerProps = {
|
|
|
33
31
|
* TODO
|
|
34
32
|
*/
|
|
35
33
|
cogBitmapOptions: GeoImageOptions;
|
|
34
|
+
isTiled: boolean;
|
|
36
35
|
/**
|
|
37
36
|
* @deprecated Use `loadOptions.terrain.workerUrl` instead
|
|
38
37
|
*/
|
|
39
38
|
workerUrl?: string;
|
|
40
39
|
};
|
|
40
|
+
/** All properties supported by CogBitmapLayer */
|
|
41
|
+
export type CogBitmapLayerProps = _CogBitmapLayerProps & TileLayerProps<MeshAndTexture> & CompositeLayerProps;
|
|
41
42
|
/** Render bitmap texture from cog raster images. */
|
|
42
43
|
export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends CompositeLayer<ExtraPropsT & Required<_CogBitmapLayerProps & Required<TileLayerProps<MeshAndTexture>>>> {
|
|
43
44
|
static defaultProps: DefaultProps<CogBitmapLayerProps>;
|
|
44
45
|
static layerName: string;
|
|
45
|
-
rasterUrl: string;
|
|
46
46
|
minZoom: number;
|
|
47
47
|
maxZoom: number;
|
|
48
48
|
state: {
|
|
49
|
+
initialized: boolean;
|
|
49
50
|
isTiled?: boolean;
|
|
50
51
|
terrain?: MeshAttributes;
|
|
51
52
|
zRange?: ZRange | null;
|
|
52
53
|
bitmapCogTiles: any;
|
|
54
|
+
minZoom: number;
|
|
55
|
+
maxZoom: number;
|
|
53
56
|
};
|
|
54
57
|
initializeState(context: any): Promise<void>;
|
|
55
|
-
init(
|
|
58
|
+
init(): Promise<void>;
|
|
56
59
|
updateState({ props, oldProps }: UpdateParameters<this>): void;
|
|
57
60
|
getTiledBitmapData(tile: TileLoadProps): Promise<TextureSource>;
|
|
58
61
|
renderSubLayers(props: TileLayerProps<TextureSource> & {
|
|
@@ -66,11 +69,12 @@ export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends Composi
|
|
|
66
69
|
updateTriggers: {
|
|
67
70
|
getTileData: {
|
|
68
71
|
rasterData: string;
|
|
72
|
+
cogBitmapOptions: GeoImageOptions;
|
|
69
73
|
clampToTerrain: boolean | ClampToTerrainOptions;
|
|
70
74
|
};
|
|
71
75
|
};
|
|
72
76
|
extent: any;
|
|
73
|
-
tileSize:
|
|
77
|
+
tileSize: any;
|
|
74
78
|
minZoom: number;
|
|
75
79
|
maxZoom: number;
|
|
76
80
|
maxRequests: number;
|
package/dist/esm/index.js
CHANGED
|
@@ -15548,16 +15548,15 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15548
15548
|
bitmapCogTiles: new CogTiles(this.props.cogBitmapOptions),
|
|
15549
15549
|
initialized: false,
|
|
15550
15550
|
});
|
|
15551
|
-
yield this.init(
|
|
15551
|
+
yield this.init();
|
|
15552
15552
|
});
|
|
15553
15553
|
}
|
|
15554
|
-
init(
|
|
15554
|
+
init() {
|
|
15555
15555
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15556
15556
|
const cog = yield this.state.bitmapCogTiles.initializeCog(this.props.rasterData);
|
|
15557
|
-
// this.tileSize = this.terrainCogTiles.getTileSize(cog);
|
|
15558
15557
|
const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
|
|
15559
|
-
[
|
|
15560
|
-
this.setState({ initialized: true });
|
|
15558
|
+
const [minZoom, maxZoom] = zoomRange;
|
|
15559
|
+
this.setState({ initialized: true, minZoom, maxZoom });
|
|
15561
15560
|
});
|
|
15562
15561
|
}
|
|
15563
15562
|
updateState({ props, oldProps }) {
|
|
@@ -15565,8 +15564,8 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15565
15564
|
if (rasterDataChanged) {
|
|
15566
15565
|
const { rasterData } = props;
|
|
15567
15566
|
const isTiled = rasterData
|
|
15568
|
-
&& (Array.isArray(rasterData)
|
|
15569
|
-
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled;
|
|
15567
|
+
&& ((Array.isArray(rasterData)
|
|
15568
|
+
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled);
|
|
15570
15569
|
this.setState({ isTiled });
|
|
15571
15570
|
}
|
|
15572
15571
|
// Reloading for single terrain mesh
|
|
@@ -15583,26 +15582,10 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15583
15582
|
}
|
|
15584
15583
|
getTiledBitmapData(tile) {
|
|
15585
15584
|
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
15585
|
// TODO - pass signal to getTile
|
|
15604
15586
|
// abort request if signal is aborted
|
|
15605
|
-
|
|
15587
|
+
const tileData = yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
|
|
15588
|
+
return tileData;
|
|
15606
15589
|
});
|
|
15607
15590
|
}
|
|
15608
15591
|
renderSubLayers(props) {
|
|
@@ -15614,7 +15597,7 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15614
15597
|
return null;
|
|
15615
15598
|
}
|
|
15616
15599
|
const { bbox: { west, south, east, north, }, } = props.tile;
|
|
15617
|
-
return new SubLayerClass(Object.assign(Object.assign({}, props), { tileSize:
|
|
15600
|
+
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: {
|
|
15618
15601
|
minFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15619
15602
|
magFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15620
15603
|
},
|
|
@@ -15624,8 +15607,11 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15624
15607
|
: {})));
|
|
15625
15608
|
}
|
|
15626
15609
|
renderLayers() {
|
|
15627
|
-
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15610
|
+
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15611
|
+
// tileSize,
|
|
15612
|
+
maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, cogBitmapOptions, } = this.props;
|
|
15628
15613
|
if (this.state.isTiled && this.state.initialized) {
|
|
15614
|
+
const { tileSize } = this.state.bitmapCogTiles;
|
|
15629
15615
|
return new TileLayer(this.getSubLayerProps({
|
|
15630
15616
|
id: 'tiles',
|
|
15631
15617
|
}), {
|
|
@@ -15636,14 +15622,15 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15636
15622
|
rasterData: urlTemplateToUpdateTrigger$1(rasterData),
|
|
15637
15623
|
// blurredTexture,
|
|
15638
15624
|
// opacity,
|
|
15625
|
+
cogBitmapOptions,
|
|
15639
15626
|
clampToTerrain,
|
|
15640
15627
|
},
|
|
15641
15628
|
},
|
|
15642
15629
|
extent: this.state.bitmapCogTiles.cog
|
|
15643
15630
|
? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
|
|
15644
15631
|
tileSize,
|
|
15645
|
-
minZoom: this.minZoom,
|
|
15646
|
-
maxZoom: this.maxZoom,
|
|
15632
|
+
minZoom: this.state.minZoom,
|
|
15633
|
+
maxZoom: this.state.maxZoom,
|
|
15647
15634
|
maxRequests,
|
|
15648
15635
|
onTileLoad,
|
|
15649
15636
|
onTileUnload,
|