gps-plus-slam-app-framework 1.0.0 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -4
- package/README.md +249 -108
- package/dist/accuracy-circles-CsxE_7x1.d.ts +43 -0
- package/dist/{app-selectors-DyMzxCEC.d.ts → app-selectors-BeU0_ab8.d.ts} +14 -15
- package/dist/ar/camera-blit-capture.d.ts +1 -1
- package/dist/ar/capture-failure-tracker.d.ts +1 -1
- package/dist/ar/chromium-camera-access-workaround.d.ts +1 -1
- package/dist/ar/depth-sampler.d.ts +2 -2
- package/dist/ar/depth-sampler.js +1 -1
- package/dist/ar/frame-loop.d.ts +2 -0
- package/dist/ar/frame-loop.js +40 -0
- package/dist/ar/image-capture.d.ts +1 -1
- package/dist/ar/image-capture.js +1 -1
- package/dist/ar/index.d.ts +12 -12
- package/dist/ar/index.js +3 -3
- package/dist/ar/replay-scene.d.ts +1 -1
- package/dist/ar/scene-node-names.d.ts +1 -1
- package/dist/ar/webxr-session.d.ts +4 -4
- package/dist/ar/webxr-session.js +151 -56
- package/dist/ar/xr-camera-texture.d.ts +1 -1
- package/dist/ar/xr-error-handler.d.ts +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/create-slam-app-store-CNsZ3rcX.d.ts +371 -0
- package/dist/{depth-sampler-BNCtnEoP.d.ts → depth-sampler-xg8vna6c.d.ts} +1 -1
- package/dist/file-system-DTApEv_Q.d.ts +114 -0
- package/dist/frame-loop-QJIxLin0.d.ts +42 -0
- package/dist/frustum-visibility-BHnFrSKQ.d.ts +58 -0
- package/dist/{fused-path-DtqCSqJh.d.ts → fused-path-CB4DwWOG.d.ts} +1 -1
- package/dist/geo/h3-proximity.d.ts +2 -0
- package/dist/{ref-points/h3-ref-point.js → geo/h3-proximity.js} +16 -12
- package/dist/geo/index.d.ts +2 -0
- package/dist/geo/index.js +2 -0
- package/dist/{geo-types-Xx-LVcnw.d.ts → geo-types-CTuF23gG.d.ts} +16 -1
- package/dist/{gps-Ddzr2KlX.d.ts → gps-DXoQb9Kf.d.ts} +1 -1
- package/dist/gps-anchor-CnWY61XK.d.ts +48 -0
- package/dist/gps-anchor-DjC_3MoT.js +257 -0
- package/dist/gps-ar-pose-sampler-DsM1Kb2N.d.ts +43 -0
- package/dist/{recording-coordinator-DzflP07_.d.ts → gps-event-coordinator-DBx9I1YX.d.ts} +7 -6
- package/dist/gps-event-markers-BGr-iLvi.d.ts +103 -0
- package/dist/{h3-ref-point-CFhayNSZ.d.ts → h3-proximity-BhfgNbdW.d.ts} +16 -12
- package/dist/{image-capture-2pKjYUS6.d.ts → image-capture-DZLxHDN9.d.ts} +1 -1
- package/dist/index-gzWJMVpo.d.ts +2 -0
- package/dist/index-pOjUCKEP.d.ts +24 -0
- package/dist/index.d.ts +59 -56
- package/dist/index.js +22 -21
- package/dist/{leaflet-map-overlay-CvfQXTye.d.ts → leaflet-map-overlay-Cew7XAoO.d.ts} +32 -17
- package/dist/licensing/index.d.ts +1 -1
- package/dist/licensing/index.js +1 -1
- package/dist/{logger-B81iwxx0.d.ts → logger-C9vugiQb.d.ts} +7 -1
- package/dist/map-data-sih4g64v.d.ts +49 -0
- package/dist/map-overlay-draw-B3R1c9Xp.d.ts +42 -0
- package/dist/{null-storage-backend-CsWvQwN8.d.ts → null-storage-backend-BKOS7JpL.d.ts} +4 -2
- package/dist/{opfs-storage-ChOzF_Wp.d.ts → opfs-storage-DOPkzgeT.d.ts} +54 -51
- package/dist/opfs-storage-backend-Cj_7PWoq.d.ts +13 -0
- package/dist/{permission-checker-jO2ziCWC.d.ts → permission-checker-DPJl_RU6.d.ts} +41 -1
- package/dist/persistence-middleware-BkHIqvaA.d.ts +55 -0
- package/dist/{recording-replayer-oOzPITrd.d.ts → recording-replayer-CmCIIZ02.d.ts} +2 -2
- package/dist/recording-slice-d6OtCrza.d.ts +28 -0
- package/dist/{replay-engine-DuX316ae.d.ts → replay-engine-BGBRQyXs.d.ts} +4 -1
- package/dist/{replay-scene-DtUm6bsr.d.ts → replay-scene-DpAGcAKY.d.ts} +3 -3
- package/dist/sensors/gps-error-handler.d.ts +1 -1
- package/dist/sensors/gps.d.ts +1 -1
- package/dist/sensors/gps.js +2 -2
- package/dist/sensors/index.d.ts +3 -3
- package/dist/sensors/index.js +1 -1
- package/dist/sensors/permission-checker.d.ts +2 -2
- package/dist/sensors/permission-checker.js +79 -1
- package/dist/state/app-selectors.d.ts +2 -2
- package/dist/state/app-selectors.js +33 -3
- package/dist/state/combined-root-state.d.ts +2 -0
- package/dist/state/combined-root-state.js +1 -0
- package/dist/state/create-slam-app-store.d.ts +2 -0
- package/dist/state/create-slam-app-store.js +75 -0
- package/dist/state/gps-ar-pose-sampler.d.ts +4 -0
- package/dist/state/gps-ar-pose-sampler.js +19 -0
- package/dist/state/{recording-coordinator.d.ts → gps-event-coordinator.d.ts} +1 -1
- package/dist/state/{recording-coordinator.js → gps-event-coordinator.js} +3 -4
- package/dist/state/index.d.ts +17 -17
- package/dist/state/index.js +10 -8
- package/dist/state/persistence-middleware.d.ts +2 -2
- package/dist/state/persistence-middleware.js +39 -11
- package/dist/state/recording-options.d.ts +1 -1
- package/dist/state/recording-replayer.d.ts +3 -2
- package/dist/state/recording-replayer.js +2 -2
- package/dist/state/recording-slice.d.ts +2 -0
- package/dist/state/{recorder-slice.js → recording-slice.js} +7 -15
- package/dist/state/replay-engine.d.ts +1 -1
- package/dist/state/replay-engine.js +3 -3
- package/dist/state/store-subscribers.d.ts +2 -2
- package/dist/state/store-subscribers.js +38 -20
- package/dist/state/subscribe-to-selector.d.ts +1 -1
- package/dist/state/tracking-quality.d.ts +2 -0
- package/dist/state/tracking-quality.js +723 -0
- package/dist/state/tracking-slice.d.ts +2 -0
- package/dist/state/tracking-slice.js +147 -0
- package/dist/storage/file-system-utils.d.ts +1 -1
- package/dist/storage/file-system.d.ts +2 -2
- package/dist/storage/file-system.js +154 -94
- package/dist/storage/index.d.ts +9 -11
- package/dist/storage/index.js +5 -7
- package/dist/storage/null-storage-backend.d.ts +1 -1
- package/dist/storage/null-storage-backend.js +7 -0
- package/dist/storage/opfs-storage-backend.d.ts +1 -1
- package/dist/storage/opfs-storage-backend.js +7 -1
- package/dist/storage/opfs-storage.d.ts +2 -2
- package/dist/storage/opfs-storage.js +69 -85
- package/dist/storage/storage-backend.d.ts +2 -2
- package/dist/storage/zip-export.d.ts +2 -2
- package/dist/storage/zip-export.js +55 -62
- package/dist/storage/zip-reader.d.ts +2 -2
- package/dist/storage/zip-reader.js +32 -5
- package/dist/storage-backend-CT0Il_AB.d.ts +28 -0
- package/dist/{store-subscribers-CuoIzB5T.d.ts → store-subscribers-Dce_CoJF.d.ts} +31 -7
- package/dist/{subscribe-to-selector-UTZ0KkAc.d.ts → subscribe-to-selector-DIHm3BRZ.d.ts} +1 -1
- package/dist/test-utils/browser-mocks.d.ts +1 -1
- package/dist/test-utils/zip-round-trip-helpers.d.ts +7 -1
- package/dist/test-utils/zip-round-trip-helpers.js +6 -5
- package/dist/tracking-slice-utCNND8t.d.ts +86 -0
- package/dist/types/ar-types.d.ts +1 -1
- package/dist/types/geo-types.d.ts +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/concurrency.d.ts +1 -1
- package/dist/utils/failure-tracker.d.ts +1 -1
- package/dist/utils/format-file-size.d.ts +1 -1
- package/dist/utils/fused-path.d.ts +1 -1
- package/dist/utils/index.d.ts +6 -6
- package/dist/utils/list-formatter.d.ts +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +68 -8
- package/dist/visualization/accuracy-circles.d.ts +2 -0
- package/dist/visualization/accuracy-circles.js +57 -0
- package/dist/visualization/alignment-lerper.d.ts +1 -1
- package/dist/visualization/camera-follower.d.ts +1 -1
- package/dist/visualization/css3d-renderer-manager.d.ts +1 -1
- package/dist/visualization/frustum-visibility.d.ts +2 -0
- package/dist/visualization/frustum-visibility.js +139 -0
- package/dist/visualization/gps-anchor.d.ts +2 -0
- package/dist/visualization/gps-anchor.js +2 -0
- package/dist/visualization/gps-compass-cubes.d.ts +1 -1
- package/dist/visualization/gps-event-markers.d.ts +2 -2
- package/dist/visualization/gps-event-markers.js +69 -2
- package/dist/visualization/index.d.ts +17 -12
- package/dist/visualization/index.js +6 -2
- package/dist/visualization/leaflet-map-overlay.d.ts +1 -1
- package/dist/visualization/leaflet-map-overlay.js +56 -98
- package/dist/visualization/lerp-utils.d.ts +1 -1
- package/dist/visualization/map-data.d.ts +2 -0
- package/dist/visualization/map-data.js +33 -0
- package/dist/visualization/map-overlay-draw.d.ts +2 -0
- package/dist/visualization/map-overlay-draw.js +107 -0
- package/dist/visualization/map-overlay.d.ts +1 -1
- package/dist/visualization/three-dispose.d.ts +1 -1
- package/dist/visualization/vis-colors.d.ts +1 -1
- package/dist/{webxr-session-COlSrXdL.d.ts → webxr-session-DB5cIZnN.d.ts} +53 -12
- package/dist/{zip-export-Rtpi75JJ.d.ts → zip-export-QO4iLIi7.d.ts} +58 -7
- package/dist/{zip-reader-D7pkpX8K.d.ts → zip-reader-D1105idz.d.ts} +38 -1
- package/package.json +29 -18
- package/dist/ar/tracking-state.d.ts +0 -2
- package/dist/ar/tracking-state.js +0 -164
- package/dist/community-license-key-ChZLCJyO.d.ts +0 -21
- package/dist/file-system-BsQgYCU3.d.ts +0 -128
- package/dist/gps-event-markers-DpEy2qRd.d.ts +0 -67
- package/dist/licensing/community-license-key.d.ts +0 -2
- package/dist/licensing/community-license-key.js +0 -21
- package/dist/opfs-storage-backend-CVcmfJHN.d.ts +0 -11
- package/dist/persistence-middleware-DrptY02i.d.ts +0 -31
- package/dist/recorder-slice-fcwAXrsh.d.ts +0 -35
- package/dist/ref-point-importer-B_wn5ABk.d.ts +0 -62
- package/dist/ref-point-loader-Pt1smgHS.d.ts +0 -117
- package/dist/ref-points/h3-ref-point.d.ts +0 -2
- package/dist/ref-points/index.d.ts +0 -2
- package/dist/ref-points/index.js +0 -2
- package/dist/ref-points-slice-tC-Wd6XJ.d.ts +0 -48
- package/dist/reference-points-CFWy8_wj.d.ts +0 -68
- package/dist/routing-slice-BlHTM8eh.d.ts +0 -23
- package/dist/state/recorder-slice.d.ts +0 -2
- package/dist/state/ref-points-slice.d.ts +0 -2
- package/dist/state/ref-points-slice.js +0 -44
- package/dist/state/routing-slice.d.ts +0 -2
- package/dist/state/routing-slice.js +0 -13
- package/dist/state/store.d.ts +0 -9
- package/dist/state/store.js +0 -71
- package/dist/storage/ref-point-importer.d.ts +0 -2
- package/dist/storage/ref-point-importer.js +0 -163
- package/dist/storage/ref-point-loader.d.ts +0 -2
- package/dist/storage/ref-point-loader.js +0 -248
- package/dist/storage/ref-point-recovery.d.ts +0 -28
- package/dist/storage/ref-point-recovery.js +0 -159
- package/dist/storage-backend-BcEItnFr.d.ts +0 -20
- package/dist/store-C7PKOj8S.d.ts +0 -96
- package/dist/tracking-state-B9QfuZCg.d.ts +0 -101
- package/dist/visualization/reference-points.d.ts +0 -2
- package/dist/visualization/reference-points.js +0 -160
- /package/dist/{alignment-lerper-D9BeDwZX.d.ts → alignment-lerper-L1RbWHQ4.d.ts} +0 -0
- /package/dist/{ar-types-B-ORgk6Z.d.ts → ar-types-Ck8LEq8k.d.ts} +0 -0
- /package/dist/{camera-blit-capture-DHuyrrxr.d.ts → camera-blit-capture-C1V9I1Z6.d.ts} +0 -0
- /package/dist/{camera-follower-BMqPddxx.d.ts → camera-follower-1k8mnw5J.d.ts} +0 -0
- /package/dist/{capture-failure-tracker-2Q6oI2uQ.d.ts → capture-failure-tracker-JKb1ST8E.d.ts} +0 -0
- /package/dist/{chromium-camera-access-workaround-CU5zSKNr.d.ts → chromium-camera-access-workaround-NvChXsi8.d.ts} +0 -0
- /package/dist/{concurrency-p6gB30fT.d.ts → concurrency-CMw8pSaG.d.ts} +0 -0
- /package/dist/{css3d-renderer-manager-rgLMVAvd.d.ts → css3d-renderer-manager-CkjCb2HW.d.ts} +0 -0
- /package/dist/{failure-tracker-1sQ_Cgyw.d.ts → failure-tracker-DnHXOIRa.d.ts} +0 -0
- /package/dist/{file-system-utils-5cWO8Xyv.d.ts → file-system-utils-CtKiiw27.d.ts} +0 -0
- /package/dist/{format-file-size-onGq0k1Q.d.ts → format-file-size-BTS5H62-.d.ts} +0 -0
- /package/dist/{gps-compass-cubes-C-6JEnpR.d.ts → gps-compass-cubes-CsLtFv4B.d.ts} +0 -0
- /package/dist/{gps-error-handler-VPuNOuf8.d.ts → gps-error-handler-Dg3ziRVY.d.ts} +0 -0
- /package/dist/{lerp-utils-87NWjUOD.d.ts → lerp-utils-B8MM8zCR.d.ts} +0 -0
- /package/dist/{list-formatter-DKQQVLcl.d.ts → list-formatter-CNqi-E2j.d.ts} +0 -0
- /package/dist/{map-overlay-DuiZuCTx.d.ts → map-overlay-DAmreyA3.d.ts} +0 -0
- /package/dist/{recording-options-BYUFX8iU.d.ts → recording-options-Dq6IsKAv.d.ts} +0 -0
- /package/dist/{scene-node-names-DPsaE2z3.d.ts → scene-node-names-6LBjPmwz.d.ts} +0 -0
- /package/dist/{three-dispose-CCBHjE_a.d.ts → three-dispose-C2drkp6f.d.ts} +0 -0
- /package/dist/{vis-colors-Qi2vlRGt.d.ts → vis-colors-CHQhjal3.d.ts} +0 -0
- /package/dist/{xr-camera-texture-BbukNE79.d.ts → xr-camera-texture-BU5YvKAM.d.ts} +0 -0
- /package/dist/{xr-error-handler-DTHfmvrl.d.ts → xr-error-handler-CDY5QxGb.d.ts} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//#region ../src/storage/ref-point-importer.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Reference Point Importer Module
|
|
4
|
-
*
|
|
5
|
-
* Extracts reference points from ZIP files in a folder, enabling reuse of
|
|
6
|
-
* ref points from previous recording sessions.
|
|
7
|
-
*
|
|
8
|
-
* This module:
|
|
9
|
-
* 1. Enumerates all *.zip files in a folder
|
|
10
|
-
* 2. Opens each ZIP and looks for refPoints/*.json files
|
|
11
|
-
* 3. Parses and validates each ref point definition
|
|
12
|
-
* 4. Merges and deduplicates ref points by ID
|
|
13
|
-
*
|
|
14
|
-
* Uses @zip.js/zip.js for ZIP reading (same library as zip-export.ts).
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Simplified reference point for import/suggestion purposes.
|
|
18
|
-
* Contains only the essential data needed for ref point suggestions and display.
|
|
19
|
-
* The `lat`/`lon` are kept for "nearby ref point" proximity suggestions.
|
|
20
|
-
*/
|
|
21
|
-
interface ImportedRefPoint {
|
|
22
|
-
/** Unique identifier — H3 hex index since the March 2026 H3 migration */
|
|
23
|
-
readonly id: string;
|
|
24
|
-
/** Human-readable display name entered by the user (e.g., "Bench Corner") */
|
|
25
|
-
readonly name: string;
|
|
26
|
-
/** Latitude from first observation (for future proximity-based suggestions) */
|
|
27
|
-
readonly lat: number;
|
|
28
|
-
/** Longitude from first observation */
|
|
29
|
-
readonly lon: number;
|
|
30
|
-
/** Optional altitude */
|
|
31
|
-
readonly alt?: number;
|
|
32
|
-
/** Source ZIP file name for debugging/tracking */
|
|
33
|
-
readonly sourceZipName: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Result from importing reference points from a folder.
|
|
37
|
-
*/
|
|
38
|
-
interface RefPointImportResult {
|
|
39
|
-
/** Whether the import completed (even with some errors) */
|
|
40
|
-
readonly success: boolean;
|
|
41
|
-
/** Merged, deduplicated reference points from all ZIPs */
|
|
42
|
-
readonly refPoints: ImportedRefPoint[];
|
|
43
|
-
/** Number of ZIP files successfully scanned */
|
|
44
|
-
readonly zipFilesScanned: number;
|
|
45
|
-
/** Error messages from failed ZIPs or malformed ref points */
|
|
46
|
-
readonly errors: string[];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Import reference points from all ZIP files in a folder.
|
|
50
|
-
*
|
|
51
|
-
* Enumerates all *.zip files in the folder, extracts refPoints/*.json from each,
|
|
52
|
-
* and merges them into a deduplicated list.
|
|
53
|
-
*
|
|
54
|
-
* Deduplication: If the same ref point ID appears in multiple ZIPs, the first
|
|
55
|
-
* occurrence is kept (based on iteration order).
|
|
56
|
-
*
|
|
57
|
-
* @param folderHandle - Read-only directory handle from showDirectoryPicker
|
|
58
|
-
* @returns Result containing merged ref points, scan count, and errors
|
|
59
|
-
*/
|
|
60
|
-
declare function importRefPointsFromFolder(folderHandle: FileSystemDirectoryHandle): Promise<RefPointImportResult>;
|
|
61
|
-
//#endregion
|
|
62
|
-
export { RefPointImportResult as n, importRefPointsFromFolder as r, ImportedRefPoint as t };
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { n as ArPoseTuples } from "./ar-types-B-ORgk6Z.js";
|
|
2
|
-
import { GpsPoint, LatLongAlt, Quaternion, Vector3 } from "gps-plus-slam-js";
|
|
3
|
-
|
|
4
|
-
//#region ../src/storage/ref-point-loader.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* A single observation of a reference point in one session.
|
|
7
|
-
*/
|
|
8
|
-
interface RefPointObservation {
|
|
9
|
-
/** Session ID (e.g., "recording-2025-02-28_14-30-11utc") */
|
|
10
|
-
readonly sessionId: string;
|
|
11
|
-
/** When this observation was made */
|
|
12
|
-
readonly timestamp: number;
|
|
13
|
-
/** AR pose at the moment of marking */
|
|
14
|
-
readonly arPose: ArPoseTuples;
|
|
15
|
-
/** Full GPS point from library (includes lat/lon, accuracy, etc.) */
|
|
16
|
-
readonly gpsPoint: GpsPoint;
|
|
17
|
-
/** Fused GPS from aligned VIO path at mark time (absent in legacy data) */
|
|
18
|
-
readonly fusedGpsPoint?: {
|
|
19
|
-
latitude: number;
|
|
20
|
-
longitude: number;
|
|
21
|
-
altitude?: number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Complete definition of a reference point with all observations.
|
|
26
|
-
*/
|
|
27
|
-
interface RefPointDefinition {
|
|
28
|
-
/** Unique identifier (e.g., "pointA", "benchCorner") */
|
|
29
|
-
id: string;
|
|
30
|
-
/** Human-readable name */
|
|
31
|
-
name: string;
|
|
32
|
-
/** Timestamp of first observation */
|
|
33
|
-
createdAt: number;
|
|
34
|
-
/** All observations across sessions */
|
|
35
|
-
observations: RefPointObservation[];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Load all reference point definitions from the scenario's refPoints/ directory.
|
|
39
|
-
*
|
|
40
|
-
* @param scenarioHandle - File system handle for the scenario folder
|
|
41
|
-
* @returns Array of all reference point definitions
|
|
42
|
-
*/
|
|
43
|
-
declare function loadAllRefPoints(scenarioHandle: FileSystemDirectoryHandle): Promise<RefPointDefinition[]>;
|
|
44
|
-
/**
|
|
45
|
-
* Load a specific reference point by ID.
|
|
46
|
-
*
|
|
47
|
-
* @param scenarioHandle - File system handle for the scenario folder
|
|
48
|
-
* @param pointId - Reference point ID
|
|
49
|
-
* @returns Reference point definition or null if not found
|
|
50
|
-
*/
|
|
51
|
-
declare function loadRefPoint(scenarioHandle: FileSystemDirectoryHandle, pointId: string): Promise<RefPointDefinition | null>;
|
|
52
|
-
/**
|
|
53
|
-
* Save or update a reference point observation.
|
|
54
|
-
* Creates the refPoints/ directory if it doesn't exist.
|
|
55
|
-
* If the reference point exists, appends the new observation.
|
|
56
|
-
* If it doesn't exist, creates a new reference point file.
|
|
57
|
-
*
|
|
58
|
-
* @param scenarioHandle - File system handle for the scenario folder
|
|
59
|
-
* @param pointId - Reference point ID
|
|
60
|
-
* @param pointName - Human-readable name for the reference point
|
|
61
|
-
* @param observation - New observation to add
|
|
62
|
-
*/
|
|
63
|
-
declare function saveRefPointObservation(scenarioHandle: FileSystemDirectoryHandle, pointId: string, pointName: string, observation: RefPointObservation): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Write a complete RefPointDefinition to OPFS.
|
|
66
|
-
* Creates the refPoints/ directory if it doesn't exist.
|
|
67
|
-
* Used by the recovery flow to restore definitions extracted from ZIPs.
|
|
68
|
-
*
|
|
69
|
-
* @param scenarioHandle - File system handle for the scenario folder
|
|
70
|
-
* @param definition - Complete ref point definition to write
|
|
71
|
-
*/
|
|
72
|
-
declare function writeRefPointDefinition(scenarioHandle: FileSystemDirectoryHandle, definition: RefPointDefinition): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Get list of all reference point IDs in the scenario.
|
|
75
|
-
* Useful for autocomplete/suggestions.
|
|
76
|
-
*
|
|
77
|
-
* @param scenarioHandle - File system handle for the scenario folder
|
|
78
|
-
* @returns Array of reference point IDs
|
|
79
|
-
*/
|
|
80
|
-
declare function listRefPointIds(scenarioHandle: FileSystemDirectoryHandle): Promise<string[]>;
|
|
81
|
-
/**
|
|
82
|
-
* Marker type representing a single observation suitable for visualization.
|
|
83
|
-
* Position/rotation use odometry frame; gpsPosition provides world coordinates.
|
|
84
|
-
*/
|
|
85
|
-
interface RefPointMark {
|
|
86
|
-
id: string;
|
|
87
|
-
/** Odometry position at the moment of marking */
|
|
88
|
-
odomPosition: Vector3;
|
|
89
|
-
/** Odometry rotation at the moment of marking */
|
|
90
|
-
odomRotation: Quaternion;
|
|
91
|
-
/** GPS position if available */
|
|
92
|
-
gpsPosition?: LatLongAlt;
|
|
93
|
-
timestamp: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Flatten an array of RefPointDefinition objects into individual RefPointMark
|
|
97
|
-
* observations suitable for visualization.
|
|
98
|
-
*
|
|
99
|
-
* @param refPointDefs - Array of reference point definitions with observations
|
|
100
|
-
* @returns Flat array of individual marks (one per observation)
|
|
101
|
-
*/
|
|
102
|
-
declare function flattenRefPointsToMarks(refPointDefs: RefPointDefinition[]): RefPointMark[];
|
|
103
|
-
/**
|
|
104
|
-
* Compute one averaged GPS position per reference point ID.
|
|
105
|
-
* For each observation, prefers `fusedGpsPoint` (sub-meter accuracy) when
|
|
106
|
-
* available, falling back to raw `gpsPoint`. Returns the centroid (mean
|
|
107
|
-
* lat/lon) across all observations.
|
|
108
|
-
*/
|
|
109
|
-
declare function averageGpsPerRefPoint(refPointDefs: RefPointDefinition[]): Array<{
|
|
110
|
-
id: string;
|
|
111
|
-
name: string;
|
|
112
|
-
lat: number;
|
|
113
|
-
lon: number;
|
|
114
|
-
alt?: number;
|
|
115
|
-
}>;
|
|
116
|
-
//#endregion
|
|
117
|
-
export { flattenRefPointsToMarks as a, loadRefPoint as c, averageGpsPerRefPoint as i, saveRefPointObservation as l, RefPointMark as n, listRefPointIds as o, RefPointObservation as r, loadAllRefPoints as s, RefPointDefinition as t, writeRefPointDefinition as u };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as gpsToH3, i as findNearbyRefPoint, n as KnownRefPoint, o as h3RefsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-ref-point-CFhayNSZ.js";
|
|
2
|
-
export { H3_RESOLUTION, KnownRefPoint, approxDistanceMetres, findNearbyRefPoint, gpsToH3, h3RefsMatch, isH3Index };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as gpsToH3, i as findNearbyRefPoint, n as KnownRefPoint, o as h3RefsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-ref-point-CFhayNSZ.js";
|
|
2
|
-
export { H3_RESOLUTION, type KnownRefPoint, approxDistanceMetres, findNearbyRefPoint, gpsToH3, h3RefsMatch, isH3Index };
|
package/dist/ref-points/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { n as KnownRefPoint } from "./h3-ref-point-CFhayNSZ.js";
|
|
2
|
-
import { t as ImportedRefPoint } from "./ref-point-importer-B_wn5ABk.js";
|
|
3
|
-
import * as _$_reduxjs_toolkit0 from "@reduxjs/toolkit";
|
|
4
|
-
|
|
5
|
-
//#region ../src/state/ref-points-slice.d.ts
|
|
6
|
-
interface RefPointsState {
|
|
7
|
-
/** Prior ref points loaded from previous session ZIPs. */
|
|
8
|
-
importedRefPoints: ImportedRefPoint[];
|
|
9
|
-
/**
|
|
10
|
-
* Tracks how many times each ref point was marked in the current session.
|
|
11
|
-
* Keyed by ref-point ID (H3 index). Plain object for Redux serializability
|
|
12
|
-
* (replaces the Map<string, number> that lived in the closure).
|
|
13
|
-
*/
|
|
14
|
-
sessionRefPointUsage: Record<string, number>;
|
|
15
|
-
}
|
|
16
|
-
declare const setImportedRefPoints: _$_reduxjs_toolkit0.ActionCreatorWithPayload<ImportedRefPoint[], "refPoints/setImportedRefPoints">, incrementRefPointUsage: _$_reduxjs_toolkit0.ActionCreatorWithPayload<string, "refPoints/incrementRefPointUsage">, clearSessionRefPointUsage: _$_reduxjs_toolkit0.ActionCreatorWithoutPayload<"refPoints/clearSessionRefPointUsage">, resetRefPointsState: _$_reduxjs_toolkit0.ActionCreatorWithoutPayload<"refPoints/resetRefPointsState">;
|
|
17
|
-
declare const refPointsReducer: _$_reduxjs_toolkit0.Reducer<RefPointsState>;
|
|
18
|
-
/**
|
|
19
|
-
* Memoized selector that derives KnownRefPoint[] (with H3 indices) from
|
|
20
|
-
* importedRefPoints. Replaces the closure-based `recomputeKnownRefPoints()`
|
|
21
|
-
* in ref-point-handlers.ts.
|
|
22
|
-
*
|
|
23
|
-
* Uses createSelector (reselect) for standard RTK memoization — recomputes
|
|
24
|
-
* only when the importedRefPoints array reference changes.
|
|
25
|
-
*/
|
|
26
|
-
declare const selectCachedKnownRefPoints: ((state: RefPointsState) => KnownRefPoint[]) & {
|
|
27
|
-
clearCache: () => void;
|
|
28
|
-
resultsCount: () => number;
|
|
29
|
-
resetResultsCount: () => void;
|
|
30
|
-
} & {
|
|
31
|
-
resultFunc: (resultFuncArgs_0: ImportedRefPoint[]) => KnownRefPoint[];
|
|
32
|
-
memoizedResultFunc: ((resultFuncArgs_0: ImportedRefPoint[]) => KnownRefPoint[]) & {
|
|
33
|
-
clearCache: () => void;
|
|
34
|
-
resultsCount: () => number;
|
|
35
|
-
resetResultsCount: () => void;
|
|
36
|
-
};
|
|
37
|
-
lastResult: () => KnownRefPoint[];
|
|
38
|
-
dependencies: [(state: RefPointsState) => ImportedRefPoint[]];
|
|
39
|
-
recomputations: () => number;
|
|
40
|
-
resetRecomputations: () => void;
|
|
41
|
-
dependencyRecomputations: () => number;
|
|
42
|
-
resetDependencyRecomputations: () => void;
|
|
43
|
-
} & {
|
|
44
|
-
memoize: typeof _$_reduxjs_toolkit0.weakMapMemoize;
|
|
45
|
-
argsMemoize: typeof _$_reduxjs_toolkit0.weakMapMemoize;
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
|
-
export { resetRefPointsState as a, refPointsReducer as i, clearSessionRefPointUsage as n, selectCachedKnownRefPoints as o, incrementRefPointUsage as r, setImportedRefPoints as s, RefPointsState as t };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { n as RefPointMark } from "./ref-point-loader-Pt1smgHS.js";
|
|
2
|
-
import { LatLong } from "gps-plus-slam-js";
|
|
3
|
-
|
|
4
|
-
//#region ../src/visualization/reference-points.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Manager for reference point visualization
|
|
7
|
-
*/
|
|
8
|
-
declare class RefPointVisualizer {
|
|
9
|
-
private priorRefMeshes;
|
|
10
|
-
private currentRefMeshes;
|
|
11
|
-
private zeroRef;
|
|
12
|
-
/** Shared geometry for prior-session ref point meshes (lazy-created) */
|
|
13
|
-
private priorRefGeometry;
|
|
14
|
-
/** Shared material for prior-session ref point meshes (lazy-created) */
|
|
15
|
-
private priorRefMaterial;
|
|
16
|
-
/** Shared geometry for current-session ref point meshes (lazy-created) */
|
|
17
|
-
private currentRefGeometry;
|
|
18
|
-
/**
|
|
19
|
-
* Set the GPS zero reference (origin for coordinate conversion).
|
|
20
|
-
* Must be called before displaying reference points.
|
|
21
|
-
*
|
|
22
|
-
* @param zero - GPS coordinates of the origin
|
|
23
|
-
*/
|
|
24
|
-
setZeroRef(zero: LatLong): void;
|
|
25
|
-
/**
|
|
26
|
-
* Get the current zero reference
|
|
27
|
-
*/
|
|
28
|
-
getZeroRef(): LatLong | null;
|
|
29
|
-
/**
|
|
30
|
-
* Display reference points from prior sessions.
|
|
31
|
-
* Clears any existing prior ref points first.
|
|
32
|
-
*
|
|
33
|
-
* @param refPoints - Array of reference point marks to visualize
|
|
34
|
-
*/
|
|
35
|
-
displayPriorRefPoints(refPoints: RefPointMark[]): void;
|
|
36
|
-
/**
|
|
37
|
-
* Add a reference point from the current session.
|
|
38
|
-
*
|
|
39
|
-
* @param refPoint - Reference point mark to visualize
|
|
40
|
-
*/
|
|
41
|
-
addCurrentRefPoint(refPoint: RefPointMark): void;
|
|
42
|
-
/**
|
|
43
|
-
* Clear all prior reference point meshes from the scene.
|
|
44
|
-
*/
|
|
45
|
-
clearPriorRefPoints(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Clear current session reference point meshes from the scene.
|
|
48
|
-
*/
|
|
49
|
-
clearCurrentRefPoints(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Clear all visualizations and reset state.
|
|
52
|
-
*/
|
|
53
|
-
clearAll(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Get count of visible reference points.
|
|
56
|
-
*/
|
|
57
|
-
getCounts(): {
|
|
58
|
-
prior: number;
|
|
59
|
-
current: number;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Singleton instance for global use.
|
|
64
|
-
* Import this to visualize reference points.
|
|
65
|
-
*/
|
|
66
|
-
declare const refPointVisualizer: RefPointVisualizer;
|
|
67
|
-
//#endregion
|
|
68
|
-
export { refPointVisualizer as n, RefPointVisualizer as t };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as _$_reduxjs_toolkit0 from "@reduxjs/toolkit";
|
|
2
|
-
|
|
3
|
-
//#region ../src/state/routing-slice.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Routing Slice — Redux state for current application screen.
|
|
6
|
-
*
|
|
7
|
-
* Bug 2 fix (SPA architecture audit): Moves `currentScreen` from a
|
|
8
|
-
* module-level variable in navigation.ts into Redux, making it the
|
|
9
|
-
* single source of truth for screen state. This enables time-travel
|
|
10
|
-
* debugging and prevents desync between navigation state and Redux.
|
|
11
|
-
*
|
|
12
|
-
* @see docs/2026-04-06-spa-architecture-audit.md — Bug 2
|
|
13
|
-
* @see docs_guides/spa-architecture-best-practices.md — §4 State-Driven Routing
|
|
14
|
-
*/
|
|
15
|
-
/** Application screen states for history-based navigation. */
|
|
16
|
-
type AppScreen = 'setup' | 'ar' | 'recording' | 'summary';
|
|
17
|
-
interface RoutingState {
|
|
18
|
-
currentScreen: AppScreen;
|
|
19
|
-
}
|
|
20
|
-
declare const navigateTo: _$_reduxjs_toolkit0.ActionCreatorWithPayload<AppScreen, "routing/navigateTo">;
|
|
21
|
-
declare const routingReducer: _$_reduxjs_toolkit0.Reducer<RoutingState>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { routingReducer as i, RoutingState as n, navigateTo as r, AppScreen as t };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as recordWriteFailure, c as startSession, i as recordDepthSample, n as SessionMetadata, o as recorderReducer, r as endSession, s as setCurrentScenarioName, t as RecorderState } from "../recorder-slice-fcwAXrsh.js";
|
|
2
|
-
export { RecorderState, SessionMetadata, endSession, recordDepthSample, recordWriteFailure, recorderReducer, setCurrentScenarioName, startSession };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as resetRefPointsState, i as refPointsReducer, n as clearSessionRefPointUsage, o as selectCachedKnownRefPoints, r as incrementRefPointUsage, s as setImportedRefPoints, t as RefPointsState } from "../ref-points-slice-tC-Wd6XJ.js";
|
|
2
|
-
export { RefPointsState, clearSessionRefPointUsage, incrementRefPointUsage, refPointsReducer, resetRefPointsState, selectCachedKnownRefPoints, setImportedRefPoints };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { gpsToH3 } from "../ref-points/h3-ref-point.js";
|
|
2
|
-
import { createSelector, createSlice } from "@reduxjs/toolkit";
|
|
3
|
-
//#region ../src/state/ref-points-slice.ts
|
|
4
|
-
const initialState = {
|
|
5
|
-
importedRefPoints: [],
|
|
6
|
-
sessionRefPointUsage: {}
|
|
7
|
-
};
|
|
8
|
-
const refPointsSlice = createSlice({
|
|
9
|
-
name: "refPoints",
|
|
10
|
-
initialState,
|
|
11
|
-
reducers: {
|
|
12
|
-
setImportedRefPoints(state, action) {
|
|
13
|
-
state.importedRefPoints = action.payload;
|
|
14
|
-
},
|
|
15
|
-
incrementRefPointUsage(state, action) {
|
|
16
|
-
const id = action.payload;
|
|
17
|
-
state.sessionRefPointUsage[id] = (state.sessionRefPointUsage[id] ?? 0) + 1;
|
|
18
|
-
},
|
|
19
|
-
clearSessionRefPointUsage(state) {
|
|
20
|
-
state.sessionRefPointUsage = {};
|
|
21
|
-
},
|
|
22
|
-
resetRefPointsState() {
|
|
23
|
-
return initialState;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const { setImportedRefPoints, incrementRefPointUsage, clearSessionRefPointUsage, resetRefPointsState } = refPointsSlice.actions;
|
|
28
|
-
const refPointsReducer = refPointsSlice.reducer;
|
|
29
|
-
/**
|
|
30
|
-
* Memoized selector that derives KnownRefPoint[] (with H3 indices) from
|
|
31
|
-
* importedRefPoints. Replaces the closure-based `recomputeKnownRefPoints()`
|
|
32
|
-
* in ref-point-handlers.ts.
|
|
33
|
-
*
|
|
34
|
-
* Uses createSelector (reselect) for standard RTK memoization — recomputes
|
|
35
|
-
* only when the importedRefPoints array reference changes.
|
|
36
|
-
*/
|
|
37
|
-
const selectCachedKnownRefPoints = createSelector((state) => state.importedRefPoints, (importedRefPoints) => importedRefPoints.map((rp) => ({
|
|
38
|
-
h3Index: gpsToH3(rp.lat, rp.lon),
|
|
39
|
-
displayName: rp.name || rp.id,
|
|
40
|
-
lat: rp.lat,
|
|
41
|
-
lon: rp.lon
|
|
42
|
-
})));
|
|
43
|
-
//#endregion
|
|
44
|
-
export { clearSessionRefPointUsage, incrementRefPointUsage, refPointsReducer, resetRefPointsState, selectCachedKnownRefPoints, setImportedRefPoints };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
-
//#region ../src/state/routing-slice.ts
|
|
3
|
-
const routingSlice = createSlice({
|
|
4
|
-
name: "routing",
|
|
5
|
-
initialState: { currentScreen: "setup" },
|
|
6
|
-
reducers: { navigateTo(state, action) {
|
|
7
|
-
state.currentScreen = action.payload;
|
|
8
|
-
} }
|
|
9
|
-
});
|
|
10
|
-
const { navigateTo } = routingSlice.actions;
|
|
11
|
-
const routingReducer = routingSlice.reducer;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { navigateTo, routingReducer };
|
package/dist/state/store.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { i as DepthSample, r as DepthPoint } from "../ar-types-B-ORgk6Z.js";
|
|
2
|
-
import { s as RecordingOptions } from "../recording-options-BYUFX8iU.js";
|
|
3
|
-
import { n as SessionMetadata } from "../opfs-storage-ChOzF_Wp.js";
|
|
4
|
-
import { t as StorageBackend } from "../storage-backend-BcEItnFr.js";
|
|
5
|
-
import { a as recordWriteFailure, c as startSession, i as recordDepthSample, n as SessionMetadata$1, r as endSession, s as setCurrentScenarioName, t as RecorderState } from "../recorder-slice-fcwAXrsh.js";
|
|
6
|
-
import { a as resetRefPointsState, n as clearSessionRefPointUsage, o as selectCachedKnownRefPoints, r as incrementRefPointUsage, s as setImportedRefPoints, t as RefPointsState } from "../ref-points-slice-tC-Wd6XJ.js";
|
|
7
|
-
import { n as RefPointMark } from "../ref-point-loader-Pt1smgHS.js";
|
|
8
|
-
import { _ as setZeroPos, a as MarkReferencePointPayload, c as RecordGpsEventPayload, d as RootState, f as add2dImage, g as recordGpsEvent, h as markReferencePoint, i as LatLong, l as RecorderStore, m as createRecorderStore, n as CombinedRootState, o as RawDeviceOrientation, p as calcRelativeCoordsInMeters, r as GpsPoint, s as RawGpsPoint, t as AppDispatch, u as RecorderStoreOptions } from "../store-C7PKOj8S.js";
|
|
9
|
-
export { AppDispatch, CombinedRootState, DepthPoint, DepthSample, GpsPoint, LatLong, MarkReferencePointPayload, SessionMetadata as OpfsSessionMetadata, RawDeviceOrientation, RawGpsPoint, RecordGpsEventPayload, RecorderState, RecorderStore, RecorderStoreOptions, RecordingOptions, RefPointMark, RefPointsState, RootState, SessionMetadata$1 as SessionMetadata, StorageBackend, add2dImage, calcRelativeCoordsInMeters, clearSessionRefPointUsage, createRecorderStore, endSession, incrementRefPointUsage, markReferencePoint, recordDepthSample, recordGpsEvent, recordWriteFailure, resetRefPointsState, selectCachedKnownRefPoints, setCurrentScenarioName, setImportedRefPoints, setZeroPos, startSession };
|
package/dist/state/store.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { endSession, recordDepthSample, recordWriteFailure, recorderReducer, setCurrentScenarioName, startSession } from "./recorder-slice.js";
|
|
2
|
-
import { clearSessionRefPointUsage, incrementRefPointUsage, refPointsReducer, resetRefPointsState, selectCachedKnownRefPoints, setImportedRefPoints } from "./ref-points-slice.js";
|
|
3
|
-
import { routingReducer } from "./routing-slice.js";
|
|
4
|
-
import { OpfsStorageBackend } from "../storage/opfs-storage-backend.js";
|
|
5
|
-
import { createPersistenceMiddleware } from "./persistence-middleware.js";
|
|
6
|
-
import "../licensing/community-license-key.js";
|
|
7
|
-
import { configureStore } from "@reduxjs/toolkit";
|
|
8
|
-
import { add2dImage, arElementsReducer, calcRelativeCoordsInMeters, gpsDataReducer, gpsElementsReducer, markReferencePoint, recordGpsEvent, sanitizeForDevTools, setZeroPos, validateLicenseKey } from "gps-plus-slam-js";
|
|
9
|
-
//#region ../src/state/store.ts
|
|
10
|
-
/**
|
|
11
|
-
* Redux Store for Recorder App
|
|
12
|
-
*
|
|
13
|
-
* Uses Redux Toolkit's configureStore to combine all reducers (library +
|
|
14
|
-
* app-level) into a single store. Action persistence during recording is
|
|
15
|
-
* handled by the persistence middleware.
|
|
16
|
-
*
|
|
17
|
-
* ARCHITECTURE NOTE: See docs/architecture-ar-gps-pose-separation.md
|
|
18
|
-
* The library's recordGpsEvent action captures paired AR+GPS data
|
|
19
|
-
* that feeds directly into the alignment algorithm.
|
|
20
|
-
*
|
|
21
|
-
* Migration note (§4 — architecture-observations-consolidated.md):
|
|
22
|
-
* Previously the store used a manual wrapper pattern with action.type.startsWith()
|
|
23
|
-
* prefix matching to route actions between a library store and local state
|
|
24
|
-
* variables. This has been replaced with a single configureStore call that
|
|
25
|
-
* combines all 6 reducers declaratively.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Create the recorder store using Redux Toolkit's configureStore.
|
|
29
|
-
*
|
|
30
|
-
* Combines all 6 reducers (3 library: gpsData, gpsElements, arElements;
|
|
31
|
-
* 3 app: recorder, refPoints, routing) into a single store with the
|
|
32
|
-
* persistence middleware for action recording.
|
|
33
|
-
*
|
|
34
|
-
* @param options - Optional configuration including callbacks
|
|
35
|
-
*/
|
|
36
|
-
function createRecorderStore(options = {}) {
|
|
37
|
-
const { onWriteFailure } = options;
|
|
38
|
-
const storageBackend = options.storageBackend ?? new OpfsStorageBackend();
|
|
39
|
-
const enableDevChecks = options.enableDevChecks ?? true;
|
|
40
|
-
validateLicenseKey(options.licenseKey ?? "eyJ0eXBlIjoiY29tbXVuaXR5IiwiZXhwIjoxODA4NzcyNDI3fQ.YYNf0IdqniZdMzRXCuvewxsQQ01XNywrKsfL5IpiJotfFJfqtrGg4u9z0QFhXeszPtUhnvgC8_oOnbOkbXPuAw");
|
|
41
|
-
const store = configureStore({
|
|
42
|
-
reducer: {
|
|
43
|
-
gpsData: gpsDataReducer,
|
|
44
|
-
gpsElements: gpsElementsReducer,
|
|
45
|
-
arElements: arElementsReducer,
|
|
46
|
-
recorder: recorderReducer,
|
|
47
|
-
refPoints: refPointsReducer,
|
|
48
|
-
routing: routingReducer
|
|
49
|
-
},
|
|
50
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
51
|
-
serializableCheck: enableDevChecks,
|
|
52
|
-
immutableCheck: enableDevChecks
|
|
53
|
-
}).concat(createPersistenceMiddleware({
|
|
54
|
-
storageBackend,
|
|
55
|
-
onWriteFailure
|
|
56
|
-
})),
|
|
57
|
-
devTools: {
|
|
58
|
-
actionSanitizer: sanitizeForDevTools,
|
|
59
|
-
stateSanitizer: sanitizeForDevTools
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return {
|
|
63
|
-
getState: () => store.getState(),
|
|
64
|
-
dispatch: store.dispatch,
|
|
65
|
-
subscribe: (listener) => store.subscribe(listener),
|
|
66
|
-
writeFrame: (blob, index) => storageBackend.writeFrame(blob, index),
|
|
67
|
-
writeSessionMetadata: (metadata) => storageBackend.writeSessionMetadata(metadata)
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
//#endregion
|
|
71
|
-
export { add2dImage, calcRelativeCoordsInMeters, clearSessionRefPointUsage, createRecorderStore, endSession, incrementRefPointUsage, markReferencePoint, recordDepthSample, recordGpsEvent, recordWriteFailure, resetRefPointsState, selectCachedKnownRefPoints, setCurrentScenarioName, setImportedRefPoints, setZeroPos, startSession };
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../utils/logger.js";
|
|
2
|
-
import { h3RefsMatch, isH3Index } from "../ref-points/h3-ref-point.js";
|
|
3
|
-
import { BlobReader, TextWriter, ZipReader } from "@zip.js/zip.js";
|
|
4
|
-
//#region ../src/storage/ref-point-importer.ts
|
|
5
|
-
/**
|
|
6
|
-
* Reference Point Importer Module
|
|
7
|
-
*
|
|
8
|
-
* Extracts reference points from ZIP files in a folder, enabling reuse of
|
|
9
|
-
* ref points from previous recording sessions.
|
|
10
|
-
*
|
|
11
|
-
* This module:
|
|
12
|
-
* 1. Enumerates all *.zip files in a folder
|
|
13
|
-
* 2. Opens each ZIP and looks for refPoints/*.json files
|
|
14
|
-
* 3. Parses and validates each ref point definition
|
|
15
|
-
* 4. Merges and deduplicates ref points by ID
|
|
16
|
-
*
|
|
17
|
-
* Uses @zip.js/zip.js for ZIP reading (same library as zip-export.ts).
|
|
18
|
-
*/
|
|
19
|
-
const log = createLogger("RefPointImporter");
|
|
20
|
-
/**
|
|
21
|
-
* Check if a file name is a ZIP file (case-insensitive).
|
|
22
|
-
*/
|
|
23
|
-
function isZipFileName(name) {
|
|
24
|
-
return name.toLowerCase().endsWith(".zip");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Check if a ZIP entry path is a ref point JSON file.
|
|
28
|
-
* Expected path: refPoints/{id}.json
|
|
29
|
-
*/
|
|
30
|
-
function isRefPointEntry(entryPath) {
|
|
31
|
-
return entryPath.startsWith("refPoints/") && entryPath.endsWith(".json") && entryPath !== "refPoints/";
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Type guard to validate parsed JSON matches RefPointDefinition shape.
|
|
35
|
-
* Validates at least one observation exists with required nested properties.
|
|
36
|
-
*/
|
|
37
|
-
function isValidRefPointDefinition(value) {
|
|
38
|
-
if (typeof value !== "object" || value === null) return false;
|
|
39
|
-
const obj = value;
|
|
40
|
-
if (typeof obj.id !== "string" || typeof obj.name !== "string" || typeof obj.createdAt !== "number" || !Array.isArray(obj.observations)) return false;
|
|
41
|
-
if (obj.observations.length === 0) return true;
|
|
42
|
-
const firstObs = obj.observations[0];
|
|
43
|
-
if (typeof firstObs !== "object" || firstObs === null) return false;
|
|
44
|
-
const gpsPoint = firstObs.gpsPoint;
|
|
45
|
-
if (typeof gpsPoint !== "object" || gpsPoint === null || typeof gpsPoint.latitude !== "number" || typeof gpsPoint.longitude !== "number") return false;
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Convert a RefPointDefinition to an ImportedRefPoint.
|
|
50
|
-
* Extracts GPS coordinates from the first observation.
|
|
51
|
-
*/
|
|
52
|
-
function toImportedRefPoint(def, sourceZipName) {
|
|
53
|
-
if (def.observations.length === 0) return null;
|
|
54
|
-
const firstObs = def.observations[0];
|
|
55
|
-
return {
|
|
56
|
-
id: def.id,
|
|
57
|
-
name: def.name,
|
|
58
|
-
lat: firstObs.gpsPoint.latitude,
|
|
59
|
-
lon: firstObs.gpsPoint.longitude,
|
|
60
|
-
alt: firstObs.gpsPoint.altitude,
|
|
61
|
-
sourceZipName
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Extract reference points from a single ZIP file.
|
|
66
|
-
*
|
|
67
|
-
* @param zipBlob - The ZIP file as a Blob
|
|
68
|
-
* @param zipFileName - Name of the ZIP file (for error messages)
|
|
69
|
-
* @returns Array of imported ref points and any errors
|
|
70
|
-
*/
|
|
71
|
-
async function extractRefPointsFromZip(zipBlob, zipFileName) {
|
|
72
|
-
const refPoints = [];
|
|
73
|
-
const errors = [];
|
|
74
|
-
const zipReader = new ZipReader(new BlobReader(zipBlob));
|
|
75
|
-
try {
|
|
76
|
-
const entries = await zipReader.getEntries();
|
|
77
|
-
for (const entry of entries) {
|
|
78
|
-
if (entry.directory) continue;
|
|
79
|
-
if (!isRefPointEntry(entry.filename)) continue;
|
|
80
|
-
try {
|
|
81
|
-
const textWriter = new TextWriter();
|
|
82
|
-
const jsonText = await entry.getData(textWriter);
|
|
83
|
-
let parsed;
|
|
84
|
-
try {
|
|
85
|
-
parsed = JSON.parse(jsonText);
|
|
86
|
-
} catch (parseErr) {
|
|
87
|
-
errors.push(`${zipFileName}/${entry.filename}: Invalid JSON - ${parseErr.message}`);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (!isValidRefPointDefinition(parsed)) {
|
|
91
|
-
errors.push(`${zipFileName}/${entry.filename}: Invalid ref point schema`);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const imported = toImportedRefPoint(parsed, zipFileName);
|
|
95
|
-
if (imported) refPoints.push(imported);
|
|
96
|
-
} catch (entryErr) {
|
|
97
|
-
errors.push(`${zipFileName}/${entry.filename}: ${entryErr.message}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} finally {
|
|
101
|
-
await zipReader.close();
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
refPoints,
|
|
105
|
-
errors
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Import reference points from all ZIP files in a folder.
|
|
110
|
-
*
|
|
111
|
-
* Enumerates all *.zip files in the folder, extracts refPoints/*.json from each,
|
|
112
|
-
* and merges them into a deduplicated list.
|
|
113
|
-
*
|
|
114
|
-
* Deduplication: If the same ref point ID appears in multiple ZIPs, the first
|
|
115
|
-
* occurrence is kept (based on iteration order).
|
|
116
|
-
*
|
|
117
|
-
* @param folderHandle - Read-only directory handle from showDirectoryPicker
|
|
118
|
-
* @returns Result containing merged ref points, scan count, and errors
|
|
119
|
-
*/
|
|
120
|
-
async function importRefPointsFromFolder(folderHandle) {
|
|
121
|
-
const allRefPoints = [];
|
|
122
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
123
|
-
const allErrors = [];
|
|
124
|
-
let zipFilesScanned = 0;
|
|
125
|
-
log.info(`Scanning folder: ${folderHandle.name}`);
|
|
126
|
-
try {
|
|
127
|
-
for await (const entry of folderHandle.values()) {
|
|
128
|
-
if (entry.kind !== "file" || !isZipFileName(entry.name)) continue;
|
|
129
|
-
log.debug(`Processing ZIP: ${entry.name}`);
|
|
130
|
-
try {
|
|
131
|
-
const { refPoints, errors } = await extractRefPointsFromZip(await (await folderHandle.getFileHandle(entry.name)).getFile(), entry.name);
|
|
132
|
-
zipFilesScanned++;
|
|
133
|
-
allErrors.push(...errors);
|
|
134
|
-
for (const refPoint of refPoints) if (!(isH3Index(refPoint.id) ? allRefPoints.some((existing) => isH3Index(existing.id) && h3RefsMatch(existing.id, refPoint.id)) : seenIds.has(refPoint.id))) {
|
|
135
|
-
seenIds.add(refPoint.id);
|
|
136
|
-
allRefPoints.push(refPoint);
|
|
137
|
-
} else log.debug(`Skipping duplicate ref point: ${refPoint.id} from ${entry.name}`);
|
|
138
|
-
} catch (zipErr) {
|
|
139
|
-
const errorMsg = `Failed to process ${entry.name}: ${zipErr.message}`;
|
|
140
|
-
log.warn(errorMsg);
|
|
141
|
-
allErrors.push(errorMsg);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
log.info(`Imported ${allRefPoints.length} ref points from ${zipFilesScanned} ZIP files`);
|
|
145
|
-
return {
|
|
146
|
-
success: true,
|
|
147
|
-
refPoints: allRefPoints,
|
|
148
|
-
zipFilesScanned,
|
|
149
|
-
errors: allErrors
|
|
150
|
-
};
|
|
151
|
-
} catch (err) {
|
|
152
|
-
const errorMsg = `Failed to scan folder: ${err.message}`;
|
|
153
|
-
log.error(errorMsg);
|
|
154
|
-
return {
|
|
155
|
-
success: false,
|
|
156
|
-
refPoints: allRefPoints,
|
|
157
|
-
zipFilesScanned,
|
|
158
|
-
errors: [...allErrors, errorMsg]
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
export { importRefPointsFromFolder };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as flattenRefPointsToMarks, c as loadRefPoint, i as averageGpsPerRefPoint, l as saveRefPointObservation, n as RefPointMark, o as listRefPointIds, r as RefPointObservation, s as loadAllRefPoints, t as RefPointDefinition, u as writeRefPointDefinition } from "../ref-point-loader-Pt1smgHS.js";
|
|
2
|
-
export { RefPointDefinition, RefPointMark, RefPointObservation, averageGpsPerRefPoint, flattenRefPointsToMarks, listRefPointIds, loadAllRefPoints, loadRefPoint, saveRefPointObservation, writeRefPointDefinition };
|