maplibre-gl-lidar 0.1.0

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +395 -0
  3. package/dist/LidarControl-BFJN1DIQ.js +37815 -0
  4. package/dist/LidarControl-BFJN1DIQ.js.map +1 -0
  5. package/dist/LidarControl-CQjIl4U5.cjs +37814 -0
  6. package/dist/LidarControl-CQjIl4U5.cjs.map +1 -0
  7. package/dist/index.cjs +21 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.mjs +21 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/laz-perf.wasm +0 -0
  12. package/dist/laz_rs_wasm_bg.wasm +0 -0
  13. package/dist/libs/laz_rs_wasm_bg.wasm +0 -0
  14. package/dist/maplibre-gl-lidar.css +570 -0
  15. package/dist/react.cjs +179 -0
  16. package/dist/react.cjs.map +1 -0
  17. package/dist/react.mjs +179 -0
  18. package/dist/react.mjs.map +1 -0
  19. package/dist/types/index.d.ts +13 -0
  20. package/dist/types/index.d.ts.map +1 -0
  21. package/dist/types/lib/colorizers/ColorScheme.d.ts +60 -0
  22. package/dist/types/lib/colorizers/ColorScheme.d.ts.map +1 -0
  23. package/dist/types/lib/colorizers/index.d.ts +3 -0
  24. package/dist/types/lib/colorizers/index.d.ts.map +1 -0
  25. package/dist/types/lib/colorizers/types.d.ts +17 -0
  26. package/dist/types/lib/colorizers/types.d.ts.map +1 -0
  27. package/dist/types/lib/core/DeckOverlay.d.ts +64 -0
  28. package/dist/types/lib/core/DeckOverlay.d.ts.map +1 -0
  29. package/dist/types/lib/core/LidarControl.d.ts +318 -0
  30. package/dist/types/lib/core/LidarControl.d.ts.map +1 -0
  31. package/dist/types/lib/core/LidarControlReact.d.ts +35 -0
  32. package/dist/types/lib/core/LidarControlReact.d.ts.map +1 -0
  33. package/dist/types/lib/core/ViewportManager.d.ts +105 -0
  34. package/dist/types/lib/core/ViewportManager.d.ts.map +1 -0
  35. package/dist/types/lib/core/types.d.ts +235 -0
  36. package/dist/types/lib/core/types.d.ts.map +1 -0
  37. package/dist/types/lib/gui/DualRangeSlider.d.ts +46 -0
  38. package/dist/types/lib/gui/DualRangeSlider.d.ts.map +1 -0
  39. package/dist/types/lib/gui/FileInput.d.ts +44 -0
  40. package/dist/types/lib/gui/FileInput.d.ts.map +1 -0
  41. package/dist/types/lib/gui/PanelBuilder.d.ts +117 -0
  42. package/dist/types/lib/gui/PanelBuilder.d.ts.map +1 -0
  43. package/dist/types/lib/gui/RangeSlider.d.ts +50 -0
  44. package/dist/types/lib/gui/RangeSlider.d.ts.map +1 -0
  45. package/dist/types/lib/gui/index.d.ts +7 -0
  46. package/dist/types/lib/gui/index.d.ts.map +1 -0
  47. package/dist/types/lib/hooks/index.d.ts +3 -0
  48. package/dist/types/lib/hooks/index.d.ts.map +1 -0
  49. package/dist/types/lib/hooks/useLidarState.d.ts +52 -0
  50. package/dist/types/lib/hooks/useLidarState.d.ts.map +1 -0
  51. package/dist/types/lib/hooks/usePointCloud.d.ts +53 -0
  52. package/dist/types/lib/hooks/usePointCloud.d.ts.map +1 -0
  53. package/dist/types/lib/layers/PointCloudManager.d.ts +136 -0
  54. package/dist/types/lib/layers/PointCloudManager.d.ts.map +1 -0
  55. package/dist/types/lib/layers/index.d.ts +3 -0
  56. package/dist/types/lib/layers/index.d.ts.map +1 -0
  57. package/dist/types/lib/layers/types.d.ts +71 -0
  58. package/dist/types/lib/layers/types.d.ts.map +1 -0
  59. package/dist/types/lib/loaders/CopcStreamingLoader.d.ts +217 -0
  60. package/dist/types/lib/loaders/CopcStreamingLoader.d.ts.map +1 -0
  61. package/dist/types/lib/loaders/PointCloudLoader.d.ts +61 -0
  62. package/dist/types/lib/loaders/PointCloudLoader.d.ts.map +1 -0
  63. package/dist/types/lib/loaders/index.d.ts +5 -0
  64. package/dist/types/lib/loaders/index.d.ts.map +1 -0
  65. package/dist/types/lib/loaders/streaming-types.d.ts +122 -0
  66. package/dist/types/lib/loaders/streaming-types.d.ts.map +1 -0
  67. package/dist/types/lib/loaders/types.d.ts +83 -0
  68. package/dist/types/lib/loaders/types.d.ts.map +1 -0
  69. package/dist/types/lib/utils/helpers.d.ts +91 -0
  70. package/dist/types/lib/utils/helpers.d.ts.map +1 -0
  71. package/dist/types/lib/utils/index.d.ts +2 -0
  72. package/dist/types/lib/utils/index.d.ts.map +1 -0
  73. package/dist/types/react.d.ts +6 -0
  74. package/dist/types/react.d.ts.map +1 -0
  75. package/package.json +118 -0
@@ -0,0 +1,136 @@
1
+ import { DeckOverlay } from '../core/DeckOverlay';
2
+ import { PointCloudData } from '../loaders/types';
3
+ import { ColorScheme, PointCloudBounds } from '../core/types';
4
+ import { PointCloudLayerOptions, PickedPointInfo } from './types';
5
+ /**
6
+ * Manages deck.gl PointCloudLayer instances for visualization.
7
+ */
8
+ export declare class PointCloudManager {
9
+ private _deckOverlay;
10
+ private _pointClouds;
11
+ private _options;
12
+ private _colorProcessor;
13
+ constructor(deckOverlay: DeckOverlay, options?: Partial<PointCloudLayerOptions>);
14
+ /**
15
+ * Sets the hover callback.
16
+ *
17
+ * @param callback - Function called when a point is hovered
18
+ */
19
+ setOnHover(callback: ((info: PickedPointInfo | null) => void) | undefined): void;
20
+ /**
21
+ * Adds a point cloud to the visualization.
22
+ *
23
+ * @param id - Unique identifier for the point cloud
24
+ * @param data - Point cloud data (positions are already offsets from coordinateOrigin)
25
+ */
26
+ addPointCloud(id: string, data: PointCloudData): void;
27
+ /**
28
+ * Updates an existing point cloud with new data.
29
+ * Used for streaming/incremental loading where points are added over time.
30
+ *
31
+ * @param id - Unique identifier for the point cloud
32
+ * @param data - Updated point cloud data
33
+ */
34
+ updatePointCloud(id: string, data: PointCloudData): void;
35
+ /**
36
+ * Gets the current point count for a point cloud.
37
+ *
38
+ * @param id - Point cloud ID
39
+ * @returns Point count or 0 if not found
40
+ */
41
+ getPointCount(id: string): number;
42
+ /**
43
+ * Removes a point cloud from the visualization.
44
+ *
45
+ * @param id - ID of the point cloud to remove
46
+ */
47
+ removePointCloud(id: string): void;
48
+ /**
49
+ * Checks if a point cloud exists.
50
+ *
51
+ * @param id - Point cloud ID
52
+ * @returns True if exists
53
+ */
54
+ hasPointCloud(id: string): boolean;
55
+ /**
56
+ * Gets all point cloud IDs.
57
+ *
58
+ * @returns Array of point cloud IDs
59
+ */
60
+ getPointCloudIds(): string[];
61
+ /**
62
+ * Gets the bounds of a point cloud.
63
+ *
64
+ * @param id - Point cloud ID
65
+ * @returns Bounds or undefined if not found
66
+ */
67
+ getPointCloudBounds(id: string): PointCloudBounds | undefined;
68
+ /**
69
+ * Updates styling options for all point clouds.
70
+ *
71
+ * @param options - New style options
72
+ */
73
+ updateStyle(options: Partial<PointCloudLayerOptions>): void;
74
+ /**
75
+ * Sets the point size.
76
+ *
77
+ * @param size - Point size in pixels
78
+ */
79
+ setPointSize(size: number): void;
80
+ /**
81
+ * Sets the opacity.
82
+ *
83
+ * @param opacity - Opacity value (0-1)
84
+ */
85
+ setOpacity(opacity: number): void;
86
+ /**
87
+ * Sets the color scheme.
88
+ *
89
+ * @param scheme - Color scheme to apply
90
+ */
91
+ setColorScheme(scheme: ColorScheme): void;
92
+ /**
93
+ * Sets whether to use percentile range for elevation/intensity coloring.
94
+ *
95
+ * @param usePercentile - Whether to use percentile range (2-98%)
96
+ */
97
+ setUsePercentile(usePercentile: boolean): void;
98
+ /**
99
+ * Sets the elevation range filter.
100
+ *
101
+ * @param range - [min, max] elevation or null to disable
102
+ */
103
+ setElevationRange(range: [number, number] | null): void;
104
+ /**
105
+ * Sets whether points are pickable (enables hover/click interactions).
106
+ *
107
+ * @param pickable - Whether points should be pickable
108
+ */
109
+ setPickable(pickable: boolean): void;
110
+ /**
111
+ * Sets the Z offset for vertical adjustment.
112
+ *
113
+ * @param offset - Z offset in meters
114
+ */
115
+ setZOffset(offset: number): void;
116
+ /**
117
+ * Clears all point clouds.
118
+ */
119
+ clear(): void;
120
+ /**
121
+ * Gets the current options.
122
+ */
123
+ getOptions(): PointCloudLayerOptions;
124
+ /**
125
+ * Creates a deck.gl layer for a point cloud.
126
+ * Chunks large point clouds into multiple layers to avoid WebGL buffer limits.
127
+ * Uses coordinateOrigin + LNGLAT_OFFSETS to maintain Float32 precision.
128
+ * Applies elevation filter if set.
129
+ */
130
+ private _createLayer;
131
+ /**
132
+ * Updates all layers with current options.
133
+ */
134
+ private _updateAllLayers;
135
+ }
136
+ //# sourceMappingURL=PointCloudManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PointCloudManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/layers/PointCloudManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAavE;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,eAAe,CAAuB;gBAElC,WAAW,EAAE,WAAW,EAAE,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM;IAgBnF;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI;IAIhF;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI;IAYrD;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI;IA6BxD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAIjC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAalC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIlC;;;;OAIG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI7D;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;IAsB3D;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAIzC;;;;OAIG;IACH,gBAAgB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI;IAI9C;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI;IAIvD;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAIpC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIhC;;OAEG;IACH,KAAK,IAAI,IAAI;IAYb;;OAEG;IACH,UAAU,IAAI,sBAAsB;IAIpC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IA6IpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAKzB"}
@@ -0,0 +1,3 @@
1
+ export { PointCloudManager } from './PointCloudManager';
2
+ export type { PointCloudLayerOptions } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/layers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { ColorScheme } from '../core/types';
2
+ /**
3
+ * Information about a picked point
4
+ */
5
+ export interface PickedPointInfo {
6
+ /** Point index within the point cloud */
7
+ index: number;
8
+ /** Longitude coordinate */
9
+ longitude: number;
10
+ /** Latitude coordinate */
11
+ latitude: number;
12
+ /** Elevation in meters */
13
+ elevation: number;
14
+ /** Intensity value (0-1) if available */
15
+ intensity?: number;
16
+ /** Classification code if available */
17
+ classification?: number;
18
+ /** Red color component (0-255) if available */
19
+ red?: number;
20
+ /** Green color component (0-255) if available */
21
+ green?: number;
22
+ /** Blue color component (0-255) if available */
23
+ blue?: number;
24
+ /** Dynamic map of all extra attributes available for this point */
25
+ attributes?: Record<string, number>;
26
+ /** Screen X coordinate */
27
+ x: number;
28
+ /** Screen Y coordinate */
29
+ y: number;
30
+ }
31
+ /**
32
+ * Options for configuring point cloud layer styling
33
+ */
34
+ export interface PointCloudLayerOptions {
35
+ /**
36
+ * Point size in pixels
37
+ */
38
+ pointSize: number;
39
+ /**
40
+ * Opacity (0-1)
41
+ */
42
+ opacity: number;
43
+ /**
44
+ * Color scheme for visualization
45
+ */
46
+ colorScheme: ColorScheme;
47
+ /**
48
+ * Whether to use percentile range (2-98%) for elevation/intensity coloring
49
+ * @default true
50
+ */
51
+ usePercentile: boolean;
52
+ /**
53
+ * Elevation range filter [min, max] or null for no filter
54
+ */
55
+ elevationRange: [number, number] | null;
56
+ /**
57
+ * Whether points are pickable (enables hover/click interactions)
58
+ * @default false
59
+ */
60
+ pickable: boolean;
61
+ /**
62
+ * Z offset in meters (shifts point cloud vertically)
63
+ * @default 0
64
+ */
65
+ zOffset: number;
66
+ /**
67
+ * Callback when a point is hovered (requires pickable: true)
68
+ */
69
+ onHover?: (info: PickedPointInfo | null) => void;
70
+ }
71
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/layers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAExC;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC;CAClD"}
@@ -0,0 +1,217 @@
1
+ import { CachedNode, StreamingLoaderOptions, ViewportInfo, StreamingLoaderEvent, StreamingLoaderEventHandler } from './streaming-types';
2
+ import { PointCloudData } from './types';
3
+ import { PointCloudBounds } from '../core/types';
4
+ /**
5
+ * Source type for streaming loader - can be URL, File, or ArrayBuffer
6
+ */
7
+ export type StreamingSource = string | File | ArrayBuffer;
8
+ /**
9
+ * Streams COPC point cloud data on-demand based on viewport.
10
+ * Implements center-first priority loading and respects point budget.
11
+ * Supports both URL and local file (File/ArrayBuffer) sources.
12
+ */
13
+ export declare class CopcStreamingLoader {
14
+ private _originalSource;
15
+ private _source;
16
+ private _copc;
17
+ private _lazPerf;
18
+ private _options;
19
+ private _hierarchyPages;
20
+ private _loadedHierarchyKeys;
21
+ private _rootHierarchyPage;
22
+ private _nodeCache;
23
+ private _positions;
24
+ private _colors;
25
+ private _intensities;
26
+ private _classifications;
27
+ private _extraAttributes;
28
+ private _coordinateOrigin;
29
+ private _bounds;
30
+ private _loadingQueue;
31
+ private _activeRequests;
32
+ private _totalLoadedPoints;
33
+ private _totalLoadedNodes;
34
+ private _isInitialized;
35
+ private _transformer;
36
+ private _verticalUnitFactor;
37
+ private _needsTransform;
38
+ private _hasColor;
39
+ private _totalPointsInFile;
40
+ private _octreeCube;
41
+ private _spacing;
42
+ private _availableDimensions;
43
+ private _dimensionsDetected;
44
+ private _eventHandlers;
45
+ private _pendingLayerUpdate;
46
+ private _updateBatchTimeout;
47
+ private _onPointsLoaded?;
48
+ /**
49
+ * Creates a new CopcStreamingLoader instance.
50
+ *
51
+ * @param source - URL string, File object, or ArrayBuffer
52
+ * @param options - Streaming options
53
+ */
54
+ constructor(source: StreamingSource, options?: StreamingLoaderOptions);
55
+ /**
56
+ * Initializes the COPC file - reads header and root hierarchy.
57
+ * Must be called before any loading operations.
58
+ *
59
+ * @returns Initial info about the point cloud
60
+ */
61
+ initialize(): Promise<{
62
+ bounds: PointCloudBounds;
63
+ totalPoints: number;
64
+ hasRGB: boolean;
65
+ spacing: number;
66
+ }>;
67
+ /**
68
+ * Pre-allocates buffers for the point budget.
69
+ */
70
+ private _allocateBuffers;
71
+ /**
72
+ * Gets the octree spacing value (useful for ViewportManager).
73
+ */
74
+ getSpacing(): number;
75
+ /**
76
+ * Parses a node key string to array format.
77
+ *
78
+ * @param key - Node key in format "depth-x-y-z"
79
+ * @returns NodeKey array [depth, x, y, z]
80
+ */
81
+ private _parseNodeKey;
82
+ /**
83
+ * Calculates the bounding box of an octree node.
84
+ *
85
+ * @param key - Node key [depth, x, y, z]
86
+ * @returns Node bounds in source CRS and WGS84
87
+ */
88
+ private _calculateNodeBounds;
89
+ /**
90
+ * Checks if a node's bounds intersect the viewport.
91
+ * Adds a buffer around viewport to catch edge/corner nodes.
92
+ *
93
+ * @param nodeBounds - Node bounds in WGS84
94
+ * @param viewport - Current viewport info
95
+ * @returns True if bounds intersect
96
+ */
97
+ private _boundsIntersectsViewport;
98
+ /**
99
+ * Calculates node priority based on distance from viewport center.
100
+ * Lower values = higher priority (closer to center).
101
+ *
102
+ * @param nodeBounds - Node bounds in WGS84
103
+ * @param viewport - Current viewport info
104
+ * @returns Priority value (distance from center)
105
+ */
106
+ private _calculateNodePriority;
107
+ /**
108
+ * Ensures the hierarchy page containing a node key is loaded.
109
+ *
110
+ * @param nodeKey - Node key to ensure hierarchy for
111
+ */
112
+ private _ensureHierarchyLoaded;
113
+ /**
114
+ * Recursively loads hierarchy pages.
115
+ *
116
+ * @param page - Hierarchy page to load
117
+ */
118
+ private _loadHierarchyRecursive;
119
+ /**
120
+ * Finds nodes that intersect the viewport and should be loaded.
121
+ * Implements center-first priority and LOD selection.
122
+ * Loads nodes at ALL depths up to targetDepth to ensure full coverage
123
+ * (parent nodes fill gaps where child nodes don't exist in sparse octrees).
124
+ *
125
+ * @param viewport - Current viewport information
126
+ * @returns Sorted array of nodes to load (by priority)
127
+ */
128
+ selectNodesForViewport(viewport: ViewportInfo): Promise<CachedNode[]>;
129
+ /**
130
+ * Queues a node for loading.
131
+ *
132
+ * @param node - Node to queue
133
+ */
134
+ queueNode(node: CachedNode): void;
135
+ /**
136
+ * Loads nodes from the queue, respecting point budget and concurrency limits.
137
+ */
138
+ loadQueuedNodes(): Promise<void>;
139
+ /**
140
+ * Loads a single node's point data.
141
+ *
142
+ * @param node - Node to load
143
+ */
144
+ private _loadNode;
145
+ /**
146
+ * Extracts point data from a view into the buffers.
147
+ *
148
+ * @param view - Point data view from copc.js
149
+ * @param node - Node being loaded
150
+ * @param startIndex - Starting index in buffers
151
+ */
152
+ private _extractPointData;
153
+ /**
154
+ * Schedules a batched layer update.
155
+ */
156
+ private _scheduleLayerUpdate;
157
+ /**
158
+ * Performs the layer update callback.
159
+ */
160
+ private _performLayerUpdate;
161
+ /**
162
+ * Sets the callback for when points are loaded.
163
+ *
164
+ * @param callback - Function to call with updated point cloud data
165
+ */
166
+ setOnPointsLoaded(callback: (data: PointCloudData) => void): void;
167
+ /**
168
+ * Gets the current loaded point cloud data for rendering.
169
+ *
170
+ * @returns Current loaded data
171
+ */
172
+ getLoadedPointCloudData(): PointCloudData;
173
+ /**
174
+ * Gets the current streaming progress.
175
+ *
176
+ * @returns Progress event data
177
+ */
178
+ private _getProgressEvent;
179
+ /**
180
+ * Registers an event handler.
181
+ *
182
+ * @param event - Event type
183
+ * @param handler - Handler function
184
+ */
185
+ on(event: StreamingLoaderEvent, handler: StreamingLoaderEventHandler): void;
186
+ /**
187
+ * Removes an event handler.
188
+ *
189
+ * @param event - Event type
190
+ * @param handler - Handler function
191
+ */
192
+ off(event: StreamingLoaderEvent, handler: StreamingLoaderEventHandler): void;
193
+ /**
194
+ * Emits an event to all registered handlers.
195
+ *
196
+ * @param event - Event type
197
+ * @param data - Event data
198
+ */
199
+ private _emit;
200
+ /**
201
+ * Gets the total number of loaded points.
202
+ */
203
+ getLoadedPointCount(): number;
204
+ /**
205
+ * Gets the total number of loaded nodes.
206
+ */
207
+ getLoadedNodeCount(): number;
208
+ /**
209
+ * Checks if the loader is currently loading.
210
+ */
211
+ isLoading(): boolean;
212
+ /**
213
+ * Destroys the streaming loader and cleans up resources.
214
+ */
215
+ destroy(): void;
216
+ }
217
+ //# sourceMappingURL=CopcStreamingLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopcStreamingLoader.d.ts","sourceRoot":"","sources":["../../../../src/lib/loaders/CopcStreamingLoader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,UAAU,EACV,sBAAsB,EACtB,YAAY,EAEZ,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAwC,MAAM,SAAS,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,CAAC;AA6J1D;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,QAAQ,CAAmC;IAGnD,OAAO,CAAC,eAAe,CAA6C;IACpE,OAAO,CAAC,oBAAoB,CAA0B;IACtD,OAAO,CAAC,kBAAkB,CAA+B;IAGzD,OAAO,CAAC,UAAU,CAAsC;IAGxD,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,iBAAiB,CAAuC;IAChE,OAAO,CAAC,OAAO,CAAiC;IAGhD,OAAO,CAAC,a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AE,CAAC;IAyC3E;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAYjC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBtC;;;;OAIG;YACW,SAAS;IAiEvB;;;;;;OAMG;YACW,iBAAiB;IAsE/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;;OAIG;IACH,iBAAiB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;IAIjE;;;;OAIG;IACH,uBAAuB,IAAI,cAAc;IA4BzC;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAO3E;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAI5E;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAYb;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,OAAO,IAAI,IAAI;CAoBhB"}
@@ -0,0 +1,61 @@
1
+ import { PointCloudData } from './types';
2
+ /**
3
+ * Loads and parses LiDAR point cloud files (LAS, LAZ, COPC).
4
+ * Uses copc.js for COPC/LAZ files with LAS 1.4 support.
5
+ */
6
+ export declare class PointCloudLoader {
7
+ /**
8
+ * Creates a new PointCloudLoader instance.
9
+ */
10
+ constructor();
11
+ private _onProgress?;
12
+ /**
13
+ * Loads a point cloud from a URL, File, or ArrayBuffer.
14
+ *
15
+ * @param source - URL string, File object, or ArrayBuffer
16
+ * @param onProgress - Optional progress callback (progress: 0-100, message: string)
17
+ * @returns Normalized point cloud data
18
+ */
19
+ load(source: string | File | ArrayBuffer, onProgress?: (progress: number, message: string) => void): Promise<PointCloudData>;
20
+ /**
21
+ * Reports progress to the callback if set.
22
+ */
23
+ private _reportProgress;
24
+ /**
25
+ * Yields to the event loop to allow UI updates.
26
+ */
27
+ private _yieldToUI;
28
+ /**
29
+ * Loads a COPC file from a URL using the copc.js library.
30
+ * Falls back to loaders.gl for unsupported LAS versions (e.g., 1.3).
31
+ */
32
+ private _loadCopcFromUrl;
33
+ /**
34
+ * Loads a COPC file from an ArrayBuffer using the copc.js library.
35
+ * Falls back to loaders.gl for unsupported LAS versions (e.g., 1.3).
36
+ */
37
+ private _loadCopcFromBuffer;
38
+ /**
39
+ * Loads a regular LAS 1.2/1.4 file using copc.js Las module.
40
+ */
41
+ private _loadRegularLasFromBuffer;
42
+ /**
43
+ * Loads a point cloud using loaders.gl (fallback for LAS 1.0/1.1/1.3).
44
+ */
45
+ private _loadWithLoadersGL;
46
+ /**
47
+ * Loads a point cloud from URL using loaders.gl (fallback for unsupported LAS versions).
48
+ */
49
+ private _loadUrlWithLoadersGL;
50
+ /**
51
+ * Recursively loads all hierarchy pages from a COPC file.
52
+ * @param source - URL string or Getter function
53
+ * @param info - COPC info containing root hierarchy page
54
+ */
55
+ private _loadFullHierarchy;
56
+ /**
57
+ * Process COPC data and extract point cloud information.
58
+ */
59
+ private _processCopcData;
60
+ }
61
+ //# sourceMappingURL=PointCloudLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PointCloudLoader.d.ts","sourceRoot":"","sources":["../../../../src/lib/loaders/PointCloudLoader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAwC,MAAM,SAAS,CAAC;AA+JpF;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;;IAKH,OAAO,CAAC,WAAW,CAAC,CAA8C;IAElE;;;;;;OAMG;IACG,IAAI,CACR,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,EACnC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GACvD,OAAO,CAAC,cAAc,CAAC;IAyB1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;YACW,UAAU;IAIxB;;;OAGG;YACW,gBAAgB;IA+C9B;;;OAGG;YACW,mBAAmB;IAoDjC;;OAEG;YACW,yBAAyB;IAsLvC;;OAEG;YACW,kBAAkB;IAmNhC;;OAEG;YACW,qBAAqB;IAcnC;;;;OAIG;YACW,kBAAkB;IA6BhC;;OAEG;YACW,gBAAgB;CAgP/B"}
@@ -0,0 +1,5 @@
1
+ export { PointCloudLoader } from './PointCloudLoader';
2
+ export { CopcStreamingLoader } from './CopcStreamingLoader';
3
+ export type { PointCloudData, LoaderOptions } from './types';
4
+ export type { CopcLoadingMode, StreamingLoaderOptions, StreamingProgressEvent, ViewportInfo, CachedNode, NodeKey, NodeState, StreamingLoaderEvent, StreamingLoaderEventHandler, StreamingLoadOptions, } from './streaming-types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/loaders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,122 @@
1
+ import { PointCloudBounds } from '../core/types';
2
+ /**
3
+ * COPC loading mode options
4
+ */
5
+ export type CopcLoadingMode = 'full' | 'dynamic';
6
+ /**
7
+ * Represents an octree node key in COPC format
8
+ * Format: [depth, x, y, z]
9
+ */
10
+ export type NodeKey = [number, number, number, number];
11
+ /**
12
+ * Streaming loader options
13
+ */
14
+ export interface StreamingLoaderOptions {
15
+ /**
16
+ * Maximum number of points to keep in memory
17
+ * @default 5_000_000
18
+ */
19
+ pointBudget?: number;
20
+ /**
21
+ * Maximum concurrent node requests
22
+ * @default 4
23
+ */
24
+ maxConcurrentRequests?: number;
25
+ /**
26
+ * Debounce time for viewport changes in ms
27
+ * @default 150
28
+ */
29
+ viewportDebounceMs?: number;
30
+ /**
31
+ * Minimum zoom level to start loading high-detail nodes
32
+ * @default 10
33
+ */
34
+ minDetailZoom?: number;
35
+ /**
36
+ * Maximum octree depth to load
37
+ * @default 20
38
+ */
39
+ maxOctreeDepth?: number;
40
+ }
41
+ /**
42
+ * State of a node in the streaming cache
43
+ */
44
+ export type NodeState = 'pending' | 'loading' | 'loaded' | 'error';
45
+ /**
46
+ * Cached node data
47
+ */
48
+ export interface CachedNode {
49
+ /** String format key: "depth-x-y-z" */
50
+ key: string;
51
+ /** Array format key: [depth, x, y, z] */
52
+ keyArray: NodeKey;
53
+ /** Current state of the node */
54
+ state: NodeState;
55
+ /** Number of points in this node */
56
+ pointCount: number;
57
+ /** Offset in the COPC file for point data */
58
+ pointDataOffset: number;
59
+ /** Length of point data in bytes */
60
+ pointDataLength: number;
61
+ /** Bounding box in source CRS */
62
+ bounds: PointCloudBounds;
63
+ /** Bounding box in WGS84 (for viewport intersection) */
64
+ boundsWgs84: PointCloudBounds;
65
+ /** Distance from viewport center (for priority queue) - lower = higher priority */
66
+ priority?: number;
67
+ /** Points array slice start index in the main buffer */
68
+ bufferStartIndex?: number;
69
+ /** Error message if state is 'error' */
70
+ error?: string;
71
+ }
72
+ /**
73
+ * Viewport information for node selection
74
+ */
75
+ export interface ViewportInfo {
76
+ /** Viewport bounds in WGS84 [west, south, east, north] */
77
+ bounds: [number, number, number, number];
78
+ /** Viewport center in WGS84 [lng, lat] */
79
+ center: [number, number];
80
+ /** Current zoom level */
81
+ zoom: number;
82
+ /** Current pitch (tilt angle in degrees) */
83
+ pitch: number;
84
+ /** Target octree depth based on zoom and pitch */
85
+ targetDepth: number;
86
+ }
87
+ /**
88
+ * Streaming progress event data
89
+ */
90
+ export interface StreamingProgressEvent {
91
+ /** Total nodes in viewport */
92
+ totalNodesInView: number;
93
+ /** Nodes currently loaded */
94
+ loadedNodes: number;
95
+ /** Points currently loaded */
96
+ loadedPoints: number;
97
+ /** Point budget limit */
98
+ pointBudget: number;
99
+ /** Whether loading is in progress */
100
+ isLoading: boolean;
101
+ /** Current loading queue size */
102
+ queueSize: number;
103
+ }
104
+ /**
105
+ * Events emitted by the streaming loader
106
+ */
107
+ export type StreamingLoaderEvent = 'progress' | 'nodeloaded' | 'viewportchange' | 'budgetreached' | 'error';
108
+ /**
109
+ * Event handler for streaming loader events
110
+ */
111
+ export type StreamingLoaderEventHandler = (event: StreamingLoaderEvent, data: StreamingProgressEvent | CachedNode | Error) => void;
112
+ /**
113
+ * Load options that can be passed to loadPointCloud for streaming
114
+ */
115
+ export interface StreamingLoadOptions extends StreamingLoaderOptions {
116
+ /**
117
+ * Loading mode: 'full' for complete load, 'dynamic' for viewport-based streaming
118
+ * @default 'full'
119
+ */
120
+ loadingMode?: CopcLoadingMode;
121
+ }
122
+ //# sourceMappingURL=streaming-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-types.d.ts","sourceRoot":"","sources":["../../../../src/lib/loaders/streaming-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OA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