@shapediver/viewer.shared.services 3.3.4 → 3.3.7
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/package.json +5 -6
- package/src/converter/Converter.ts +0 -407
- package/src/dom-event-engine/DomEventEngine.ts +0 -310
- package/src/dom-event-engine/IDomEventListener.ts +0 -14
- package/src/event-engine/EventEngine.ts +0 -131
- package/src/event-engine/EventTypes.ts +0 -334
- package/src/event-engine/interfaces/ICallback.ts +0 -5
- package/src/event-engine/interfaces/IEvent.ts +0 -1
- package/src/event-engine/interfaces/IListener.ts +0 -8
- package/src/http-client/HttpClient.ts +0 -353
- package/src/http-client/HttpResponse.ts +0 -6
- package/src/index.ts +0 -166
- package/src/input-validator/InputValidator.ts +0 -123
- package/src/logger/ErrorTypeGuards.ts +0 -130
- package/src/logger/Logger.ts +0 -174
- package/src/logger/ShapeDiverBackendErrors.ts +0 -40
- package/src/logger/ShapeDiverError.ts +0 -58
- package/src/logger/ShapeDiverViewerErrors.ts +0 -121
- package/src/performance-evaluator/PerformanceEvaluator.ts +0 -146
- package/src/settings-engine/SettingsEngine.ts +0 -182
- package/src/state-engine/ISessionGlobalAccessObjectDefinition.ts +0 -25
- package/src/state-engine/IViewportGlobalAccessObjectDefinition.ts +0 -29
- package/src/state-engine/StateEngine.ts +0 -47
- package/src/state-engine/StatePromise.ts +0 -54
- package/src/system-info/SystemInfo.ts +0 -143
- package/src/type-check/TypeChecker.ts +0 -27
- package/src/utilities/base64.ts +0 -15
- package/src/uuid-generator/UuidGenerator.ts +0 -57
- package/tsconfig.json +0 -17
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { ShapeDiverGeometryBackendError, ShapeDiverGeometryBackendRequestError, ShapeDiverGeometryBackendResponseError } from "./ShapeDiverBackendErrors"
|
|
2
|
-
import { ShapeDiverViewerError, ShapeDiverViewerErrorType } from "./ShapeDiverError"
|
|
3
|
-
import { ShapeDiverViewerArError, ShapeDiverViewerCameraError, ShapeDiverViewerDataProcessingError, ShapeDiverViewerDrawingToolsError, ShapeDiverViewerEnvironmentMapError, ShapeDiverViewerInteractionError, ShapeDiverViewerLightError, ShapeDiverViewerSessionError, ShapeDiverViewerSettingsError, ShapeDiverViewerUnknownError, ShapeDiverViewerValidationError, ShapeDiverViewerViewportError, ShapeDiverViewerWebGLError } from "./ShapeDiverViewerErrors"
|
|
4
|
-
|
|
5
|
-
/** Type guard for all error types of the viewer package. */
|
|
6
|
-
export function isViewerError(e: any): e is ShapeDiverViewerError {
|
|
7
|
-
return e instanceof Error &&
|
|
8
|
-
"errorType" in e &&
|
|
9
|
-
Object.values(ShapeDiverViewerErrorType).includes((<ShapeDiverViewerError>e).errorType as any)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Type guard for an unknown viewer error. */
|
|
13
|
-
export function isViewerUnknownError(e: any): e is ShapeDiverViewerUnknownError {
|
|
14
|
-
return e instanceof Error &&
|
|
15
|
-
"errorType" in e &&
|
|
16
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.UNKNOWN
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Type guard for a data processing viewer error. */
|
|
20
|
-
export function isViewerDataProcessingError(e: any): e is ShapeDiverViewerDataProcessingError {
|
|
21
|
-
return e instanceof Error &&
|
|
22
|
-
"errorType" in e &&
|
|
23
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.DATA_PROCESSING_ERROR
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Type guard for a environment map viewer error. */
|
|
27
|
-
export function isViewerEnvironmentMapError(e: any): e is ShapeDiverViewerEnvironmentMapError {
|
|
28
|
-
return e instanceof Error &&
|
|
29
|
-
"errorType" in e &&
|
|
30
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.ENVIRONMENT_MAP_ERROR
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Type guard for a webGL viewer error. */
|
|
34
|
-
export function isViewerWebGLError(e: any): e is ShapeDiverViewerWebGLError {
|
|
35
|
-
return e instanceof Error &&
|
|
36
|
-
"errorType" in e &&
|
|
37
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.WEBGL_ERROR
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Type guard for a settings viewer error. */
|
|
41
|
-
export function isViewerSettingsError(e: any): e is ShapeDiverViewerSettingsError {
|
|
42
|
-
return e instanceof Error &&
|
|
43
|
-
"errorType" in e &&
|
|
44
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.SETTINGS_ERROR
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Type guard for a session viewer error. */
|
|
48
|
-
export function isViewerSessionError(e: any): e is ShapeDiverViewerSessionError {
|
|
49
|
-
return e instanceof Error &&
|
|
50
|
-
"errorType" in e &&
|
|
51
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.SESSION_ERROR
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Type guard for a viewport viewer error. */
|
|
55
|
-
export function isViewerViewportError(e: any): e is ShapeDiverViewerViewportError {
|
|
56
|
-
return e instanceof Error &&
|
|
57
|
-
"errorType" in e &&
|
|
58
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.VIEWPORT_ERROR
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Type guard for a light viewer error. */
|
|
62
|
-
export function isViewerLightError(e: any): e is ShapeDiverViewerLightError {
|
|
63
|
-
return e instanceof Error &&
|
|
64
|
-
"errorType" in e &&
|
|
65
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.LIGHT_ERROR
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Type guard for a camera viewer error. */
|
|
69
|
-
export function isViewerCameraError(e: any): e is ShapeDiverViewerCameraError {
|
|
70
|
-
return e instanceof Error &&
|
|
71
|
-
"errorType" in e &&
|
|
72
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.CAMERA_ERROR
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** Type guard for an AR viewer error. */
|
|
76
|
-
export function isARError(e: any): e is ShapeDiverViewerArError {
|
|
77
|
-
return e instanceof Error &&
|
|
78
|
-
"errorType" in e &&
|
|
79
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.AR_ERROR
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Type guard for a validation viewer error. */
|
|
83
|
-
export function isViewerValidationError(e: any): e is ShapeDiverViewerValidationError {
|
|
84
|
-
return e instanceof Error &&
|
|
85
|
-
"errorType" in e &&
|
|
86
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.VALIDATION_ERROR
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Type guard for a interaction viewer error. */
|
|
90
|
-
export function isViewerInteractionError(e: any): e is ShapeDiverViewerInteractionError {
|
|
91
|
-
return e instanceof Error &&
|
|
92
|
-
"errorType" in e &&
|
|
93
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.INTERACTION_ERROR
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Type guard for a drawing tools viewer error. */
|
|
97
|
-
export function isViewerDrawingToolsError(e: any): e is ShapeDiverViewerDrawingToolsError {
|
|
98
|
-
return e instanceof Error &&
|
|
99
|
-
"errorType" in e &&
|
|
100
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.DRAWING_TOOLS_ERROR
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Type guard for all error types of the Geometry Backend SDK package that are mapped to viewer errors. */
|
|
104
|
-
export function isViewerGeometryBackendError(e: any): e is
|
|
105
|
-
(ShapeDiverGeometryBackendError & ShapeDiverGeometryBackendRequestError & ShapeDiverGeometryBackendResponseError) {
|
|
106
|
-
return e instanceof Error &&
|
|
107
|
-
"errorType" in e &&
|
|
108
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_ERROR || (<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_REQUEST_ERROR || (<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_REQUEST_ERROR
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Type guard for a Geometry Backend SDK generic error that is mapped to a viewer error. */
|
|
112
|
-
export function isViewerGeometryBackendGenericError(e: any): e is ShapeDiverGeometryBackendError {
|
|
113
|
-
return e instanceof Error &&
|
|
114
|
-
"errorType" in e &&
|
|
115
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_ERROR
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** Type guard for a Geometry Backend SDK request error that is mapped to a viewer error. */
|
|
119
|
-
export function isViewerGeometryBackendRequestError(e: any): e is ShapeDiverGeometryBackendRequestError {
|
|
120
|
-
return e instanceof Error &&
|
|
121
|
-
"errorType" in e &&
|
|
122
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_REQUEST_ERROR
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Type guard for a Geometry Backend SDK response error that is mapped to a viewer error. */
|
|
126
|
-
export function isViewerGeometryBackendResponseError(e: any): e is ShapeDiverGeometryBackendResponseError {
|
|
127
|
-
return e instanceof Error &&
|
|
128
|
-
"errorType" in e &&
|
|
129
|
-
(<ShapeDiverViewerError>e).errorType === ShapeDiverViewerErrorType.GEOMETRY_BACKEND_RESPONSE_ERROR
|
|
130
|
-
}
|
package/src/logger/Logger.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
export enum LOGGING_LEVEL {
|
|
2
|
-
NONE = 'none',
|
|
3
|
-
ERROR = 'error',
|
|
4
|
-
FATAL = 'fatal',
|
|
5
|
-
WARN = 'warn',
|
|
6
|
-
INFO = 'info',
|
|
7
|
-
DEBUG = 'debug',
|
|
8
|
-
DEBUG_HIGH = 'debug_high',
|
|
9
|
-
DEBUG_MEDIUM = 'debug_medium',
|
|
10
|
-
DEBUG_LOW = 'debug_low',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Logger {
|
|
14
|
-
// #region Properties (8)
|
|
15
|
-
|
|
16
|
-
private static _instance: Logger;
|
|
17
|
-
|
|
18
|
-
private _loggingLevel: LOGGING_LEVEL = LOGGING_LEVEL.WARN;
|
|
19
|
-
private _showMessages: boolean = true;
|
|
20
|
-
|
|
21
|
-
// #endregion Properties (8)
|
|
22
|
-
|
|
23
|
-
// #region Public Static Accessors (1)
|
|
24
|
-
|
|
25
|
-
public static get instance() {
|
|
26
|
-
return this._instance || (this._instance = new this());
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// #endregion Public Static Accessors (1)
|
|
30
|
-
|
|
31
|
-
// #region Public Accessors (4)
|
|
32
|
-
|
|
33
|
-
public get loggingLevel(): LOGGING_LEVEL {
|
|
34
|
-
return this._loggingLevel;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public set loggingLevel(value: LOGGING_LEVEL) {
|
|
38
|
-
this._loggingLevel = value;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public get showMessages(): boolean {
|
|
42
|
-
return this._showMessages;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public set showMessages(value: boolean) {
|
|
46
|
-
this._showMessages = value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// #endregion Public Accessors (4)
|
|
50
|
-
|
|
51
|
-
// #region Public Methods (11)
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Logging a debug message.
|
|
55
|
-
* @param msg the message
|
|
56
|
-
*/
|
|
57
|
-
public debug(msg: string): void {
|
|
58
|
-
if (this.canLog(LOGGING_LEVEL.DEBUG) && this.showMessages === true)
|
|
59
|
-
console.debug('(DEBUG) ' + this.messageConstruction(msg));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Logging a debug message with high priority.
|
|
64
|
-
* @param msg the message
|
|
65
|
-
*/
|
|
66
|
-
public debugHigh(msg: string): void {
|
|
67
|
-
if (this.canLog(LOGGING_LEVEL.DEBUG_HIGH) && this.showMessages === true)
|
|
68
|
-
console.debug('(DEBUG_HIGH) ' + this.messageConstruction(msg));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Logging a debug message with low priority.
|
|
73
|
-
* @param msg the message
|
|
74
|
-
*/
|
|
75
|
-
public debugLow(msg: string): void {
|
|
76
|
-
if (this.canLog(LOGGING_LEVEL.DEBUG_LOW) && this.showMessages === true)
|
|
77
|
-
console.debug('(DEBUG_LOW) ' + this.messageConstruction(msg));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Logging a debug message with medium priority.
|
|
82
|
-
* @param msg the message
|
|
83
|
-
*/
|
|
84
|
-
public debugMedium(msg: string): void {
|
|
85
|
-
if (this.canLog(LOGGING_LEVEL.DEBUG_MEDIUM) && this.showMessages === true)
|
|
86
|
-
console.debug('(DEBUG_MEDIUM) ' + this.messageConstruction(msg));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Logging an error.
|
|
91
|
-
* @param msg the message
|
|
92
|
-
*/
|
|
93
|
-
public error(msg: string): void {
|
|
94
|
-
if (this.canLog(LOGGING_LEVEL.ERROR) && this.showMessages === true)
|
|
95
|
-
console.error('(ERROR) ' + this.messageConstruction(msg));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Logging a fatal error.
|
|
100
|
-
* @param msg the message
|
|
101
|
-
*/
|
|
102
|
-
public fatal(msg: string): void {
|
|
103
|
-
if (this.canLog(LOGGING_LEVEL.FATAL) && this.showMessages === true)
|
|
104
|
-
console.error('(FATAL) ' + this.messageConstruction(msg));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Logging an info.
|
|
109
|
-
* @param msg the message
|
|
110
|
-
*/
|
|
111
|
-
public info(msg: string): void {
|
|
112
|
-
if (this.canLog(LOGGING_LEVEL.INFO) && this.showMessages === true)
|
|
113
|
-
console.info('(INFO) ' + this.messageConstruction(msg));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Logging a warning.
|
|
118
|
-
* @param msg the message
|
|
119
|
-
*/
|
|
120
|
-
public warn(msg: string): void {
|
|
121
|
-
if (this.canLog(LOGGING_LEVEL.WARN) && this.showMessages === true)
|
|
122
|
-
console.warn('(WARN) ' + this.messageConstruction(msg));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// #endregion Public Methods (11)
|
|
126
|
-
|
|
127
|
-
// #region Private Methods (2)
|
|
128
|
-
|
|
129
|
-
private canLog(loggingLevel: LOGGING_LEVEL): boolean {
|
|
130
|
-
switch (this.loggingLevel) {
|
|
131
|
-
case LOGGING_LEVEL.ERROR:
|
|
132
|
-
if (loggingLevel === LOGGING_LEVEL.FATAL) return false;
|
|
133
|
-
if (loggingLevel === LOGGING_LEVEL.WARN) return false;
|
|
134
|
-
if (loggingLevel === LOGGING_LEVEL.INFO) return false;
|
|
135
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG) return false;
|
|
136
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_HIGH) return false;
|
|
137
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_MEDIUM) return false;
|
|
138
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
139
|
-
case LOGGING_LEVEL.FATAL:
|
|
140
|
-
if (loggingLevel === LOGGING_LEVEL.WARN) return false;
|
|
141
|
-
if (loggingLevel === LOGGING_LEVEL.INFO) return false;
|
|
142
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG) return false;
|
|
143
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_HIGH) return false;
|
|
144
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_MEDIUM) return false;
|
|
145
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
146
|
-
case LOGGING_LEVEL.WARN:
|
|
147
|
-
if (loggingLevel === LOGGING_LEVEL.INFO) return false;
|
|
148
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG) return false;
|
|
149
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_HIGH) return false;
|
|
150
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_MEDIUM) return false;
|
|
151
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
152
|
-
case LOGGING_LEVEL.INFO:
|
|
153
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG) return false;
|
|
154
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_HIGH) return false;
|
|
155
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_MEDIUM) return false;
|
|
156
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
157
|
-
case LOGGING_LEVEL.DEBUG_HIGH:
|
|
158
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_MEDIUM) return false;
|
|
159
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
160
|
-
case LOGGING_LEVEL.DEBUG_MEDIUM:
|
|
161
|
-
if (loggingLevel === LOGGING_LEVEL.DEBUG_LOW) return false;
|
|
162
|
-
case LOGGING_LEVEL.DEBUG_LOW:
|
|
163
|
-
case LOGGING_LEVEL.DEBUG:
|
|
164
|
-
default:
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
private messageConstruction(msg: string): string {
|
|
170
|
-
return new Date().toISOString() + ': ' + msg;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// #endregion Private Methods (2)
|
|
174
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ShapeDiverResponseErrorType } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
-
import { ShapeDiverViewerError, ShapeDiverViewerErrorType } from "./ShapeDiverError";
|
|
3
|
-
|
|
4
|
-
export class ShapeDiverGeometryBackendRequestError extends ShapeDiverViewerError {
|
|
5
|
-
// #region Constructors (1)
|
|
6
|
-
|
|
7
|
-
constructor(
|
|
8
|
-
message: string,
|
|
9
|
-
public readonly desc: string,
|
|
10
|
-
) {
|
|
11
|
-
super(ShapeDiverViewerErrorType.GEOMETRY_BACKEND_REQUEST_ERROR, desc, message);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// #endregion Constructors (1)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class ShapeDiverGeometryBackendResponseError extends ShapeDiverViewerError {
|
|
18
|
-
// #region Constructors (1)
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
message: string,
|
|
22
|
-
public readonly status: number,
|
|
23
|
-
public readonly geometryBackendErrorType: ShapeDiverResponseErrorType,
|
|
24
|
-
public readonly desc: string,
|
|
25
|
-
) {
|
|
26
|
-
super(ShapeDiverViewerErrorType.GEOMETRY_BACKEND_RESPONSE_ERROR, desc, message);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// #endregion Constructors (1)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class ShapeDiverGeometryBackendError extends ShapeDiverViewerError {
|
|
33
|
-
// #region Constructors (1)
|
|
34
|
-
|
|
35
|
-
constructor(message: string) {
|
|
36
|
-
super(ShapeDiverViewerErrorType.GEOMETRY_BACKEND_ERROR, "A generic geometry backend error occurred.", message);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// #endregion Constructors (1)
|
|
40
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export enum ShapeDiverViewerErrorType {
|
|
2
|
-
AR_ERROR = 'SdARError',
|
|
3
|
-
GEOMETRY_BACKEND_ERROR = 'SdGeometryBackendError',
|
|
4
|
-
GEOMETRY_BACKEND_REQUEST_ERROR = 'SdGeometryBackendRequestError',
|
|
5
|
-
GEOMETRY_BACKEND_RESPONSE_ERROR = 'SdGeometryBackendResponseError',
|
|
6
|
-
CAMERA_ERROR = 'SdCameraError',
|
|
7
|
-
CONNECTION_ERROR = 'SdConnectionError',
|
|
8
|
-
DATA_PROCESSING_ERROR = 'SdDataProcessingError',
|
|
9
|
-
DRAWING_TOOLS_ERROR = 'SdDrawingToolsError',
|
|
10
|
-
ENVIRONMENT_MAP_ERROR = 'SdEnvironmentMapError',
|
|
11
|
-
INTERACTION_ERROR = 'SdInteractionError',
|
|
12
|
-
LIGHT_ERROR = 'SdLightError',
|
|
13
|
-
SESSION_ERROR = 'SdSessionError',
|
|
14
|
-
SETTINGS_ERROR = 'SdSettingsError',
|
|
15
|
-
VALIDATION_ERROR = 'SdValidationError',
|
|
16
|
-
VIEWPORT_ERROR = 'SdViewerError',
|
|
17
|
-
WEBGL_ERROR = 'SdWebGLError',
|
|
18
|
-
UNKNOWN = "",
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IShapeDiverViewerError {
|
|
22
|
-
// #region Properties (3)
|
|
23
|
-
|
|
24
|
-
desc: string;
|
|
25
|
-
errorType: ShapeDiverViewerErrorType;
|
|
26
|
-
message: string;
|
|
27
|
-
|
|
28
|
-
// #endregion Properties (3)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class ShapeDiverError extends Error {
|
|
32
|
-
// #region Constructors (1)
|
|
33
|
-
|
|
34
|
-
constructor(message: string) {
|
|
35
|
-
super(message)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// #endregion Constructors (1)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class ShapeDiverViewerError extends ShapeDiverError implements IShapeDiverViewerError {
|
|
42
|
-
// #region Constructors (1)
|
|
43
|
-
public readonly errorType: ShapeDiverViewerErrorType = ShapeDiverViewerErrorType.UNKNOWN;
|
|
44
|
-
|
|
45
|
-
constructor(
|
|
46
|
-
errorType: ShapeDiverViewerErrorType,
|
|
47
|
-
public readonly desc: string,
|
|
48
|
-
message: string
|
|
49
|
-
) {
|
|
50
|
-
super(message)
|
|
51
|
-
|
|
52
|
-
this.errorType = (Object.values(ShapeDiverViewerErrorType).includes(errorType as any))
|
|
53
|
-
? errorType as ShapeDiverViewerErrorType
|
|
54
|
-
: ShapeDiverViewerErrorType.UNKNOWN
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// #endregion Constructors (1)
|
|
58
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { ShapeDiverViewerError, ShapeDiverViewerErrorType } from "./ShapeDiverError";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class ShapeDiverViewerUnknownError extends ShapeDiverViewerError {
|
|
5
|
-
constructor(
|
|
6
|
-
public readonly message: string,
|
|
7
|
-
public readonly errorObject: Error | unknown
|
|
8
|
-
) {
|
|
9
|
-
super(ShapeDiverViewerErrorType.UNKNOWN, 'An unknown error occurred.', message);
|
|
10
|
-
if(Error.captureStackTrace !== undefined) Error.captureStackTrace(this, ShapeDiverViewerUnknownError)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class ShapeDiverViewerDataProcessingError extends ShapeDiverViewerError {
|
|
15
|
-
constructor(
|
|
16
|
-
public readonly message: string,
|
|
17
|
-
public readonly errorObject?: Error | unknown
|
|
18
|
-
) {
|
|
19
|
-
super(ShapeDiverViewerErrorType.DATA_PROCESSING_ERROR, 'An error occurred while processing data.', message);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class ShapeDiverViewerEnvironmentMapError extends ShapeDiverViewerError {
|
|
24
|
-
constructor(
|
|
25
|
-
public readonly message: string,
|
|
26
|
-
public readonly url?: string | string[],
|
|
27
|
-
public readonly errorObject?: Error | unknown
|
|
28
|
-
) {
|
|
29
|
-
super(ShapeDiverViewerErrorType.ENVIRONMENT_MAP_ERROR, 'An error occurred while loading the environment map.', message);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class ShapeDiverViewerWebGLError extends ShapeDiverViewerError {
|
|
34
|
-
constructor(
|
|
35
|
-
public readonly message: string,
|
|
36
|
-
public readonly errorObject?: Error | unknown
|
|
37
|
-
) {
|
|
38
|
-
super(ShapeDiverViewerErrorType.WEBGL_ERROR, 'An error occurred regarding to the WebGL context.', message);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export class ShapeDiverViewerSettingsError extends ShapeDiverViewerError {
|
|
43
|
-
constructor(
|
|
44
|
-
public readonly message: string,
|
|
45
|
-
public readonly errorObject?: Error | unknown
|
|
46
|
-
) {
|
|
47
|
-
super(ShapeDiverViewerErrorType.SETTINGS_ERROR, 'An error occurred while loading the settings.', message);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export class ShapeDiverViewerSessionError extends ShapeDiverViewerError {
|
|
52
|
-
constructor(
|
|
53
|
-
public readonly message: string,
|
|
54
|
-
public readonly errorObject?: Error | unknown
|
|
55
|
-
) {
|
|
56
|
-
super(ShapeDiverViewerErrorType.SESSION_ERROR, 'An error occurred while working with the session.', message);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export class ShapeDiverViewerViewportError extends ShapeDiverViewerError {
|
|
61
|
-
constructor(
|
|
62
|
-
public readonly message: string,
|
|
63
|
-
public readonly errorObject?: Error | unknown
|
|
64
|
-
) {
|
|
65
|
-
super(ShapeDiverViewerErrorType.VIEWPORT_ERROR, 'An error occurred while working with the viewport.', message);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export class ShapeDiverViewerLightError extends ShapeDiverViewerError {
|
|
70
|
-
constructor(
|
|
71
|
-
public readonly message: string,
|
|
72
|
-
public readonly errorObject?: Error | unknown
|
|
73
|
-
) {
|
|
74
|
-
super(ShapeDiverViewerErrorType.LIGHT_ERROR, 'An error occurred while working with the lights.', message);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export class ShapeDiverViewerCameraError extends ShapeDiverViewerError {
|
|
79
|
-
constructor(
|
|
80
|
-
public readonly message: string,
|
|
81
|
-
public readonly errorObject?: Error | unknown
|
|
82
|
-
) {
|
|
83
|
-
super(ShapeDiverViewerErrorType.CAMERA_ERROR, 'An error occurred while working with the cameras.', message);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export class ShapeDiverViewerArError extends ShapeDiverViewerError {
|
|
88
|
-
constructor(
|
|
89
|
-
public readonly message: string,
|
|
90
|
-
public readonly errorObject?: Error | unknown
|
|
91
|
-
) {
|
|
92
|
-
super(ShapeDiverViewerErrorType.AR_ERROR, 'An error occurred while working with AR.', message);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export class ShapeDiverViewerValidationError extends ShapeDiverViewerError {
|
|
97
|
-
constructor(
|
|
98
|
-
public readonly message: string,
|
|
99
|
-
public readonly value: any,
|
|
100
|
-
public readonly requestedType: string,
|
|
101
|
-
public readonly errorObject?: Error | unknown
|
|
102
|
-
) {
|
|
103
|
-
super(ShapeDiverViewerErrorType.VALIDATION_ERROR, 'An error occurred while validating the value.', message);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class ShapeDiverViewerInteractionError extends ShapeDiverViewerError {
|
|
108
|
-
constructor(
|
|
109
|
-
public readonly message: string
|
|
110
|
-
) {
|
|
111
|
-
super(ShapeDiverViewerErrorType.INTERACTION_ERROR, 'An error occurred with interactions.', message);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export class ShapeDiverViewerDrawingToolsError extends ShapeDiverViewerError {
|
|
116
|
-
constructor(
|
|
117
|
-
public readonly message: string
|
|
118
|
-
) {
|
|
119
|
-
super(ShapeDiverViewerErrorType.INTERACTION_ERROR, 'An error occurred with drawing tools.', message);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
export class PerformanceEvaluator {
|
|
2
|
-
// #region Properties (2)
|
|
3
|
-
|
|
4
|
-
private static _instance: PerformanceEvaluator;
|
|
5
|
-
|
|
6
|
-
private _eval: {
|
|
7
|
-
start: number;
|
|
8
|
-
section: {
|
|
9
|
-
[key: string]: {
|
|
10
|
-
start: number;
|
|
11
|
-
continued?: number;
|
|
12
|
-
end?: number;
|
|
13
|
-
duration?: number;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
end?: number;
|
|
17
|
-
duration?: number;
|
|
18
|
-
} | undefined;
|
|
19
|
-
|
|
20
|
-
// #endregion Properties (2)
|
|
21
|
-
|
|
22
|
-
// #region Public Static Accessors (1)
|
|
23
|
-
|
|
24
|
-
public static get instance() {
|
|
25
|
-
return this._instance || (this._instance = new this());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// #endregion Public Static Accessors (1)
|
|
29
|
-
|
|
30
|
-
// #region Public Methods (8)
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Continue the performance evaluation.
|
|
34
|
-
*
|
|
35
|
-
* @param id
|
|
36
|
-
*/
|
|
37
|
-
public continueSection(sectionId: string): void {
|
|
38
|
-
if (!this._eval) return;
|
|
39
|
-
if (this._eval.end) return;
|
|
40
|
-
if (!this._eval.section[sectionId]) return;
|
|
41
|
-
if (this._eval.section[sectionId].end) return;
|
|
42
|
-
|
|
43
|
-
this._eval.section[sectionId].continued = performance.now();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* End the performance evaluation and calculate the duration.
|
|
48
|
-
*
|
|
49
|
-
* @param id
|
|
50
|
-
*/
|
|
51
|
-
public end(): void {
|
|
52
|
-
if (!this._eval) return;
|
|
53
|
-
if (this._eval.end) return;
|
|
54
|
-
|
|
55
|
-
this._eval.end = performance.now();
|
|
56
|
-
this._eval.duration = this._eval.end! - this._eval.start;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* End the performance evaluation of a section and calculate the duration.
|
|
61
|
-
*
|
|
62
|
-
* @param id
|
|
63
|
-
*/
|
|
64
|
-
public endSection(sectionId: string): void {
|
|
65
|
-
if (!this._eval) return;
|
|
66
|
-
if (this._eval.end) return;
|
|
67
|
-
if (!this._eval.section[sectionId]) return;
|
|
68
|
-
if (this._eval.section[sectionId].end) return;
|
|
69
|
-
|
|
70
|
-
this._eval.section[sectionId].end = performance.now();
|
|
71
|
-
|
|
72
|
-
this._eval.section[sectionId].duration = (this._eval.section[sectionId].duration || 0) + (this._eval.section[sectionId].end! - (this._eval.section[sectionId].continued || this._eval.section[sectionId].start));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get the evaluation data for a specific id.
|
|
77
|
-
*
|
|
78
|
-
* @param id
|
|
79
|
-
*/
|
|
80
|
-
public getEvaluation(): {
|
|
81
|
-
start: number,
|
|
82
|
-
section: {
|
|
83
|
-
[key: string]: {
|
|
84
|
-
start: number,
|
|
85
|
-
continued?: number,
|
|
86
|
-
end?: number,
|
|
87
|
-
duration?: number
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
end?: number,
|
|
91
|
-
duration?: number,
|
|
92
|
-
} | undefined {
|
|
93
|
-
return this._eval;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get the evaluation data for a specific id.
|
|
98
|
-
*
|
|
99
|
-
* @param id
|
|
100
|
-
*/
|
|
101
|
-
public getEvaluationToString(): string {
|
|
102
|
-
const e = this._eval;
|
|
103
|
-
return `Performance Evaluation: ${e!.duration}ms\n`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Pause the performance evaluation.
|
|
108
|
-
*
|
|
109
|
-
* @param id
|
|
110
|
-
*/
|
|
111
|
-
public pauseSection(sectionId: string): void {
|
|
112
|
-
if (!this._eval) return;
|
|
113
|
-
if (this._eval.end) return;
|
|
114
|
-
if (!this._eval.section[sectionId]) return;
|
|
115
|
-
if (this._eval.section[sectionId].end) return;
|
|
116
|
-
|
|
117
|
-
this._eval.section[sectionId].duration = (this._eval.section[sectionId].duration || 0) + performance.now() - (this._eval.section[sectionId].continued || this._eval.section[sectionId].start);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Start the evaluation with a specific id.
|
|
122
|
-
*
|
|
123
|
-
* @param id
|
|
124
|
-
*/
|
|
125
|
-
public start(time?: number): void {
|
|
126
|
-
this._eval = {
|
|
127
|
-
start: time || performance.now(),
|
|
128
|
-
section: {}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Start the evaluation of a section with a specific id.
|
|
134
|
-
*
|
|
135
|
-
* @param id
|
|
136
|
-
*/
|
|
137
|
-
public startSection(sectionId: string, time?: number): void {
|
|
138
|
-
if (!this._eval) return;
|
|
139
|
-
if (this._eval.end) return;
|
|
140
|
-
this._eval.section[sectionId] = {
|
|
141
|
-
start: time || performance.now(),
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// #endregion Public Methods (8)
|
|
146
|
-
}
|