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.
- package/LICENSE +21 -0
- package/README.md +395 -0
- package/dist/LidarControl-BFJN1DIQ.js +37815 -0
- package/dist/LidarControl-BFJN1DIQ.js.map +1 -0
- package/dist/LidarControl-CQjIl4U5.cjs +37814 -0
- package/dist/LidarControl-CQjIl4U5.cjs.map +1 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +21 -0
- package/dist/index.mjs.map +1 -0
- package/dist/laz-perf.wasm +0 -0
- package/dist/laz_rs_wasm_bg.wasm +0 -0
- package/dist/libs/laz_rs_wasm_bg.wasm +0 -0
- package/dist/maplibre-gl-lidar.css +570 -0
- package/dist/react.cjs +179 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.mjs +179 -0
- package/dist/react.mjs.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/colorizers/ColorScheme.d.ts +60 -0
- package/dist/types/lib/colorizers/ColorScheme.d.ts.map +1 -0
- package/dist/types/lib/colorizers/index.d.ts +3 -0
- package/dist/types/lib/colorizers/index.d.ts.map +1 -0
- package/dist/types/lib/colorizers/types.d.ts +17 -0
- package/dist/types/lib/colorizers/types.d.ts.map +1 -0
- package/dist/types/lib/core/DeckOverlay.d.ts +64 -0
- package/dist/types/lib/core/DeckOverlay.d.ts.map +1 -0
- package/dist/types/lib/core/LidarControl.d.ts +318 -0
- package/dist/types/lib/core/LidarControl.d.ts.map +1 -0
- package/dist/types/lib/core/LidarControlReact.d.ts +35 -0
- package/dist/types/lib/core/LidarControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/ViewportManager.d.ts +105 -0
- package/dist/types/lib/core/ViewportManager.d.ts.map +1 -0
- package/dist/types/lib/core/types.d.ts +235 -0
- package/dist/types/lib/core/types.d.ts.map +1 -0
- package/dist/types/lib/gui/DualRangeSlider.d.ts +46 -0
- package/dist/types/lib/gui/DualRangeSlider.d.ts.map +1 -0
- package/dist/types/lib/gui/FileInput.d.ts +44 -0
- package/dist/types/lib/gui/FileInput.d.ts.map +1 -0
- package/dist/types/lib/gui/PanelBuilder.d.ts +117 -0
- package/dist/types/lib/gui/PanelBuilder.d.ts.map +1 -0
- package/dist/types/lib/gui/RangeSlider.d.ts +50 -0
- package/dist/types/lib/gui/RangeSlider.d.ts.map +1 -0
- package/dist/types/lib/gui/index.d.ts +7 -0
- package/dist/types/lib/gui/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/index.d.ts +3 -0
- package/dist/types/lib/hooks/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useLidarState.d.ts +52 -0
- package/dist/types/lib/hooks/useLidarState.d.ts.map +1 -0
- package/dist/types/lib/hooks/usePointCloud.d.ts +53 -0
- package/dist/types/lib/hooks/usePointCloud.d.ts.map +1 -0
- package/dist/types/lib/layers/PointCloudManager.d.ts +136 -0
- package/dist/types/lib/layers/PointCloudManager.d.ts.map +1 -0
- package/dist/types/lib/layers/index.d.ts +3 -0
- package/dist/types/lib/layers/index.d.ts.map +1 -0
- package/dist/types/lib/layers/types.d.ts +71 -0
- package/dist/types/lib/layers/types.d.ts.map +1 -0
- package/dist/types/lib/loaders/CopcStreamingLoader.d.ts +217 -0
- package/dist/types/lib/loaders/CopcStreamingLoader.d.ts.map +1 -0
- package/dist/types/lib/loaders/PointCloudLoader.d.ts +61 -0
- package/dist/types/lib/loaders/PointCloudLoader.d.ts.map +1 -0
- package/dist/types/lib/loaders/index.d.ts +5 -0
- package/dist/types/lib/loaders/index.d.ts.map +1 -0
- package/dist/types/lib/loaders/streaming-types.d.ts +122 -0
- package/dist/types/lib/loaders/streaming-types.d.ts.map +1 -0
- package/dist/types/lib/loaders/types.d.ts +83 -0
- package/dist/types/lib/loaders/types.d.ts.map +1 -0
- package/dist/types/lib/utils/helpers.d.ts +91 -0
- package/dist/types/lib/utils/helpers.d.ts.map +1 -0
- package/dist/types/lib/utils/index.d.ts +2 -0
- package/dist/types/lib/utils/index.d.ts.map +1 -0
- package/dist/types/react.d.ts +6 -0
- package/dist/types/react.d.ts.map +1 -0
- package/package.json +118 -0
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const LidarControl = require("./LidarControl-CQjIl4U5.cjs");
|
|
5
|
+
function LidarControlReact({
|
|
6
|
+
map,
|
|
7
|
+
onStateChange,
|
|
8
|
+
onLoad,
|
|
9
|
+
onError,
|
|
10
|
+
...options
|
|
11
|
+
}) {
|
|
12
|
+
const controlRef = react.useRef(null);
|
|
13
|
+
react.useEffect(() => {
|
|
14
|
+
if (!map) return;
|
|
15
|
+
const control = new LidarControl.LidarControl(options);
|
|
16
|
+
controlRef.current = control;
|
|
17
|
+
if (onStateChange) {
|
|
18
|
+
control.on("statechange", (event) => {
|
|
19
|
+
onStateChange(event.state);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (onLoad) {
|
|
23
|
+
control.on("load", (event) => {
|
|
24
|
+
if (event.pointCloud) {
|
|
25
|
+
onLoad(event.pointCloud);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (onError) {
|
|
30
|
+
control.on("loaderror", (event) => {
|
|
31
|
+
if (event.error) {
|
|
32
|
+
onError(event.error);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
map.addControl(control, options.position || "top-right");
|
|
37
|
+
return () => {
|
|
38
|
+
if (map.hasControl(control)) {
|
|
39
|
+
map.removeControl(control);
|
|
40
|
+
}
|
|
41
|
+
controlRef.current = null;
|
|
42
|
+
};
|
|
43
|
+
}, [map]);
|
|
44
|
+
react.useEffect(() => {
|
|
45
|
+
if (controlRef.current) {
|
|
46
|
+
const currentState = controlRef.current.getState();
|
|
47
|
+
if (options.collapsed !== void 0 && options.collapsed !== currentState.collapsed) {
|
|
48
|
+
if (options.collapsed) {
|
|
49
|
+
controlRef.current.collapse();
|
|
50
|
+
} else {
|
|
51
|
+
controlRef.current.expand();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (options.pointSize !== void 0 && options.pointSize !== currentState.pointSize) {
|
|
55
|
+
controlRef.current.setPointSize(options.pointSize);
|
|
56
|
+
}
|
|
57
|
+
if (options.opacity !== void 0 && options.opacity !== currentState.opacity) {
|
|
58
|
+
controlRef.current.setOpacity(options.opacity);
|
|
59
|
+
}
|
|
60
|
+
if (options.colorScheme !== void 0 && options.colorScheme !== currentState.colorScheme) {
|
|
61
|
+
controlRef.current.setColorScheme(options.colorScheme);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [options.collapsed, options.pointSize, options.opacity, options.colorScheme]);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const DEFAULT_STATE = {
|
|
68
|
+
collapsed: true,
|
|
69
|
+
panelWidth: 365,
|
|
70
|
+
panelMaxHeight: 600,
|
|
71
|
+
pointClouds: [],
|
|
72
|
+
activePointCloudId: null,
|
|
73
|
+
pointSize: 2,
|
|
74
|
+
opacity: 1,
|
|
75
|
+
colorScheme: "elevation",
|
|
76
|
+
usePercentile: true,
|
|
77
|
+
elevationRange: null,
|
|
78
|
+
pointBudget: 1e6,
|
|
79
|
+
pickable: false,
|
|
80
|
+
loading: false,
|
|
81
|
+
error: null,
|
|
82
|
+
zOffsetEnabled: false,
|
|
83
|
+
zOffset: 0
|
|
84
|
+
};
|
|
85
|
+
function useLidarState(initialState) {
|
|
86
|
+
const [state, setState] = react.useState({
|
|
87
|
+
...DEFAULT_STATE,
|
|
88
|
+
...initialState
|
|
89
|
+
});
|
|
90
|
+
const setCollapsed = react.useCallback((collapsed) => {
|
|
91
|
+
setState((prev) => ({ ...prev, collapsed }));
|
|
92
|
+
}, []);
|
|
93
|
+
const setPanelWidth = react.useCallback((panelWidth) => {
|
|
94
|
+
setState((prev) => ({ ...prev, panelWidth }));
|
|
95
|
+
}, []);
|
|
96
|
+
const setPointSize = react.useCallback((pointSize) => {
|
|
97
|
+
setState((prev) => ({ ...prev, pointSize }));
|
|
98
|
+
}, []);
|
|
99
|
+
const setOpacity = react.useCallback((opacity) => {
|
|
100
|
+
setState((prev) => ({ ...prev, opacity }));
|
|
101
|
+
}, []);
|
|
102
|
+
const setColorScheme = react.useCallback((colorScheme) => {
|
|
103
|
+
setState((prev) => ({ ...prev, colorScheme }));
|
|
104
|
+
}, []);
|
|
105
|
+
const setUsePercentile = react.useCallback((usePercentile) => {
|
|
106
|
+
setState((prev) => ({ ...prev, usePercentile }));
|
|
107
|
+
}, []);
|
|
108
|
+
const setElevationRange = react.useCallback((elevationRange) => {
|
|
109
|
+
setState((prev) => ({ ...prev, elevationRange }));
|
|
110
|
+
}, []);
|
|
111
|
+
const setPointBudget = react.useCallback((pointBudget) => {
|
|
112
|
+
setState((prev) => ({ ...prev, pointBudget }));
|
|
113
|
+
}, []);
|
|
114
|
+
const setZOffsetEnabled = react.useCallback((zOffsetEnabled) => {
|
|
115
|
+
setState((prev) => ({ ...prev, zOffsetEnabled }));
|
|
116
|
+
}, []);
|
|
117
|
+
const setZOffset = react.useCallback((zOffset) => {
|
|
118
|
+
setState((prev) => ({ ...prev, zOffset }));
|
|
119
|
+
}, []);
|
|
120
|
+
const reset = react.useCallback(() => {
|
|
121
|
+
setState({ ...DEFAULT_STATE, ...initialState });
|
|
122
|
+
}, [initialState]);
|
|
123
|
+
const toggle = react.useCallback(() => {
|
|
124
|
+
setState((prev) => ({ ...prev, collapsed: !prev.collapsed }));
|
|
125
|
+
}, []);
|
|
126
|
+
return {
|
|
127
|
+
state,
|
|
128
|
+
setState,
|
|
129
|
+
setCollapsed,
|
|
130
|
+
setPanelWidth,
|
|
131
|
+
setPointSize,
|
|
132
|
+
setOpacity,
|
|
133
|
+
setColorScheme,
|
|
134
|
+
setUsePercentile,
|
|
135
|
+
setElevationRange,
|
|
136
|
+
setPointBudget,
|
|
137
|
+
setZOffsetEnabled,
|
|
138
|
+
setZOffset,
|
|
139
|
+
reset,
|
|
140
|
+
toggle
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function usePointCloud(options) {
|
|
144
|
+
const [data, setData] = react.useState(null);
|
|
145
|
+
const [loading, setLoading] = react.useState(false);
|
|
146
|
+
const [error, setError] = react.useState(null);
|
|
147
|
+
const [progress, setProgress] = react.useState(0);
|
|
148
|
+
const load = react.useCallback(
|
|
149
|
+
async (source) => {
|
|
150
|
+
setLoading(true);
|
|
151
|
+
setError(null);
|
|
152
|
+
setProgress(0);
|
|
153
|
+
try {
|
|
154
|
+
const loader = new LidarControl.PointCloudLoader();
|
|
155
|
+
const result = await loader.load(source);
|
|
156
|
+
setData(result);
|
|
157
|
+
return result;
|
|
158
|
+
} catch (err) {
|
|
159
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
160
|
+
setError(e);
|
|
161
|
+
return null;
|
|
162
|
+
} finally {
|
|
163
|
+
setLoading(false);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
[options]
|
|
167
|
+
);
|
|
168
|
+
const reset = react.useCallback(() => {
|
|
169
|
+
setData(null);
|
|
170
|
+
setLoading(false);
|
|
171
|
+
setError(null);
|
|
172
|
+
setProgress(0);
|
|
173
|
+
}, []);
|
|
174
|
+
return { data, loading, error, progress, load, reset };
|
|
175
|
+
}
|
|
176
|
+
exports.LidarControlReact = LidarControlReact;
|
|
177
|
+
exports.useLidarState = useLidarState;
|
|
178
|
+
exports.usePointCloud = usePointCloud;
|
|
179
|
+
//# sourceMappingURL=react.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":["../src/lib/core/LidarControlReact.tsx","../src/lib/hooks/useLidarState.ts","../src/lib/hooks/usePointCloud.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { LidarControl } from './LidarControl';\nimport type { LidarControlReactProps } from './types';\n\n/**\n * React wrapper component for LidarControl.\n *\n * This component manages the lifecycle of a LidarControl instance,\n * adding it to the map on mount and removing it on unmount.\n *\n * @example\n * ```tsx\n * import { LidarControlReact } from 'maplibre-gl-lidar/react';\n *\n * function MyMap() {\n * const [map, setMap] = useState<Map | null>(null);\n *\n * return (\n * <>\n * <div ref={mapContainer} />\n * {map && (\n * <LidarControlReact\n * map={map}\n * title=\"LiDAR Viewer\"\n * collapsed={false}\n * onLoad={(pc) => console.log('Loaded:', pc)}\n * />\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @param props - Component props including map instance and control options\n * @returns null - This component renders nothing directly\n */\nexport function LidarControlReact({\n map,\n onStateChange,\n onLoad,\n onError,\n ...options\n}: LidarControlReactProps): null {\n const controlRef = useRef<LidarControl | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create the control instance\n const control = new LidarControl(options);\n controlRef.current = control;\n\n // Register event handlers\n if (onStateChange) {\n control.on('statechange', (event) => {\n onStateChange(event.state);\n });\n }\n\n if (onLoad) {\n control.on('load', (event) => {\n if (event.pointCloud) {\n onLoad(event.pointCloud);\n }\n });\n }\n\n if (onError) {\n control.on('loaderror', (event) => {\n if (event.error) {\n onError(event.error);\n }\n });\n }\n\n // Add control to map\n map.addControl(control, options.position || 'top-right');\n\n // Cleanup on unmount\n return () => {\n if (map.hasControl(control)) {\n map.removeControl(control);\n }\n controlRef.current = null;\n };\n }, [map]);\n\n // Update options when they change\n useEffect(() => {\n if (controlRef.current) {\n // Handle collapsed state changes\n const currentState = controlRef.current.getState();\n if (options.collapsed !== undefined && options.collapsed !== currentState.collapsed) {\n if (options.collapsed) {\n controlRef.current.collapse();\n } else {\n controlRef.current.expand();\n }\n }\n\n // Handle style changes\n if (options.pointSize !== undefined && options.pointSize !== currentState.pointSize) {\n controlRef.current.setPointSize(options.pointSize);\n }\n\n if (options.opacity !== undefined && options.opacity !== currentState.opacity) {\n controlRef.current.setOpacity(options.opacity);\n }\n\n if (options.colorScheme !== undefined && options.colorScheme !== currentState.colorScheme) {\n controlRef.current.setColorScheme(options.colorScheme);\n }\n }\n }, [options.collapsed, options.pointSize, options.opacity, options.colorScheme]);\n\n return null;\n}\n","import { useState, useCallback } from 'react';\nimport type { LidarState, ColorScheme } from '../core/types';\n\n/**\n * Default initial state for the LiDAR control\n */\nconst DEFAULT_STATE: LidarState = {\n collapsed: true,\n panelWidth: 365,\n panelMaxHeight: 600,\n pointClouds: [],\n activePointCloudId: null,\n pointSize: 2,\n opacity: 1.0,\n colorScheme: 'elevation',\n usePercentile: true,\n elevationRange: null,\n pointBudget: 1000000,\n pickable: false,\n loading: false,\n error: null,\n zOffsetEnabled: false,\n zOffset: 0,\n};\n\n/**\n * Custom hook for managing LiDAR state in React applications.\n *\n * This hook provides a simple way to track and update the state\n * of a LidarControl from React components.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { state, setPointSize, setColorScheme, toggle } = useLidarState();\n *\n * return (\n * <div>\n * <button onClick={toggle}>\n * {state.collapsed ? 'Expand' : 'Collapse'}\n * </button>\n * <button onClick={() => setColorScheme('intensity')}>\n * Show Intensity\n * </button>\n * <LidarControlReact\n * map={map}\n * collapsed={state.collapsed}\n * pointSize={state.pointSize}\n * colorScheme={state.colorScheme}\n * onStateChange={(newState) => setState(newState)}\n * />\n * </div>\n * );\n * }\n * ```\n *\n * @param initialState - Optional initial state values\n * @returns Object containing state and update functions\n */\nexport function useLidarState(initialState?: Partial<LidarState>) {\n const [state, setState] = useState<LidarState>({\n ...DEFAULT_STATE,\n ...initialState,\n });\n\n /**\n * Sets the collapsed state\n */\n const setCollapsed = useCallback((collapsed: boolean) => {\n setState((prev) => ({ ...prev, collapsed }));\n }, []);\n\n /**\n * Sets the panel width\n */\n const setPanelWidth = useCallback((panelWidth: number) => {\n setState((prev) => ({ ...prev, panelWidth }));\n }, []);\n\n /**\n * Sets the point size\n */\n const setPointSize = useCallback((pointSize: number) => {\n setState((prev) => ({ ...prev, pointSize }));\n }, []);\n\n /**\n * Sets the opacity\n */\n const setOpacity = useCallback((opacity: number) => {\n setState((prev) => ({ ...prev, opacity }));\n }, []);\n\n /**\n * Sets the color scheme\n */\n const setColorScheme = useCallback((colorScheme: ColorScheme) => {\n setState((prev) => ({ ...prev, colorScheme }));\n }, []);\n\n /**\n * Sets whether to use percentile range for coloring\n */\n const setUsePercentile = useCallback((usePercentile: boolean) => {\n setState((prev) => ({ ...prev, usePercentile }));\n }, []);\n\n /**\n * Sets the elevation range filter\n */\n const setElevationRange = useCallback((elevationRange: [number, number] | null) => {\n setState((prev) => ({ ...prev, elevationRange }));\n }, []);\n\n /**\n * Sets the point budget\n */\n const setPointBudget = useCallback((pointBudget: number) => {\n setState((prev) => ({ ...prev, pointBudget }));\n }, []);\n\n /**\n * Sets whether Z offset is enabled\n */\n const setZOffsetEnabled = useCallback((zOffsetEnabled: boolean) => {\n setState((prev) => ({ ...prev, zOffsetEnabled }));\n }, []);\n\n /**\n * Sets the Z offset value\n */\n const setZOffset = useCallback((zOffset: number) => {\n setState((prev) => ({ ...prev, zOffset }));\n }, []);\n\n /**\n * Resets the state to default values\n */\n const reset = useCallback(() => {\n setState({ ...DEFAULT_STATE, ...initialState });\n }, [initialState]);\n\n /**\n * Toggles the collapsed state\n */\n const toggle = useCallback(() => {\n setState((prev) => ({ ...prev, collapsed: !prev.collapsed }));\n }, []);\n\n return {\n state,\n setState,\n setCollapsed,\n setPanelWidth,\n setPointSize,\n setOpacity,\n setColorScheme,\n setUsePercentile,\n setElevationRange,\n setPointBudget,\n setZOffsetEnabled,\n setZOffset,\n reset,\n toggle,\n };\n}\n","import { useState, useCallback } from 'react';\nimport { PointCloudLoader } from '../loaders/PointCloudLoader';\nimport type { PointCloudData, LoaderOptions } from '../loaders/types';\n\n/**\n * Result of the usePointCloud hook\n */\ninterface UsePointCloudResult {\n /** The loaded point cloud data or null */\n data: PointCloudData | null;\n /** Whether loading is in progress */\n loading: boolean;\n /** Error if loading failed */\n error: Error | null;\n /** Loading progress (0-1) */\n progress: number;\n /** Function to load a point cloud */\n load: (source: string | File | ArrayBuffer) => Promise<PointCloudData | null>;\n /** Function to reset the state */\n reset: () => void;\n}\n\n/**\n * Custom hook for loading point cloud data in React applications.\n *\n * This hook provides a simple way to load point cloud files\n * with loading state and error handling.\n *\n * @example\n * ```tsx\n * function PointCloudLoader() {\n * const { data, loading, error, load, reset } = usePointCloud();\n *\n * const handleFile = async (file: File) => {\n * const result = await load(file);\n * if (result) {\n * console.log(`Loaded ${result.pointCount} points`);\n * }\n * };\n *\n * return (\n * <div>\n * <input type=\"file\" onChange={(e) => handleFile(e.target.files?.[0])} />\n * {loading && <p>Loading...</p>}\n * {error && <p>Error: {error.message}</p>}\n * {data && <p>Loaded {data.pointCount} points</p>}\n * </div>\n * );\n * }\n * ```\n *\n * @param options - Optional loader options\n * @returns Object containing state and functions\n */\nexport function usePointCloud(options?: Partial<LoaderOptions>): UsePointCloudResult {\n const [data, setData] = useState<PointCloudData | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [progress, setProgress] = useState(0);\n\n const load = useCallback(\n async (source: string | File | ArrayBuffer): Promise<PointCloudData | null> => {\n setLoading(true);\n setError(null);\n setProgress(0);\n\n try {\n const loader = new PointCloudLoader();\n const result = await loader.load(source);\n setData(result);\n return result;\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setError(e);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const reset = useCallback(() => {\n setData(null);\n setLoading(false);\n setError(null);\n setProgress(0);\n }, []);\n\n return { data, loading, error, progress, load, reset };\n}\n"],"names":["useRef","useEffect","LidarControl","useState","useCallback","PointCloudLoader"],"mappings":";;;;AAoCO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAC/B,QAAM,aAAaA,MAAAA,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CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAuB,IAAI;AACrD,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAS,CAAC;AAE1C,QAAM,OAAOC,MAAAA;AAAAA,IACX,OAAO,WAAwE;AAC7E,iBAAW,IAAI;AACf,eAAS,IAAI;AACb,kBAAY,CAAC;AAEb,UAAI;AACF,cAAM,SAAS,IAAIC,8BAAA;AACnB,cAAM,SAAS,MAAM,OAAO,KAAK,MAAM;AACvC,gBAAQ,MAAM;AACd,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,IAAI,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAC5D,iBAAS,CAAC;AACV,eAAO;AAAA,MACT,UAAA;AACE,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF;AAAA,IACA,CAAC,OAAO;AAAA,EAAA;AAGV,QAAM,QAAQD,MAAAA,YAAY,MAAM;AAC9B,YAAQ,IAAI;AACZ,eAAW,KAAK;AAChB,aAAS,IAAI;AACb,gBAAY,CAAC;AAAA,EACf,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,MAAM,SAAS,OAAO,UAAU,MAAM,MAAA;AACjD;;;;"}
|
package/dist/react.mjs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { useRef, useEffect, useState, useCallback } from "react";
|
|
2
|
+
import { L as LidarControl, P as PointCloudLoader } from "./LidarControl-BFJN1DIQ.js";
|
|
3
|
+
function LidarControlReact({
|
|
4
|
+
map,
|
|
5
|
+
onStateChange,
|
|
6
|
+
onLoad,
|
|
7
|
+
onError,
|
|
8
|
+
...options
|
|
9
|
+
}) {
|
|
10
|
+
const controlRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!map) return;
|
|
13
|
+
const control = new LidarControl(options);
|
|
14
|
+
controlRef.current = control;
|
|
15
|
+
if (onStateChange) {
|
|
16
|
+
control.on("statechange", (event) => {
|
|
17
|
+
onStateChange(event.state);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (onLoad) {
|
|
21
|
+
control.on("load", (event) => {
|
|
22
|
+
if (event.pointCloud) {
|
|
23
|
+
onLoad(event.pointCloud);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (onError) {
|
|
28
|
+
control.on("loaderror", (event) => {
|
|
29
|
+
if (event.error) {
|
|
30
|
+
onError(event.error);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
map.addControl(control, options.position || "top-right");
|
|
35
|
+
return () => {
|
|
36
|
+
if (map.hasControl(control)) {
|
|
37
|
+
map.removeControl(control);
|
|
38
|
+
}
|
|
39
|
+
controlRef.current = null;
|
|
40
|
+
};
|
|
41
|
+
}, [map]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (controlRef.current) {
|
|
44
|
+
const currentState = controlRef.current.getState();
|
|
45
|
+
if (options.collapsed !== void 0 && options.collapsed !== currentState.collapsed) {
|
|
46
|
+
if (options.collapsed) {
|
|
47
|
+
controlRef.current.collapse();
|
|
48
|
+
} else {
|
|
49
|
+
controlRef.current.expand();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (options.pointSize !== void 0 && options.pointSize !== currentState.pointSize) {
|
|
53
|
+
controlRef.current.setPointSize(options.pointSize);
|
|
54
|
+
}
|
|
55
|
+
if (options.opacity !== void 0 && options.opacity !== currentState.opacity) {
|
|
56
|
+
controlRef.current.setOpacity(options.opacity);
|
|
57
|
+
}
|
|
58
|
+
if (options.colorScheme !== void 0 && options.colorScheme !== currentState.colorScheme) {
|
|
59
|
+
controlRef.current.setColorScheme(options.colorScheme);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, [options.collapsed, options.pointSize, options.opacity, options.colorScheme]);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const DEFAULT_STATE = {
|
|
66
|
+
collapsed: true,
|
|
67
|
+
panelWidth: 365,
|
|
68
|
+
panelMaxHeight: 600,
|
|
69
|
+
pointClouds: [],
|
|
70
|
+
activePointCloudId: null,
|
|
71
|
+
pointSize: 2,
|
|
72
|
+
opacity: 1,
|
|
73
|
+
colorScheme: "elevation",
|
|
74
|
+
usePercentile: true,
|
|
75
|
+
elevationRange: null,
|
|
76
|
+
pointBudget: 1e6,
|
|
77
|
+
pickable: false,
|
|
78
|
+
loading: false,
|
|
79
|
+
error: null,
|
|
80
|
+
zOffsetEnabled: false,
|
|
81
|
+
zOffset: 0
|
|
82
|
+
};
|
|
83
|
+
function useLidarState(initialState) {
|
|
84
|
+
const [state, setState] = useState({
|
|
85
|
+
...DEFAULT_STATE,
|
|
86
|
+
...initialState
|
|
87
|
+
});
|
|
88
|
+
const setCollapsed = useCallback((collapsed) => {
|
|
89
|
+
setState((prev) => ({ ...prev, collapsed }));
|
|
90
|
+
}, []);
|
|
91
|
+
const setPanelWidth = useCallback((panelWidth) => {
|
|
92
|
+
setState((prev) => ({ ...prev, panelWidth }));
|
|
93
|
+
}, []);
|
|
94
|
+
const setPointSize = useCallback((pointSize) => {
|
|
95
|
+
setState((prev) => ({ ...prev, pointSize }));
|
|
96
|
+
}, []);
|
|
97
|
+
const setOpacity = useCallback((opacity) => {
|
|
98
|
+
setState((prev) => ({ ...prev, opacity }));
|
|
99
|
+
}, []);
|
|
100
|
+
const setColorScheme = useCallback((colorScheme) => {
|
|
101
|
+
setState((prev) => ({ ...prev, colorScheme }));
|
|
102
|
+
}, []);
|
|
103
|
+
const setUsePercentile = useCallback((usePercentile) => {
|
|
104
|
+
setState((prev) => ({ ...prev, usePercentile }));
|
|
105
|
+
}, []);
|
|
106
|
+
const setElevationRange = useCallback((elevationRange) => {
|
|
107
|
+
setState((prev) => ({ ...prev, elevationRange }));
|
|
108
|
+
}, []);
|
|
109
|
+
const setPointBudget = useCallback((pointBudget) => {
|
|
110
|
+
setState((prev) => ({ ...prev, pointBudget }));
|
|
111
|
+
}, []);
|
|
112
|
+
const setZOffsetEnabled = useCallback((zOffsetEnabled) => {
|
|
113
|
+
setState((prev) => ({ ...prev, zOffsetEnabled }));
|
|
114
|
+
}, []);
|
|
115
|
+
const setZOffset = useCallback((zOffset) => {
|
|
116
|
+
setState((prev) => ({ ...prev, zOffset }));
|
|
117
|
+
}, []);
|
|
118
|
+
const reset = useCallback(() => {
|
|
119
|
+
setState({ ...DEFAULT_STATE, ...initialState });
|
|
120
|
+
}, [initialState]);
|
|
121
|
+
const toggle = useCallback(() => {
|
|
122
|
+
setState((prev) => ({ ...prev, collapsed: !prev.collapsed }));
|
|
123
|
+
}, []);
|
|
124
|
+
return {
|
|
125
|
+
state,
|
|
126
|
+
setState,
|
|
127
|
+
setCollapsed,
|
|
128
|
+
setPanelWidth,
|
|
129
|
+
setPointSize,
|
|
130
|
+
setOpacity,
|
|
131
|
+
setColorScheme,
|
|
132
|
+
setUsePercentile,
|
|
133
|
+
setElevationRange,
|
|
134
|
+
setPointBudget,
|
|
135
|
+
setZOffsetEnabled,
|
|
136
|
+
setZOffset,
|
|
137
|
+
reset,
|
|
138
|
+
toggle
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function usePointCloud(options) {
|
|
142
|
+
const [data, setData] = useState(null);
|
|
143
|
+
const [loading, setLoading] = useState(false);
|
|
144
|
+
const [error, setError] = useState(null);
|
|
145
|
+
const [progress, setProgress] = useState(0);
|
|
146
|
+
const load = useCallback(
|
|
147
|
+
async (source) => {
|
|
148
|
+
setLoading(true);
|
|
149
|
+
setError(null);
|
|
150
|
+
setProgress(0);
|
|
151
|
+
try {
|
|
152
|
+
const loader = new PointCloudLoader();
|
|
153
|
+
const result = await loader.load(source);
|
|
154
|
+
setData(result);
|
|
155
|
+
return result;
|
|
156
|
+
} catch (err) {
|
|
157
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
158
|
+
setError(e);
|
|
159
|
+
return null;
|
|
160
|
+
} finally {
|
|
161
|
+
setLoading(false);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
[options]
|
|
165
|
+
);
|
|
166
|
+
const reset = useCallback(() => {
|
|
167
|
+
setData(null);
|
|
168
|
+
setLoading(false);
|
|
169
|
+
setError(null);
|
|
170
|
+
setProgress(0);
|
|
171
|
+
}, []);
|
|
172
|
+
return { data, loading, error, progress, load, reset };
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
LidarControlReact,
|
|
176
|
+
useLidarState,
|
|
177
|
+
usePointCloud
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=react.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.mjs","sources":["../src/lib/core/LidarControlReact.tsx","../src/lib/hooks/useLidarState.ts","../src/lib/hooks/usePointCloud.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { LidarControl } from './LidarControl';\nimport type { LidarControlReactProps } from './types';\n\n/**\n * React wrapper component for LidarControl.\n *\n * This component manages the lifecycle of a LidarControl instance,\n * adding it to the map on mount and removing it on unmount.\n *\n * @example\n * ```tsx\n * import { LidarControlReact } from 'maplibre-gl-lidar/react';\n *\n * function MyMap() {\n * const [map, setMap] = useState<Map | null>(null);\n *\n * return (\n * <>\n * <div ref={mapContainer} />\n * {map && (\n * <LidarControlReact\n * map={map}\n * title=\"LiDAR Viewer\"\n * collapsed={false}\n * onLoad={(pc) => console.log('Loaded:', pc)}\n * />\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @param props - Component props including map instance and control options\n * @returns null - This component renders nothing directly\n */\nexport function LidarControlReact({\n map,\n onStateChange,\n onLoad,\n onError,\n ...options\n}: LidarControlReactProps): null {\n const controlRef = useRef<LidarControl | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create the control instance\n const control = new LidarControl(options);\n controlRef.current = control;\n\n // Register event handlers\n if (onStateChange) {\n control.on('statechange', (event) => {\n onStateChange(event.state);\n });\n }\n\n if (onLoad) {\n control.on('load', (event) => {\n if (event.pointCloud) {\n onLoad(event.pointCloud);\n }\n });\n }\n\n if (onError) {\n control.on('loaderror', (event) => {\n if (event.error) {\n onError(event.error);\n }\n });\n }\n\n // Add control to map\n map.addControl(control, options.position || 'top-right');\n\n // Cleanup on unmount\n return () => {\n if (map.hasControl(control)) {\n map.removeControl(control);\n }\n controlRef.current = null;\n };\n }, [map]);\n\n // Update options when they change\n useEffect(() => {\n if (controlRef.current) {\n // Handle collapsed state changes\n const currentState = controlRef.current.getState();\n if (options.collapsed !== undefined && options.collapsed !== currentState.collapsed) {\n if (options.collapsed) {\n controlRef.current.collapse();\n } else {\n controlRef.current.expand();\n }\n }\n\n // Handle style changes\n if (options.pointSize !== undefined && options.pointSize !== currentState.pointSize) {\n controlRef.current.setPointSize(options.pointSize);\n }\n\n if (options.opacity !== undefined && options.opacity !== currentState.opacity) {\n controlRef.current.setOpacity(options.opacity);\n }\n\n if (options.colorScheme !== undefined && options.colorScheme !== currentState.colorScheme) {\n controlRef.current.setColorScheme(options.colorScheme);\n }\n }\n }, [options.collapsed, options.pointSize, options.opacity, options.colorScheme]);\n\n return null;\n}\n","import { useState, useCallback } from 'react';\nimport type { LidarState, ColorScheme } from '../core/types';\n\n/**\n * Default initial state for the LiDAR control\n */\nconst DEFAULT_STATE: LidarState = {\n collapsed: true,\n panelWidth: 365,\n panelMaxHeight: 600,\n pointClouds: [],\n activePointCloudId: null,\n pointSize: 2,\n opacity: 1.0,\n colorScheme: 'elevation',\n usePercentile: true,\n elevationRange: null,\n pointBudget: 1000000,\n pickable: false,\n loading: false,\n error: null,\n zOffsetEnabled: false,\n zOffset: 0,\n};\n\n/**\n * Custom hook for managing LiDAR state in React applications.\n *\n * This hook provides a simple way to track and update the state\n * of a LidarControl from React components.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { state, setPointSize, setColorScheme, toggle } = useLidarState();\n *\n * return (\n * <div>\n * <button onClick={toggle}>\n * {state.collapsed ? 'Expand' : 'Collapse'}\n * </button>\n * <button onClick={() => setColorScheme('intensity')}>\n * Show Intensity\n * </button>\n * <LidarControlReact\n * map={map}\n * collapsed={state.collapsed}\n * pointSize={state.pointSize}\n * colorScheme={state.colorScheme}\n * onStateChange={(newState) => setState(newState)}\n * />\n * </div>\n * );\n * }\n * ```\n *\n * @param initialState - Optional initial state values\n * @returns Object containing state and update functions\n */\nexport function useLidarState(initialState?: Partial<LidarState>) {\n const [state, setState] = useState<LidarState>({\n ...DEFAULT_STATE,\n ...initialState,\n });\n\n /**\n * Sets the collapsed state\n */\n const setCollapsed = useCallback((collapsed: boolean) => {\n setState((prev) => ({ ...prev, collapsed }));\n }, []);\n\n /**\n * Sets the panel width\n */\n const setPanelWidth = useCallback((panelWidth: number) => {\n setState((prev) => ({ ...prev, panelWidth }));\n }, []);\n\n /**\n * Sets the point size\n */\n const setPointSize = useCallback((pointSize: number) => {\n setState((prev) => ({ ...prev, pointSize }));\n }, []);\n\n /**\n * Sets the opacity\n */\n const setOpacity = useCallback((opacity: number) => {\n setState((prev) => ({ ...prev, opacity }));\n }, []);\n\n /**\n * Sets the color scheme\n */\n const setColorScheme = useCallback((colorScheme: ColorScheme) => {\n setState((prev) => ({ ...prev, colorScheme }));\n }, []);\n\n /**\n * Sets whether to use percentile range for coloring\n */\n const setUsePercentile = useCallback((usePercentile: boolean) => {\n setState((prev) => ({ ...prev, usePercentile }));\n }, []);\n\n /**\n * Sets the elevation range filter\n */\n const setElevationRange = useCallback((elevationRange: [number, number] | null) => {\n setState((prev) => ({ ...prev, elevationRange }));\n }, []);\n\n /**\n * Sets the point budget\n */\n const setPointBudget = useCallback((pointBudget: number) => {\n setState((prev) => ({ ...prev, pointBudget }));\n }, []);\n\n /**\n * Sets whether Z offset is enabled\n */\n const setZOffsetEnabled = useCallback((zOffsetEnabled: boolean) => {\n setState((prev) => ({ ...prev, zOffsetEnabled }));\n }, []);\n\n /**\n * Sets the Z offset value\n */\n const setZOffset = useCallback((zOffset: number) => {\n setState((prev) => ({ ...prev, zOffset }));\n }, []);\n\n /**\n * Resets the state to default values\n */\n const reset = useCallback(() => {\n setState({ ...DEFAULT_STATE, ...initialState });\n }, [initialState]);\n\n /**\n * Toggles the collapsed state\n */\n const toggle = useCallback(() => {\n setState((prev) => ({ ...prev, collapsed: !prev.collapsed }));\n }, []);\n\n return {\n state,\n setState,\n setCollapsed,\n setPanelWidth,\n setPointSize,\n setOpacity,\n setColorScheme,\n setUsePercentile,\n setElevationRange,\n setPointBudget,\n setZOffsetEnabled,\n setZOffset,\n reset,\n toggle,\n };\n}\n","import { useState, useCallback } from 'react';\nimport { PointCloudLoader } from '../loaders/PointCloudLoader';\nimport type { PointCloudData, LoaderOptions } from '../loaders/types';\n\n/**\n * Result of the usePointCloud hook\n */\ninterface UsePointCloudResult {\n /** The loaded point cloud data or null */\n data: PointCloudData | null;\n /** Whether loading is in progress */\n loading: boolean;\n /** Error if loading failed */\n error: Error | null;\n /** Loading progress (0-1) */\n progress: number;\n /** Function to load a point cloud */\n load: (source: string | File | ArrayBuffer) => Promise<PointCloudData | null>;\n /** Function to reset the state */\n reset: () => void;\n}\n\n/**\n * Custom hook for loading point cloud data in React applications.\n *\n * This hook provides a simple way to load point cloud files\n * with loading state and error handling.\n *\n * @example\n * ```tsx\n * function PointCloudLoader() {\n * const { data, loading, error, load, reset } = usePointCloud();\n *\n * const handleFile = async (file: File) => {\n * const result = await load(file);\n * if (result) {\n * console.log(`Loaded ${result.pointCount} points`);\n * }\n * };\n *\n * return (\n * <div>\n * <input type=\"file\" onChange={(e) => handleFile(e.target.files?.[0])} />\n * {loading && <p>Loading...</p>}\n * {error && <p>Error: {error.message}</p>}\n * {data && <p>Loaded {data.pointCount} points</p>}\n * </div>\n * );\n * }\n * ```\n *\n * @param options - Optional loader options\n * @returns Object containing state and functions\n */\nexport function usePointCloud(options?: Partial<LoaderOptions>): UsePointCloudResult {\n const [data, setData] = useState<PointCloudData | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [progress, setProgress] = useState(0);\n\n const load = useCallback(\n async (source: string | File | ArrayBuffer): Promise<PointCloudData | null> => {\n setLoading(true);\n setError(null);\n setProgress(0);\n\n try {\n const loader = new PointCloudLoader();\n const result = await loader.load(source);\n setData(result);\n return result;\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setError(e);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const reset = useCallback(() => {\n setData(null);\n setLoading(false);\n setError(null);\n setProgress(0);\n }, []);\n\n return { data, loading, error, progress, load, reset };\n}\n"],"names":[],"mappings":";;AAoCO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAC/B,QAAM,aAAa,OAA4B,IAAI;AAEnD,YAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAGV,UAAM,UAAU,IAAI,aAAa,OAAO;AACxC,eAAW,UAAU;AAGrB,QAAI,eAAe;AACjB,cAAQ,GAAG,eAAe,CAAC,UAAU;AACnC,sBAAc,MAAM,KAAK;AAAA,MAC3B,CAAC;AAAA,IACH;AAEA,QAAI,QAAQ;AACV,cAAQ,GAAG,QAAQ,CAAC,UAAU;AAC5B,YAAI,MAAM,YAAY;AACpB,iBAAO,MAAM,UAAU;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,SAAS;AACX,cAAQ,GAAG,aAAa,CAAC,UAAU;AACjC,YAAI,MAAM,OAAO;AACf,kBAAQ,MAAM,KAAK;AAAA,QACrB;AAAA,MACF,CAAC;AAAA,IACH;AAGA,QAAI,WAAW,SAAS,QAAQ,YAAY,WAAW;AAGvD,WAAO,MAAM;AACX,UAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,YAAI,cAAc,OAAO;AAAA,MAC3B;AACA,iBAAW,UAAU;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAGR,YAAU,MAAM;AACd,QAAI,WAAW,SAAS;AAEtB,YAAM,eAAe,WAAW,QAAQ,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,UAAA,EAAY;AAAA,EAC9D,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AC/GO,SAAS,cAAc,SAAuD;AACnF,QAAM,CAAC,MAAM,OAAO,IAAI,SAAgC,IAAI;AAC5D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAuB,IAAI;AACrD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,CAAC;AAE1C,QAAM,OAAO;AAAA,IACX,OAAO,WAAwE;AAC7E,iBAAW,IAAI;AACf,eAAS,IAAI;AACb,kBAAY,CAAC;AAEb,UAAI;AACF,cAAM,SAAS,IAAI,iBAAA;AACnB,cAAM,SAAS,MAAM,OAAO,KAAK,MAAM;AACvC,gBAAQ,MAAM;AACd,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,IAAI,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAC5D,iBAAS,CAAC;AACV,eAAO;AAAA,MACT,UAAA;AACE,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF;AAAA,IACA,CAAC,OAAO;AAAA,EAAA;AAGV,QAAM,QAAQ,YAAY,MAAM;AAC9B,YAAQ,IAAI;AACZ,eAAW,KAAK;AAChB,aAAS,IAAI;AACb,gBAAY,CAAC;AAAA,EACf,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,MAAM,SAAS,OAAO,UAAU,MAAM,MAAA;AACjD;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { LidarControl } from './lib/core/LidarControl';
|
|
2
|
+
export { DeckOverlay } from './lib/core/DeckOverlay';
|
|
3
|
+
export { ViewportManager } from './lib/core/ViewportManager';
|
|
4
|
+
export { PointCloudLoader } from './lib/loaders/PointCloudLoader';
|
|
5
|
+
export { CopcStreamingLoader } from './lib/loaders/CopcStreamingLoader';
|
|
6
|
+
export { PointCloudManager } from './lib/layers/PointCloudManager';
|
|
7
|
+
export { ColorSchemeProcessor, getClassificationName } from './lib/colorizers/ColorScheme';
|
|
8
|
+
export type { LidarControlOptions, LidarState, LidarControlEvent, LidarControlEventHandler, LidarEventData, PointCloudInfo, PointCloudBounds, ColorScheme, ColorSchemeType, ColorSchemeConfig, CopcLoadingMode, } from './lib/core/types';
|
|
9
|
+
export type { PointCloudData, LoaderOptions, } from './lib/loaders/types';
|
|
10
|
+
export type { StreamingLoaderOptions, StreamingProgressEvent, ViewportInfo, CachedNode, NodeKey, NodeState, StreamingLoaderEvent, StreamingLoaderEventHandler, StreamingLoadOptions, } from './lib/loaders/streaming-types';
|
|
11
|
+
export type { PointCloudLayerOptions, } from './lib/layers/types';
|
|
12
|
+
export { clamp, formatNumericValue, generateId, debounce, throttle, classNames, formatNumber, formatBytes, getFilename, } from './lib/utils';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,gCAAgC,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAG3F,YAAY,EACV,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EACV,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PointCloudData } from '../loaders/types';
|
|
2
|
+
import { ColorScheme } from '../core/types';
|
|
3
|
+
/**
|
|
4
|
+
* Options for color generation
|
|
5
|
+
*/
|
|
6
|
+
export interface ColorOptions {
|
|
7
|
+
/** Whether to use percentile range (2-98%) for elevation/intensity coloring */
|
|
8
|
+
usePercentile?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Processes point cloud data into color arrays based on color scheme.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ColorSchemeProcessor {
|
|
14
|
+
/**
|
|
15
|
+
* Generates a color array for the point cloud based on the color scheme.
|
|
16
|
+
*
|
|
17
|
+
* @param data - Point cloud data
|
|
18
|
+
* @param scheme - Color scheme to apply
|
|
19
|
+
* @param options - Optional color generation options
|
|
20
|
+
* @returns Uint8Array of RGBA colors (length = pointCount * 4)
|
|
21
|
+
*/
|
|
22
|
+
getColors(data: PointCloudData, scheme: ColorScheme, options?: ColorOptions): Uint8Array;
|
|
23
|
+
/**
|
|
24
|
+
* Colors points by elevation using terrain-like ramp.
|
|
25
|
+
*
|
|
26
|
+
* @param data - Point cloud data
|
|
27
|
+
* @param colors - Output color array
|
|
28
|
+
* @param usePercentile - Whether to use percentile bounds (2-98%) for better color distribution
|
|
29
|
+
*/
|
|
30
|
+
private _colorByElevation;
|
|
31
|
+
/**
|
|
32
|
+
* Colors points by intensity using grayscale ramp.
|
|
33
|
+
*
|
|
34
|
+
* @param data - Point cloud data
|
|
35
|
+
* @param colors - Output color array
|
|
36
|
+
* @param usePercentile - Whether to use percentile bounds (2-98%) for better color distribution
|
|
37
|
+
*/
|
|
38
|
+
private _colorByIntensity;
|
|
39
|
+
/**
|
|
40
|
+
* Colors points by classification using ASPRS standard colors.
|
|
41
|
+
*/
|
|
42
|
+
private _colorByClassification;
|
|
43
|
+
/**
|
|
44
|
+
* Uses embedded RGB colors from the point cloud.
|
|
45
|
+
*/
|
|
46
|
+
private _colorByRGB;
|
|
47
|
+
/**
|
|
48
|
+
* Applies a custom color scheme configuration.
|
|
49
|
+
*/
|
|
50
|
+
private _colorByCustom;
|
|
51
|
+
/**
|
|
52
|
+
* Interpolates a color from a color ramp.
|
|
53
|
+
*/
|
|
54
|
+
private _interpolateRamp;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets the name of a classification code.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getClassificationName(code: number): string;
|
|
60
|
+
//# sourceMappingURL=ColorScheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.d.ts","sourceRoot":"","sources":["../../../../src/lib/colorizers/ColorScheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAwDpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;;;;;;OAOG;IACH,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,YAAiB,GAAG,UAAU;IAsB5F;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAsCzB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAuCzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAiB9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAmBzB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuB1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/colorizers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC5E,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RGB color tuple
|
|
3
|
+
*/
|
|
4
|
+
export type RGBColor = [number, number, number];
|
|
5
|
+
/**
|
|
6
|
+
* RGBA color tuple
|
|
7
|
+
*/
|
|
8
|
+
export type RGBAColor = [number, number, number, number];
|
|
9
|
+
/**
|
|
10
|
+
* Color ramp definition (array of RGB colors)
|
|
11
|
+
*/
|
|
12
|
+
export type ColorRamp = RGBColor[];
|
|
13
|
+
/**
|
|
14
|
+
* Classification color map
|
|
15
|
+
*/
|
|
16
|
+
export type ClassificationColorMap = Record<number, RGBColor>;
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/colorizers/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { Layer } from '@deck.gl/core';
|
|
3
|
+
/**
|
|
4
|
+
* Manages the deck.gl overlay integration with MapLibre GL.
|
|
5
|
+
* Handles adding, removing, and updating deck.gl layers.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeckOverlay {
|
|
8
|
+
private _map;
|
|
9
|
+
private _overlay;
|
|
10
|
+
private _layers;
|
|
11
|
+
constructor(map: MapLibreMap);
|
|
12
|
+
/**
|
|
13
|
+
* Adds a layer to the overlay.
|
|
14
|
+
*
|
|
15
|
+
* @param id - Unique layer ID
|
|
16
|
+
* @param layer - The deck.gl layer to add
|
|
17
|
+
*/
|
|
18
|
+
addLayer(id: string, layer: Layer): void;
|
|
19
|
+
/**
|
|
20
|
+
* Removes a layer from the overlay.
|
|
21
|
+
*
|
|
22
|
+
* @param id - ID of the layer to remove
|
|
23
|
+
*/
|
|
24
|
+
removeLayer(id: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Updates an existing layer with new props.
|
|
27
|
+
*
|
|
28
|
+
* @param id - ID of the layer to update
|
|
29
|
+
* @param layer - New layer instance with updated props
|
|
30
|
+
*/
|
|
31
|
+
updateLayer(id: string, layer: Layer): void;
|
|
32
|
+
/**
|
|
33
|
+
* Gets all current layers.
|
|
34
|
+
*
|
|
35
|
+
* @returns Array of deck.gl layers
|
|
36
|
+
*/
|
|
37
|
+
getLayers(): Layer[];
|
|
38
|
+
/**
|
|
39
|
+
* Checks if a layer exists.
|
|
40
|
+
*
|
|
41
|
+
* @param id - Layer ID to check
|
|
42
|
+
* @returns True if layer exists
|
|
43
|
+
*/
|
|
44
|
+
hasLayer(id: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clears all layers from the overlay.
|
|
47
|
+
*/
|
|
48
|
+
clearLayers(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the MapLibre map instance.
|
|
51
|
+
*
|
|
52
|
+
* @returns The MapLibre map
|
|
53
|
+
*/
|
|
54
|
+
getMap(): MapLibreMap;
|
|
55
|
+
/**
|
|
56
|
+
* Destroys the overlay and removes it from the map.
|
|
57
|
+
*/
|
|
58
|
+
destroy(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Updates the overlay with current layers.
|
|
61
|
+
*/
|
|
62
|
+
private _updateOverlay;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=DeckOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckOverlay.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/DeckOverlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,OAAO,CAAqB;gBAExB,GAAG,EAAE,WAAW;IAW5B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAKxC;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAO3C;;;;OAIG;IACH,SAAS,IAAI,KAAK,EAAE;IAIpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI7B;;OAEG;IACH,WAAW,IAAI,IAAI;IAKnB;;;;OAIG;IACH,MAAM,IAAI,WAAW;IAIrB;;OAEG;IACH,OAAO,IAAI,IAAI;IASf;;OAEG;IACH,OAAO,CAAC,cAAc;CAOvB"}
|