@crystaldesign/web-planner-logic 24.10.0-beta.2 → 24.10.0-beta.21

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 (97) hide show
  1. package/build/cjs/{DivaBoxPlanner-6a883291.js → DivaBoxPlanner-f5288507.js} +16 -18
  2. package/build/cjs/{DivaStandardPlanner-a18f752d.js → DivaStandardPlanner-e910ac72.js} +26 -30
  3. package/build/cjs/{DoorPlanner-5164c50d.js → DoorPlanner-3c76f0cf.js} +1 -1
  4. package/build/cjs/{Host3DSignalR-f13134cb.js → Host3DSignalR-1e376e3f.js} +1 -6
  5. package/build/cjs/{LiviqueWWSHandler-32bb295f.js → LiviqueWWSHandler-248f4aa6.js} +1 -1
  6. package/build/cjs/{PfisterWWSHandler-0447de84.js → PfisterWWSHandler-a28671cf.js} +1 -1
  7. package/build/cjs/{PlannerHandler2D-a941c306.js → PlannerHandler2D-085a6eb4.js} +1249 -10
  8. package/build/cjs/{ProductBasketHandler-144386d9.js → ProductBasketHandler-fb47032b.js} +1 -1
  9. package/build/cjs/{SeriousBasketHandler-e7f5bfb9.js → SeriousBasketHandler-768b44df.js} +1 -1
  10. package/build/cjs/{ShelfPlanner-63df1fef.js → ShelfPlanner-6d8d7580.js} +6 -6
  11. package/build/cjs/{StandardWWSHandler-96b3ab81.js → StandardWWSHandler-196a78e7.js} +1 -1
  12. package/build/cjs/{index-0cf8efc1.js → index-3703fcc3.js} +1367 -1799
  13. package/build/cjs/index.js +1 -1
  14. package/build/esm/{DivaBoxPlanner-0a38d41b.js → DivaBoxPlanner-4c8eb4d1.js} +5 -7
  15. package/build/esm/{DivaStandardPlanner-774854f1.js → DivaStandardPlanner-bff9587a.js} +5 -9
  16. package/build/esm/{DoorPlanner-c9293a3a.js → DoorPlanner-715224ea.js} +1 -1
  17. package/build/esm/{Host3DSignalR-3ca1dd9c.js → Host3DSignalR-69dbf5aa.js} +1 -6
  18. package/build/esm/{LiviqueWWSHandler-28edc334.js → LiviqueWWSHandler-f0ff1337.js} +1 -1
  19. package/build/esm/{PfisterWWSHandler-21e4c2f3.js → PfisterWWSHandler-c869657f.js} +1 -1
  20. package/build/esm/{PlannerHandler2D-9f4f8efb.js → PlannerHandler2D-ba45ba21.js} +1245 -8
  21. package/build/esm/{ProductBasketHandler-fa0c1a9e.js → ProductBasketHandler-d5f9fa30.js} +1 -1
  22. package/build/esm/{SeriousBasketHandler-2e0ab157.js → SeriousBasketHandler-9fdcebc2.js} +1 -1
  23. package/build/esm/{ShelfPlanner-c52e6233.js → ShelfPlanner-e5c01f8b.js} +6 -6
  24. package/build/esm/{StandardWWSHandler-72ea1ffc.js → StandardWWSHandler-72cb836f.js} +1 -1
  25. package/build/esm/{index-622ebf68.js → index-98a31597.js} +1367 -1799
  26. package/build/esm/index.js +1 -1
  27. package/build/types/web-planner-logic/src/index.d.ts +1 -0
  28. package/build/types/web-planner-logic/src/index.d.ts.map +1 -1
  29. package/build/types/web-planner-logic/src/interface/API/TemplateConfigType.d.ts +7 -7
  30. package/build/types/web-planner-logic/src/interface/API/TemplateConfigType.d.ts.map +1 -1
  31. package/build/types/web-planner-logic/src/interface/API/ViewConfigDataType.d.ts +2 -5
  32. package/build/types/web-planner-logic/src/interface/API/ViewConfigDataType.d.ts.map +1 -1
  33. package/build/types/web-planner-logic/src/interface/AdditionalModelInfos.d.ts +2 -2
  34. package/build/types/web-planner-logic/src/interface/Configuration.d.ts +1 -3
  35. package/build/types/web-planner-logic/src/interface/Configuration.d.ts.map +1 -1
  36. package/build/types/web-planner-logic/src/interface/CoreTypes/index.d.ts +44 -14
  37. package/build/types/web-planner-logic/src/interface/CoreTypes/index.d.ts.map +1 -1
  38. package/build/types/web-planner-logic/src/interface/FunctionTypes/index.d.ts +1 -1
  39. package/build/types/web-planner-logic/src/interface/FunctionTypes/index.d.ts.map +1 -1
  40. package/build/types/web-planner-logic/src/interface/OptionTypes/ArticleOptionDataTypes.d.ts +0 -1
  41. package/build/types/web-planner-logic/src/interface/OptionTypes/ArticleOptionDataTypes.d.ts.map +1 -1
  42. package/build/types/web-planner-logic/src/interface/Planner/IDivaPlanner.d.ts +1 -2
  43. package/build/types/web-planner-logic/src/interface/Planner/IDivaPlanner.d.ts.map +1 -1
  44. package/build/types/web-planner-logic/src/interface/Planner/IDivaSetPlanner.d.ts +1 -3
  45. package/build/types/web-planner-logic/src/interface/Planner/IDivaSetPlanner.d.ts.map +1 -1
  46. package/build/types/web-planner-logic/src/interface/ShelfPlanner/plannerData.d.ts +3 -2
  47. package/build/types/web-planner-logic/src/interface/ShelfPlanner/plannerData.d.ts.map +1 -1
  48. package/build/types/web-planner-logic/src/logic/Article/ArticleOptionState.d.ts +0 -1
  49. package/build/types/web-planner-logic/src/logic/Article/ArticleOptionState.d.ts.map +1 -1
  50. package/build/types/web-planner-logic/src/logic/Article/DivaArticle.d.ts +2 -3
  51. package/build/types/web-planner-logic/src/logic/Article/DivaArticle.d.ts.map +1 -1
  52. package/build/types/web-planner-logic/src/logic/Basket/DivaBasketHandler.d.ts.map +1 -1
  53. package/build/types/web-planner-logic/src/logic/ConfigTree/DivaConfigTree.d.ts.map +1 -1
  54. package/build/types/web-planner-logic/src/logic/ConfigTree/Shelfplanner/ShelfPlannerGrid.d.ts +3 -2
  55. package/build/types/web-planner-logic/src/logic/ConfigTree/Shelfplanner/ShelfPlannerGrid.d.ts.map +1 -1
  56. package/build/types/web-planner-logic/src/logic/DivaApiHandler.d.ts +4 -4
  57. package/build/types/web-planner-logic/src/logic/DivaApiHandler.d.ts.map +1 -1
  58. package/build/types/web-planner-logic/src/logic/DivaCatalogHandler.d.ts.map +1 -1
  59. package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts +1 -12
  60. package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts.map +1 -1
  61. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts +1 -2
  62. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts.map +1 -1
  63. package/build/types/web-planner-logic/src/logic/Planner/DivaPlannerHandler.d.ts.map +1 -1
  64. package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts +1 -2
  65. package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts.map +1 -1
  66. package/build/types/web-planner-logic/src/logic/Planner/Rendering/DivaMediaServiceHandler.d.ts +0 -1
  67. package/build/types/web-planner-logic/src/logic/Planner/Rendering/DivaMediaServiceHandler.d.ts.map +1 -1
  68. package/build/types/web-planner-logic/src/logic/Planner/Rendering/Host3DSignalR.d.ts +0 -1
  69. package/build/types/web-planner-logic/src/logic/Planner/Rendering/Host3DSignalR.d.ts.map +1 -1
  70. package/build/types/web-planner-logic/src/logic/Planner/Rendering/PlannerHandler3D.d.ts +0 -17
  71. package/build/types/web-planner-logic/src/logic/Planner/Rendering/PlannerHandler3D.d.ts.map +1 -1
  72. package/build/types/web-planner-logic/src/logic/Planner/Rendering/RenderSettings.d.ts +0 -9
  73. package/build/types/web-planner-logic/src/logic/Planner/Rendering/RenderSettings.d.ts.map +1 -1
  74. package/build/types/web-planner-logic/src/logic/Planner/Rendering/Rendering.d.ts +0 -13
  75. package/build/types/web-planner-logic/src/logic/Planner/Rendering/Rendering.d.ts.map +1 -1
  76. package/build/types/web-planner-logic/src/logic/Planner/Rendering/types.d.ts +0 -3
  77. package/build/types/web-planner-logic/src/logic/Planner/Rendering/types.d.ts.map +1 -1
  78. package/build/types/web-planner-logic/src/logic/Set/DivaSet.d.ts +2 -3
  79. package/build/types/web-planner-logic/src/logic/Set/DivaSet.d.ts.map +1 -1
  80. package/build/types/web-planner-logic/src/logic/Set/DivaSetHandler.d.ts +0 -6
  81. package/build/types/web-planner-logic/src/logic/Set/DivaSetHandler.d.ts.map +1 -1
  82. package/build/types/web-planner-logic/src/logic/Set/FavoritesHandler.d.ts +1 -1
  83. package/build/types/web-planner-logic/src/logic/Set/FavoritesHandler.d.ts.map +1 -1
  84. package/build/types/web-planner-logic/src/model/DivaCatalogData.d.ts +1 -0
  85. package/build/types/web-planner-logic/src/model/DivaCatalogData.d.ts.map +1 -1
  86. package/build/types/web-planner-logic/src/model/Options/ArticleOptionValueData.d.ts +0 -1
  87. package/build/types/web-planner-logic/src/model/Options/ArticleOptionValueData.d.ts.map +1 -1
  88. package/build/types/web-planner-logic/src/model/Options/CatalogOptionData.d.ts.map +1 -1
  89. package/build/types/web-planner-logic/src/test/datas/environments/testing/pfister-dev.d.ts.map +1 -1
  90. package/build/types/web-planner-logic/src/test/scripts/productHandlerMoc.d.ts.map +1 -1
  91. package/package.json +2 -2
  92. package/build/cjs/DivaSingleProductPlanner-fcf3e4be.js +0 -1169
  93. package/build/cjs/DockingPointHandler-5c6b6024.js +0 -1255
  94. package/build/esm/DivaSingleProductPlanner-76dcd48c.js +0 -1158
  95. package/build/esm/DockingPointHandler-c35c0ee3.js +0 -1245
  96. package/build/types/web-planner-logic/src/logic/Planner/DivaSingleProductPlanner.d.ts +0 -140
  97. package/build/types/web-planner-logic/src/logic/Planner/DivaSingleProductPlanner.d.ts.map +0 -1
@@ -1,1245 +0,0 @@
1
- import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/createClass';
3
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
- import { V as Vector3, c as Vector2, D as DockingPoint } from './index-622ebf68.js';
5
- import DivaUtils, { md5 } from '@crystaldesign/diva-utils';
6
-
7
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
- var PlannerElementData = /*#__PURE__*/function () {
10
- function PlannerElementData(setId, basketId, _elementId, plannerType) {
11
- _classCallCheck(this, PlannerElementData);
12
- _defineProperty(this, "planElement", void 0);
13
- _defineProperty(this, "plannerStateHash", void 0);
14
- //this value saves the state of the plannerData - used to check if plannerData state changed
15
- // private dockingPoints: Map<string, DockingPoint[]>; //This map saves all docking Points accessioated to a type
16
- _defineProperty(this, "dockingPoints", void 0);
17
- //This map saves all docking Points accessioated to a type
18
- _defineProperty(this, "tempDockingPoints", void 0);
19
- //When reloading the element this array saves the previous docking points for redocking
20
- _defineProperty(this, "plannerType", void 0);
21
- _defineProperty(this, "basketId", void 0);
22
- _defineProperty(this, "doSetWidthFromSVG", void 0);
23
- _defineProperty(this, "doSetDepthFromSVG", void 0);
24
- this.basketId = basketId;
25
- this.planElement = {
26
- elementId: _elementId,
27
- setId: setId,
28
- worldPosCenter: new Vector3(0, 0, 0),
29
- //welt Position der linken hinteren unteren Ecke des Elementes
30
- rotDeg: 0,
31
- posNr: -1,
32
- setPosNr: -1
33
- };
34
- // this.dockingPoints = new Map<string, DockingPoint[]>();
35
- this.dockingPoints = [];
36
- this.tempDockingPoints = [];
37
- this.plannerStateHash = '';
38
- this.plannerType = plannerType;
39
- this.doSetWidthFromSVG = false;
40
- this.doSetDepthFromSVG = false;
41
- }
42
- return _createClass(PlannerElementData, [{
43
- key: "destroy",
44
- value: function destroy() {
45
- this.planElement.svgShapeOLF2D = null;
46
- this.planElement.svgShapeOLT2D = null;
47
- this.planElement.svgAsHTMLCanvas = undefined;
48
- this.dockingPoints = [];
49
- this.tempDockingPoints = [];
50
- }
51
- }, {
52
- key: "getTempDockingPoints",
53
- value: function getTempDockingPoints() {
54
- return this.tempDockingPoints;
55
- }
56
- }, {
57
- key: "clearTempDockingPoints",
58
- value: function clearTempDockingPoints() {
59
- this.tempDockingPoints = [];
60
- }
61
- }, {
62
- key: "getDockingPoints",
63
- value: function getDockingPoints() {
64
- return this.dockingPoints;
65
- }
66
-
67
- /**
68
- * This function returns true if any docking Point of the type is docking. For example, the type is AVL. if no AVL is docking - return false. If at least one AVL is docking - return true.
69
- * @param type Type of the docking point
70
- */
71
- }, {
72
- key: "dockingTypeIsDocking",
73
- value: function dockingTypeIsDocking(type) {
74
- var dockingPoints = this.getDockingPointsByType(type);
75
- for (var i = 0; i < dockingPoints.length; i++) {
76
- if (dockingPoints[i].IsDocking) return true;
77
- }
78
- return false;
79
- }
80
-
81
- /**
82
- * This function returns all docking DPs of a specific type.
83
- * @param type The type of the docking Point , e.g. AVL
84
- */
85
- }, {
86
- key: "getDockingDockingPointsByType",
87
- value: function getDockingDockingPointsByType(type) {
88
- var dockingPoints = this.getDockingPointsByType(type);
89
- var ret = [];
90
- for (var i = 0; i < dockingPoints.length; i++) {
91
- if (dockingPoints[i].IsDocking) ret.push(dockingPoints[i]);
92
- }
93
- return ret;
94
- }
95
-
96
- /**
97
- * This function returns all docking DPs of any type.
98
- */
99
- }, {
100
- key: "getDockingDockingPoints",
101
- value: function getDockingDockingPoints() {
102
- var ret = [];
103
- for (var i = 0; i < this.dockingPoints.length; i++) {
104
- if (this.dockingPoints[i].IsDocking) ret.push(this.dockingPoints[i]);
105
- }
106
- return ret;
107
- }
108
-
109
- /**
110
- * This function returns all notDocking DPs of a specific type.
111
- * @param type The type of the docking Point , e.g. AVL
112
- */
113
- }, {
114
- key: "getFreeDockingPointsByType",
115
- value: function getFreeDockingPointsByType(type) {
116
- var dockingPoints = this.getDockingPointsByType(type);
117
- var ret = [];
118
- for (var i = 0; i < dockingPoints.length; i++) {
119
- if (!dockingPoints[i].IsDocking) ret.push(dockingPoints[i]);
120
- }
121
- return ret;
122
- }
123
-
124
- /**
125
- * This function returns the free docking with the specific type and number
126
- * @param type
127
- * @param number
128
- */
129
- }, {
130
- key: "getFreeDockingPointByTypeAndNumber",
131
- value: function getFreeDockingPointByTypeAndNumber(type, number) {
132
- for (var i = 0; i < this.dockingPoints.length; i++) {
133
- if (!this.dockingPoints[i].IsDocking && this.dockingPoints[i].Type == type && this.dockingPoints[i].Number == number) return this.dockingPoints[i];
134
- }
135
- return undefined;
136
- }
137
-
138
- /**
139
- * This function returns all docking points of the element. It returns docking and not docking points with any type.
140
- */
141
- }, {
142
- key: "getAllDockingPoints",
143
- value: function getAllDockingPoints() {
144
- return this.dockingPoints;
145
- }
146
- }, {
147
- key: "getDockingPointsByType",
148
- value: function getDockingPointsByType(type) {
149
- var dps = [];
150
- for (var i = 0; i < this.dockingPoints.length; i++) {
151
- if (this.dockingPoints[i].Type == type) {
152
- dps.push(this.dockingPoints[i]);
153
- }
154
- }
155
- return dps;
156
- }
157
- }, {
158
- key: "getDockingPointById",
159
- value: function getDockingPointById(id) {
160
- for (var i = 0; i < this.dockingPoints.length; i++) {
161
- if (this.dockingPoints[i].DpId == id) {
162
- return this.dockingPoints[i];
163
- }
164
- }
165
- return undefined;
166
- }
167
- /**
168
- * This function retuns the DockingPoint info in a string format that is used for the 3D image rendering planningData.
169
- */
170
- }, {
171
- key: "getDockingPointJS3D",
172
- value: function getDockingPointJS3D() {
173
- var dpJS = '';
174
- for (var i = 0; i < this.dockingPoints.length; i++) {
175
- var dockingPoint = this.dockingPoints[i];
176
- if (dockingPoint.IsDocking) {
177
- if (dpJS != '') dpJS += ',';
178
- dpJS += dockingPoint.Name + ':' + 'E' + dockingPoint.OnElementId;
179
- }
180
- }
181
- return dpJS;
182
- }
183
- }, {
184
- key: "ArticleCodex",
185
- get: function get() {
186
- var _this$planElement$pla, _this$planElement$pla2;
187
- return (_this$planElement$pla = this.planElement.plannerData) !== null && _this$planElement$pla !== void 0 && _this$planElement$pla.articleCodex ? (_this$planElement$pla2 = this.planElement.plannerData) === null || _this$planElement$pla2 === void 0 ? void 0 : _this$planElement$pla2.articleCodex : '';
188
- }
189
- /**
190
- * Returns true if the accessoire is docked to another element in the planner (relatedToBasketID is set).
191
- */
192
- }, {
193
- key: "IsDockedAccessoire",
194
- get: function get() {
195
- return this.planElement.plannerData ? this.planElement.plannerData.isAccessoire : false;
196
- }
197
-
198
- //this.planElement.plannerData && this.planElement.plannerData.isAccessoire -> Becomes true if the accessoire is placed in the planner and docked to an element - this must not be true when loading the accessoire for the first time
199
- //this.planElement.plannerData?.filterType == "Accessoire" -> This is always true - The Accesssoire article is listed as accessoire
200
- }, {
201
- key: "IsAccessoire",
202
- get: function get() {
203
- var _this$planElement$pla3;
204
- return ((_this$planElement$pla3 = this.planElement.plannerData) === null || _this$planElement$pla3 === void 0 ? void 0 : _this$planElement$pla3.filterType) == 'Accessoire';
205
- }
206
- }, {
207
- key: "FilterAVL",
208
- get: function get() {
209
- return this.getFilterAVL();
210
- }
211
- }, {
212
- key: "FilterAVR",
213
- get: function get() {
214
- return this.getFilterAVR();
215
- }
216
- }, {
217
- key: "PosNr",
218
- get: function get() {
219
- return this.planElement.posNr;
220
- },
221
- set: function set(posNr) {
222
- this.planElement.posNr = posNr;
223
- }
224
- }, {
225
- key: "SetPosNr",
226
- set: function set(setPosNr) {
227
- this.planElement.setPosNr = setPosNr;
228
- }
229
- }, {
230
- key: "AccessoirePosNr",
231
- get: function get() {
232
- return this.planElement.posNrAcc != undefined ? this.planElement.posNrAcc : -1;
233
- },
234
- set: function set(posNr) {
235
- this.planElement.posNrAcc = posNr;
236
- }
237
- }, {
238
- key: "WorldPosCenter",
239
- get: function get() {
240
- return this.planElement.worldPosCenter;
241
- }
242
-
243
- /**
244
- * This function returns the world pos of the top left bottom corner.
245
- */,
246
- set: function set(pos) {
247
- this.planElement.worldPosCenter = pos;
248
- }
249
- }, {
250
- key: "WorldPosCorner",
251
- get: function get() {
252
- if (this.planElement.plannerData == null) return new Vector3(0, 0, 0);
253
- var cornerDir = new Vector2(-this.planElement.plannerData.width / 2, -this.planElement.plannerData.depth / 2);
254
- cornerDir = Vector2.rotateOrigin(cornerDir, this.planElement.rotDeg);
255
- return new Vector3(this.planElement.worldPosCenter.x + cornerDir.x, this.planElement.worldPosCenter.y - this.planElement.plannerData.height / 2, this.planElement.worldPosCenter.z + cornerDir.y);
256
- },
257
- set: function set(cornerPos) {
258
- if (!this.planElement.plannerData) return;
259
- var centerDir = new Vector2(this.planElement.plannerData.width / 2, this.planElement.plannerData.depth / 2);
260
- centerDir = Vector2.rotateOrigin(centerDir, this.planElement.rotDeg);
261
- this.planElement.worldPosCenter = new Vector3(cornerPos.x + centerDir.x, cornerPos.y + this.planElement.plannerData.height / 2, cornerPos.z + centerDir.y);
262
- }
263
-
264
- /**
265
- * This function updates the world position and rotation of the element based of some delta Elements
266
- * @param deltaMove delta translation in cm
267
- * @param deltaRotDeg delta rotation in degrees
268
- * @param rotCorrection Specifies the degrees the rotation is corrected. For Example if rotCorrection is 5 degrees and the final angle is between 20 and 25: Then the final angle is rounded to the nearest angle
269
- */
270
- }, {
271
- key: "updateDeltaTrans",
272
- value: function updateDeltaTrans(deltaMove, deltaRotDeg, rotCorrection, correctAngle) {
273
- this.WorldPosCenter = new Vector3(this.WorldPosCenter.x + deltaMove.x, this.WorldPosCenter.y + deltaMove.y, this.WorldPosCenter.z + deltaMove.z);
274
- if (deltaRotDeg != 0 || correctAngle) {
275
- if (correctAngle) {
276
- var newRot = this.RotDeg + deltaRotDeg;
277
- if (rotCorrection != 0) {
278
- if (Math.abs(newRot % rotCorrection) > rotCorrection / 2) {
279
- deltaRotDeg = deltaRotDeg + rotCorrection - Math.abs(newRot % rotCorrection);
280
- } else {
281
- deltaRotDeg = deltaRotDeg + Math.abs(newRot % rotCorrection);
282
- }
283
- }
284
- }
285
- this.processCenterRot(deltaRotDeg);
286
- }
287
- }
288
- }, {
289
- key: "processCenterRot",
290
- value: function processCenterRot(deltaRot) {
291
- this.RotDeg = this.RotDeg + deltaRot;
292
- }
293
- /**
294
- * Returns the position in world coordinates of the DP of the element depending on the position and rotation of the planner element
295
- * @param dpID
296
- */
297
- }, {
298
- key: "getWorldPosOfDP",
299
- value: function getWorldPosOfDP(dpID) {
300
- var dp = this.getDockingPointById(dpID);
301
- if (dp == undefined) return new Vector3(0, 0, 0);
302
- var rotatedDir = Vector2.rotateOrigin(new Vector2(dp === null || dp === void 0 ? void 0 : dp.LocalWorldPos.x, dp === null || dp === void 0 ? void 0 : dp.LocalWorldPos.z), this.RotDeg);
303
- return new Vector3(this.WorldPosCorner.x + rotatedDir.x, this.WorldPosCorner.y, this.WorldPosCorner.z + rotatedDir.y);
304
- }
305
-
306
- /**
307
- * Returns the outlines of the bounding box in world coordinates
308
- */
309
- }, {
310
- key: "getWorld2DBBoxOutline",
311
- value: function getWorld2DBBoxOutline() {
312
- var bboxPoints = [];
313
- bboxPoints.push(new Vector2(this.WorldPosCorner.x, this.WorldPosCorner.z));
314
- var helper = Vector2.rotateOrigin(new Vector2(this.getGlobalWidth(), 0), this.RotDeg);
315
- bboxPoints.push(new Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
316
- helper = Vector2.rotateOrigin(new Vector2(this.getGlobalWidth(), this.getGlobalDepth()), this.RotDeg);
317
- bboxPoints.push(new Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
318
- helper = Vector2.rotateOrigin(new Vector2(0, this.getGlobalDepth()), this.RotDeg);
319
- bboxPoints.push(new Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
320
- return bboxPoints;
321
- }
322
- }, {
323
- key: "RotDeg",
324
- get: function get() {
325
- return this.planElement.rotDeg;
326
- }
327
-
328
- /**
329
- * Saves the current docking point state
330
- */,
331
- set: function set(rot) {
332
- this.planElement.rotDeg = rot;
333
- }
334
- }, {
335
- key: "saveCurrentDPState",
336
- value: function saveCurrentDPState() {
337
- if (this.dockingPoints && this.dockingPoints.length > 0) {
338
- this.tempDockingPoints = [];
339
- for (var i = 0; i < this.dockingPoints.length; i++) {
340
- this.tempDockingPoints.push(this.dockingPoints[i].clone());
341
- }
342
- }
343
- }
344
- }, {
345
- key: "clearAllDockingPoints",
346
- value: function clearAllDockingPoints() {
347
- this.dockingPoints = [];
348
- }
349
- }, {
350
- key: "addDockingPoint",
351
- value: function addDockingPoint(dockingPoint) {
352
- this.dockingPoints.push(dockingPoint);
353
- }
354
-
355
- //Sets the planner Data. Returns true if something changed -> Reload
356
- }, {
357
- key: "updatePlannerData",
358
- value: function updatePlannerData(data) {
359
- //The plannerData ist keine Kopie, sondern ein verweis - wenn im Konfigurator das PlannerData Object geändert wird, dann wird es das hier auch.
360
- if ((data === null || data === void 0 ? void 0 : data.width) == undefined || data.width == -1) {
361
- this.doSetWidthFromSVG = true;
362
- } else {
363
- this.doSetWidthFromSVG = false;
364
- }
365
- if ((data === null || data === void 0 ? void 0 : data.depth) == undefined || data.depth == -1) {
366
- this.doSetDepthFromSVG = true;
367
- } else {
368
- this.doSetDepthFromSVG = false;
369
- }
370
- if (this.planElement.plannerData == null && data != null) {
371
- this.planElement.plannerData = data;
372
- this.plannerStateHash = md5(JSON.stringify(this.planElement.plannerData));
373
- return true;
374
- }
375
- if (data != null) this.planElement.plannerData = data;
376
- if (!this.planElement.plannerData) return false;
377
- var plannerDataForCache = _objectSpread(_objectSpread({}, this.planElement.plannerData), {}, {
378
- currentAccessorires: []
379
- });
380
- var currentHash = md5(JSON.stringify(plannerDataForCache));
381
- if (this.plannerStateHash != currentHash) {
382
- this.plannerStateHash = currentHash;
383
- return true;
384
- }
385
- return false;
386
- }
387
- }, {
388
- key: "cleanShapeOLF2D",
389
- value: function cleanShapeOLF2D() {
390
- this.planElement.svgShapeOLF2D = undefined;
391
- }
392
- }, {
393
- key: "cleanShapeOLT2D",
394
- value: function cleanShapeOLT2D() {
395
- this.planElement.svgShapeOLT2D = undefined;
396
- }
397
- }, {
398
- key: "DoSetWidthFromSVG",
399
- get: function get() {
400
- return this.doSetWidthFromSVG;
401
- }
402
- }, {
403
- key: "DoSetDepthFromSVG",
404
- get: function get() {
405
- return this.doSetDepthFromSVG;
406
- }
407
- }, {
408
- key: "WidthFromSVG",
409
- set: function set(svgWidth) {
410
- if (this.planElement.plannerData) this.planElement.plannerData.width = svgWidth;
411
- this.doSetWidthFromSVG = false;
412
- }
413
- }, {
414
- key: "DepthFromSVG",
415
- set: function set(svgDepth) {
416
- if (this.planElement.plannerData) this.planElement.plannerData.depth = svgDepth;
417
- this.doSetDepthFromSVG = false;
418
- }
419
- }, {
420
- key: "ElementId",
421
- get: function get() {
422
- return this.planElement.elementId;
423
- }
424
- }, {
425
- key: "SvgFileName",
426
- get: function get() {
427
- var _this$planElement$pla4;
428
- return (_this$planElement$pla4 = this.planElement.plannerData) === null || _this$planElement$pla4 === void 0 ? void 0 : _this$planElement$pla4.curSVG;
429
- }
430
- }, {
431
- key: "Width",
432
- get: function get() {
433
- var _this$planElement$pla5;
434
- return (_this$planElement$pla5 = this.planElement.plannerData) === null || _this$planElement$pla5 === void 0 ? void 0 : _this$planElement$pla5.width;
435
- }
436
- }, {
437
- key: "Height",
438
- get: function get() {
439
- var _this$planElement$pla6;
440
- return (_this$planElement$pla6 = this.planElement.plannerData) === null || _this$planElement$pla6 === void 0 ? void 0 : _this$planElement$pla6.height;
441
- }
442
- }, {
443
- key: "Depth",
444
- get: function get() {
445
- var _this$planElement$pla7;
446
- return (_this$planElement$pla7 = this.planElement.plannerData) === null || _this$planElement$pla7 === void 0 ? void 0 : _this$planElement$pla7.depth;
447
- }
448
- }, {
449
- key: "HasAVL",
450
- get: function get() {
451
- var _this$planElement$pla8;
452
- return (_this$planElement$pla8 = this.planElement.plannerData) === null || _this$planElement$pla8 === void 0 ? void 0 : _this$planElement$pla8.hasAVL;
453
- }
454
- }, {
455
- key: "HasAVR",
456
- get: function get() {
457
- var _this$planElement$pla9;
458
- return (_this$planElement$pla9 = this.planElement.plannerData) === null || _this$planElement$pla9 === void 0 ? void 0 : _this$planElement$pla9.hasAVR;
459
- }
460
- }, {
461
- key: "HasAVO",
462
- get: function get() {
463
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVO > 0 ? true : false : false;
464
- }
465
- }, {
466
- key: "HasAVU",
467
- get: function get() {
468
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVU > 0 ? true : false : false;
469
- }
470
- }, {
471
- key: "HasAVC",
472
- get: function get() {
473
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVC > 0 ? true : false : false;
474
- }
475
- }, {
476
- key: "SvgShapeOLF2D",
477
- get: function get() {
478
- return this.planElement.svgShapeOLF2D;
479
- },
480
- set: function set(shape) {
481
- this.planElement.svgShapeOLF2D = shape;
482
- }
483
- }, {
484
- key: "SvgShapeOLT2D",
485
- get: function get() {
486
- return this.planElement.svgShapeOLT2D;
487
- },
488
- set: function set(shape) {
489
- this.planElement.svgShapeOLT2D = shape;
490
- }
491
- }, {
492
- key: "OLTPolygon",
493
- get: function get() {
494
- return this.planElement.oltPolygon;
495
- },
496
- set: function set(polygon) {
497
- this.planElement.oltPolygon = polygon;
498
- }
499
- }, {
500
- key: "setupOLF",
501
- value: function setupOLF(polygon, olfWidth, olfHeight) {
502
- this.planElement.olfPolygon = polygon;
503
- this.planElement.olfDepth = olfHeight;
504
- this.planElement.olfWidth = olfWidth;
505
- }
506
- }, {
507
- key: "clearOLF",
508
- value: function clearOLF() {
509
- this.planElement.olfPolygon = undefined;
510
- this.planElement.olfDepth = undefined;
511
- this.planElement.olfWidth = undefined;
512
- }
513
- }, {
514
- key: "getGlobalWidth",
515
- value: function getGlobalWidth() {
516
- if (this.HasOLFPolygon) {
517
- return this.planElement.olfWidth / DivaUtils.UnitRecalc;
518
- }
519
- return this.Width;
520
- }
521
- }, {
522
- key: "getGlobalDepth",
523
- value: function getGlobalDepth() {
524
- if (this.HasOLFPolygon) {
525
- return this.planElement.olfDepth / DivaUtils.UnitRecalc;
526
- }
527
- return this.Depth;
528
- }
529
- }, {
530
- key: "HasOLTPolygon",
531
- get: function get() {
532
- return this.planElement.oltPolygon != null;
533
- }
534
- }, {
535
- key: "HasOLFPolygon",
536
- get: function get() {
537
- return this.planElement.olfPolygon != null;
538
- }
539
- }, {
540
- key: "getOLTPolygonWorldPos",
541
- value: function getOLTPolygonWorldPos() {
542
- if (!this.planElement.oltPolygon) return [];
543
- var polygon = [];
544
- for (var i = 0; i < this.planElement.oltPolygon.length; i++) {
545
- var localWorldPos = new Vector2(this.planElement.oltPolygon[i].x / DivaUtils.UnitRecalc, this.planElement.oltPolygon[i].y / DivaUtils.UnitRecalc);
546
- localWorldPos = Vector2.rotateOrigin(localWorldPos, this.RotDeg);
547
- polygon.push(new Vector2(this.WorldPosCorner.x + localWorldPos.x, this.WorldPosCorner.z + localWorldPos.y));
548
- }
549
- return polygon;
550
- }
551
- }, {
552
- key: "getOLFPolygonWorldPos",
553
- value: function getOLFPolygonWorldPos() {
554
- var polygon = [];
555
- if (!this.planElement.olfPolygon) return [];
556
- for (var i = 0; i < this.planElement.olfPolygon.length; i++) {
557
- var localWorldPos = new Vector2(this.planElement.olfPolygon[i].x / DivaUtils.UnitRecalc, this.planElement.olfPolygon[i].y / DivaUtils.UnitRecalc);
558
- localWorldPos = Vector2.rotateOrigin(localWorldPos, this.RotDeg);
559
- polygon.push(new Vector2(this.WorldPosCorner.x + localWorldPos.x, this.WorldPosCorner.z + localWorldPos.y));
560
- }
561
- return polygon;
562
- }
563
- }, {
564
- key: "SvgData",
565
- get: function get() {
566
- return this.planElement.svgData ? this.planElement.svgData : '';
567
- },
568
- set: function set(svgData) {
569
- this.planElement.svgData = svgData;
570
- }
571
- }, {
572
- key: "SvgDataOLTBase64",
573
- set: function set(svgData) {
574
- this.planElement.SvgDataOLTBase64 = svgData;
575
- }
576
- }, {
577
- key: "Layer",
578
- get: function get() {
579
- return this.planElement.plannerData.layer;
580
- }
581
- }, {
582
- key: "HasSvgAsHTMLCanvas",
583
- get: function get() {
584
- return this.planElement.svgAsHTMLCanvas == undefined ? false : true;
585
- }
586
- }, {
587
- key: "SvgAsHTMLCanvas",
588
- get: function get() {
589
- return this.planElement.svgAsHTMLCanvas;
590
- }
591
-
592
- /** ---------------------------------Getter und setter for the view------------------------- */,
593
- set: function set(ctx) {
594
- this.planElement.svgAsHTMLCanvas = ctx;
595
- }
596
- }, {
597
- key: "getPosNr",
598
- value: function getPosNr() {
599
- return this.planElement.setPosNr;
600
- }
601
- }, {
602
- key: "getAccessoirePosNr",
603
- value: function getAccessoirePosNr() {
604
- return this.planElement.posNrAcc;
605
- }
606
- }, {
607
- key: "getPosNrWithAccessoirePosNr",
608
- value: function getPosNrWithAccessoirePosNr() {
609
- return this.getIsDockedAccessoire() ? this.getPosNr() + '.' + (this.getAccessoirePosNr() != undefined && this.getAccessoirePosNr() < 10 ? '0' + this.getAccessoirePosNr() : this.getAccessoirePosNr()) : this.getPosNr().toString();
610
- }
611
- }, {
612
- key: "getIsDockedAccessoire",
613
- value: function getIsDockedAccessoire() {
614
- return this.IsDockedAccessoire;
615
- }
616
- }, {
617
- key: "getIsNotDockedAccessoire",
618
- value: function getIsNotDockedAccessoire() {
619
- var _this$planElement$pla10;
620
- return !!((_this$planElement$pla10 = this.planElement.plannerData) !== null && _this$planElement$pla10 !== void 0 && _this$planElement$pla10.isNotDockedAccessoire);
621
- }
622
- }, {
623
- key: "getParentElementId",
624
- value: function getParentElementId() {
625
- var _this$planElement$pla11;
626
- return (_this$planElement$pla11 = this.planElement.plannerData) === null || _this$planElement$pla11 === void 0 ? void 0 : _this$planElement$pla11.parentElementId;
627
- }
628
- }, {
629
- key: "getElementId",
630
- value: function getElementId() {
631
- return this.planElement.elementId;
632
- }
633
- }, {
634
- key: "getBasketId",
635
- value: function getBasketId() {
636
- return this.basketId;
637
- }
638
- }, {
639
- key: "getSetId",
640
- value: function getSetId() {
641
- return this.planElement.setId;
642
- }
643
- }, {
644
- key: "getWorldPosCorner",
645
- value: function getWorldPosCorner() {
646
- return this.WorldPosCorner;
647
- }
648
-
649
- /**
650
- * This function returns the position in world coordinates of the CENTER of the plannerElement
651
- */
652
- }, {
653
- key: "getWorldPosCenter",
654
- value: function getWorldPosCenter() {
655
- return this.WorldPosCenter;
656
- }
657
- }, {
658
- key: "getRotDeg",
659
- value: function getRotDeg() {
660
- return this.planElement.rotDeg;
661
- }
662
- }, {
663
- key: "getRotRad",
664
- value: function getRotRad() {
665
- return this.planElement.rotDeg * Math.PI / 180;
666
- }
667
- }, {
668
- key: "getHasAVL",
669
- value: function getHasAVL() {
670
- return this.planElement.plannerData ? this.planElement.plannerData.hasAVL : false;
671
- }
672
- }, {
673
- key: "getHasAVR",
674
- value: function getHasAVR() {
675
- return this.planElement.plannerData ? this.planElement.plannerData.hasAVR : false;
676
- }
677
- }, {
678
- key: "getHasAVO",
679
- value: function getHasAVO() {
680
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVO > 0 ? true : false : false;
681
- }
682
- }, {
683
- key: "getHasAVU",
684
- value: function getHasAVU() {
685
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVU > 0 ? true : false : false;
686
- }
687
- }, {
688
- key: "getHasAVC",
689
- value: function getHasAVC() {
690
- return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVC > 0 ? true : false : false;
691
- }
692
- }, {
693
- key: "getFilterAVL",
694
- value: function getFilterAVL() {
695
- var _this$planElement$pla12;
696
- return this.planElement.plannerData ? (_this$planElement$pla12 = this.planElement.plannerData) === null || _this$planElement$pla12 === void 0 ? void 0 : _this$planElement$pla12.AVLFilter : [];
697
- }
698
- }, {
699
- key: "getFilterAVR",
700
- value: function getFilterAVR() {
701
- return this.planElement.plannerData ? this.planElement.plannerData.AVRFilter : [];
702
- }
703
- }, {
704
- key: "getSVGShapeOLF2D",
705
- value: function getSVGShapeOLF2D() {
706
- return this.planElement.svgShapeOLF2D;
707
- }
708
- }, {
709
- key: "getSVGShapeOLT2D",
710
- value: function getSVGShapeOLT2D() {
711
- return this.planElement.svgShapeOLT2D;
712
- }
713
- }, {
714
- key: "getPlannerType",
715
- value: function getPlannerType() {
716
- return this.plannerType;
717
- }
718
-
719
- /**
720
- * Returns the original svg XML
721
- */
722
- }, {
723
- key: "getSVGData",
724
- value: function getSVGData() {
725
- return this.planElement.svgData ? this.planElement.svgData : '';
726
- }
727
- }, {
728
- key: "getWidth",
729
- value: function getWidth() {
730
- return this.planElement.plannerData ? this.getGlobalWidth() : -1;
731
- }
732
- }, {
733
- key: "getHeight",
734
- value: function getHeight() {
735
- return this.planElement.plannerData ? this.planElement.plannerData.height : -1;
736
- }
737
- }, {
738
- key: "getDepth",
739
- value: function getDepth() {
740
- return this.planElement.plannerData ? this.getGlobalDepth() : -1;
741
- }
742
- }, {
743
- key: "getDepthOLT",
744
- value: function getDepthOLT() {
745
- return this.Depth ? this.Depth : -1;
746
- }
747
- }, {
748
- key: "getWidthOLT",
749
- value: function getWidthOLT() {
750
- return this.Width ? this.Width : -1;
751
- }
752
- }, {
753
- key: "getLayer",
754
- value: function getLayer() {
755
- return this.planElement.plannerData ? this.planElement.plannerData.layer : 20;
756
- }
757
- }, {
758
- key: "hasSvgAsHtmlCanvas",
759
- value: function hasSvgAsHtmlCanvas() {
760
- return this.planElement.svgAsHTMLCanvas == undefined ? false : true;
761
- }
762
- }, {
763
- key: "getSvgAsHtmlCanvas",
764
- value: function getSvgAsHtmlCanvas() {
765
- return this.planElement.svgAsHTMLCanvas;
766
- }
767
- }, {
768
- key: "hasSvgDataOLTBase64",
769
- value: function hasSvgDataOLTBase64() {
770
- return this.planElement.SvgDataOLTBase64 != undefined && this.planElement.SvgDataOLTBase64 != '';
771
- }
772
- }, {
773
- key: "getSvgDataOLTBase64",
774
- value: function getSvgDataOLTBase64() {
775
- return this.planElement.SvgDataOLTBase64 != undefined ? this.planElement.SvgDataOLTBase64 : '';
776
- }
777
- }, {
778
- key: "getAccessoires",
779
- value: function getAccessoires() {
780
- var _this$planElement$pla13;
781
- return this.planElement.plannerData ? (_this$planElement$pla13 = this.planElement.plannerData) === null || _this$planElement$pla13 === void 0 ? void 0 : _this$planElement$pla13.accessoireList : [];
782
- }
783
- }, {
784
- key: "getSVGsWithFormula",
785
- value: function getSVGsWithFormula() {
786
- var _this$planElement$pla14;
787
- return (_this$planElement$pla14 = this.planElement.plannerData) === null || _this$planElement$pla14 === void 0 ? void 0 : _this$planElement$pla14.svgsWithFormula;
788
- }
789
- }, {
790
- key: "getCurrentAccessorires",
791
- value: function getCurrentAccessorires() {
792
- var _this$planElement$pla15;
793
- return this.planElement.plannerData ? (_this$planElement$pla15 = this.planElement.plannerData) === null || _this$planElement$pla15 === void 0 ? void 0 : _this$planElement$pla15.currentAccessorires : [];
794
- }
795
- }]);
796
- }();
797
-
798
- var LOG = DivaUtils.initLog('Planner', 'WEB-PLANNER-LOGIC');
799
- /**
800
- * This class is used like a service.
801
- * It handles different actions on planner Elements and its docking Points
802
- */
803
- var DockingPointHandler = /*#__PURE__*/function () {
804
- function DockingPointHandler() {
805
- _classCallCheck(this, DockingPointHandler);
806
- }
807
- return _createClass(DockingPointHandler, [{
808
- key: "getRotOfDP",
809
- value:
810
- /**
811
- * This function returns the rotation of a vector that is specified by two positions in the 2 Dim Space
812
- * The rotation is 0 when the Vector is pointing downwards (pos1 is directly above pos2). The rotation is then computed clockwise
813
- * The result is resturned in degrees
814
- * @param pos1 2 Dimensional position
815
- * @param pos2 2 Dimensional position
816
- */
817
- function getRotOfDP(pos1, pos2) {
818
- var directionVec = Vector2.getDirection(pos2, pos1);
819
- var refDirection = new Vector2(0, 1);
820
- var smallAngle = Vector2.angleDeg(refDirection, directionVec);
821
- if (directionVec.x > 0) {
822
- return 360 - smallAngle;
823
- }
824
- return smallAngle;
825
- }
826
- }, {
827
- key: "getReferenceDPType",
828
- value: function getReferenceDPType(dpType) {
829
- switch (dpType) {
830
- case 'AVR':
831
- return 'AVL';
832
- case 'AVL':
833
- return 'AVR';
834
- case 'AVO':
835
- return 'AVU';
836
- case 'AVU':
837
- return 'AVO';
838
- case 'AVC':
839
- return 'AVC';
840
- }
841
- return '';
842
- }
843
- }, {
844
- key: "sortDockingPoints",
845
- value: function sortDockingPoints(dir, dockingPoints) {
846
- if (dir == 'LEFT_TO_RIGHT') return dockingPoints.sort(function (a, b) {
847
- return a.LocalWorldPos.x > b.LocalWorldPos.x ? 1 : -1;
848
- });else return dockingPoints.sort(function (a, b) {
849
- return a.LocalWorldPos.x < b.LocalWorldPos.x ? 1 : -1;
850
- });
851
- }
852
- /**
853
- * Check if the docking Points Filter match for the two elements.
854
- * @param plannerElement1
855
- * @param plannerElement2
856
- */
857
- }, {
858
- key: "checkDPAVLFilterDoMatch",
859
- value: function checkDPAVLFilterDoMatch(plannerElement1, plannerElement2) {
860
- var avrFilter1 = plannerElement1.FilterAVR;
861
- var avlFilter2 = plannerElement2.FilterAVL;
862
- if (avlFilter2.length == 0 && avrFilter1.length == 0) return true; //Diese überprüfung bin ich mir nicht sicher, dass es so passt.
863
-
864
- for (var i = 0; i < avrFilter1.length; i++) {
865
- for (var j = 0; j < avlFilter2.length; j++) {
866
- if (avrFilter1[i] == avlFilter2[j]) {
867
- return true;
868
- }
869
- }
870
- }
871
- return false;
872
- }
873
- }, {
874
- key: "checkDPAVRFilterDoMatch",
875
- value: function checkDPAVRFilterDoMatch(plannerElement1, plannerElement2) {
876
- var avlFilter1 = plannerElement1.FilterAVL;
877
- var avrFilter2 = plannerElement2.FilterAVR;
878
- if (avlFilter1.length == 0 && avrFilter2.length == 0) return true; //Diese überprüfung bin ich mir nicht sicher, dass es so passt.
879
- for (var i = 0; i < avlFilter1.length; i++) {
880
- for (var j = 0; j < avrFilter2.length; j++) {
881
- if (avlFilter1[i] == avrFilter2[j]) {
882
- return true;
883
- }
884
- }
885
- }
886
- return false;
887
- }
888
-
889
- /**
890
- * This function checks if two docking Points can be docked
891
- */
892
- }, {
893
- key: "checkDPsDoMatch",
894
- value: function checkDPsDoMatch(dp1, dp2, sourcePlannerElement, targetElement) {
895
- dp1.ElementId;
896
- var avrDockable = this.checkDPAVRFilterDoMatch(sourcePlannerElement, targetElement);
897
- var avlDockable = this.checkDPAVLFilterDoMatch(sourcePlannerElement, targetElement);
898
- var refDPType = this.getReferenceDPType(dp1.Type);
899
- if (refDPType == 'AVL' && !avlDockable) return false;
900
- if (refDPType == 'AVR' && !avrDockable) return false;
901
- if (dp2.Type != refDPType) return false;
902
- if (dp1.IsDocking || dp2.IsDocking) return false;
903
- if (!dp1.IgnoreLayer || !dp2.IgnoreLayer) {
904
- var doCheckLayer = true;
905
- if (dp1.PlannerConfig.ignoreLayerAVC && (dp1.Type == 'AVC' || dp2.Type == 'AVC')) {
906
- doCheckLayer = false;
907
- }
908
- if (dp1.PlannerConfig.ignoreLayerAVOAVU && (dp1.Type == 'AVO' || dp1.Type == 'AVU') && (dp2.Type == 'AVO' || dp2.Type == 'AVU')) {
909
- doCheckLayer = false;
910
- }
911
-
912
- //Check layer
913
- if (doCheckLayer && dp2.Layer == dp1.Layer) return false;
914
- }
915
- if (dp1.HasNumber && dp2.HasNumber && dp1.Number != dp2.Number) return false;
916
- return true;
917
- }
918
-
919
- /**
920
- * This function assumes that the two docking points are matching and can be docked
921
- * @param dp1
922
- * @param dp2
923
- */
924
- }, {
925
- key: "doDock",
926
- value: function doDock(dp1, dp2, elemId1, elemId2) {
927
- dp1.doDock(dp2, elemId2);
928
- dp2.doDock(dp1, elemId1);
929
- }
930
- /*
931
- This function inits all docking points of a planner Element Data. The information of the docking Points is currently loaded from the SVG Loader
932
- catalogCodex indicates the catalogCodex of the plannerElement
933
- */
934
- }, {
935
- key: "initDockingPointsFromSvg",
936
- value: function initDockingPointsFromSvg(plannerElement, dockingVectors, plannerconfig) {
937
- plannerElement.saveCurrentDPState();
938
- this.removeDockingPointRelations(plannerElement);
939
- plannerElement.clearAllDockingPoints();
940
- for (var i = 0; i < dockingVectors.length; i++) {
941
- var dockingVector = dockingVectors[i];
942
- var localWorldPos1 = new Vector2(dockingVector.x1 / DivaUtils.UnitRecalc, dockingVector.y1 / DivaUtils.UnitRecalc);
943
- var localWorldPos2 = new Vector2(dockingVector.x2 / DivaUtils.UnitRecalc, dockingVector.y2 / DivaUtils.UnitRecalc);
944
- var angle = this.getRotOfDP(localWorldPos1, localWorldPos2);
945
- var dockingfilter = undefined;
946
- if (dockingVector.dockingType == 'AVL') dockingfilter = plannerElement.getFilterAVL();else if (dockingVector.dockingType == 'AVR') dockingfilter = plannerElement.getFilterAVR();
947
- var dockingPoint = new DockingPoint(plannerElement.getElementId(), dockingVector.dockingType, dockingVector.dockingName, new Vector3(localWorldPos1.x, 0, localWorldPos1.y), angle, plannerElement.Layer, plannerconfig, dockingfilter);
948
- plannerElement.addDockingPoint(dockingPoint);
949
- }
950
- }
951
-
952
- /**
953
- * This function removes all docking Point relations from the Element .
954
- * It removes them as well in the docked elements.
955
- * This function is used when deleting a plannerElement
956
- * @param plannerElement
957
- */
958
- }, {
959
- key: "removeDockingPointRelations",
960
- value: function removeDockingPointRelations(plannerElement) {
961
- var dockingPoints = plannerElement.getDockingPoints();
962
- for (var i = 0; i < dockingPoints.length; i++) {
963
- var dockingPoint = dockingPoints[i];
964
- if (dockingPoint.IsDocking) {
965
- var refDockingPoint = dockingPoint.OnDP;
966
- refDockingPoint.undock();
967
- dockingPoint.undock();
968
- }
969
- }
970
- }
971
- /**
972
- * This function removes all docking Point relations with the type from the Element .
973
- * It removes them as well in the docked elements.
974
- * This function is used when deleting a plannerElement
975
- * @param plannerElement
976
- * @param dpTypeList The Type of the docking Point like AVL or AVR
977
- */
978
- }, {
979
- key: "removeDockingPointRelationsByType",
980
- value: function removeDockingPointRelationsByType(plannerElement, dpTypeList) {
981
- var undockedFromElements = [];
982
- var dockingPoints = plannerElement.getDockingPoints();
983
- for (var i = 0; i < dockingPoints.length; i++) {
984
- var dockingPoint = dockingPoints[i];
985
- if (dpTypeList.indexOf(dockingPoint.Type) > -1 && dockingPoint.IsDocking) {
986
- var refDockingPoint = dockingPoint.OnDP;
987
- undockedFromElements.push(refDockingPoint.ElementId);
988
- refDockingPoint.undock();
989
- dockingPoint.undock();
990
- }
991
- }
992
- return undockedFromElements;
993
- }
994
- /**
995
- * This function returns a list of docking points that are dockable to the source Planner Element. The function only returns docking Points that lay within a specific area.
996
- *
997
- * @param sourceElement
998
- * @param targetElements
999
- * @param autoDockingDistance //gibt die distance an in der er automatisch snappen muss. Infinity _> Docke überall. 0 Docke nie
1000
- * @returns saves dockable dockingpoints per type with the distance
1001
- */
1002
- }, {
1003
- key: "searchDockableElementsInArea",
1004
- value: function searchDockableElementsInArea(sourceElement, targetElements, autoDockingDistance // Wenn 0, dann dockt es immer
1005
- ) {
1006
- var sourceDPs = sourceElement.getAllDockingPoints();
1007
- var dockableDPPairs = new Map(); //saves all dockable dockingpoints per type
1008
- for (var i = 0; i < targetElements.length; i++) {
1009
- var targetElement = targetElements[i];
1010
- if (sourceElement.getElementId() == targetElement.getElementId()) continue;
1011
- for (var di = 0; di < sourceDPs.length; di++) {
1012
- var sourceDP = sourceDPs[di];
1013
- var targetType = this.getReferenceDPType(sourceDP.Type);
1014
- var targetDPS = targetElement.getFreeDockingPointsByType(targetType);
1015
- for (var j = 0; j < targetDPS.length; j++) {
1016
- var targetDP = targetDPS[j];
1017
- if (this.checkDPsDoMatch(sourceDP, targetDP, sourceElement, targetElement)) {
1018
- var worldPosSourceDP = sourceElement.getWorldPosOfDP(sourceDP.DpId);
1019
- var worldPosTargetDP = targetElement.getWorldPosOfDP(targetDP.DpId);
1020
- var distance = Math.sqrt(Math.pow(worldPosSourceDP.x - worldPosTargetDP.x, 2) + Math.pow(worldPosSourceDP.z - worldPosTargetDP.z, 2));
1021
- if (autoDockingDistance != 0 && (autoDockingDistance == Infinity || distance < autoDockingDistance)) {
1022
- // dockableDPs.set();
1023
- //TODO Lea - ich muss mir das paar merken!!!! Hier habe ich ein potentielles Paar gefunden.
1024
- //Pro dockingPoint merke dir den mit dem kleinsten Abstand
1025
- if (dockableDPPairs.has(sourceDP.Type)) {
1026
- if (distance < dockableDPPairs.get(sourceDP.Type).distance) {
1027
- dockableDPPairs.set(sourceDP.Type, {
1028
- sourceDP: sourceDP,
1029
- targetDP: targetDP,
1030
- distance: distance
1031
- });
1032
- }
1033
- } else {
1034
- dockableDPPairs.set(sourceDP.Type, {
1035
- sourceDP: sourceDP,
1036
- targetDP: targetDP,
1037
- distance: distance
1038
- });
1039
- }
1040
- }
1041
- }
1042
- }
1043
- }
1044
- }
1045
- return dockableDPPairs;
1046
- }
1047
-
1048
- /**
1049
- * This function tries to dock an element sourcePlannerElement to one element in the targetElements
1050
- * @param sourcePlannerElement the element that must be docked
1051
- * @param sourceDPType the type of the element that must be docked
1052
- * @param targetElements the target Element on which the element should be docked
1053
- * the function returns true when the Element is docked
1054
- */
1055
- }, {
1056
- key: "tryDockElement",
1057
- value: function tryDockElement(sourcePlannerElement, sourceDPType, targetElements) {
1058
- var dockingPoints = sourcePlannerElement.getDockingPointsByType(sourceDPType);
1059
- if (!dockingPoints) {
1060
- return false;
1061
- }
1062
- var refDPType = this.getReferenceDPType(sourceDPType);
1063
- for (var i = 0; i < targetElements.length; i++) {
1064
- var targetElement = targetElements[i];
1065
- if (targetElement.ElementId == sourcePlannerElement.ElementId) continue;
1066
-
1067
- //this if denies an element (with is not an accessorie) to dock to an accessorie of another element
1068
- if (!sourcePlannerElement.IsAccessoire && targetElement.IsAccessoire && targetElement.getParentElementId() != sourcePlannerElement.getElementId()) continue;
1069
- if (sourcePlannerElement.IsAccessoire && !targetElement.getAccessoires().includes(sourcePlannerElement.ArticleCodex)) continue;
1070
- var targetDockingPoints = targetElement.getDockingPointsByType(refDPType);
1071
- if (sourcePlannerElement.getIsDockedAccessoire() || sourcePlannerElement.IsAccessoire) {
1072
- targetDockingPoints = this.sortDockingPoints('LEFT_TO_RIGHT', targetDockingPoints);
1073
- }
1074
- if (!targetDockingPoints) continue; //Das target Element hat keinen solchen dp
1075
- for (var j = 0; j < targetDockingPoints.length; j++) {
1076
- var targetDockingPoint = targetDockingPoints[j];
1077
- for (var dpNr = 0; dpNr < dockingPoints.length; dpNr++) {
1078
- var dockingPoint = dockingPoints[dpNr];
1079
- if (this.checkDPsDoMatch(dockingPoint, targetDockingPoint, sourcePlannerElement, targetElement)) {
1080
- //The two docking Points match
1081
- this.doDock(dockingPoint, targetDockingPoint, sourcePlannerElement.ElementId, targetElement.ElementId); //Passender Docking Point wurde gefunden. Nun erfolgt das docken
1082
- return dockingPoint;
1083
- }
1084
- }
1085
- }
1086
- }
1087
- return false;
1088
- }
1089
-
1090
- /**
1091
- * This function tries to dock an element sourcePlannerElement to the targetElement and a specific DockingPoint of the targetElement
1092
- * @param sourcePlannerElement the element that must be docked
1093
- * @param sourceDPType the type of the element that must be docked
1094
- * @param targetElements the target Element on which the element should be docked
1095
- * the function returns true when the Element is docked
1096
- */
1097
- }, {
1098
- key: "tryDockElementToDP",
1099
- value: function tryDockElementToDP(sourcePlannerElement, targetElement, targetDP) {
1100
- var sourceDPType = this.getReferenceDPType(targetDP.Type);
1101
- var dockingPoints = sourcePlannerElement.getFreeDockingPointsByType(sourceDPType);
1102
- if (!dockingPoints) {
1103
- return false;
1104
- }
1105
- for (var i = 0; i < dockingPoints.length; i++) {
1106
- if (this.checkDPsDoMatch(dockingPoints[i], targetDP, sourcePlannerElement, targetElement)) {
1107
- //The two docking Points match
1108
- this.doDock(dockingPoints[i], targetDP, sourcePlannerElement.ElementId, targetElement.ElementId); //Passender Docking Point wurde gefunden. Nun erfolgt das docken
1109
- return dockingPoints[i];
1110
- }
1111
- }
1112
- return false;
1113
- }
1114
-
1115
- /**
1116
- * This function tries to dock an element sourcePlannerElement to the targetElement and a specific DockingPoint of the targetElement
1117
- * @param sourcePlannerElement the element that must be docked
1118
- * @param sourceDPType the type of the element that must be docked
1119
- * @param sourceDP The source DP
1120
- * @param targetElements the target Element on which the element should be docked
1121
- * the function returns true when the Element is docked
1122
- */
1123
- }, {
1124
- key: "tryDockElementDPToDP",
1125
- value: function tryDockElementDPToDP(sourcePlannerElement, targetElement, sourceDP, targetDP) {
1126
- if (this.checkDPsDoMatch(sourceDP, targetDP, sourcePlannerElement, targetElement)) {
1127
- this.doDock(sourceDP, targetDP, sourcePlannerElement.getElementId(), targetElement.getElementId());
1128
- return true;
1129
- }
1130
- return false;
1131
- }
1132
-
1133
- /**
1134
- * this function updates the dockingPoint relations. It is called after reloading one or more SVGs (StretchAreas / SVG Tausch) . For example when changing the ArmRests of
1135
- * two docking sofas - the old docking information is saved in the plannerElement. The new DockingPoints must be updated based on the previous docking information.
1136
- * @param plannerElements
1137
- * @returns returns the list of all Articles that have lost their dockingPoint relations
1138
- */
1139
- }, {
1140
- key: "updateDockingRelations",
1141
- value: function updateDockingRelations(plannerElements) {
1142
- //Sort the elements by pos nr
1143
- var sortedPlannerElementsbyPosNr = [];
1144
- var accElems = [];
1145
- plannerElements.forEach(function (plannerElement, elementId) {
1146
- if (!plannerElement.IsDockedAccessoire) {
1147
- sortedPlannerElementsbyPosNr[plannerElement.PosNr - 1] = plannerElement;
1148
- } else {
1149
- accElems.push(plannerElement);
1150
- }
1151
- });
1152
- sortedPlannerElementsbyPosNr = sortedPlannerElementsbyPosNr.concat(accElems);
1153
- var elementsLostDockingRelation = [];
1154
- //nun laufe alle Elemente durch und schaue, ob sie vorher zu einem DP gedockt haben. Diese müssen nun auch gedockt werden, falls möglich
1155
- for (var i = 0; i < sortedPlannerElementsbyPosNr.length; i++) {
1156
- if (sortedPlannerElementsbyPosNr[i]) {
1157
- var element = sortedPlannerElementsbyPosNr[i];
1158
- var tempDPs = element.getTempDockingPoints();
1159
- for (var j = 0; j < tempDPs.length; j++) {
1160
- var tempDP = tempDPs[j];
1161
- if (tempDP.IsDocking && tempDP.OnElementId) {
1162
- //Check if tempDP still exists.
1163
- var dp = element.getDockingPointById(tempDP.DpId);
1164
- if (dp == undefined) {
1165
- //In this case the dockingPoint does not exist anymore
1166
- var targetElement = plannerElements.get(tempDP.OnElementId);
1167
-
1168
- //In some cases like hasena fjord it can happen - that the Dockingpoint nummer has changed.
1169
- //First kopfteil and rahmen have docked using AVO_1 and AVU_1. When changing the size of the bedframe the docking Points get changed AVO_2 and AVU_2.
1170
- //In this case -look if both elements only have 1 dockingpoint of the same Type - and then redock them.
1171
-
1172
- var dockingPointsCurElement = element.getFreeDockingPointsByType(tempDP.Type);
1173
- if (dockingPointsCurElement.length == 1) {
1174
- var dockingPointsToDockElement = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getFreeDockingPointsByType(this.getReferenceDPType(tempDP.Type));
1175
- if ((dockingPointsToDockElement === null || dockingPointsToDockElement === void 0 ? void 0 : dockingPointsToDockElement.length) == 1) {
1176
- this.tryDockElementDPToDP(element, targetElement, dockingPointsCurElement[0], dockingPointsToDockElement[0]);
1177
- continue;
1178
- }
1179
- }
1180
- if (targetElement) elementsLostDockingRelation.push(targetElement);
1181
- continue;
1182
- }
1183
- //Suche den targetDP und schaue ob sie schon docken
1184
- if (plannerElements.has(tempDP.OnElementId)) {
1185
- var _targetElement = plannerElements.get(tempDP.OnElementId);
1186
- var targetDP = _targetElement === null || _targetElement === void 0 ? void 0 : _targetElement.getDockingPointById(tempDP.OnDP.DpId);
1187
- this.tryDockElementDPToDP(element, _targetElement, dp, targetDP);
1188
- }
1189
- }
1190
- }
1191
- }
1192
- }
1193
- for (var i = 0; i < sortedPlannerElementsbyPosNr.length; i++) {
1194
- if (sortedPlannerElementsbyPosNr[i]) sortedPlannerElementsbyPosNr[i].clearTempDockingPoints();
1195
- }
1196
- return elementsLostDockingRelation;
1197
- }
1198
- /**
1199
- * This function is used when initialiazing a planning. In the old planner we do only know that a docking point of a specific kind (AVL) of the source Element docks with any docking Point of the targetPlannerElement.
1200
- * If there is only one target docking Point in the reference object - dock to that. However, when looking at AVOs, there can be that the target element has two AVUs. In this case search the docking point that is the neares.
1201
- * @param sourcePlannerElement
1202
- * @param targetPlannerElement
1203
- * @param sourceDPType The type of the dockingPoint
1204
- */
1205
- }, {
1206
- key: "initDockingPointRelationByArea",
1207
- value: function initDockingPointRelationByArea(sourcePlannerElement, targetPlannerElement, sourceDPType) {
1208
- // let refDPTarget = this.getReferenceDPType(sourceDPType);
1209
- var freeSourceDPs = sourcePlannerElement.getFreeDockingPointsByType(sourceDPType);
1210
- //let allTargetDPs = targetPlannerElement.getDockingPointsByType(refDPTarget);
1211
-
1212
- if (freeSourceDPs.length > 0) {
1213
- var allDockingPairs = this.searchDockableElementsInArea(sourcePlannerElement, [targetPlannerElement], Infinity);
1214
- if (allDockingPairs.has(sourceDPType)) {
1215
- var dockingPair = allDockingPairs.get(sourceDPType);
1216
- if (dockingPair) {
1217
- var success = this.tryDockElementDPToDP(sourcePlannerElement, targetPlannerElement, dockingPair.sourceDP, dockingPair.targetDP);
1218
- if (!success) {
1219
- LOG.debug('Error when initializing docking Points. Two dockingpoints could not be matched. sourceDP: ' + dockingPair.sourceDP.DpId + '; sourceRlementId: ' + dockingPair.sourceDP.ElementId + '; targetDP: ' + dockingPair.targetDP.DpId + ' targetElemId: ' + dockingPair.targetDP.ElementId);
1220
- }
1221
- }
1222
- }
1223
- }
1224
- }
1225
-
1226
- /**
1227
- * This function returns true if the two elements are docking. False if they are not
1228
- * @param element1
1229
- * @param element2
1230
- */
1231
- }, {
1232
- key: "checkElementsAreDocking",
1233
- value: function checkElementsAreDocking(element1, element2) {
1234
- var allDockingDockingPoints = element1.getDockingDockingPoints();
1235
- for (var i = 0; i < allDockingDockingPoints.length; i++) {
1236
- var dp = allDockingDockingPoints[i];
1237
- if (dp.OnElementId == element2.getElementId()) return true;
1238
- }
1239
- return false;
1240
- }
1241
- }]);
1242
- }();
1243
- var dockingPointHandlerInst = new DockingPointHandler();
1244
-
1245
- export { PlannerElementData as P, dockingPointHandlerInst as d };