@buerli.io/core 0.13.0 → 0.13.1-beta.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 (81) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/README.md +12 -12
  3. package/build/cjs/geometry/ThreeGeometryCreator.js +320 -320
  4. package/build/cjs/geometry/index.js +17 -17
  5. package/build/cjs/graphic/filters.js +25 -25
  6. package/build/cjs/index.js +25 -25
  7. package/build/cjs/store/index.js +37 -37
  8. package/build/cjs/store/states/buerli.js +98 -98
  9. package/build/cjs/store/states/cad.js +47 -47
  10. package/build/cjs/store/states/drawing.js +49 -49
  11. package/build/cjs/store/states/geometry.js +157 -157
  12. package/build/cjs/store/states/graphic.js +112 -112
  13. package/build/cjs/store/states/interaction.js +55 -55
  14. package/build/cjs/store/states/message.js +25 -25
  15. package/build/cjs/store/states/plugin.js +115 -115
  16. package/build/cjs/store/states/selection.js +267 -267
  17. package/build/cjs/store/states/structure.js +250 -250
  18. package/build/cjs/store/store.js +9 -9
  19. package/build/cjs/store/subscribtion/selection.js +49 -49
  20. package/build/cjs/store/subscribtion/subscribeToDrawing.js +13 -13
  21. package/build/cjs/types/IGraphicPackage.js +46 -46
  22. package/build/cjs/types/IStructurePatch.js +2 -2
  23. package/build/cjs/types/IStructureTree.js +28 -28
  24. package/build/cjs/types/InteractionInfo.js +11 -11
  25. package/build/cjs/types/index.js +20 -20
  26. package/build/cjs/utils/Math.js +91 -91
  27. package/build/cjs/utils/Measure.js +576 -576
  28. package/build/cjs/utils/Timing.js +34 -34
  29. package/build/esm/geometry/ThreeGeometryCreator.js +291 -291
  30. package/build/esm/geometry/index.js +1 -1
  31. package/build/esm/graphic/filters.js +12 -12
  32. package/build/esm/index.js +9 -9
  33. package/build/esm/store/index.js +26 -26
  34. package/build/esm/store/states/buerli.js +92 -92
  35. package/build/esm/store/states/cad.js +42 -42
  36. package/build/esm/store/states/drawing.js +45 -45
  37. package/build/esm/store/states/geometry.js +129 -129
  38. package/build/esm/store/states/graphic.js +107 -107
  39. package/build/esm/store/states/interaction.js +50 -50
  40. package/build/esm/store/states/message.js +21 -21
  41. package/build/esm/store/states/plugin.js +109 -109
  42. package/build/esm/store/states/selection.js +261 -261
  43. package/build/esm/store/states/structure.js +219 -219
  44. package/build/esm/store/store.js +3 -3
  45. package/build/esm/store/subscribtion/selection.js +44 -44
  46. package/build/esm/store/subscribtion/subscribeToDrawing.js +9 -9
  47. package/build/esm/types/IGraphicPackage.js +43 -43
  48. package/build/esm/types/IStructurePatch.js +1 -1
  49. package/build/esm/types/IStructureTree.js +24 -24
  50. package/build/esm/types/InteractionInfo.js +6 -6
  51. package/build/esm/types/index.js +4 -4
  52. package/build/esm/utils/Math.js +65 -65
  53. package/build/esm/utils/Measure.js +550 -550
  54. package/build/esm/utils/Timing.js +31 -31
  55. package/build/types/geometry/ThreeGeometryCreator.d.ts +256 -256
  56. package/build/types/geometry/index.d.ts +1 -1
  57. package/build/types/graphic/filters.d.ts +11 -11
  58. package/build/types/index.d.ts +37 -37
  59. package/build/types/store/index.d.ts +16 -16
  60. package/build/types/store/states/buerli.d.ts +41 -41
  61. package/build/types/store/states/cad.d.ts +53 -53
  62. package/build/types/store/states/drawing.d.ts +45 -45
  63. package/build/types/store/states/geometry.d.ts +65 -65
  64. package/build/types/store/states/graphic.d.ts +22 -22
  65. package/build/types/store/states/interaction.d.ts +34 -34
  66. package/build/types/store/states/message.d.ts +30 -30
  67. package/build/types/store/states/plugin.d.ts +53 -53
  68. package/build/types/store/states/selection.d.ts +62 -62
  69. package/build/types/store/states/structure.d.ts +47 -47
  70. package/build/types/store/store.d.ts +2 -2
  71. package/build/types/store/subscribtion/selection.d.ts +7 -7
  72. package/build/types/store/subscribtion/subscribeToDrawing.d.ts +4 -4
  73. package/build/types/types/IGraphicPackage.d.ts +160 -160
  74. package/build/types/types/IStructurePatch.d.ts +6 -6
  75. package/build/types/types/IStructureTree.d.ts +80 -80
  76. package/build/types/types/InteractionInfo.d.ts +43 -43
  77. package/build/types/types/index.d.ts +4 -4
  78. package/build/types/utils/Math.d.ts +21 -21
  79. package/build/types/utils/Measure.d.ts +64 -64
  80. package/build/types/utils/Timing.d.ts +8 -8
  81. package/package.json +44 -44
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,24 +1,24 @@
1
- /**
2
- * Defines the default structure tree.
3
- * Should be used to initialize a new structure tree.
4
- */
5
- export const DEFAULT_STRUCTURE_TREE = () => {
6
- return {
7
- tree: {},
8
- root: NOID,
9
- currentProduct: NOID,
10
- currentNode: NOID,
11
- currentInstance: NOID,
12
- testRoot: NOID,
13
- };
14
- };
15
- /** Zero is no Id in classcad, and no object will exist in the CCDatabase for Id === 0! */
16
- export const NOID = 0;
17
- export var MemberType;
18
- (function (MemberType) {
19
- MemberType["ARRAY"] = "array";
20
- MemberType["ID"] = "id";
21
- MemberType["POINT"] = "point";
22
- MemberType["REAL"] = "real";
23
- MemberType["STRING"] = "string";
24
- })(MemberType || (MemberType = {}));
1
+ /**
2
+ * Defines the default structure tree.
3
+ * Should be used to initialize a new structure tree.
4
+ */
5
+ export const DEFAULT_STRUCTURE_TREE = () => {
6
+ return {
7
+ tree: {},
8
+ root: NOID,
9
+ currentProduct: NOID,
10
+ currentNode: NOID,
11
+ currentInstance: NOID,
12
+ testRoot: NOID,
13
+ };
14
+ };
15
+ /** Zero is no Id in classcad, and no object will exist in the CCDatabase for Id === 0! */
16
+ export const NOID = 0;
17
+ export var MemberType;
18
+ (function (MemberType) {
19
+ MemberType["ARRAY"] = "array";
20
+ MemberType["ID"] = "id";
21
+ MemberType["POINT"] = "point";
22
+ MemberType["REAL"] = "real";
23
+ MemberType["STRING"] = "string";
24
+ })(MemberType || (MemberType = {}));
@@ -1,6 +1,6 @@
1
- export const createInfo = (data) => {
2
- return Object.assign({ uniqueIdent: createUniqueIdent(data) }, data);
3
- };
4
- export const createUniqueIdent = (data) => {
5
- return `${[data.prodRefId, data.objectId, data.containerId, data.graphicId]}`;
6
- };
1
+ export const createInfo = (data) => {
2
+ return Object.assign({ uniqueIdent: createUniqueIdent(data) }, data);
3
+ };
4
+ export const createUniqueIdent = (data) => {
5
+ return `${[data.prodRefId, data.objectId, data.containerId, data.graphicId]}`;
6
+ };
@@ -1,4 +1,4 @@
1
- export * from './IGraphicPackage';
2
- export * from './InteractionInfo';
3
- export * from './IStructurePatch';
4
- export * from './IStructureTree';
1
+ export * from './IGraphicPackage';
2
+ export * from './InteractionInfo';
3
+ export * from './IStructurePatch';
4
+ export * from './IStructureTree';
@@ -1,65 +1,65 @@
1
- import * as THREE from 'three';
2
- const degToRad = THREE.MathUtils.degToRad;
3
- const tolerance = 1e-6;
4
- export const MathUtils = {
5
- convertToMatrix4: function (coordinateSystem) {
6
- const [orig, vx, vy, vz] = coordinateSystem.map(row => new THREE.Vector3().fromArray(row));
7
- return new THREE.Matrix4().makeBasis(vx, vy, vz).setPosition(orig);
8
- },
9
- convertToMatrix3: function (coordinateSystem) {
10
- const [, vx, vy, vz] = coordinateSystem;
11
- return new THREE.Matrix3().fromArray([...vx, ...vy, ...vz]);
12
- },
13
- convertToCoordinateSystem: function (matrix) {
14
- const position = new THREE.Vector3();
15
- const xAxis = new THREE.Vector3();
16
- const yAxis = new THREE.Vector3();
17
- const zAxis = new THREE.Vector3();
18
- position.setFromMatrixPosition(matrix);
19
- matrix.extractBasis(xAxis, yAxis, zAxis);
20
- const coordSys = [];
21
- coordSys[0] = [position.x, position.y, position.z];
22
- coordSys[1] = [xAxis.x, xAxis.y, xAxis.z];
23
- coordSys[2] = [yAxis.x, yAxis.y, yAxis.z];
24
- coordSys[3] = [zAxis.x, zAxis.y, zAxis.z];
25
- return coordSys;
26
- },
27
- round(value, digits) {
28
- if (isNaN(value))
29
- return NaN;
30
- const factor = Math.pow(10, digits);
31
- return Math.round(value * factor) / factor;
32
- },
33
- /**
34
- * Calculates a transformation matrix.
35
- *
36
- * xDir and yDir are NOT orthogonal in general case, thus the y-axis is calculated as a series of cross products.
37
- *
38
- * @param originPos The origin position.
39
- * @param xDir The x direction.
40
- * @param yDir The y direction.
41
- * @param offset The offset vector.
42
- * @param rotation The rotation vector.
43
- * @param inverted The inverted flag --- 0: do not invert; 1: do invert.
44
- * @returns The calculated THREE.Matrix4
45
- */
46
- calcluateTransform: function (originPos, xDir, yDir, offset, rotation, inverted) {
47
- rotation = new THREE.Vector3(degToRad(rotation.x), degToRad(rotation.y), degToRad(rotation.z));
48
- const xAxis = xDir.clone().normalize();
49
- let yDir_ = yDir.clone().normalize();
50
- if (Math.abs(yDir_.dot(xAxis.clone())) > 1 - tolerance) {
51
- yDir_ = Math.abs(xAxis.y) !== 1 ? new THREE.Vector3(0.0, 1.0, 0.0) : new THREE.Vector3(1.0, 0.0, 0.0);
52
- }
53
- const zAxis = xAxis.clone().cross(yDir_).normalize();
54
- const yAxis = zAxis.clone().cross(xAxis).normalize();
55
- if (inverted) {
56
- xAxis.negate();
57
- zAxis.negate();
58
- }
59
- const mLocal = new THREE.Matrix4()
60
- .makeRotationFromEuler(new THREE.Euler(rotation.x, rotation.y, rotation.z))
61
- .setPosition(offset.x, offset.y, offset.z);
62
- const mGlobal = new THREE.Matrix4().makeBasis(xAxis, yAxis, zAxis).setPosition(originPos);
63
- return mGlobal.clone().multiply(mLocal);
64
- },
65
- };
1
+ import * as THREE from 'three';
2
+ const degToRad = THREE.MathUtils.degToRad;
3
+ const tolerance = 1e-6;
4
+ export const MathUtils = {
5
+ convertToMatrix4: function (coordinateSystem) {
6
+ const [orig, vx, vy, vz] = coordinateSystem.map(row => new THREE.Vector3().fromArray(row));
7
+ return new THREE.Matrix4().makeBasis(vx, vy, vz).setPosition(orig);
8
+ },
9
+ convertToMatrix3: function (coordinateSystem) {
10
+ const [, vx, vy, vz] = coordinateSystem;
11
+ return new THREE.Matrix3().fromArray([...vx, ...vy, ...vz]);
12
+ },
13
+ convertToCoordinateSystem: function (matrix) {
14
+ const position = new THREE.Vector3();
15
+ const xAxis = new THREE.Vector3();
16
+ const yAxis = new THREE.Vector3();
17
+ const zAxis = new THREE.Vector3();
18
+ position.setFromMatrixPosition(matrix);
19
+ matrix.extractBasis(xAxis, yAxis, zAxis);
20
+ const coordSys = [];
21
+ coordSys[0] = [position.x, position.y, position.z];
22
+ coordSys[1] = [xAxis.x, xAxis.y, xAxis.z];
23
+ coordSys[2] = [yAxis.x, yAxis.y, yAxis.z];
24
+ coordSys[3] = [zAxis.x, zAxis.y, zAxis.z];
25
+ return coordSys;
26
+ },
27
+ round(value, digits) {
28
+ if (isNaN(value))
29
+ return NaN;
30
+ const factor = Math.pow(10, digits);
31
+ return Math.round(value * factor) / factor;
32
+ },
33
+ /**
34
+ * Calculates a transformation matrix.
35
+ *
36
+ * xDir and yDir are NOT orthogonal in general case, thus the y-axis is calculated as a series of cross products.
37
+ *
38
+ * @param originPos The origin position.
39
+ * @param xDir The x direction.
40
+ * @param yDir The y direction.
41
+ * @param offset The offset vector.
42
+ * @param rotation The rotation vector.
43
+ * @param inverted The inverted flag --- 0: do not invert; 1: do invert.
44
+ * @returns The calculated THREE.Matrix4
45
+ */
46
+ calcluateTransform: function (originPos, xDir, yDir, offset, rotation, inverted) {
47
+ rotation = new THREE.Vector3(degToRad(rotation.x), degToRad(rotation.y), degToRad(rotation.z));
48
+ const xAxis = xDir.clone().normalize();
49
+ let yDir_ = yDir.clone().normalize();
50
+ if (Math.abs(yDir_.dot(xAxis.clone())) > 1 - tolerance) {
51
+ yDir_ = Math.abs(xAxis.y) !== 1 ? new THREE.Vector3(0.0, 1.0, 0.0) : new THREE.Vector3(1.0, 0.0, 0.0);
52
+ }
53
+ const zAxis = xAxis.clone().cross(yDir_).normalize();
54
+ const yAxis = zAxis.clone().cross(xAxis).normalize();
55
+ if (inverted) {
56
+ xAxis.negate();
57
+ zAxis.negate();
58
+ }
59
+ const mLocal = new THREE.Matrix4()
60
+ .makeRotationFromEuler(new THREE.Euler(rotation.x, rotation.y, rotation.z))
61
+ .setPosition(offset.x, offset.y, offset.z);
62
+ const mGlobal = new THREE.Matrix4().makeBasis(xAxis, yAxis, zAxis).setPosition(originPos);
63
+ return mGlobal.clone().multiply(mLocal);
64
+ },
65
+ };