@gisatcz/deckgl-geolib 2.6.0-dev.3 → 2.6.0-dev.5
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 +261 -23
- 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 +261 -24
- 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/index.d.ts +1 -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
|
/**
|
|
@@ -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';
|
|
@@ -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 {};
|