@smarterplan/ngx-smarterplan-core 1.2.11 → 1.2.12
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 +49 -41
- package/esm2020/lib/services/matterport.service.mjs +31 -12
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +79 -52
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +78 -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
|
@@ -2924,23 +2924,42 @@ class MatterportService {
|
|
|
2924
2924
|
// renderer.shadowMap.bias = 0.0001;
|
|
2925
2925
|
// renderer.shadowMap.type = three.PCFSoftShadowMap;
|
|
2926
2926
|
// });
|
|
2927
|
-
let sensorRadius = 3.5; // Meters
|
|
2928
2927
|
// Wait until Showcase is actually playing....
|
|
2929
2928
|
this.sdk.Tag.data.subscribe({
|
|
2930
2929
|
onAdded: function (index, item, collection) {
|
|
2931
2930
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2932
2931
|
let thisOpacity = 0.2;
|
|
2933
2932
|
this.sdk.Tag.editOpacity(index, thisOpacity);
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2933
|
+
let source = null;
|
|
2934
|
+
try {
|
|
2935
|
+
source = yield Promise.all([
|
|
2936
|
+
this.sdk.Sensor.createSource(this.sdk.Sensor.SourceType.SPHERE, {
|
|
2937
|
+
origin: item.anchorPosition,
|
|
2938
|
+
radius: Number(3),
|
|
2939
|
+
userData: {
|
|
2940
|
+
id: index + '-sphere-source',
|
|
2941
|
+
},
|
|
2942
|
+
})
|
|
2943
|
+
]);
|
|
2944
|
+
}
|
|
2945
|
+
catch (e) {
|
|
2946
|
+
console.log('could not create Sphere sensor');
|
|
2947
|
+
console.error(e);
|
|
2948
|
+
}
|
|
2949
|
+
if (!source) {
|
|
2950
|
+
return;
|
|
2951
|
+
}
|
|
2952
|
+
let sensor = null;
|
|
2953
|
+
try {
|
|
2954
|
+
sensor = yield this.sdk.Sensor.createSensor(this.sdk.Sensor.SensorType.CAMERA);
|
|
2955
|
+
}
|
|
2956
|
+
catch (e) {
|
|
2957
|
+
console.log('could not create Camera sensor');
|
|
2958
|
+
console.error(e);
|
|
2959
|
+
}
|
|
2960
|
+
if (!sensor) {
|
|
2961
|
+
return;
|
|
2962
|
+
}
|
|
2944
2963
|
sensor.addSource(...source);
|
|
2945
2964
|
sensor.readings.subscribe({
|
|
2946
2965
|
onUpdated(source, reading) {
|
|
@@ -12014,7 +12033,7 @@ class MatterportImportService {
|
|
|
12014
12033
|
this.importingImages = new Subject();
|
|
12015
12034
|
this.sweepProcessedCount = new Subject();
|
|
12016
12035
|
this.totalSweepsCount = new Subject();
|
|
12017
|
-
this.MAX_SCANS_RELOAD =
|
|
12036
|
+
this.MAX_SCANS_RELOAD = 5;
|
|
12018
12037
|
}
|
|
12019
12038
|
get spaceID() {
|
|
12020
12039
|
return this._spaceID;
|
|
@@ -12048,46 +12067,49 @@ class MatterportImportService {
|
|
|
12048
12067
|
const element = document.querySelector('#viewer-frame');
|
|
12049
12068
|
element.append(iframe);
|
|
12050
12069
|
this.currentFrame = iframe;
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12070
|
+
return new Promise((res, rej) => {
|
|
12071
|
+
iframe.addEventListener('load', () => __awaiter(this, void 0, void 0, function* () {
|
|
12072
|
+
try {
|
|
12073
|
+
this.sdk = yield window.MP_SDK.connect(iframe, 'qn9wsasuy5h2fzrbrn1nzr0id', '3.11');
|
|
12074
|
+
// Subscribe to Floor data
|
|
12075
|
+
this.sdk.Floor.data.subscribe({
|
|
12076
|
+
onCollectionUpdated: function upd(collection) {
|
|
12077
|
+
// console.log("Floors", collection);
|
|
12078
|
+
this.floors = collection;
|
|
12079
|
+
}.bind(this),
|
|
12080
|
+
});
|
|
12081
|
+
// Subscribe to current Floor
|
|
12082
|
+
this.sdk.Floor.current.subscribe(function upd(currentFloor) {
|
|
12083
|
+
this.currentFloor = currentFloor;
|
|
12084
|
+
}.bind(this));
|
|
12085
|
+
// Subscribe to Sweep data
|
|
12086
|
+
this.sdk.Sweep.data.subscribe({
|
|
12087
|
+
onCollectionUpdated: function upd(collection) {
|
|
12088
|
+
console.log('the entire up-to-date collection', collection);
|
|
12089
|
+
this.sweeps = collection;
|
|
12090
|
+
}.bind(this),
|
|
12091
|
+
});
|
|
12092
|
+
// remove labels
|
|
12093
|
+
yield this.sdk.Settings.update('labels', false);
|
|
12094
|
+
let timeoutExpired = false;
|
|
12095
|
+
// start timeout
|
|
12096
|
+
setTimeout(() => (timeoutExpired = true), 7000);
|
|
12097
|
+
yield waitUntil(() => (this.sweeps !== undefined && this.floors !== undefined) ||
|
|
12098
|
+
timeoutExpired === true);
|
|
12099
|
+
if (timeoutExpired) {
|
|
12100
|
+
// we are likely in matterport error case (that we cannot catch!)
|
|
12101
|
+
console.log('timeout intitialising Matterport');
|
|
12102
|
+
return rej(new Error('error init Matterport'));
|
|
12103
|
+
}
|
|
12104
|
+
console.log('init done');
|
|
12105
|
+
return res(true);
|
|
12106
|
+
}
|
|
12107
|
+
catch (e) {
|
|
12108
|
+
console.error(e);
|
|
12109
|
+
rej(new Error('error init Matterport'));
|
|
12110
|
+
}
|
|
12111
|
+
}));
|
|
12112
|
+
});
|
|
12091
12113
|
});
|
|
12092
12114
|
}
|
|
12093
12115
|
importData(spaceID, surface, reloading = false, node = null) {
|
|
@@ -12202,6 +12224,11 @@ class MatterportImportService {
|
|
|
12202
12224
|
}
|
|
12203
12225
|
for (let index = indexScan; index < maxScan; index += 1) {
|
|
12204
12226
|
if (!this.stop) {
|
|
12227
|
+
yield new Promise((res) => {
|
|
12228
|
+
setTimeout(() => {
|
|
12229
|
+
res(null);
|
|
12230
|
+
}, 1000);
|
|
12231
|
+
});
|
|
12205
12232
|
yield this.sdk.Sweep.moveTo(scans[index].uuid);
|
|
12206
12233
|
yield this.sdk.Camera.setRotation({
|
|
12207
12234
|
x: 0,
|