@shapediver/viewer.shared.node-tree 2.3.5 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/implementation/AbstractTree.d.ts +14 -0
  2. package/dist/implementation/AbstractTree.d.ts.map +1 -0
  3. package/dist/implementation/{Tree.js → AbstractTree.js} +21 -29
  4. package/dist/implementation/AbstractTree.js.map +1 -0
  5. package/dist/implementation/{TreeNode.d.ts → AbstractTreeNode.d.ts} +21 -24
  6. package/dist/implementation/AbstractTreeNode.d.ts.map +1 -0
  7. package/dist/implementation/AbstractTreeNode.js +296 -0
  8. package/dist/implementation/AbstractTreeNode.js.map +1 -0
  9. package/dist/implementation/AbstractTreeNodeData.d.ts +2 -2
  10. package/dist/implementation/AbstractTreeNodeData.d.ts.map +1 -1
  11. package/dist/implementation/AbstractTreeNodeData.js +10 -0
  12. package/dist/implementation/AbstractTreeNodeData.js.map +1 -1
  13. package/dist/implementation/three/AbstractTreeNodeDataThreeJs.d.ts +9 -0
  14. package/dist/implementation/three/AbstractTreeNodeDataThreeJs.d.ts.map +1 -0
  15. package/dist/implementation/three/AbstractTreeNodeDataThreeJs.js +23 -0
  16. package/dist/implementation/three/AbstractTreeNodeDataThreeJs.js.map +1 -0
  17. package/dist/implementation/three/Tree.d.ts +7 -0
  18. package/dist/implementation/three/Tree.d.ts.map +1 -0
  19. package/dist/implementation/three/Tree.js +26 -0
  20. package/dist/implementation/three/Tree.js.map +1 -0
  21. package/dist/implementation/three/TreeNodeThreejs.d.ts +12 -0
  22. package/dist/implementation/three/TreeNodeThreejs.d.ts.map +1 -0
  23. package/dist/implementation/three/TreeNodeThreejs.js +35 -0
  24. package/dist/implementation/three/TreeNodeThreejs.js.map +1 -0
  25. package/dist/index.d.ts +10 -10
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +5 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/interfaces/ITree.d.ts +11 -7
  30. package/dist/interfaces/ITree.d.ts.map +1 -1
  31. package/dist/interfaces/ITreeNode.d.ts +85 -30
  32. package/dist/interfaces/ITreeNode.d.ts.map +1 -1
  33. package/dist/interfaces/ITreeNodeData.d.ts +16 -2
  34. package/dist/interfaces/ITreeNodeData.d.ts.map +1 -1
  35. package/dist/interfaces/three/ITreeNodeDataThreeJs.d.ts +10 -0
  36. package/dist/interfaces/three/ITreeNodeDataThreeJs.d.ts.map +1 -0
  37. package/dist/interfaces/three/ITreeNodeDataThreeJs.js +3 -0
  38. package/dist/interfaces/three/ITreeNodeDataThreeJs.js.map +1 -0
  39. package/dist/interfaces/three/ITreeNodeThreeJs.d.ts +16 -0
  40. package/dist/interfaces/three/ITreeNodeThreeJs.d.ts.map +1 -0
  41. package/dist/interfaces/three/ITreeNodeThreeJs.js +3 -0
  42. package/dist/interfaces/three/ITreeNodeThreeJs.js.map +1 -0
  43. package/dist/interfaces/three/ITreeThreeJs.d.ts +5 -0
  44. package/dist/interfaces/three/ITreeThreeJs.d.ts.map +1 -0
  45. package/dist/interfaces/{ISDObject.js → three/ITreeThreeJs.js} +1 -1
  46. package/dist/interfaces/three/ITreeThreeJs.js.map +1 -0
  47. package/package.json +4 -4
  48. package/src/implementation/{Tree.ts → AbstractTree.ts} +12 -13
  49. package/src/implementation/{TreeNode.ts → AbstractTreeNode.ts} +39 -44
  50. package/src/implementation/AbstractTreeNodeData.ts +5 -2
  51. package/src/implementation/three/AbstractTreeNodeDataThreeJs.ts +11 -0
  52. package/src/implementation/three/Tree.ts +12 -0
  53. package/src/implementation/three/TreeNodeThreeJs.ts +20 -0
  54. package/src/index.ts +10 -12
  55. package/src/interfaces/ITree.ts +11 -7
  56. package/src/interfaces/ITreeNode.ts +89 -55
  57. package/src/interfaces/ITreeNodeData.ts +25 -2
  58. package/src/interfaces/three/ITreeNodeDataThreeJs.ts +12 -0
  59. package/src/interfaces/three/ITreeNodeThreeJs.ts +18 -0
  60. package/src/interfaces/three/ITreeThreeJs.ts +4 -0
  61. package/dist/implementation/Tree.d.ts +0 -13
  62. package/dist/implementation/Tree.d.ts.map +0 -1
  63. package/dist/implementation/Tree.js.map +0 -1
  64. package/dist/implementation/TreeNode.d.ts.map +0 -1
  65. package/dist/implementation/TreeNode.js +0 -295
  66. package/dist/implementation/TreeNode.js.map +0 -1
  67. package/dist/interfaces/ISDObject.d.ts +0 -7
  68. package/dist/interfaces/ISDObject.d.ts.map +0 -1
  69. package/dist/interfaces/ISDObject.js.map +0 -1
  70. package/src/interfaces/ISDObject.ts +0 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../src/implementation/three/Tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,qBACa,IAAK,SAAQ,YAAY,CAAC,gBAAgB,CAAE,YAAW,YAAY;;CAI/E"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Tree = void 0;
13
+ const tsyringe_1 = require("tsyringe");
14
+ const AbstractTree_1 = require("../AbstractTree");
15
+ const TreeNodeThreejs_1 = require("./TreeNodeThreejs");
16
+ let Tree = class Tree extends AbstractTree_1.AbstractTree {
17
+ constructor() {
18
+ super(new TreeNodeThreejs_1.TreeNodeThreeJs('root'));
19
+ }
20
+ };
21
+ Tree = __decorate([
22
+ (0, tsyringe_1.singleton)(),
23
+ __metadata("design:paramtypes", [])
24
+ ], Tree);
25
+ exports.Tree = Tree;
26
+ //# sourceMappingURL=Tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/implementation/three/Tree.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAqC;AAGrC,kDAA+C;AAC/C,uDAAoD;AAGpD,IAAa,IAAI,GAAjB,MAAa,IAAK,SAAQ,2BAA8B;IACpD;QACI,KAAK,CAAC,IAAI,iCAAe,CAAC,MAAM,CAAC,CAAC,CAAA;IACtC,CAAC;CACJ,CAAA;AAJY,IAAI;IADhB,IAAA,oBAAS,GAAE;;GACC,IAAI,CAIhB;AAJY,oBAAI"}
@@ -0,0 +1,12 @@
1
+ import { ITreeNodeDataThreeJs } from "../../interfaces/three/ITreeNodeDataThreeJs";
2
+ import { ITreeNodeThreeJs } from "../../interfaces/three/ITreeNodeThreeJs";
3
+ import { AbstractTreeNode } from "../AbstractTreeNode";
4
+ export declare class TreeNodeThreeJs extends AbstractTreeNode<ITreeNodeThreeJs, ITreeNodeDataThreeJs> implements ITreeNodeThreeJs {
5
+ #private;
6
+ get threeJsObject(): {
7
+ [key: string]: THREE.Object3D;
8
+ };
9
+ get updateCallbackThreeJsObject(): ((newObj: THREE.Object3D, oldObj: THREE.Object3D, viewport: string) => void) | null;
10
+ set updateCallbackThreeJsObject(value: ((newObj: THREE.Object3D, oldObj: THREE.Object3D, viewport: string) => void) | null);
11
+ }
12
+ //# sourceMappingURL=TreeNodeThreejs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeThreejs.d.ts","sourceRoot":"","sources":["../../../src/implementation/three/TreeNodeThreejs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,qBAAa,eAAgB,SAAQ,gBAAgB,CAAC,gBAAgB,EAAE,oBAAoB,CAAE,YAAW,gBAAgB;;IAIrH,IAAW,aAAa,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAA;KAAE,CAE5D;IAED,IAAW,2BAA2B,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAE5H;IAED,IAAW,2BAA2B,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,EAEhI;CACJ"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _TreeNodeThreeJs_threeJsObject, _TreeNodeThreeJs_updateCallbackThreeJsObject;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.TreeNodeThreeJs = void 0;
16
+ const AbstractTreeNode_1 = require("../AbstractTreeNode");
17
+ class TreeNodeThreeJs extends AbstractTreeNode_1.AbstractTreeNode {
18
+ constructor() {
19
+ super(...arguments);
20
+ _TreeNodeThreeJs_threeJsObject.set(this, {});
21
+ _TreeNodeThreeJs_updateCallbackThreeJsObject.set(this, null);
22
+ }
23
+ get threeJsObject() {
24
+ return __classPrivateFieldGet(this, _TreeNodeThreeJs_threeJsObject, "f");
25
+ }
26
+ get updateCallbackThreeJsObject() {
27
+ return __classPrivateFieldGet(this, _TreeNodeThreeJs_updateCallbackThreeJsObject, "f");
28
+ }
29
+ set updateCallbackThreeJsObject(value) {
30
+ __classPrivateFieldSet(this, _TreeNodeThreeJs_updateCallbackThreeJsObject, value, "f");
31
+ }
32
+ }
33
+ exports.TreeNodeThreeJs = TreeNodeThreeJs;
34
+ _TreeNodeThreeJs_threeJsObject = new WeakMap(), _TreeNodeThreeJs_updateCallbackThreeJsObject = new WeakMap();
35
+ //# sourceMappingURL=TreeNodeThreejs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeThreejs.js","sourceRoot":"","sources":["../../../src/implementation/three/TreeNodeThreejs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,0DAAuD;AAEvD,MAAa,eAAgB,SAAQ,mCAAwD;IAA7F;;QACI,yCAAoD,EAAE,EAAC;QACvD,uDAAoH,IAAI,EAAC;IAa7H,CAAC;IAXG,IAAW,aAAa;QACpB,OAAO,uBAAA,IAAI,sCAAe,CAAC;IAC/B,CAAC;IAED,IAAW,2BAA2B;QAClC,OAAO,uBAAA,IAAI,oDAA6B,CAAC;IAC7C,CAAC;IAED,IAAW,2BAA2B,CAAC,KAA0F;QAC7H,uBAAA,IAAI,gDAAgC,KAAK,MAAA,CAAC;IAC9C,CAAC;CACJ;AAfD,0CAeC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { ITreeNodeData } from './interfaces/ITreeNodeData';
2
- import { AbstractTreeNodeData } from './implementation/AbstractTreeNodeData';
3
- import { ISDObject } from './interfaces/ISDObject';
4
- import { ITree } from './interfaces/ITree';
5
- import { Tree } from './implementation/Tree';
6
- import { ITransformation, ITreeNode } from './interfaces/ITreeNode';
7
- import { TreeNode } from './implementation/TreeNode';
8
- export { ITree, Tree };
9
- export { ITreeNode, TreeNode, ITransformation };
10
- export { ITreeNodeData, ISDObject, AbstractTreeNodeData };
1
+ import { ITransformation } from './interfaces/ITreeNode';
2
+ import { TreeNodeThreeJs } from './implementation/three/TreeNodeThreejs';
3
+ import { ITreeNodeThreeJs } from './interfaces/three/ITreeNodeThreeJs';
4
+ import { Tree } from './implementation/three/Tree';
5
+ import { ITreeThreeJs } from './interfaces/three/ITreeThreeJs';
6
+ import { ITreeNodeDataThreeJs } from './interfaces/three/ITreeNodeDataThreeJs';
7
+ import { AbstractTreeNodeDataThreeJs } from './implementation/three/AbstractTreeNodeDataThreeJs';
8
+ export { ITreeThreeJs as ITree, Tree };
9
+ export { ITreeNodeThreeJs as ITreeNode, TreeNodeThreeJs as TreeNode, ITransformation };
10
+ export { ITreeNodeDataThreeJs as ITreeNodeData, AbstractTreeNodeDataThreeJs as AbstractTreeNodeData };
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEpD,OAAO,EACH,KAAK,EAAE,IAAI,EACd,CAAA;AAED,OAAO,EACH,SAAS,EAAE,QAAQ,EAAE,eAAe,EACvC,CAAA;AAED,OAAO,EACH,aAAa,EACb,SAAS,EACT,oBAAoB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAEhG,OAAO,EACH,YAAY,IAAI,KAAK,EAAE,IAAI,EAC9B,CAAA;AAED,OAAO,EACH,gBAAgB,IAAI,SAAS,EAAE,eAAe,IAAI,QAAQ,EAAE,eAAe,EAC9E,CAAA;AAED,OAAO,EACH,oBAAoB,IAAI,aAAa,EAAE,2BAA2B,IAAI,oBAAoB,EAC7F,CAAA"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractTreeNodeData = exports.TreeNode = exports.Tree = void 0;
4
- const AbstractTreeNodeData_1 = require("./implementation/AbstractTreeNodeData");
5
- Object.defineProperty(exports, "AbstractTreeNodeData", { enumerable: true, get: function () { return AbstractTreeNodeData_1.AbstractTreeNodeData; } });
6
- const Tree_1 = require("./implementation/Tree");
4
+ const TreeNodeThreejs_1 = require("./implementation/three/TreeNodeThreejs");
5
+ Object.defineProperty(exports, "TreeNode", { enumerable: true, get: function () { return TreeNodeThreejs_1.TreeNodeThreeJs; } });
6
+ const Tree_1 = require("./implementation/three/Tree");
7
7
  Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return Tree_1.Tree; } });
8
- const TreeNode_1 = require("./implementation/TreeNode");
9
- Object.defineProperty(exports, "TreeNode", { enumerable: true, get: function () { return TreeNode_1.TreeNode; } });
8
+ const AbstractTreeNodeDataThreeJs_1 = require("./implementation/three/AbstractTreeNodeDataThreeJs");
9
+ Object.defineProperty(exports, "AbstractTreeNodeData", { enumerable: true, get: function () { return AbstractTreeNodeDataThreeJs_1.AbstractTreeNodeDataThreeJs; } });
10
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,gFAA4E;AAkBxE,qGAlBK,2CAAoB,OAkBL;AAfxB,gDAA4C;AAKjC,qFALF,WAAI,OAKE;AAHf,wDAAoD;AAOrC,yFAPN,mBAAQ,OAOM"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,4EAAwE;AAYlB,yFAZ7C,iCAAe,OAYsC;AAV9D,sDAAkD;AAMvB,qFANlB,WAAI,OAMkB;AAH/B,oGAAgG;AAWtB,qGAXjE,yDAA2B,OAW0D"}
@@ -1,6 +1,10 @@
1
1
  import { ITreeNode } from "./ITreeNode";
2
- export interface ITree {
3
- readonly root: ITreeNode;
2
+ import { ITreeNodeData } from "./ITreeNodeData";
3
+ export interface ITree<T extends ITreeNode<any, ITreeNodeData<any>>> {
4
+ /**
5
+ * The root of the tree.
6
+ */
7
+ readonly root: T;
4
8
  /**
5
9
  * Add the node as a child of the corresponding parent node.
6
10
  *
@@ -8,7 +12,7 @@ export interface ITree {
8
12
  * @param parent the targeted parent node
9
13
  * @param root optional root at which the process begins, root node will be used per default
10
14
  */
11
- addNode(node: ITreeNode, parent?: ITreeNode, root?: ITreeNode): boolean;
15
+ addNode(node: T, parent?: T, root?: T): boolean;
12
16
  /**
13
17
  * Add the node at the corresponding path. (paths are dot separated ids)
14
18
  *
@@ -16,7 +20,7 @@ export interface ITree {
16
20
  * @param path the path at which the node should be added
17
21
  * @param root optional root at which the process begins, root node will be used per default
18
22
  */
19
- addNodeAtPath(node: ITreeNode, path?: string, root?: ITreeNode): boolean;
23
+ addNodeAtPath(node: T, path?: string, root?: T): boolean;
20
24
  /**
21
25
  * Get the node at the provided path.
22
26
  *
@@ -24,20 +28,20 @@ export interface ITree {
24
28
  * @param root
25
29
  * @returns
26
30
  */
27
- getNodeAtPath(path?: string, root?: ITreeNode): ITreeNode | null;
31
+ getNodeAtPath(path?: string, root?: T): T | null;
28
32
  /**
29
33
  * Remove a node from the tree.
30
34
  *
31
35
  * @param node the node to remove
32
36
  * @param root optional root at which the process begins, root node will be used per default
33
37
  */
34
- removeNode(node: ITreeNode, root?: ITreeNode): boolean;
38
+ removeNode(node: T, root?: T): boolean;
35
39
  /**
36
40
  * Remove a node via the path of it.
37
41
  *
38
42
  * @param path the path of the node to be removed
39
43
  * @param root optional root at which the process begins, root node will be used per default
40
44
  */
41
- removeNodeAtPath(path: string, root?: ITreeNode): boolean;
45
+ removeNodeAtPath(path: string, root?: T): boolean;
42
46
  }
43
47
  //# sourceMappingURL=ITree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITree.d.ts","sourceRoot":"","sources":["../../src/interfaces/ITree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,KAAK;IAGlB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAMzB;;;;;;OA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AAM,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAEjD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAEvC;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;CAGrD"}
@@ -1,44 +1,99 @@
1
1
  import { mat4 } from 'gl-matrix';
2
2
  import { IBox } from '@shapediver/viewer.shared.math';
3
3
  import { ITreeNodeData } from './ITreeNodeData';
4
- import { ISDObject } from './ISDObject';
5
4
  export interface ITransformation {
6
5
  id: string;
7
6
  matrix: mat4;
8
7
  }
9
- export interface ITreeNode {
10
- readonly children: ITreeNode[];
11
- readonly data: ITreeNodeData[];
8
+ export interface ITreeNode<T extends ITreeNode<any, ITreeNodeData<any>>, U extends ITreeNodeData<any>> {
9
+ /**
10
+ * The bounding box of this tree node.
11
+ */
12
+ readonly boundingBox: IBox;
13
+ /**
14
+ * The children of this tree node. Can be added and remove via {@link addChild} and {@link removeChild}.
15
+ */
16
+ readonly children: T[];
17
+ /**
18
+ * The data of this tree node.
19
+ * The data can include Geometry, Materials, Lights, Cameras, but also informational or custom data.
20
+ *
21
+ * Can be added and remove via {@link addData} and {@link removeData}.
22
+ */
23
+ readonly data: U[];
24
+ /**
25
+ * The ID of the tree node.
26
+ */
12
27
  readonly id: string;
13
- readonly originalId: string;
28
+ /**
29
+ * The name of the tree node.
30
+ */
14
31
  readonly name: string;
15
- readonly version: string;
16
- readonly parent?: ITreeNode;
32
+ /**
33
+ * The matrix of the tree node.
34
+ * This is computed via all transformations in the {@link transformations} property.
35
+ */
17
36
  readonly nodeMatrix: mat4;
37
+ /**
38
+ * The original ID of the tree node, if it was copied.
39
+ */
40
+ readonly originalId: string;
41
+ /**
42
+ * The parent of the tree node.
43
+ * This property is automatically managed by {@link addChild} and {@link removeChild}.
44
+ */
45
+ readonly parent?: T;
46
+ /**
47
+ * The version of the tree node.
48
+ * If the version changes, the node will be marked for an update.
49
+ * A version change can be triggered via {@link updateVersion}.
50
+ */
51
+ readonly version: string;
52
+ /**
53
+ * The world matrix of the tree node.
54
+ * This includes also the transformations of all parents.
55
+ */
18
56
  readonly worldMatrix: mat4;
19
- readonly boundingBox: IBox;
20
- readonly transformedNodes: {
21
- [key: string]: ISDObject;
22
- };
57
+ /**
58
+ * The inverse matrices for the bones, if specified.
59
+ */
60
+ boneInverses: mat4[];
61
+ /**
62
+ * The optional bones that build a skeleton for animations.
63
+ */
64
+ bones: T[];
65
+ /**
66
+ * The viewports to exclude this tree node from.
67
+ */
23
68
  excludeViewports: string[];
69
+ /**
70
+ * The viewports to restrict this tree node to.
71
+ */
24
72
  restrictViewports: string[];
73
+ /**
74
+ * Property to mark this node as a skin node. (default: false)
75
+ */
76
+ skinNode: boolean;
77
+ /**
78
+ * The transformation to be applied to this tree node.
79
+ */
25
80
  transformations: ITransformation[];
81
+ /**
82
+ * Option to make this tree node visible. (default: true)
83
+ */
26
84
  visible: boolean;
27
- skinNode: boolean;
28
- bones: ITreeNode[];
29
- boneInverses: mat4[];
30
85
  /**
31
86
  * Add a child to the children of this node.
32
87
  *
33
88
  * @param child the child to add
34
89
  */
35
- addChild(child: ITreeNode): boolean;
90
+ addChild(child: T): boolean;
36
91
  /**
37
92
  * Add a data item to node.
38
93
  *
39
94
  * @param data the data to add
40
95
  */
41
- addData(data: ITreeNodeData): boolean;
96
+ addData(data: U): boolean;
42
97
  /**
43
98
  * Add a transformation to this node.
44
99
  *
@@ -50,40 +105,40 @@ export interface ITreeNode {
50
105
  * The data objects like GeometryData, MaterialData, etc. are cloned as well.
51
106
  * Depending on the size of the node and the amount of children, this can therefore be relatively slow.
52
107
  */
53
- clone(): ITreeNode;
108
+ clone(): T;
54
109
  /**
55
110
  * Clones this node and all its children.
56
111
  * The data objects like GeometryData, MaterialData, etc. are not copied in this case.
57
112
  */
58
- cloneInstance(): ITreeNode;
113
+ cloneInstance(): T;
59
114
  /**
60
115
  * Returns the child with the specified id
61
116
  */
62
- getChild(id: string): ITreeNode | undefined;
117
+ getChild(id: string): T | undefined;
63
118
  /**
64
119
  * Returns the data item with the specified id
65
120
  */
66
- getData(id: string): ITreeNodeData | undefined;
67
- /**
68
- * Returns the transformation with the specified id
69
- */
70
- getTransformation(id: string): ITransformation | undefined;
121
+ getData(id: string): U | undefined;
71
122
  /**
72
123
  * Return the path to this node.
73
124
  */
74
125
  getPath(): string;
126
+ /**
127
+ * Returns the transformation with the specified id
128
+ */
129
+ getTransformation(id: string): ITransformation | undefined;
75
130
  /**
76
131
  * Check for existence of a child from the children of this node.
77
132
  *
78
133
  * @param child the child to check
79
134
  */
80
- hasChild(child: ITreeNode): boolean;
135
+ hasChild(child: T): boolean;
81
136
  /**
82
137
  * Check for existence of a data item of this node.
83
138
  *
84
139
  * @param data the data item to check
85
140
  */
86
- hasData(data: ITreeNodeData): boolean;
141
+ hasData(data: U): boolean;
87
142
  /**
88
143
  * Check for existence of a transformation of this node.
89
144
  *
@@ -95,13 +150,13 @@ export interface ITreeNode {
95
150
  *
96
151
  * @param child the child to remove
97
152
  */
98
- removeChild(child: ITreeNode): boolean;
153
+ removeChild(child: T): boolean;
99
154
  /**
100
155
  * Remove a data item from this node.
101
156
  *
102
157
  * @param data the data to remove
103
158
  */
104
- removeData(data: ITreeNodeData): boolean;
159
+ removeData(data: U): boolean;
105
160
  /**
106
161
  * Remove a transformation from this node.
107
162
  *
@@ -113,9 +168,9 @@ export interface ITreeNode {
113
168
  *
114
169
  * @param callback
115
170
  */
116
- traverse(callback: (node: ITreeNode) => void): void;
171
+ traverse(callback: (node: T) => void): void;
117
172
  /**
118
- * Update the version
173
+ * Update the version.
119
174
  */
120
175
  updateVersion(): void;
121
176
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ITreeNode.d.ts","sourceRoot":"","sources":["../../src/interfaces/ITreeNode.ts"],"names":[],"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* The ID of the tree node data.
4
+ */
2
5
  id: string;
6
+ /**
7
+ * The version of the tree node data.
8
+ * If the version changes, the node data will be marked for an update.
9
+ * A version change can be triggered via {@link updateVersion}.
10
+ */
3
11
  version: string;
12
+ /**
13
+ * Clones this node tree data.
14
+ */
15
+ clone(): T;
16
+ /**
17
+ * Update the version.
18
+ */
4
19
  updateVersion(): void;
5
- clone(): ITreeNodeData;
6
20
  }
7
21
  //# sourceMappingURL=ITreeNodeData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITreeNodeData.d.ts","sourceRoot":"","sources":["../../src/interfaces/ITreeNodeData.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,IAAI,IAAI,CAAC;IACtB,KAAK,IAAI,aAAa,CAAC;CACxB"}
1
+ {"version":3,"file":"ITreeNodeData.d.ts","sourceRoot":"","sources":["../../src/interfaces/ITreeNodeData.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC;IAGzD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAMhB;;OAEG;IACH,KAAK,IAAI,CAAC,CAAC;IACX;;OAEG;IACH,aAAa,IAAI,IAAI,CAAC;CAGvB"}
@@ -0,0 +1,10 @@
1
+ import { ITreeNodeData } from "../ITreeNodeData";
2
+ export interface ITreeNodeDataThreeJs extends ITreeNodeData<ITreeNodeDataThreeJs> {
3
+ /**
4
+ * The threeJs object that is created for each viewport as a representation of the tree node data item.
5
+ */
6
+ threeJsObject: {
7
+ [key: string]: THREE.Object3D | THREE.BufferGeometry | THREE.Material | undefined;
8
+ };
9
+ }
10
+ //# sourceMappingURL=ITreeNodeDataThreeJs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeNodeDataThreeJs.d.ts","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeNodeDataThreeJs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,oBAAqB,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAG7E;;OAEG;IACH,aAAa,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAA;KAAE,CAAC;CAGvG"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITreeNodeDataThreeJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeNodeDataThreeJs.js","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeNodeDataThreeJs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { ITreeNode } from "../ITreeNode";
2
+ import { ITreeNodeDataThreeJs } from "./ITreeNodeDataThreeJs";
3
+ export interface ITreeNodeThreeJs extends ITreeNode<ITreeNodeThreeJs, ITreeNodeDataThreeJs> {
4
+ /**
5
+ * The threeJs object that is created for each viewport as a representation of the tree node item.
6
+ */
7
+ threeJsObject: {
8
+ [key: string]: THREE.Object3D;
9
+ };
10
+ /**
11
+ * The update callback that is called whenever the threeJs object is replaced internally.
12
+ * Changes that were done to the object can be reapplied here.
13
+ */
14
+ updateCallbackThreeJsObject: ((newObj: THREE.Object3D, oldObj: THREE.Object3D, viewport: string) => void) | null;
15
+ }
16
+ //# sourceMappingURL=ITreeNodeThreeJs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeNodeThreeJs.d.ts","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeNodeThreeJs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;IAGvF;;OAEG;IACH,aAAa,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAA;KAAE,CAAC;IAChD;;;OAGG;IACH,2BAA2B,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CAGpH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITreeNodeThreeJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeNodeThreeJs.js","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeNodeThreeJs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ITree } from "../ITree";
2
+ import { ITreeNodeThreeJs } from "./ITreeNodeThreeJs";
3
+ export interface ITreeThreeJs extends ITree<ITreeNodeThreeJs> {
4
+ }
5
+ //# sourceMappingURL=ITreeThreeJs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeThreeJs.d.ts","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeThreeJs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,gBAAgB,CAAC;CAAI"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ISDObject.js.map
3
+ //# sourceMappingURL=ITreeThreeJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITreeThreeJs.js","sourceRoot":"","sources":["../../../src/interfaces/three/ITreeThreeJs.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/viewer.shared.node-tree",
3
- "version": "2.3.5",
3
+ "version": "2.4.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Michael Oppitz <michael@shapediver.com>",
@@ -39,10 +39,10 @@
39
39
  "testEnvironment": "node"
40
40
  },
41
41
  "dependencies": {
42
- "@shapediver/viewer.shared.math": "2.3.5",
43
- "@shapediver/viewer.shared.services": "2.3.5",
42
+ "@shapediver/viewer.shared.math": "2.4.1",
43
+ "@shapediver/viewer.shared.services": "2.4.1",
44
44
  "gl-matrix": "3.3.0",
45
45
  "tsyringe": "^4.5.0"
46
46
  },
47
- "gitHead": "e0ddd8dcd9ed69964378bf5f938babf2a72f921e"
47
+ "gitHead": "352e7f4d52776b73746cb88e373f0a3acb145f43"
48
48
  }
@@ -1,26 +1,25 @@
1
- import { singleton } from 'tsyringe'
2
1
  import { ITree } from '../interfaces/ITree';
3
2
  import { ITreeNode } from '../interfaces/ITreeNode';
3
+ import { ITreeNodeData } from '../interfaces/ITreeNodeData';
4
4
 
5
- import { TreeNode } from './TreeNode'
6
-
7
- @singleton()
8
- export class Tree implements ITree {
5
+ export abstract class AbstractTree<T extends ITreeNode<any, ITreeNodeData<any>>> implements ITree<T> {
9
6
  // #region Properties (1)
10
7
 
11
- readonly #root = new TreeNode('root');
8
+ readonly #root: T;
12
9
 
13
10
  // #endregion Properties (1)
14
11
 
15
12
  // #region Constructors (1)
16
13
 
17
- constructor() { }
14
+ constructor(root: T) {
15
+ this.#root = root;
16
+ }
18
17
 
19
18
  // #endregion Constructors (1)
20
19
 
21
20
  // #region Public Accessors (1)
22
21
 
23
- public get root(): ITreeNode {
22
+ public get root(): T {
24
23
  return this.#root;
25
24
  }
26
25
 
@@ -28,7 +27,7 @@ export class Tree implements ITree {
28
27
 
29
28
  // #region Public Methods (6)
30
29
 
31
- public addNode(node: ITreeNode, parent: ITreeNode = this.#root, root: ITreeNode = this.#root): boolean {
30
+ public addNode(node: T, parent: T = this.#root, root: T = this.#root): boolean {
32
31
  if (root === parent) {
33
32
  root.addChild(node);
34
33
  return true;
@@ -43,7 +42,7 @@ export class Tree implements ITree {
43
42
  return false;
44
43
  }
45
44
 
46
- public addNodeAtPath(node: ITreeNode, path: string = this.root.getPath(), root: ITreeNode = this.#root): boolean {
45
+ public addNodeAtPath(node: T, path: string = this.root.getPath(), root: T = this.#root): boolean {
47
46
  if (root.name === path) {
48
47
  root.addChild(node);
49
48
  return true;
@@ -63,7 +62,7 @@ export class Tree implements ITree {
63
62
  return false;
64
63
  }
65
64
 
66
- public getNodeAtPath(path: string = this.root.getPath(), root: ITreeNode = this.#root): ITreeNode | null {
65
+ public getNodeAtPath(path: string = this.root.getPath(), root: T = this.#root): T | null {
67
66
  if (root.name === path)
68
67
  return root;
69
68
 
@@ -80,7 +79,7 @@ export class Tree implements ITree {
80
79
  return null;
81
80
  }
82
81
 
83
- public removeNode(node: ITreeNode, root: ITreeNode = this.#root): boolean {
82
+ public removeNode(node: T, root: T = this.#root): boolean {
84
83
  if (root.hasChild(node)) {
85
84
  root.removeChild(node);
86
85
  return true;
@@ -96,7 +95,7 @@ export class Tree implements ITree {
96
95
  return false;
97
96
  }
98
97
 
99
- public removeNodeAtPath(path: string, root: ITreeNode = this.#root): boolean {
98
+ public removeNodeAtPath(path: string, root: T = this.#root): boolean {
100
99
  if (root.name === path) {
101
100
  root.parent?.removeChild(root);
102
101
  return true;