@shapediver/viewer.data-engine.data-engine 3.3.4 → 3.3.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/viewer.data-engine.data-engine",
3
- "version": "3.3.4",
3
+ "version": "3.3.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Michael Oppitz <michael@shapediver.com>",
@@ -10,11 +10,10 @@
10
10
  "test": "__tests__"
11
11
  },
12
12
  "files": [
13
- "dist",
14
- "src",
15
13
  "package.json",
14
+ "dist/",
16
15
  "README.md",
17
- "tsconfig.json"
16
+ "LICENSE"
18
17
  ],
19
18
  "publishConfig": {
20
19
  "access": "public"
@@ -40,17 +39,17 @@
40
39
  },
41
40
  "dependencies": {
42
41
  "@shapediver/sdk.geometry-api-sdk-v2": "1.11.0",
43
- "@shapediver/viewer.data-engine.geometry-engine": "3.3.4",
44
- "@shapediver/viewer.data-engine.html-element-anchor-engine": "3.3.4",
45
- "@shapediver/viewer.data-engine.material-engine": "3.3.4",
46
- "@shapediver/viewer.data-engine.sdtf-engine": "3.3.4",
47
- "@shapediver/viewer.data-engine.tag3d-engine": "3.3.4",
48
- "@shapediver/viewer.shared.global-access-objects": "3.3.4",
49
- "@shapediver/viewer.shared.node-tree": "3.3.4",
50
- "@shapediver/viewer.shared.services": "3.3.4",
51
- "@shapediver/viewer.shared.types": "3.3.4",
42
+ "@shapediver/viewer.data-engine.geometry-engine": "3.3.6",
43
+ "@shapediver/viewer.data-engine.html-element-anchor-engine": "3.3.6",
44
+ "@shapediver/viewer.data-engine.material-engine": "3.3.6",
45
+ "@shapediver/viewer.data-engine.sdtf-engine": "3.3.6",
46
+ "@shapediver/viewer.data-engine.tag3d-engine": "3.3.6",
47
+ "@shapediver/viewer.shared.global-access-objects": "3.3.6",
48
+ "@shapediver/viewer.shared.node-tree": "3.3.6",
49
+ "@shapediver/viewer.shared.services": "3.3.6",
50
+ "@shapediver/viewer.shared.types": "3.3.6",
52
51
  "axios": "^1.2.6",
53
52
  "gl-matrix": "3.3.0"
54
53
  },
55
- "gitHead": "8193da527b4e3fc4d90181018bd60d6ac70be3e8"
54
+ "gitHead": "13aea937b128a001e6e93be300674c4a04624c29"
56
55
  }
package/src/DataEngine.ts DELETED
@@ -1,99 +0,0 @@
1
- import { CustomData, TASK_TYPE } from '@shapediver/viewer.shared.types';
2
- import {
3
- EventEngine,
4
- EVENTTYPE,
5
- ShapeDiverViewerDataProcessingError,
6
- UuidGenerator
7
- } from '@shapediver/viewer.shared.services';
8
- import { GeometryEngine } from '@shapediver/viewer.data-engine.geometry-engine';
9
- import { HTMLElementAnchorEngine } from '@shapediver/viewer.data-engine.html-element-anchor-engine';
10
- import { ITreeNode, TreeNode } from '@shapediver/viewer.shared.node-tree';
11
- import { mat4 } from 'gl-matrix';
12
- import { MaterialEngine } from '@shapediver/viewer.data-engine.material-engine';
13
- import { SDTFEngine } from '@shapediver/viewer.data-engine.sdtf-engine';
14
- import { ShapeDiverResponseOutputContent } from '@shapediver/sdk.geometry-api-sdk-v2';
15
- import { Tag3dEngine } from '@shapediver/viewer.data-engine.tag3d-engine';
16
-
17
- export class DataEngine {
18
- // #region Properties (8)
19
-
20
- private readonly _eventEngine: EventEngine = EventEngine.instance;
21
- private readonly _geometryEngine: GeometryEngine = GeometryEngine.instance;
22
- private readonly _htmlElementAnchorEngine: HTMLElementAnchorEngine = HTMLElementAnchorEngine.instance;
23
- private readonly _materialEngine: MaterialEngine = MaterialEngine.instance;
24
- private readonly _sdtfEngine: SDTFEngine = SDTFEngine.instance;
25
- private readonly _tag3dEngine: Tag3dEngine = Tag3dEngine.instance;
26
- private readonly _uuidGenerator: UuidGenerator = UuidGenerator.instance;
27
-
28
- private static _instance: DataEngine;
29
-
30
- // #endregion Properties (8)
31
-
32
- // #region Public Static Getters And Setters (1)
33
-
34
- public static get instance() {
35
- return this._instance || (this._instance = new this());
36
- }
37
-
38
- // #endregion Public Static Getters And Setters (1)
39
-
40
- // #region Public Methods (1)
41
-
42
- public async loadContent(content: ShapeDiverResponseOutputContent, jwtToken?: string, taskEventId?: string): Promise<ITreeNode> {
43
- if (!content || (content && !content.format))
44
- throw new ShapeDiverViewerDataProcessingError('DataEngine cannot load content.');
45
-
46
- taskEventId = taskEventId || this._uuidGenerator.create();
47
-
48
- let node: ITreeNode;
49
-
50
- if (content.format === 'glb' || content.format === 'gltf') {
51
- node = await this._geometryEngine.loadContent(content, taskEventId);
52
- } else if (content.format === 'material') {
53
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_START, { type: TASK_TYPE.MATERIAL_CONTENT_LOADING, id: taskEventId, progress: 0, status: 'Loading material content.' });
54
- node = await this._materialEngine.loadContent(content);
55
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_END, { type: TASK_TYPE.MATERIAL_CONTENT_LOADING, id: taskEventId, progress: 1, status: 'MATERIAL content loaded.' });
56
- } else if (content.format === 'tag2d' || content.format === 'anchor') {
57
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_START, { type: TASK_TYPE.TAG_CONTENT_LOADING, id: taskEventId, progress: 0, status: 'Loading tag content.' });
58
- node = await this._htmlElementAnchorEngine.loadContent(content);
59
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_END, { type: TASK_TYPE.TAG_CONTENT_LOADING, id: taskEventId, progress: 1, status: 'Tag content loaded.' });
60
- } else if (content.format === 'tag3d') {
61
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_START, { type: TASK_TYPE.TAG_CONTENT_LOADING, id: taskEventId, progress: 0, status: 'Loading tag content.' });
62
- node = await this._tag3dEngine.loadContent(content);
63
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_END, { type: TASK_TYPE.TAG_CONTENT_LOADING, id: taskEventId, progress: 1, status: 'Tag content loaded.' });
64
- } else if (content.format === 'sdtf') {
65
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_START, { type: TASK_TYPE.SDTF_CONTENT_LOADING, id: taskEventId, progress: 0, status: 'Loading sdTF content.' });
66
- node = await this._sdtfEngine.loadContent(content, jwtToken);
67
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_END, { type: TASK_TYPE.SDTF_CONTENT_LOADING, id: taskEventId, progress: 1, status: 'SdTF content loaded.' });
68
- } else {
69
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_START, { type: TASK_TYPE.CUSTOM_CONTENT_LOADING, id: taskEventId, progress: 0, status: 'Loading custom content.' });
70
- node = new TreeNode('custom');
71
- node.data.push(new CustomData({ ...content }));
72
- this._eventEngine.emitEvent(EVENTTYPE.TASK.TASK_END, { type: TASK_TYPE.CUSTOM_CONTENT_LOADING, id: taskEventId, progress: 1, status: 'Custom content loaded.' });
73
- }
74
-
75
- const transformationNode = new TreeNode('transformation');
76
- if (content.transformations && Array.isArray(content.transformations)) {
77
- for (let i = 0; i < content.transformations.length; i++) {
78
- const t = content.transformations[i];
79
- if (Array.isArray(t) && t.length === 16) {
80
- const nodeInstance = node.clone();
81
- nodeInstance.transformations = [{
82
- id: 'content_' + i,
83
- matrix: mat4.fromValues(t[0], t[1], t[2], t[3],
84
- t[4], t[5], t[6], t[7],
85
- t[8], t[9], t[10], t[11],
86
- t[12], t[13], t[14], t[15])
87
- }].concat(node.transformations);
88
- transformationNode.updateVersion();
89
- transformationNode.addChild(nodeInstance);
90
- }
91
- }
92
- } else {
93
- transformationNode.addChild(node)
94
- }
95
- return transformationNode;
96
- }
97
-
98
- // #endregion Public Methods (1)
99
- }
package/src/index.ts DELETED
@@ -1,9 +0,0 @@
1
- import { DataEngine } from './DataEngine';
2
- import { GlobalAccessObjects } from '@shapediver/viewer.shared.global-access-objects';
3
-
4
- export {
5
- DataEngine
6
- };
7
-
8
- const instance = DataEngine.instance;
9
- GlobalAccessObjects.instance.loadContent = instance.loadContent.bind(instance);
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": [
4
- "./**/*.ts"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "src",
8
- "outDir": "dist"
9
- },
10
- "exclude": [
11
- "__tests__",
12
- "node_modules",
13
- "dist",
14
- "dist-dev",
15
- "dist-prod"
16
- ]
17
- }