@shapediver/viewer.session-engine.session-engine 2.12.8 → 3.0.1
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/dist/implementation/OutputDelayException.js +1 -1
- package/dist/implementation/OutputDelayException.js.map +1 -1
- package/dist/implementation/OutputLoader.d.ts +9 -7
- package/dist/implementation/OutputLoader.d.ts.map +1 -1
- package/dist/implementation/OutputLoader.js +56 -41
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionData.d.ts +1 -1
- package/dist/implementation/SessionData.d.ts.map +1 -1
- package/dist/implementation/SessionData.js +2 -2
- package/dist/implementation/SessionData.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts +30 -3
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +115 -48
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionOutputData.d.ts +1 -1
- package/dist/implementation/SessionOutputData.d.ts.map +1 -1
- package/dist/implementation/SessionOutputData.js +2 -2
- package/dist/implementation/SessionOutputData.js.map +1 -1
- package/dist/implementation/SessionTreeNode.d.ts +1 -1
- package/dist/implementation/SessionTreeNode.d.ts.map +1 -1
- package/dist/implementation/SessionTreeNode.js +1 -1
- package/dist/implementation/SessionTreeNode.js.map +1 -1
- package/dist/implementation/dto/Export.d.ts +4 -4
- package/dist/implementation/dto/Export.d.ts.map +1 -1
- package/dist/implementation/dto/Export.js +2 -2
- package/dist/implementation/dto/Export.js.map +1 -1
- package/dist/implementation/dto/FileParameter.d.ts +2 -2
- package/dist/implementation/dto/FileParameter.d.ts.map +1 -1
- package/dist/implementation/dto/FileParameter.js +69 -31
- package/dist/implementation/dto/FileParameter.js.map +1 -1
- package/dist/implementation/dto/Output.js +2 -2
- package/dist/implementation/dto/Output.js.map +1 -1
- package/dist/implementation/dto/Parameter.d.ts +6 -6
- package/dist/implementation/dto/Parameter.d.ts.map +1 -1
- package/dist/implementation/dto/Parameter.js +106 -87
- package/dist/implementation/dto/Parameter.js.map +1 -1
- package/dist/index.d.ts +9 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ISessionData.d.ts +2 -2
- package/dist/interfaces/ISessionData.d.ts.map +1 -1
- package/dist/interfaces/ISessionEngine.d.ts +11 -46
- package/dist/interfaces/ISessionEngine.d.ts.map +1 -1
- package/dist/interfaces/ISessionEngine.js +0 -4
- package/dist/interfaces/ISessionEngine.js.map +1 -1
- package/dist/interfaces/ISessionOutputData.d.ts +2 -2
- package/dist/interfaces/ISessionOutputData.d.ts.map +1 -1
- package/dist/interfaces/ISessionTreeNode.d.ts +1 -1
- package/dist/interfaces/dto/IExport.d.ts +2 -2
- package/dist/interfaces/dto/IExport.d.ts.map +1 -1
- package/dist/interfaces/dto/IFileParameter.d.ts +1 -1
- package/dist/interfaces/dto/IFileParameter.d.ts.map +1 -1
- package/dist/interfaces/dto/IOutput.d.ts +13 -13
- package/dist/interfaces/dto/IOutput.d.ts.map +1 -1
- package/dist/interfaces/dto/IOutput.js +1 -0
- package/dist/interfaces/dto/IOutput.js.map +1 -1
- package/dist/interfaces/dto/IParameter.d.ts +3 -3
- package/dist/interfaces/dto/IParameter.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/implementation/OutputDelayException.ts +3 -3
- package/src/implementation/OutputLoader.ts +139 -104
- package/src/implementation/SessionData.ts +9 -9
- package/src/implementation/SessionEngine.ts +133 -53
- package/src/implementation/SessionOutputData.ts +8 -8
- package/src/implementation/SessionTreeNode.ts +8 -5
- package/src/implementation/dto/Export.ts +24 -11
- package/src/implementation/dto/FileParameter.ts +72 -37
- package/src/implementation/dto/Output.ts +2 -2
- package/src/implementation/dto/Parameter.ts +115 -85
- package/src/index.ts +17 -21
- package/src/interfaces/ISessionData.ts +2 -2
- package/src/interfaces/ISessionEngine.ts +19 -60
- package/src/interfaces/ISessionOutputData.ts +2 -2
- package/src/interfaces/ISessionTreeNode.ts +1 -1
- package/src/interfaces/dto/IExport.ts +4 -4
- package/src/interfaces/dto/IFileParameter.ts +2 -2
- package/src/interfaces/dto/IOutput.ts +38 -26
- package/src/interfaces/dto/IParameter.ts +3 -3
|
@@ -27,7 +27,6 @@ const sdk_geometry_api_sdk_v2_1 = require("@shapediver/sdk.geometry-api-sdk-v2")
|
|
|
27
27
|
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
28
28
|
const Export_1 = require("./dto/Export");
|
|
29
29
|
const FileParameter_1 = require("./dto/FileParameter");
|
|
30
|
-
const ISessionEngine_1 = require("../interfaces/ISessionEngine");
|
|
31
30
|
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
32
31
|
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
33
32
|
const Output_1 = require("./dto/Output");
|
|
@@ -38,14 +37,14 @@ const SessionData_1 = require("./SessionData");
|
|
|
38
37
|
const SessionTreeNode_1 = require("./SessionTreeNode");
|
|
39
38
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
40
39
|
class SessionEngine {
|
|
41
|
-
// #endregion Properties (
|
|
40
|
+
// #endregion Properties (46)
|
|
42
41
|
// #region Constructors (1)
|
|
43
42
|
/**
|
|
44
43
|
* Can be use to initialize a session with the ticket/guid and modelViewUrl and returns a scene graph node with the result.
|
|
45
44
|
* Can be use to customize the session with updated parameters to get the updated scene graph node.
|
|
46
45
|
*/
|
|
47
46
|
constructor(properties) {
|
|
48
|
-
// #region Properties (
|
|
47
|
+
// #region Properties (46)
|
|
49
48
|
this._eventEngine = viewer_shared_services_1.EventEngine.instance;
|
|
50
49
|
this._exports = {};
|
|
51
50
|
this._httpClient = viewer_shared_services_1.HttpClient.instance;
|
|
@@ -65,6 +64,7 @@ class SessionEngine {
|
|
|
65
64
|
_SessionEngine_parameterHistory.set(this, []);
|
|
66
65
|
_SessionEngine_parameterHistoryCall.set(this, false);
|
|
67
66
|
_SessionEngine_parameterHistoryForward.set(this, []);
|
|
67
|
+
this._allowOutputLoading = true;
|
|
68
68
|
this._automaticSceneUpdate = true;
|
|
69
69
|
this._closeOnFailure = () => __awaiter(this, void 0, void 0, function* () { });
|
|
70
70
|
this._closed = false;
|
|
@@ -78,6 +78,7 @@ class SessionEngine {
|
|
|
78
78
|
'X-ShapeDiver-BuildDate': ''
|
|
79
79
|
};
|
|
80
80
|
this._initialized = false;
|
|
81
|
+
this._loadSdtf = false;
|
|
81
82
|
this._retryCounter = 0;
|
|
82
83
|
this._updateCallback = null;
|
|
83
84
|
this._viewerSettingsVersion = viewer_settings_1.latestVersion;
|
|
@@ -89,6 +90,8 @@ class SessionEngine {
|
|
|
89
90
|
this._modelViewUrl = properties.modelViewUrl;
|
|
90
91
|
this._excludeViewports = properties.excludeViewports || [];
|
|
91
92
|
this._jwtToken = properties.jwtToken;
|
|
93
|
+
this._allowOutputLoading = properties.allowOutputLoading;
|
|
94
|
+
this._loadSdtf = properties.loadSdtf;
|
|
92
95
|
this._headers['X-ShapeDiver-BuildDate'] = properties.buildDate;
|
|
93
96
|
this._headers['X-ShapeDiver-BuildVersion'] = properties.buildVersion;
|
|
94
97
|
this._outputLoader = new OutputLoader_1.OutputLoader(this);
|
|
@@ -101,7 +104,7 @@ class SessionEngine {
|
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
// #endregion Constructors (1)
|
|
104
|
-
// #region Public
|
|
107
|
+
// #region Public Getters And Setters (26)
|
|
105
108
|
get automaticSceneUpdate() {
|
|
106
109
|
return this._automaticSceneUpdate;
|
|
107
110
|
}
|
|
@@ -146,6 +149,20 @@ class SessionEngine {
|
|
|
146
149
|
get jwtToken() {
|
|
147
150
|
return this._jwtToken;
|
|
148
151
|
}
|
|
152
|
+
get loadSdtf() {
|
|
153
|
+
return this._loadSdtf;
|
|
154
|
+
}
|
|
155
|
+
set loadSdtf(value) {
|
|
156
|
+
this._loadSdtf = value;
|
|
157
|
+
if (this._initialized === true && this._loadSdtf === true) {
|
|
158
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
this._outputLoader.reloadSdtf = true;
|
|
160
|
+
yield this.updateOutputs();
|
|
161
|
+
this._outputLoader.reloadSdtf = false;
|
|
162
|
+
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.SESSION.SESSION_SDTF_DELAYED_LOADED, { sessionId: this.id });
|
|
163
|
+
}))();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
149
166
|
get modelViewUrl() {
|
|
150
167
|
return this._modelViewUrl;
|
|
151
168
|
}
|
|
@@ -185,8 +202,8 @@ class SessionEngine {
|
|
|
185
202
|
get viewerSettings() {
|
|
186
203
|
return this._viewerSettings;
|
|
187
204
|
}
|
|
188
|
-
// #endregion Public
|
|
189
|
-
// #region Public Methods (
|
|
205
|
+
// #endregion Public Getters And Setters (26)
|
|
206
|
+
// #region Public Methods (30)
|
|
190
207
|
applySettings(response, sections) {
|
|
191
208
|
sections = sections || {};
|
|
192
209
|
if (sections.session === undefined) {
|
|
@@ -323,9 +340,9 @@ class SessionEngine {
|
|
|
323
340
|
if (__classPrivateFieldGet(this, _SessionEngine_customizationProcess, "f"))
|
|
324
341
|
this.removeBusyMode(__classPrivateFieldGet(this, _SessionEngine_customizationProcess, "f"));
|
|
325
342
|
for (const busyId of __classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f")) {
|
|
326
|
-
for (const r in this._stateEngine.
|
|
327
|
-
if (this._stateEngine.
|
|
328
|
-
this._stateEngine.
|
|
343
|
+
for (const r in this._stateEngine.viewportEngines) {
|
|
344
|
+
if (this._stateEngine.viewportEngines[r].busy.includes(busyId))
|
|
345
|
+
this._stateEngine.viewportEngines[r].busy.splice(this._stateEngine.viewportEngines[r].busy.indexOf(busyId), 1);
|
|
329
346
|
}
|
|
330
347
|
}
|
|
331
348
|
__classPrivateFieldSet(this, _SessionEngine_customizationBusyModes, [], "f");
|
|
@@ -375,24 +392,12 @@ class SessionEngine {
|
|
|
375
392
|
this.addBusyMode(customizationId);
|
|
376
393
|
const eventFileUpload = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.1, data: { sessionId: this.id }, status: 'Uploading file parameters' };
|
|
377
394
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventFileUpload);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
for (const parameterId in this.parameters) {
|
|
381
|
-
if (this.parameters[parameterId] instanceof FileParameter_1.FileParameter) {
|
|
382
|
-
fileParameterIds[parameterId] = yield this.parameters[parameterId].upload();
|
|
383
|
-
// OPTION TO SKIP - PART 1a
|
|
384
|
-
const cancelResult = this.cancelProcess(customizationId, eventId, viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, 1, { sessionId: this.id });
|
|
385
|
-
if (cancelResult)
|
|
386
|
-
return cancelResult;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
395
|
+
// upload file parameters
|
|
396
|
+
yield this.uploadFileParameters();
|
|
389
397
|
// OPTION TO SKIP - PART 1b
|
|
390
398
|
const cancelResult = this.cancelProcess(customizationId, eventId, viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, 1, { sessionId: this.id });
|
|
391
399
|
if (cancelResult)
|
|
392
400
|
return cancelResult;
|
|
393
|
-
// assign the uploaded parameters
|
|
394
|
-
for (const parameterId in fileParameterIds)
|
|
395
|
-
this.parameters[parameterId].value = fileParameterIds[parameterId];
|
|
396
401
|
const parameterSet = {};
|
|
397
402
|
// create a set of the current validated parameter values
|
|
398
403
|
for (const parameterId in this.parameters) {
|
|
@@ -470,9 +475,9 @@ class SessionEngine {
|
|
|
470
475
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
|
|
471
476
|
// update the viewports
|
|
472
477
|
if (waitForViewportUpdate) {
|
|
473
|
-
for (const r in this._stateEngine.
|
|
474
|
-
if (!this.excludeViewports.includes(this._stateEngine.
|
|
475
|
-
this._stateEngine.
|
|
478
|
+
for (const r in this._stateEngine.viewportEngines)
|
|
479
|
+
if (!this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
|
|
480
|
+
this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).customize`);
|
|
476
481
|
for (const outputId in this.outputs) {
|
|
477
482
|
if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
|
|
478
483
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
|
|
@@ -491,9 +496,9 @@ class SessionEngine {
|
|
|
491
496
|
}
|
|
492
497
|
if (!waitForViewportUpdate) {
|
|
493
498
|
setTimeout(() => {
|
|
494
|
-
for (const r in this._stateEngine.
|
|
495
|
-
if (!this.excludeViewports.includes(this._stateEngine.
|
|
496
|
-
this._stateEngine.
|
|
499
|
+
for (const r in this._stateEngine.viewportEngines)
|
|
500
|
+
if (!this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
|
|
501
|
+
this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).customize`);
|
|
497
502
|
}, 0);
|
|
498
503
|
}
|
|
499
504
|
return this.node;
|
|
@@ -511,10 +516,12 @@ class SessionEngine {
|
|
|
511
516
|
const eventId = this._uuidGenerator.create();
|
|
512
517
|
const eventStart = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0, data: { sessionId: this.id }, status: 'Customizing session' };
|
|
513
518
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
|
|
519
|
+
// upload file parameters
|
|
520
|
+
yield this.uploadFileParameters(parameterValues);
|
|
514
521
|
const parameterSet = {};
|
|
515
522
|
// create a set of the current validated parameter values
|
|
516
523
|
for (const parameterId in this.parameters)
|
|
517
|
-
parameterSet[parameterId] =
|
|
524
|
+
parameterSet[parameterId] = (' ' + this.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
|
|
518
525
|
const result = yield this.customizeSession(parameterSet, () => false, {
|
|
519
526
|
eventId,
|
|
520
527
|
type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
|
|
@@ -793,6 +800,7 @@ class SessionEngine {
|
|
|
793
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
794
801
|
this.checkAvailability('export');
|
|
795
802
|
try {
|
|
803
|
+
yield this.uploadFileParameters(parameters);
|
|
796
804
|
const requestParameterSet = this.cleanExportParameters(parameters);
|
|
797
805
|
const responseDto = yield this._sdk.utils.submitAndWaitForExport(this._sdk, this._sessionId, { exports: { id: exportId }, parameters: requestParameterSet }, maxWaitTime);
|
|
798
806
|
this.updateResponseDto(responseDto);
|
|
@@ -806,16 +814,28 @@ class SessionEngine {
|
|
|
806
814
|
}
|
|
807
815
|
requestExports(body, loadOutputs = false, maxWaitMsec, retry = false) {
|
|
808
816
|
return __awaiter(this, void 0, void 0, function* () {
|
|
817
|
+
let processId;
|
|
809
818
|
this.checkAvailability('export');
|
|
810
819
|
try {
|
|
820
|
+
// activate the busy mode if outputs are loaded
|
|
821
|
+
if (loadOutputs === true && this._allowOutputLoading === true &&
|
|
822
|
+
body.outputs && Object.keys(body.outputs).length > 0) {
|
|
823
|
+
processId = this._uuidGenerator.create();
|
|
824
|
+
this.addBusyMode(processId);
|
|
825
|
+
}
|
|
826
|
+
yield this.uploadFileParameters(body.parameters);
|
|
811
827
|
const requestParameterSet = this.cleanExportParameters(body.parameters);
|
|
812
828
|
const responseDto = yield this._sdk.utils.submitAndWaitForExport(this._sdk, this._sessionId, { exports: body.exports, parameters: requestParameterSet, outputs: body.outputs, max_wait_time: body.max_wait_time }, maxWaitMsec);
|
|
813
829
|
this.updateResponseDto(responseDto);
|
|
814
|
-
if (loadOutputs === true)
|
|
830
|
+
if (loadOutputs === true && this._allowOutputLoading === true)
|
|
815
831
|
this.updateOutputs();
|
|
832
|
+
if (processId)
|
|
833
|
+
this.removeBusyMode(processId);
|
|
816
834
|
return responseDto;
|
|
817
835
|
}
|
|
818
836
|
catch (e) {
|
|
837
|
+
if (processId)
|
|
838
|
+
this.removeBusyMode(processId);
|
|
819
839
|
yield this.handleError(e, retry);
|
|
820
840
|
return yield this.requestExports(body, loadOutputs, maxWaitMsec, true);
|
|
821
841
|
}
|
|
@@ -1080,9 +1100,9 @@ class SessionEngine {
|
|
|
1080
1100
|
}
|
|
1081
1101
|
// update the viewports
|
|
1082
1102
|
if (waitForViewportUpdate) {
|
|
1083
|
-
for (const r in this._stateEngine.
|
|
1084
|
-
if (!this.excludeViewports.includes(this._stateEngine.
|
|
1085
|
-
this._stateEngine.
|
|
1103
|
+
for (const r in this._stateEngine.viewportEngines)
|
|
1104
|
+
if (!this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
|
|
1105
|
+
this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).updateOutputs`);
|
|
1086
1106
|
for (const outputId in this.outputs) {
|
|
1087
1107
|
if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
|
|
1088
1108
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
|
|
@@ -1126,6 +1146,35 @@ class SessionEngine {
|
|
|
1126
1146
|
}
|
|
1127
1147
|
});
|
|
1128
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Uploads all file parameters and returns the file parameter values.
|
|
1151
|
+
* If parameterValues is provided, the file parameter values are added to it.
|
|
1152
|
+
*
|
|
1153
|
+
* @param parameterValues
|
|
1154
|
+
* @returns
|
|
1155
|
+
*/
|
|
1156
|
+
uploadFileParameters(parameterValues) {
|
|
1157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1158
|
+
const parameterValueSet = parameterValues !== undefined ? this.getFileParameterSet(parameterValues) : undefined;
|
|
1159
|
+
const fileParameterValues = {};
|
|
1160
|
+
// load file parameter first
|
|
1161
|
+
for (const parameterId in this.parameters) {
|
|
1162
|
+
if (this.parameters[parameterId] instanceof FileParameter_1.FileParameter) {
|
|
1163
|
+
fileParameterValues[parameterId] = yield this.parameters[parameterId].upload(parameterValueSet ? parameterValueSet[parameterId] : undefined);
|
|
1164
|
+
if (parameterValues) {
|
|
1165
|
+
parameterValues[parameterId] = fileParameterValues[parameterId];
|
|
1166
|
+
// if the parameter value of the file parameter was used, set the value to the parameter
|
|
1167
|
+
if (parameterValues[parameterId] === undefined && this.parameters[parameterId].value !== fileParameterValues[parameterId])
|
|
1168
|
+
this.parameters[parameterId].value = fileParameterValues[parameterId];
|
|
1169
|
+
}
|
|
1170
|
+
else if (this.parameters[parameterId].value !== fileParameterValues[parameterId]) {
|
|
1171
|
+
this.parameters[parameterId].value = fileParameterValues[parameterId];
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return fileParameterValues;
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1129
1178
|
uploadGLTF(blob, conversion = sdk_geometry_api_sdk_v2_1.ShapeDiverRequestGltfUploadQueryConversion.NONE, retry = false) {
|
|
1130
1179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1131
1180
|
this.checkAvailability('gltf-upload');
|
|
@@ -1141,8 +1190,8 @@ class SessionEngine {
|
|
|
1141
1190
|
}
|
|
1142
1191
|
});
|
|
1143
1192
|
}
|
|
1144
|
-
// #endregion Public Methods (
|
|
1145
|
-
// #region Private Methods (
|
|
1193
|
+
// #endregion Public Methods (30)
|
|
1194
|
+
// #region Private Methods (16)
|
|
1146
1195
|
_saveSessionSettings() {
|
|
1147
1196
|
const parameters = this.parameters;
|
|
1148
1197
|
const exports = this.exports;
|
|
@@ -1190,9 +1239,9 @@ class SessionEngine {
|
|
|
1190
1239
|
}
|
|
1191
1240
|
}
|
|
1192
1241
|
addBusyMode(busyId) {
|
|
1193
|
-
for (const r in this._stateEngine.
|
|
1242
|
+
for (const r in this._stateEngine.viewportEngines) {
|
|
1194
1243
|
if (!this.excludeViewports.includes(r)) {
|
|
1195
|
-
this._stateEngine.
|
|
1244
|
+
this._stateEngine.viewportEngines[r].busy.push(busyId);
|
|
1196
1245
|
__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").push(busyId);
|
|
1197
1246
|
}
|
|
1198
1247
|
}
|
|
@@ -1248,7 +1297,7 @@ class SessionEngine {
|
|
|
1248
1297
|
if (!parameterObject)
|
|
1249
1298
|
continue;
|
|
1250
1299
|
// copy into new dictionary
|
|
1251
|
-
requestParameterSet[parameterObject.id] = parameters[parameterIdOrName];
|
|
1300
|
+
requestParameterSet[parameterObject.id] = (' ' + parameterObject.stringify(parameters[parameterIdOrName])).slice(1);
|
|
1252
1301
|
}
|
|
1253
1302
|
// seconds step, fill all other parameter values that are currently not set
|
|
1254
1303
|
const currentParameters = this.parameterValues;
|
|
@@ -1273,7 +1322,7 @@ class SessionEngine {
|
|
|
1273
1322
|
this._performanceEvaluator.startSection('sessionResponse');
|
|
1274
1323
|
const responseDto = yield this._sdk.utils.submitAndWaitForCustomization(this._sdk, this._sessionId, parameters);
|
|
1275
1324
|
this._performanceEvaluator.endSection('sessionResponse');
|
|
1276
|
-
if (loadOutputs === true) {
|
|
1325
|
+
if (loadOutputs === true && this._allowOutputLoading === true) {
|
|
1277
1326
|
if (cancelRequest())
|
|
1278
1327
|
return new SessionTreeNode_1.SessionTreeNode();
|
|
1279
1328
|
if (parallel === true) {
|
|
@@ -1288,7 +1337,9 @@ class SessionEngine {
|
|
|
1288
1337
|
}
|
|
1289
1338
|
else {
|
|
1290
1339
|
// special case, we don't load the outputs and only return the responseDto
|
|
1291
|
-
|
|
1340
|
+
const node = new SessionTreeNode_1.SessionTreeNode();
|
|
1341
|
+
node.data.push(new SessionData_1.SessionData(responseDto));
|
|
1342
|
+
return node;
|
|
1292
1343
|
}
|
|
1293
1344
|
}
|
|
1294
1345
|
catch (e) {
|
|
@@ -1299,6 +1350,22 @@ class SessionEngine {
|
|
|
1299
1350
|
}
|
|
1300
1351
|
});
|
|
1301
1352
|
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Get all file parameters from the parameter set.
|
|
1355
|
+
* If the parameter is not set in the parameter set, the value from the parameter object is used.
|
|
1356
|
+
*
|
|
1357
|
+
* @param parameters
|
|
1358
|
+
* @returns
|
|
1359
|
+
*/
|
|
1360
|
+
getFileParameterSet(parameters) {
|
|
1361
|
+
const fileParameterSet = {};
|
|
1362
|
+
for (const parameterId in this.parameters) {
|
|
1363
|
+
if (this.parameters[parameterId] instanceof FileParameter_1.FileParameter) {
|
|
1364
|
+
fileParameterSet[parameterId] = parameters[parameterId] !== undefined ? parameters[parameterId] : this.parameters[parameterId].value;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
return fileParameterSet;
|
|
1368
|
+
}
|
|
1302
1369
|
handleError(e, retry = false) {
|
|
1303
1370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1304
1371
|
if ((0, sdk_geometry_api_sdk_v2_1.isGBResponseError)(e)) {
|
|
@@ -1366,9 +1433,9 @@ class SessionEngine {
|
|
|
1366
1433
|
});
|
|
1367
1434
|
}
|
|
1368
1435
|
removeBusyMode(busyId) {
|
|
1369
|
-
for (const r in this._stateEngine.
|
|
1370
|
-
if (this._stateEngine.
|
|
1371
|
-
this._stateEngine.
|
|
1436
|
+
for (const r in this._stateEngine.viewportEngines) {
|
|
1437
|
+
if (this._stateEngine.viewportEngines[r].busy.includes(busyId))
|
|
1438
|
+
this._stateEngine.viewportEngines[r].busy.splice(this._stateEngine.viewportEngines[r].busy.indexOf(busyId), 1);
|
|
1372
1439
|
if (__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").includes(busyId))
|
|
1373
1440
|
__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").splice(__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").indexOf(busyId), 1);
|
|
1374
1441
|
}
|
|
@@ -1422,16 +1489,16 @@ class SessionEngine {
|
|
|
1422
1489
|
continue;
|
|
1423
1490
|
this._responseDto.parameters[parameterId].id = parameterId;
|
|
1424
1491
|
switch (true) {
|
|
1425
|
-
case this._responseDto.parameters[parameterId].type ===
|
|
1492
|
+
case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.BOOL:
|
|
1426
1493
|
this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
|
|
1427
1494
|
break;
|
|
1428
|
-
case this._responseDto.parameters[parameterId].type ===
|
|
1495
|
+
case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.COLOR:
|
|
1429
1496
|
this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
|
|
1430
1497
|
break;
|
|
1431
|
-
case this._responseDto.parameters[parameterId].type ===
|
|
1498
|
+
case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.FILE:
|
|
1432
1499
|
this.parameters[parameterId] = new FileParameter_1.FileParameter(this._responseDto.parameters[parameterId], this);
|
|
1433
1500
|
break;
|
|
1434
|
-
case this._responseDto.parameters[parameterId].type ===
|
|
1501
|
+
case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.EVEN || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.FLOAT || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.INT || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.ODD:
|
|
1435
1502
|
this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
|
|
1436
1503
|
break;
|
|
1437
1504
|
default:
|