@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 +24 -33
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +3 -3
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/types/cogbitmaplayer/CogBitmapLayer.d.ts +10 -7
- package/dist/esm/index.js +24 -33
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -3
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/cogbitmaplayer/CogBitmapLayer.d.ts +10 -7
- package/package.json +1 -1
- package/src/cogbitmaplayer/CogBitmapLayer.ts +32 -47
- package/src/cogtiles/cogtiles.ts +5 -1
|
@@ -17,16 +17,12 @@ 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. * */
|
|
25
23
|
rasterData: URLTemplate;
|
|
26
24
|
/** Bounding box of the bitmap image, [minX, minY, maxX, maxY] in world coordinates. * */
|
|
27
25
|
bounds: Bounds | null;
|
|
28
|
-
/** Whether the rendered texture should be blurred or not - effects minFilter and maxFilter * */
|
|
29
|
-
blurredTexture?: boolean;
|
|
30
26
|
/** Weather visualise the entire image with specified opacity (0-1) * */
|
|
31
27
|
opacity?: number;
|
|
32
28
|
/** Whether the rendered texture should be clamped to terrain * */
|
|
@@ -35,25 +31,31 @@ type _CogBitmapLayerProps = {
|
|
|
35
31
|
* TODO
|
|
36
32
|
*/
|
|
37
33
|
cogBitmapOptions: GeoImageOptions;
|
|
34
|
+
isTiled: boolean;
|
|
38
35
|
/**
|
|
39
36
|
* @deprecated Use `loadOptions.terrain.workerUrl` instead
|
|
40
37
|
*/
|
|
41
38
|
workerUrl?: string;
|
|
42
39
|
};
|
|
40
|
+
/** All properties supported by CogBitmapLayer */
|
|
41
|
+
export type CogBitmapLayerProps = _CogBitmapLayerProps & TileLayerProps<MeshAndTexture> & CompositeLayerProps;
|
|
43
42
|
/** Render bitmap texture from cog raster images. */
|
|
44
43
|
export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends CompositeLayer<ExtraPropsT & Required<_CogBitmapLayerProps & Required<TileLayerProps<MeshAndTexture>>>> {
|
|
45
44
|
static defaultProps: DefaultProps<CogBitmapLayerProps>;
|
|
46
45
|
static layerName: string;
|
|
47
|
-
rasterUrl: string;
|
|
48
46
|
minZoom: number;
|
|
49
47
|
maxZoom: number;
|
|
50
48
|
state: {
|
|
49
|
+
initialized: boolean;
|
|
51
50
|
isTiled?: boolean;
|
|
52
51
|
terrain?: MeshAttributes;
|
|
53
52
|
zRange?: ZRange | null;
|
|
53
|
+
bitmapCogTiles: any;
|
|
54
|
+
minZoom: number;
|
|
55
|
+
maxZoom: number;
|
|
54
56
|
};
|
|
55
57
|
initializeState(context: any): Promise<void>;
|
|
56
|
-
init(
|
|
58
|
+
init(): Promise<void>;
|
|
57
59
|
updateState({ props, oldProps }: UpdateParameters<this>): void;
|
|
58
60
|
getTiledBitmapData(tile: TileLoadProps): Promise<TextureSource>;
|
|
59
61
|
renderSubLayers(props: TileLayerProps<TextureSource> & {
|
|
@@ -67,11 +69,12 @@ export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends Composi
|
|
|
67
69
|
updateTriggers: {
|
|
68
70
|
getTileData: {
|
|
69
71
|
rasterData: string;
|
|
72
|
+
cogBitmapOptions: GeoImageOptions;
|
|
70
73
|
clampToTerrain: boolean | ClampToTerrainOptions;
|
|
71
74
|
};
|
|
72
75
|
};
|
|
73
76
|
extent: any;
|
|
74
|
-
tileSize:
|
|
77
|
+
tileSize: any;
|
|
75
78
|
minZoom: number;
|
|
76
79
|
maxZoom: number;
|
|
77
80
|
maxRequests: number;
|
package/dist/esm/index.js
CHANGED
|
@@ -15214,6 +15214,9 @@ function getDelatinTileMesh(meshMaxError, width, height, terrain) {
|
|
|
15214
15214
|
|
|
15215
15215
|
const EARTH_CIRCUMFERENCE = 40075000.0;
|
|
15216
15216
|
const EARTH_HALF_CIRCUMFERENCE = 20037500.0;
|
|
15217
|
+
const CogTilesGeoImageOptionsDefaults = {
|
|
15218
|
+
blurredTexture: true,
|
|
15219
|
+
};
|
|
15217
15220
|
class CogTiles {
|
|
15218
15221
|
constructor(options) {
|
|
15219
15222
|
this.zoomRange = [0, 0];
|
|
@@ -15222,7 +15225,7 @@ class CogTiles {
|
|
|
15222
15225
|
this.loaded = false;
|
|
15223
15226
|
this.geo = new GeoImage();
|
|
15224
15227
|
this.lzw = new LZWDecoder$1();
|
|
15225
|
-
this.options = options;
|
|
15228
|
+
this.options = Object.assign(Object.assign({}, CogTilesGeoImageOptionsDefaults), options);
|
|
15226
15229
|
}
|
|
15227
15230
|
initializeCog(url) {
|
|
15228
15231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15535,7 +15538,6 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15535
15538
|
//
|
|
15536
15539
|
// tileSize: number;
|
|
15537
15540
|
//
|
|
15538
|
-
// blurredTexture: boolean;
|
|
15539
15541
|
initializeState(context) {
|
|
15540
15542
|
const _super = Object.create(null, {
|
|
15541
15543
|
initializeState: { get: () => super.initializeState }
|
|
@@ -15546,16 +15548,15 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15546
15548
|
bitmapCogTiles: new CogTiles(this.props.cogBitmapOptions),
|
|
15547
15549
|
initialized: false,
|
|
15548
15550
|
});
|
|
15549
|
-
yield this.init(
|
|
15551
|
+
yield this.init();
|
|
15550
15552
|
});
|
|
15551
15553
|
}
|
|
15552
|
-
init(
|
|
15554
|
+
init() {
|
|
15553
15555
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15554
15556
|
const cog = yield this.state.bitmapCogTiles.initializeCog(this.props.rasterData);
|
|
15555
|
-
// this.tileSize = this.terrainCogTiles.getTileSize(cog);
|
|
15556
15557
|
const zoomRange = this.state.bitmapCogTiles.getZoomRange(cog);
|
|
15557
|
-
[
|
|
15558
|
-
this.setState({ initialized: true });
|
|
15558
|
+
const [minZoom, maxZoom] = zoomRange;
|
|
15559
|
+
this.setState({ initialized: true, minZoom, maxZoom });
|
|
15559
15560
|
});
|
|
15560
15561
|
}
|
|
15561
15562
|
updateState({ props, oldProps }) {
|
|
@@ -15563,8 +15564,8 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15563
15564
|
if (rasterDataChanged) {
|
|
15564
15565
|
const { rasterData } = props;
|
|
15565
15566
|
const isTiled = rasterData
|
|
15566
|
-
&& (Array.isArray(rasterData)
|
|
15567
|
-
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled;
|
|
15567
|
+
&& ((Array.isArray(rasterData)
|
|
15568
|
+
|| (rasterData.includes('{x}') && rasterData.includes('{y}'))) || this.props.isTiled);
|
|
15568
15569
|
this.setState({ isTiled });
|
|
15569
15570
|
}
|
|
15570
15571
|
// Reloading for single terrain mesh
|
|
@@ -15581,37 +15582,22 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15581
15582
|
}
|
|
15582
15583
|
getTiledBitmapData(tile) {
|
|
15583
15584
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15584
|
-
// const {
|
|
15585
|
-
// rasterData, fetch,
|
|
15586
|
-
// } = this.props;
|
|
15587
|
-
const { viewport } = this.context;
|
|
15588
|
-
let bottomLeft = [0, 0];
|
|
15589
|
-
let topRight = [0, 0];
|
|
15590
|
-
if (viewport.isGeospatial) {
|
|
15591
|
-
const bbox = tile.bbox;
|
|
15592
|
-
bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
|
|
15593
|
-
topRight = viewport.projectFlat([bbox.east, bbox.north]);
|
|
15594
|
-
}
|
|
15595
|
-
else {
|
|
15596
|
-
const bbox = tile.bbox;
|
|
15597
|
-
bottomLeft = [bbox.left, bbox.bottom];
|
|
15598
|
-
topRight = [bbox.right, bbox.top];
|
|
15599
|
-
}
|
|
15600
|
-
[bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
|
|
15601
15585
|
// TODO - pass signal to getTile
|
|
15602
15586
|
// abort request if signal is aborted
|
|
15603
|
-
|
|
15587
|
+
const tileData = yield this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
|
|
15588
|
+
return tileData;
|
|
15604
15589
|
});
|
|
15605
15590
|
}
|
|
15606
15591
|
renderSubLayers(props) {
|
|
15607
15592
|
const SubLayerClass = this.getSubLayerClass('image', BitmapLayer);
|
|
15608
|
-
const { blurredTexture
|
|
15593
|
+
const { blurredTexture } = this.state.bitmapCogTiles.options;
|
|
15594
|
+
const { opacity, clampToTerrain } = this.props;
|
|
15609
15595
|
const { data } = props;
|
|
15610
15596
|
if (!data) {
|
|
15611
15597
|
return null;
|
|
15612
15598
|
}
|
|
15613
15599
|
const { bbox: { west, south, east, north, }, } = props.tile;
|
|
15614
|
-
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: {
|
|
15615
15601
|
minFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15616
15602
|
magFilter: blurredTexture ? 'linear' : 'nearest',
|
|
15617
15603
|
},
|
|
@@ -15621,8 +15607,11 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15621
15607
|
: {})));
|
|
15622
15608
|
}
|
|
15623
15609
|
renderLayers() {
|
|
15624
|
-
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15610
|
+
const { rasterData, blurredTexture, opacity, clampToTerrain,
|
|
15611
|
+
// tileSize,
|
|
15612
|
+
maxRequests, onTileLoad, onTileUnload, onTileError, maxCacheSize, maxCacheByteSize, refinementStrategy, cogBitmapOptions, } = this.props;
|
|
15625
15613
|
if (this.state.isTiled && this.state.initialized) {
|
|
15614
|
+
const { tileSize } = this.state.bitmapCogTiles;
|
|
15626
15615
|
return new TileLayer(this.getSubLayerProps({
|
|
15627
15616
|
id: 'tiles',
|
|
15628
15617
|
}), {
|
|
@@ -15633,13 +15622,15 @@ class CogBitmapLayer extends CompositeLayer {
|
|
|
15633
15622
|
rasterData: urlTemplateToUpdateTrigger$1(rasterData),
|
|
15634
15623
|
// blurredTexture,
|
|
15635
15624
|
// opacity,
|
|
15625
|
+
cogBitmapOptions,
|
|
15636
15626
|
clampToTerrain,
|
|
15637
15627
|
},
|
|
15638
15628
|
},
|
|
15639
|
-
extent: this.state.bitmapCogTiles.cog
|
|
15629
|
+
extent: this.state.bitmapCogTiles.cog
|
|
15630
|
+
? this.state.bitmapCogTiles.getBoundsAsLatLon(this.state.bitmapCogTiles.cog) : null,
|
|
15640
15631
|
tileSize,
|
|
15641
|
-
minZoom: this.minZoom,
|
|
15642
|
-
maxZoom: this.maxZoom,
|
|
15632
|
+
minZoom: this.state.minZoom,
|
|
15633
|
+
maxZoom: this.state.maxZoom,
|
|
15643
15634
|
maxRequests,
|
|
15644
15635
|
onTileLoad,
|
|
15645
15636
|
onTileUnload,
|