@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 +17 -37
- 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 +8 -6
- package/dist/esm/index.js +17 -37
- 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 +8 -6
- package/package.json +1 -1
- package/src/cogbitmaplayer/CogBitmapLayer.ts +28 -42
|
@@ -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> & {
|
|
@@ -65,12 +68,11 @@ export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends Composi
|
|
|
65
68
|
renderSubLayers: any;
|
|
66
69
|
updateTriggers: {
|
|
67
70
|
getTileData: {
|
|
68
|
-
rasterData: string;
|
|
69
71
|
clampToTerrain: boolean | ClampToTerrainOptions;
|
|
70
72
|
};
|
|
71
73
|
};
|
|
72
74
|
extent: any;
|
|
73
|
-
tileSize:
|
|
75
|
+
tileSize: any;
|
|
74
76
|
minZoom: number;
|
|
75
77
|
maxZoom: number;
|
|
76
78
|
maxRequests: number;
|
package/dist/esm/index.js
CHANGED
|
@@ -15521,13 +15521,6 @@ const defaultProps$1 = Object.assign(Object.assign({}, TileLayer.defaultProps),
|
|
|
15521
15521
|
// },
|
|
15522
15522
|
// Supply url to local terrain worker bundle. Only required if running offline and cannot access CDN.
|
|
15523
15523
|
workerUrl: '' });
|
|
15524
|
-
// Turns array of templates into a single string to work around shallow change
|
|
15525
|
-
function urlTemplateToUpdateTrigger$1(template) {
|
|
15526
|
-
if (Array.isArray(template)) {
|
|
15527
|
-
return template.join(';');
|
|
15528
|
-
}
|
|
15529
|
-
return template || '';
|
|
15530
|
-
}
|
|
15531
15524
|
/** Render bitmap texture from cog raster images. */
|
|
15532
15525
|
class CogBitmapLayer extends CompositeLayer {
|
|
15533
15526
|
// private _isLoaded: boolean;
|
|
@@ -15548,16 +15541,15 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15548
15541
|
bitmapCogTiles: new CogTiles(this.props.cogBitmapOptions),
|
|
15549
15542
|
initialized: false,
|
|
15550
15543
|
});
|
|
15551
|
-
yield this.init(
|
|
15544
|
+
yield this.init();
|
|
15552
15545
|
});
|
|
15553
15546
|
}
|
|
15554
|
-
init(
|
|
15547
|
+
init() {
|
|
15555
15548
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15556
15549
|
const cog = yield this.state.bitmapCogTiles.initializeCog(this.props.rasterData);
|
|
15557
|
-
// this.tileSize = this.terrainCogTiles.getTileSize(cog);
|
|
15558
15550
|
const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
|
|
15559
|
-
[
|
|
15560
|
-
this.setState({ initialized: true });
|
|
15551
|
+
const [minZoom, maxZoom] = zoomRange;
|
|
15552
|
+
this.setState({ initialized: true, minZoom, maxZoom });
|
|
15561
15553
|
});
|
|
15562
15554
|
}
|
|
15563
15555
|
updateState({ props, oldProps }) {
|
|
@@ -15565,8 +15557,8 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15565
15557
|
if (rasterDataChanged) {
|
|
15566
15558
|
const { rasterData } = props;
|
|
15567
15559
|
const isTiled = rasterData
|
|
15568
|
-
&& (Array.isArray(rasterData)
|
|
15569
|
-
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled;
|
|
15560
|
+
&& ((Array.isArray(rasterData)
|
|
15561
|
+
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled);
|
|
15570
15562
|
this.setState({ isTiled });
|
|
15571
15563
|
}
|
|
15572
15564
|
// Reloading for single terrain mesh
|
|
@@ -15583,26 +15575,10 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15583
15575
|
}
|
|
15584
15576
|
getTiledBitmapData(tile) {
|
|
15585
15577
|
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
15578
|
// TODO - pass signal to getTile
|
|
15604
15579
|
// abort request if signal is aborted
|
|
15605
|
-
|
|
15580
|
+
const tileData = yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
|
|
15581
|
+
return tileData;
|
|
15606
15582
|
});
|
|
15607
15583
|
}
|
|
15608
15584
|
renderSubLayers(props) {
|
|
@@ -15614,7 +15590,7 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15614
15590
|
return null;
|
|
15615
15591
|
}
|
|
15616
15592
|
const { bbox: { west, south, east, north, }, } = props.tile;
|
|
15617
|
-
return new SubLayerClass(Object.assign(Object.assign({}, props), { tileSize:
|
|
15593
|
+
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
15594
|
minFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15619
15595
|
magFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15620
15596
|
},
|
|
@@ -15624,8 +15600,11 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15624
15600
|
: {})));
|
|
15625
15601
|
}
|
|
15626
15602
|
renderLayers() {
|
|
15627
|
-
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15603
|
+
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15604
|
+
// tileSize,
|
|
15605
|
+
maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, cogBitmapOptions, } = this.props;
|
|
15628
15606
|
if (this.state.isTiled && this.state.initialized) {
|
|
15607
|
+
const { tileSize } = this.state.bitmapCogTiles;
|
|
15629
15608
|
return new TileLayer(this.getSubLayerProps({
|
|
15630
15609
|
id: 'tiles',
|
|
15631
15610
|
}), {
|
|
@@ -15633,17 +15612,18 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15633
15612
|
renderSubLayers: this.renderSubLayers.bind(this),
|
|
15634
15613
|
updateTriggers: {
|
|
15635
15614
|
getTileData: {
|
|
15636
|
-
rasterData: urlTemplateToUpdateTrigger
|
|
15615
|
+
// rasterData: urlTemplateToUpdateTrigger(rasterData),
|
|
15637
15616
|
// blurredTexture,
|
|
15638
15617
|
// opacity,
|
|
15618
|
+
// cogBitmapOptions,
|
|
15639
15619
|
clampToTerrain,
|
|
15640
15620
|
},
|
|
15641
15621
|
},
|
|
15642
15622
|
extent: this.state.bitmapCogTiles.cog
|
|
15643
15623
|
? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
|
|
15644
15624
|
tileSize,
|
|
15645
|
-
minZoom: this.minZoom,
|
|
15646
|
-
maxZoom: this.maxZoom,
|
|
15625
|
+
minZoom: this.state.minZoom,
|
|
15626
|
+
maxZoom: this.state.maxZoom,
|
|
15647
15627
|
maxRequests,
|
|
15648
15628
|
onTileLoad,
|
|
15649
15629
|
onTileUnload,
|