@shapediver/viewer.session-engine.session-engine 3.14.7 → 3.14.9
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 +19 -0
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +5 -8
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionEngineCore.d.ts +119 -0
- package/dist/implementation/SessionEngineCore.d.ts.map +1 -0
- package/dist/implementation/SessionEngineCore.js +367 -0
- package/dist/implementation/SessionEngineCore.js.map +1 -0
- package/dist/implementation/SessionEngineFacade.d.ts +106 -0
- package/dist/implementation/SessionEngineFacade.d.ts.map +1 -0
- package/dist/implementation/SessionEngineFacade.js +191 -0
- package/dist/implementation/SessionEngineFacade.js.map +1 -0
- package/dist/implementation/managers/CustomizationManager.d.ts +67 -0
- package/dist/implementation/managers/CustomizationManager.d.ts.map +1 -0
- package/dist/implementation/managers/CustomizationManager.js +324 -0
- package/dist/implementation/managers/CustomizationManager.js.map +1 -0
- package/dist/implementation/managers/ExportManager.d.ts +75 -0
- package/dist/implementation/managers/ExportManager.d.ts.map +1 -0
- package/dist/implementation/managers/ExportManager.js +213 -0
- package/dist/implementation/managers/ExportManager.js.map +1 -0
- package/dist/implementation/managers/FileUploadManager.d.ts +74 -0
- package/dist/implementation/managers/FileUploadManager.d.ts.map +1 -0
- package/dist/implementation/managers/FileUploadManager.js +221 -0
- package/dist/implementation/managers/FileUploadManager.js.map +1 -0
- package/dist/implementation/managers/ModelStateManager.d.ts +54 -0
- package/dist/implementation/managers/ModelStateManager.d.ts.map +1 -0
- package/dist/implementation/managers/ModelStateManager.js +177 -0
- package/dist/implementation/managers/ModelStateManager.js.map +1 -0
- package/dist/implementation/managers/OutputManager.d.ts +99 -0
- package/dist/implementation/managers/OutputManager.d.ts.map +1 -0
- package/dist/implementation/managers/OutputManager.js +418 -0
- package/dist/implementation/managers/OutputManager.js.map +1 -0
- package/dist/implementation/managers/ParameterManager.d.ts +75 -0
- package/dist/implementation/managers/ParameterManager.d.ts.map +1 -0
- package/dist/implementation/managers/ParameterManager.js +235 -0
- package/dist/implementation/managers/ParameterManager.js.map +1 -0
- package/dist/implementation/managers/SettingsManager.d.ts +80 -0
- package/dist/implementation/managers/SettingsManager.d.ts.map +1 -0
- package/dist/implementation/managers/SettingsManager.js +502 -0
- package/dist/implementation/managers/SettingsManager.js.map +1 -0
- package/dist/implementation/managers/UtilsManager.d.ts +127 -0
- package/dist/implementation/managers/UtilsManager.d.ts.map +1 -0
- package/dist/implementation/managers/UtilsManager.js +410 -0
- package/dist/implementation/managers/UtilsManager.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ResGetModelState, ResModelState } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
+
import { ITreeNode } from "@shapediver/viewer.shared.node-tree";
|
|
3
|
+
import { SessionEngineCore } from "../SessionEngineCore";
|
|
4
|
+
/**
|
|
5
|
+
* Manager responsible for model states.
|
|
6
|
+
*
|
|
7
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
8
|
+
* via the `modelStateManager` property.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ModelStateManager {
|
|
11
|
+
private readonly _converter;
|
|
12
|
+
private readonly _httpClient;
|
|
13
|
+
private readonly _sessionEngineCore;
|
|
14
|
+
private _modelState?;
|
|
15
|
+
private _modelStateId?;
|
|
16
|
+
private _modelStateValidationMode?;
|
|
17
|
+
constructor(sessionEngineCore: SessionEngineCore);
|
|
18
|
+
get modelState(): ResModelState | undefined;
|
|
19
|
+
set modelState(value: ResModelState | undefined);
|
|
20
|
+
get modelStateId(): string | undefined;
|
|
21
|
+
set modelStateId(value: string | undefined);
|
|
22
|
+
get modelStateValidationMode(): boolean | undefined;
|
|
23
|
+
set modelStateValidationMode(value: boolean | undefined);
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new model state with the given parameter values and optional image and data.
|
|
26
|
+
*
|
|
27
|
+
* @param parameterValues Key-value pairs of parameter IDs and their corresponding values
|
|
28
|
+
* @param omitSessionParameterValues Whether to omit parameters that have not been explicitly set in the session
|
|
29
|
+
* @param image Optional image to associate with the model state
|
|
30
|
+
* @param data Optional additional data to associate with the model state
|
|
31
|
+
* @param arScene Optional AR scene to associate with the model state
|
|
32
|
+
* @param retry Whether to retry the request in case of failure
|
|
33
|
+
* @returns Promise with the ID of the created model state
|
|
34
|
+
*/
|
|
35
|
+
createModelState(parameterValues?: {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}, omitSessionParameterValues?: boolean, image?: (() => string) | (() => Promise<string>) | string | Promise<string> | Blob | File, data?: Record<string, any>, arScene?: (() => Promise<ArrayBuffer>) | ArrayBuffer | (() => Promise<Blob>) | Blob | File, retry?: boolean): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Customizes the session using the provided model state.
|
|
40
|
+
*
|
|
41
|
+
* @param modelState The model state ID or the model state response object
|
|
42
|
+
* @param retry Whether to retry the request in case of failure
|
|
43
|
+
* @returns Promise with the root tree node of the customized session
|
|
44
|
+
*/
|
|
45
|
+
customizeWithModelState(modelState: string | ResGetModelState, retry?: boolean): Promise<ITreeNode>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves a model state by its ID.
|
|
48
|
+
*
|
|
49
|
+
* @param modelStateId The ID of the model state to retrieve. If undefined, the current model state ID is used.
|
|
50
|
+
* @returns Promise with the model state information
|
|
51
|
+
*/
|
|
52
|
+
getModelState(modelStateId?: string): Promise<ResGetModelState>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ModelStateManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelStateManager.d.ts","sourceRoot":"","sources":["../../../src/implementation/managers/ModelStateManager.ts"],"names":[],"mappings":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,CAAC,CAAC,GAC5B,WAAW,GACX,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GACrB,IAAI,GACJ,IAAI,EACP,KAAK,UAAQ,GACX,OAAO,CAAC,MAAM,CAAC;IA8GlB;;;;;;OAMG;IACU,uBAAuB,CACnC,UAAU,EAAE,MAAM,GAAG,gBAAgB,EACrC,KAAK,UAAQ,GACX,OAAO,CAAC,SAAS,CAAC;IA+BrB;;;;;OAKG;IACU,aAAa,CACzB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC;CAmB5B"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ModelStateManager = void 0;
|
|
13
|
+
const sdk_geometry_api_sdk_v2_1 = require("@shapediver/sdk.geometry-api-sdk-v2");
|
|
14
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
15
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
16
|
+
/**
|
|
17
|
+
* Manager responsible for model states.
|
|
18
|
+
*
|
|
19
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
20
|
+
* via the `modelStateManager` property.
|
|
21
|
+
*/
|
|
22
|
+
class ModelStateManager {
|
|
23
|
+
constructor(sessionEngineCore) {
|
|
24
|
+
this._converter = viewer_shared_services_1.Converter.instance;
|
|
25
|
+
this._httpClient = viewer_shared_services_1.HttpClient.instance;
|
|
26
|
+
this._sessionEngineCore = sessionEngineCore;
|
|
27
|
+
}
|
|
28
|
+
get modelState() {
|
|
29
|
+
return this._modelState;
|
|
30
|
+
}
|
|
31
|
+
set modelState(value) {
|
|
32
|
+
this._modelState = value;
|
|
33
|
+
this._modelStateId = value === null || value === void 0 ? void 0 : value.id;
|
|
34
|
+
}
|
|
35
|
+
get modelStateId() {
|
|
36
|
+
return this._modelStateId;
|
|
37
|
+
}
|
|
38
|
+
set modelStateId(value) {
|
|
39
|
+
this._modelStateId = value;
|
|
40
|
+
}
|
|
41
|
+
get modelStateValidationMode() {
|
|
42
|
+
return this._modelStateValidationMode;
|
|
43
|
+
}
|
|
44
|
+
set modelStateValidationMode(value) {
|
|
45
|
+
this._modelStateValidationMode = value;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new model state with the given parameter values and optional image and data.
|
|
49
|
+
*
|
|
50
|
+
* @param parameterValues Key-value pairs of parameter IDs and their corresponding values
|
|
51
|
+
* @param omitSessionParameterValues Whether to omit parameters that have not been explicitly set in the session
|
|
52
|
+
* @param image Optional image to associate with the model state
|
|
53
|
+
* @param data Optional additional data to associate with the model state
|
|
54
|
+
* @param arScene Optional AR scene to associate with the model state
|
|
55
|
+
* @param retry Whether to retry the request in case of failure
|
|
56
|
+
* @returns Promise with the ID of the created model state
|
|
57
|
+
*/
|
|
58
|
+
createModelState(parameterValues = {}, omitSessionParameterValues = false, image, data, arScene, retry = false) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
this._sessionEngineCore.utilsManager.checkAvailability();
|
|
61
|
+
try {
|
|
62
|
+
const promises = [];
|
|
63
|
+
// process the parameters
|
|
64
|
+
const parameterSet = {};
|
|
65
|
+
promises.push(this._sessionEngineCore.fileUploadManager
|
|
66
|
+
.uploadFileParameters(parameterValues)
|
|
67
|
+
.then(() => {
|
|
68
|
+
// create a set of the current validated parameter values
|
|
69
|
+
for (const parameterId in this._sessionEngineCore
|
|
70
|
+
.parameterManager.parameters) {
|
|
71
|
+
// if the parameter has not been set, we do not include it in the parameter set if the omitSessionParameterValues flag is set
|
|
72
|
+
if (!(omitSessionParameterValues === true &&
|
|
73
|
+
parameterValues[parameterId] === undefined)) {
|
|
74
|
+
parameterSet[parameterId] = (" " +
|
|
75
|
+
this._sessionEngineCore.parameterManager.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
// process the image input
|
|
80
|
+
let imageData;
|
|
81
|
+
let imageArrayBuffer;
|
|
82
|
+
if (image) {
|
|
83
|
+
promises.push(this._sessionEngineCore.utilsManager
|
|
84
|
+
.processImageInput(image)
|
|
85
|
+
.then((result) => {
|
|
86
|
+
imageData = result === null || result === void 0 ? void 0 : result.imageData;
|
|
87
|
+
imageArrayBuffer = result === null || result === void 0 ? void 0 : result.arrayBuffer;
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
// process the arScene input
|
|
91
|
+
let arSceneId;
|
|
92
|
+
if (arScene) {
|
|
93
|
+
promises.push(this._converter
|
|
94
|
+
.convertToBlob(arScene)
|
|
95
|
+
.then((arSceneBlob) => new sdk_geometry_api_sdk_v2_1.GltfApi(this._sessionEngineCore.sdkConfig).uploadGltf(this._sessionEngineCore.sessionId, new File([arSceneBlob], "arScene.gltf", {
|
|
96
|
+
type: "model/gltf-binary",
|
|
97
|
+
}), sdk_geometry_api_sdk_v2_1.QueryGltfConversion.SCENE))
|
|
98
|
+
.then((arSceneResponseDto) => {
|
|
99
|
+
var _a;
|
|
100
|
+
arSceneId = (_a = arSceneResponseDto.data.gltf) === null || _a === void 0 ? void 0 : _a.sceneId;
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
// wait for all promises to resolve
|
|
104
|
+
yield Promise.all(promises);
|
|
105
|
+
// create the model state
|
|
106
|
+
const response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sessionEngineCore.sdkConfig).createModelState(this._sessionEngineCore.sessionId, {
|
|
107
|
+
parameters: parameterSet,
|
|
108
|
+
data: data,
|
|
109
|
+
image: imageData,
|
|
110
|
+
arSceneId: arSceneId,
|
|
111
|
+
})).data;
|
|
112
|
+
if (imageData && imageArrayBuffer)
|
|
113
|
+
yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sessionEngineCore.sdkConfig).uploadAsset(response.asset.modelState.href, imageArrayBuffer, response.asset.modelState.headers);
|
|
114
|
+
return response.modelState.id;
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
yield this._sessionEngineCore.utilsManager.handleError(e, retry);
|
|
118
|
+
return yield this.createModelState(parameterValues, omitSessionParameterValues, image, data, arScene, true);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Customizes the session using the provided model state.
|
|
124
|
+
*
|
|
125
|
+
* @param modelState The model state ID or the model state response object
|
|
126
|
+
* @param retry Whether to retry the request in case of failure
|
|
127
|
+
* @returns Promise with the root tree node of the customized session
|
|
128
|
+
*/
|
|
129
|
+
customizeWithModelState(modelState, retry = false) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
this._sessionEngineCore.utilsManager.checkAvailability();
|
|
132
|
+
try {
|
|
133
|
+
// get the model state if it is not already a response
|
|
134
|
+
let response;
|
|
135
|
+
if (typeof modelState === "string") {
|
|
136
|
+
response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sessionEngineCore.sdkConfig).getModelState(modelState)).data;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
response = modelState;
|
|
140
|
+
}
|
|
141
|
+
if (!response.modelState)
|
|
142
|
+
return new viewer_shared_node_tree_1.TreeNode();
|
|
143
|
+
// read out the parameter values from the model state
|
|
144
|
+
for (const parameterId in response.modelState.parameters)
|
|
145
|
+
this._sessionEngineCore.parameterManager.parameters[parameterId].value = response.modelState.parameters[parameterId];
|
|
146
|
+
return this._sessionEngineCore.customizationManager.customize();
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
yield this._sessionEngineCore.utilsManager.handleError(e, retry);
|
|
150
|
+
return yield this.customizeWithModelState(modelState, true);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Retrieves a model state by its ID.
|
|
156
|
+
*
|
|
157
|
+
* @param modelStateId The ID of the model state to retrieve. If undefined, the current model state ID is used.
|
|
158
|
+
* @returns Promise with the model state information
|
|
159
|
+
*/
|
|
160
|
+
getModelState(modelStateId) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
this._sessionEngineCore.utilsManager.checkAvailability();
|
|
163
|
+
try {
|
|
164
|
+
const id = modelStateId || this._modelStateId;
|
|
165
|
+
if (!id)
|
|
166
|
+
throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.getModelState: No model state id available.");
|
|
167
|
+
const response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sessionEngineCore.sdkConfig).getModelState(id)).data;
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
throw this._httpClient.convertError(e);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.ModelStateManager = ModelStateManager;
|
|
177
|
+
//# sourceMappingURL=ModelStateManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelStateManager.js","sourceRoot":"","sources":["../../../src/implementation/managers/ModelStateManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAQ6C;AAC7C,iFAAwE;AACxE,+EAI4C;AAI5C;;;;;GAKG;AACH,MAAa,iBAAi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AAI,CAAC,kBAAkB,CAAC,SAAS,CACjC,CAAC,aAAa,CAAC,EAAE,CAAC,CACnB,CAAC,IAAI,CAAC;gBACP,OAAO,QAAQ,CAAC;aAChB;YAAC,OAAO,CAAC,EAAE;gBACX,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aACvC;QACF,CAAC;KAAA;CACD;AArPD,8CAqPC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ResBase } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
+
import { ITreeNode } from "@shapediver/viewer.shared.node-tree";
|
|
3
|
+
import { ITaskEventDescription } from "@shapediver/viewer.shared.types";
|
|
4
|
+
import { IOutput } from "../../interfaces/dto/IOutput";
|
|
5
|
+
import { ISessionTreeNode } from "../../interfaces/ISessionTreeNode";
|
|
6
|
+
import { SessionEngineCore } from "../SessionEngineCore";
|
|
7
|
+
/**
|
|
8
|
+
* Manager responsible for outputs.
|
|
9
|
+
*
|
|
10
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
11
|
+
* via the `outputManager` property.
|
|
12
|
+
*/
|
|
13
|
+
export declare class OutputManager {
|
|
14
|
+
private readonly _eventEngine;
|
|
15
|
+
private readonly _logger;
|
|
16
|
+
private readonly _outputLoader;
|
|
17
|
+
private readonly _outputs;
|
|
18
|
+
private readonly _outputsFreeze;
|
|
19
|
+
private readonly _sessionEngineCore;
|
|
20
|
+
private readonly _stateEngine;
|
|
21
|
+
private readonly _uuidGenerator;
|
|
22
|
+
private _allowOutputLoading;
|
|
23
|
+
constructor(sessionEngineCore: SessionEngineCore);
|
|
24
|
+
init(): void;
|
|
25
|
+
get allowOutputLoading(): boolean;
|
|
26
|
+
set allowOutputLoading(value: boolean);
|
|
27
|
+
get jwtToken(): string | undefined;
|
|
28
|
+
get loadSdtf(): boolean;
|
|
29
|
+
get outputs(): {
|
|
30
|
+
[key: string]: IOutput;
|
|
31
|
+
};
|
|
32
|
+
get outputsFreeze(): {
|
|
33
|
+
[key: string]: boolean;
|
|
34
|
+
};
|
|
35
|
+
get reloadSdtf(): boolean;
|
|
36
|
+
set reloadSdtf(value: boolean);
|
|
37
|
+
/**
|
|
38
|
+
* Create outputs from the response DTO.
|
|
39
|
+
*/
|
|
40
|
+
createOutputsFromDto(): void;
|
|
41
|
+
getCurrentOutputVersions(): {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Load cached outputs in parallel.
|
|
46
|
+
*
|
|
47
|
+
* @param outputMapping mapping of output ids to their versions
|
|
48
|
+
* @param taskEventInfo optional task event info
|
|
49
|
+
* @param retry whether to retry the request in case of failure
|
|
50
|
+
* @returns promise with a mapping of output ids to their scene graph nodes
|
|
51
|
+
*/
|
|
52
|
+
loadCachedOutputsParallel(outputMapping: {
|
|
53
|
+
[key: string]: string;
|
|
54
|
+
}, taskEventInfo?: ITaskEventDescription, retry?: boolean): Promise<{
|
|
55
|
+
[key: string]: ITreeNode | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Load the outputs and return the scene graph node of the result.
|
|
59
|
+
* In case the outputs have a delay property, another customization request with the parameter set is sent.
|
|
60
|
+
*
|
|
61
|
+
* @param parameters the parameter set to update the session
|
|
62
|
+
* @param outputs the outputs to load
|
|
63
|
+
* @returns promise with a scene graph node
|
|
64
|
+
*/
|
|
65
|
+
loadOutputs(cancelRequest: (() => boolean) | undefined, taskEventInfo: ITaskEventDescription, retry?: boolean): Promise<ISessionTreeNode>;
|
|
66
|
+
/**
|
|
67
|
+
* Load the outputs and return the scene graph node of the result.
|
|
68
|
+
* In case the outputs have a delay property, another customization request with the parameter set is sent.
|
|
69
|
+
*
|
|
70
|
+
* @param parameters the parameter set to update the session
|
|
71
|
+
* @param outputs the outputs to load
|
|
72
|
+
* @returns promise with a scene graph node
|
|
73
|
+
*/
|
|
74
|
+
loadOutputsParallel(responseDto: ResBase, cancelRequest: (() => boolean) | undefined, taskEventInfo: ITaskEventDescription, retry?: boolean): Promise<ISessionTreeNode>;
|
|
75
|
+
/**
|
|
76
|
+
* Save the output properties for displayname, order, tooltip and hidden
|
|
77
|
+
*
|
|
78
|
+
* @param outputs
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
saveOutputProperties(outputs: {
|
|
82
|
+
[key: string]: {
|
|
83
|
+
displayname: string;
|
|
84
|
+
hidden: boolean;
|
|
85
|
+
order: number;
|
|
86
|
+
tooltip: string;
|
|
87
|
+
};
|
|
88
|
+
}, retry?: boolean): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Update the outputs and return the scene graph node of the result.
|
|
91
|
+
* In case the outputs have a delay property, another customization request with the parameter set is sent.
|
|
92
|
+
*
|
|
93
|
+
* @param taskEventInfo optional task event info
|
|
94
|
+
* @param waitForViewportUpdate whether to wait for the viewport update callbacks before returning
|
|
95
|
+
* @returns promise with a scene graph node
|
|
96
|
+
*/
|
|
97
|
+
updateOutputs(taskEventInfo?: ITaskEventDescription, waitForViewportUpdate?: boolean): Promise<ITreeNode>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=OutputManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputManager.d.ts","sourceRoot":"","sources":["../../../src/implementation/managers/OutputManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,OAAO,EAIP,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,qCAAqC,CAAC;AAQ9D,OAAO,EAEN,qBAAqB,EAErB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AAKnE,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAGvD;;;;;GAKG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC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