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