@smarterplan/ngx-smarterplan-core 1.4.20 → 1.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/esm2022/lib/components/splat-viewer/splat-viewer.component.mjs +361 -0
  2. package/esm2022/lib/matterport-extensions/security-camera/SecurityCamera.mjs +28 -7
  3. package/esm2022/lib/ngx-smarterplan-core.module.mjs +9 -4
  4. package/esm2022/lib/services/matterport-object3d.service.mjs +657 -133
  5. package/esm2022/lib/services/matterport-tag.service.mjs +12 -7
  6. package/esm2022/lib/services/matterport.service.mjs +330 -9
  7. package/esm2022/lib/services/obj-to-glb.mjs +649 -0
  8. package/esm2022/lib/services/s3.service.mjs +43 -3
  9. package/esm2022/lib/services/threejs-import.service.mjs +6 -4
  10. package/esm2022/lib/services/threejs.service.mjs +867 -95
  11. package/esm2022/lib/services/utils/matterport-framing.util.mjs +63 -0
  12. package/esm2022/lib/services/viewer.service.mjs +189 -7
  13. package/esm2022/lib/types.service.mjs +3 -1
  14. package/esm2022/public-api.mjs +3 -1
  15. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +3217 -282
  16. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  17. package/lib/components/splat-viewer/splat-viewer.component.d.ts +98 -0
  18. package/lib/ngx-smarterplan-core.module.d.ts +7 -6
  19. package/lib/services/matterport-object3d.service.d.ts +125 -5
  20. package/lib/services/matterport-tag.service.d.ts +5 -5
  21. package/lib/services/matterport.service.d.ts +106 -7
  22. package/lib/services/obj-to-glb.d.ts +66 -0
  23. package/lib/services/s3.service.d.ts +7 -0
  24. package/lib/services/threejs.service.d.ts +336 -16
  25. package/lib/services/utils/matterport-framing.util.d.ts +40 -0
  26. package/lib/services/viewer.service.d.ts +110 -8
  27. package/lib/types.service.d.ts +42 -1
  28. package/package.json +1 -1
  29. package/public-api.d.ts +2 -0
  30. package/src/assets/viewers/splat/chunk-BYLI4YBI.js +17037 -0
  31. package/src/assets/viewers/splat/chunk-LDV6YPMG.js +1 -0
  32. package/src/assets/viewers/splat/chunk-WZ5Z4TU3.js +105719 -0
  33. package/src/assets/viewers/splat/convert-4DRLH77X.js +1 -0
  34. package/src/assets/viewers/splat/convert.html +11 -0
  35. package/src/assets/viewers/splat/converter-SLBB5MHG.js +1 -0
  36. package/src/assets/viewers/splat/index.html +90 -0
  37. package/src/assets/viewers/splat/spz-DEYRea_v-QE6YSGIB.js +5292 -0
  38. package/src/assets/viewers/splat/viewer-W4X3FWQJ.js +2704 -0
  39. package/src/assets/viewers/splat/viewer.css +1096 -0
  40. package/src/assets/viewers/splat/webp.wasm +0 -0
  41. package/src/assets/viewers/splat/worker.mjs +1383 -0
@@ -8,6 +8,24 @@ import { PoiService } from './models/poi.service';
8
8
  import { ThreeJsModelUp } from '../helpers.service';
9
9
  import { Config } from '../config';
10
10
  import * as i0 from "@angular/core";
11
+ /**
12
+ * What a Gaussian splat file is named with, when it is a .ply: the content is what tells it from
13
+ * another .ply, and the key is all a visit stores (see isGaussianSplatPly).
14
+ */
15
+ export declare const GAUSSIAN_SPLAT_PLY_SUFFIX = ".splat.ply";
16
+ /**
17
+ * Whether a 3D model file holds Gaussian splats, which the Three.js viewer cannot draw: .spz,
18
+ * .splat, .ksplat, SuperSplat's .sog, a .ply named with GAUSSIAN_SPLAT_PLY_SUFFIX, or the
19
+ * lod-meta.json of a Streamed SOG - SuperSplat's levels of detail, in pieces beside it.
20
+ */
21
+ export declare function isGaussianSplatFile(name: string): boolean;
22
+ /**
23
+ * Whether a .ply holds Gaussian splats: what splat tools export carries, for each splat, its colour
24
+ * as spherical harmonics (f_dc_0...) and its size (scale_0...). Only the header is read.
25
+ */
26
+ export declare function isGaussianSplatPly(file: Blob): Promise<boolean>;
27
+ /** Whether a 3D model file is the lod-meta.json of a Streamed SOG; see isGaussianSplatFile. */
28
+ export declare function isStreamedSplatFile(name: string): boolean;
11
29
  export declare class ViewerService {
12
30
  private readonly sdkKey;
13
31
  private readonly config;
@@ -155,6 +173,22 @@ export declare class ViewerService {
155
173
  private defaultTagIconUrl;
156
174
  /** Moves the Three.js camera to frame a tag, mirroring Matterport's goToTag. */
157
175
  goToThreeJsTag(elementId: string): void;
176
+ /** The tag the Three.js camera is sent to, for the splat viewer to point out; see goToThreeJsTag. */
177
+ get threeJsTagFocused$(): Subject<string>;
178
+ /** A tag clicked in the splat viewer, said as threeJsTagClicked$ says one clicked in the scene. */
179
+ clickThreeJsTag(elementId: string): void;
180
+ /** Whether the visit's 3D model has a calibration, from its capture's metadata. */
181
+ isThreeJsCalibrated(): boolean;
182
+ /** Whether the tags a calibration works with are on show; see ThreeJsService.showsCalibrationTags. */
183
+ isThreeJsShowingCalibrationTags(): boolean;
184
+ /** Whether a calibration is under way in the Three.js scene. */
185
+ isThreeJsAligningTags(): boolean;
186
+ /** Whether a measurement is taking clicks in the Three.js scene. */
187
+ isThreeJsMeasuring(): boolean;
188
+ /** True when a measurement starts taking clicks, false when it stops; see ThreeJsService.measuringChanged$. */
189
+ get threeJsMeasuringChanged$(): Subject<boolean>;
190
+ /** Says a click in the splat viewer was of no use to the calibration, as one in the scene would. */
191
+ ignoreThreeJsAlignmentClick(expected: 'tag' | 'point'): void;
158
192
  /** Shows only tags of the given POI types; null clears the filter. */
159
193
  setVisibleThreeJsTagTypes(types: PoiType[] | null): void;
160
194
  /**
@@ -165,11 +199,17 @@ export declare class ViewerService {
165
199
  */
166
200
  startThreeJsTagAlignment(): void;
167
201
  cancelThreeJsTagAlignment(): void;
168
- get threeJsAlignmentProgress$(): Subject<{
169
- pairs: number;
170
- awaiting: "tag" | "point";
171
- tagId?: string;
172
- }>;
202
+ /**
203
+ * Says whether the 3D model on screen is the site's only visit. Then there is nowhere else for a
204
+ * tag to have come from, and the tags that do not record where they were placed are its own.
205
+ */
206
+ setThreeJsSoleVisit(sole: boolean): void;
207
+ /**
208
+ * Shows the tags a calibration would work with, including those hidden for not landing on the
209
+ * model, before anything is armed. Cancelling or saving the calibration hides them again.
210
+ */
211
+ revealThreeJsCalibrationTags(): void;
212
+ get threeJsAlignmentProgress$(): Subject<import("./threejs.service").ThreeJsAlignmentProgress>;
173
213
  /**
174
214
  * Solves the alignment and applies it to the scene, returning it as the JSON to store in the
175
215
  * capture's metadata. Null means the three tags were collinear and nothing was applied.
@@ -224,8 +264,28 @@ export declare class ViewerService {
224
264
  points: number;
225
265
  distances: number[];
226
266
  }>;
227
- /** Ends the Three.js measurement in progress, or returns null when it has fewer than two points. */
228
- finishThreeJsMeasurement(): ThreeJsMeasurement | null;
267
+ /**
268
+ * Ends the Three.js measurement in progress, or returns null when it has fewer than two points.
269
+ * `screenshot` is the picture of it, when the model is drawn by another viewer than the scene.
270
+ */
271
+ finishThreeJsMeasurement(screenshot?: string): ThreeJsMeasurement | null;
272
+ /** A measurement was taken off the model, finished or not; see ThreeJsService.measurementCleared$. */
273
+ get threeJsMeasurementCleared$(): Subject<void>;
274
+ /**
275
+ * Adds a point to the measurement under way, picked on the model in another viewer - the splat
276
+ * viewer - in the model's own coordinates. False when no measurement is under way.
277
+ */
278
+ addThreeJsMeasurePointAtModelPoint(point: {
279
+ x: number;
280
+ y: number;
281
+ z: number;
282
+ }): boolean;
283
+ /** The points of the measurement on the model, in the model's own coordinates, for another viewer to draw. */
284
+ getThreeJsMeasurePointsInModelFrame(): {
285
+ x: number;
286
+ y: number;
287
+ z: number;
288
+ }[];
229
289
  /** The measurement last finished in the Three.js viewer, for the form that saves it. */
230
290
  getThreeJsLastMeasurement(): ThreeJsMeasurement | null;
231
291
  /**
@@ -259,6 +319,22 @@ export declare class ViewerService {
259
319
  } | null;
260
320
  /** Chooses the tag for the calibration pair being matched by id, instead of by clicking it. */
261
321
  selectThreeJsAlignmentTag(elementId: string): boolean;
322
+ /**
323
+ * Gives the tag being matched in the calibration under way its real place, picked on the model in
324
+ * another viewer - the splat viewer - in the model's own coordinates. False when no tag was waiting.
325
+ */
326
+ matchThreeJsAlignmentTagAtModelPoint(point: {
327
+ x: number;
328
+ y: number;
329
+ z: number;
330
+ }): boolean;
331
+ /**
332
+ * Takes back the last step of the calibration under way: the tag just chosen, or else the last
333
+ * pair matched. False when there was nothing to take back.
334
+ */
335
+ undoThreeJsAlignmentStep(): boolean;
336
+ /** Removes one matched pair of the calibration under way, by its place in the list. */
337
+ removeThreeJsAlignmentPair(index: number): boolean;
262
338
  /** How far the visible tags sit from the 3D model, in model radii. Null without both. */
263
339
  getThreeJsTagDistanceFromModel(): number | null;
264
340
  /** How many tags the Three.js scene is showing. */
@@ -281,11 +357,37 @@ export declare class ViewerService {
281
357
  *
282
358
  * Returns null when there is no pending placement, which is the normal case in Matterport mode.
283
359
  */
284
- createPoiForThreeJsPlacement(element: DbObjectType, poiType: PoiType): Promise<POI | null>;
360
+ createPoiForThreeJsPlacement(element: DbObjectType, poiType: PoiType, extra?: Partial<POI>): Promise<POI | null>;
285
361
  /** Emits when a tag is dropped on the model in the Three.js scene. */
286
362
  get threeJsTagPlaced$(): Subject<import("./threejs.service").ThreeJsTagPlacement>;
287
363
  /** Emits when the calibration walkthrough is abandoned, including via Escape. */
288
364
  get threeJsAlignmentCancelled$(): Subject<void>;
365
+ /** Emits when the Three.js tags change; see getThreeJsTagSnapshot. */
366
+ get threeJsTagsChanged$(): Subject<void>;
367
+ /** The tags, and their calibration, as a viewer drawing the scene elsewhere needs them. */
368
+ getThreeJsTagSnapshot(): {
369
+ tags: import("./threejs.service").ThreeJsTagSnapshot[];
370
+ alignment: import("../helpers.service").ThreeJsAlignment;
371
+ };
372
+ /** Stops drawing the Three.js scene while another viewer covers it, or starts again. */
373
+ setThreeJsRenderingPaused(paused: boolean): void;
374
+ /** Emits when a click during calibration landed on nothing it could use: a tag, or the model. */
375
+ get threeJsAlignmentClickIgnored$(): Subject<"tag" | "point">;
376
+ /** Emits when Three.js tag placement is armed (true) and when it ends (false). */
377
+ get threeJsPlacementChanged$(): Subject<boolean>;
378
+ /**
379
+ * Completes an armed Three.js tag placement at a spot the splat viewer picked, in the model's own
380
+ * coordinates: the creation form then opens as for a click in the Three.js scene.
381
+ */
382
+ placeThreeJsTagAtModelPoint(point: {
383
+ x: number;
384
+ y: number;
385
+ z: number;
386
+ }, normal?: {
387
+ x: number;
388
+ y: number;
389
+ z: number;
390
+ } | null): void;
289
391
  /** Leaves Three.js tag placement mode without placing anything. */
290
392
  cancelThreeJsTagPlacement(): void;
291
393
  editOnlyTagStyleForPoi(poi: POI, object: DbObjectType): void;
@@ -405,7 +405,9 @@ export type POI = {
405
405
  export declare enum ViewerInteractions {
406
406
  DEFAULT = 0,
407
407
  ADDING = 1,
408
- POSITIONING = 2
408
+ POSITIONING = 2,
409
+ /** A loaded 3D object follows the cursor until the user clicks (validate) or cancels */
410
+ PLACING_OBJECT3D = 3
409
411
  }
410
412
  export type Mission = {
411
413
  userID: string;
@@ -820,6 +822,8 @@ export type IObject3D = {
820
822
  id?: string;
821
823
  object: string;
822
824
  format: string;
825
+ /** Full url of the model file; when set it replaces the url built from the bundled assets */
826
+ url?: string;
823
827
  mode: string;
824
828
  position: {
825
829
  x: number;
@@ -838,6 +842,43 @@ export type IObject3D = {
838
842
  };
839
843
  viewFrustum: boolean;
840
844
  };
845
+ export type Point3D = {
846
+ x: number;
847
+ y: number;
848
+ z: number;
849
+ };
850
+ /** World-space bounding box of a 3D object */
851
+ export type Object3DBoundingBox = {
852
+ min: Point3D;
853
+ max: Point3D;
854
+ size: Point3D;
855
+ center: Point3D;
856
+ };
857
+ /** Local transform of a 3D object (rotation in radians, Euler XYZ) */
858
+ export type Object3DTransform = {
859
+ position: Point3D;
860
+ rotation: Point3D;
861
+ scale: Point3D;
862
+ };
863
+ /** Emitted when the transform of a 3D object changes (gizmo drag or setObject3DTransform) */
864
+ export type Object3DTransformChange = Object3DTransform & {
865
+ uuid: string;
866
+ };
867
+ export type GizmoMode = 'translate' | 'rotate' | 'scale';
868
+ /** Snapping steps of the gizmo. A missing / null value disables snapping for that mode */
869
+ export type GizmoSnap = {
870
+ /** meters */
871
+ translation?: number | null;
872
+ /** degrees */
873
+ rotationDeg?: number | null;
874
+ /** scale step */
875
+ scale?: number | null;
876
+ };
877
+ /** Result of an interactive placement (surface point under the cursor and its normal) */
878
+ export type Object3DPlacementResult = {
879
+ position: Point3D;
880
+ normal: Point3D;
881
+ };
841
882
  /**
842
883
  * DynamoDb object3D
843
884
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarterplan/ngx-smarterplan-core",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },
package/public-api.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from './lib/services/search.service';
21
21
  export * from './lib/services/zone-drawer.service';
22
22
  export * from './lib/services/matterport-import.service';
23
23
  export * from './lib/services/threejs-import.service';
24
+ export * from './lib/services/obj-to-glb';
24
25
  export * from './lib/services/matterport-tag-copy.service';
25
26
  export * from './lib/mattertagData';
26
27
  export * from './lib/services/utils/matterport-transform.util';
@@ -56,6 +57,7 @@ export * from './lib/components/csv-export/csv-export.component';
56
57
  export * from './lib/components/search-bar/search-bar.component';
57
58
  export * from './lib/components/menu-bar/menu-bar.component';
58
59
  export * from './lib/components/loader/loader.component';
60
+ export * from './lib/components/splat-viewer/splat-viewer.component';
59
61
  export * from './lib/components/support-modal/support-modal.component';
60
62
  export * from './lib/components/menu-bar/avatar/avatar.component';
61
63
  export * from './lib/pipes/duration-to-string.pipe';