@gisatcz/deckgl-geolib 2.6.0-dev.4 → 2.6.0-dev.6
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 +424 -70
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +2 -2
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +424 -71
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/core/CogTiles.d.ts +1 -0
- package/dist/esm/types/core/GeoImage.d.ts +4 -2
- package/dist/esm/types/core/lib/TerrainGenerator.d.ts +2 -1
- package/dist/esm/types/core/types.d.ts +2 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/layers/CogTerrainLayer.d.ts +15 -0
- package/dist/esm/types/workers/TerrainWorkerPool.d.ts +58 -0
- package/dist/esm/types/workers/terrain.worker.d.ts +5 -0
- package/package.json +1 -1
|
@@ -10,7 +10,8 @@ export default class GeoImage {
|
|
|
10
10
|
rasters: any[];
|
|
11
11
|
bounds: Bounds;
|
|
12
12
|
cellSizeMeters?: number;
|
|
13
|
-
}, options: GeoImageOptions, meshMaxError: number
|
|
13
|
+
}, options: GeoImageOptions, meshMaxError: number, workerPool?: any, // TerrainWorkerPool (optional)
|
|
14
|
+
signal?: AbortSignal): Promise<TileResult | null>;
|
|
14
15
|
/**
|
|
15
16
|
* Resolves the active visualization (coloring) mode after merging user options with defaults.
|
|
16
17
|
*
|
|
@@ -38,7 +39,8 @@ export default class GeoImage {
|
|
|
38
39
|
height: number;
|
|
39
40
|
rasters: any[];
|
|
40
41
|
cellSizeMeters?: number;
|
|
41
|
-
}, options: GeoImageOptions, meshMaxError: number)
|
|
42
|
+
}, options: GeoImageOptions, meshMaxError: number, workerPool?: any, // TerrainWorkerPool (optional)
|
|
43
|
+
signal?: AbortSignal): Promise<TileResult>;
|
|
42
44
|
getBitmap(input: string | {
|
|
43
45
|
width: number;
|
|
44
46
|
height: number;
|
|
@@ -6,7 +6,8 @@ export declare class TerrainGenerator {
|
|
|
6
6
|
rasters: TypedArray[];
|
|
7
7
|
bounds: Bounds;
|
|
8
8
|
cellSizeMeters?: number;
|
|
9
|
-
}, options: GeoImageOptions, meshMaxError: number)
|
|
9
|
+
}, options: GeoImageOptions, meshMaxError: number, workerPool?: any, // TerrainWorkerPool (optional for flexibility)
|
|
10
|
+
signal?: AbortSignal): Promise<TileResult>;
|
|
10
11
|
private static extractMeshRaster;
|
|
11
12
|
private static hasVisualizationOptions;
|
|
12
13
|
/**
|
|
@@ -83,6 +83,8 @@ export type GeoImageOptions = {
|
|
|
83
83
|
disableLighting?: boolean;
|
|
84
84
|
/** When true, fetch and cache all bands for a tile on first access. Enables instant slider animation. */
|
|
85
85
|
cacheAllBands?: boolean;
|
|
86
|
+
/** When true, bypass the Web Worker pool for terrain tessellation. Set this for smooth animation during rapid band changes (e.g., slider scrubbing). Default: false */
|
|
87
|
+
disableWorkerPool?: boolean;
|
|
86
88
|
};
|
|
87
89
|
export declare const DefaultGeoImageOptions: GeoImageOptions;
|
|
88
90
|
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
@@ -2,5 +2,6 @@ export { CogBitmapLayer, CogTerrainLayer } from './layers/index';
|
|
|
2
2
|
export { CogTiles, GeoImage } from './core/index';
|
|
3
3
|
export { suppressGlobalAbortErrors } from './utils/suppressAbortErrors';
|
|
4
4
|
export { extractTerrainCoordinate, sampleTerrainTileCoordinates } from './utils/terrainPickingUtils';
|
|
5
|
+
export { terminateGlobalTerrainWorkerPool } from './workers/TerrainWorkerPool';
|
|
5
6
|
export type { GeoImageOptions } from './core/index';
|
|
6
7
|
export type { TerrainCoordinate } from './utils/terrainPickingUtils';
|
|
@@ -55,6 +55,17 @@ type _CogTerrainLayerProps = {
|
|
|
55
55
|
terrainOptions: GeoImageOptions;
|
|
56
56
|
/** Pre-initialized CogTiles object for terrain */
|
|
57
57
|
cogTiles?: CogTiles;
|
|
58
|
+
/**
|
|
59
|
+
* Override layer zoom. When set, both minZoom and maxZoom will use this value,
|
|
60
|
+
* effectively locking the TileLayer to a single zoom level (used for LOD placeholder).
|
|
61
|
+
*/
|
|
62
|
+
zoomOverride?: number;
|
|
63
|
+
/**
|
|
64
|
+
* When true (default), automatically loads low-resolution overview tiles first
|
|
65
|
+
* before fetching high-resolution detail tiles. Prevents blank-map delays on slow connections.
|
|
66
|
+
* Set to false to disable automatic LOD gate and request all visible tiles immediately.
|
|
67
|
+
*/
|
|
68
|
+
enableProgressiveLoading?: boolean;
|
|
58
69
|
/**
|
|
59
70
|
* When true, suppresses any texture generated by the tile (e.g. heatmap/hillshade)
|
|
60
71
|
* and renders the mesh in the plain `color` instead.
|
|
@@ -76,6 +87,8 @@ export default class CogTerrainLayer<ExtraPropsT extends object = object> extend
|
|
|
76
87
|
static defaultProps: DefaultProps<_CogTerrainLayerProps>;
|
|
77
88
|
static layerName: string;
|
|
78
89
|
terrainUrl: string;
|
|
90
|
+
private zRangeUpdateTimeoutId;
|
|
91
|
+
private lastZRangeValue;
|
|
79
92
|
state: {
|
|
80
93
|
isTiled?: boolean;
|
|
81
94
|
terrain?: MeshAttributes;
|
|
@@ -84,6 +97,7 @@ export default class CogTerrainLayer<ExtraPropsT extends object = object> extend
|
|
|
84
97
|
maxZoom: number;
|
|
85
98
|
terrainCogTiles: CogTiles;
|
|
86
99
|
initialized: boolean;
|
|
100
|
+
overviewLoaded: boolean;
|
|
87
101
|
};
|
|
88
102
|
initializeState(context: any): Promise<void>;
|
|
89
103
|
init(): Promise<void>;
|
|
@@ -97,5 +111,6 @@ export default class CogTerrainLayer<ExtraPropsT extends object = object> extend
|
|
|
97
111
|
}): SimpleMeshLayer<any, {}> | null;
|
|
98
112
|
onViewportLoad(tiles?: Tile2DHeader<MeshAndTexture | null>[]): void;
|
|
99
113
|
renderLayers(): Layer | null | LayersList;
|
|
114
|
+
_finalize(): void;
|
|
100
115
|
}
|
|
101
116
|
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pool of Web Workers for parallel terrain tessellation.
|
|
3
|
+
* Distributes work across multiple workers based on CPU core count.
|
|
4
|
+
*
|
|
5
|
+
* SINGLETON PATTERN: One global pool is shared across all CogTiles instances
|
|
6
|
+
* to avoid expensive worker creation/destruction during deck.gl layer recreations.
|
|
7
|
+
*/
|
|
8
|
+
interface MeshResult {
|
|
9
|
+
vertices: Uint16Array | Float64Array;
|
|
10
|
+
triangles: Uint32Array;
|
|
11
|
+
terrain: Float32Array;
|
|
12
|
+
}
|
|
13
|
+
export interface ComputeMeshOptions {
|
|
14
|
+
terrain: Float32Array;
|
|
15
|
+
meshMaxError: number;
|
|
16
|
+
tesselator: 'martini' | 'delatin';
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Manages a pool of terrain tessellation workers.
|
|
23
|
+
* Automatically scales to CPU core count (capped at 8 for memory safety).
|
|
24
|
+
*/
|
|
25
|
+
declare class TerrainWorkerPool {
|
|
26
|
+
private workers;
|
|
27
|
+
private pendingTasks;
|
|
28
|
+
private taskCounter;
|
|
29
|
+
private roundRobinIndex;
|
|
30
|
+
constructor(poolSize?: number);
|
|
31
|
+
/**
|
|
32
|
+
* Compute terrain mesh using the worker pool.
|
|
33
|
+
* Returns a Promise that resolves with the mesh data.
|
|
34
|
+
* Supports cancellation via AbortSignal.
|
|
35
|
+
*/
|
|
36
|
+
computeMesh(options: ComputeMeshOptions): Promise<MeshResult>;
|
|
37
|
+
private getNextWorker;
|
|
38
|
+
private handleWorkerMessage;
|
|
39
|
+
private handleWorkerError;
|
|
40
|
+
/**
|
|
41
|
+
* Terminate all workers.
|
|
42
|
+
* ⚠️ NOTE: Because this is a singleton, terminate() should only be called
|
|
43
|
+
* on app shutdown, not on individual layer unmount.
|
|
44
|
+
*/
|
|
45
|
+
terminate(): void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the global terrain worker pool, creating it on first use.
|
|
49
|
+
* All CogTiles instances share this pool to avoid expensive worker churn
|
|
50
|
+
* during deck.gl layer recreations.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getGlobalTerrainWorkerPool(): TerrainWorkerPool;
|
|
53
|
+
/**
|
|
54
|
+
* Terminates the global worker pool.
|
|
55
|
+
* Only call this on app shutdown, not on layer unmount.
|
|
56
|
+
*/
|
|
57
|
+
export declare function terminateGlobalTerrainWorkerPool(): void;
|
|
58
|
+
export {};
|