@smarterplan/ngx-smarterplan-core 1.2.11 → 1.2.13
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 +50 -41
- package/esm2020/lib/services/matterport.service.mjs +31 -12
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +80 -52
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +79 -51
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/services/matterport-import.service.d.ts +7 -0
- package/lib/services/matterport-import.service.d.ts.map +1 -1
- package/lib/services/matterport.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2806,22 +2806,41 @@ class MatterportService {
|
|
|
2806
2806
|
// renderer.shadowMap.bias = 0.0001;
|
|
2807
2807
|
// renderer.shadowMap.type = three.PCFSoftShadowMap;
|
|
2808
2808
|
// });
|
|
2809
|
-
let sensorRadius = 3.5; // Meters
|
|
2810
2809
|
// Wait until Showcase is actually playing....
|
|
2811
2810
|
this.sdk.Tag.data.subscribe({
|
|
2812
2811
|
onAdded: async function (index, item, collection) {
|
|
2813
2812
|
let thisOpacity = 0.2;
|
|
2814
2813
|
this.sdk.Tag.editOpacity(index, thisOpacity);
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2814
|
+
let source = null;
|
|
2815
|
+
try {
|
|
2816
|
+
source = await Promise.all([
|
|
2817
|
+
this.sdk.Sensor.createSource(this.sdk.Sensor.SourceType.SPHERE, {
|
|
2818
|
+
origin: item.anchorPosition,
|
|
2819
|
+
radius: Number(3),
|
|
2820
|
+
userData: {
|
|
2821
|
+
id: index + '-sphere-source',
|
|
2822
|
+
},
|
|
2823
|
+
})
|
|
2824
|
+
]);
|
|
2825
|
+
}
|
|
2826
|
+
catch (e) {
|
|
2827
|
+
console.log('could not create Sphere sensor');
|
|
2828
|
+
console.error(e);
|
|
2829
|
+
}
|
|
2830
|
+
if (!source) {
|
|
2831
|
+
return;
|
|
2832
|
+
}
|
|
2833
|
+
let sensor = null;
|
|
2834
|
+
try {
|
|
2835
|
+
sensor = await this.sdk.Sensor.createSensor(this.sdk.Sensor.SensorType.CAMERA);
|
|
2836
|
+
}
|
|
2837
|
+
catch (e) {
|
|
2838
|
+
console.log('could not create Camera sensor');
|
|
2839
|
+
console.error(e);
|
|
2840
|
+
}
|
|
2841
|
+
if (!sensor) {
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2825
2844
|
sensor.addSource(...source);
|
|
2826
2845
|
sensor.readings.subscribe({
|
|
2827
2846
|
onUpdated(source, reading) {
|
|
@@ -11359,7 +11378,7 @@ class MatterportImportService {
|
|
|
11359
11378
|
this.importingImages = new Subject();
|
|
11360
11379
|
this.sweepProcessedCount = new Subject();
|
|
11361
11380
|
this.totalSweepsCount = new Subject();
|
|
11362
|
-
this.MAX_SCANS_RELOAD =
|
|
11381
|
+
this.MAX_SCANS_RELOAD = 5;
|
|
11363
11382
|
}
|
|
11364
11383
|
get spaceID() {
|
|
11365
11384
|
return this._spaceID;
|
|
@@ -11392,46 +11411,50 @@ class MatterportImportService {
|
|
|
11392
11411
|
const element = document.querySelector('#viewer-frame');
|
|
11393
11412
|
element.append(iframe);
|
|
11394
11413
|
this.currentFrame = iframe;
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11414
|
+
const showcaseWindow = iframe.contentWindow;
|
|
11415
|
+
return new Promise((res, rej) => {
|
|
11416
|
+
iframe.addEventListener('load', async () => {
|
|
11417
|
+
try {
|
|
11418
|
+
this.sdk = await showcaseWindow.MP_SDK.connect(iframe, 'qn9wsasuy5h2fzrbrn1nzr0id', '3.11');
|
|
11419
|
+
// Subscribe to Floor data
|
|
11420
|
+
this.sdk.Floor.data.subscribe({
|
|
11421
|
+
onCollectionUpdated: function upd(collection) {
|
|
11422
|
+
// console.log("Floors", collection);
|
|
11423
|
+
this.floors = collection;
|
|
11424
|
+
}.bind(this),
|
|
11425
|
+
});
|
|
11426
|
+
// Subscribe to current Floor
|
|
11427
|
+
this.sdk.Floor.current.subscribe(function upd(currentFloor) {
|
|
11428
|
+
this.currentFloor = currentFloor;
|
|
11429
|
+
}.bind(this));
|
|
11430
|
+
// Subscribe to Sweep data
|
|
11431
|
+
this.sdk.Sweep.data.subscribe({
|
|
11432
|
+
onCollectionUpdated: function upd(collection) {
|
|
11433
|
+
console.log('the entire up-to-date collection', collection);
|
|
11434
|
+
this.sweeps = collection;
|
|
11435
|
+
}.bind(this),
|
|
11436
|
+
});
|
|
11437
|
+
// remove labels
|
|
11438
|
+
await this.sdk.Settings.update('labels', false);
|
|
11439
|
+
let timeoutExpired = false;
|
|
11440
|
+
// start timeout
|
|
11441
|
+
setTimeout(() => (timeoutExpired = true), 7000);
|
|
11442
|
+
await waitUntil(() => (this.sweeps !== undefined && this.floors !== undefined) ||
|
|
11443
|
+
timeoutExpired === true);
|
|
11444
|
+
if (timeoutExpired) {
|
|
11445
|
+
// we are likely in matterport error case (that we cannot catch!)
|
|
11446
|
+
console.log('timeout intitialising Matterport');
|
|
11447
|
+
return rej(new Error('error init Matterport'));
|
|
11448
|
+
}
|
|
11449
|
+
console.log('init done');
|
|
11450
|
+
return res(true);
|
|
11451
|
+
}
|
|
11452
|
+
catch (e) {
|
|
11453
|
+
console.error(e);
|
|
11454
|
+
rej(new Error('error init Matterport'));
|
|
11455
|
+
}
|
|
11415
11456
|
});
|
|
11416
|
-
|
|
11417
|
-
await this.sdk.Settings.update('labels', false);
|
|
11418
|
-
let timeoutExpired = false;
|
|
11419
|
-
// start timeout
|
|
11420
|
-
setTimeout(() => (timeoutExpired = true), 7000);
|
|
11421
|
-
await waitUntil(() => (this.sweeps !== undefined && this.floors !== undefined) ||
|
|
11422
|
-
timeoutExpired === true);
|
|
11423
|
-
if (timeoutExpired) {
|
|
11424
|
-
// we are likely in matterport error case (that we cannot catch!)
|
|
11425
|
-
console.log('timeout intitialising Matterport');
|
|
11426
|
-
throw new Error('error init Matterport');
|
|
11427
|
-
}
|
|
11428
|
-
console.log('init done');
|
|
11429
|
-
return true;
|
|
11430
|
-
}
|
|
11431
|
-
catch (e) {
|
|
11432
|
-
console.error(e);
|
|
11433
|
-
throw new Error('error init Matterport');
|
|
11434
|
-
}
|
|
11457
|
+
});
|
|
11435
11458
|
}
|
|
11436
11459
|
async importData(spaceID, surface, reloading = false, node = null) {
|
|
11437
11460
|
if (!this.sweeps) {
|
|
@@ -11540,6 +11563,11 @@ class MatterportImportService {
|
|
|
11540
11563
|
}
|
|
11541
11564
|
for (let index = indexScan; index < maxScan; index += 1) {
|
|
11542
11565
|
if (!this.stop) {
|
|
11566
|
+
await new Promise((res) => {
|
|
11567
|
+
setTimeout(() => {
|
|
11568
|
+
res(null);
|
|
11569
|
+
}, 1000);
|
|
11570
|
+
});
|
|
11543
11571
|
await this.sdk.Sweep.moveTo(scans[index].uuid);
|
|
11544
11572
|
await this.sdk.Camera.setRotation({
|
|
11545
11573
|
x: 0,
|