@smarterplan/ngx-smarterplan-core 1.4.21 → 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 (114) hide show
  1. package/README.md +24 -24
  2. package/esm2022/lib/components/csv-export/csv-export.component.mjs +3 -3
  3. package/esm2022/lib/components/loader/loader.component.mjs +3 -3
  4. package/esm2022/lib/components/menu-bar/avatar/avatar.component.mjs +1 -1
  5. package/esm2022/lib/components/menu-bar/menu-bar.component.mjs +3 -3
  6. package/esm2022/lib/components/menu-bar/navigation-bar/navigation-bar.component.mjs +3 -3
  7. package/esm2022/lib/components/modal-switch-visit/modal-switch-visit.component.mjs +3 -3
  8. package/esm2022/lib/components/search-bar/search-bar.component.mjs +3 -3
  9. package/esm2022/lib/components/splat-viewer/splat-viewer.component.mjs +361 -0
  10. package/esm2022/lib/components/support-modal/support-modal.component.mjs +3 -3
  11. package/esm2022/lib/config.mjs +1 -1
  12. package/esm2022/lib/helpers.service.mjs +1 -1
  13. package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasImage.mjs +1 -1
  14. package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasRenderer.mjs +1 -1
  15. package/esm2022/lib/matterport-extensions/nest-thermostat/NestThermostat.mjs +1 -1
  16. package/esm2022/lib/matterport-extensions/nest-thermostat/PlaneRenderer.mjs +1 -1
  17. package/esm2022/lib/matterport-extensions/scene-component/SceneComponent.mjs +1 -1
  18. package/esm2022/lib/matterport-extensions/security-camera/SecurityCamera.mjs +22 -22
  19. package/esm2022/lib/matterport-extensions/tv-player/TvPlayer.mjs +1 -1
  20. package/esm2022/lib/matterport-extensions/view-frustum-mesh/ViewFrustumMesh.mjs +22 -22
  21. package/esm2022/lib/mattertagData.mjs +1 -1
  22. package/esm2022/lib/ngx-smarterplan-core.module.mjs +9 -4
  23. package/esm2022/lib/ngx-smarterplan-core.service.mjs +1 -1
  24. package/esm2022/lib/pipes/duration-to-string.pipe.mjs +1 -1
  25. package/esm2022/lib/pipes/format-date-number-to-digits.pipe.mjs +1 -1
  26. package/esm2022/lib/pipes/hashtag-from-id.pipe.mjs +1 -1
  27. package/esm2022/lib/pipes/safe-url.pipe.mjs +1 -1
  28. package/esm2022/lib/pipes/time-date-to-local-string.pipe.mjs +1 -1
  29. package/esm2022/lib/pipes/username-from-id.pipe.mjs +1 -1
  30. package/esm2022/lib/services/amplify-cache.service.mjs +1 -1
  31. package/esm2022/lib/services/base-tab.service.mjs +1 -1
  32. package/esm2022/lib/services/baseVisibility.service.mjs +1 -1
  33. package/esm2022/lib/services/content.service.mjs +1 -1
  34. package/esm2022/lib/services/filter.service.mjs +1 -1
  35. package/esm2022/lib/services/intervention.service.mjs +1 -1
  36. package/esm2022/lib/services/locale.service.mjs +1 -1
  37. package/esm2022/lib/services/matterport-import.service.mjs +1 -1
  38. package/esm2022/lib/services/matterport-measurement.service.mjs +1 -1
  39. package/esm2022/lib/services/matterport-navigation.service.mjs +1 -1
  40. package/esm2022/lib/services/matterport-pointer.service.mjs +6 -6
  41. package/esm2022/lib/services/matterport-tag-copy.service.mjs +1 -1
  42. package/esm2022/lib/services/matterport-tag.service.mjs +12 -7
  43. package/esm2022/lib/services/matterport.service.mjs +17 -17
  44. package/esm2022/lib/services/models/affectation.service.mjs +1 -1
  45. package/esm2022/lib/services/models/base-object.service.mjs +1 -1
  46. package/esm2022/lib/services/models/capture.service.mjs +1 -1
  47. package/esm2022/lib/services/models/comment.service.mjs +1 -1
  48. package/esm2022/lib/services/models/domain.service.mjs +1 -1
  49. package/esm2022/lib/services/models/equipment.service.mjs +1 -1
  50. package/esm2022/lib/services/models/event.service.mjs +1 -1
  51. package/esm2022/lib/services/models/feature.service.mjs +1 -1
  52. package/esm2022/lib/services/models/hashtag.service.mjs +1 -1
  53. package/esm2022/lib/services/models/layer.service.mjs +1 -1
  54. package/esm2022/lib/services/models/measurement.service.mjs +1 -1
  55. package/esm2022/lib/services/models/mission.service.mjs +1 -1
  56. package/esm2022/lib/services/models/navigation.service.mjs +1 -1
  57. package/esm2022/lib/services/models/node.service.mjs +1 -1
  58. package/esm2022/lib/services/models/object3D.service.mjs +1 -1
  59. package/esm2022/lib/services/models/operation.service.mjs +1 -1
  60. package/esm2022/lib/services/models/organisation.service.mjs +1 -1
  61. package/esm2022/lib/services/models/plan.service.mjs +1 -1
  62. package/esm2022/lib/services/models/poi.service.mjs +27 -27
  63. package/esm2022/lib/services/models/profile.service.mjs +1 -1
  64. package/esm2022/lib/services/models/property.service.mjs +1 -1
  65. package/esm2022/lib/services/models/space.service.mjs +1 -1
  66. package/esm2022/lib/services/models/template.service.mjs +1 -1
  67. package/esm2022/lib/services/models/ticket.service.mjs +1 -1
  68. package/esm2022/lib/services/models/visit.service.mjs +1 -1
  69. package/esm2022/lib/services/models/zone.service.mjs +1 -1
  70. package/esm2022/lib/services/navigator.service.mjs +1 -1
  71. package/esm2022/lib/services/obj-to-glb.mjs +649 -0
  72. package/esm2022/lib/services/s3.service.mjs +43 -3
  73. package/esm2022/lib/services/search.service.mjs +1 -1
  74. package/esm2022/lib/services/support.service.mjs +1 -1
  75. package/esm2022/lib/services/sweep-locator.service.mjs +1 -1
  76. package/esm2022/lib/services/tag.service.mjs +16 -16
  77. package/esm2022/lib/services/threejs-import.service.mjs +6 -4
  78. package/esm2022/lib/services/threejs.service.mjs +867 -95
  79. package/esm2022/lib/services/user.service.mjs +1 -1
  80. package/esm2022/lib/services/utils/matterport-transform.util.mjs +1 -1
  81. package/esm2022/lib/services/validators.service.mjs +1 -1
  82. package/esm2022/lib/services/viewer.service.mjs +189 -7
  83. package/esm2022/lib/services/zone-drawer.service.mjs +1 -1
  84. package/esm2022/lib/services/zoneChange.service.mjs +1 -1
  85. package/esm2022/lib/tokens/matterport-sdk-key.token.mjs +1 -1
  86. package/esm2022/lib/validators/email.directive.mjs +1 -1
  87. package/esm2022/lib/validators/no-empty.directive.mjs +1 -1
  88. package/esm2022/lib/validators/number.directive.mjs +1 -1
  89. package/esm2022/lib/validators/text.directive.mjs +1 -1
  90. package/esm2022/public-api.mjs +3 -1
  91. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +2239 -233
  92. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  93. package/lib/components/splat-viewer/splat-viewer.component.d.ts +98 -0
  94. package/lib/ngx-smarterplan-core.module.d.ts +7 -6
  95. package/lib/services/matterport-tag.service.d.ts +5 -5
  96. package/lib/services/obj-to-glb.d.ts +66 -0
  97. package/lib/services/s3.service.d.ts +7 -0
  98. package/lib/services/threejs.service.d.ts +336 -16
  99. package/lib/services/viewer.service.d.ts +110 -8
  100. package/package.json +1 -1
  101. package/public-api.d.ts +2 -0
  102. package/src/assets/viewers/splat/chunk-BYLI4YBI.js +17037 -0
  103. package/src/assets/viewers/splat/chunk-LDV6YPMG.js +1 -0
  104. package/src/assets/viewers/splat/chunk-WZ5Z4TU3.js +105719 -0
  105. package/src/assets/viewers/splat/convert-4DRLH77X.js +1 -0
  106. package/src/assets/viewers/splat/convert.html +11 -0
  107. package/src/assets/viewers/splat/converter-SLBB5MHG.js +1 -0
  108. package/src/assets/viewers/splat/index.html +90 -0
  109. package/src/assets/viewers/splat/spz-DEYRea_v-QE6YSGIB.js +5292 -0
  110. package/src/assets/viewers/splat/viewer-W4X3FWQJ.js +2704 -0
  111. package/src/assets/viewers/splat/viewer.css +1096 -0
  112. package/src/assets/viewers/splat/webp.wasm +0 -0
  113. package/src/assets/viewers/splat/worker.mjs +1383 -0
  114. package/src/assets/vs-app.json +67 -67
@@ -0,0 +1,98 @@
1
+ import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
2
+ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3
+ import { TranslateService } from '@ngx-translate/core';
4
+ import { ThreeJsModelUp } from '../../helpers.service';
5
+ import { ViewerService } from '../../services/viewer.service';
6
+ import * as i0 from "@angular/core";
7
+ /** How the splat viewer is moved through: around the model, or inside it. */
8
+ export type SplatViewerMode = 'orbit' | 'walk';
9
+ /**
10
+ * Gaussian splats, drawn by SuperSplat's viewer (PlayCanvas) in an iframe, as Matterport's showcase
11
+ * is: the page built from projects/splat-viewer, which each app serves from assets/viewers/splat.
12
+ *
13
+ * The visit's Three.js scene stays underneath, unseen, holding the tags, their calibration and the
14
+ * measurement, as it does for a model it draws itself; this hands the viewer what the scene holds,
15
+ * and turns what is clicked in it into what a click in the scene does - through ViewerService, so
16
+ * that whatever drives the scene (the add buttons, the calibration panel, the measuring tool, the
17
+ * tag lists) drives this as well. Tags clicked come out of ViewerService.threeJsTagClicked$, as
18
+ * clicks in the scene do.
19
+ *
20
+ * What it says of loading is for the app's own loading overlay; see the outputs.
21
+ */
22
+ export declare class SplatViewerComponent implements OnInit, OnChanges, OnDestroy {
23
+ private viewerService;
24
+ private host;
25
+ private sanitizer;
26
+ private translate;
27
+ /** The model: the S3 key - or assets/ path - of a splat file, or of a Streamed SOG's lod-meta.json. */
28
+ modelKey: string | null;
29
+ /** Which of the model's axes is up, from its capture's placement; null for the viewer's own idea. */
30
+ up: ThreeJsModelUp | null;
31
+ /** How far loading has got, from 0 to 1, or null when the size is not known. 0 when it starts. */
32
+ loadProgress: EventEmitter<number>;
33
+ loaded: EventEmitter<void>;
34
+ loadFailed: EventEmitter<string>;
35
+ /** Said whenever the mode changes, the viewer's own buttons included. */
36
+ modeChange: EventEmitter<SplatViewerMode>;
37
+ frame: ElementRef<HTMLIFrameElement>;
38
+ /**
39
+ * The viewer's page, made once, in ngOnInit: a new object, even for the same address, would make
40
+ * Angular set the iframe's src again, which loads the viewer afresh with nothing in it.
41
+ */
42
+ page: SafeResourceUrl;
43
+ /** Whether the page has said it is ready; it says so again each time it starts over. */
44
+ private ready;
45
+ /** The model handed to the page, so the same one is not downloaded twice. */
46
+ private loadedKey;
47
+ /** Set by cancelLoad: the page, starting over empty, waits to be asked again (reload). */
48
+ private cancelled;
49
+ /** Whether the page was last asked to take a click for a calibration. */
50
+ private pickingForCalibration;
51
+ /** The calibration under way, as ViewerService last said. */
52
+ private alignment;
53
+ /** Each segment's length of the measurement on the model, as ViewerService last said. */
54
+ private measureDistances;
55
+ /** The last lod-meta.json handed to the page, as a link of this page's own. */
56
+ private streamedMeta;
57
+ /** Pictures asked of the page, by the number they were asked with, until it answers. */
58
+ private snapshots;
59
+ private snapshotCount;
60
+ private destroyed$;
61
+ constructor(viewerService: ViewerService, host: ElementRef<HTMLElement>, sanitizer: DomSanitizer, translate: TranslateService);
62
+ ngOnInit(): void;
63
+ ngOnChanges(changes: SimpleChanges): void;
64
+ ngOnDestroy(): void;
65
+ /** Stops the model loading; nothing is loaded again until reload(). */
66
+ cancelLoad(): void;
67
+ /** Loads the model again, after cancelLoad. */
68
+ reload(): void;
69
+ setMode(mode: SplatViewerMode): void;
70
+ /**
71
+ * The scene as it is on screen, with the measurement drawn on it and no tags, as a JPEG data URL;
72
+ * null when there is no scene to take, or the page does not answer within ten seconds.
73
+ */
74
+ snapshot(): Promise<string | null>;
75
+ /** What the page says: that it is ready, how loading goes, what was clicked in it. */
76
+ onMessage(event: MessageEvent): void;
77
+ private load;
78
+ /**
79
+ * The lod-meta.json of a Streamed SOG, with its pieces named so that the page asks for each of
80
+ * them when it needs it ('sign').
81
+ *
82
+ * The pieces sit beside lod-meta.json in S3 and are named relative to it, which a signed link -
83
+ * its signature in the query - does not survive. And they are fetched while the visit lasts, as the
84
+ * camera reaches them, long after any link signed up front has run out.
85
+ */
86
+ private streamedEntry;
87
+ private postTags;
88
+ /**
89
+ * The calibration under way, for the page to draw - the pins dropped, the tag being matched - and,
90
+ * while the place of a tag is asked for, to take the click on the model that says where ('picked').
91
+ */
92
+ private postCalibration;
93
+ /** The measurement for the page to draw - its points, each segment's length - or nothing. */
94
+ private postMeasurement;
95
+ private post;
96
+ static ɵfac: i0.ɵɵFactoryDeclaration<SplatViewerComponent, never>;
97
+ static ɵcmp: i0.ɵɵComponentDeclaration<SplatViewerComponent, "lib-splat-viewer", never, { "modelKey": { "alias": "modelKey"; "required": false; }; "up": { "alias": "up"; "required": false; }; }, { "loadProgress": "loadProgress"; "loaded": "loaded"; "loadFailed": "loadFailed"; "modeChange": "modeChange"; }, never, never, false, never>;
98
+ }
@@ -15,14 +15,15 @@ import * as i11 from "./components/menu-bar/navigation-bar/navigation-bar.compon
15
15
  import * as i12 from "./components/loader/loader.component";
16
16
  import * as i13 from "./components/support-modal/support-modal.component";
17
17
  import * as i14 from "./pipes/format-date-number-to-digits.pipe";
18
- import * as i15 from "@angular/forms";
19
- import * as i16 from "@angular/common";
20
- import * as i17 from "@angular/router";
21
- import * as i18 from "@ng-bootstrap/ng-bootstrap";
22
- import * as i19 from "@ngx-translate/core";
18
+ import * as i15 from "./components/splat-viewer/splat-viewer.component";
19
+ import * as i16 from "@angular/forms";
20
+ import * as i17 from "@angular/common";
21
+ import * as i18 from "@angular/router";
22
+ import * as i19 from "@ng-bootstrap/ng-bootstrap";
23
+ import * as i20 from "@ngx-translate/core";
23
24
  export declare class NgxSmarterplanCoreModule {
24
25
  static forRoot(config: Config): ModuleWithProviders<NgxSmarterplanCoreModule>;
25
26
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxSmarterplanCoreModule, never>;
26
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSmarterplanCoreModule, [typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i7.UsernameFromIdPipe, typeof i8.ModalSwitchVisitComponent, typeof i9.MenuBarComponent, typeof i10.AvatarComponent, typeof i11.NavigationBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i14.FormatDateNumberToDigitsPipe], [typeof i15.FormsModule, typeof i15.ReactiveFormsModule, typeof i16.CommonModule, typeof i17.RouterModule, typeof i18.NgbModule, typeof i19.TranslateModule], [typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i7.UsernameFromIdPipe, typeof i9.MenuBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i10.AvatarComponent]>;
27
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSmarterplanCoreModule, [typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i7.UsernameFromIdPipe, typeof i8.ModalSwitchVisitComponent, typeof i9.MenuBarComponent, typeof i10.AvatarComponent, typeof i11.NavigationBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i14.FormatDateNumberToDigitsPipe, typeof i15.SplatViewerComponent], [typeof i16.FormsModule, typeof i16.ReactiveFormsModule, typeof i17.CommonModule, typeof i18.RouterModule, typeof i19.NgbModule, typeof i20.TranslateModule], [typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i7.UsernameFromIdPipe, typeof i9.MenuBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i10.AvatarComponent, typeof i15.SplatViewerComponent]>;
27
28
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxSmarterplanCoreModule>;
28
29
  }
@@ -121,11 +121,11 @@ export declare class MatterportTagService {
121
121
  * floor and room context. Must be called after each sweep, floor or mode change.
122
122
  *
123
123
  * Rules:
124
- * - DOLLHOUSE / FLOORPLAN → all tags hidden (opacity 0).
125
- * - INSIDE → only tags whose sweep belongs to the current floor are shown;
126
- * proximity-based opacity is applied via computeTagOpacity().
127
- * Tags on other floors are hidden (opacity 0).
128
- * - TRANSITIONING → no change (skip update to avoid flickering).
124
+ * - A tag shows when its sweep is on the floor being displayed, in every mode. Tags on
125
+ * other floors are hidden (opacity 0) and cannot be opened.
126
+ * - While all floors are displayed - the usual state of DOLLHOUSE and FLOORPLAN - every
127
+ * tag shows.
128
+ * - A tag with no sweep belongs to no floor and always shows.
129
129
  *
130
130
  * @param sdk Matterport SDK instance.
131
131
  * @param poseCamera Current camera pose.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Converts an .obj model, with its .mtl and textures, into the .glb the Three.js viewer loads - in
3
+ * the browser, as the model is added, with nothing to install.
4
+ *
5
+ * It does what obj2gltf did in converte-modelo.sh, and the reason is the same. An .obj lists every
6
+ * corner of every triangle; loaded as it is, a captured model's 2.6 million distinct vertices become
7
+ * 12.6 million, one per corner. Here each position and texture coordinate pair becomes one vertex,
8
+ * shared by every triangle that uses it, so what reaches the graphics card is the 2.6 million.
9
+ *
10
+ * Textures go in as they are, their bytes untouched: a JPEG re-encoded would lose quality and gain
11
+ * nothing. Normals are only written when the .obj has them; without, the viewer works them out as
12
+ * it loads the model. The axes are left as the .obj has them - the viewer finds which way is up.
13
+ *
14
+ * The .obj is read as a stream, so a file of hundreds of megabytes is never held whole.
15
+ */
16
+ export interface ConvertedModel {
17
+ /** The model as a .glb. */
18
+ file: File;
19
+ vertices: number;
20
+ triangles: number;
21
+ materials: number;
22
+ /** Textures the .mtl names that were not among the files given; those materials go untextured. */
23
+ missingTextures: string[];
24
+ }
25
+ export interface ObjConversionOptions {
26
+ /** Called as the conversion goes, with the share done so far. */
27
+ onProgress?: (fraction: number) => void;
28
+ /** Stops the conversion; it then rejects with an AbortError. */
29
+ signal?: AbortSignal;
30
+ }
31
+ /** Whether a set of files holds an .obj model to convert. */
32
+ export declare function hasObjModel(files: {
33
+ name: string;
34
+ }[]): boolean;
35
+ /**
36
+ * Converts the .obj among `files` into a .glb, using the .mtl and the images found with it.
37
+ */
38
+ export declare function convertObjToGlb(files: File[], options?: ObjConversionOptions): Promise<ConvertedModel>;
39
+ /** A growable typed array: an .obj does not say up front how many of anything it holds. */
40
+ declare class Growable<T extends Float64Array | Float32Array | Int32Array> {
41
+ data: T;
42
+ length: number;
43
+ constructor(data: T);
44
+ push(value: number): void;
45
+ view(): T;
46
+ }
47
+ /** The triangles that use one material, as corners: position, texture and normal index each. */
48
+ interface FaceGroup {
49
+ material: string | null;
50
+ corners: Growable<Int32Array>;
51
+ }
52
+ export interface ParsedObj {
53
+ positions: Float64Array;
54
+ uvs: Float64Array;
55
+ normals: Float64Array;
56
+ groups: FaceGroup[];
57
+ materialLibraries: string[];
58
+ triangleCount: number;
59
+ }
60
+ /**
61
+ * Reads an .obj from a stream of its bytes: positions, texture coordinates, normals, and triangles
62
+ * grouped by material. Polygons are split into triangles; negative indices, counting back from the
63
+ * end, are resolved; anything else (objects, groups, smoothing) is skipped.
64
+ */
65
+ export declare function readObj(stream: ReadableStream<Uint8Array>, size: number, options?: ObjConversionOptions): Promise<ParsedObj>;
66
+ export {};
@@ -7,6 +7,13 @@ export declare const uploadFileToS3: (path: string, file: File, objectId: string
7
7
  * uploadFileToS3 above swallows progress, which is fine for a photo and unusable for a 3D model:
8
8
  * these run to hundreds of megabytes, and an upload with no feedback is indistinguishable from a
9
9
  * frozen page. Returns the stored key, which is what gets saved on the record.
10
+ *
11
+ * A large file is sent in parts, each signed when it is sent. Left to itself, Storage.put signs
12
+ * them all with whatever credentials Amplify last handed the S3 provider, for any call - credentials
13
+ * that last an hour at most, and an upload of a few gigabytes takes longer: every part after they
14
+ * expire is refused with "The provided token has expired", and fetching new ones does not help, the
15
+ * upload never asks for them. Passing no credentials at all makes it ask Amplify for them part by
16
+ * part, and Amplify renews them as they age. Should they run out anyway, it starts once more.
10
17
  */
11
18
  export declare const uploadFileToS3WithProgress: (path: string, file: File, onProgress?: (fraction: number) => void) => Promise<string>;
12
19
  export declare const getSignedImageUrlForEquipment: (equip: Equipment) => Promise<string | null>;