@shapediver/viewer.session-engine.session-engine 3.14.8 → 3.14.10
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/OutputLoader.d.ts.map +1 -1
- package/dist/implementation/OutputLoader.js +4 -0
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +0 -4
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionEngineCore.d.ts +49 -75
- package/dist/implementation/SessionEngineCore.d.ts.map +1 -1
- package/dist/implementation/SessionEngineCore.js +88 -265
- package/dist/implementation/SessionEngineCore.js.map +1 -1
- package/dist/implementation/SessionEngineFacade.d.ts +16 -11
- package/dist/implementation/SessionEngineFacade.d.ts.map +1 -1
- package/dist/implementation/SessionEngineFacade.js +19 -18
- package/dist/implementation/SessionEngineFacade.js.map +1 -1
- package/dist/implementation/managers/CustomizationManager.d.ts +41 -6
- package/dist/implementation/managers/CustomizationManager.d.ts.map +1 -1
- package/dist/implementation/managers/CustomizationManager.js +114 -56
- package/dist/implementation/managers/CustomizationManager.js.map +1 -1
- package/dist/implementation/managers/ExportManager.d.ts +49 -5
- package/dist/implementation/managers/ExportManager.d.ts.map +1 -1
- package/dist/implementation/managers/ExportManager.js +105 -42
- package/dist/implementation/managers/ExportManager.js.map +1 -1
- package/dist/implementation/managers/FileUploadManager.d.ts +41 -3
- package/dist/implementation/managers/FileUploadManager.d.ts.map +1 -1
- package/dist/implementation/managers/FileUploadManager.js +110 -67
- package/dist/implementation/managers/FileUploadManager.js.map +1 -1
- package/dist/implementation/managers/ModelStateManager.d.ts +42 -4
- package/dist/implementation/managers/ModelStateManager.d.ts.map +1 -1
- package/dist/implementation/managers/ModelStateManager.js +71 -24
- package/dist/implementation/managers/ModelStateManager.js.map +1 -1
- package/dist/implementation/managers/OutputManager.d.ts +48 -10
- package/dist/implementation/managers/OutputManager.d.ts.map +1 -1
- package/dist/implementation/managers/OutputManager.js +144 -84
- package/dist/implementation/managers/OutputManager.js.map +1 -1
- package/dist/implementation/managers/ParameterManager.d.ts +51 -4
- package/dist/implementation/managers/ParameterManager.d.ts.map +1 -1
- package/dist/implementation/managers/ParameterManager.js +164 -13
- package/dist/implementation/managers/ParameterManager.js.map +1 -1
- package/dist/implementation/managers/SettingsManager.d.ts +27 -2
- package/dist/implementation/managers/SettingsManager.d.ts.map +1 -1
- package/dist/implementation/managers/SettingsManager.js +120 -74
- package/dist/implementation/managers/SettingsManager.js.map +1 -1
- package/dist/implementation/managers/UtilsManager.d.ts +79 -17
- package/dist/implementation/managers/UtilsManager.d.ts.map +1 -1
- package/dist/implementation/managers/UtilsManager.js +187 -126
- package/dist/implementation/managers/UtilsManager.js.map +1 -1
- package/package.json +8 -8
|
@@ -12,23 +12,177 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ParameterManager = void 0;
|
|
13
13
|
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
14
14
|
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
15
|
+
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
16
|
+
const DrawingParameter_1 = require("../dto/DrawingParameter");
|
|
17
|
+
const FileParameter_1 = require("../dto/FileParameter");
|
|
18
|
+
const Parameter_1 = require("../dto/Parameter");
|
|
19
|
+
/**
|
|
20
|
+
* Manager responsible for parameters.
|
|
21
|
+
*
|
|
22
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
23
|
+
* via the `parameterManager` property.
|
|
24
|
+
*/
|
|
15
25
|
class ParameterManager {
|
|
16
26
|
constructor(sessionEngineCore) {
|
|
17
27
|
this._logger = viewer_shared_services_1.Logger.instance;
|
|
18
|
-
this.
|
|
28
|
+
this._parameterValues = {};
|
|
29
|
+
this._parameters = {};
|
|
19
30
|
this._parameterHistory = [];
|
|
31
|
+
this._parameterHistoryCall = false;
|
|
20
32
|
this._parameterHistoryForward = [];
|
|
21
33
|
this._sessionEngineCore = sessionEngineCore;
|
|
22
34
|
}
|
|
23
|
-
get
|
|
24
|
-
return this.
|
|
35
|
+
get ignoreUnknownParams() {
|
|
36
|
+
return this._ignoreUnknownParams;
|
|
37
|
+
}
|
|
38
|
+
set ignoreUnknownParams(value) {
|
|
39
|
+
this._ignoreUnknownParams = value;
|
|
25
40
|
}
|
|
26
41
|
get parameterHistory() {
|
|
27
42
|
return this._parameterHistory;
|
|
28
43
|
}
|
|
44
|
+
get parameterHistoryCall() {
|
|
45
|
+
return this._parameterHistoryCall;
|
|
46
|
+
}
|
|
29
47
|
set parameterHistoryForward(value) {
|
|
30
48
|
this._parameterHistoryForward = value;
|
|
31
49
|
}
|
|
50
|
+
get parameterValues() {
|
|
51
|
+
return this._parameterValues;
|
|
52
|
+
}
|
|
53
|
+
get parameters() {
|
|
54
|
+
return this._parameters;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks whether it is possible to go back in the parameter history.
|
|
58
|
+
*
|
|
59
|
+
* @returns True if it is possible to go back, false otherwise.
|
|
60
|
+
*/
|
|
61
|
+
canGoBack() {
|
|
62
|
+
// the first entry is always the one from the init call
|
|
63
|
+
// all additional entries can be undone
|
|
64
|
+
return this._parameterHistory.length > 1;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether it is possible to go forward in the parameter history.
|
|
68
|
+
*
|
|
69
|
+
* @returns True if it is possible to go forward, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
canGoForward() {
|
|
72
|
+
return this._parameterHistoryForward.length > 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates parameters from the session engine's response DTO.
|
|
76
|
+
*
|
|
77
|
+
* @param initialParameters
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
createParametersFromDto(initialParameters) {
|
|
81
|
+
if (!this._sessionEngineCore.responseDto)
|
|
82
|
+
return;
|
|
83
|
+
const parameterSet = {};
|
|
84
|
+
for (const parameterId in this._sessionEngineCore.responseDto
|
|
85
|
+
.parameters) {
|
|
86
|
+
if (this.parameters[parameterId])
|
|
87
|
+
continue;
|
|
88
|
+
this._sessionEngineCore.responseDto.parameters[parameterId].id =
|
|
89
|
+
parameterId;
|
|
90
|
+
switch (true) {
|
|
91
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
92
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.BOOL:
|
|
93
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
94
|
+
break;
|
|
95
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
96
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.COLOR:
|
|
97
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
98
|
+
break;
|
|
99
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
100
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.FILE:
|
|
101
|
+
this.parameters[parameterId] = new FileParameter_1.FileParameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
102
|
+
break;
|
|
103
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
104
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.EVEN ||
|
|
105
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
106
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.FLOAT ||
|
|
107
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
108
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.INT ||
|
|
109
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
110
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.ODD:
|
|
111
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
112
|
+
break;
|
|
113
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
114
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.INTERACTION:
|
|
115
|
+
this.parameters[parameterId] =
|
|
116
|
+
this._sessionEngineCore.utilsManager.createInteractionParameter(this._sessionEngineCore.responseDto.parameters[parameterId]);
|
|
117
|
+
break;
|
|
118
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
119
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.DRAWING:
|
|
120
|
+
this.parameters[parameterId] = new DrawingParameter_1.DrawingParameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
// we don't have to do larger restrictions for this as the backend would have already thrown an error if the values were not correct
|
|
127
|
+
if (initialParameters) {
|
|
128
|
+
let hasInitialValue = false;
|
|
129
|
+
// check if the id is within the initial parameters
|
|
130
|
+
if (initialParameters[parameterId] !== undefined) {
|
|
131
|
+
this.parameters[parameterId].value =
|
|
132
|
+
initialParameters[parameterId];
|
|
133
|
+
hasInitialValue = true;
|
|
134
|
+
}
|
|
135
|
+
// check if the name is within the initial parameters
|
|
136
|
+
else if (initialParameters[this.parameters[parameterId].name] !==
|
|
137
|
+
undefined) {
|
|
138
|
+
this.parameters[parameterId].value =
|
|
139
|
+
initialParameters[this.parameters[parameterId].name];
|
|
140
|
+
hasInitialValue = true;
|
|
141
|
+
}
|
|
142
|
+
// check if the displayname is within the initial parameters
|
|
143
|
+
else if (this.parameters[parameterId].displayname &&
|
|
144
|
+
initialParameters[this.parameters[parameterId].displayname] !== undefined) {
|
|
145
|
+
this.parameters[parameterId].value =
|
|
146
|
+
initialParameters[this.parameters[parameterId].displayname];
|
|
147
|
+
hasInitialValue = true;
|
|
148
|
+
}
|
|
149
|
+
// if there is an initial value, we try to cast it to the correct type
|
|
150
|
+
// we only do this for bool and number types, as the other types are either string or have their own parsing
|
|
151
|
+
if (hasInitialValue) {
|
|
152
|
+
if (this.parameters[parameterId].type ===
|
|
153
|
+
viewer_shared_types_1.PARAMETER_TYPE.BOOL) {
|
|
154
|
+
// cast to boolean
|
|
155
|
+
this.parameters[parameterId].value = Boolean(this.parameters[parameterId].value);
|
|
156
|
+
}
|
|
157
|
+
else if (this.parameters[parameterId].type ===
|
|
158
|
+
viewer_shared_types_1.PARAMETER_TYPE.INT ||
|
|
159
|
+
this.parameters[parameterId].type ===
|
|
160
|
+
viewer_shared_types_1.PARAMETER_TYPE.FLOAT ||
|
|
161
|
+
this.parameters[parameterId].type ===
|
|
162
|
+
viewer_shared_types_1.PARAMETER_TYPE.EVEN ||
|
|
163
|
+
this.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.ODD) {
|
|
164
|
+
// cast to number
|
|
165
|
+
this.parameters[parameterId].value = Number(this.parameters[parameterId].value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
parameterSet[parameterId] = {
|
|
170
|
+
value: this.parameters[parameterId].value,
|
|
171
|
+
valueString: this.parameters[parameterId].stringify(),
|
|
172
|
+
};
|
|
173
|
+
if (!this._sessionEngineCore.initialized)
|
|
174
|
+
this.parameterValues[parameterId] =
|
|
175
|
+
parameterSet[parameterId].valueString;
|
|
176
|
+
}
|
|
177
|
+
// store the initialization as the first parameter set in the history
|
|
178
|
+
if (!this._sessionEngineCore.initialized)
|
|
179
|
+
this.parameterHistory.push(parameterSet);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Goes one step back in the parameter history and applies the parameter values.
|
|
183
|
+
*
|
|
184
|
+
* @returns The tree node returned by the customization function.
|
|
185
|
+
*/
|
|
32
186
|
goBack() {
|
|
33
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
188
|
if (!this.canGoBack()) {
|
|
@@ -40,7 +194,7 @@ class ParameterManager {
|
|
|
40
194
|
// adjust the parameters according to the last parameter set
|
|
41
195
|
const lastParameterSet = this._parameterHistory[this._parameterHistory.length - 1];
|
|
42
196
|
for (const parameterId in lastParameterSet)
|
|
43
|
-
this.
|
|
197
|
+
this.parameters[parameterId].value =
|
|
44
198
|
lastParameterSet[parameterId].value;
|
|
45
199
|
// call the customization function with the parameterHistoryCall value set to true
|
|
46
200
|
this._parameterHistoryCall = true;
|
|
@@ -51,6 +205,11 @@ class ParameterManager {
|
|
|
51
205
|
return node;
|
|
52
206
|
});
|
|
53
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Goes one step forward in the parameter history and applies the parameter values.
|
|
210
|
+
*
|
|
211
|
+
* @returns The tree node returned by the customization function.
|
|
212
|
+
*/
|
|
54
213
|
goForward() {
|
|
55
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
215
|
if (!this.canGoForward()) {
|
|
@@ -60,7 +219,7 @@ class ParameterManager {
|
|
|
60
219
|
// get the last undone parameter set and apply the values to the parameters
|
|
61
220
|
const lastParameterSet = this._parameterHistoryForward.pop();
|
|
62
221
|
for (const parameterId in lastParameterSet)
|
|
63
|
-
this.
|
|
222
|
+
this.parameters[parameterId].value =
|
|
64
223
|
lastParameterSet[parameterId].value;
|
|
65
224
|
// call the customization function with the parameterHistoryCall value set to true
|
|
66
225
|
this._parameterHistoryCall = true;
|
|
@@ -71,14 +230,6 @@ class ParameterManager {
|
|
|
71
230
|
return node;
|
|
72
231
|
});
|
|
73
232
|
}
|
|
74
|
-
canGoBack() {
|
|
75
|
-
// the first entry is always the one from the init call
|
|
76
|
-
// all additional entries can be undone
|
|
77
|
-
return this._parameterHistory.length > 1;
|
|
78
|
-
}
|
|
79
|
-
canGoForward() {
|
|
80
|
-
return this._parameterHistoryForward.length > 0;
|
|
81
|
-
}
|
|
82
233
|
}
|
|
83
234
|
exports.ParameterManager = ParameterManager;
|
|
84
235
|
//# sourceMappingURL=ParameterManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterManager.js","sourceRoot":"","sources":["../../../src/implementation/managers/ParameterManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAAwE;AACxE,+EAA0D;
|
|
1
|
+
{"version":3,"file":"ParameterManager.js","sourceRoot":"","sources":["../../../src/implementation/managers/ParameterManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAAwE;AACxE,+EAA0D;AAC1D,yEAA+D;AAK/D,8DAAyD;AACzD,wDAAmD;AACnD,gDAA2C;AAG3C;;;;;GAKG;AACH,MAAa,gBAAgB;IAqB5B,YAAY,iBAAoC;QApB/B,YAAO,GAAG,+BAAM,CAAC,QAAQ,CAAC;QAC1B,qBAAgB,GAA4B,EAAE,CAAC;QAC/C,gBAAW,GAAyC,EAAE,CAAC;QAIhE,sBAAiB,GAKnB,EAAE,CAAC;QACD,0BAAqB,GAAG,KAAK,CAAC;QAC9B,6BAAwB,GAK1B,EAAE,CAAC;QAGR,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IAClC,CAAC;IAED,IAAW,mBAAmB,CAAC,KAA0B;QACxD,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACnC,CAAC;IAED,IAAW,gBAAgB;QAM1B,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAED,IAAW,oBAAoB;QAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,CAAC;IAED,IAAW,uBAAuB,CACjC,KAKG;QAEH,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;IACvC,CAAC;IAED,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAED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C;QACb,CAAC;KAAA;IAED;;;;OAIG;IACU,SAAS;;YACrB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CACjB,WAAW,IAAI,CAAC,kBAAkB,CAAC,EAAE,yCAAyC,CAC9E,CAAC;gBACF,OAAO,IAAI,kCAAQ,EAAE,CAAC;aACtB;YACD,2EAA2E;YAC3E,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAG,CAAC;YAC9D,KAAK,MAAM,WAAW,IAAI,gBAAgB;gBACzC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,KAAK;oBACjC,gBAAgB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC;YAEtC,kFAAkF;YAClF,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;YAClC,MAAM,IAAI,GACT,MAAM,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;YAChE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;YAEnC,+CAA+C;YAC/C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;QACb,CAAC;KAAA;CACD;AAnUD,4CAmUC"}
|
|
@@ -2,6 +2,12 @@ import { ResBase } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
|
2
2
|
import { SettingsEngine } from "@shapediver/viewer.shared.services";
|
|
3
3
|
import { ISettingsSections } from "@shapediver/viewer.shared.types";
|
|
4
4
|
import { SessionEngineCore } from "../SessionEngineCore";
|
|
5
|
+
/**
|
|
6
|
+
* Manager responsible for settings.
|
|
7
|
+
*
|
|
8
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
9
|
+
* via the `settingsManager` property.
|
|
10
|
+
*/
|
|
5
11
|
export declare class SettingsManager {
|
|
6
12
|
private readonly _logger;
|
|
7
13
|
private readonly _sessionEngineCore;
|
|
@@ -9,16 +15,25 @@ export declare class SettingsManager {
|
|
|
9
15
|
private _viewerSettings?;
|
|
10
16
|
private _viewerSettingsVersion;
|
|
11
17
|
private _viewerSettingsVersionBackend;
|
|
12
|
-
private readonly _utilsManager;
|
|
13
18
|
constructor(sessionEngineCore: SessionEngineCore);
|
|
14
19
|
get hasStoredSettings(): boolean;
|
|
15
20
|
get settingsEngine(): SettingsEngine;
|
|
16
21
|
get viewerSettings(): object | undefined;
|
|
17
22
|
set viewerSettings(value: object | undefined);
|
|
18
23
|
set viewerSettingsVersionBackend(value: string);
|
|
19
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Apply settings from the response to the session engine.
|
|
26
|
+
*/
|
|
20
27
|
applySettings(response: ResBase, sections?: ISettingsSections): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reset settings to the default values from the model.
|
|
30
|
+
*
|
|
31
|
+
* @param sections Sections to reset
|
|
32
|
+
*/
|
|
21
33
|
resetSettings(sections?: ISettingsSections): void;
|
|
34
|
+
/**
|
|
35
|
+
* Save the default parameter values
|
|
36
|
+
*/
|
|
22
37
|
saveDefaultParameterValues(): Promise<boolean>;
|
|
23
38
|
/**
|
|
24
39
|
* Save the default parameter values
|
|
@@ -50,6 +65,16 @@ export declare class SettingsManager {
|
|
|
50
65
|
* @returns
|
|
51
66
|
*/
|
|
52
67
|
saveSettings(json: unknown, retry?: boolean): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Save UI related properties for parameters, exports and outputs
|
|
70
|
+
*
|
|
71
|
+
* @param saveInSettings Whether to save the properties in the settings as well
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
53
74
|
saveUiProperties(saveInSettings?: boolean): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Save the session settings for parameters and exports
|
|
77
|
+
*/
|
|
78
|
+
private saveSessionSettings;
|
|
54
79
|
}
|
|
55
80
|
//# sourceMappingURL=SettingsManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../src/implementation/managers/SettingsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,OAAO,EACP,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EAEN,cAAc,EAGd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../src/implementation/managers/SettingsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,OAAO,EACP,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EAEN,cAAc,EAGd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IAExE,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,6BAA6B,CAAyB;gBAElD,iBAAiB,EAAE,iBAAiB;IAIhD,IAAW,iBAAiB,IAAI,OAAO,CAEtC;IAED,IAAW,cAAc,IAAI,cAAc,CAE1C;IAED,IAAW,cAAc,IAAI,MAAM,GAAG,SAAS,CAE9C;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAElD;IAED,IAAW,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAEpD;IAED;;OAEG;IACI,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,iBAAiB;IA2OpE;;;;OAIG;IACI,aAAa,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI;IA2CxD;;OAEG;IACU,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB3D;;;;;OAKG;IACU,qBAAqB,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBnE;;;;;;OAMG;IACU,uBAAuB,CACnC,UAAU,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,MAAM,EAAE,OAAO,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;SAChB,CAAC;KACF,EACD,KAAK,UAAQ,GACX,OAAO,CAAC,OAAO,CAAC;IAmBnB;;;;;;OAMG;IACU,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAyCzE;;;;;OAKG;IACU,gBAAgB,CAC5B,cAAc,GAAE,OAAc,GAC5B,OAAO,CAAC,OAAO,CAAC;IA0InB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CA2B3B"}
|
|
@@ -14,6 +14,12 @@ const sdk_geometry_api_sdk_v2_1 = require("@shapediver/sdk.geometry-api-sdk-v2")
|
|
|
14
14
|
const viewer_settings_1 = require("@shapediver/viewer.settings");
|
|
15
15
|
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
16
16
|
const FileParameter_1 = require("../dto/FileParameter");
|
|
17
|
+
/**
|
|
18
|
+
* Manager responsible for settings.
|
|
19
|
+
*
|
|
20
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
21
|
+
* via the `settingsManager` property.
|
|
22
|
+
*/
|
|
17
23
|
class SettingsManager {
|
|
18
24
|
constructor(sessionEngineCore) {
|
|
19
25
|
this._logger = viewer_shared_services_1.Logger.instance;
|
|
@@ -21,7 +27,6 @@ class SettingsManager {
|
|
|
21
27
|
this._viewerSettingsVersion = viewer_settings_1.latestVersion;
|
|
22
28
|
this._viewerSettingsVersionBackend = viewer_settings_1.latestVersion;
|
|
23
29
|
this._sessionEngineCore = sessionEngineCore;
|
|
24
|
-
this._utilsManager = this._sessionEngineCore.utilsManager;
|
|
25
30
|
}
|
|
26
31
|
get hasStoredSettings() {
|
|
27
32
|
return this._settingsEngine.hasStoredSettings;
|
|
@@ -38,26 +43,9 @@ class SettingsManager {
|
|
|
38
43
|
set viewerSettingsVersionBackend(value) {
|
|
39
44
|
this._viewerSettingsVersionBackend = value;
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const sessionProperties = {};
|
|
45
|
-
for (const p in parameters) {
|
|
46
|
-
sessionProperties[p] = {
|
|
47
|
-
order: parameters[p].order || 0,
|
|
48
|
-
displayname: parameters[p].displayname || "",
|
|
49
|
-
hidden: parameters[p].hidden,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
for (const e in exports) {
|
|
53
|
-
sessionProperties[e] = {
|
|
54
|
-
order: exports[e].order || 0,
|
|
55
|
-
displayname: exports[e].displayname || "",
|
|
56
|
-
hidden: exports[e].hidden,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
this._settingsEngine.session = sessionProperties;
|
|
60
|
-
}
|
|
46
|
+
/**
|
|
47
|
+
* Apply settings from the response to the session engine.
|
|
48
|
+
*/
|
|
61
49
|
applySettings(response, sections) {
|
|
62
50
|
sections = sections || {};
|
|
63
51
|
if (sections.session === undefined) {
|
|
@@ -118,28 +106,26 @@ class SettingsManager {
|
|
|
118
106
|
sections.session.parameter.order ||
|
|
119
107
|
sections.session.parameter.hidden ||
|
|
120
108
|
sections.session.parameter.value) {
|
|
121
|
-
for (const p in this._sessionEngineCore.
|
|
109
|
+
for (const p in this._sessionEngineCore.parameterManager
|
|
110
|
+
.parameters) {
|
|
122
111
|
if (settings.session[p]) {
|
|
123
112
|
if (sections.session.parameter.displayname)
|
|
124
|
-
this._sessionEngineCore.parameters[p].displayname =
|
|
125
|
-
settings.session[p].displayname;
|
|
113
|
+
this._sessionEngineCore.parameterManager.parameters[p].displayname = settings.session[p].displayname;
|
|
126
114
|
if (sections.session.parameter.order)
|
|
127
|
-
this._sessionEngineCore.parameters[p].order =
|
|
128
|
-
settings.session[p].order;
|
|
115
|
+
this._sessionEngineCore.parameterManager.parameters[p].order = settings.session[p].order;
|
|
129
116
|
if (sections.session.parameter.hidden)
|
|
130
|
-
this._sessionEngineCore.parameters[p].hidden =
|
|
131
|
-
settings.session[p].hidden || false;
|
|
117
|
+
this._sessionEngineCore.parameterManager.parameters[p].hidden = settings.session[p].hidden || false;
|
|
132
118
|
}
|
|
133
119
|
if (response.parameters &&
|
|
134
120
|
response.parameters[p] &&
|
|
135
|
-
!(this._sessionEngineCore.parameters[p] instanceof
|
|
136
|
-
|
|
137
|
-
this._sessionEngineCore.parameters[p].type.startsWith("s"))) {
|
|
121
|
+
!(this._sessionEngineCore.parameterManager.parameters[p] instanceof FileParameter_1.FileParameter ||
|
|
122
|
+
this._sessionEngineCore.parameterManager.parameters[p].type.startsWith("s"))) {
|
|
138
123
|
if (sections.session.parameter.value)
|
|
139
|
-
this._sessionEngineCore.parameters[p].value =
|
|
124
|
+
this._sessionEngineCore.parameterManager.parameters[p].value =
|
|
140
125
|
response.parameters[p].defval !== undefined
|
|
141
126
|
? response.parameters[p].defval
|
|
142
|
-
: this._sessionEngineCore.
|
|
127
|
+
: this._sessionEngineCore.parameterManager
|
|
128
|
+
.parameters[p].value;
|
|
143
129
|
}
|
|
144
130
|
}
|
|
145
131
|
}
|
|
@@ -147,13 +133,13 @@ class SettingsManager {
|
|
|
147
133
|
if (sections.session.export.displayname ||
|
|
148
134
|
sections.session.export.order ||
|
|
149
135
|
sections.session.export.hidden) {
|
|
150
|
-
for (const p in this._sessionEngineCore.exports) {
|
|
136
|
+
for (const p in this._sessionEngineCore.exportManager.exports) {
|
|
151
137
|
let idForSettings = "";
|
|
152
138
|
if (settings.session[p]) {
|
|
153
139
|
idForSettings = p;
|
|
154
140
|
}
|
|
155
141
|
else {
|
|
156
|
-
const uid = this._sessionEngineCore.exports[p].uid;
|
|
142
|
+
const uid = this._sessionEngineCore.exportManager.exports[p].uid;
|
|
157
143
|
if (!uid)
|
|
158
144
|
continue;
|
|
159
145
|
if (!exportMappingUid[uid])
|
|
@@ -162,13 +148,13 @@ class SettingsManager {
|
|
|
162
148
|
}
|
|
163
149
|
if (settings.session[idForSettings]) {
|
|
164
150
|
if (sections.session.export.displayname)
|
|
165
|
-
this._sessionEngineCore.exports[p].displayname =
|
|
151
|
+
this._sessionEngineCore.exportManager.exports[p].displayname =
|
|
166
152
|
settings.session[idForSettings].displayname;
|
|
167
153
|
if (sections.session.export.order)
|
|
168
|
-
this._sessionEngineCore.exports[p].order =
|
|
154
|
+
this._sessionEngineCore.exportManager.exports[p].order =
|
|
169
155
|
settings.session[idForSettings].order;
|
|
170
156
|
if (sections.session.export.hidden)
|
|
171
|
-
this._sessionEngineCore.exports[p].hidden =
|
|
157
|
+
this._sessionEngineCore.exportManager.exports[p].hidden =
|
|
172
158
|
settings.session[idForSettings].hidden || false;
|
|
173
159
|
}
|
|
174
160
|
}
|
|
@@ -253,6 +239,11 @@ class SettingsManager {
|
|
|
253
239
|
settings.environment.intensity;
|
|
254
240
|
}
|
|
255
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Reset settings to the default values from the model.
|
|
244
|
+
*
|
|
245
|
+
* @param sections Sections to reset
|
|
246
|
+
*/
|
|
256
247
|
resetSettings(sections) {
|
|
257
248
|
if (!this._sessionEngineCore.responseDto)
|
|
258
249
|
throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.resetSettings: responseDto not available.");
|
|
@@ -288,6 +279,9 @@ class SettingsManager {
|
|
|
288
279
|
};
|
|
289
280
|
return this.applySettings(this._sessionEngineCore.responseDto, sections);
|
|
290
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Save the default parameter values
|
|
284
|
+
*/
|
|
291
285
|
saveDefaultParameterValues() {
|
|
292
286
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
287
|
this._logger.debugLow(`Session(${this._sessionEngineCore.id}).saveDefaultParameters: Saving default parameters.`);
|
|
@@ -309,13 +303,13 @@ class SettingsManager {
|
|
|
309
303
|
*/
|
|
310
304
|
saveDefaultParameters(retry = false) {
|
|
311
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
-
this.
|
|
306
|
+
this._sessionEngineCore.utilsManager.checkAvailability("defaultparam", true);
|
|
313
307
|
try {
|
|
314
|
-
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sessionEngineCore.sdkConfig).updateParameterDefaultValues(this._sessionEngineCore.modelId, this._sessionEngineCore.parameterValues);
|
|
308
|
+
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sessionEngineCore.sdkConfig).updateParameterDefaultValues(this._sessionEngineCore.modelId, this._sessionEngineCore.parameterManager.parameterValues);
|
|
315
309
|
return true;
|
|
316
310
|
}
|
|
317
311
|
catch (e) {
|
|
318
|
-
yield this.
|
|
312
|
+
yield this._sessionEngineCore.utilsManager.handleError(e, retry);
|
|
319
313
|
return yield this.saveDefaultParameters(true);
|
|
320
314
|
}
|
|
321
315
|
});
|
|
@@ -329,13 +323,13 @@ class SettingsManager {
|
|
|
329
323
|
*/
|
|
330
324
|
saveParameterProperties(parameters, retry = false) {
|
|
331
325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
-
this.
|
|
326
|
+
this._sessionEngineCore.utilsManager.checkAvailability("parameter-definition", true);
|
|
333
327
|
try {
|
|
334
328
|
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sessionEngineCore.sdkConfig).updateParameterDefinitions(this._sessionEngineCore.modelId, parameters);
|
|
335
329
|
return true;
|
|
336
330
|
}
|
|
337
331
|
catch (e) {
|
|
338
|
-
yield this.
|
|
332
|
+
yield this._sessionEngineCore.utilsManager.handleError(e, retry);
|
|
339
333
|
return yield this.saveParameterProperties(parameters, true);
|
|
340
334
|
}
|
|
341
335
|
});
|
|
@@ -349,7 +343,7 @@ class SettingsManager {
|
|
|
349
343
|
*/
|
|
350
344
|
saveSettings(json, retry = false) {
|
|
351
345
|
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
-
this.
|
|
346
|
+
this._sessionEngineCore.utilsManager.checkAvailability("configure", true);
|
|
353
347
|
try {
|
|
354
348
|
(0, viewer_settings_1.validate)(json, this._viewerSettingsVersion);
|
|
355
349
|
// if viewer settings version is higher than backend settings version
|
|
@@ -367,31 +361,44 @@ class SettingsManager {
|
|
|
367
361
|
return true;
|
|
368
362
|
}
|
|
369
363
|
catch (e) {
|
|
370
|
-
yield this.
|
|
364
|
+
yield this._sessionEngineCore.utilsManager.handleError(e, retry);
|
|
371
365
|
return yield this.saveSettings(json, true);
|
|
372
366
|
}
|
|
373
367
|
});
|
|
374
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Save UI related properties for parameters, exports and outputs
|
|
371
|
+
*
|
|
372
|
+
* @param saveInSettings Whether to save the properties in the settings as well
|
|
373
|
+
* @returns
|
|
374
|
+
*/
|
|
375
375
|
saveUiProperties(saveInSettings = true) {
|
|
376
376
|
return __awaiter(this, void 0, void 0, function* () {
|
|
377
377
|
this._logger.debugLow(`Session(${this._sessionEngineCore.id}).saveSessionProperties: Saving session properties.`);
|
|
378
378
|
// settings saving
|
|
379
|
-
this.
|
|
379
|
+
this.saveSessionSettings();
|
|
380
380
|
let properties = {};
|
|
381
|
-
for (const p in this._sessionEngineCore.parameters) {
|
|
381
|
+
for (const p in this._sessionEngineCore.parameterManager.parameters) {
|
|
382
382
|
properties[p] = {
|
|
383
|
-
displayname: this._sessionEngineCore.parameters[p]
|
|
384
|
-
undefined
|
|
385
|
-
? this._sessionEngineCore.parameters[p]
|
|
383
|
+
displayname: this._sessionEngineCore.parameterManager.parameters[p]
|
|
384
|
+
.displayname !== undefined
|
|
385
|
+
? this._sessionEngineCore.parameterManager.parameters[p]
|
|
386
|
+
.displayname
|
|
386
387
|
: "",
|
|
387
|
-
hidden: this._sessionEngineCore.parameters[p]
|
|
388
|
-
|
|
388
|
+
hidden: this._sessionEngineCore.parameterManager.parameters[p]
|
|
389
|
+
.hidden !== undefined
|
|
390
|
+
? this._sessionEngineCore.parameterManager.parameters[p]
|
|
391
|
+
.hidden
|
|
389
392
|
: false,
|
|
390
|
-
order: this._sessionEngineCore.parameters[p]
|
|
391
|
-
|
|
393
|
+
order: this._sessionEngineCore.parameterManager.parameters[p]
|
|
394
|
+
.order !== undefined
|
|
395
|
+
? this._sessionEngineCore.parameterManager.parameters[p]
|
|
396
|
+
.order
|
|
392
397
|
: 0,
|
|
393
|
-
tooltip: this._sessionEngineCore.parameters[p]
|
|
394
|
-
|
|
398
|
+
tooltip: this._sessionEngineCore.parameterManager.parameters[p]
|
|
399
|
+
.tooltip !== undefined
|
|
400
|
+
? this._sessionEngineCore.parameterManager.parameters[p]
|
|
401
|
+
.tooltip
|
|
395
402
|
: "",
|
|
396
403
|
};
|
|
397
404
|
}
|
|
@@ -399,19 +406,27 @@ class SettingsManager {
|
|
|
399
406
|
? yield this.saveParameterProperties(properties)
|
|
400
407
|
: true;
|
|
401
408
|
properties = {};
|
|
402
|
-
for (const e in this._sessionEngineCore.exports) {
|
|
409
|
+
for (const e in this._sessionEngineCore.exportManager.exports) {
|
|
403
410
|
properties[e] = {
|
|
404
|
-
displayname: this._sessionEngineCore.exports[e]
|
|
405
|
-
|
|
411
|
+
displayname: this._sessionEngineCore.exportManager.exports[e]
|
|
412
|
+
.displayname !== undefined
|
|
413
|
+
? this._sessionEngineCore.exportManager.exports[e]
|
|
414
|
+
.displayname
|
|
406
415
|
: "",
|
|
407
|
-
hidden: this._sessionEngineCore.exports[e].hidden !==
|
|
408
|
-
|
|
416
|
+
hidden: this._sessionEngineCore.exportManager.exports[e].hidden !==
|
|
417
|
+
undefined
|
|
418
|
+
? this._sessionEngineCore.exportManager.exports[e]
|
|
419
|
+
.hidden
|
|
409
420
|
: false,
|
|
410
|
-
order: this._sessionEngineCore.exports[e].order !==
|
|
411
|
-
|
|
421
|
+
order: this._sessionEngineCore.exportManager.exports[e].order !==
|
|
422
|
+
undefined
|
|
423
|
+
? this._sessionEngineCore.exportManager.exports[e]
|
|
424
|
+
.order
|
|
412
425
|
: 0,
|
|
413
|
-
tooltip: this._sessionEngineCore.exports[e].tooltip !==
|
|
414
|
-
|
|
426
|
+
tooltip: this._sessionEngineCore.exportManager.exports[e].tooltip !==
|
|
427
|
+
undefined
|
|
428
|
+
? this._sessionEngineCore.exportManager.exports[e]
|
|
429
|
+
.tooltip
|
|
415
430
|
: "",
|
|
416
431
|
};
|
|
417
432
|
}
|
|
@@ -419,19 +434,27 @@ class SettingsManager {
|
|
|
419
434
|
? yield this._sessionEngineCore.exportManager.saveExportProperties(properties)
|
|
420
435
|
: true;
|
|
421
436
|
properties = {};
|
|
422
|
-
for (const o in this._sessionEngineCore.outputs) {
|
|
437
|
+
for (const o in this._sessionEngineCore.outputManager.outputs) {
|
|
423
438
|
properties[o] = {
|
|
424
|
-
displayname: this._sessionEngineCore.outputs[o]
|
|
425
|
-
|
|
439
|
+
displayname: this._sessionEngineCore.outputManager.outputs[o]
|
|
440
|
+
.displayname !== undefined
|
|
441
|
+
? this._sessionEngineCore.outputManager.outputs[o]
|
|
442
|
+
.displayname
|
|
426
443
|
: "",
|
|
427
|
-
hidden: this._sessionEngineCore.outputs[o].hidden !==
|
|
428
|
-
|
|
444
|
+
hidden: this._sessionEngineCore.outputManager.outputs[o].hidden !==
|
|
445
|
+
undefined
|
|
446
|
+
? this._sessionEngineCore.outputManager.outputs[o]
|
|
447
|
+
.hidden
|
|
429
448
|
: false,
|
|
430
|
-
order: this._sessionEngineCore.outputs[o].order !==
|
|
431
|
-
|
|
449
|
+
order: this._sessionEngineCore.outputManager.outputs[o].order !==
|
|
450
|
+
undefined
|
|
451
|
+
? this._sessionEngineCore.outputManager.outputs[o]
|
|
452
|
+
.order
|
|
432
453
|
: 0,
|
|
433
|
-
tooltip: this._sessionEngineCore.outputs[o].tooltip !==
|
|
434
|
-
|
|
454
|
+
tooltip: this._sessionEngineCore.outputManager.outputs[o].tooltip !==
|
|
455
|
+
undefined
|
|
456
|
+
? this._sessionEngineCore.outputManager.outputs[o]
|
|
457
|
+
.tooltip
|
|
435
458
|
: "",
|
|
436
459
|
};
|
|
437
460
|
}
|
|
@@ -451,6 +474,29 @@ class SettingsManager {
|
|
|
451
474
|
return response && responseP && responseO && responseE;
|
|
452
475
|
});
|
|
453
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Save the session settings for parameters and exports
|
|
479
|
+
*/
|
|
480
|
+
saveSessionSettings() {
|
|
481
|
+
const parameters = this._sessionEngineCore.parameterManager.parameters;
|
|
482
|
+
const exports = this._sessionEngineCore.exportManager.exports;
|
|
483
|
+
const sessionProperties = {};
|
|
484
|
+
for (const p in parameters) {
|
|
485
|
+
sessionProperties[p] = {
|
|
486
|
+
order: parameters[p].order || 0,
|
|
487
|
+
displayname: parameters[p].displayname || "",
|
|
488
|
+
hidden: parameters[p].hidden,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
for (const e in exports) {
|
|
492
|
+
sessionProperties[e] = {
|
|
493
|
+
order: exports[e].order || 0,
|
|
494
|
+
displayname: exports[e].displayname || "",
|
|
495
|
+
hidden: exports[e].hidden,
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
this._settingsEngine.session = sessionProperties;
|
|
499
|
+
}
|
|
454
500
|
}
|
|
455
501
|
exports.SettingsManager = SettingsManager;
|
|
456
502
|
//# sourceMappingURL=SettingsManager.js.map
|