@smarterplan/ngx-smarterplan-core 1.2.24 → 1.2.25
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/esm2020/lib/services/matterport-import.service.mjs +30 -58
- package/esm2020/lib/services/s3.service.mjs +18 -5
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +48 -61
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +46 -61
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/services/matterport-import.service.d.ts +3 -4
- package/lib/services/s3.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4591,10 +4591,6 @@ const uploadFileToS3 = (path, file, objectId) => __awaiter(void 0, void 0, void
|
|
|
4591
4591
|
.then((result) => {
|
|
4592
4592
|
console.log("Success =>", result);
|
|
4593
4593
|
return result.key;
|
|
4594
|
-
})
|
|
4595
|
-
.catch((error) => {
|
|
4596
|
-
console.log("error =>", error);
|
|
4597
|
-
return null;
|
|
4598
4594
|
});
|
|
4599
4595
|
});
|
|
4600
4596
|
const getSignedImageUrlForEquipment = (equip) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -4638,6 +4634,23 @@ const uploadBase64Image = (uri, objectId, path, friendlyFileName) => __awaiter(v
|
|
|
4638
4634
|
return uploadFileToS3(path, file, objectId);
|
|
4639
4635
|
});
|
|
4640
4636
|
});
|
|
4637
|
+
const uploadBase64ImageWithRetry = (uri, objectId, path, friendlyFileName, retry) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4638
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4639
|
+
while (retry > 0) {
|
|
4640
|
+
try {
|
|
4641
|
+
const r = yield uploadBase64Image(uri, objectId, path, friendlyFileName);
|
|
4642
|
+
resolve(r);
|
|
4643
|
+
return;
|
|
4644
|
+
}
|
|
4645
|
+
catch (e) {
|
|
4646
|
+
retry--;
|
|
4647
|
+
console.error(`Upload error, retry n° ${retry} : `, e);
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
;
|
|
4651
|
+
reject("Max retry exceeded");
|
|
4652
|
+
}));
|
|
4653
|
+
});
|
|
4641
4654
|
const removeAllFilesFromFolderS3 = (folderPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4642
4655
|
const arrayOfPromises = [];
|
|
4643
4656
|
Storage.list(folderPath, { level: "public" })
|
|
@@ -12067,7 +12080,6 @@ class MatterportImportService {
|
|
|
12067
12080
|
this.importingImages = new Subject();
|
|
12068
12081
|
this.sweepProcessedCount = new Subject();
|
|
12069
12082
|
this.totalSweepsCount = new Subject();
|
|
12070
|
-
this.MAX_SCANS_RELOAD = 10;
|
|
12071
12083
|
}
|
|
12072
12084
|
get spaceID() {
|
|
12073
12085
|
return this._spaceID;
|
|
@@ -12147,7 +12159,7 @@ class MatterportImportService {
|
|
|
12147
12159
|
});
|
|
12148
12160
|
});
|
|
12149
12161
|
}
|
|
12150
|
-
importData(spaceID, surface, reloading = false, node = null) {
|
|
12162
|
+
importData(spaceID, surface, reloading = false, node = null, overrideExisting = true) {
|
|
12151
12163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12152
12164
|
if (!this.sweeps) {
|
|
12153
12165
|
return Promise.reject(new Error('no sweeps initialized'));
|
|
@@ -12164,10 +12176,9 @@ class MatterportImportService {
|
|
|
12164
12176
|
yield waitUntil(() => appIsLoaded === true);
|
|
12165
12177
|
if (reloading) {
|
|
12166
12178
|
// perform only 360 import since we are reloading
|
|
12167
|
-
yield this.import360images();
|
|
12179
|
+
yield this.import360images(overrideExisting);
|
|
12168
12180
|
return Promise.resolve(true);
|
|
12169
12181
|
}
|
|
12170
|
-
this.cleanLocalStorage(); // we are importing new visit
|
|
12171
12182
|
this.spaceID = spaceID;
|
|
12172
12183
|
let floorZones = [];
|
|
12173
12184
|
const zones = yield this.zoneService.getZonesBySpace(spaceID);
|
|
@@ -12204,7 +12215,7 @@ class MatterportImportService {
|
|
|
12204
12215
|
console.log('could create navigation', navigationInput.id);
|
|
12205
12216
|
}
|
|
12206
12217
|
})));
|
|
12207
|
-
yield this.import360images();
|
|
12218
|
+
yield this.import360images(overrideExisting);
|
|
12208
12219
|
return Promise.resolve(true);
|
|
12209
12220
|
});
|
|
12210
12221
|
}
|
|
@@ -12231,47 +12242,31 @@ class MatterportImportService {
|
|
|
12231
12242
|
return newLocal;
|
|
12232
12243
|
});
|
|
12233
12244
|
}
|
|
12234
|
-
import360images() {
|
|
12245
|
+
import360images(overrideExisting = true) {
|
|
12235
12246
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12236
12247
|
console.log('Importing 360 images');
|
|
12237
12248
|
this.importingImages.next(true);
|
|
12238
12249
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
12239
12250
|
const scans = Object.values(this.sweeps);
|
|
12240
|
-
let maxScan;
|
|
12241
|
-
let indexScan;
|
|
12242
12251
|
const nmbScans = Object.keys(scans).length;
|
|
12243
|
-
console.log('Total number of scan points :', nmbScans);
|
|
12244
12252
|
this.totalSweepsCount.next(nmbScans);
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
console.log('retaking import from scan', localStorage.getItem('indexScanLoad'));
|
|
12248
|
-
indexScan = +localStorage.getItem('indexScanLoad');
|
|
12249
|
-
nmbScans < indexScan + this.MAX_SCANS_RELOAD
|
|
12250
|
-
? (maxScan = nmbScans)
|
|
12251
|
-
: (maxScan = indexScan + this.MAX_SCANS_RELOAD);
|
|
12252
|
-
}
|
|
12253
|
-
else {
|
|
12254
|
-
indexScan = 0;
|
|
12255
|
-
nmbScans < this.MAX_SCANS_RELOAD
|
|
12256
|
-
? (maxScan = nmbScans)
|
|
12257
|
-
: (maxScan = this.MAX_SCANS_RELOAD);
|
|
12258
|
-
}
|
|
12259
|
-
for (let index = indexScan; index < maxScan; index += 1) {
|
|
12253
|
+
const start = overrideExisting ? 0 : yield this.getUploadedImageCount(this.modelID);
|
|
12254
|
+
for (let index = start; index < nmbScans; index += 1) {
|
|
12260
12255
|
if (!this.stop) {
|
|
12261
|
-
yield
|
|
12262
|
-
setTimeout(() => {
|
|
12263
|
-
res(null);
|
|
12264
|
-
}, 1000);
|
|
12265
|
-
});
|
|
12266
|
-
yield this.sdk.Sweep.moveTo(scans[index].uuid);
|
|
12267
|
-
yield this.sdk.Camera.setRotation({
|
|
12268
|
-
x: 0,
|
|
12269
|
-
y: 0,
|
|
12270
|
-
});
|
|
12256
|
+
yield this.sdk.Sweep.moveTo(scans[index].uuid, { rotation: { x: 0, y: 0 }, transition: this.sdk.Sweep.Transition.INSTANT, transitionTime: 0 });
|
|
12271
12257
|
const img = yield this.sdk.Renderer.takeEquirectangular({ width: 2048, height: 1024 }, { mattertags: false, sweeps: true });
|
|
12272
|
-
|
|
12273
|
-
this.
|
|
12274
|
-
|
|
12258
|
+
/**Upload on S3 are asynchronous, in order to no slow down the process*/
|
|
12259
|
+
uploadBase64ImageWithRetry(img, scans[index].uuid, `visits/${this.modelID}/sweeps/`, 'sweep', 5).then((r) => {
|
|
12260
|
+
this.sweepProcessedCount.next(index);
|
|
12261
|
+
if (index === nmbScans - 1) {
|
|
12262
|
+
console.log('Import 360 done');
|
|
12263
|
+
resolve(true);
|
|
12264
|
+
this.removeFrame();
|
|
12265
|
+
this.stop = true;
|
|
12266
|
+
}
|
|
12267
|
+
}).catch((e) => {
|
|
12268
|
+
console.log("Error uploading scan : ", e);
|
|
12269
|
+
});
|
|
12275
12270
|
}
|
|
12276
12271
|
else {
|
|
12277
12272
|
console.log('Abandoning import because it was cancelled');
|
|
@@ -12279,23 +12274,20 @@ class MatterportImportService {
|
|
|
12279
12274
|
break;
|
|
12280
12275
|
}
|
|
12281
12276
|
}
|
|
12282
|
-
if (maxScan === nmbScans) {
|
|
12283
|
-
console.log('Import 360 done');
|
|
12284
|
-
this.cleanLocalStorage();
|
|
12285
|
-
this.removeFrame();
|
|
12286
|
-
this.stop = true;
|
|
12287
|
-
resolve(true);
|
|
12288
|
-
}
|
|
12289
|
-
else if (!this.stop) {
|
|
12290
|
-
// to restart the procedure from where we left of
|
|
12291
|
-
localStorage.setItem('indexScanLoad', maxScan.toString());
|
|
12292
|
-
localStorage.setItem('visitInImport', this.modelID);
|
|
12293
|
-
this.removeFrame();
|
|
12294
|
-
window.location.reload();
|
|
12295
|
-
}
|
|
12296
12277
|
}));
|
|
12297
12278
|
});
|
|
12298
12279
|
}
|
|
12280
|
+
getUploadedImageCount(modelID) {
|
|
12281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12282
|
+
try {
|
|
12283
|
+
const images = yield listFilesInFolder(`visits/${modelID}/sweeps/`);
|
|
12284
|
+
return images.length;
|
|
12285
|
+
}
|
|
12286
|
+
catch (e) {
|
|
12287
|
+
return 0;
|
|
12288
|
+
}
|
|
12289
|
+
});
|
|
12290
|
+
}
|
|
12299
12291
|
moveToFloor(floorName, matterportFloorSequence = null) {
|
|
12300
12292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12301
12293
|
if (!this.floors) {
|
|
@@ -12388,7 +12380,6 @@ class MatterportImportService {
|
|
|
12388
12380
|
abandon() {
|
|
12389
12381
|
setTimeout(() => {
|
|
12390
12382
|
console.log('abandonning import');
|
|
12391
|
-
localStorage.removeItem('visitInImport');
|
|
12392
12383
|
this.stop = true;
|
|
12393
12384
|
this.removeFrame();
|
|
12394
12385
|
}, 500);
|
|
@@ -12398,10 +12389,6 @@ class MatterportImportService {
|
|
|
12398
12389
|
this.currentFrame.remove();
|
|
12399
12390
|
}
|
|
12400
12391
|
}
|
|
12401
|
-
cleanLocalStorage() {
|
|
12402
|
-
localStorage.removeItem('indexScanLoad');
|
|
12403
|
-
localStorage.removeItem('visitInImport');
|
|
12404
|
-
}
|
|
12405
12392
|
getLayerByName(name) {
|
|
12406
12393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12407
12394
|
const mission = this.userService.currentMission(this.spaceID);
|
|
@@ -13061,5 +13048,5 @@ function floatValidator() {
|
|
|
13061
13048
|
* Generated bundle index. Do not edit.
|
|
13062
13049
|
*/
|
|
13063
13050
|
|
|
13064
|
-
export { AffectationService, AvatarComponent, BaseLateralTabService, BaseTagService, BaseUserService, BaseVisibilityService, CameraMode, CaptureService, CaptureViewer, CommentService, CommentType, Config, ContentService, CsvExportComponent, DomainService, DomainType, DurationToStringPipe, EmailStatus, EquipmentService, EventService, EventStatus, EventType, FeatureService, FeatureType, FilterService, HashtagFromIdPipe, HashtagService, InterventionService, InventoryStatus, LayerService, LevelStatus, LoaderComponent, Locale, LocaleService, MatterportImportService, MatterportService, MattertagActionMode, MattertagData, MeasurementService, MenuBarComponent, MissionService, NavigationService, NavigatorService, NgxSmarterplanCoreModule, NgxSmarterplanCoreService, NodeService, Object3DService, OperationService, OrganisationService, PaymentStatus, PlanService, PoiService, PoiType, ProfileEntity, ProfileService, ProfileStatus, PropertyService, PropertyType, RoleStatus, SafeUrlPipe, SearchBarComponent, SearchObjectType, SearchService, SpModule, SpaceService, SpaceStatus, StatusEquipment, SupportModalComponent, SupportService, TagAction, TemplateService, TicketPriority, TicketStatus, TicketType, TicketsService, TimeDateToLocalStringPipe, TypeNote, UsernameFromIdPipe, ValidatorsService, ViewerInteractions, ViewerService, VisitService, ZoneChangeService, ZoneService, arraysContainSameElements, checkElementById, convertTimestampToLocalZone, dateHasExpired, dateTimeToLocalString, deleteFromS3, downloadBlob, downloadEquipmentDocument, downloadFile, downloadFileAsObject, durationToString, emailValidator, enumToArray, filterUniqueArrayByID, floatValidator, getBufferForFileFromS3, getCoefficientsForImage, getDistanceBetweenTwoPoints, getHighestLevelForMissions, getHighestRoleForMissions, getLevelsBelow, getLocaleLong, getLocaleShort, getMetaForImage, getRolesBelowForManager, getSignedFile, getSignedImageUrlForEquipment, getSignedImageUrlForProfile, getSignedImageUrlForSpace, getSpaceIDFromUrl, getVisitUrl, isEmptyObject, listFilesInFolder, mean, noEmptyValidator, numberToDateString, openDocument, openModalForVisitSwitch, poiTypeToString, removeAllFilesFromFolderS3, removeNullKeysFromObject, showScanPointsOnPlanInDiv, shuffleArray, sortAlphabeticallyOnName, stringLocaleToEnum, stringToLowercaseNoSpaces, styleButton, textValidator, translateDatePeriod, uploadBase64Image, uploadFileToS3, uploadJsonToS3, validEmail, wait, waitUntil };
|
|
13051
|
+
export { AffectationService, AvatarComponent, BaseLateralTabService, BaseTagService, BaseUserService, BaseVisibilityService, CameraMode, CaptureService, CaptureViewer, CommentService, CommentType, Config, ContentService, CsvExportComponent, DomainService, DomainType, DurationToStringPipe, EmailStatus, EquipmentService, EventService, EventStatus, EventType, FeatureService, FeatureType, FilterService, HashtagFromIdPipe, HashtagService, InterventionService, InventoryStatus, LayerService, LevelStatus, LoaderComponent, Locale, LocaleService, MatterportImportService, MatterportService, MattertagActionMode, MattertagData, MeasurementService, MenuBarComponent, MissionService, NavigationService, NavigatorService, NgxSmarterplanCoreModule, NgxSmarterplanCoreService, NodeService, Object3DService, OperationService, OrganisationService, PaymentStatus, PlanService, PoiService, PoiType, ProfileEntity, ProfileService, ProfileStatus, PropertyService, PropertyType, RoleStatus, SafeUrlPipe, SearchBarComponent, SearchObjectType, SearchService, SpModule, SpaceService, SpaceStatus, StatusEquipment, SupportModalComponent, SupportService, TagAction, TemplateService, TicketPriority, TicketStatus, TicketType, TicketsService, TimeDateToLocalStringPipe, TypeNote, UsernameFromIdPipe, ValidatorsService, ViewerInteractions, ViewerService, VisitService, ZoneChangeService, ZoneService, arraysContainSameElements, checkElementById, convertTimestampToLocalZone, dateHasExpired, dateTimeToLocalString, deleteFromS3, downloadBlob, downloadEquipmentDocument, downloadFile, downloadFileAsObject, durationToString, emailValidator, enumToArray, filterUniqueArrayByID, floatValidator, getBufferForFileFromS3, getCoefficientsForImage, getDistanceBetweenTwoPoints, getHighestLevelForMissions, getHighestRoleForMissions, getLevelsBelow, getLocaleLong, getLocaleShort, getMetaForImage, getRolesBelowForManager, getSignedFile, getSignedImageUrlForEquipment, getSignedImageUrlForProfile, getSignedImageUrlForSpace, getSpaceIDFromUrl, getVisitUrl, isEmptyObject, listFilesInFolder, mean, noEmptyValidator, numberToDateString, openDocument, openModalForVisitSwitch, poiTypeToString, removeAllFilesFromFolderS3, removeNullKeysFromObject, showScanPointsOnPlanInDiv, shuffleArray, sortAlphabeticallyOnName, stringLocaleToEnum, stringToLowercaseNoSpaces, styleButton, textValidator, translateDatePeriod, uploadBase64Image, uploadBase64ImageWithRetry, uploadFileToS3, uploadJsonToS3, validEmail, wait, waitUntil };
|
|
13065
13052
|
//# sourceMappingURL=smarterplan-ngx-smarterplan-core.mjs.map
|