@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.
- package/build/cjs/{DivaBoxPlanner-6a883291.js → DivaBoxPlanner-f5288507.js} +16 -18
- package/build/cjs/{DivaStandardPlanner-a18f752d.js → DivaStandardPlanner-e910ac72.js} +26 -30
- package/build/cjs/{DoorPlanner-5164c50d.js → DoorPlanner-3c76f0cf.js} +1 -1
- package/build/cjs/{Host3DSignalR-f13134cb.js → Host3DSignalR-1e376e3f.js} +1 -6
- package/build/cjs/{LiviqueWWSHandler-32bb295f.js → LiviqueWWSHandler-248f4aa6.js} +1 -1
- package/build/cjs/{PfisterWWSHandler-0447de84.js → PfisterWWSHandler-a28671cf.js} +1 -1
- package/build/cjs/{PlannerHandler2D-a941c306.js → PlannerHandler2D-085a6eb4.js} +1249 -10
- package/build/cjs/{ProductBasketHandler-144386d9.js → ProductBasketHandler-fb47032b.js} +1 -1
- package/build/cjs/{SeriousBasketHandler-e7f5bfb9.js → SeriousBasketHandler-768b44df.js} +1 -1
- package/build/cjs/{ShelfPlanner-63df1fef.js → ShelfPlanner-6d8d7580.js} +6 -6
- package/build/cjs/{StandardWWSHandler-96b3ab81.js → StandardWWSHandler-196a78e7.js} +1 -1
- package/build/cjs/{index-0cf8efc1.js → index-3703fcc3.js} +1367 -1799
- package/build/cjs/index.js +1 -1
- package/build/esm/{DivaBoxPlanner-0a38d41b.js → DivaBoxPlanner-4c8eb4d1.js} +5 -7
- package/build/esm/{DivaStandardPlanner-774854f1.js → DivaStandardPlanner-bff9587a.js} +5 -9
- package/build/esm/{DoorPlanner-c9293a3a.js → DoorPlanner-715224ea.js} +1 -1
- package/build/esm/{Host3DSignalR-3ca1dd9c.js → Host3DSignalR-69dbf5aa.js} +1 -6
- package/build/esm/{LiviqueWWSHandler-28edc334.js → LiviqueWWSHandler-f0ff1337.js} +1 -1
- package/build/esm/{PfisterWWSHandler-21e4c2f3.js → PfisterWWSHandler-c869657f.js} +1 -1
- package/build/esm/{PlannerHandler2D-9f4f8efb.js → PlannerHandler2D-ba45ba21.js} +1245 -8
- package/build/esm/{ProductBasketHandler-fa0c1a9e.js → ProductBasketHandler-d5f9fa30.js} +1 -1
- package/build/esm/{SeriousBasketHandler-2e0ab157.js → SeriousBasketHandler-9fdcebc2.js} +1 -1
- package/build/esm/{ShelfPlanner-c52e6233.js → ShelfPlanner-e5c01f8b.js} +6 -6
- package/build/esm/{StandardWWSHandler-72ea1ffc.js → StandardWWSHandler-72cb836f.js} +1 -1
- package/build/esm/{index-622ebf68.js → index-98a31597.js} +1367 -1799
- package/build/esm/index.js +1 -1
- package/build/types/web-planner-logic/src/index.d.ts +1 -0
- package/build/types/web-planner-logic/src/index.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/API/TemplateConfigType.d.ts +7 -7
- package/build/types/web-planner-logic/src/interface/API/TemplateConfigType.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/API/ViewConfigDataType.d.ts +2 -5
- package/build/types/web-planner-logic/src/interface/API/ViewConfigDataType.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/AdditionalModelInfos.d.ts +2 -2
- package/build/types/web-planner-logic/src/interface/Configuration.d.ts +1 -3
- package/build/types/web-planner-logic/src/interface/Configuration.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/CoreTypes/index.d.ts +44 -14
- package/build/types/web-planner-logic/src/interface/CoreTypes/index.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/FunctionTypes/index.d.ts +1 -1
- package/build/types/web-planner-logic/src/interface/FunctionTypes/index.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/OptionTypes/ArticleOptionDataTypes.d.ts +0 -1
- package/build/types/web-planner-logic/src/interface/OptionTypes/ArticleOptionDataTypes.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/Planner/IDivaPlanner.d.ts +1 -2
- package/build/types/web-planner-logic/src/interface/Planner/IDivaPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/Planner/IDivaSetPlanner.d.ts +1 -3
- package/build/types/web-planner-logic/src/interface/Planner/IDivaSetPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/interface/ShelfPlanner/plannerData.d.ts +3 -2
- package/build/types/web-planner-logic/src/interface/ShelfPlanner/plannerData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Article/ArticleOptionState.d.ts +0 -1
- package/build/types/web-planner-logic/src/logic/Article/ArticleOptionState.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Article/DivaArticle.d.ts +2 -3
- package/build/types/web-planner-logic/src/logic/Article/DivaArticle.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Basket/DivaBasketHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/ConfigTree/DivaConfigTree.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/ConfigTree/Shelfplanner/ShelfPlannerGrid.d.ts +3 -2
- package/build/types/web-planner-logic/src/logic/ConfigTree/Shelfplanner/ShelfPlannerGrid.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/DivaApiHandler.d.ts +4 -4
- package/build/types/web-planner-logic/src/logic/DivaApiHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/DivaCatalogHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts +1 -12
- package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts +1 -2
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/DivaPlannerHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts +1 -2
- package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/DivaMediaServiceHandler.d.ts +0 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/DivaMediaServiceHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/Host3DSignalR.d.ts +0 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/Host3DSignalR.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/PlannerHandler3D.d.ts +0 -17
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/PlannerHandler3D.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/RenderSettings.d.ts +0 -9
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/RenderSettings.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/Rendering.d.ts +0 -13
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/Rendering.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/types.d.ts +0 -3
- package/build/types/web-planner-logic/src/logic/Planner/Rendering/types.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Set/DivaSet.d.ts +2 -3
- package/build/types/web-planner-logic/src/logic/Set/DivaSet.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Set/DivaSetHandler.d.ts +0 -6
- package/build/types/web-planner-logic/src/logic/Set/DivaSetHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Set/FavoritesHandler.d.ts +1 -1
- package/build/types/web-planner-logic/src/logic/Set/FavoritesHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/DivaCatalogData.d.ts +1 -0
- package/build/types/web-planner-logic/src/model/DivaCatalogData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/Options/ArticleOptionValueData.d.ts +0 -1
- package/build/types/web-planner-logic/src/model/Options/ArticleOptionValueData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/Options/CatalogOptionData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/test/datas/environments/testing/pfister-dev.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/test/scripts/productHandlerMoc.d.ts.map +1 -1
- package/package.json +2 -2
- package/build/cjs/DivaSingleProductPlanner-fcf3e4be.js +0 -1169
- package/build/cjs/DockingPointHandler-5c6b6024.js +0 -1255
- package/build/esm/DivaSingleProductPlanner-76dcd48c.js +0 -1158
- package/build/esm/DockingPointHandler-c35c0ee3.js +0 -1245
- package/build/types/web-planner-logic/src/logic/Planner/DivaSingleProductPlanner.d.ts +0 -140
- package/build/types/web-planner-logic/src/logic/Planner/DivaSingleProductPlanner.d.ts.map +0 -1
|
@@ -1,29 +1,819 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
4
3
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
5
4
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
6
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var index = require('./index-3703fcc3.js');
|
|
7
|
+
var DivaUtils = require('@crystaldesign/diva-utils');
|
|
8
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
7
9
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
8
|
-
var index = require('./index-0cf8efc1.js');
|
|
9
10
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
10
11
|
var fabric = require('fabric');
|
|
11
|
-
var DivaUtils = require('@crystaldesign/diva-utils');
|
|
12
12
|
var serialize = require('w3c-xmlserializer');
|
|
13
|
-
var DockingPointHandler = require('./DockingPointHandler-5c6b6024.js');
|
|
14
13
|
|
|
15
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
15
|
|
|
17
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
18
16
|
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
19
17
|
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
20
18
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
|
+
var DivaUtils__default = /*#__PURE__*/_interopDefaultLegacy(DivaUtils);
|
|
20
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
21
21
|
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
22
22
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
23
|
-
var DivaUtils__default = /*#__PURE__*/_interopDefaultLegacy(DivaUtils);
|
|
24
23
|
var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
|
|
25
24
|
|
|
26
|
-
var
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
var PlannerElementData = /*#__PURE__*/function () {
|
|
28
|
+
function PlannerElementData(setId, basketId, _elementId, plannerType) {
|
|
29
|
+
_classCallCheck__default["default"](this, PlannerElementData);
|
|
30
|
+
_defineProperty__default["default"](this, "planElement", void 0);
|
|
31
|
+
_defineProperty__default["default"](this, "plannerStateHash", void 0);
|
|
32
|
+
//this value saves the state of the plannerData - used to check if plannerData state changed
|
|
33
|
+
// private dockingPoints: Map<string, DockingPoint[]>; //This map saves all docking Points accessioated to a type
|
|
34
|
+
_defineProperty__default["default"](this, "dockingPoints", void 0);
|
|
35
|
+
//This map saves all docking Points accessioated to a type
|
|
36
|
+
_defineProperty__default["default"](this, "tempDockingPoints", void 0);
|
|
37
|
+
//When reloading the element this array saves the previous docking points for redocking
|
|
38
|
+
_defineProperty__default["default"](this, "plannerType", void 0);
|
|
39
|
+
_defineProperty__default["default"](this, "basketId", void 0);
|
|
40
|
+
_defineProperty__default["default"](this, "doSetWidthFromSVG", void 0);
|
|
41
|
+
_defineProperty__default["default"](this, "doSetDepthFromSVG", void 0);
|
|
42
|
+
this.basketId = basketId;
|
|
43
|
+
this.planElement = {
|
|
44
|
+
elementId: _elementId,
|
|
45
|
+
setId: setId,
|
|
46
|
+
worldPosCenter: new index.Vector3(0, 0, 0),
|
|
47
|
+
//welt Position der linken hinteren unteren Ecke des Elementes
|
|
48
|
+
rotDeg: 0,
|
|
49
|
+
posNr: -1,
|
|
50
|
+
setPosNr: -1
|
|
51
|
+
};
|
|
52
|
+
// this.dockingPoints = new Map<string, DockingPoint[]>();
|
|
53
|
+
this.dockingPoints = [];
|
|
54
|
+
this.tempDockingPoints = [];
|
|
55
|
+
this.plannerStateHash = '';
|
|
56
|
+
this.plannerType = plannerType;
|
|
57
|
+
this.doSetWidthFromSVG = false;
|
|
58
|
+
this.doSetDepthFromSVG = false;
|
|
59
|
+
}
|
|
60
|
+
return _createClass__default["default"](PlannerElementData, [{
|
|
61
|
+
key: "destroy",
|
|
62
|
+
value: function destroy() {
|
|
63
|
+
this.planElement.svgShapeOLF2D = null;
|
|
64
|
+
this.planElement.svgShapeOLT2D = null;
|
|
65
|
+
this.planElement.svgAsHTMLCanvas = undefined;
|
|
66
|
+
this.dockingPoints = [];
|
|
67
|
+
this.tempDockingPoints = [];
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "getTempDockingPoints",
|
|
71
|
+
value: function getTempDockingPoints() {
|
|
72
|
+
return this.tempDockingPoints;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "clearTempDockingPoints",
|
|
76
|
+
value: function clearTempDockingPoints() {
|
|
77
|
+
this.tempDockingPoints = [];
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "getDockingPoints",
|
|
81
|
+
value: function getDockingPoints() {
|
|
82
|
+
return this.dockingPoints;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 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.
|
|
87
|
+
* @param type Type of the docking point
|
|
88
|
+
*/
|
|
89
|
+
}, {
|
|
90
|
+
key: "dockingTypeIsDocking",
|
|
91
|
+
value: function dockingTypeIsDocking(type) {
|
|
92
|
+
var dockingPoints = this.getDockingPointsByType(type);
|
|
93
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
94
|
+
if (dockingPoints[i].IsDocking) return true;
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* This function returns all docking DPs of a specific type.
|
|
101
|
+
* @param type The type of the docking Point , e.g. AVL
|
|
102
|
+
*/
|
|
103
|
+
}, {
|
|
104
|
+
key: "getDockingDockingPointsByType",
|
|
105
|
+
value: function getDockingDockingPointsByType(type) {
|
|
106
|
+
var dockingPoints = this.getDockingPointsByType(type);
|
|
107
|
+
var ret = [];
|
|
108
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
109
|
+
if (dockingPoints[i].IsDocking) ret.push(dockingPoints[i]);
|
|
110
|
+
}
|
|
111
|
+
return ret;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* This function returns all docking DPs of any type.
|
|
116
|
+
*/
|
|
117
|
+
}, {
|
|
118
|
+
key: "getDockingDockingPoints",
|
|
119
|
+
value: function getDockingDockingPoints() {
|
|
120
|
+
var ret = [];
|
|
121
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
122
|
+
if (this.dockingPoints[i].IsDocking) ret.push(this.dockingPoints[i]);
|
|
123
|
+
}
|
|
124
|
+
return ret;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* This function returns all notDocking DPs of a specific type.
|
|
129
|
+
* @param type The type of the docking Point , e.g. AVL
|
|
130
|
+
*/
|
|
131
|
+
}, {
|
|
132
|
+
key: "getFreeDockingPointsByType",
|
|
133
|
+
value: function getFreeDockingPointsByType(type) {
|
|
134
|
+
var dockingPoints = this.getDockingPointsByType(type);
|
|
135
|
+
var ret = [];
|
|
136
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
137
|
+
if (!dockingPoints[i].IsDocking) ret.push(dockingPoints[i]);
|
|
138
|
+
}
|
|
139
|
+
return ret;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* This function returns the free docking with the specific type and number
|
|
144
|
+
* @param type
|
|
145
|
+
* @param number
|
|
146
|
+
*/
|
|
147
|
+
}, {
|
|
148
|
+
key: "getFreeDockingPointByTypeAndNumber",
|
|
149
|
+
value: function getFreeDockingPointByTypeAndNumber(type, number) {
|
|
150
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
151
|
+
if (!this.dockingPoints[i].IsDocking && this.dockingPoints[i].Type == type && this.dockingPoints[i].Number == number) return this.dockingPoints[i];
|
|
152
|
+
}
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* This function returns all docking points of the element. It returns docking and not docking points with any type.
|
|
158
|
+
*/
|
|
159
|
+
}, {
|
|
160
|
+
key: "getAllDockingPoints",
|
|
161
|
+
value: function getAllDockingPoints() {
|
|
162
|
+
return this.dockingPoints;
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "getDockingPointsByType",
|
|
166
|
+
value: function getDockingPointsByType(type) {
|
|
167
|
+
var dps = [];
|
|
168
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
169
|
+
if (this.dockingPoints[i].Type == type) {
|
|
170
|
+
dps.push(this.dockingPoints[i]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return dps;
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "getDockingPointById",
|
|
177
|
+
value: function getDockingPointById(id) {
|
|
178
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
179
|
+
if (this.dockingPoints[i].DpId == id) {
|
|
180
|
+
return this.dockingPoints[i];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* This function retuns the DockingPoint info in a string format that is used for the 3D image rendering planningData.
|
|
187
|
+
*/
|
|
188
|
+
}, {
|
|
189
|
+
key: "getDockingPointJS3D",
|
|
190
|
+
value: function getDockingPointJS3D() {
|
|
191
|
+
var dpJS = '';
|
|
192
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
193
|
+
var dockingPoint = this.dockingPoints[i];
|
|
194
|
+
if (dockingPoint.IsDocking) {
|
|
195
|
+
if (dpJS != '') dpJS += ',';
|
|
196
|
+
dpJS += dockingPoint.Name + ':' + 'E' + dockingPoint.OnElementId;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return dpJS;
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
key: "ArticleCodex",
|
|
203
|
+
get: function get() {
|
|
204
|
+
var _this$planElement$pla, _this$planElement$pla2;
|
|
205
|
+
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 : '';
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Returns true if the accessoire is docked to another element in the planner (relatedToBasketID is set).
|
|
209
|
+
*/
|
|
210
|
+
}, {
|
|
211
|
+
key: "IsDockedAccessoire",
|
|
212
|
+
get: function get() {
|
|
213
|
+
return this.planElement.plannerData ? this.planElement.plannerData.isAccessoire : false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
//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
|
|
217
|
+
//this.planElement.plannerData?.filterType == "Accessoire" -> This is always true - The Accesssoire article is listed as accessoire
|
|
218
|
+
}, {
|
|
219
|
+
key: "IsAccessoire",
|
|
220
|
+
get: function get() {
|
|
221
|
+
var _this$planElement$pla3;
|
|
222
|
+
return ((_this$planElement$pla3 = this.planElement.plannerData) === null || _this$planElement$pla3 === void 0 ? void 0 : _this$planElement$pla3.filterType) == 'Accessoire';
|
|
223
|
+
}
|
|
224
|
+
}, {
|
|
225
|
+
key: "FilterAVL",
|
|
226
|
+
get: function get() {
|
|
227
|
+
return this.getFilterAVL();
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "FilterAVR",
|
|
231
|
+
get: function get() {
|
|
232
|
+
return this.getFilterAVR();
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
key: "PosNr",
|
|
236
|
+
get: function get() {
|
|
237
|
+
return this.planElement.posNr;
|
|
238
|
+
},
|
|
239
|
+
set: function set(posNr) {
|
|
240
|
+
this.planElement.posNr = posNr;
|
|
241
|
+
}
|
|
242
|
+
}, {
|
|
243
|
+
key: "SetPosNr",
|
|
244
|
+
set: function set(setPosNr) {
|
|
245
|
+
this.planElement.setPosNr = setPosNr;
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "AccessoirePosNr",
|
|
249
|
+
get: function get() {
|
|
250
|
+
return this.planElement.posNrAcc != undefined ? this.planElement.posNrAcc : -1;
|
|
251
|
+
},
|
|
252
|
+
set: function set(posNr) {
|
|
253
|
+
this.planElement.posNrAcc = posNr;
|
|
254
|
+
}
|
|
255
|
+
}, {
|
|
256
|
+
key: "WorldPosCenter",
|
|
257
|
+
get: function get() {
|
|
258
|
+
return this.planElement.worldPosCenter;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* This function returns the world pos of the top left bottom corner.
|
|
263
|
+
*/,
|
|
264
|
+
set: function set(pos) {
|
|
265
|
+
this.planElement.worldPosCenter = pos;
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
key: "WorldPosCorner",
|
|
269
|
+
get: function get() {
|
|
270
|
+
if (this.planElement.plannerData == null) return new index.Vector3(0, 0, 0);
|
|
271
|
+
var cornerDir = new index.Vector2(-this.planElement.plannerData.width / 2, -this.planElement.plannerData.depth / 2);
|
|
272
|
+
cornerDir = index.Vector2.rotateOrigin(cornerDir, this.planElement.rotDeg);
|
|
273
|
+
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);
|
|
274
|
+
},
|
|
275
|
+
set: function set(cornerPos) {
|
|
276
|
+
if (!this.planElement.plannerData) return;
|
|
277
|
+
var centerDir = new index.Vector2(this.planElement.plannerData.width / 2, this.planElement.plannerData.depth / 2);
|
|
278
|
+
centerDir = index.Vector2.rotateOrigin(centerDir, this.planElement.rotDeg);
|
|
279
|
+
this.planElement.worldPosCenter = new index.Vector3(cornerPos.x + centerDir.x, cornerPos.y + this.planElement.plannerData.height / 2, cornerPos.z + centerDir.y);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* This function updates the world position and rotation of the element based of some delta Elements
|
|
284
|
+
* @param deltaMove delta translation in cm
|
|
285
|
+
* @param deltaRotDeg delta rotation in degrees
|
|
286
|
+
* @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
|
|
287
|
+
*/
|
|
288
|
+
}, {
|
|
289
|
+
key: "updateDeltaTrans",
|
|
290
|
+
value: function updateDeltaTrans(deltaMove, deltaRotDeg, rotCorrection, correctAngle) {
|
|
291
|
+
this.WorldPosCenter = new index.Vector3(this.WorldPosCenter.x + deltaMove.x, this.WorldPosCenter.y + deltaMove.y, this.WorldPosCenter.z + deltaMove.z);
|
|
292
|
+
if (deltaRotDeg != 0 || correctAngle) {
|
|
293
|
+
if (correctAngle) {
|
|
294
|
+
var newRot = this.RotDeg + deltaRotDeg;
|
|
295
|
+
if (rotCorrection != 0) {
|
|
296
|
+
if (Math.abs(newRot % rotCorrection) > rotCorrection / 2) {
|
|
297
|
+
deltaRotDeg = deltaRotDeg + rotCorrection - Math.abs(newRot % rotCorrection);
|
|
298
|
+
} else {
|
|
299
|
+
deltaRotDeg = deltaRotDeg + Math.abs(newRot % rotCorrection);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
this.processCenterRot(deltaRotDeg);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "processCenterRot",
|
|
308
|
+
value: function processCenterRot(deltaRot) {
|
|
309
|
+
this.RotDeg = this.RotDeg + deltaRot;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Returns the position in world coordinates of the DP of the element depending on the position and rotation of the planner element
|
|
313
|
+
* @param dpID
|
|
314
|
+
*/
|
|
315
|
+
}, {
|
|
316
|
+
key: "getWorldPosOfDP",
|
|
317
|
+
value: function getWorldPosOfDP(dpID) {
|
|
318
|
+
var dp = this.getDockingPointById(dpID);
|
|
319
|
+
if (dp == undefined) return new index.Vector3(0, 0, 0);
|
|
320
|
+
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);
|
|
321
|
+
return new index.Vector3(this.WorldPosCorner.x + rotatedDir.x, this.WorldPosCorner.y, this.WorldPosCorner.z + rotatedDir.y);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Returns the outlines of the bounding box in world coordinates
|
|
326
|
+
*/
|
|
327
|
+
}, {
|
|
328
|
+
key: "getWorld2DBBoxOutline",
|
|
329
|
+
value: function getWorld2DBBoxOutline() {
|
|
330
|
+
var bboxPoints = [];
|
|
331
|
+
bboxPoints.push(new index.Vector2(this.WorldPosCorner.x, this.WorldPosCorner.z));
|
|
332
|
+
var helper = index.Vector2.rotateOrigin(new index.Vector2(this.getGlobalWidth(), 0), this.RotDeg);
|
|
333
|
+
bboxPoints.push(new index.Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
|
|
334
|
+
helper = index.Vector2.rotateOrigin(new index.Vector2(this.getGlobalWidth(), this.getGlobalDepth()), this.RotDeg);
|
|
335
|
+
bboxPoints.push(new index.Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
|
|
336
|
+
helper = index.Vector2.rotateOrigin(new index.Vector2(0, this.getGlobalDepth()), this.RotDeg);
|
|
337
|
+
bboxPoints.push(new index.Vector2(this.WorldPosCorner.x + helper.x, this.WorldPosCorner.z + helper.y));
|
|
338
|
+
return bboxPoints;
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
key: "RotDeg",
|
|
342
|
+
get: function get() {
|
|
343
|
+
return this.planElement.rotDeg;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Saves the current docking point state
|
|
348
|
+
*/,
|
|
349
|
+
set: function set(rot) {
|
|
350
|
+
this.planElement.rotDeg = rot;
|
|
351
|
+
}
|
|
352
|
+
}, {
|
|
353
|
+
key: "saveCurrentDPState",
|
|
354
|
+
value: function saveCurrentDPState() {
|
|
355
|
+
if (this.dockingPoints && this.dockingPoints.length > 0) {
|
|
356
|
+
this.tempDockingPoints = [];
|
|
357
|
+
for (var i = 0; i < this.dockingPoints.length; i++) {
|
|
358
|
+
this.tempDockingPoints.push(this.dockingPoints[i].clone());
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}, {
|
|
363
|
+
key: "clearAllDockingPoints",
|
|
364
|
+
value: function clearAllDockingPoints() {
|
|
365
|
+
this.dockingPoints = [];
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: "addDockingPoint",
|
|
369
|
+
value: function addDockingPoint(dockingPoint) {
|
|
370
|
+
this.dockingPoints.push(dockingPoint);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
//Sets the planner Data. Returns true if something changed -> Reload
|
|
374
|
+
}, {
|
|
375
|
+
key: "updatePlannerData",
|
|
376
|
+
value: function updatePlannerData(data) {
|
|
377
|
+
//The plannerData ist keine Kopie, sondern ein verweis - wenn im Konfigurator das PlannerData Object geändert wird, dann wird es das hier auch.
|
|
378
|
+
if ((data === null || data === void 0 ? void 0 : data.width) == undefined || data.width == -1) {
|
|
379
|
+
this.doSetWidthFromSVG = true;
|
|
380
|
+
} else {
|
|
381
|
+
this.doSetWidthFromSVG = false;
|
|
382
|
+
}
|
|
383
|
+
if ((data === null || data === void 0 ? void 0 : data.depth) == undefined || data.depth == -1) {
|
|
384
|
+
this.doSetDepthFromSVG = true;
|
|
385
|
+
} else {
|
|
386
|
+
this.doSetDepthFromSVG = false;
|
|
387
|
+
}
|
|
388
|
+
if (this.planElement.plannerData == null && data != null) {
|
|
389
|
+
this.planElement.plannerData = data;
|
|
390
|
+
this.plannerStateHash = DivaUtils.md5(JSON.stringify(this.planElement.plannerData));
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
if (data != null) this.planElement.plannerData = data;
|
|
394
|
+
if (!this.planElement.plannerData) return false;
|
|
395
|
+
var plannerDataForCache = _objectSpread(_objectSpread({}, this.planElement.plannerData), {}, {
|
|
396
|
+
currentAccessorires: []
|
|
397
|
+
});
|
|
398
|
+
var currentHash = DivaUtils.md5(JSON.stringify(plannerDataForCache));
|
|
399
|
+
if (this.plannerStateHash != currentHash) {
|
|
400
|
+
this.plannerStateHash = currentHash;
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "cleanShapeOLF2D",
|
|
407
|
+
value: function cleanShapeOLF2D() {
|
|
408
|
+
this.planElement.svgShapeOLF2D = undefined;
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
411
|
+
key: "cleanShapeOLT2D",
|
|
412
|
+
value: function cleanShapeOLT2D() {
|
|
413
|
+
this.planElement.svgShapeOLT2D = undefined;
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "DoSetWidthFromSVG",
|
|
417
|
+
get: function get() {
|
|
418
|
+
return this.doSetWidthFromSVG;
|
|
419
|
+
}
|
|
420
|
+
}, {
|
|
421
|
+
key: "DoSetDepthFromSVG",
|
|
422
|
+
get: function get() {
|
|
423
|
+
return this.doSetDepthFromSVG;
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
key: "WidthFromSVG",
|
|
427
|
+
set: function set(svgWidth) {
|
|
428
|
+
if (this.planElement.plannerData) this.planElement.plannerData.width = svgWidth;
|
|
429
|
+
this.doSetWidthFromSVG = false;
|
|
430
|
+
}
|
|
431
|
+
}, {
|
|
432
|
+
key: "DepthFromSVG",
|
|
433
|
+
set: function set(svgDepth) {
|
|
434
|
+
if (this.planElement.plannerData) this.planElement.plannerData.depth = svgDepth;
|
|
435
|
+
this.doSetDepthFromSVG = false;
|
|
436
|
+
}
|
|
437
|
+
}, {
|
|
438
|
+
key: "ElementId",
|
|
439
|
+
get: function get() {
|
|
440
|
+
return this.planElement.elementId;
|
|
441
|
+
}
|
|
442
|
+
}, {
|
|
443
|
+
key: "SvgFileName",
|
|
444
|
+
get: function get() {
|
|
445
|
+
var _this$planElement$pla4;
|
|
446
|
+
return (_this$planElement$pla4 = this.planElement.plannerData) === null || _this$planElement$pla4 === void 0 ? void 0 : _this$planElement$pla4.curSVG;
|
|
447
|
+
}
|
|
448
|
+
}, {
|
|
449
|
+
key: "Width",
|
|
450
|
+
get: function get() {
|
|
451
|
+
var _this$planElement$pla5;
|
|
452
|
+
return (_this$planElement$pla5 = this.planElement.plannerData) === null || _this$planElement$pla5 === void 0 ? void 0 : _this$planElement$pla5.width;
|
|
453
|
+
}
|
|
454
|
+
}, {
|
|
455
|
+
key: "Height",
|
|
456
|
+
get: function get() {
|
|
457
|
+
var _this$planElement$pla6;
|
|
458
|
+
return (_this$planElement$pla6 = this.planElement.plannerData) === null || _this$planElement$pla6 === void 0 ? void 0 : _this$planElement$pla6.height;
|
|
459
|
+
}
|
|
460
|
+
}, {
|
|
461
|
+
key: "Depth",
|
|
462
|
+
get: function get() {
|
|
463
|
+
var _this$planElement$pla7;
|
|
464
|
+
return (_this$planElement$pla7 = this.planElement.plannerData) === null || _this$planElement$pla7 === void 0 ? void 0 : _this$planElement$pla7.depth;
|
|
465
|
+
}
|
|
466
|
+
}, {
|
|
467
|
+
key: "HasAVL",
|
|
468
|
+
get: function get() {
|
|
469
|
+
var _this$planElement$pla8;
|
|
470
|
+
return (_this$planElement$pla8 = this.planElement.plannerData) === null || _this$planElement$pla8 === void 0 ? void 0 : _this$planElement$pla8.hasAVL;
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "HasAVR",
|
|
474
|
+
get: function get() {
|
|
475
|
+
var _this$planElement$pla9;
|
|
476
|
+
return (_this$planElement$pla9 = this.planElement.plannerData) === null || _this$planElement$pla9 === void 0 ? void 0 : _this$planElement$pla9.hasAVR;
|
|
477
|
+
}
|
|
478
|
+
}, {
|
|
479
|
+
key: "HasAVO",
|
|
480
|
+
get: function get() {
|
|
481
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVO > 0 ? true : false : false;
|
|
482
|
+
}
|
|
483
|
+
}, {
|
|
484
|
+
key: "HasAVU",
|
|
485
|
+
get: function get() {
|
|
486
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVU > 0 ? true : false : false;
|
|
487
|
+
}
|
|
488
|
+
}, {
|
|
489
|
+
key: "HasAVC",
|
|
490
|
+
get: function get() {
|
|
491
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVC > 0 ? true : false : false;
|
|
492
|
+
}
|
|
493
|
+
}, {
|
|
494
|
+
key: "SvgShapeOLF2D",
|
|
495
|
+
get: function get() {
|
|
496
|
+
return this.planElement.svgShapeOLF2D;
|
|
497
|
+
},
|
|
498
|
+
set: function set(shape) {
|
|
499
|
+
this.planElement.svgShapeOLF2D = shape;
|
|
500
|
+
}
|
|
501
|
+
}, {
|
|
502
|
+
key: "SvgShapeOLT2D",
|
|
503
|
+
get: function get() {
|
|
504
|
+
return this.planElement.svgShapeOLT2D;
|
|
505
|
+
},
|
|
506
|
+
set: function set(shape) {
|
|
507
|
+
this.planElement.svgShapeOLT2D = shape;
|
|
508
|
+
}
|
|
509
|
+
}, {
|
|
510
|
+
key: "OLTPolygon",
|
|
511
|
+
get: function get() {
|
|
512
|
+
return this.planElement.oltPolygon;
|
|
513
|
+
},
|
|
514
|
+
set: function set(polygon) {
|
|
515
|
+
this.planElement.oltPolygon = polygon;
|
|
516
|
+
}
|
|
517
|
+
}, {
|
|
518
|
+
key: "setupOLF",
|
|
519
|
+
value: function setupOLF(polygon, olfWidth, olfHeight) {
|
|
520
|
+
this.planElement.olfPolygon = polygon;
|
|
521
|
+
this.planElement.olfDepth = olfHeight;
|
|
522
|
+
this.planElement.olfWidth = olfWidth;
|
|
523
|
+
}
|
|
524
|
+
}, {
|
|
525
|
+
key: "clearOLF",
|
|
526
|
+
value: function clearOLF() {
|
|
527
|
+
this.planElement.olfPolygon = undefined;
|
|
528
|
+
this.planElement.olfDepth = undefined;
|
|
529
|
+
this.planElement.olfWidth = undefined;
|
|
530
|
+
}
|
|
531
|
+
}, {
|
|
532
|
+
key: "getGlobalWidth",
|
|
533
|
+
value: function getGlobalWidth() {
|
|
534
|
+
if (this.HasOLFPolygon) {
|
|
535
|
+
return this.planElement.olfWidth / DivaUtils__default["default"].UnitRecalc;
|
|
536
|
+
}
|
|
537
|
+
return this.Width;
|
|
538
|
+
}
|
|
539
|
+
}, {
|
|
540
|
+
key: "getGlobalDepth",
|
|
541
|
+
value: function getGlobalDepth() {
|
|
542
|
+
if (this.HasOLFPolygon) {
|
|
543
|
+
return this.planElement.olfDepth / DivaUtils__default["default"].UnitRecalc;
|
|
544
|
+
}
|
|
545
|
+
return this.Depth;
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
key: "HasOLTPolygon",
|
|
549
|
+
get: function get() {
|
|
550
|
+
return this.planElement.oltPolygon != null;
|
|
551
|
+
}
|
|
552
|
+
}, {
|
|
553
|
+
key: "HasOLFPolygon",
|
|
554
|
+
get: function get() {
|
|
555
|
+
return this.planElement.olfPolygon != null;
|
|
556
|
+
}
|
|
557
|
+
}, {
|
|
558
|
+
key: "getOLTPolygonWorldPos",
|
|
559
|
+
value: function getOLTPolygonWorldPos() {
|
|
560
|
+
if (!this.planElement.oltPolygon) return [];
|
|
561
|
+
var polygon = [];
|
|
562
|
+
for (var i = 0; i < this.planElement.oltPolygon.length; i++) {
|
|
563
|
+
var localWorldPos = new index.Vector2(this.planElement.oltPolygon[i].x / DivaUtils__default["default"].UnitRecalc, this.planElement.oltPolygon[i].y / DivaUtils__default["default"].UnitRecalc);
|
|
564
|
+
localWorldPos = index.Vector2.rotateOrigin(localWorldPos, this.RotDeg);
|
|
565
|
+
polygon.push(new index.Vector2(this.WorldPosCorner.x + localWorldPos.x, this.WorldPosCorner.z + localWorldPos.y));
|
|
566
|
+
}
|
|
567
|
+
return polygon;
|
|
568
|
+
}
|
|
569
|
+
}, {
|
|
570
|
+
key: "getOLFPolygonWorldPos",
|
|
571
|
+
value: function getOLFPolygonWorldPos() {
|
|
572
|
+
var polygon = [];
|
|
573
|
+
if (!this.planElement.olfPolygon) return [];
|
|
574
|
+
for (var i = 0; i < this.planElement.olfPolygon.length; i++) {
|
|
575
|
+
var localWorldPos = new index.Vector2(this.planElement.olfPolygon[i].x / DivaUtils__default["default"].UnitRecalc, this.planElement.olfPolygon[i].y / DivaUtils__default["default"].UnitRecalc);
|
|
576
|
+
localWorldPos = index.Vector2.rotateOrigin(localWorldPos, this.RotDeg);
|
|
577
|
+
polygon.push(new index.Vector2(this.WorldPosCorner.x + localWorldPos.x, this.WorldPosCorner.z + localWorldPos.y));
|
|
578
|
+
}
|
|
579
|
+
return polygon;
|
|
580
|
+
}
|
|
581
|
+
}, {
|
|
582
|
+
key: "SvgData",
|
|
583
|
+
get: function get() {
|
|
584
|
+
return this.planElement.svgData ? this.planElement.svgData : '';
|
|
585
|
+
},
|
|
586
|
+
set: function set(svgData) {
|
|
587
|
+
this.planElement.svgData = svgData;
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
key: "SvgDataOLTBase64",
|
|
591
|
+
set: function set(svgData) {
|
|
592
|
+
this.planElement.SvgDataOLTBase64 = svgData;
|
|
593
|
+
}
|
|
594
|
+
}, {
|
|
595
|
+
key: "Layer",
|
|
596
|
+
get: function get() {
|
|
597
|
+
return this.planElement.plannerData.layer;
|
|
598
|
+
}
|
|
599
|
+
}, {
|
|
600
|
+
key: "HasSvgAsHTMLCanvas",
|
|
601
|
+
get: function get() {
|
|
602
|
+
return this.planElement.svgAsHTMLCanvas == undefined ? false : true;
|
|
603
|
+
}
|
|
604
|
+
}, {
|
|
605
|
+
key: "SvgAsHTMLCanvas",
|
|
606
|
+
get: function get() {
|
|
607
|
+
return this.planElement.svgAsHTMLCanvas;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** ---------------------------------Getter und setter for the view------------------------- */,
|
|
611
|
+
set: function set(ctx) {
|
|
612
|
+
this.planElement.svgAsHTMLCanvas = ctx;
|
|
613
|
+
}
|
|
614
|
+
}, {
|
|
615
|
+
key: "getPosNr",
|
|
616
|
+
value: function getPosNr() {
|
|
617
|
+
return this.planElement.setPosNr;
|
|
618
|
+
}
|
|
619
|
+
}, {
|
|
620
|
+
key: "getAccessoirePosNr",
|
|
621
|
+
value: function getAccessoirePosNr() {
|
|
622
|
+
return this.planElement.posNrAcc;
|
|
623
|
+
}
|
|
624
|
+
}, {
|
|
625
|
+
key: "getPosNrWithAccessoirePosNr",
|
|
626
|
+
value: function getPosNrWithAccessoirePosNr() {
|
|
627
|
+
return this.getIsDockedAccessoire() ? this.getPosNr() + '.' + (this.getAccessoirePosNr() != undefined && this.getAccessoirePosNr() < 10 ? '0' + this.getAccessoirePosNr() : this.getAccessoirePosNr()) : this.getPosNr().toString();
|
|
628
|
+
}
|
|
629
|
+
}, {
|
|
630
|
+
key: "getIsDockedAccessoire",
|
|
631
|
+
value: function getIsDockedAccessoire() {
|
|
632
|
+
return this.IsDockedAccessoire;
|
|
633
|
+
}
|
|
634
|
+
}, {
|
|
635
|
+
key: "getIsNotDockedAccessoire",
|
|
636
|
+
value: function getIsNotDockedAccessoire() {
|
|
637
|
+
var _this$planElement$pla10;
|
|
638
|
+
return !!((_this$planElement$pla10 = this.planElement.plannerData) !== null && _this$planElement$pla10 !== void 0 && _this$planElement$pla10.isNotDockedAccessoire);
|
|
639
|
+
}
|
|
640
|
+
}, {
|
|
641
|
+
key: "getParentElementId",
|
|
642
|
+
value: function getParentElementId() {
|
|
643
|
+
var _this$planElement$pla11;
|
|
644
|
+
return (_this$planElement$pla11 = this.planElement.plannerData) === null || _this$planElement$pla11 === void 0 ? void 0 : _this$planElement$pla11.parentElementId;
|
|
645
|
+
}
|
|
646
|
+
}, {
|
|
647
|
+
key: "getElementId",
|
|
648
|
+
value: function getElementId() {
|
|
649
|
+
return this.planElement.elementId;
|
|
650
|
+
}
|
|
651
|
+
}, {
|
|
652
|
+
key: "getBasketId",
|
|
653
|
+
value: function getBasketId() {
|
|
654
|
+
return this.basketId;
|
|
655
|
+
}
|
|
656
|
+
}, {
|
|
657
|
+
key: "getSetId",
|
|
658
|
+
value: function getSetId() {
|
|
659
|
+
return this.planElement.setId;
|
|
660
|
+
}
|
|
661
|
+
}, {
|
|
662
|
+
key: "getWorldPosCorner",
|
|
663
|
+
value: function getWorldPosCorner() {
|
|
664
|
+
return this.WorldPosCorner;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* This function returns the position in world coordinates of the CENTER of the plannerElement
|
|
669
|
+
*/
|
|
670
|
+
}, {
|
|
671
|
+
key: "getWorldPosCenter",
|
|
672
|
+
value: function getWorldPosCenter() {
|
|
673
|
+
return this.WorldPosCenter;
|
|
674
|
+
}
|
|
675
|
+
}, {
|
|
676
|
+
key: "getRotDeg",
|
|
677
|
+
value: function getRotDeg() {
|
|
678
|
+
return this.planElement.rotDeg;
|
|
679
|
+
}
|
|
680
|
+
}, {
|
|
681
|
+
key: "getRotRad",
|
|
682
|
+
value: function getRotRad() {
|
|
683
|
+
return this.planElement.rotDeg * Math.PI / 180;
|
|
684
|
+
}
|
|
685
|
+
}, {
|
|
686
|
+
key: "getHasAVL",
|
|
687
|
+
value: function getHasAVL() {
|
|
688
|
+
return this.planElement.plannerData ? this.planElement.plannerData.hasAVL : false;
|
|
689
|
+
}
|
|
690
|
+
}, {
|
|
691
|
+
key: "getHasAVR",
|
|
692
|
+
value: function getHasAVR() {
|
|
693
|
+
return this.planElement.plannerData ? this.planElement.plannerData.hasAVR : false;
|
|
694
|
+
}
|
|
695
|
+
}, {
|
|
696
|
+
key: "getHasAVO",
|
|
697
|
+
value: function getHasAVO() {
|
|
698
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVO > 0 ? true : false : false;
|
|
699
|
+
}
|
|
700
|
+
}, {
|
|
701
|
+
key: "getHasAVU",
|
|
702
|
+
value: function getHasAVU() {
|
|
703
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVU > 0 ? true : false : false;
|
|
704
|
+
}
|
|
705
|
+
}, {
|
|
706
|
+
key: "getHasAVC",
|
|
707
|
+
value: function getHasAVC() {
|
|
708
|
+
return this.planElement.plannerData != undefined ? this.planElement.plannerData.countAVC > 0 ? true : false : false;
|
|
709
|
+
}
|
|
710
|
+
}, {
|
|
711
|
+
key: "getFilterAVL",
|
|
712
|
+
value: function getFilterAVL() {
|
|
713
|
+
var _this$planElement$pla12;
|
|
714
|
+
return this.planElement.plannerData ? (_this$planElement$pla12 = this.planElement.plannerData) === null || _this$planElement$pla12 === void 0 ? void 0 : _this$planElement$pla12.AVLFilter : [];
|
|
715
|
+
}
|
|
716
|
+
}, {
|
|
717
|
+
key: "getFilterAVR",
|
|
718
|
+
value: function getFilterAVR() {
|
|
719
|
+
return this.planElement.plannerData ? this.planElement.plannerData.AVRFilter : [];
|
|
720
|
+
}
|
|
721
|
+
}, {
|
|
722
|
+
key: "getSVGShapeOLF2D",
|
|
723
|
+
value: function getSVGShapeOLF2D() {
|
|
724
|
+
return this.planElement.svgShapeOLF2D;
|
|
725
|
+
}
|
|
726
|
+
}, {
|
|
727
|
+
key: "getSVGShapeOLT2D",
|
|
728
|
+
value: function getSVGShapeOLT2D() {
|
|
729
|
+
return this.planElement.svgShapeOLT2D;
|
|
730
|
+
}
|
|
731
|
+
}, {
|
|
732
|
+
key: "getPlannerType",
|
|
733
|
+
value: function getPlannerType() {
|
|
734
|
+
return this.plannerType;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Returns the original svg XML
|
|
739
|
+
*/
|
|
740
|
+
}, {
|
|
741
|
+
key: "getSVGData",
|
|
742
|
+
value: function getSVGData() {
|
|
743
|
+
return this.planElement.svgData ? this.planElement.svgData : '';
|
|
744
|
+
}
|
|
745
|
+
}, {
|
|
746
|
+
key: "getWidth",
|
|
747
|
+
value: function getWidth() {
|
|
748
|
+
return this.planElement.plannerData ? this.getGlobalWidth() : -1;
|
|
749
|
+
}
|
|
750
|
+
}, {
|
|
751
|
+
key: "getHeight",
|
|
752
|
+
value: function getHeight() {
|
|
753
|
+
return this.planElement.plannerData ? this.planElement.plannerData.height : -1;
|
|
754
|
+
}
|
|
755
|
+
}, {
|
|
756
|
+
key: "getDepth",
|
|
757
|
+
value: function getDepth() {
|
|
758
|
+
return this.planElement.plannerData ? this.getGlobalDepth() : -1;
|
|
759
|
+
}
|
|
760
|
+
}, {
|
|
761
|
+
key: "getDepthOLT",
|
|
762
|
+
value: function getDepthOLT() {
|
|
763
|
+
return this.Depth ? this.Depth : -1;
|
|
764
|
+
}
|
|
765
|
+
}, {
|
|
766
|
+
key: "getWidthOLT",
|
|
767
|
+
value: function getWidthOLT() {
|
|
768
|
+
return this.Width ? this.Width : -1;
|
|
769
|
+
}
|
|
770
|
+
}, {
|
|
771
|
+
key: "getLayer",
|
|
772
|
+
value: function getLayer() {
|
|
773
|
+
return this.planElement.plannerData ? this.planElement.plannerData.layer : 20;
|
|
774
|
+
}
|
|
775
|
+
}, {
|
|
776
|
+
key: "hasSvgAsHtmlCanvas",
|
|
777
|
+
value: function hasSvgAsHtmlCanvas() {
|
|
778
|
+
return this.planElement.svgAsHTMLCanvas == undefined ? false : true;
|
|
779
|
+
}
|
|
780
|
+
}, {
|
|
781
|
+
key: "getSvgAsHtmlCanvas",
|
|
782
|
+
value: function getSvgAsHtmlCanvas() {
|
|
783
|
+
return this.planElement.svgAsHTMLCanvas;
|
|
784
|
+
}
|
|
785
|
+
}, {
|
|
786
|
+
key: "hasSvgDataOLTBase64",
|
|
787
|
+
value: function hasSvgDataOLTBase64() {
|
|
788
|
+
return this.planElement.SvgDataOLTBase64 != undefined && this.planElement.SvgDataOLTBase64 != '';
|
|
789
|
+
}
|
|
790
|
+
}, {
|
|
791
|
+
key: "getSvgDataOLTBase64",
|
|
792
|
+
value: function getSvgDataOLTBase64() {
|
|
793
|
+
return this.planElement.SvgDataOLTBase64 != undefined ? this.planElement.SvgDataOLTBase64 : '';
|
|
794
|
+
}
|
|
795
|
+
}, {
|
|
796
|
+
key: "getAccessoires",
|
|
797
|
+
value: function getAccessoires() {
|
|
798
|
+
var _this$planElement$pla13;
|
|
799
|
+
return this.planElement.plannerData ? (_this$planElement$pla13 = this.planElement.plannerData) === null || _this$planElement$pla13 === void 0 ? void 0 : _this$planElement$pla13.accessoireList : [];
|
|
800
|
+
}
|
|
801
|
+
}, {
|
|
802
|
+
key: "getSVGsWithFormula",
|
|
803
|
+
value: function getSVGsWithFormula() {
|
|
804
|
+
var _this$planElement$pla14;
|
|
805
|
+
return (_this$planElement$pla14 = this.planElement.plannerData) === null || _this$planElement$pla14 === void 0 ? void 0 : _this$planElement$pla14.svgsWithFormula;
|
|
806
|
+
}
|
|
807
|
+
}, {
|
|
808
|
+
key: "getCurrentAccessorires",
|
|
809
|
+
value: function getCurrentAccessorires() {
|
|
810
|
+
var _this$planElement$pla15;
|
|
811
|
+
return this.planElement.plannerData ? (_this$planElement$pla15 = this.planElement.plannerData) === null || _this$planElement$pla15 === void 0 ? void 0 : _this$planElement$pla15.currentAccessorires : [];
|
|
812
|
+
}
|
|
813
|
+
}]);
|
|
814
|
+
}();
|
|
815
|
+
|
|
816
|
+
var LOG$2 = DivaUtils__default["default"].initLog('Planner', 'WEB-PLANNER-LOGIC');
|
|
27
817
|
var SVGUtils = /*#__PURE__*/function () {
|
|
28
818
|
function SVGUtils() {
|
|
29
819
|
_classCallCheck__default["default"](this, SVGUtils);
|
|
@@ -589,7 +1379,7 @@ var SVGUtils = /*#__PURE__*/function () {
|
|
|
589
1379
|
}
|
|
590
1380
|
}
|
|
591
1381
|
function correctViewBoxScaleStyle(styleNode, scaleFactorSvgViewBox) {
|
|
592
|
-
if (styleNode.getAttribute('type') != 'text/css') LOG$
|
|
1382
|
+
if (styleNode.getAttribute('type') != 'text/css') LOG$2.debug('Warnung komisches style Element bei diesem CSS.');
|
|
593
1383
|
var styleText = styleNode.innerHTML;
|
|
594
1384
|
var styleParts = styleText.split('{');
|
|
595
1385
|
var newStyleContent = '';
|
|
@@ -1359,7 +2149,7 @@ var SVGUtils = /*#__PURE__*/function () {
|
|
|
1359
2149
|
deltaParameter = 4;
|
|
1360
2150
|
break;
|
|
1361
2151
|
default:
|
|
1362
|
-
LOG$
|
|
2152
|
+
LOG$2.error(new DivaUtils.DivaError('svg path command: ' + command + ' unknown'));
|
|
1363
2153
|
return;
|
|
1364
2154
|
}
|
|
1365
2155
|
for (var a = 0; a < number.length; a = a + deltaParameter) {
|
|
@@ -1488,6 +2278,453 @@ var SVGUtils = /*#__PURE__*/function () {
|
|
|
1488
2278
|
}]);
|
|
1489
2279
|
}();
|
|
1490
2280
|
|
|
2281
|
+
var LOG$1 = DivaUtils__default["default"].initLog('Planner', 'WEB-PLANNER-LOGIC');
|
|
2282
|
+
/**
|
|
2283
|
+
* This class is used like a service.
|
|
2284
|
+
* It handles different actions on planner Elements and its docking Points
|
|
2285
|
+
*/
|
|
2286
|
+
var DockingPointHandler = /*#__PURE__*/function () {
|
|
2287
|
+
function DockingPointHandler() {
|
|
2288
|
+
_classCallCheck__default["default"](this, DockingPointHandler);
|
|
2289
|
+
}
|
|
2290
|
+
return _createClass__default["default"](DockingPointHandler, [{
|
|
2291
|
+
key: "getRotOfDP",
|
|
2292
|
+
value:
|
|
2293
|
+
/**
|
|
2294
|
+
* This function returns the rotation of a vector that is specified by two positions in the 2 Dim Space
|
|
2295
|
+
* The rotation is 0 when the Vector is pointing downwards (pos1 is directly above pos2). The rotation is then computed clockwise
|
|
2296
|
+
* The result is resturned in degrees
|
|
2297
|
+
* @param pos1 2 Dimensional position
|
|
2298
|
+
* @param pos2 2 Dimensional position
|
|
2299
|
+
*/
|
|
2300
|
+
function getRotOfDP(pos1, pos2) {
|
|
2301
|
+
var directionVec = index.Vector2.getDirection(pos2, pos1);
|
|
2302
|
+
var refDirection = new index.Vector2(0, 1);
|
|
2303
|
+
var smallAngle = index.Vector2.angleDeg(refDirection, directionVec);
|
|
2304
|
+
if (directionVec.x > 0) {
|
|
2305
|
+
return 360 - smallAngle;
|
|
2306
|
+
}
|
|
2307
|
+
return smallAngle;
|
|
2308
|
+
}
|
|
2309
|
+
}, {
|
|
2310
|
+
key: "getReferenceDPType",
|
|
2311
|
+
value: function getReferenceDPType(dpType) {
|
|
2312
|
+
switch (dpType) {
|
|
2313
|
+
case 'AVR':
|
|
2314
|
+
return 'AVL';
|
|
2315
|
+
case 'AVL':
|
|
2316
|
+
return 'AVR';
|
|
2317
|
+
case 'AVO':
|
|
2318
|
+
return 'AVU';
|
|
2319
|
+
case 'AVU':
|
|
2320
|
+
return 'AVO';
|
|
2321
|
+
case 'AVC':
|
|
2322
|
+
return 'AVC';
|
|
2323
|
+
}
|
|
2324
|
+
return '';
|
|
2325
|
+
}
|
|
2326
|
+
}, {
|
|
2327
|
+
key: "sortDockingPoints",
|
|
2328
|
+
value: function sortDockingPoints(dir, dockingPoints) {
|
|
2329
|
+
if (dir == 'LEFT_TO_RIGHT') return dockingPoints.sort(function (a, b) {
|
|
2330
|
+
return a.LocalWorldPos.x > b.LocalWorldPos.x ? 1 : -1;
|
|
2331
|
+
});else return dockingPoints.sort(function (a, b) {
|
|
2332
|
+
return a.LocalWorldPos.x < b.LocalWorldPos.x ? 1 : -1;
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* Check if the docking Points Filter match for the two elements.
|
|
2337
|
+
* @param plannerElement1
|
|
2338
|
+
* @param plannerElement2
|
|
2339
|
+
*/
|
|
2340
|
+
}, {
|
|
2341
|
+
key: "checkDPAVLFilterDoMatch",
|
|
2342
|
+
value: function checkDPAVLFilterDoMatch(plannerElement1, plannerElement2) {
|
|
2343
|
+
var avrFilter1 = plannerElement1.FilterAVR;
|
|
2344
|
+
var avlFilter2 = plannerElement2.FilterAVL;
|
|
2345
|
+
if (avlFilter2.length == 0 && avrFilter1.length == 0) return true; //Diese überprüfung bin ich mir nicht sicher, dass es so passt.
|
|
2346
|
+
|
|
2347
|
+
for (var i = 0; i < avrFilter1.length; i++) {
|
|
2348
|
+
for (var j = 0; j < avlFilter2.length; j++) {
|
|
2349
|
+
if (avrFilter1[i] == avlFilter2[j]) {
|
|
2350
|
+
return true;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
return false;
|
|
2355
|
+
}
|
|
2356
|
+
}, {
|
|
2357
|
+
key: "checkDPAVRFilterDoMatch",
|
|
2358
|
+
value: function checkDPAVRFilterDoMatch(plannerElement1, plannerElement2) {
|
|
2359
|
+
var avlFilter1 = plannerElement1.FilterAVL;
|
|
2360
|
+
var avrFilter2 = plannerElement2.FilterAVR;
|
|
2361
|
+
if (avlFilter1.length == 0 && avrFilter2.length == 0) return true; //Diese überprüfung bin ich mir nicht sicher, dass es so passt.
|
|
2362
|
+
for (var i = 0; i < avlFilter1.length; i++) {
|
|
2363
|
+
for (var j = 0; j < avrFilter2.length; j++) {
|
|
2364
|
+
if (avlFilter1[i] == avrFilter2[j]) {
|
|
2365
|
+
return true;
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
return false;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/**
|
|
2373
|
+
* This function checks if two docking Points can be docked
|
|
2374
|
+
*/
|
|
2375
|
+
}, {
|
|
2376
|
+
key: "checkDPsDoMatch",
|
|
2377
|
+
value: function checkDPsDoMatch(dp1, dp2, sourcePlannerElement, targetElement) {
|
|
2378
|
+
dp1.ElementId;
|
|
2379
|
+
var avrDockable = this.checkDPAVRFilterDoMatch(sourcePlannerElement, targetElement);
|
|
2380
|
+
var avlDockable = this.checkDPAVLFilterDoMatch(sourcePlannerElement, targetElement);
|
|
2381
|
+
var refDPType = this.getReferenceDPType(dp1.Type);
|
|
2382
|
+
if (refDPType == 'AVL' && !avlDockable) return false;
|
|
2383
|
+
if (refDPType == 'AVR' && !avrDockable) return false;
|
|
2384
|
+
if (dp2.Type != refDPType) return false;
|
|
2385
|
+
if (dp1.IsDocking || dp2.IsDocking) return false;
|
|
2386
|
+
if (!dp1.IgnoreLayer || !dp2.IgnoreLayer) {
|
|
2387
|
+
var doCheckLayer = true;
|
|
2388
|
+
if (dp1.PlannerConfig.ignoreLayerAVC && (dp1.Type == 'AVC' || dp2.Type == 'AVC')) {
|
|
2389
|
+
doCheckLayer = false;
|
|
2390
|
+
}
|
|
2391
|
+
if (dp1.PlannerConfig.ignoreLayerAVOAVU && (dp1.Type == 'AVO' || dp1.Type == 'AVU') && (dp2.Type == 'AVO' || dp2.Type == 'AVU')) {
|
|
2392
|
+
doCheckLayer = false;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
//Check layer
|
|
2396
|
+
if (doCheckLayer && dp2.Layer == dp1.Layer) return false;
|
|
2397
|
+
}
|
|
2398
|
+
if (dp1.HasNumber && dp2.HasNumber && dp1.Number != dp2.Number) return false;
|
|
2399
|
+
return true;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
/**
|
|
2403
|
+
* This function assumes that the two docking points are matching and can be docked
|
|
2404
|
+
* @param dp1
|
|
2405
|
+
* @param dp2
|
|
2406
|
+
*/
|
|
2407
|
+
}, {
|
|
2408
|
+
key: "doDock",
|
|
2409
|
+
value: function doDock(dp1, dp2, elemId1, elemId2) {
|
|
2410
|
+
dp1.doDock(dp2, elemId2);
|
|
2411
|
+
dp2.doDock(dp1, elemId1);
|
|
2412
|
+
}
|
|
2413
|
+
/*
|
|
2414
|
+
This function inits all docking points of a planner Element Data. The information of the docking Points is currently loaded from the SVG Loader
|
|
2415
|
+
catalogCodex indicates the catalogCodex of the plannerElement
|
|
2416
|
+
*/
|
|
2417
|
+
}, {
|
|
2418
|
+
key: "initDockingPointsFromSvg",
|
|
2419
|
+
value: function initDockingPointsFromSvg(plannerElement, dockingVectors, plannerconfig) {
|
|
2420
|
+
plannerElement.saveCurrentDPState();
|
|
2421
|
+
this.removeDockingPointRelations(plannerElement);
|
|
2422
|
+
plannerElement.clearAllDockingPoints();
|
|
2423
|
+
for (var i = 0; i < dockingVectors.length; i++) {
|
|
2424
|
+
var dockingVector = dockingVectors[i];
|
|
2425
|
+
var localWorldPos1 = new index.Vector2(dockingVector.x1 / DivaUtils__default["default"].UnitRecalc, dockingVector.y1 / DivaUtils__default["default"].UnitRecalc);
|
|
2426
|
+
var localWorldPos2 = new index.Vector2(dockingVector.x2 / DivaUtils__default["default"].UnitRecalc, dockingVector.y2 / DivaUtils__default["default"].UnitRecalc);
|
|
2427
|
+
var angle = this.getRotOfDP(localWorldPos1, localWorldPos2);
|
|
2428
|
+
var dockingfilter = undefined;
|
|
2429
|
+
if (dockingVector.dockingType == 'AVL') dockingfilter = plannerElement.getFilterAVL();else if (dockingVector.dockingType == 'AVR') dockingfilter = plannerElement.getFilterAVR();
|
|
2430
|
+
var dockingPoint = new index.DockingPoint(plannerElement.getElementId(), dockingVector.dockingType, dockingVector.dockingName, new index.Vector3(localWorldPos1.x, 0, localWorldPos1.y), angle, plannerElement.Layer, plannerconfig, dockingfilter);
|
|
2431
|
+
plannerElement.addDockingPoint(dockingPoint);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
/**
|
|
2436
|
+
* This function removes all docking Point relations from the Element .
|
|
2437
|
+
* It removes them as well in the docked elements.
|
|
2438
|
+
* This function is used when deleting a plannerElement
|
|
2439
|
+
* @param plannerElement
|
|
2440
|
+
*/
|
|
2441
|
+
}, {
|
|
2442
|
+
key: "removeDockingPointRelations",
|
|
2443
|
+
value: function removeDockingPointRelations(plannerElement) {
|
|
2444
|
+
var dockingPoints = plannerElement.getDockingPoints();
|
|
2445
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
2446
|
+
var dockingPoint = dockingPoints[i];
|
|
2447
|
+
if (dockingPoint.IsDocking) {
|
|
2448
|
+
var refDockingPoint = dockingPoint.OnDP;
|
|
2449
|
+
refDockingPoint.undock();
|
|
2450
|
+
dockingPoint.undock();
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* This function removes all docking Point relations with the type from the Element .
|
|
2456
|
+
* It removes them as well in the docked elements.
|
|
2457
|
+
* This function is used when deleting a plannerElement
|
|
2458
|
+
* @param plannerElement
|
|
2459
|
+
* @param dpTypeList The Type of the docking Point like AVL or AVR
|
|
2460
|
+
*/
|
|
2461
|
+
}, {
|
|
2462
|
+
key: "removeDockingPointRelationsByType",
|
|
2463
|
+
value: function removeDockingPointRelationsByType(plannerElement, dpTypeList) {
|
|
2464
|
+
var undockedFromElements = [];
|
|
2465
|
+
var dockingPoints = plannerElement.getDockingPoints();
|
|
2466
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
2467
|
+
var dockingPoint = dockingPoints[i];
|
|
2468
|
+
if (dpTypeList.indexOf(dockingPoint.Type) > -1 && dockingPoint.IsDocking) {
|
|
2469
|
+
var refDockingPoint = dockingPoint.OnDP;
|
|
2470
|
+
undockedFromElements.push(refDockingPoint.ElementId);
|
|
2471
|
+
refDockingPoint.undock();
|
|
2472
|
+
dockingPoint.undock();
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
return undockedFromElements;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* 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.
|
|
2479
|
+
*
|
|
2480
|
+
* @param sourceElement
|
|
2481
|
+
* @param targetElements
|
|
2482
|
+
* @param autoDockingDistance //gibt die distance an in der er automatisch snappen muss. Infinity _> Docke überall. 0 Docke nie
|
|
2483
|
+
* @returns saves dockable dockingpoints per type with the distance
|
|
2484
|
+
*/
|
|
2485
|
+
}, {
|
|
2486
|
+
key: "searchDockableElementsInArea",
|
|
2487
|
+
value: function searchDockableElementsInArea(sourceElement, targetElements, autoDockingDistance // Wenn 0, dann dockt es immer
|
|
2488
|
+
) {
|
|
2489
|
+
var sourceDPs = sourceElement.getAllDockingPoints();
|
|
2490
|
+
var dockableDPPairs = new Map(); //saves all dockable dockingpoints per type
|
|
2491
|
+
for (var i = 0; i < targetElements.length; i++) {
|
|
2492
|
+
var targetElement = targetElements[i];
|
|
2493
|
+
if (sourceElement.getElementId() == targetElement.getElementId()) continue;
|
|
2494
|
+
for (var di = 0; di < sourceDPs.length; di++) {
|
|
2495
|
+
var sourceDP = sourceDPs[di];
|
|
2496
|
+
var targetType = this.getReferenceDPType(sourceDP.Type);
|
|
2497
|
+
var targetDPS = targetElement.getFreeDockingPointsByType(targetType);
|
|
2498
|
+
for (var j = 0; j < targetDPS.length; j++) {
|
|
2499
|
+
var targetDP = targetDPS[j];
|
|
2500
|
+
if (this.checkDPsDoMatch(sourceDP, targetDP, sourceElement, targetElement)) {
|
|
2501
|
+
var worldPosSourceDP = sourceElement.getWorldPosOfDP(sourceDP.DpId);
|
|
2502
|
+
var worldPosTargetDP = targetElement.getWorldPosOfDP(targetDP.DpId);
|
|
2503
|
+
var distance = Math.sqrt(Math.pow(worldPosSourceDP.x - worldPosTargetDP.x, 2) + Math.pow(worldPosSourceDP.z - worldPosTargetDP.z, 2));
|
|
2504
|
+
if (autoDockingDistance != 0 && (autoDockingDistance == Infinity || distance < autoDockingDistance)) {
|
|
2505
|
+
// dockableDPs.set();
|
|
2506
|
+
//TODO Lea - ich muss mir das paar merken!!!! Hier habe ich ein potentielles Paar gefunden.
|
|
2507
|
+
//Pro dockingPoint merke dir den mit dem kleinsten Abstand
|
|
2508
|
+
if (dockableDPPairs.has(sourceDP.Type)) {
|
|
2509
|
+
if (distance < dockableDPPairs.get(sourceDP.Type).distance) {
|
|
2510
|
+
dockableDPPairs.set(sourceDP.Type, {
|
|
2511
|
+
sourceDP: sourceDP,
|
|
2512
|
+
targetDP: targetDP,
|
|
2513
|
+
distance: distance
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
} else {
|
|
2517
|
+
dockableDPPairs.set(sourceDP.Type, {
|
|
2518
|
+
sourceDP: sourceDP,
|
|
2519
|
+
targetDP: targetDP,
|
|
2520
|
+
distance: distance
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
return dockableDPPairs;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* This function tries to dock an element sourcePlannerElement to one element in the targetElements
|
|
2533
|
+
* @param sourcePlannerElement the element that must be docked
|
|
2534
|
+
* @param sourceDPType the type of the element that must be docked
|
|
2535
|
+
* @param targetElements the target Element on which the element should be docked
|
|
2536
|
+
* the function returns true when the Element is docked
|
|
2537
|
+
*/
|
|
2538
|
+
}, {
|
|
2539
|
+
key: "tryDockElement",
|
|
2540
|
+
value: function tryDockElement(sourcePlannerElement, sourceDPType, targetElements) {
|
|
2541
|
+
var dockingPoints = sourcePlannerElement.getDockingPointsByType(sourceDPType);
|
|
2542
|
+
if (!dockingPoints) {
|
|
2543
|
+
return false;
|
|
2544
|
+
}
|
|
2545
|
+
var refDPType = this.getReferenceDPType(sourceDPType);
|
|
2546
|
+
for (var i = 0; i < targetElements.length; i++) {
|
|
2547
|
+
var targetElement = targetElements[i];
|
|
2548
|
+
if (targetElement.ElementId == sourcePlannerElement.ElementId) continue;
|
|
2549
|
+
|
|
2550
|
+
//this if denies an element (with is not an accessorie) to dock to an accessorie of another element
|
|
2551
|
+
if (!sourcePlannerElement.IsAccessoire && targetElement.IsAccessoire && targetElement.getParentElementId() != sourcePlannerElement.getElementId()) continue;
|
|
2552
|
+
if (sourcePlannerElement.IsAccessoire && !targetElement.getAccessoires().includes(sourcePlannerElement.ArticleCodex)) continue;
|
|
2553
|
+
var targetDockingPoints = targetElement.getDockingPointsByType(refDPType);
|
|
2554
|
+
if (sourcePlannerElement.getIsDockedAccessoire() || sourcePlannerElement.IsAccessoire) {
|
|
2555
|
+
targetDockingPoints = this.sortDockingPoints('LEFT_TO_RIGHT', targetDockingPoints);
|
|
2556
|
+
}
|
|
2557
|
+
if (!targetDockingPoints) continue; //Das target Element hat keinen solchen dp
|
|
2558
|
+
for (var j = 0; j < targetDockingPoints.length; j++) {
|
|
2559
|
+
var targetDockingPoint = targetDockingPoints[j];
|
|
2560
|
+
for (var dpNr = 0; dpNr < dockingPoints.length; dpNr++) {
|
|
2561
|
+
var dockingPoint = dockingPoints[dpNr];
|
|
2562
|
+
if (this.checkDPsDoMatch(dockingPoint, targetDockingPoint, sourcePlannerElement, targetElement)) {
|
|
2563
|
+
//The two docking Points match
|
|
2564
|
+
this.doDock(dockingPoint, targetDockingPoint, sourcePlannerElement.ElementId, targetElement.ElementId); //Passender Docking Point wurde gefunden. Nun erfolgt das docken
|
|
2565
|
+
return dockingPoint;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
return false;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
/**
|
|
2574
|
+
* This function tries to dock an element sourcePlannerElement to the targetElement and a specific DockingPoint of the targetElement
|
|
2575
|
+
* @param sourcePlannerElement the element that must be docked
|
|
2576
|
+
* @param sourceDPType the type of the element that must be docked
|
|
2577
|
+
* @param targetElements the target Element on which the element should be docked
|
|
2578
|
+
* the function returns true when the Element is docked
|
|
2579
|
+
*/
|
|
2580
|
+
}, {
|
|
2581
|
+
key: "tryDockElementToDP",
|
|
2582
|
+
value: function tryDockElementToDP(sourcePlannerElement, targetElement, targetDP) {
|
|
2583
|
+
var sourceDPType = this.getReferenceDPType(targetDP.Type);
|
|
2584
|
+
var dockingPoints = sourcePlannerElement.getFreeDockingPointsByType(sourceDPType);
|
|
2585
|
+
if (!dockingPoints) {
|
|
2586
|
+
return false;
|
|
2587
|
+
}
|
|
2588
|
+
for (var i = 0; i < dockingPoints.length; i++) {
|
|
2589
|
+
if (this.checkDPsDoMatch(dockingPoints[i], targetDP, sourcePlannerElement, targetElement)) {
|
|
2590
|
+
//The two docking Points match
|
|
2591
|
+
this.doDock(dockingPoints[i], targetDP, sourcePlannerElement.ElementId, targetElement.ElementId); //Passender Docking Point wurde gefunden. Nun erfolgt das docken
|
|
2592
|
+
return dockingPoints[i];
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
return false;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* This function tries to dock an element sourcePlannerElement to the targetElement and a specific DockingPoint of the targetElement
|
|
2600
|
+
* @param sourcePlannerElement the element that must be docked
|
|
2601
|
+
* @param sourceDPType the type of the element that must be docked
|
|
2602
|
+
* @param sourceDP The source DP
|
|
2603
|
+
* @param targetElements the target Element on which the element should be docked
|
|
2604
|
+
* the function returns true when the Element is docked
|
|
2605
|
+
*/
|
|
2606
|
+
}, {
|
|
2607
|
+
key: "tryDockElementDPToDP",
|
|
2608
|
+
value: function tryDockElementDPToDP(sourcePlannerElement, targetElement, sourceDP, targetDP) {
|
|
2609
|
+
if (this.checkDPsDoMatch(sourceDP, targetDP, sourcePlannerElement, targetElement)) {
|
|
2610
|
+
this.doDock(sourceDP, targetDP, sourcePlannerElement.getElementId(), targetElement.getElementId());
|
|
2611
|
+
return true;
|
|
2612
|
+
}
|
|
2613
|
+
return false;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
/**
|
|
2617
|
+
* 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
|
|
2618
|
+
* two docking sofas - the old docking information is saved in the plannerElement. The new DockingPoints must be updated based on the previous docking information.
|
|
2619
|
+
* @param plannerElements
|
|
2620
|
+
* @returns returns the list of all Articles that have lost their dockingPoint relations
|
|
2621
|
+
*/
|
|
2622
|
+
}, {
|
|
2623
|
+
key: "updateDockingRelations",
|
|
2624
|
+
value: function updateDockingRelations(plannerElements) {
|
|
2625
|
+
//Sort the elements by pos nr
|
|
2626
|
+
var sortedPlannerElementsbyPosNr = [];
|
|
2627
|
+
var accElems = [];
|
|
2628
|
+
plannerElements.forEach(function (plannerElement, elementId) {
|
|
2629
|
+
if (!plannerElement.IsDockedAccessoire) {
|
|
2630
|
+
sortedPlannerElementsbyPosNr[plannerElement.PosNr - 1] = plannerElement;
|
|
2631
|
+
} else {
|
|
2632
|
+
accElems.push(plannerElement);
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
sortedPlannerElementsbyPosNr = sortedPlannerElementsbyPosNr.concat(accElems);
|
|
2636
|
+
var elementsLostDockingRelation = [];
|
|
2637
|
+
//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
|
|
2638
|
+
for (var i = 0; i < sortedPlannerElementsbyPosNr.length; i++) {
|
|
2639
|
+
if (sortedPlannerElementsbyPosNr[i]) {
|
|
2640
|
+
var element = sortedPlannerElementsbyPosNr[i];
|
|
2641
|
+
var tempDPs = element.getTempDockingPoints();
|
|
2642
|
+
for (var j = 0; j < tempDPs.length; j++) {
|
|
2643
|
+
var tempDP = tempDPs[j];
|
|
2644
|
+
if (tempDP.IsDocking && tempDP.OnElementId) {
|
|
2645
|
+
//Check if tempDP still exists.
|
|
2646
|
+
var dp = element.getDockingPointById(tempDP.DpId);
|
|
2647
|
+
if (dp == undefined) {
|
|
2648
|
+
//In this case the dockingPoint does not exist anymore
|
|
2649
|
+
var targetElement = plannerElements.get(tempDP.OnElementId);
|
|
2650
|
+
|
|
2651
|
+
//In some cases like hasena fjord it can happen - that the Dockingpoint nummer has changed.
|
|
2652
|
+
//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.
|
|
2653
|
+
//In this case -look if both elements only have 1 dockingpoint of the same Type - and then redock them.
|
|
2654
|
+
|
|
2655
|
+
var dockingPointsCurElement = element.getFreeDockingPointsByType(tempDP.Type);
|
|
2656
|
+
if (dockingPointsCurElement.length == 1) {
|
|
2657
|
+
var dockingPointsToDockElement = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getFreeDockingPointsByType(this.getReferenceDPType(tempDP.Type));
|
|
2658
|
+
if ((dockingPointsToDockElement === null || dockingPointsToDockElement === void 0 ? void 0 : dockingPointsToDockElement.length) == 1) {
|
|
2659
|
+
this.tryDockElementDPToDP(element, targetElement, dockingPointsCurElement[0], dockingPointsToDockElement[0]);
|
|
2660
|
+
continue;
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
if (targetElement) elementsLostDockingRelation.push(targetElement);
|
|
2664
|
+
continue;
|
|
2665
|
+
}
|
|
2666
|
+
//Suche den targetDP und schaue ob sie schon docken
|
|
2667
|
+
if (plannerElements.has(tempDP.OnElementId)) {
|
|
2668
|
+
var _targetElement = plannerElements.get(tempDP.OnElementId);
|
|
2669
|
+
var targetDP = _targetElement === null || _targetElement === void 0 ? void 0 : _targetElement.getDockingPointById(tempDP.OnDP.DpId);
|
|
2670
|
+
this.tryDockElementDPToDP(element, _targetElement, dp, targetDP);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
for (var i = 0; i < sortedPlannerElementsbyPosNr.length; i++) {
|
|
2677
|
+
if (sortedPlannerElementsbyPosNr[i]) sortedPlannerElementsbyPosNr[i].clearTempDockingPoints();
|
|
2678
|
+
}
|
|
2679
|
+
return elementsLostDockingRelation;
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* 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.
|
|
2683
|
+
* 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.
|
|
2684
|
+
* @param sourcePlannerElement
|
|
2685
|
+
* @param targetPlannerElement
|
|
2686
|
+
* @param sourceDPType The type of the dockingPoint
|
|
2687
|
+
*/
|
|
2688
|
+
}, {
|
|
2689
|
+
key: "initDockingPointRelationByArea",
|
|
2690
|
+
value: function initDockingPointRelationByArea(sourcePlannerElement, targetPlannerElement, sourceDPType) {
|
|
2691
|
+
// let refDPTarget = this.getReferenceDPType(sourceDPType);
|
|
2692
|
+
var freeSourceDPs = sourcePlannerElement.getFreeDockingPointsByType(sourceDPType);
|
|
2693
|
+
//let allTargetDPs = targetPlannerElement.getDockingPointsByType(refDPTarget);
|
|
2694
|
+
|
|
2695
|
+
if (freeSourceDPs.length > 0) {
|
|
2696
|
+
var allDockingPairs = this.searchDockableElementsInArea(sourcePlannerElement, [targetPlannerElement], Infinity);
|
|
2697
|
+
if (allDockingPairs.has(sourceDPType)) {
|
|
2698
|
+
var dockingPair = allDockingPairs.get(sourceDPType);
|
|
2699
|
+
if (dockingPair) {
|
|
2700
|
+
var success = this.tryDockElementDPToDP(sourcePlannerElement, targetPlannerElement, dockingPair.sourceDP, dockingPair.targetDP);
|
|
2701
|
+
if (!success) {
|
|
2702
|
+
LOG$1.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);
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* This function returns true if the two elements are docking. False if they are not
|
|
2711
|
+
* @param element1
|
|
2712
|
+
* @param element2
|
|
2713
|
+
*/
|
|
2714
|
+
}, {
|
|
2715
|
+
key: "checkElementsAreDocking",
|
|
2716
|
+
value: function checkElementsAreDocking(element1, element2) {
|
|
2717
|
+
var allDockingDockingPoints = element1.getDockingDockingPoints();
|
|
2718
|
+
for (var i = 0; i < allDockingDockingPoints.length; i++) {
|
|
2719
|
+
var dp = allDockingDockingPoints[i];
|
|
2720
|
+
if (dp.OnElementId == element2.getElementId()) return true;
|
|
2721
|
+
}
|
|
2722
|
+
return false;
|
|
2723
|
+
}
|
|
2724
|
+
}]);
|
|
2725
|
+
}();
|
|
2726
|
+
var dockingPointHandlerInst = new DockingPointHandler();
|
|
2727
|
+
|
|
1491
2728
|
var LOG = DivaUtils__default["default"].initLog('Planner', 'WEB-PLANNER-LOGIC');
|
|
1492
2729
|
//Diese Klasse dient dazu, die 2D Shapes zu verwalten. Achtung_ Hier wird es aber noch nicht angezeigt
|
|
1493
2730
|
var PlannerHandler2D = /*#__PURE__*/function () {
|
|
@@ -1608,7 +2845,7 @@ var PlannerHandler2D = /*#__PURE__*/function () {
|
|
|
1608
2845
|
var that = this;
|
|
1609
2846
|
svgXml = this.svgUtils.removeMaskFromSvg(svgXml); //Correct mask attributes
|
|
1610
2847
|
var svgXmlOLT = this.svgUtils.removeOLFFromSvg(svgXml);
|
|
1611
|
-
|
|
2848
|
+
dockingPointHandlerInst.initDockingPointsFromSvg(plannerElement, this.svgUtils.getDPsInSVG(svgXml), plannerconfig);
|
|
1612
2849
|
var oltPoints = this.svgUtils.getPointOfPoligonById(svgXml, 'OLT');
|
|
1613
2850
|
if (oltPoints === undefined) throw new Error('no olt fount in svg');
|
|
1614
2851
|
plannerElement.OLTPolygon = oltPoints;
|
|
@@ -1794,4 +3031,6 @@ var PlannerHandler2D = /*#__PURE__*/function () {
|
|
|
1794
3031
|
}();
|
|
1795
3032
|
var handler2D = new PlannerHandler2D();
|
|
1796
3033
|
|
|
3034
|
+
exports.PlannerElementData = PlannerElementData;
|
|
3035
|
+
exports.dockingPointHandlerInst = dockingPointHandlerInst;
|
|
1797
3036
|
exports.handler2D = handler2D;
|