@smarterplan/ngx-smarterplan-core 1.4.29 → 1.4.30
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/README.md +24 -24
- package/esm2022/lib/components/checkbox-slider/checkbox-slider.component.mjs +3 -3
- package/esm2022/lib/components/csv-export/csv-export.component.mjs +3 -3
- package/esm2022/lib/components/inventory-runs/inventory-files.component.mjs +89 -89
- package/esm2022/lib/components/inventory-runs/inventory-launch.component.mjs +3 -3
- package/esm2022/lib/components/inventory-runs/inventory-runs.component.mjs +3 -3
- package/esm2022/lib/components/loader/loader.component.mjs +3 -3
- package/esm2022/lib/components/menu-bar/avatar/avatar.component.mjs +1 -1
- package/esm2022/lib/components/menu-bar/menu-bar.component.mjs +3 -3
- package/esm2022/lib/components/menu-bar/navigation-bar/navigation-bar.component.mjs +3 -3
- package/esm2022/lib/components/modal-switch-visit/modal-switch-visit.component.mjs +3 -3
- package/esm2022/lib/components/search-bar/search-bar.component.mjs +3 -3
- package/esm2022/lib/components/splat-viewer/splat-viewer.component.mjs +1 -1
- package/esm2022/lib/components/support-modal/support-modal.component.mjs +3 -3
- package/esm2022/lib/config.mjs +1 -1
- package/esm2022/lib/helpers.service.mjs +1 -1
- package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasImage.mjs +1 -1
- package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasRenderer.mjs +1 -1
- package/esm2022/lib/matterport-extensions/nest-thermostat/NestThermostat.mjs +1 -1
- package/esm2022/lib/matterport-extensions/nest-thermostat/PlaneRenderer.mjs +1 -1
- package/esm2022/lib/matterport-extensions/scene-component/SceneComponent.mjs +1 -1
- package/esm2022/lib/matterport-extensions/security-camera/SecurityCamera.mjs +22 -22
- package/esm2022/lib/matterport-extensions/tv-player/TvPlayer.mjs +1 -1
- package/esm2022/lib/matterport-extensions/view-frustum-mesh/ViewFrustumMesh.mjs +22 -22
- package/esm2022/lib/mattertagData.mjs +1 -1
- package/esm2022/lib/ngx-smarterplan-core.module.mjs +1 -1
- package/esm2022/lib/ngx-smarterplan-core.service.mjs +1 -1
- package/esm2022/lib/pipes/duration-to-string.pipe.mjs +1 -1
- package/esm2022/lib/pipes/format-date-number-to-digits.pipe.mjs +1 -1
- package/esm2022/lib/pipes/hashtag-from-id.pipe.mjs +1 -1
- package/esm2022/lib/pipes/safe-url.pipe.mjs +1 -1
- package/esm2022/lib/pipes/time-date-to-local-string.pipe.mjs +1 -1
- package/esm2022/lib/pipes/username-from-id.pipe.mjs +1 -1
- package/esm2022/lib/services/amplify-cache.service.mjs +1 -1
- package/esm2022/lib/services/base-tab.service.mjs +1 -1
- package/esm2022/lib/services/baseVisibility.service.mjs +1 -1
- package/esm2022/lib/services/content.service.mjs +1 -1
- package/esm2022/lib/services/filter.service.mjs +1 -1
- package/esm2022/lib/services/intervention.service.mjs +1 -1
- package/esm2022/lib/services/locale.service.mjs +1 -1
- package/esm2022/lib/services/matterport-import.service.mjs +1 -1
- package/esm2022/lib/services/matterport-measurement.service.mjs +1 -1
- package/esm2022/lib/services/matterport-navigation.service.mjs +1 -1
- package/esm2022/lib/services/matterport-object3d.service.mjs +1 -1
- package/esm2022/lib/services/matterport-pointer.service.mjs +6 -6
- package/esm2022/lib/services/matterport-tag-copy.service.mjs +930 -138
- package/esm2022/lib/services/matterport-tag.service.mjs +1 -1
- package/esm2022/lib/services/matterport.service.mjs +17 -17
- package/esm2022/lib/services/models/affectation.service.mjs +1 -1
- package/esm2022/lib/services/models/base-object.service.mjs +1 -1
- package/esm2022/lib/services/models/capture.service.mjs +1 -1
- package/esm2022/lib/services/models/comment.service.mjs +1 -1
- package/esm2022/lib/services/models/domain.service.mjs +1 -1
- package/esm2022/lib/services/models/equipment.service.mjs +1 -1
- package/esm2022/lib/services/models/event.service.mjs +1 -1
- package/esm2022/lib/services/models/feature.service.mjs +1 -1
- package/esm2022/lib/services/models/hashtag.service.mjs +1 -1
- package/esm2022/lib/services/models/inventory-storage.mjs +1 -1
- package/esm2022/lib/services/models/inventory.service.mjs +3 -3
- package/esm2022/lib/services/models/layer.service.mjs +1 -1
- package/esm2022/lib/services/models/measurement.service.mjs +1 -1
- package/esm2022/lib/services/models/mission.service.mjs +1 -1
- package/esm2022/lib/services/models/navigation.service.mjs +1 -1
- package/esm2022/lib/services/models/node.service.mjs +1 -1
- package/esm2022/lib/services/models/object3D.service.mjs +1 -1
- package/esm2022/lib/services/models/operation.service.mjs +1 -1
- package/esm2022/lib/services/models/organisation.service.mjs +1 -1
- package/esm2022/lib/services/models/plan.service.mjs +1 -1
- package/esm2022/lib/services/models/poi.service.mjs +27 -27
- package/esm2022/lib/services/models/profile.service.mjs +1 -1
- package/esm2022/lib/services/models/property.service.mjs +1 -1
- package/esm2022/lib/services/models/space.service.mjs +1 -1
- package/esm2022/lib/services/models/template.service.mjs +1 -1
- package/esm2022/lib/services/models/ticket.service.mjs +1 -1
- package/esm2022/lib/services/models/visit.service.mjs +1 -1
- package/esm2022/lib/services/models/zone.service.mjs +1 -1
- package/esm2022/lib/services/navigator.service.mjs +1 -1
- package/esm2022/lib/services/obj-to-glb.mjs +1 -1
- package/esm2022/lib/services/retry-when-throttled.mjs +1 -1
- package/esm2022/lib/services/s3.service.mjs +22 -5
- package/esm2022/lib/services/search.service.mjs +1 -1
- package/esm2022/lib/services/support.service.mjs +1 -1
- package/esm2022/lib/services/sweep-locator.service.mjs +1 -1
- package/esm2022/lib/services/tag.service.mjs +16 -16
- package/esm2022/lib/services/threejs-import.service.mjs +1 -1
- package/esm2022/lib/services/threejs.service.mjs +1 -1
- package/esm2022/lib/services/user.service.mjs +1 -1
- package/esm2022/lib/services/utils/matterport-framing.util.mjs +1 -1
- package/esm2022/lib/services/utils/matterport-transform.util.mjs +26 -1
- package/esm2022/lib/services/utils/object3d-model.util.mjs +155 -0
- package/esm2022/lib/services/utils/tag-archive.util.mjs +89 -0
- package/esm2022/lib/services/validators.service.mjs +1 -1
- package/esm2022/lib/services/viewer.service.mjs +1 -1
- package/esm2022/lib/services/zone-drawer.service.mjs +1 -1
- package/esm2022/lib/services/zoneChange.service.mjs +1 -1
- package/esm2022/lib/tokens/matterport-sdk-key.token.mjs +1 -1
- package/esm2022/lib/tokens/object3d-model-upload.token.mjs +14 -0
- package/esm2022/lib/types.service.mjs +1 -1
- package/esm2022/lib/validators/email.directive.mjs +1 -1
- package/esm2022/lib/validators/no-empty.directive.mjs +1 -1
- package/esm2022/lib/validators/number.directive.mjs +1 -1
- package/esm2022/lib/validators/text.directive.mjs +1 -1
- package/esm2022/public-api.mjs +4 -1
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +1440 -354
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/services/matterport-tag-copy.service.d.ts +233 -13
- package/lib/services/s3.service.d.ts +15 -0
- package/lib/services/utils/matterport-transform.util.d.ts +14 -0
- package/lib/services/utils/object3d-model.util.d.ts +58 -0
- package/lib/services/utils/tag-archive.util.d.ts +97 -0
- package/lib/tokens/object3d-model-upload.token.d.ts +10 -0
- package/package.json +2 -1
- package/public-api.d.ts +3 -0
- package/src/assets/viewers/splat/convert.html +11 -11
- package/src/assets/viewers/splat/index.html +90 -90
- package/src/assets/viewers/splat/webp.wasm +0 -0
- package/src/assets/vs-app.json +67 -67
|
@@ -16,10 +16,11 @@ import { DomainService } from './models/domain.service';
|
|
|
16
16
|
import { ZoneService } from './models/zone.service';
|
|
17
17
|
import { BaseUserService } from './user.service';
|
|
18
18
|
import { Vec3 } from './utils/matterport-transform.util';
|
|
19
|
+
import { TagArchive, TagArchiveOrigin, TagArchiveVisit } from './utils/tag-archive.util';
|
|
19
20
|
import * as i0 from "@angular/core";
|
|
20
21
|
/** Progress snapshot emitted during copyTagsFromVisit(), so the UI can show a live status. */
|
|
21
22
|
export interface CopyProgress {
|
|
22
|
-
phase: 'collecting' | 'tickets' | 'equipments' | 'pois' | 'objects3d' | 'features' | 'measurements' | 'recalibrating' | 'done';
|
|
23
|
+
phase: 'collecting' | 'tickets' | 'equipments' | 'pois' | 'objects3d' | 'features' | 'measurements' | 'recalibrating' | 'files' | 'done';
|
|
23
24
|
processedInPhase: number;
|
|
24
25
|
totalInPhase: number;
|
|
25
26
|
processedOverall: number;
|
|
@@ -35,9 +36,32 @@ export interface CopyProgress {
|
|
|
35
36
|
* item notice (appended once, permanent). */
|
|
36
37
|
export interface CopyLogEntry {
|
|
37
38
|
id: string;
|
|
38
|
-
type: 'step' | 'error' | 'healed';
|
|
39
|
+
type: 'step' | 'error' | 'healed' | 'info';
|
|
39
40
|
text: string;
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* How an import places the archived tags in the target visit.
|
|
44
|
+
* - SAME_MODEL: the target visit is the very Matterport model the tags were exported from
|
|
45
|
+
* (typically the same location on another environment): positions and sweeps are kept.
|
|
46
|
+
* - LANDMARKS: another model, aligned with two pairs of landmarks, exactly like a copy.
|
|
47
|
+
*/
|
|
48
|
+
export type TagImportCalibration = {
|
|
49
|
+
mode: 'SAME_MODEL';
|
|
50
|
+
} | {
|
|
51
|
+
mode: 'LANDMARKS';
|
|
52
|
+
landmarkSourceA: Vec3;
|
|
53
|
+
landmarkTargetA: Vec3;
|
|
54
|
+
landmarkSourceB: Vec3;
|
|
55
|
+
landmarkTargetB: Vec3;
|
|
56
|
+
};
|
|
57
|
+
/** A 3D model an import cannot restore by itself, see getMissingObject3DModels(). */
|
|
58
|
+
export interface MissingObject3DModel {
|
|
59
|
+
/** reference of the model in the archive: pass it as key of `replacementModels` */
|
|
60
|
+
key: string;
|
|
61
|
+
fileName: string;
|
|
62
|
+
/** names of the archived 3D objects using it */
|
|
63
|
+
objectNames: string[];
|
|
64
|
+
}
|
|
41
65
|
/** A tag listed for recalibration, with what the UI needs to identify it. */
|
|
42
66
|
export type RecalibrationTag = POI & {
|
|
43
67
|
elementName: string;
|
|
@@ -92,6 +116,7 @@ export declare class MatterportTagCopyService {
|
|
|
92
116
|
private domainService;
|
|
93
117
|
private translate;
|
|
94
118
|
private zoneService;
|
|
119
|
+
private readonly modelUploadEnabled;
|
|
95
120
|
copyProgress$: BehaviorSubject<CopyProgress | null>;
|
|
96
121
|
copyLog$: BehaviorSubject<CopyLogEntry[]>;
|
|
97
122
|
private spModule;
|
|
@@ -132,8 +157,47 @@ export declare class MatterportTagCopyService {
|
|
|
132
157
|
private targetDomainIdsByTypeAndName;
|
|
133
158
|
/** Target space id of the run in progress — used to re-home copied tag icons. */
|
|
134
159
|
private targetSpaceId;
|
|
135
|
-
|
|
160
|
+
/** archive being imported; null for a copy between two locations */
|
|
161
|
+
private archive;
|
|
162
|
+
/** an imported comment is credited to the operator running the import (their mission
|
|
163
|
+
* on the target space): the original author's mission belongs to another environment */
|
|
164
|
+
private importOwnerMissionId;
|
|
165
|
+
/** organisation in which the categories missing from the target are created on import */
|
|
166
|
+
private importDomainOrganisationId;
|
|
167
|
+
/** same Matterport model on both sides: a source sweep id is kept when the target has it */
|
|
168
|
+
private keepSweepIds;
|
|
169
|
+
/** library model file -> whether this application ships it (import only) */
|
|
170
|
+
private libraryModelAvailability;
|
|
171
|
+
/** model reference (see object3DModelKeyOf()) -> .glb chosen by the operator to replace it */
|
|
172
|
+
private replacementModels;
|
|
173
|
+
/** model reference -> S3 key its replacement was uploaded to: a model shared by several
|
|
174
|
+
* objects is uploaded once */
|
|
175
|
+
private uploadedReplacementKeys;
|
|
176
|
+
constructor(navigationService: NavigationService, userService: BaseUserService, poiService: PoiService, ticketService: TicketsService, equipmentService: EquipmentService, object3DService: Object3DService, featureService: FeatureService, measurementService: MeasurementService, commentService: CommentService, hashtagService: HashtagService, missionService: MissionService, operationService: OperationService, domainService: DomainService, translate: TranslateService, zoneService: ZoneService, modelUploadEnabled: boolean);
|
|
177
|
+
/** Whether this application may write 3D model files (see OBJECT3D_MODEL_UPLOAD_ENABLED). */
|
|
178
|
+
get object3DModelUploadEnabled(): boolean;
|
|
136
179
|
copyTagsFromVisit(sourceSpaceId: string, targetSpaceId: string, landmarkSourceA: Vec3, landmarkTargetA: Vec3, landmarkSourceB: Vec3, landmarkTargetB: Vec3): Promise<boolean>;
|
|
180
|
+
/**
|
|
181
|
+
* Imports into a location the tags of an archive produced by exportTagsToArchive(),
|
|
182
|
+
* possibly on another environment (dev, demo, staging, production).
|
|
183
|
+
*
|
|
184
|
+
* Runs the very same phases as copyTagsFromVisit(), the source being the archive instead
|
|
185
|
+
* of a location: same deduplication (re-importing the same archive creates nothing twice),
|
|
186
|
+
* same healing, same keyword handling. What differs is how references are re-pointed,
|
|
187
|
+
* since the archive's ids designate nothing on this environment:
|
|
188
|
+
* - files are re-uploaded from the archive instead of being copied inside the bucket;
|
|
189
|
+
* - comments are credited to the operator running the import (see importOwnerMissionId);
|
|
190
|
+
* - categories are matched by name, and created in the operator's organisation when the
|
|
191
|
+
* target has none of that name (see resolveImportedDomainID()).
|
|
192
|
+
*/
|
|
193
|
+
importTagsFromArchive(archive: TagArchive, targetSpaceId: string, calibration: TagImportCalibration, replacementModels?: Record<string, Blob & {
|
|
194
|
+
name?: string;
|
|
195
|
+
}>): Promise<boolean>;
|
|
196
|
+
/**
|
|
197
|
+
* Body shared by a copy and an import: reads the source through `collect`, then creates
|
|
198
|
+
* the records in the target space.
|
|
199
|
+
*/
|
|
200
|
+
private runCopy;
|
|
137
201
|
/**
|
|
138
202
|
* Serialises the current copy log (step lines as last emitted, plus every error and
|
|
139
203
|
* healed-item notice) to a plain-text file and triggers a browser download — wired to a
|
|
@@ -141,6 +205,144 @@ export declare class MatterportTagCopyService {
|
|
|
141
205
|
* of a run rather than only the ~200px scrollable panel showing it.
|
|
142
206
|
*/
|
|
143
207
|
downloadLog(filename?: string): void;
|
|
208
|
+
/**
|
|
209
|
+
* Exports every tag of a location — and everything the tags point at: tickets, equipments
|
|
210
|
+
* with their notes and links, 3D objects, POIs with their media, measurements, keywords,
|
|
211
|
+
* categories — into a ZIP archive downloaded by the browser, together with the S3 files
|
|
212
|
+
* they reference. The archive can then be imported in any location of any environment
|
|
213
|
+
* (see importTagsFromArchive()): it records where it comes from (see TagArchiveOrigin).
|
|
214
|
+
*
|
|
215
|
+
* The location is read exactly as a copy reads its source (collectLiveSnapshot()), so an
|
|
216
|
+
* export carries what a copy would. A file that cannot be downloaded is reported in the
|
|
217
|
+
* log and left out; the import then treats it like a copy treats a missing file.
|
|
218
|
+
*
|
|
219
|
+
* Progress and log go through copyProgress$ / copyLog$ (phases 'collecting', 'files').
|
|
220
|
+
*/
|
|
221
|
+
exportTagsToArchive(spaceId: string, spaceName: string, visits?: TagArchiveVisit[]): Promise<boolean>;
|
|
222
|
+
/**
|
|
223
|
+
* Reads an archive chosen by the user (see exportTagsToArchive()). Throws a TagArchiveError
|
|
224
|
+
* when it is not a tag archive, was made by a newer version, or by the application of
|
|
225
|
+
* another module (MUSEUM vs IMMO): their models differ (Object3D, tickets...), the records
|
|
226
|
+
* could not be created here.
|
|
227
|
+
*/
|
|
228
|
+
readTagArchive(file: Blob): Promise<TagArchive>;
|
|
229
|
+
/** Placeholders of the matterportCopy.importOrigin / exportOrigin translations. */
|
|
230
|
+
describeOrigin(origin: TagArchiveOrigin): Record<string, string>;
|
|
231
|
+
/**
|
|
232
|
+
* Reads a location of the current environment as the source of a copy or an export.
|
|
233
|
+
*
|
|
234
|
+
* Features archived by the operator are skipped (historical rule) — null-safe:
|
|
235
|
+
* FeatureService.isArchived() dereferences currentMission(spaceID).id and threw a
|
|
236
|
+
* TypeError when the operator had no mission on the source space (the common case for an
|
|
237
|
+
* archived v1 space), aborting the whole copy. Features are paginated: a space routinely
|
|
238
|
+
* holds more than the 100 features a single AppSync page returns, and the tail was
|
|
239
|
+
* silently dropped.
|
|
240
|
+
*
|
|
241
|
+
* The attachments of tickets and features are read on demand, through their own
|
|
242
|
+
* paginated query: the `comments` connection embedded in TicketsBySpace / FeaturesBySpace
|
|
243
|
+
* is capped at 100 items and its nextToken was never followed, so rich POIs lost
|
|
244
|
+
* attachments silently. The embedded list is only the fallback when that query fails.
|
|
245
|
+
*/
|
|
246
|
+
private collectLiveSnapshot;
|
|
247
|
+
/** Source of an import: the records of the archive, as the exporting environment read them. */
|
|
248
|
+
private snapshotFromArchive;
|
|
249
|
+
/**
|
|
250
|
+
* READ-ONLY indexing of what the source references and the target already has: keywords,
|
|
251
|
+
* comment authors and categories.
|
|
252
|
+
* - copy: authors are matched by user (resolveCommentOwnerID()), categories by the
|
|
253
|
+
* operator's missions on both spaces (loadDomainIndex());
|
|
254
|
+
* - import: the archive's users belong to another environment, comments are credited to
|
|
255
|
+
* the operator; categories are matched by name (loadImportedDomainIndex()).
|
|
256
|
+
*/
|
|
257
|
+
private loadReferenceIndexes;
|
|
258
|
+
/**
|
|
259
|
+
* READ-ONLY indexing for an import: the archived categories by their (foreign) id, and the
|
|
260
|
+
* categories the operator's mission on the target space can see, by (type, name).
|
|
261
|
+
* Missing categories are created in the mission's organisation, on demand — see
|
|
262
|
+
* resolveImportedDomainID(). When the target categories cannot be read, none is created:
|
|
263
|
+
* doing it blindly could duplicate existing ones.
|
|
264
|
+
*/
|
|
265
|
+
private loadImportedDomainIndex;
|
|
266
|
+
/**
|
|
267
|
+
* Resolves an archived category for the target space: the category of the same type and
|
|
268
|
+
* name the operator can see there, else a new one created in the organisation of their
|
|
269
|
+
* mission on the target space (parents first, so the tree is kept). Dropped when it cannot
|
|
270
|
+
* be created (no mission there, creation refused...).
|
|
271
|
+
*/
|
|
272
|
+
private resolveImportedDomainID;
|
|
273
|
+
/**
|
|
274
|
+
* Import counterpart of an S3 copy: uploads the archived bytes of `sourceKey` under
|
|
275
|
+
* `destKey`. A file the export could not include is a MissingS3FileError, handled exactly
|
|
276
|
+
* like an orphaned reference during a copy.
|
|
277
|
+
*/
|
|
278
|
+
private restoreArchivedFile;
|
|
279
|
+
/** Runs `task` over `items`, a few at a time (keeps the API and S3 from throttling). */
|
|
280
|
+
private forEachInBatches;
|
|
281
|
+
/** Every POI of a snapshot: those on the sweeps and those embedded in the elements. */
|
|
282
|
+
private allSnapshotPois;
|
|
283
|
+
/**
|
|
284
|
+
* Raw S3 keys of every file the copy duplicates (see the copy phases): equipment photos and
|
|
285
|
+
* notes, attachments and media, measurement screenshots, uploaded 3D models, tag icons.
|
|
286
|
+
*/
|
|
287
|
+
private collectArchiveFileKeys;
|
|
288
|
+
/**
|
|
289
|
+
* Categories referenced by the exported records, with their ancestors: an import matches
|
|
290
|
+
* them by name, and recreates the missing ones at the same place of the tree.
|
|
291
|
+
*/
|
|
292
|
+
private collectExportDomains;
|
|
293
|
+
/** Where an export comes from: environment (application origin), location, date, operator. */
|
|
294
|
+
private buildExportOrigin;
|
|
295
|
+
/** File-name-safe version of a label. */
|
|
296
|
+
private toFileName;
|
|
297
|
+
/**
|
|
298
|
+
* Reference of the model of a 3D object, as the archive indexes its files: the raw S3 key
|
|
299
|
+
* of an uploaded model, `assets/3Dobjects/objects/<file>` for a library model, null for a
|
|
300
|
+
* model hosted at an absolute url (nothing to carry over).
|
|
301
|
+
*/
|
|
302
|
+
private object3DModelKeyOf;
|
|
303
|
+
/**
|
|
304
|
+
* 3D models of an archive that an import could not give to their objects: neither in the
|
|
305
|
+
* archive (missing on the source, or not exportable — a library model of another format
|
|
306
|
+
* than .glb) nor shipped by this application. The operator can provide a .glb for each
|
|
307
|
+
* before importing (see importTagsFromArchive(), `replacementModels`); otherwise the
|
|
308
|
+
* object is created without a displayable model and the log says so.
|
|
309
|
+
*/
|
|
310
|
+
getMissingObject3DModels(archive: TagArchive): Promise<MissingObject3DModel[]>;
|
|
311
|
+
/**
|
|
312
|
+
* Model path of a copied / imported 3D object when this application may not write model
|
|
313
|
+
* files (see OBJECT3D_MODEL_UPLOAD_ENABLED):
|
|
314
|
+
* - copy between two locations: the same path, an S3 model included — both objects then
|
|
315
|
+
* share the file, which nothing deletes with an object;
|
|
316
|
+
* - import: a library model is referenced as is (reported when this application does not
|
|
317
|
+
* ship it); an S3 model of the other environment cannot be referenced at all, the object
|
|
318
|
+
* is skipped (Object3DModelUploadDisabledError).
|
|
319
|
+
*/
|
|
320
|
+
private modelPathWithoutUpload;
|
|
321
|
+
/** Replacement model the operator chose for this object's model, if any. */
|
|
322
|
+
private replacementModelOf;
|
|
323
|
+
/** Uploads a replacement model once, whatever the number of objects using it. */
|
|
324
|
+
private uploadReplacementModel;
|
|
325
|
+
/** File names of the library .glb models the snapshot's 3D objects use (see object3d-model.util.ts). */
|
|
326
|
+
private collectLibraryModelFiles;
|
|
327
|
+
/** Url this application serves a library model from. */
|
|
328
|
+
private libraryModelUrl;
|
|
329
|
+
/**
|
|
330
|
+
* Bytes of a library model as this application serves it; null when it does not ship it.
|
|
331
|
+
* A single-page host answers an unknown path with the index page (200, text/html): that is
|
|
332
|
+
* a missing file too.
|
|
333
|
+
*/
|
|
334
|
+
private fetchLibraryModel;
|
|
335
|
+
/** Whether this application ships a library model (checked once per file and per run). */
|
|
336
|
+
private isLibraryModelAvailable;
|
|
337
|
+
/** Asks this application whether it serves a library model (an index page is a no). */
|
|
338
|
+
private isLibraryModelServed;
|
|
339
|
+
/**
|
|
340
|
+
* Import of a 3D object whose model comes from the application's library: when the target
|
|
341
|
+
* application does not ship that model, the copy exported in the archive is uploaded to S3
|
|
342
|
+
* and the object switched to it. Returns the S3 key, or null to keep the library path
|
|
343
|
+
* (model available, or impossible to restore — reported in the log).
|
|
344
|
+
*/
|
|
345
|
+
private restoreMissingLibraryModel;
|
|
144
346
|
/** Adds or updates a step line (identified by stepId) with new text, then republishes the log. */
|
|
145
347
|
private setStepLog;
|
|
146
348
|
/** Appends a new, permanent log line (never overwritten), then republishes the log. */
|
|
@@ -148,6 +350,8 @@ export declare class MatterportTagCopyService {
|
|
|
148
350
|
/** Appends a permanent log line for an item that was repaired rather than newly
|
|
149
351
|
* created — see healEquipmentIdentity() and its ticket/feature equivalents. */
|
|
150
352
|
private appendHealedLog;
|
|
353
|
+
/** Appends a permanent, neutral log line (origin of an import, category created...). */
|
|
354
|
+
private appendInfoLog;
|
|
151
355
|
/** Resets the log for a new run. */
|
|
152
356
|
private resetLog;
|
|
153
357
|
/** Clears every id map carried over from a previous run. The service is a root-level
|
|
@@ -212,14 +416,21 @@ export declare class MatterportTagCopyService {
|
|
|
212
416
|
/** Normalised lookup key for a hashtag name, so "Moyen Âge" and "moyen âge " match. */
|
|
213
417
|
private hashtagKey;
|
|
214
418
|
/**
|
|
215
|
-
* READ-ONLY
|
|
419
|
+
* READ-ONLY: hashtag id -> name of a space's hashtags. Creates nothing.
|
|
216
420
|
*
|
|
217
421
|
* `Feature.hashtags` stores Hashtag *ids*, and a Hashtag is a per-space record, so the
|
|
218
|
-
* ids have to be translated by name. The translation table is built
|
|
219
|
-
* keywords are created later, one at a time, only
|
|
220
|
-
* about to be written (see resolveHashtagIds()).
|
|
422
|
+
* ids have to be translated by name. The translation table is built from this and
|
|
423
|
+
* loadTargetHashtagIndex(); the missing keywords are created later, one at a time, only
|
|
424
|
+
* when a POI that actually uses them is about to be written (see resolveHashtagIds()).
|
|
425
|
+
* A failed read answers an empty map: the keywords are then dropped.
|
|
426
|
+
*/
|
|
427
|
+
private loadHashtagNames;
|
|
428
|
+
/**
|
|
429
|
+
* READ-ONLY indexing of the target space's hashtags, by name. When they cannot be read,
|
|
430
|
+
* the source keywords are dropped too: creating them blindly could duplicate keywords the
|
|
431
|
+
* target already has.
|
|
221
432
|
*/
|
|
222
|
-
private
|
|
433
|
+
private loadTargetHashtagIndex;
|
|
223
434
|
/**
|
|
224
435
|
* Translates one feature's hashtag ids into target-space ids, creating on the fly the
|
|
225
436
|
* keywords the target space does not have yet.
|
|
@@ -238,15 +449,18 @@ export declare class MatterportTagCopyService {
|
|
|
238
449
|
*/
|
|
239
450
|
private resolveHashtagIds;
|
|
240
451
|
/**
|
|
241
|
-
* READ-ONLY
|
|
452
|
+
* READ-ONLY: mission id -> user id of a space's missions.
|
|
242
453
|
*
|
|
243
454
|
* A Mission is scoped to one space (it pairs a userID with a spaceID), so the id a
|
|
244
455
|
* source comment's `ownerID` points at never designates anyone in the target space.
|
|
245
|
-
* This
|
|
246
|
-
* which user a source Mission id belongs to, and which Mission (if
|
|
247
|
-
* user already holds in the target space.
|
|
456
|
+
* This and loadTargetMissionIndex() build the two lookup tables resolveCommentOwnerID()
|
|
457
|
+
* needs to translate it: which user a source Mission id belongs to, and which Mission (if
|
|
458
|
+
* any) that same user already holds in the target space.
|
|
459
|
+
* A failed read answers an empty map: comment authorship is then dropped.
|
|
248
460
|
*/
|
|
249
|
-
private
|
|
461
|
+
private loadMissionUserIds;
|
|
462
|
+
/** READ-ONLY indexing of the target space's missions, by user. */
|
|
463
|
+
private loadTargetMissionIndex;
|
|
250
464
|
/**
|
|
251
465
|
* Translates a source comment's `ownerID` (a per-space Mission id) into the Mission of
|
|
252
466
|
* the SAME user in the target space, so the copy keeps crediting its real author.
|
|
@@ -403,6 +617,12 @@ export declare class MatterportTagCopyService {
|
|
|
403
617
|
private buildNavigationPositionMap;
|
|
404
618
|
/** Applies the rigid transform to a POI coordinate (position + orientation). */
|
|
405
619
|
private getAdjustedCoordinates;
|
|
620
|
+
/**
|
|
621
|
+
* Moves a 3D object of the scene with the rigid transform: its position like a tag's, its
|
|
622
|
+
* orientation turned by the same angle around the vertical axis (applyRigidTransformToEulerXYZ).
|
|
623
|
+
* Its scale does not change: both models are in meters.
|
|
624
|
+
*/
|
|
625
|
+
private getAdjustedObject3DPlacement;
|
|
406
626
|
/**
|
|
407
627
|
* Reads a stored coordinate (JSON string or object, whatever its spacing) as a position.
|
|
408
628
|
* Null for a virtual POI or an unreadable value.
|
|
@@ -49,3 +49,18 @@ export declare const copyFileInS3: (sourceKey: string, destKey: string) => Promi
|
|
|
49
49
|
* IMPORTANT: like copyFileInS3, this must NOT swallow errors.
|
|
50
50
|
*/
|
|
51
51
|
export declare const copyFileInS3ViaDownload: (sourceKey: string, destKey: string) => Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Downloads an S3 object (public level) as a Blob, with its content type.
|
|
54
|
+
* Used by the tag export, which packs the files into an archive so they can be re-uploaded
|
|
55
|
+
* on another environment (another bucket).
|
|
56
|
+
* IMPORTANT: does NOT swallow errors — callers need NoSuchKey to tell a missing file apart.
|
|
57
|
+
*/
|
|
58
|
+
export declare const downloadS3Object: (key: string) => Promise<{
|
|
59
|
+
body: Blob;
|
|
60
|
+
contentType: string | null;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Uploads raw content (Blob or bytes) under an exact S3 key (public level) and returns that key.
|
|
64
|
+
* IMPORTANT: does NOT swallow errors.
|
|
65
|
+
*/
|
|
66
|
+
export declare const uploadS3Object: (key: string, body: Blob | Uint8Array, contentType?: string | null) => Promise<string>;
|
|
@@ -34,3 +34,17 @@ export declare function distance(a: Vec3, b: Vec3): number;
|
|
|
34
34
|
* rotated relative to the source ends up pointing into the wall it is stuck on.
|
|
35
35
|
*/
|
|
36
36
|
export declare function applyRigidTransformToDirection(v: Vec3, t: RigidTransform): Vec3;
|
|
37
|
+
/**
|
|
38
|
+
* Applies the rotation part of the transform to an object's orientation: the Euler angles
|
|
39
|
+
* (radians, three.js "XYZ" order, the one Object3D.rotation is stored and loaded in).
|
|
40
|
+
*
|
|
41
|
+
* A 3D object placed in the scene keeps its full orientation, so adding the angle to the Y
|
|
42
|
+
* component only — as applyRigidTransformToYRotationDeg() does for a tag's heading — would be
|
|
43
|
+
* wrong as soon as the object is tilted on X or Z. The rotation is composed instead: the
|
|
44
|
+
* object's own rotation first, then the turn around the vertical axis of the whole model.
|
|
45
|
+
*
|
|
46
|
+
* The turn is the one applyRigidTransformToPoint() applies to positions, written for (x, z) as
|
|
47
|
+
* x' = x cos(a) - z sin(a), z' = x sin(a) + z cos(a): in three.js terms a rotation of -a
|
|
48
|
+
* around +Y. So an object keeps pointing at the same thing in both models.
|
|
49
|
+
*/
|
|
50
|
+
export declare function applyRigidTransformToEulerXYZ(rotation: Vec3, t: RigidTransform): Vec3;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Folder of the library models, as stored in Object3D.path. */
|
|
2
|
+
export declare const OBJECT3D_LIBRARY_FOLDER = "3DObjects/objects/";
|
|
3
|
+
/** Folder the application serves the library models from (see MatterportObject3DService). */
|
|
4
|
+
export declare const OBJECT3D_LIBRARY_ASSET_FOLDER = "assets/3Dobjects/objects/";
|
|
5
|
+
/** Largest model file a user may upload. */
|
|
6
|
+
export declare const OBJECT3D_UPLOAD_MAX_BYTES: number;
|
|
7
|
+
/** S3 folder of the uploaded models; one sub-folder per space. */
|
|
8
|
+
export declare const OBJECT3D_S3_FOLDER = "objects3D/";
|
|
9
|
+
/** Model formats the 3D loaders handle (an S3 model copied between locations keeps its own). */
|
|
10
|
+
export declare const OBJECT3D_MODEL_EXTENSIONS: string[];
|
|
11
|
+
/** Content type the uploaded models are stored with. */
|
|
12
|
+
export declare const GLB_CONTENT_TYPE = "model/gltf-binary";
|
|
13
|
+
/**
|
|
14
|
+
* Why a model file is refused. The values are translation keys of the application, written
|
|
15
|
+
* in English like its other keys.
|
|
16
|
+
*/
|
|
17
|
+
export type Object3dUploadError = 'Only .glb files can be uploaded.' | 'The file is too large (50 MB maximum).' | 'The file is empty.' | 'This file is not a valid .glb model.' | 'This model refers to external files: export it as a single .glb file with embedded textures.';
|
|
18
|
+
/** Where the model of an Object3D is loaded from. */
|
|
19
|
+
export interface Object3DModelSource {
|
|
20
|
+
/** file name without extension */
|
|
21
|
+
object: string;
|
|
22
|
+
/** extension, lower case, without the dot */
|
|
23
|
+
format: string;
|
|
24
|
+
/** url to load; absent for a library model (the loader builds it from object + format) */
|
|
25
|
+
url?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Checks that a file is a self-contained binary glTF 2.0 model, small enough to be uploaded:
|
|
29
|
+
* - name ending in .glb, size between 1 byte and OBJECT3D_UPLOAD_MAX_BYTES;
|
|
30
|
+
* - glb header: magic "glTF", version 2, declared length equal to the file size;
|
|
31
|
+
* - first chunk of type JSON, holding a parseable glTF document of version 2.x;
|
|
32
|
+
* - no buffer nor image pointing at another file or url (only embedded data): such a
|
|
33
|
+
* reference cannot be resolved next to a signed S3 url, and would make the viewer fetch
|
|
34
|
+
* an arbitrary address.
|
|
35
|
+
* The content is only read, never executed. Returns the error, or null when the file is valid.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateGlbFile(file: Blob & {
|
|
38
|
+
name?: string;
|
|
39
|
+
}): Promise<Object3dUploadError | null>;
|
|
40
|
+
/**
|
|
41
|
+
* S3 key of an uploaded model: under the space's folder, with a file name reduced to safe
|
|
42
|
+
* characters, followed by the upload time (UTC, to the millisecond) and a short random suffix.
|
|
43
|
+
* S3 overwrites an existing key without warning, and a model may be used by several objects
|
|
44
|
+
* (duplicates, copies, imports): two uploads of the same file name must never share a key.
|
|
45
|
+
* The user's file name never decides the folder.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildObject3DModelKey(spaceId: string, fileName: string, now?: Date): string;
|
|
48
|
+
/** File name of a library model ("3DObjects/objects/chair.glb" gives "chair.glb"), null otherwise. */
|
|
49
|
+
export declare function getObject3DLibraryFile(path: string | null | undefined): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Where to load the model of an Object3D from (see the header of this file). A model uploaded
|
|
52
|
+
* to S3 gets a signed url, valid for a limited time: resolve it when loading, never store it.
|
|
53
|
+
* Null when the path is unusable.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveObject3DModelSource(object3D: {
|
|
56
|
+
path?: string | null;
|
|
57
|
+
s3Bucket?: boolean | null;
|
|
58
|
+
}): Promise<Object3DModelSource | null>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { SpModule } from '../../types.service';
|
|
2
|
+
import { Vec3 } from './matterport-transform.util';
|
|
3
|
+
export declare const TAG_ARCHIVE_FORMAT = "smarterplan-tags";
|
|
4
|
+
/** Bumped on any change of the manifest that an older import could misread. */
|
|
5
|
+
export declare const TAG_ARCHIVE_VERSION = 1;
|
|
6
|
+
export declare const TAG_ARCHIVE_MANIFEST = "manifest.json";
|
|
7
|
+
export declare const TAG_ARCHIVE_FILES_FOLDER = "files/";
|
|
8
|
+
/** Where an archive comes from: shown before the import and written in the import log. */
|
|
9
|
+
export interface TagArchiveOrigin {
|
|
10
|
+
/** origin (scheme + host) of the application that exported: tells the environment apart */
|
|
11
|
+
environment: string;
|
|
12
|
+
/** module of the application that exported: only an application of the same module can import */
|
|
13
|
+
module: SpModule;
|
|
14
|
+
spaceId: string;
|
|
15
|
+
spaceName: string;
|
|
16
|
+
/** ISO date */
|
|
17
|
+
exportedAt: string;
|
|
18
|
+
exportedBy: {
|
|
19
|
+
userID: string | null;
|
|
20
|
+
name: string | null;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** A virtual visit of the exported location, offered as source visit when placing landmarks. */
|
|
24
|
+
export interface TagArchiveVisit {
|
|
25
|
+
name: string;
|
|
26
|
+
model3d: string;
|
|
27
|
+
viewer?: string | null;
|
|
28
|
+
}
|
|
29
|
+
/** Index entry of an S3 file referenced by the data, keyed by its raw S3 key. */
|
|
30
|
+
export interface TagArchiveFileEntry {
|
|
31
|
+
/** path of the file inside the archive; null when it could not be exported */
|
|
32
|
+
path: string | null;
|
|
33
|
+
contentType?: string | null;
|
|
34
|
+
size?: number;
|
|
35
|
+
/** the file did not exist (orphan reference) or could not be downloaded */
|
|
36
|
+
missing?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** One link between a ticket and an equipment (Operation record). */
|
|
39
|
+
export interface TagArchiveOperation {
|
|
40
|
+
ticketID: string;
|
|
41
|
+
equipmentID: string;
|
|
42
|
+
}
|
|
43
|
+
/** Raw records of the exported location. */
|
|
44
|
+
export interface TagArchiveData {
|
|
45
|
+
tickets: any[];
|
|
46
|
+
/** ticket id -> its attachments (Comments) */
|
|
47
|
+
ticketComments: Record<string, any[]>;
|
|
48
|
+
operations: TagArchiveOperation[];
|
|
49
|
+
equipments: any[];
|
|
50
|
+
objects3D: any[];
|
|
51
|
+
features: any[];
|
|
52
|
+
/** feature id -> its media set (Comments) */
|
|
53
|
+
featureComments: Record<string, any[]>;
|
|
54
|
+
measurements: any[];
|
|
55
|
+
/** every POI placed on the sweeps of the location */
|
|
56
|
+
pois: any[];
|
|
57
|
+
/** sweep id -> position, to find the closest sweep of the target visit */
|
|
58
|
+
sweepPositions: Record<string, Vec3>;
|
|
59
|
+
/** hashtag id -> name */
|
|
60
|
+
hashtags: Record<string, string>;
|
|
61
|
+
/** the categories referenced by the records, with their ancestors */
|
|
62
|
+
domains: any[];
|
|
63
|
+
}
|
|
64
|
+
export interface TagArchiveManifest {
|
|
65
|
+
format: string;
|
|
66
|
+
version: number;
|
|
67
|
+
origin: TagArchiveOrigin;
|
|
68
|
+
visits: TagArchiveVisit[];
|
|
69
|
+
/** number of records per kind, displayed before importing */
|
|
70
|
+
counts: Record<string, number>;
|
|
71
|
+
data: TagArchiveData;
|
|
72
|
+
/** raw S3 key -> file of the archive */
|
|
73
|
+
files: Record<string, TagArchiveFileEntry>;
|
|
74
|
+
}
|
|
75
|
+
/** An archive read in memory: its manifest and the bytes of its files, by archive path. */
|
|
76
|
+
export interface TagArchive {
|
|
77
|
+
manifest: TagArchiveManifest;
|
|
78
|
+
files: Record<string, Uint8Array>;
|
|
79
|
+
}
|
|
80
|
+
/** Why an archive cannot be read. `code` is the end of a `matterportCopy.*` translation key. */
|
|
81
|
+
export declare class TagArchiveError extends Error {
|
|
82
|
+
readonly code: string;
|
|
83
|
+
readonly params: Record<string, any>;
|
|
84
|
+
constructor(code: string, params?: Record<string, any>);
|
|
85
|
+
}
|
|
86
|
+
/** Archive path of the n-th exported file. The original name is kept for readability only. */
|
|
87
|
+
export declare function tagArchiveFilePath(index: number, s3Key: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Packs a manifest and its files into a ZIP. Media files are stored without compression:
|
|
90
|
+
* images, videos and models are already compressed, recompressing them only costs time.
|
|
91
|
+
*/
|
|
92
|
+
export declare function buildTagArchive(manifest: TagArchiveManifest, files: Record<string, Uint8Array>): Uint8Array;
|
|
93
|
+
/**
|
|
94
|
+
* Reads a ZIP produced by buildTagArchive(). Checks the format and the version, not the
|
|
95
|
+
* module: see MatterportTagCopyService.readTagArchive().
|
|
96
|
+
*/
|
|
97
|
+
export declare function readTagArchive(bytes: Uint8Array): TagArchive;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Whether this application may write 3D model files to S3: a model uploaded by the operator,
|
|
4
|
+
* a library model restored from a tag archive, a model copied with a 3D object.
|
|
5
|
+
*
|
|
6
|
+
* True by default. An application not ready for it yet provides false (see the app.module.ts
|
|
7
|
+
* of smarterplan-museum): tag copies and imports then never create a model file — a 3D object
|
|
8
|
+
* whose model would need one is reported in the log instead.
|
|
9
|
+
*/
|
|
10
|
+
export declare const OBJECT3D_MODEL_UPLOAD_ENABLED: InjectionToken<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smarterplan/ngx-smarterplan-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.30",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.5.0"
|
|
6
6
|
},
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@ngx-translate/core": "^17.0.0",
|
|
16
16
|
"@types/hls.js": "^0.12.5",
|
|
17
17
|
"aws-amplify": "^5.0.9",
|
|
18
|
+
"fflate": "^0.7.3",
|
|
18
19
|
"file-saver": "^2.0.5",
|
|
19
20
|
"hls.js": "^0.13.2",
|
|
20
21
|
"js-levenshtein": "^1.1.6",
|
package/public-api.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export * from './lib/services/obj-to-glb';
|
|
|
25
25
|
export * from './lib/services/matterport-tag-copy.service';
|
|
26
26
|
export * from './lib/mattertagData';
|
|
27
27
|
export * from './lib/services/utils/matterport-transform.util';
|
|
28
|
+
export * from './lib/services/utils/tag-archive.util';
|
|
29
|
+
export * from './lib/services/utils/object3d-model.util';
|
|
28
30
|
export * from './lib/services/models/profile.service';
|
|
29
31
|
export * from './lib/services/models/zone.service';
|
|
30
32
|
export * from './lib/services/models/mission.service';
|
|
@@ -75,3 +77,4 @@ export * from './lib/validators/no-empty.directive';
|
|
|
75
77
|
export * from './lib/validators/text.directive';
|
|
76
78
|
export * from './lib/validators/number.directive';
|
|
77
79
|
export * from './lib/tokens/matterport-sdk-key.token';
|
|
80
|
+
export * from './lib/tokens/object3d-model-upload.token';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>SmarterPlan splat converter</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<!-- Opened unseen by the app's 3D models form, which hands it a splat file to turn into .sog. -->
|
|
9
|
-
<script type="module" src="convert-AJMRDWU6.js"></script>
|
|
10
|
-
</body>
|
|
11
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>SmarterPlan splat converter</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<!-- Opened unseen by the app's 3D models form, which hands it a splat file to turn into .sog. -->
|
|
9
|
+
<script type="module" src="convert-AJMRDWU6.js"></script>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|