@crystaldesign/web-planner-logic 25.13.0-beta.42 → 25.13.0-beta.43
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-69472708.js → DivaBoxPlanner-a7a2bcb9.js} +568 -504
- package/build/cjs/{DivaStandardPlanner-2acdae3b.js → DivaStandardPlanner-30ad0b92.js} +2 -2
- package/build/cjs/{DoorPlanner-947f5506.js → DoorPlanner-13625bb7.js} +1 -1
- package/build/cjs/{Host3DSignalR-bc47c003.js → Host3DSignalR-91921736.js} +1 -1
- package/build/cjs/{LiviqueWWSHandler-57f23ad5.js → LiviqueWWSHandler-fcd38ba9.js} +1 -1
- package/build/cjs/{PfisterWWSHandler-300877cd.js → PfisterWWSHandler-4707db89.js} +1 -1
- package/build/cjs/{PlannerHandler2D-c7c60612.js → PlannerHandler2D-eda6acbb.js} +1 -1
- package/build/cjs/{SeriousBasketHandler-1896f91b.js → SeriousBasketHandler-f1cd3ad9.js} +1 -1
- package/build/cjs/{ShelfPlanner-9f377509.js → ShelfPlanner-98a1e49a.js} +1 -1
- package/build/cjs/{StandardWWSHandler-a5fef3eb.js → StandardWWSHandler-28018691.js} +1 -1
- package/build/cjs/{index-1b02c00c.js → index-1c5aa2c3.js} +10 -10
- package/build/cjs/index.js +1 -1
- package/build/esm/{DivaBoxPlanner-6e6c1465.js → DivaBoxPlanner-e4a3c8dd.js} +568 -504
- package/build/esm/{DivaStandardPlanner-ca7db49c.js → DivaStandardPlanner-c2c8606b.js} +2 -2
- package/build/esm/{DoorPlanner-90ba2b13.js → DoorPlanner-e1456c31.js} +1 -1
- package/build/esm/{Host3DSignalR-d3a48e24.js → Host3DSignalR-9d0f0ffe.js} +1 -1
- package/build/esm/{LiviqueWWSHandler-5ec5254c.js → LiviqueWWSHandler-cdd66c4d.js} +1 -1
- package/build/esm/{PfisterWWSHandler-dd0d8dd0.js → PfisterWWSHandler-4f6681e6.js} +1 -1
- package/build/esm/{PlannerHandler2D-79196c59.js → PlannerHandler2D-f28b33b6.js} +1 -1
- package/build/esm/{SeriousBasketHandler-6feb3b3a.js → SeriousBasketHandler-7ca42dbb.js} +1 -1
- package/build/esm/{ShelfPlanner-aaca549e.js → ShelfPlanner-6dadb2ac.js} +1 -1
- package/build/esm/{StandardWWSHandler-57d91252.js → StandardWWSHandler-48e56aed.js} +1 -1
- package/build/esm/{index-dcce5e3a.js → index-9aa6880b.js} +10 -10
- package/build/esm/index.js +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/BoxPlannerGrid.d.ts +2 -2
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/BoxPlannerGrid.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/ConstructionRulesHandler.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/Catalog/CatalogData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/Planner/BoxPlannerData.d.ts +2 -1
- package/build/types/web-planner-logic/src/model/Planner/BoxPlannerData.d.ts.map +1 -1
- package/build/types/web-planner-logic/src/model/Planner/PlannerInteractionData.d.ts +1 -2
- package/build/types/web-planner-logic/src/model/Planner/PlannerInteractionData.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -3,10 +3,10 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
|
3
3
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
4
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
6
|
-
import { c as Vector2, V as Vector3, P as PlannerElementData, B as BoundingBox } from './index-
|
|
6
|
+
import { c as Vector2, V as Vector3, P as PlannerElementData, B as BoundingBox } from './index-9aa6880b.js';
|
|
7
7
|
import DivaUtils, { DivaError, md5 } from '@crystaldesign/diva-utils';
|
|
8
8
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
9
|
-
import { d as dockingPointHandlerInst, h as handler2D } from './PlannerHandler2D-
|
|
9
|
+
import { d as dockingPointHandlerInst, h as handler2D } from './PlannerHandler2D-f28b33b6.js';
|
|
10
10
|
import '@babel/runtime/helpers/slicedToArray';
|
|
11
11
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
12
|
import 'axios';
|
|
@@ -1822,6 +1822,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
1822
1822
|
* Elements without bottom plate are "Garderobe" or "Offenes Fach ohne Boden"
|
|
1823
1823
|
*/
|
|
1824
1824
|
_defineProperty(this, "getElementHasBottomPlate", function (curElement, optionHandler) {
|
|
1825
|
+
if (!curElement) return false;
|
|
1825
1826
|
if (_this.constructionRules.knotInfo.elementsWithGroundPlate) {
|
|
1826
1827
|
for (var i = 0; i < _this.constructionRules.knotInfo.elementsWithGroundPlate.length; i++) {
|
|
1827
1828
|
var onOPT = _this.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPT;
|
|
@@ -1838,6 +1839,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
1838
1839
|
* @param optionHandler
|
|
1839
1840
|
*/
|
|
1840
1841
|
_defineProperty(this, "getElementIsCornerElement", function (curElement, optionHandler) {
|
|
1842
|
+
if (!curElement) return false;
|
|
1841
1843
|
return _this.constructionRules.hasCORNER && _this.arrayContainsValue(_this.constructionRules.knotInfo.cornerElements.onOPVs, _this.getOptionVal(curElement.getElementId(), _this.constructionRules.knotInfo.cornerElements.onOPT, optionHandler));
|
|
1842
1844
|
});
|
|
1843
1845
|
_defineProperty(this, "getElementIsGarderobeElement", function (curElement, optionHandler) {
|
|
@@ -1857,9 +1859,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
1857
1859
|
if (boxPlannerGrid.getElementHasTopElement(curElement.getElementId())) {
|
|
1858
1860
|
var allTopElements = boxPlannerGrid.getTopElements(curElement.getElementId());
|
|
1859
1861
|
var oneTrueFound = false;
|
|
1860
|
-
|
|
1861
|
-
if (_this.getElementHasBottomPlate(allTopElements[i], optionHandler)) oneTrueFound = true;
|
|
1862
|
-
}
|
|
1862
|
+
if (_this.getElementHasBottomPlate(allTopElements[0], optionHandler)) oneTrueFound = true;
|
|
1863
1863
|
return oneTrueFound;
|
|
1864
1864
|
}
|
|
1865
1865
|
return true;
|
|
@@ -2045,7 +2045,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
}
|
|
2047
2047
|
if (cellsInGrid.endColIndex < colCount - 1) {
|
|
2048
|
-
var rightElement = boxPlannerGrid.getPlannerElementAtGridPos(cellsInGrid.endColIndex
|
|
2048
|
+
var rightElement = boxPlannerGrid.getPlannerElementAtGridPos(cellsInGrid.endColIndex, 0, false);
|
|
2049
2049
|
if (rightElement) {
|
|
2050
2050
|
var _cornerVal = this.getOptionVal(rightElement.getElementId(), 'OPTELEMENT', optionHandler);
|
|
2051
2051
|
if (_cornerVal == 'OPVECK_I') {
|
|
@@ -2060,7 +2060,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
if (this.constructionRules.avoidOptionLastCol) {
|
|
2062
2062
|
var elementType = this.getOptionVal(allElementIds[i], this.constructionRules.avoidOptionLastCol.onOPT, optionHandler);
|
|
2063
|
-
if (this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs, elementType) && cellsInGrid.endColIndex == colCount - 1) {
|
|
2063
|
+
if (this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs, elementType) && cellsInGrid.endColIndex - 1 == colCount - 1) {
|
|
2064
2064
|
this.setOptionValue(allElementIds[i], this.constructionRules.avoidOptionLastCol.onOPT, this.constructionRules.avoidOptionLastCol.defaultOpv, optionHandler);
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
@@ -2433,35 +2433,17 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2433
2433
|
var bottomElemts = boxPlannerGrid.getBottomElements(curElement.ElementId);
|
|
2434
2434
|
var topRightElemt = !fromBackside ? boxPlannerGrid.getTopRightElement(curElement.ElementId) : boxPlannerGrid.getTopLeftElement(curElement.ElementId);
|
|
2435
2435
|
if (rightElemts.length > 0) {
|
|
2436
|
-
|
|
2437
|
-
LOG$2.error(new DivaError('BoxPlannerError - only one OPTNACHBAR_RECHTS allowed', {
|
|
2438
|
-
code: 'WC_0012'
|
|
2439
|
-
}));
|
|
2440
|
-
} else {
|
|
2441
|
-
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_RECHTS', this.getOptionVal(rightElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2442
|
-
}
|
|
2436
|
+
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_RECHTS', this.getOptionVal(rightElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2443
2437
|
} else {
|
|
2444
2438
|
this.setOptionDoHide(curElement.ElementId, 'OPTNACHBAR_RECHTS', optionHandler);
|
|
2445
2439
|
}
|
|
2446
2440
|
if (leftElemts.length > 0) {
|
|
2447
|
-
|
|
2448
|
-
LOG$2.error(new DivaError('BoxPlannerError - only one OPTNACHBAR_LINKS allowed', {
|
|
2449
|
-
code: 'WC_0012'
|
|
2450
|
-
}));
|
|
2451
|
-
} else {
|
|
2452
|
-
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_LINKS', this.getOptionVal(leftElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2453
|
-
}
|
|
2441
|
+
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_LINKS', this.getOptionVal(leftElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2454
2442
|
} else {
|
|
2455
2443
|
this.setOptionDoHide(curElement.ElementId, 'OPTNACHBAR_LINKS', optionHandler);
|
|
2456
2444
|
}
|
|
2457
2445
|
if (topElemts.length > 0) {
|
|
2458
|
-
|
|
2459
|
-
LOG$2.error(new DivaError('BoxPlannerError - only one OPTNACHBAR_OBEN allowed', {
|
|
2460
|
-
code: 'WC_0012'
|
|
2461
|
-
}));
|
|
2462
|
-
} else {
|
|
2463
|
-
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_OBEN', this.getOptionVal(topElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2464
|
-
}
|
|
2446
|
+
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_OBEN', this.getOptionVal(topElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2465
2447
|
} else {
|
|
2466
2448
|
this.setOptionDoHide(curElement.ElementId, 'OPTNACHBAR_OBEN', optionHandler);
|
|
2467
2449
|
}
|
|
@@ -2472,13 +2454,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2472
2454
|
}
|
|
2473
2455
|
if (this.constructionRules.hasNeighbors && this.constructionRules.hasNeighbors.indexOf('OPTNACHBAR_UNTEN') >= 0) {
|
|
2474
2456
|
if (bottomElemts.length > 0) {
|
|
2475
|
-
|
|
2476
|
-
LOG$2.error(new DivaError('BoxPlannerError - only one OPTNACHBAR_UNTEN allowed', {
|
|
2477
|
-
code: 'WC_0012'
|
|
2478
|
-
}));
|
|
2479
|
-
} else {
|
|
2480
|
-
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_UNTEN', this.getOptionVal(bottomElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2481
|
-
}
|
|
2457
|
+
this.setOptionValue(curElement.ElementId, 'OPTNACHBAR_UNTEN', this.getOptionVal(bottomElemts[0].ElementId, 'OPTELEMENT', optionHandler), optionHandler);
|
|
2482
2458
|
} else {
|
|
2483
2459
|
this.setOptionDoHide(curElement.ElementId, 'OPTNACHBAR_UNTEN', optionHandler);
|
|
2484
2460
|
}
|
|
@@ -2532,7 +2508,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2532
2508
|
}
|
|
2533
2509
|
}
|
|
2534
2510
|
}
|
|
2535
|
-
if (this.getElementHasBottomPlate(backElement, optionHandler)) {
|
|
2511
|
+
if (backElement && this.getElementHasBottomPlate(backElement, optionHandler)) {
|
|
2536
2512
|
//Set the opposite element has rahmen unten vorne
|
|
2537
2513
|
this.setOptionDoShow(frontElement, 'OPTOPP_RAHMEN_U_V', optionHandler);
|
|
2538
2514
|
} else {
|
|
@@ -2628,26 +2604,34 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
2628
2604
|
/*
|
|
2629
2605
|
* This function corrects the elements in one row when the top element is wider then the bottom one.
|
|
2630
2606
|
* Goal is to make all the bottom ones also atleast as wide as the top one because no element can overhang - omlin setup
|
|
2631
|
-
|
|
2607
|
+
*/
|
|
2632
2608
|
}, {
|
|
2633
2609
|
key: "correctOverHangingElement",
|
|
2634
|
-
value: function correctOverHangingElement(boxPlannerGrid, optionHandler, changedOPTs) {
|
|
2610
|
+
value: function correctOverHangingElement(changedElementId, boxPlannerGrid, optionHandler, changedOPTs) {
|
|
2635
2611
|
var _this2 = this;
|
|
2636
2612
|
if (!changedOPTs) return;
|
|
2637
2613
|
var _loop = function _loop() {
|
|
2638
|
-
var elements = boxPlannerGrid.getAllElementsInColumn(columndIdx, false, false); // from bottom to top
|
|
2614
|
+
var elements = boxPlannerGrid.getAllElementsInColumn(columndIdx, false, false); // from bottom to top
|
|
2639
2615
|
var lastElement = null;
|
|
2640
|
-
elements.
|
|
2616
|
+
var changedElementIdx = elements.findIndex(function (e) {
|
|
2617
|
+
return e.ElementId == changedElementId;
|
|
2618
|
+
});
|
|
2619
|
+
elements.forEach(function (element, idx) {
|
|
2641
2620
|
var _lastElement$Width, _element$Width, _lastElement$Depth, _element$Depth;
|
|
2642
2621
|
if (!lastElement) {
|
|
2643
2622
|
lastElement = element;
|
|
2644
2623
|
return;
|
|
2645
2624
|
}
|
|
2646
2625
|
if (((_lastElement$Width = lastElement.Width) !== null && _lastElement$Width !== void 0 ? _lastElement$Width : 0) > ((_element$Width = element.Width) !== null && _element$Width !== void 0 ? _element$Width : 0)) {
|
|
2647
|
-
|
|
2626
|
+
// is either the above wider opt or the one under and smaller
|
|
2627
|
+
var t = Object.entries(changedOPTs);
|
|
2648
2628
|
var opt = t[0][0];
|
|
2649
2629
|
var opv = t[0][1];
|
|
2650
|
-
|
|
2630
|
+
if (idx < changedElementIdx) {
|
|
2631
|
+
_this2.setOptionValue(element.ElementId, opt, opv, optionHandler);
|
|
2632
|
+
} else {
|
|
2633
|
+
_this2.setOptionValue(element.ElementId, opt, opv, optionHandler);
|
|
2634
|
+
}
|
|
2651
2635
|
}
|
|
2652
2636
|
if (((_lastElement$Depth = lastElement.Depth) !== null && _lastElement$Depth !== void 0 ? _lastElement$Depth : 0) > ((_element$Depth = element.Depth) !== null && _element$Depth !== void 0 ? _element$Depth : 0)) {
|
|
2653
2637
|
var _t = Object.entries(changedOPTs); // should be the new wider width that causes the overhanging
|
|
@@ -3128,6 +3112,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
3128
3112
|
key: "updateOptionLogicBoxPlanner",
|
|
3129
3113
|
value: function () {
|
|
3130
3114
|
var _updateOptionLogicBoxPlanner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(boxPlannerGrid, changedOPTs, targetElements, forceResetCornerElements) {
|
|
3115
|
+
var _targetElements;
|
|
3131
3116
|
var startTime, resultMessage, optionHandler, allElements, i, _iterator, _step, coverPlateRule, j, doChangeRetailArticleNumbers;
|
|
3132
3117
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3133
3118
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3204,7 +3189,7 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
3204
3189
|
}
|
|
3205
3190
|
this.correctLadder(boxPlannerGrid, optionHandler);
|
|
3206
3191
|
this.correctOptionsInfluencedByDimensions(boxPlannerGrid, optionHandler);
|
|
3207
|
-
this.correctOverHangingElement(boxPlannerGrid, optionHandler, changedOPTs);
|
|
3192
|
+
this.correctOverHangingElement((_targetElements = targetElements) === null || _targetElements === void 0 ? void 0 : _targetElements[0], boxPlannerGrid, optionHandler, changedOPTs);
|
|
3208
3193
|
this.partlistHelper.calculateKnots(boxPlannerGrid, optionHandler);
|
|
3209
3194
|
this.partlistHelper.calculateRahmen(boxPlannerGrid, optionHandler);
|
|
3210
3195
|
for (i = 0; i < boxPlannerGrid.getColumnCount(); i++) {
|
|
@@ -3281,21 +3266,26 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
|
|
|
3281
3266
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3282
3267
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3283
3268
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
3269
|
+
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; }
|
|
3270
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3284
3271
|
var LOG$1 = DivaUtils.initLog('Planner', 'BOX-PLANNER_GRID');
|
|
3285
3272
|
var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
3286
3273
|
function BoxPlannerGrid(gridSetupParams, getValueOfOptionOfArticle) {
|
|
3287
3274
|
_classCallCheck(this, BoxPlannerGrid);
|
|
3288
3275
|
_defineProperty(this, "plannerElements", void 0);
|
|
3289
|
-
_defineProperty(this, "
|
|
3290
|
-
//
|
|
3291
|
-
_defineProperty(this, "backGrid", void 0);
|
|
3292
|
-
//if cell is empty it is undefined
|
|
3276
|
+
_defineProperty(this, "generalPlanningState", void 0);
|
|
3277
|
+
// [0] == frontgrid, and [1] == backgrid
|
|
3293
3278
|
_defineProperty(this, "hasActiveBackside", void 0);
|
|
3294
3279
|
_defineProperty(this, "getValueOfOptionOfArticle", void 0);
|
|
3295
3280
|
_defineProperty(this, "gridSetupParams", void 0);
|
|
3296
3281
|
this.plannerElements = new Map();
|
|
3297
|
-
|
|
3298
|
-
|
|
3282
|
+
|
|
3283
|
+
// the old logic
|
|
3284
|
+
this.generalPlanningState = {
|
|
3285
|
+
grids: [{
|
|
3286
|
+
matrix: [[]]
|
|
3287
|
+
}]
|
|
3288
|
+
};
|
|
3299
3289
|
this.gridSetupParams = gridSetupParams;
|
|
3300
3290
|
this.getValueOfOptionOfArticle = getValueOfOptionOfArticle;
|
|
3301
3291
|
this.hasActiveBackside = false;
|
|
@@ -3314,50 +3304,57 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3314
3304
|
if (this.gridSetupParams.forceSingleCellPerElement) {
|
|
3315
3305
|
var cell = {
|
|
3316
3306
|
//isEmpty: false,
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3307
|
+
plannedElement: {
|
|
3308
|
+
elementId: newElement.ElementId,
|
|
3309
|
+
basketId: newElement.getBasketId(),
|
|
3310
|
+
size: {
|
|
3311
|
+
width: this.gridSetupParams.forceFixCellRasterSize ? this.gridSetupParams.fixCellRasterWidth : newElement.getWidth(),
|
|
3312
|
+
height: this.gridSetupParams.forceFixCellRasterSize ? this.gridSetupParams.fixCellRasterHeight : newElement.getHeight(),
|
|
3313
|
+
depth: newElement.getDepth()
|
|
3314
|
+
},
|
|
3315
|
+
articleCodex: newElement.ArticleCodex,
|
|
3316
|
+
area: {
|
|
3317
|
+
fromX: startColIndex,
|
|
3318
|
+
toX: startColIndex + 1,
|
|
3319
|
+
fromY: startRowIndex,
|
|
3320
|
+
toY: startRowIndex + 1
|
|
3321
|
+
}
|
|
3322
|
+
},
|
|
3320
3323
|
index: new Vector2(startColIndex, startRowIndex)
|
|
3321
3324
|
};
|
|
3322
|
-
return
|
|
3323
|
-
cells: [cell],
|
|
3324
|
-
startColIndex: startColIndex,
|
|
3325
|
-
endColIndex: startColIndex,
|
|
3326
|
-
startRowIndex: startRowIndex,
|
|
3327
|
-
endRowIndex: startRowIndex,
|
|
3328
|
-
backside: backside,
|
|
3329
|
-
colCount: 1,
|
|
3330
|
-
rowCount: 1
|
|
3331
|
-
};
|
|
3325
|
+
return [cell];
|
|
3332
3326
|
}
|
|
3333
3327
|
if (!this.gridSetupParams.forceFixCellRasterSize) {
|
|
3334
3328
|
LOG$1.error(new DivaError('Box planner with params forceSingleCellPerElement is false and forceFixCellRasterSize is false are not allowed'));
|
|
3335
3329
|
}
|
|
3336
3330
|
var colCount = Math.round(newElement.getWidth() / this.gridSetupParams.fixCellRasterWidth);
|
|
3337
|
-
var rowCount = Math.round(newElement.getHeight() / this.gridSetupParams.
|
|
3331
|
+
var rowCount = Math.round(newElement.getHeight() / this.gridSetupParams.fixCellRasterHeight);
|
|
3338
3332
|
var cells = [];
|
|
3339
3333
|
for (var i = 0; i < colCount; i++) {
|
|
3340
3334
|
for (var j = 0; j < rowCount; j++) {
|
|
3341
3335
|
var _cell = {
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3336
|
+
plannedElement: {
|
|
3337
|
+
basketId: newElement.getBasketId(),
|
|
3338
|
+
elementId: newElement.getElementId(),
|
|
3339
|
+
articleCodex: newElement.ArticleCodex,
|
|
3340
|
+
size: {
|
|
3341
|
+
width: newElement.getWidth(),
|
|
3342
|
+
depth: newElement.getDepth(),
|
|
3343
|
+
height: newElement.getHeight()
|
|
3344
|
+
},
|
|
3345
|
+
area: {
|
|
3346
|
+
fromX: startColIndex,
|
|
3347
|
+
toX: startColIndex + newElement.getWidth() / this.gridSetupParams.fixCellRasterWidth,
|
|
3348
|
+
fromY: startRowIndex,
|
|
3349
|
+
toY: startRowIndex + newElement.getHeight() / this.gridSetupParams.fixCellRasterHeight
|
|
3350
|
+
}
|
|
3351
|
+
},
|
|
3346
3352
|
index: new Vector2(startColIndex + i, startRowIndex + j)
|
|
3347
3353
|
};
|
|
3348
3354
|
cells.push(_cell);
|
|
3349
3355
|
}
|
|
3350
3356
|
}
|
|
3351
|
-
return
|
|
3352
|
-
cells: cells,
|
|
3353
|
-
startColIndex: startColIndex,
|
|
3354
|
-
endColIndex: startColIndex + colCount - 1,
|
|
3355
|
-
startRowIndex: startRowIndex,
|
|
3356
|
-
endRowIndex: startRowIndex + rowCount - 1,
|
|
3357
|
-
backside: backside,
|
|
3358
|
-
colCount: colCount,
|
|
3359
|
-
rowCount: rowCount
|
|
3360
|
-
};
|
|
3357
|
+
return cells;
|
|
3361
3358
|
}
|
|
3362
3359
|
}, {
|
|
3363
3360
|
key: "createEmptyCells",
|
|
@@ -3403,7 +3400,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3403
3400
|
key: "getAllUsedCellsInGrid",
|
|
3404
3401
|
value: function getAllUsedCellsInGrid(backside) {
|
|
3405
3402
|
var allCellsInGrid = new Array();
|
|
3406
|
-
var curGrid = backside ? this.
|
|
3403
|
+
var curGrid = backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3407
3404
|
for (var i = 0; i < curGrid.length; i++) {
|
|
3408
3405
|
for (var j = 0; j < curGrid[i].length; j++) {
|
|
3409
3406
|
if (curGrid[i][j] != undefined) allCellsInGrid.push(curGrid[i][j]);
|
|
@@ -3418,8 +3415,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3418
3415
|
}, {
|
|
3419
3416
|
key: "getGridColumnWidth",
|
|
3420
3417
|
value: function getGridColumnWidth(columnIndex) {
|
|
3421
|
-
|
|
3422
|
-
|
|
3418
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
3419
|
+
for (var i = 0; i < frontGrid[columnIndex].length; i++) {
|
|
3420
|
+
var _plannedElement$size$, _plannedElement;
|
|
3421
|
+
if (frontGrid[columnIndex][i]) return (_plannedElement$size$ = (_plannedElement = frontGrid[columnIndex][i].plannedElement) === null || _plannedElement === void 0 ? void 0 : _plannedElement.size.width) !== null && _plannedElement$size$ !== void 0 ? _plannedElement$size$ : 0;
|
|
3423
3422
|
}
|
|
3424
3423
|
return 0;
|
|
3425
3424
|
}
|
|
@@ -3434,11 +3433,12 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3434
3433
|
value: function getGridColumnHeight(columnIdex) {
|
|
3435
3434
|
var height = 0;
|
|
3436
3435
|
var firstElementFound = false;
|
|
3437
|
-
|
|
3438
|
-
|
|
3436
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
3437
|
+
if (frontGrid.length > columnIdex) {
|
|
3438
|
+
var allCellsInCol = frontGrid[columnIdex];
|
|
3439
3439
|
for (var i = allCellsInCol.length; i >= 0; i--) {
|
|
3440
3440
|
if (!firstElementFound && allCellsInCol[i]) firstElementFound = true;
|
|
3441
|
-
if (firstElementFound) height += allCellsInCol[i] == undefined ? 0 : allCellsInCol[i].height;
|
|
3441
|
+
if (firstElementFound) height += allCellsInCol[i] == undefined ? 0 : allCellsInCol[i].plannedElement.size.height;
|
|
3442
3442
|
}
|
|
3443
3443
|
}
|
|
3444
3444
|
return height;
|
|
@@ -3451,31 +3451,16 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3451
3451
|
key: "deleteElementByIdFromGrid",
|
|
3452
3452
|
value: function deleteElementByIdFromGrid(elementIdTodelete) {
|
|
3453
3453
|
var gridCellsToDelete = this.getCellsInGridByElementId(elementIdTodelete);
|
|
3454
|
-
var curGrid = gridCellsToDelete.backside ? this.
|
|
3454
|
+
var curGrid = gridCellsToDelete.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3455
3455
|
var rowCountToDelete = 1 + (gridCellsToDelete.endRowIndex - gridCellsToDelete.startRowIndex);
|
|
3456
|
-
var doDeleteCol = false;
|
|
3457
|
-
var startColToDelete = gridCellsToDelete.startColIndex;
|
|
3458
|
-
var colCountToDelete = 1 + (gridCellsToDelete.startColIndex - gridCellsToDelete.endColIndex);
|
|
3459
3456
|
|
|
3460
3457
|
//check if we need to delete all cols
|
|
3461
|
-
if (this.getRowCount(gridCellsToDelete.startColIndex, gridCellsToDelete.backside) == rowCountToDelete)
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
var curCellFrontGrid = allUsedCellCurGrid[i];
|
|
3468
|
-
if (curCellFrontGrid.plannerElementId != elementIdTodelete) {
|
|
3469
|
-
if (doDeleteCol && curCellFrontGrid.index.x > startColToDelete) {
|
|
3470
|
-
curCellFrontGrid.index.x -= colCountToDelete;
|
|
3471
|
-
}
|
|
3472
|
-
if (!curGrid[curCellFrontGrid.index.x]) {
|
|
3473
|
-
curGrid[curCellFrontGrid.index.x] = [];
|
|
3474
|
-
}
|
|
3475
|
-
curGrid[curCellFrontGrid.index.x][curCellFrontGrid.index.y] = curCellFrontGrid;
|
|
3476
|
-
}
|
|
3477
|
-
}
|
|
3478
|
-
if (gridCellsToDelete.backside) this.backGrid = curGrid;else this.frontGrid = curGrid;
|
|
3458
|
+
if (this.getRowCount(gridCellsToDelete.startColIndex, gridCellsToDelete.backside) == rowCountToDelete) ;
|
|
3459
|
+
gridCellsToDelete.cells.reverse().forEach(function (cell) {
|
|
3460
|
+
curGrid[cell.index.x].splice(cell.index.y, 1);
|
|
3461
|
+
if (curGrid[cell.index.x].length == 0) curGrid.splice(cell.index.x, 1);
|
|
3462
|
+
});
|
|
3463
|
+
if (gridCellsToDelete.backside) this.generalPlanningState.grids[1].matrix = curGrid;else this.generalPlanningState.grids[0].matrix = curGrid;
|
|
3479
3464
|
}
|
|
3480
3465
|
|
|
3481
3466
|
/**
|
|
@@ -3488,11 +3473,14 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3488
3473
|
}, {
|
|
3489
3474
|
key: "getPlannerElementAtGridPos",
|
|
3490
3475
|
value: function getPlannerElementAtGridPos(curXPos, curYPos, fromBackmodul) {
|
|
3491
|
-
var curElementGrid = fromBackmodul ? this.
|
|
3476
|
+
var curElementGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3492
3477
|
if (curElementGrid[curXPos] && curElementGrid[curXPos][curYPos]) {
|
|
3478
|
+
var _cell$plannedElement;
|
|
3493
3479
|
var cell = curElementGrid[curXPos][curYPos];
|
|
3494
3480
|
if (cell == undefined) return undefined;
|
|
3495
|
-
|
|
3481
|
+
var elementId = (_cell$plannedElement = cell.plannedElement) === null || _cell$plannedElement === void 0 ? void 0 : _cell$plannedElement.elementId;
|
|
3482
|
+
if (!elementId) return undefined;
|
|
3483
|
+
return this.plannerElements.get(elementId);
|
|
3496
3484
|
}
|
|
3497
3485
|
return undefined;
|
|
3498
3486
|
}
|
|
@@ -3506,82 +3494,53 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3506
3494
|
}, {
|
|
3507
3495
|
key: "getCellsInGridByElementId",
|
|
3508
3496
|
value: function getCellsInGridByElementId(elementId) {
|
|
3509
|
-
var
|
|
3497
|
+
var _this$generalPlanning, _cells$0$plannedEleme, _area$fromX, _area$toX, _area$fromY, _area$toY;
|
|
3510
3498
|
var onBacksideFound = false;
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
}
|
|
3519
|
-
}
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
onBacksideFound = true;
|
|
3527
|
-
}
|
|
3499
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
3500
|
+
var backGrid = (_this$generalPlanning = this.generalPlanningState.grids[1]) === null || _this$generalPlanning === void 0 ? void 0 : _this$generalPlanning.matrix;
|
|
3501
|
+
var cells = [];
|
|
3502
|
+
frontGrid.forEach(function (x) {
|
|
3503
|
+
return x.forEach(function (y) {
|
|
3504
|
+
var _y$plannedElement;
|
|
3505
|
+
if (((_y$plannedElement = y.plannedElement) === null || _y$plannedElement === void 0 ? void 0 : _y$plannedElement.elementId) == elementId) cells.push(y);
|
|
3506
|
+
});
|
|
3507
|
+
});
|
|
3508
|
+
backGrid === null || backGrid === void 0 || backGrid.forEach(function (x) {
|
|
3509
|
+
return x.forEach(function (y) {
|
|
3510
|
+
var _y$plannedElement2;
|
|
3511
|
+
if (((_y$plannedElement2 = y.plannedElement) === null || _y$plannedElement2 === void 0 ? void 0 : _y$plannedElement2.elementId) == elementId) {
|
|
3512
|
+
cells.push(y);
|
|
3513
|
+
onBacksideFound = true;
|
|
3528
3514
|
}
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
if (
|
|
3532
|
-
cells:
|
|
3533
|
-
backside:
|
|
3534
|
-
startColIndex:
|
|
3535
|
-
endColIndex:
|
|
3536
|
-
startRowIndex:
|
|
3537
|
-
endRowIndex:
|
|
3515
|
+
});
|
|
3516
|
+
});
|
|
3517
|
+
if (cells.length == 0) return {
|
|
3518
|
+
cells: cells,
|
|
3519
|
+
backside: onBacksideFound,
|
|
3520
|
+
startColIndex: 0,
|
|
3521
|
+
endColIndex: 0,
|
|
3522
|
+
startRowIndex: 0,
|
|
3523
|
+
endRowIndex: 0,
|
|
3538
3524
|
colCount: 0,
|
|
3539
3525
|
rowCount: 0
|
|
3540
3526
|
};
|
|
3541
|
-
|
|
3542
|
-
cells: [firstCell],
|
|
3543
|
-
backside: onBacksideFound,
|
|
3544
|
-
startColIndex: firstCell.index.x,
|
|
3545
|
-
endColIndex: firstCell.index.x,
|
|
3546
|
-
startRowIndex: firstCell.index.y,
|
|
3547
|
-
endRowIndex: firstCell.index.y,
|
|
3548
|
-
colCount: 1,
|
|
3549
|
-
rowCount: 1
|
|
3550
|
-
};
|
|
3551
|
-
//Now find the other cells that have the same element
|
|
3552
|
-
|
|
3553
|
-
var curGrid = onBacksideFound ? this.backGrid : this.frontGrid;
|
|
3554
|
-
var cells = [firstCell];
|
|
3555
|
-
var startColIndex = Infinity;
|
|
3556
|
-
var endColIndex = -Infinity;
|
|
3557
|
-
var startRowIndex = Infinity;
|
|
3558
|
-
var endRowIndex = -Infinity;
|
|
3559
|
-
for (var i = firstCell.index.x; i < curGrid.length; i++) {
|
|
3560
|
-
for (var j = firstCell.index.y + 1; j < curGrid.length; j++) {
|
|
3561
|
-
var nextCell = curGrid[i][j];
|
|
3562
|
-
if (nextCell && nextCell.plannerElementId == elementId) {
|
|
3563
|
-
if (i < startColIndex) startColIndex = i;
|
|
3564
|
-
if (i > endColIndex) endColIndex = i;
|
|
3565
|
-
if (j < startRowIndex) startRowIndex = j;
|
|
3566
|
-
if (j > endColIndex) endRowIndex = j;
|
|
3567
|
-
cells.push(nextCell); //also this cell has the same element
|
|
3568
|
-
//TODO
|
|
3569
|
-
} else {
|
|
3570
|
-
break;
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3527
|
+
var area = (_cells$0$plannedEleme = cells[0].plannedElement) === null || _cells$0$plannedEleme === void 0 ? void 0 : _cells$0$plannedEleme.area;
|
|
3574
3528
|
return {
|
|
3575
3529
|
cells: cells,
|
|
3576
3530
|
backside: onBacksideFound,
|
|
3577
|
-
startColIndex:
|
|
3578
|
-
endColIndex:
|
|
3579
|
-
startRowIndex:
|
|
3580
|
-
endRowIndex:
|
|
3581
|
-
colCount:
|
|
3582
|
-
rowCount:
|
|
3531
|
+
startColIndex: (_area$fromX = area === null || area === void 0 ? void 0 : area.fromX) !== null && _area$fromX !== void 0 ? _area$fromX : 0,
|
|
3532
|
+
endColIndex: (_area$toX = area === null || area === void 0 ? void 0 : area.toX) !== null && _area$toX !== void 0 ? _area$toX : 0,
|
|
3533
|
+
startRowIndex: (_area$fromY = area === null || area === void 0 ? void 0 : area.fromY) !== null && _area$fromY !== void 0 ? _area$fromY : 0,
|
|
3534
|
+
endRowIndex: (_area$toY = area === null || area === void 0 ? void 0 : area.toY) !== null && _area$toY !== void 0 ? _area$toY : 0,
|
|
3535
|
+
colCount: area ? area.toX - area.toX : 0,
|
|
3536
|
+
rowCount: area ? area.toY - area.fromY : 0
|
|
3583
3537
|
};
|
|
3584
3538
|
}
|
|
3539
|
+
}, {
|
|
3540
|
+
key: "GridSetupParams",
|
|
3541
|
+
set: function set(gridSetupParams) {
|
|
3542
|
+
this.gridSetupParams = gridSetupParams;
|
|
3543
|
+
}
|
|
3585
3544
|
|
|
3586
3545
|
/**
|
|
3587
3546
|
* This function returns all elementIds that are inside the grid
|
|
@@ -3598,11 +3557,12 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3598
3557
|
var allElements = [];
|
|
3599
3558
|
for (var i = 0; i < grid.length; i++) {
|
|
3600
3559
|
for (var j = 0; j < grid[i].length; j++) {
|
|
3560
|
+
var _cell$plannedElement2;
|
|
3601
3561
|
var cell = grid[i][j];
|
|
3602
3562
|
if (cell == undefined) continue;
|
|
3603
|
-
if (allElementIds.indexOf(cell.
|
|
3604
|
-
allElementIds.push(cell.
|
|
3605
|
-
allElements.push(this.plannerElements.get(cell.
|
|
3563
|
+
if ((_cell$plannedElement2 = cell.plannedElement) !== null && _cell$plannedElement2 !== void 0 && _cell$plannedElement2.elementId && allElementIds.indexOf(cell.plannedElement.elementId) == -1) {
|
|
3564
|
+
allElementIds.push(cell.plannedElement.elementId);
|
|
3565
|
+
allElements.push(this.plannerElements.get(cell.plannedElement.elementId));
|
|
3606
3566
|
}
|
|
3607
3567
|
}
|
|
3608
3568
|
}
|
|
@@ -3611,17 +3571,17 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3611
3571
|
}, {
|
|
3612
3572
|
key: "getAllElementsInFrontGrid",
|
|
3613
3573
|
value: function getAllElementsInFrontGrid() {
|
|
3614
|
-
return this._getAllElementsInGrid(this.
|
|
3574
|
+
return this._getAllElementsInGrid(this.generalPlanningState.grids[0].matrix);
|
|
3615
3575
|
}
|
|
3616
3576
|
}, {
|
|
3617
3577
|
key: "getAllElementsInBackGrid",
|
|
3618
3578
|
value: function getAllElementsInBackGrid() {
|
|
3619
|
-
return this._getAllElementsInGrid(this.
|
|
3579
|
+
return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix);
|
|
3620
3580
|
}
|
|
3621
3581
|
}, {
|
|
3622
3582
|
key: "getAllElementsInBacksideModuleGrid",
|
|
3623
3583
|
value: function getAllElementsInBacksideModuleGrid() {
|
|
3624
|
-
return this._getAllElementsInGrid(this.
|
|
3584
|
+
return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix).map(function (element) {
|
|
3625
3585
|
return element.ElementId;
|
|
3626
3586
|
});
|
|
3627
3587
|
}
|
|
@@ -3636,24 +3596,31 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3636
3596
|
}, {
|
|
3637
3597
|
key: "getAllElementsInGridSortedbyGridPos",
|
|
3638
3598
|
value: function getAllElementsInGridSortedbyGridPos() {
|
|
3599
|
+
var _this$generalPlanning2, _this$generalPlanning3;
|
|
3639
3600
|
var returnElements = [];
|
|
3640
3601
|
var allCheckedElementIds = [];
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3602
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
3603
|
+
var backGrid = (_this$generalPlanning2 = (_this$generalPlanning3 = this.generalPlanningState.grids[1]) === null || _this$generalPlanning3 === void 0 ? void 0 : _this$generalPlanning3.matrix) !== null && _this$generalPlanning2 !== void 0 ? _this$generalPlanning2 : 0;
|
|
3604
|
+
for (var i = 0; i < frontGrid.length; i++) {
|
|
3605
|
+
for (var j = 0; j < frontGrid[i].length; j++) {
|
|
3606
|
+
var _cell$plannedElement3;
|
|
3607
|
+
var cell = frontGrid[i][j];
|
|
3608
|
+
var elementId = (_cell$plannedElement3 = cell.plannedElement) === null || _cell$plannedElement3 === void 0 ? void 0 : _cell$plannedElement3.elementId;
|
|
3609
|
+
if (cell && elementId && allCheckedElementIds.indexOf(elementId) == -1) {
|
|
3610
|
+
var element = this.getElementById(elementId);
|
|
3611
|
+
allCheckedElementIds.push(elementId);
|
|
3647
3612
|
returnElements.push(element);
|
|
3648
3613
|
}
|
|
3649
3614
|
}
|
|
3650
3615
|
}
|
|
3651
|
-
for (var i = 0; i <
|
|
3652
|
-
for (var j = 0; j <
|
|
3653
|
-
var
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3616
|
+
for (var i = 0; i < backGrid.length; i++) {
|
|
3617
|
+
for (var j = 0; j < backGrid[i].length; j++) {
|
|
3618
|
+
var _cell2$plannedElement;
|
|
3619
|
+
var _cell2 = backGrid[i][j];
|
|
3620
|
+
var _elementId = (_cell2$plannedElement = _cell2.plannedElement) === null || _cell2$plannedElement === void 0 ? void 0 : _cell2$plannedElement.elementId;
|
|
3621
|
+
if (_cell2 && _elementId && allCheckedElementIds.indexOf(_elementId) == -1) {
|
|
3622
|
+
var _element = this.getElementById(_elementId);
|
|
3623
|
+
allCheckedElementIds.push(_elementId);
|
|
3657
3624
|
returnElements.push(_element);
|
|
3658
3625
|
}
|
|
3659
3626
|
}
|
|
@@ -3685,9 +3652,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3685
3652
|
}, {
|
|
3686
3653
|
key: "getElementIsInLastCol",
|
|
3687
3654
|
value: function getElementIsInLastCol(elementId, fromBackmodul) {
|
|
3688
|
-
var curElementGrid = fromBackmodul ? this.
|
|
3655
|
+
var curElementGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3689
3656
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3690
|
-
return result.endColIndex
|
|
3657
|
+
return result.endColIndex == curElementGrid.length;
|
|
3691
3658
|
}
|
|
3692
3659
|
|
|
3693
3660
|
/**
|
|
@@ -3698,10 +3665,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3698
3665
|
key: "getElementHasTopElement",
|
|
3699
3666
|
value: function getElementHasTopElement(elementId) {
|
|
3700
3667
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3701
|
-
var curGrid = result.backside ? this.
|
|
3702
|
-
for (var i = result.startColIndex; i
|
|
3668
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3669
|
+
for (var i = result.startColIndex; i < result.endColIndex; i++) {
|
|
3703
3670
|
//Check if in one of the top cells is another element
|
|
3704
|
-
if (curGrid[i].length > result.endRowIndex
|
|
3671
|
+
if (curGrid[i].length > result.endRowIndex && curGrid[i][result.endRowIndex]) {
|
|
3705
3672
|
return true;
|
|
3706
3673
|
}
|
|
3707
3674
|
}
|
|
@@ -3715,19 +3682,18 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3715
3682
|
}, {
|
|
3716
3683
|
key: "getTopElements",
|
|
3717
3684
|
value: function getTopElements(elementId) {
|
|
3685
|
+
var _curGrid$plannedEleme;
|
|
3718
3686
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3719
|
-
var curGrid = result.backside ? this.
|
|
3687
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3720
3688
|
var neighborPlannerElements = [];
|
|
3721
|
-
var
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
}
|
|
3730
|
-
}
|
|
3689
|
+
var plannedElement = result.cells[0].plannedElement;
|
|
3690
|
+
if (!plannedElement) return neighborPlannerElements;
|
|
3691
|
+
var topElement = (_curGrid$plannedEleme = curGrid[plannedElement.area.fromX]) === null || _curGrid$plannedEleme === void 0 ? void 0 : _curGrid$plannedEleme[plannedElement.area.toY];
|
|
3692
|
+
while (topElement) {
|
|
3693
|
+
var element = topElement.plannedElement;
|
|
3694
|
+
if (!element) break;
|
|
3695
|
+
neighborPlannerElements.push(this.plannerElements.get(element.elementId));
|
|
3696
|
+
topElement = curGrid[element.area.fromX][element.area.toY];
|
|
3731
3697
|
}
|
|
3732
3698
|
return neighborPlannerElements;
|
|
3733
3699
|
}
|
|
@@ -3740,10 +3706,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3740
3706
|
key: "getTopRightElement",
|
|
3741
3707
|
value: function getTopRightElement(elementId) {
|
|
3742
3708
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3743
|
-
var curGrid = result.backside ? this.
|
|
3744
|
-
if (curGrid.length > result.endColIndex
|
|
3745
|
-
var cell = curGrid[result.endColIndex
|
|
3746
|
-
return this.plannerElements.get(cell.
|
|
3709
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3710
|
+
if (curGrid.length > result.endColIndex && curGrid[result.endColIndex].length > result.endRowIndex && curGrid[result.endColIndex][result.endRowIndex]) {
|
|
3711
|
+
var cell = curGrid[result.endColIndex][result.endRowIndex];
|
|
3712
|
+
return this.plannerElements.get(cell.plannedElement.elementId);
|
|
3747
3713
|
}
|
|
3748
3714
|
return undefined;
|
|
3749
3715
|
}
|
|
@@ -3756,10 +3722,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3756
3722
|
key: "getTopLeftElement",
|
|
3757
3723
|
value: function getTopLeftElement(elementId) {
|
|
3758
3724
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3759
|
-
var curGrid = result.backside ? this.
|
|
3760
|
-
if (result.startColIndex > 0 && curGrid[result.startColIndex - 1].length > 0 && curGrid[result.startColIndex - 1][result.endRowIndex
|
|
3761
|
-
var cell = curGrid[result.startColIndex - 1][result.endRowIndex
|
|
3762
|
-
return this.plannerElements.get(cell.
|
|
3725
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3726
|
+
if (result.startColIndex > 0 && curGrid[result.startColIndex - 1].length > 0 && curGrid[result.startColIndex - 1][result.endRowIndex]) {
|
|
3727
|
+
var cell = curGrid[result.startColIndex - 1][result.endRowIndex];
|
|
3728
|
+
return this.plannerElements.get(cell.plannedElement.elementId);
|
|
3763
3729
|
}
|
|
3764
3730
|
return undefined;
|
|
3765
3731
|
}
|
|
@@ -3787,22 +3753,21 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3787
3753
|
}, {
|
|
3788
3754
|
key: "getBottomElements",
|
|
3789
3755
|
value: function getBottomElements(elementId) {
|
|
3756
|
+
var _curGrid$plannedEleme2;
|
|
3790
3757
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3791
|
-
var curGrid = result.backside ? this.
|
|
3792
|
-
var
|
|
3793
|
-
var
|
|
3794
|
-
if (
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3758
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3759
|
+
var neighborPlannerElements = [];
|
|
3760
|
+
var plannedElement = result.cells[0].plannedElement;
|
|
3761
|
+
if (!plannedElement) return neighborPlannerElements;
|
|
3762
|
+
var topElement = (_curGrid$plannedEleme2 = curGrid[plannedElement.area.fromX]) === null || _curGrid$plannedEleme2 === void 0 ? void 0 : _curGrid$plannedEleme2[plannedElement.area.fromY - 1];
|
|
3763
|
+
while (topElement) {
|
|
3764
|
+
var _curGrid$element$area;
|
|
3765
|
+
var element = topElement.plannedElement;
|
|
3766
|
+
if (!element) break;
|
|
3767
|
+
neighborPlannerElements.push(this.plannerElements.get(element.elementId));
|
|
3768
|
+
topElement = (_curGrid$element$area = curGrid[element.area.fromX]) === null || _curGrid$element$area === void 0 ? void 0 : _curGrid$element$area[element.area.fromY - 1];
|
|
3804
3769
|
}
|
|
3805
|
-
return
|
|
3770
|
+
return neighborPlannerElements;
|
|
3806
3771
|
}
|
|
3807
3772
|
|
|
3808
3773
|
/**
|
|
@@ -3813,9 +3778,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3813
3778
|
key: "getElementHasRightElement",
|
|
3814
3779
|
value: function getElementHasRightElement(elementId) {
|
|
3815
3780
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3816
|
-
var curGrid = result.backside ? this.
|
|
3817
|
-
if (curGrid.length > result.endColIndex
|
|
3818
|
-
var cell = curGrid[result.endColIndex
|
|
3781
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3782
|
+
if (curGrid.length > result.endColIndex && curGrid[result.endColIndex].length > result.startRowIndex) {
|
|
3783
|
+
var cell = curGrid[result.endColIndex][result.startRowIndex];
|
|
3819
3784
|
if (cell) return true;
|
|
3820
3785
|
}
|
|
3821
3786
|
return false;
|
|
@@ -3832,18 +3797,18 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3832
3797
|
key: "getRightElements",
|
|
3833
3798
|
value: function getRightElements(elementId) {
|
|
3834
3799
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3835
|
-
var curGrid = result.backside ? this.
|
|
3800
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3836
3801
|
var rightElements = [];
|
|
3837
3802
|
var rightElementIds = [];
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3803
|
+
var element = result.cells[0].plannedElement;
|
|
3804
|
+
if (!element) return rightElements;
|
|
3805
|
+
for (var y = element.area.fromY; y < element.area.toY; y++) {
|
|
3806
|
+
var _curGrid$element$area2, _cell$plannedElement4;
|
|
3807
|
+
var cell = (_curGrid$element$area2 = curGrid[element.area.toX]) === null || _curGrid$element$area2 === void 0 ? void 0 : _curGrid$element$area2[y];
|
|
3808
|
+
var _elementId2 = cell === null || cell === void 0 || (_cell$plannedElement4 = cell.plannedElement) === null || _cell$plannedElement4 === void 0 ? void 0 : _cell$plannedElement4.elementId;
|
|
3809
|
+
if (cell && _elementId2 && rightElementIds.indexOf(_elementId2) == -1) {
|
|
3810
|
+
rightElementIds.push(_elementId2);
|
|
3811
|
+
rightElements.push(this.plannerElements.get(_elementId2));
|
|
3847
3812
|
}
|
|
3848
3813
|
}
|
|
3849
3814
|
return rightElements;
|
|
@@ -3857,7 +3822,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3857
3822
|
key: "getElementHasLeftElement",
|
|
3858
3823
|
value: function getElementHasLeftElement(elementId) {
|
|
3859
3824
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3860
|
-
var curGrid = result.backside ? this.
|
|
3825
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3861
3826
|
if (result.startColIndex > 0 && curGrid[result.startColIndex - 1][result.startRowIndex]) {
|
|
3862
3827
|
return true;
|
|
3863
3828
|
}
|
|
@@ -3875,21 +3840,21 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3875
3840
|
key: "getLeftElements",
|
|
3876
3841
|
value: function getLeftElements(elementId) {
|
|
3877
3842
|
var result = this.getCellsInGridByElementId(elementId);
|
|
3878
|
-
var curGrid = result.backside ? this.
|
|
3879
|
-
var
|
|
3880
|
-
var
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3843
|
+
var curGrid = result.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3844
|
+
var rightElements = [];
|
|
3845
|
+
var rightElementIds = [];
|
|
3846
|
+
var element = result.cells[0].plannedElement;
|
|
3847
|
+
if (!element) return rightElements;
|
|
3848
|
+
for (var y = element.area.fromY; y < element.area.toY; y++) {
|
|
3849
|
+
var _curGrid, _cell$plannedElement5;
|
|
3850
|
+
var cell = (_curGrid = curGrid[element.area.fromX - 1]) === null || _curGrid === void 0 ? void 0 : _curGrid[y];
|
|
3851
|
+
var _elementId3 = cell === null || cell === void 0 || (_cell$plannedElement5 = cell.plannedElement) === null || _cell$plannedElement5 === void 0 ? void 0 : _cell$plannedElement5.elementId;
|
|
3852
|
+
if (cell && _elementId3 && rightElementIds.indexOf(_elementId3) == -1) {
|
|
3853
|
+
rightElementIds.push(_elementId3);
|
|
3854
|
+
rightElements.push(this.plannerElements.get(_elementId3));
|
|
3890
3855
|
}
|
|
3891
3856
|
}
|
|
3892
|
-
return
|
|
3857
|
+
return rightElements;
|
|
3893
3858
|
}
|
|
3894
3859
|
|
|
3895
3860
|
/*
|
|
@@ -3901,24 +3866,28 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3901
3866
|
key: "getAllElementsInColumn",
|
|
3902
3867
|
value: function getAllElementsInColumn(index, fromBackmodul) {
|
|
3903
3868
|
var orderBottomDown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
3904
|
-
var curGrid = fromBackmodul ? this.
|
|
3869
|
+
var curGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3905
3870
|
var allElements = [];
|
|
3906
3871
|
var allElementIds = [];
|
|
3907
3872
|
if (!curGrid[index]) return allElements;
|
|
3908
3873
|
if (orderBottomDown) {
|
|
3909
3874
|
for (var i = 0; i < curGrid[index].length; i++) {
|
|
3875
|
+
var _cell$plannedElement6;
|
|
3910
3876
|
var cell = curGrid[index][i];
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3877
|
+
var elementId = cell === null || cell === void 0 || (_cell$plannedElement6 = cell.plannedElement) === null || _cell$plannedElement6 === void 0 ? void 0 : _cell$plannedElement6.elementId;
|
|
3878
|
+
if (elementId && cell && allElementIds.indexOf(elementId) == -1) {
|
|
3879
|
+
allElementIds.push(elementId);
|
|
3880
|
+
allElements.push(this.plannerElements.get(elementId));
|
|
3914
3881
|
}
|
|
3915
3882
|
}
|
|
3916
3883
|
} else {
|
|
3917
3884
|
for (var i = curGrid[index].length - 1; i >= 0; i--) {
|
|
3918
|
-
var
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3885
|
+
var _cell3$plannedElement;
|
|
3886
|
+
var _cell3 = curGrid[index][i];
|
|
3887
|
+
var _elementId4 = _cell3 === null || _cell3 === void 0 || (_cell3$plannedElement = _cell3.plannedElement) === null || _cell3$plannedElement === void 0 ? void 0 : _cell3$plannedElement.elementId;
|
|
3888
|
+
if (_cell3 && _elementId4 && allElementIds.indexOf(_elementId4) == -1) {
|
|
3889
|
+
allElementIds.push(_elementId4);
|
|
3890
|
+
allElements.push(this.plannerElements.get(_elementId4));
|
|
3922
3891
|
}
|
|
3923
3892
|
}
|
|
3924
3893
|
}
|
|
@@ -3931,7 +3900,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3931
3900
|
}, {
|
|
3932
3901
|
key: "getColumnCount",
|
|
3933
3902
|
value: function getColumnCount() {
|
|
3934
|
-
return this.
|
|
3903
|
+
return this.generalPlanningState.grids[0].matrix.length;
|
|
3935
3904
|
}
|
|
3936
3905
|
|
|
3937
3906
|
/**
|
|
@@ -3941,7 +3910,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3941
3910
|
}, {
|
|
3942
3911
|
key: "getRowCount",
|
|
3943
3912
|
value: function getRowCount(colIndex, fromBackmodul) {
|
|
3944
|
-
return fromBackmodul ? this.
|
|
3913
|
+
return fromBackmodul ? this.generalPlanningState.grids[1].matrix[colIndex].length : this.generalPlanningState.grids[0].matrix[colIndex].length;
|
|
3945
3914
|
}
|
|
3946
3915
|
|
|
3947
3916
|
/*
|
|
@@ -3952,15 +3921,17 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3952
3921
|
}, {
|
|
3953
3922
|
key: "getAllElementsInRow",
|
|
3954
3923
|
value: function getAllElementsInRow(index, fromBackmodul) {
|
|
3955
|
-
var curGrid = fromBackmodul ? this.
|
|
3924
|
+
var curGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3956
3925
|
var allElements = [];
|
|
3957
3926
|
var allElementIds = [];
|
|
3958
3927
|
for (var i = 0; i < curGrid.length; i++) {
|
|
3959
3928
|
if (curGrid[i].length > index) {
|
|
3929
|
+
var _cell$plannedElement7;
|
|
3960
3930
|
var cell = curGrid[i][index];
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3931
|
+
var elementId = cell === null || cell === void 0 || (_cell$plannedElement7 = cell.plannedElement) === null || _cell$plannedElement7 === void 0 ? void 0 : _cell$plannedElement7.elementId;
|
|
3932
|
+
if (cell && elementId && allElementIds.indexOf(elementId) == -1) {
|
|
3933
|
+
allElementIds.push(elementId);
|
|
3934
|
+
allElements.push(this.plannerElements.get(elementId));
|
|
3964
3935
|
}
|
|
3965
3936
|
}
|
|
3966
3937
|
}
|
|
@@ -3974,7 +3945,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
3974
3945
|
}, {
|
|
3975
3946
|
key: "getSizeOfHighesRow",
|
|
3976
3947
|
value: function getSizeOfHighesRow(fromBackmodul) {
|
|
3977
|
-
var curGrid = fromBackmodul ? this.
|
|
3948
|
+
var curGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
3978
3949
|
var highestRow = 0;
|
|
3979
3950
|
for (var i = 0; i < curGrid.length; i++) {
|
|
3980
3951
|
for (var j = curGrid[i].length; j >= 0; j--) {
|
|
@@ -4003,69 +3974,38 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4003
3974
|
}, {
|
|
4004
3975
|
key: "getNeighborElements",
|
|
4005
3976
|
value: function getNeighborElements(elementId, dir) {
|
|
4006
|
-
var
|
|
4007
|
-
var
|
|
3977
|
+
var _curGrid$area$toX, _rightNeighbour$plann, _curGrid2, _leftNeightbour$plann, _curGrid$area$fromX, _topNeighbour$planned, _curGrid$area$fromX2, _downNeighbour$planne;
|
|
3978
|
+
var res = this.getCellsInGridByElementId(elementId);
|
|
3979
|
+
var curGrid = res.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4008
3980
|
var result = [];
|
|
4009
|
-
var
|
|
3981
|
+
var plannedElement = res.cells[0].plannedElement;
|
|
3982
|
+
if (!plannedElement) return result;
|
|
4010
3983
|
switch (dir) {
|
|
4011
|
-
case '
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
if (curGrid[neighborX].length > neighborY) {
|
|
4016
|
-
var neighborCell = curGrid[neighborX][neighborY];
|
|
4017
|
-
if (neighborCell && resultPlannerIds.indexOf(neighborCell.plannerElementId) == -1) {
|
|
4018
|
-
resultPlannerIds.push(neighborCell.plannerElementId);
|
|
4019
|
-
result.push(this.plannerElements.get(neighborCell.plannerElementId));
|
|
4020
|
-
}
|
|
4021
|
-
}
|
|
4022
|
-
}
|
|
4023
|
-
break;
|
|
4024
|
-
case 'DOWN':
|
|
4025
|
-
for (var i = cellPos.startColIndex; i <= cellPos.endColIndex; i++) {
|
|
4026
|
-
var _neighborX = i;
|
|
4027
|
-
var _neighborY = cellPos.startRowIndex - 1;
|
|
4028
|
-
if (_neighborY >= 0) {
|
|
4029
|
-
var _neighborCell = curGrid[_neighborX][_neighborY];
|
|
4030
|
-
if (_neighborCell && resultPlannerIds.indexOf(_neighborCell.plannerElementId) == -1) {
|
|
4031
|
-
resultPlannerIds.push(_neighborCell.plannerElementId);
|
|
4032
|
-
result.push(this.plannerElements.get(_neighborCell.plannerElementId));
|
|
4033
|
-
}
|
|
4034
|
-
}
|
|
4035
|
-
}
|
|
3984
|
+
case 'RIGHT':
|
|
3985
|
+
var rightNeighbour = (_curGrid$area$toX = curGrid[plannedElement.area.toX]) === null || _curGrid$area$toX === void 0 ? void 0 : _curGrid$area$toX[plannedElement.area.fromY];
|
|
3986
|
+
var rElementId = rightNeighbour === null || rightNeighbour === void 0 || (_rightNeighbour$plann = rightNeighbour.plannedElement) === null || _rightNeighbour$plann === void 0 ? void 0 : _rightNeighbour$plann.elementId;
|
|
3987
|
+
if (rElementId) result.push(this.plannerElements.get(rElementId));
|
|
4036
3988
|
break;
|
|
4037
3989
|
case 'LEFT':
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
if (_neighborX2 >= 0) {
|
|
4042
|
-
var _neighborCell2 = curGrid[_neighborX2][_neighborY2];
|
|
4043
|
-
if (_neighborCell2 && resultPlannerIds.indexOf(_neighborCell2.plannerElementId) == -1) {
|
|
4044
|
-
resultPlannerIds.push(_neighborCell2.plannerElementId);
|
|
4045
|
-
result.push(this.plannerElements.get(_neighborCell2.plannerElementId));
|
|
4046
|
-
}
|
|
4047
|
-
}
|
|
4048
|
-
}
|
|
3990
|
+
var leftNeightbour = (_curGrid2 = curGrid[plannedElement.area.fromX - 1]) === null || _curGrid2 === void 0 ? void 0 : _curGrid2[plannedElement.area.fromY];
|
|
3991
|
+
var lElementId = leftNeightbour === null || leftNeightbour === void 0 || (_leftNeightbour$plann = leftNeightbour.plannedElement) === null || _leftNeightbour$plann === void 0 ? void 0 : _leftNeightbour$plann.elementId;
|
|
3992
|
+
if (lElementId) result.push(this.plannerElements.get(lElementId));
|
|
4049
3993
|
break;
|
|
4050
|
-
case '
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
}
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
3994
|
+
case 'TOP':
|
|
3995
|
+
var topNeighbour = (_curGrid$area$fromX = curGrid[plannedElement.area.fromX]) === null || _curGrid$area$fromX === void 0 ? void 0 : _curGrid$area$fromX[plannedElement.area.toY];
|
|
3996
|
+
var tElementId = topNeighbour === null || topNeighbour === void 0 || (_topNeighbour$planned = topNeighbour.plannedElement) === null || _topNeighbour$planned === void 0 ? void 0 : _topNeighbour$planned.elementId;
|
|
3997
|
+
if (tElementId) result.push(this.plannerElements.get(tElementId));
|
|
3998
|
+
break;
|
|
3999
|
+
case 'DOWN':
|
|
4000
|
+
var downNeighbour = (_curGrid$area$fromX2 = curGrid[plannedElement.area.fromX]) === null || _curGrid$area$fromX2 === void 0 ? void 0 : _curGrid$area$fromX2[plannedElement.area.fromY - 1];
|
|
4001
|
+
var dElementId = downNeighbour === null || downNeighbour === void 0 || (_downNeighbour$planne = downNeighbour.plannedElement) === null || _downNeighbour$planne === void 0 ? void 0 : _downNeighbour$planne.elementId;
|
|
4002
|
+
if (dElementId) result.push(this.plannerElements.get(dElementId));
|
|
4062
4003
|
break;
|
|
4063
4004
|
case 'BACK':
|
|
4064
4005
|
if (this.hasActiveBackside) {
|
|
4065
|
-
var plannerElement = this.getPlannerElementAtGridPos(
|
|
4006
|
+
var plannerElement = this.getPlannerElementAtGridPos(res.startColIndex, res.startRowIndex, true);
|
|
4066
4007
|
if (plannerElement != undefined) result = [plannerElement];
|
|
4067
4008
|
}
|
|
4068
|
-
break;
|
|
4069
4009
|
}
|
|
4070
4010
|
return result;
|
|
4071
4011
|
}
|
|
@@ -4121,13 +4061,16 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4121
4061
|
var depth = 0;
|
|
4122
4062
|
var height = 0;
|
|
4123
4063
|
var checkedElementIds = [];
|
|
4124
|
-
|
|
4064
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
4065
|
+
for (var i = 0; i < frontGrid.length; i++) {
|
|
4125
4066
|
var curHeight = 0;
|
|
4126
|
-
for (var j = 0; j <
|
|
4127
|
-
var
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4067
|
+
for (var j = 0; j < frontGrid[i].length; j++) {
|
|
4068
|
+
var _cell4;
|
|
4069
|
+
var cell = frontGrid[i][j];
|
|
4070
|
+
var elementId = (_cell4 = cell) === null || _cell4 === void 0 || (_cell4 = _cell4.plannedElement) === null || _cell4 === void 0 ? void 0 : _cell4.elementId;
|
|
4071
|
+
if (elementId && cell && checkedElementIds.indexOf(elementId) == -1) {
|
|
4072
|
+
curHeight += this.plannerElements.get(elementId).getHeight();
|
|
4073
|
+
if (i == 0 && j == 0) depth = this.plannerElements.get(elementId).getDepth();
|
|
4131
4074
|
}
|
|
4132
4075
|
}
|
|
4133
4076
|
if (curHeight > height) height = curHeight;
|
|
@@ -4154,7 +4097,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4154
4097
|
var result = [];
|
|
4155
4098
|
var lastHeight = -1;
|
|
4156
4099
|
for (var idx = 0; idx < this.getColumnCount(); idx++) {
|
|
4157
|
-
var row = this.
|
|
4100
|
+
var row = this.generalPlanningState.grids[0].matrix[idx];
|
|
4158
4101
|
var height = row.reduce(function (added, column) {
|
|
4159
4102
|
return column.height + added;
|
|
4160
4103
|
}, 0);
|
|
@@ -4199,38 +4142,51 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4199
4142
|
/**
|
|
4200
4143
|
* Get all the Elements need to fill up for the copy of Element x fxe:
|
|
4201
4144
|
*
|
|
4202
|
-
* [4] ->
|
|
4203
|
-
* [3]
|
|
4204
|
-
* [2]
|
|
4145
|
+
* [4] ->
|
|
4146
|
+
* [3]
|
|
4147
|
+
* [2]
|
|
4205
4148
|
* [0][1]
|
|
4206
4149
|
*
|
|
4207
|
-
* returns element 4, 3 and 2 because those are needed to copy in order
|
|
4150
|
+
* returns element 4, 3 and 2 because those are needed to copy in order
|
|
4208
4151
|
* for the copy of element 4 to not float
|
|
4209
4152
|
*/
|
|
4210
4153
|
}, {
|
|
4211
4154
|
key: "getAllElementsToFillUp",
|
|
4212
4155
|
value: function getAllElementsToFillUp(elementId, dir) {
|
|
4156
|
+
var _this = this;
|
|
4213
4157
|
var curPos = this.getCellsInGridByElementId(elementId);
|
|
4214
|
-
|
|
4215
|
-
elements: [],
|
|
4216
|
-
backside: false
|
|
4217
|
-
};
|
|
4218
|
-
var d = dir == 'RIGHT' ? +1 : -1;
|
|
4158
|
+
|
|
4219
4159
|
//columns and rows are swapped don't ask me why
|
|
4160
|
+
var element = curPos.cells[0].plannedElement;
|
|
4220
4161
|
var index = {
|
|
4221
4162
|
x: curPos.startColIndex,
|
|
4222
4163
|
y: curPos.startRowIndex
|
|
4223
4164
|
};
|
|
4224
|
-
var curGrid = curPos.backside ? this.
|
|
4165
|
+
var curGrid = curPos.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4225
4166
|
var plannerIdsToFill = [];
|
|
4226
4167
|
var existingPlannerIds = [];
|
|
4227
|
-
|
|
4228
|
-
var _curGrid$index$x$
|
|
4229
|
-
var elementToCopy = (_curGrid$index$x$
|
|
4230
|
-
|
|
4231
|
-
|
|
4168
|
+
var _loop = function _loop(_y) {
|
|
4169
|
+
var _curGrid$index$x$_y;
|
|
4170
|
+
var elementToCopy = (_curGrid$index$x$_y = curGrid[index.x][_y]) === null || _curGrid$index$x$_y === void 0 ? void 0 : _curGrid$index$x$_y.plannedElement;
|
|
4171
|
+
if (!elementToCopy) {
|
|
4172
|
+
y = _y;
|
|
4173
|
+
return 1;
|
|
4174
|
+
} // break
|
|
4175
|
+
var length = element.area.toX - element.area.fromX;
|
|
4176
|
+
var d = dir == 'RIGHT' ? +length : -length;
|
|
4177
|
+
var isPlanned = curGrid.every(function (x, idx) {
|
|
4178
|
+
var _x$_y;
|
|
4179
|
+
return idx < element.area.fromX + d || idx >= element.area.toX + d || ((_x$_y = x[_y]) === null || _x$_y === void 0 ? void 0 : _x$_y.plannedElement);
|
|
4180
|
+
});
|
|
4181
|
+
var neighbour = _this.getNeighborElements(elementToCopy.elementId, dir);
|
|
4182
|
+
if (neighbour.length == 0 && !isPlanned && elementToCopy) plannerIdsToFill.push(elementToCopy.elementId);else if (elementToCopy) existingPlannerIds.push(elementToCopy.elementId);
|
|
4183
|
+
_y = elementToCopy.area.toY;
|
|
4184
|
+
y = _y;
|
|
4185
|
+
};
|
|
4186
|
+
for (var y = 0; y <= index.y;) {
|
|
4187
|
+
if (_loop(y)) break;
|
|
4232
4188
|
}
|
|
4233
|
-
// if there is nothing to fill we copy everyting
|
|
4189
|
+
// if there is nothing to fill we copy everyting
|
|
4234
4190
|
return {
|
|
4235
4191
|
elements: plannerIdsToFill.length == 0 ? existingPlannerIds : plannerIdsToFill,
|
|
4236
4192
|
backside: curPos.backside
|
|
@@ -4253,13 +4209,15 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4253
4209
|
elements: [],
|
|
4254
4210
|
backside: false
|
|
4255
4211
|
};
|
|
4256
|
-
var curGrid = curPos.backside ? this.
|
|
4212
|
+
var curGrid = curPos.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4257
4213
|
var resultPlannerIds = [];
|
|
4258
4214
|
for (var i = curPos.startColIndex; i <= curPos.endColIndex; i++) {
|
|
4259
4215
|
for (var j = curPos.startRowIndex--; j >= 0; j--) {
|
|
4216
|
+
var _neighborCell$planned;
|
|
4260
4217
|
var neighborCell = curGrid[i][j];
|
|
4261
|
-
|
|
4262
|
-
|
|
4218
|
+
var _elementId5 = neighborCell === null || neighborCell === void 0 || (_neighborCell$planned = neighborCell.plannedElement) === null || _neighborCell$planned === void 0 ? void 0 : _neighborCell$planned.elementId;
|
|
4219
|
+
if (neighborCell && _elementId5 && resultPlannerIds.indexOf(_elementId5) == -1) {
|
|
4220
|
+
resultPlannerIds.push(_elementId5);
|
|
4263
4221
|
}
|
|
4264
4222
|
}
|
|
4265
4223
|
}
|
|
@@ -4296,25 +4254,29 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4296
4254
|
}, {
|
|
4297
4255
|
key: "prepareGridForColCopy",
|
|
4298
4256
|
value: function prepareGridForColCopy(elementId, relativeCopyIndex) {
|
|
4299
|
-
var _this$
|
|
4257
|
+
var _this$generalPlanning4, _this$generalPlanning5, _frontGrid;
|
|
4300
4258
|
if (relativeCopyIndex.y > 0) return;
|
|
4301
4259
|
var elementToCopyPos = this.getCellsInGridByElementId(elementId);
|
|
4302
4260
|
var copyDirectionIsRight = relativeCopyIndex.x > 0;
|
|
4303
|
-
// We add the relativeCopyIndex only if positive otherwise the whole grid get's
|
|
4261
|
+
// We add the relativeCopyIndex only if positive otherwise the whole grid get's
|
|
4304
4262
|
// shifted to the right bexause can`t got negative
|
|
4263
|
+
var element = elementToCopyPos.cells[0].plannedElement;
|
|
4305
4264
|
var absoluteCopyIndex = {
|
|
4306
|
-
x:
|
|
4307
|
-
y:
|
|
4265
|
+
x: element.area.toX - 1 + relativeCopyIndex.x,
|
|
4266
|
+
y: element.area.fromY + relativeCopyIndex.y
|
|
4308
4267
|
};
|
|
4268
|
+
if (relativeCopyIndex.x < 0) absoluteCopyIndex.x = elementToCopyPos.cells[0].plannedElement.area.fromX;
|
|
4309
4269
|
|
|
4310
4270
|
// check if the side we copy to is already blocked
|
|
4311
4271
|
// if blocked and we copy to the left the grid get's shifted so the copy
|
|
4312
4272
|
// get's the index of the copied
|
|
4313
|
-
|
|
4314
|
-
var
|
|
4273
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
4274
|
+
var backGrid = (_this$generalPlanning4 = (_this$generalPlanning5 = this.generalPlanningState.grids[1]) === null || _this$generalPlanning5 === void 0 ? void 0 : _this$generalPlanning5.matrix) !== null && _this$generalPlanning4 !== void 0 ? _this$generalPlanning4 : 0;
|
|
4275
|
+
var widthCopyArea = element.area.toX - element.area.fromX;
|
|
4276
|
+
var isBlocked = (_frontGrid = frontGrid[elementToCopyPos.cells[0].index.x + relativeCopyIndex.x]) === null || _frontGrid === void 0 ? void 0 : _frontGrid[elementToCopyPos.cells[0].index.y];
|
|
4315
4277
|
if (absoluteCopyIndex.x == -1 || isBlocked && !copyDirectionIsRight) absoluteCopyIndex.x -= relativeCopyIndex.x;
|
|
4316
4278
|
|
|
4317
|
-
// new copy logic fill up like this:
|
|
4279
|
+
// new copy logic fill up like this:
|
|
4318
4280
|
// [][] -> | [][][]
|
|
4319
4281
|
// [][] | [][][]
|
|
4320
4282
|
// [][][] | [][][]
|
|
@@ -4322,42 +4284,48 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4322
4284
|
// [][] -> | [][][]
|
|
4323
4285
|
// [][] | [][][]
|
|
4324
4286
|
// [][][] | [][][][]
|
|
4325
|
-
|
|
4287
|
+
this.getGeneralPlanningState();
|
|
4326
4288
|
function moveGrid(plannedCells) {
|
|
4327
4289
|
var grid = new Array();
|
|
4328
|
-
var
|
|
4329
|
-
return c.index.x ==
|
|
4290
|
+
var rightNeighbour = plannedCells.filter(function (c) {
|
|
4291
|
+
return c.index.x == element.area.toX;
|
|
4292
|
+
});
|
|
4293
|
+
var rightNeighbourOfCopy = rightNeighbour.find(function (c) {
|
|
4294
|
+
return c.index.y == absoluteCopyIndex.y;
|
|
4295
|
+
});
|
|
4296
|
+
var leftNeighbour = plannedCells.filter(function (c) {
|
|
4297
|
+
return c.index.x == element.area.fromX - 1;
|
|
4330
4298
|
});
|
|
4331
|
-
var leftNeighbourOfCopy =
|
|
4332
|
-
return
|
|
4299
|
+
var leftNeighbourOfCopy = leftNeighbour.find(function (neighbour) {
|
|
4300
|
+
return neighbour.index.y == absoluteCopyIndex.y;
|
|
4333
4301
|
});
|
|
4334
4302
|
plannedCells.forEach(function (cell) {
|
|
4335
|
-
// if
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
if (!grid[cell.index.x][cell.index.y]) {
|
|
4344
|
-
grid[cell.index.x][cell.index.y] = cell;
|
|
4345
|
-
}
|
|
4303
|
+
// if we can't fill up (need to move the grid)
|
|
4304
|
+
if (cell.index.x >= absoluteCopyIndex.x && (copyDirectionIsRight && (rightNeighbourOfCopy || rightNeighbour.length == 0) || !copyDirectionIsRight && (leftNeighbourOfCopy || leftNeighbour.length == 0) || absoluteCopyIndex.x == -1)) {
|
|
4305
|
+
cell.index.x += widthCopyArea;
|
|
4306
|
+
cell.plannedElement.area.fromX += widthCopyArea;
|
|
4307
|
+
cell.plannedElement.area.toX += widthCopyArea;
|
|
4308
|
+
}
|
|
4309
|
+
if (!grid[cell.index.x]) grid[cell.index.x] = [];
|
|
4310
|
+
grid[cell.index.x][cell.index.y] = cell;
|
|
4346
4311
|
});
|
|
4347
4312
|
return grid;
|
|
4348
4313
|
}
|
|
4349
|
-
|
|
4350
|
-
if (!
|
|
4314
|
+
frontGrid = moveGrid(this.getAllUsedCellsInGrid(false));
|
|
4315
|
+
for (var x = 0; x < widthCopyArea; x++) if (!frontGrid[absoluteCopyIndex.x + x]) frontGrid[absoluteCopyIndex.x + x] = [];
|
|
4316
|
+
this.generalPlanningState.grids[0].matrix = frontGrid;
|
|
4351
4317
|
if (this.hasActiveBackside) {
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4318
|
+
backGrid = moveGrid(this.getAllUsedCellsInGrid(true));
|
|
4319
|
+
for (var _x2 = 0; _x2 < widthCopyArea; _x2++) if (!backGrid[absoluteCopyIndex.x + _x2]) backGrid[absoluteCopyIndex.x + _x2] = [];
|
|
4320
|
+
this.generalPlanningState.grids[1].matrix = backGrid;
|
|
4355
4321
|
}
|
|
4356
4322
|
}
|
|
4357
4323
|
}, {
|
|
4358
4324
|
key: "prepareGridForBackSideCopy",
|
|
4359
4325
|
value: function prepareGridForBackSideCopy() {
|
|
4360
|
-
this.
|
|
4326
|
+
this.generalPlanningState.grids[1] = {
|
|
4327
|
+
matrix: [[]]
|
|
4328
|
+
};
|
|
4361
4329
|
this.hasActiveBackside = true;
|
|
4362
4330
|
}
|
|
4363
4331
|
|
|
@@ -4371,11 +4339,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4371
4339
|
}, {
|
|
4372
4340
|
key: "addElementAtGridPos",
|
|
4373
4341
|
value: function addElementAtGridPos(newElement, col, row, fromBackmodul) {
|
|
4374
|
-
var curGrid = fromBackmodul ? this.
|
|
4375
|
-
var
|
|
4376
|
-
for (var i = 0; i <
|
|
4377
|
-
var cell =
|
|
4378
|
-
// Prüfen, ob das innere Array existiert, sonst erstellen
|
|
4342
|
+
var curGrid = fromBackmodul ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4343
|
+
var cells = this.createNewCells(newElement, col, row, fromBackmodul);
|
|
4344
|
+
for (var i = 0; i < cells.length; i++) {
|
|
4345
|
+
var cell = cells[i];
|
|
4379
4346
|
if (!curGrid[cell.index.x]) {
|
|
4380
4347
|
curGrid[cell.index.x] = [];
|
|
4381
4348
|
}
|
|
@@ -4395,16 +4362,20 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4395
4362
|
key: "addElementAsCopy",
|
|
4396
4363
|
value: function addElementAsCopy(copiedElementId, newElement, copyIndex) {
|
|
4397
4364
|
var curPos = this.getCellsInGridByElementId(copiedElementId);
|
|
4365
|
+
var area = curPos.cells[0].plannedElement.area;
|
|
4398
4366
|
var cellIndex = {
|
|
4399
|
-
x:
|
|
4400
|
-
y:
|
|
4367
|
+
x: area.fromX,
|
|
4368
|
+
y: area.fromY
|
|
4401
4369
|
};
|
|
4370
|
+
if (copyIndex.x > 0) cellIndex.x = area.toX - 1 + copyIndex.x;else if (copyIndex.x < 0) cellIndex.x = area.fromX - (area.toX - area.fromX);else if (copyIndex.y > 0) cellIndex.y = area.toY - 1 + copyIndex.y;
|
|
4402
4371
|
var backsideForCopy = copyIndex.z == -1 || curPos.backside == true;
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4372
|
+
if (cellIndex.x < 0) cellIndex.x = 0; // can't plan to negative space see prepareGridForColCopy
|
|
4373
|
+
|
|
4374
|
+
var cells = this.createNewCells(newElement, cellIndex.x, cellIndex.y, backsideForCopy);
|
|
4375
|
+
var curGrid = backsideForCopy ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4376
|
+
for (var i = 0; i < cells.length; i++) {
|
|
4377
|
+
if (!curGrid[cells[i].index.x]) curGrid[cells[i].index.x] = [];
|
|
4378
|
+
curGrid[cells[i].index.x][cells[i].index.y] = cells[i];
|
|
4408
4379
|
}
|
|
4409
4380
|
this.plannerElements.set(newElement.getElementId(), newElement);
|
|
4410
4381
|
}
|
|
@@ -4431,12 +4402,75 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4431
4402
|
}, {
|
|
4432
4403
|
key: "updateGridElementDimensions",
|
|
4433
4404
|
value: function updateGridElementDimensions(elementId, elementData) {
|
|
4405
|
+
var _this2 = this;
|
|
4434
4406
|
if (!elementData) return;
|
|
4435
4407
|
var res = this.getCellsInGridByElementId(elementId);
|
|
4408
|
+
var scpe = this.gridSetupParams.forceSingleCellPerElement;
|
|
4436
4409
|
res.cells.forEach(function (cell) {
|
|
4437
|
-
cell.
|
|
4438
|
-
cell.
|
|
4410
|
+
if (!cell.plannedElement) return;
|
|
4411
|
+
cell.plannedElement.size.width = elementData.width;
|
|
4412
|
+
cell.plannedElement.size.height = elementData.height;
|
|
4413
|
+
cell.plannedElement.area = {
|
|
4414
|
+
fromX: cell.index.x,
|
|
4415
|
+
toX: !scpe ? cell.index.x + elementData.width / _this2.gridSetupParams.fixCellRasterWidth : cell.index.x + 1,
|
|
4416
|
+
fromY: cell.index.y,
|
|
4417
|
+
toY: !scpe ? cell.index.y + elementData.height / _this2.gridSetupParams.fixCellRasterHeight : cell.index.y + 1
|
|
4418
|
+
};
|
|
4419
|
+
});
|
|
4420
|
+
if (scpe) return;
|
|
4421
|
+
var newGrid = new Array();
|
|
4422
|
+
var plannedCells = this.getAllUsedCellsInGrid(false);
|
|
4423
|
+
plannedCells.forEach(function (cell) {
|
|
4424
|
+
var area = cell.plannedElement.area;
|
|
4425
|
+
if (newGrid.find(function (x) {
|
|
4426
|
+
return x.find(function (y) {
|
|
4427
|
+
var _y$plannedElement3, _cell$plannedElement8;
|
|
4428
|
+
return ((_y$plannedElement3 = y.plannedElement) === null || _y$plannedElement3 === void 0 ? void 0 : _y$plannedElement3.elementId) == ((_cell$plannedElement8 = cell.plannedElement) === null || _cell$plannedElement8 === void 0 ? void 0 : _cell$plannedElement8.elementId);
|
|
4429
|
+
});
|
|
4430
|
+
})) return;
|
|
4431
|
+
for (var x = area.fromX; x < area.toX; x++) {
|
|
4432
|
+
var _loop2 = function _loop2(y) {
|
|
4433
|
+
if (!newGrid[x]) newGrid[x] = [];
|
|
4434
|
+
if (y < area.fromY) {
|
|
4435
|
+
if (newGrid[x][y]) return 0; // continue
|
|
4436
|
+
var el = _this2.generalPlanningState.grids[0].matrix.findLast(function (_x) {
|
|
4437
|
+
return _x[y].plannedElement;
|
|
4438
|
+
});
|
|
4439
|
+
newGrid[x][y] = {
|
|
4440
|
+
index: {
|
|
4441
|
+
x: x,
|
|
4442
|
+
y: y
|
|
4443
|
+
},
|
|
4444
|
+
plannedElement: el && el.length > 0 ? el[0].plannedElement : undefined
|
|
4445
|
+
};
|
|
4446
|
+
return 0; // continue
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
// if the element got smaller we need to move it to the neighbour
|
|
4450
|
+
//newGrid[x][y] = { ...cell, index: { x, y: y } };
|
|
4451
|
+
newGrid[x][y] = _objectSpread(_objectSpread({}, cell), {}, {
|
|
4452
|
+
index: {
|
|
4453
|
+
x: x,
|
|
4454
|
+
y: y
|
|
4455
|
+
},
|
|
4456
|
+
plannedElement: _objectSpread(_objectSpread({}, cell.plannedElement), {}, {
|
|
4457
|
+
area: {
|
|
4458
|
+
fromX: x,
|
|
4459
|
+
toX: x + (cell.plannedElement.area.toX - cell.plannedElement.area.fromX),
|
|
4460
|
+
fromY: y,
|
|
4461
|
+
toY: y + (cell.plannedElement.area.toY - cell.plannedElement.area.fromY)
|
|
4462
|
+
}
|
|
4463
|
+
})
|
|
4464
|
+
});
|
|
4465
|
+
},
|
|
4466
|
+
_ret;
|
|
4467
|
+
for (var y = 0; y < area.toY; y++) {
|
|
4468
|
+
_ret = _loop2(y);
|
|
4469
|
+
if (_ret === 0) continue;
|
|
4470
|
+
}
|
|
4471
|
+
}
|
|
4439
4472
|
});
|
|
4473
|
+
if (res.backside) this.generalPlanningState.grids[1].matrix = newGrid;else this.generalPlanningState.grids[0].matrix = newGrid;
|
|
4440
4474
|
}
|
|
4441
4475
|
|
|
4442
4476
|
/**
|
|
@@ -4446,6 +4480,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4446
4480
|
}, {
|
|
4447
4481
|
key: "updateWorldPosOfElements",
|
|
4448
4482
|
value: function updateWorldPosOfElements() {
|
|
4483
|
+
var _this$generalPlanning6, _this$generalPlanning7;
|
|
4449
4484
|
//First remove all docking Point relation information
|
|
4450
4485
|
var _iterator = _createForOfIteratorHelper(this.plannerElements.values()),
|
|
4451
4486
|
_step;
|
|
@@ -4463,14 +4498,18 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4463
4498
|
//First remove all docking Point relation information
|
|
4464
4499
|
|
|
4465
4500
|
var allCheckedElementIds = [];
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4501
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
4502
|
+
var backGrid = (_this$generalPlanning6 = (_this$generalPlanning7 = this.generalPlanningState.grids[1]) === null || _this$generalPlanning7 === void 0 ? void 0 : _this$generalPlanning7.matrix) !== null && _this$generalPlanning6 !== void 0 ? _this$generalPlanning6 : [];
|
|
4503
|
+
for (var x = 0; x < frontGrid.length; x++) {
|
|
4504
|
+
for (var y = 0; y < frontGrid[x].length; y++) {
|
|
4505
|
+
var _cell$plannedElement9;
|
|
4506
|
+
var cell = frontGrid[x][y];
|
|
4507
|
+
var elementId = cell === null || cell === void 0 || (_cell$plannedElement9 = cell.plannedElement) === null || _cell$plannedElement9 === void 0 ? void 0 : _cell$plannedElement9.elementId;
|
|
4508
|
+
if (elementId && allCheckedElementIds.indexOf(elementId) == -1) {
|
|
4509
|
+
var element = this.plannerElements.get(elementId);
|
|
4510
|
+
allCheckedElementIds.push(elementId);
|
|
4511
|
+
var topNeighbors = this.getNeighborElements(elementId, 'TOP');
|
|
4512
|
+
var rightNeighbors = this.getNeighborElements(elementId, 'RIGHT');
|
|
4474
4513
|
for (var n = 0; n < topNeighbors.length; n++) {
|
|
4475
4514
|
dockingPointHandlerInst.tryDockElement(element, 'AVO', [topNeighbors[n]]);
|
|
4476
4515
|
}
|
|
@@ -4482,20 +4521,22 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4482
4521
|
}
|
|
4483
4522
|
}
|
|
4484
4523
|
}
|
|
4485
|
-
for (var i = 0; i <
|
|
4486
|
-
for (var j = 0; j <
|
|
4487
|
-
var _cell5
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
var
|
|
4492
|
-
|
|
4524
|
+
for (var i = 0; i < backGrid.length; i++) {
|
|
4525
|
+
for (var j = 0; j < backGrid[i].length; j++) {
|
|
4526
|
+
var _cell5$plannedElement;
|
|
4527
|
+
var _cell5 = backGrid[i][j];
|
|
4528
|
+
var _elementId6 = _cell5 === null || _cell5 === void 0 || (_cell5$plannedElement = _cell5.plannedElement) === null || _cell5$plannedElement === void 0 ? void 0 : _cell5$plannedElement.elementId;
|
|
4529
|
+
if (_elementId6 && allCheckedElementIds.indexOf(_elementId6) == -1) {
|
|
4530
|
+
var _element2 = this.plannerElements.get(_elementId6);
|
|
4531
|
+
allCheckedElementIds.push(_elementId6);
|
|
4532
|
+
var frontCell = frontGrid[i][j];
|
|
4533
|
+
var elementFrontGrid = this.plannerElements.get(frontCell.plannedElement.elementId);
|
|
4493
4534
|
if (elementFrontGrid) {
|
|
4494
4535
|
var targetDPFrontGrid = elementFrontGrid === null || elementFrontGrid === void 0 ? void 0 : elementFrontGrid.getDockingPointById('AVO_AVO_2_IL');
|
|
4495
4536
|
if (!targetDPFrontGrid) LOG$1.error(new DivaError('Error Loading DockingPoint AVO_2 for plannerElement'));else if (_element2) dockingPointHandlerInst.tryDockElementToDP(_element2, elementFrontGrid, targetDPFrontGrid);
|
|
4496
4537
|
}
|
|
4497
|
-
var _topNeighbors = this.getNeighborElements(
|
|
4498
|
-
var _rightNeighbors = this.getNeighborElements(
|
|
4538
|
+
var _topNeighbors = this.getNeighborElements(_elementId6, 'TOP');
|
|
4539
|
+
var _rightNeighbors = this.getNeighborElements(_elementId6, 'RIGHT');
|
|
4499
4540
|
for (var n = 0; n < _topNeighbors.length; n++) {
|
|
4500
4541
|
dockingPointHandlerInst.tryDockElement(_element2, 'AVO', [_topNeighbors[n]]);
|
|
4501
4542
|
}
|
|
@@ -4529,10 +4570,10 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4529
4570
|
_iterator2.f();
|
|
4530
4571
|
}
|
|
4531
4572
|
this.plannerElements.clear();
|
|
4532
|
-
this.
|
|
4573
|
+
this.generalPlanningState.grids[0].matrix = [];
|
|
4533
4574
|
if (this.hasActiveBackside) {
|
|
4534
4575
|
this.hasActiveBackside = false;
|
|
4535
|
-
this.
|
|
4576
|
+
this.generalPlanningState.grids[1].matrix = [];
|
|
4536
4577
|
}
|
|
4537
4578
|
}
|
|
4538
4579
|
|
|
@@ -4558,7 +4599,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4558
4599
|
_iterator3.f();
|
|
4559
4600
|
}
|
|
4560
4601
|
allElements = [];
|
|
4561
|
-
this.
|
|
4602
|
+
this.generalPlanningState.grids[1].matrix = [];
|
|
4562
4603
|
}
|
|
4563
4604
|
}, {
|
|
4564
4605
|
key: "getPlannerHasActiveBackside",
|
|
@@ -4573,26 +4614,31 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4573
4614
|
}, {
|
|
4574
4615
|
key: "getBoundingBox",
|
|
4575
4616
|
value: function getBoundingBox() {
|
|
4617
|
+
var _frontGrid$;
|
|
4618
|
+
var frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
4619
|
+
var element = frontGrid === null || frontGrid === void 0 || (_frontGrid$ = frontGrid[0]) === null || _frontGrid$ === void 0 || (_frontGrid$ = _frontGrid$[0]) === null || _frontGrid$ === void 0 ? void 0 : _frontGrid$.plannedElement;
|
|
4576
4620
|
var height = 0;
|
|
4577
4621
|
var minX = 0;
|
|
4578
4622
|
var maxX = 0;
|
|
4579
4623
|
var curX = 0;
|
|
4580
4624
|
var minZ = 0;
|
|
4581
|
-
var curZ =
|
|
4625
|
+
var curZ = element ? element.size.depth : 0;
|
|
4582
4626
|
var maxZ = 0;
|
|
4583
4627
|
var curDir;
|
|
4584
4628
|
curDir = 'RIGHT';
|
|
4585
4629
|
var allCheckedElementIds = [];
|
|
4586
|
-
for (var i = 0; i <
|
|
4587
|
-
var
|
|
4630
|
+
for (var i = 0; i < frontGrid.length; i++) {
|
|
4631
|
+
var _groundCell$plannedEl;
|
|
4632
|
+
var groundCell = frontGrid[i][0];
|
|
4588
4633
|
if (!groundCell) break; //if on the lowest position the cell is empty, the grid ist finished - no wholes are allowed
|
|
4589
4634
|
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4635
|
+
var elementId = (_groundCell$plannedEl = groundCell.plannedElement) === null || _groundCell$plannedEl === void 0 ? void 0 : _groundCell$plannedEl.elementId;
|
|
4636
|
+
if (elementId && allCheckedElementIds.indexOf(elementId) == -1) {
|
|
4637
|
+
allCheckedElementIds.push(elementId);
|
|
4638
|
+
var groundElement = this.plannerElements.get(elementId);
|
|
4593
4639
|
if (!groundElement) continue;
|
|
4594
4640
|
//Check if the col has a corner.
|
|
4595
|
-
var elementOption = this.getValueOfOptionOfArticle(
|
|
4641
|
+
var elementOption = this.getValueOfOptionOfArticle(elementId, 'OPTELEMENT');
|
|
4596
4642
|
if (curDir == 'RIGHT') {
|
|
4597
4643
|
curX += groundElement.getWidth();
|
|
4598
4644
|
} else if (curDir == 'FRONT') {
|
|
@@ -4661,7 +4707,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4661
4707
|
var _curGrid$x;
|
|
4662
4708
|
return ((_curGrid$x = curGrid[x]) === null || _curGrid$x === void 0 ? void 0 : _curGrid$x[y]) === undefined;
|
|
4663
4709
|
};
|
|
4664
|
-
var curGrid = elementCells.backside ? this.
|
|
4710
|
+
var curGrid = elementCells.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4665
4711
|
var _iterator4 = _createForOfIteratorHelper(this.plannerElements.keys()),
|
|
4666
4712
|
_step4;
|
|
4667
4713
|
try {
|
|
@@ -4680,7 +4726,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4680
4726
|
|
|
4681
4727
|
//Now we found a possible place
|
|
4682
4728
|
|
|
4683
|
-
var locationInformation = this.createLocationInformation(element, elementCells.backside, this.createEmptyCells(otherElementCells.
|
|
4729
|
+
var locationInformation = this.createLocationInformation(element, elementCells.backside, this.createEmptyCells(otherElementCells.cells[0].plannedElement.area.fromX, otherElementCells.cells[0].plannedElement.area.toX, otherElementCells.cells[0].plannedElement.area.fromY, otherElementCells.cells[0].plannedElement.area.toY + 1, element.getWidth(), element.getHeight()), otherElementCells.cells[0].plannedElement.area.fromX, otherElementCells.cells[0].plannedElement.area.toX, 1, 1);
|
|
4684
4730
|
allFreeMoveLocations.push(locationInformation);
|
|
4685
4731
|
}
|
|
4686
4732
|
} else {
|
|
@@ -4689,7 +4735,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4689
4735
|
var _otherElementCells = this.getCellsInGridByElementId(otherElementId);
|
|
4690
4736
|
var freeStartTopColIndex = -1;
|
|
4691
4737
|
var freeEndTopColIndex = -1;
|
|
4692
|
-
var topRow = _otherElementCells.
|
|
4738
|
+
var topRow = _otherElementCells.cells[0].plannedElement.area.toY + 1;
|
|
4693
4739
|
for (var x = _otherElementCells.startColIndex; x <= _otherElementCells.startColIndex + _otherElementCells.colCount - 1; x++) {
|
|
4694
4740
|
var freeSpaceFound = false;
|
|
4695
4741
|
if (isEmptyCell(x, topRow)) {
|
|
@@ -4762,7 +4808,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4762
4808
|
}
|
|
4763
4809
|
|
|
4764
4810
|
// Determine the grid to work with (front or back) based on the element's location
|
|
4765
|
-
var curGrid = elementCells.backside ? this.
|
|
4811
|
+
var curGrid = elementCells.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4766
4812
|
|
|
4767
4813
|
// Get the boundaries of the element in the grid
|
|
4768
4814
|
var startColIndex = elementCells.startColIndex;
|
|
@@ -4821,9 +4867,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4821
4867
|
var targetRowIndex = endRowIndex + 1;
|
|
4822
4868
|
var _copyPossible = false;
|
|
4823
4869
|
// Iterate through columns within the element's width
|
|
4824
|
-
for (var
|
|
4825
|
-
if (isValidCell(
|
|
4826
|
-
copyStartColIndex =
|
|
4870
|
+
for (var _x3 = endColIndex; _x3 >= startColIndex; _x3--) {
|
|
4871
|
+
if (isValidCell(_x3, targetRowIndex)) {
|
|
4872
|
+
copyStartColIndex = _x3;
|
|
4827
4873
|
_copyPossible = true;
|
|
4828
4874
|
}
|
|
4829
4875
|
}
|
|
@@ -4837,29 +4883,29 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4837
4883
|
case 'RIGHT':
|
|
4838
4884
|
{
|
|
4839
4885
|
// Target column to the left of the element
|
|
4840
|
-
var _targetColIndex = endColIndex
|
|
4886
|
+
var _targetColIndex = endColIndex;
|
|
4841
4887
|
var _copyPossible2 = false;
|
|
4842
4888
|
// Iterate through rows within the element's height
|
|
4843
|
-
for (var
|
|
4844
|
-
if (isValidCell(_targetColIndex,
|
|
4845
|
-
copyStartRowIndex =
|
|
4889
|
+
for (var _y2 = startRowIndex; _y2 <= endRowIndex; _y2++) {
|
|
4890
|
+
if (isValidCell(_targetColIndex, _y2)) {
|
|
4891
|
+
copyStartRowIndex = _y2;
|
|
4846
4892
|
_copyPossible2 = true;
|
|
4847
4893
|
break;
|
|
4848
4894
|
}
|
|
4849
4895
|
}
|
|
4850
4896
|
if (!_copyPossible2) return undefined;
|
|
4851
4897
|
_copyPossible2 = false;
|
|
4852
|
-
for (var
|
|
4853
|
-
if (isValidCell(
|
|
4898
|
+
for (var _x4 = endColIndex; _x4 <= endColIndex + elementCells.colCount; _x4++) {
|
|
4899
|
+
if (isValidCell(_x4, copyStartRowIndex) && (copyStartRowIndex == 0 || !isValidCell(_x4, copyStartRowIndex - 1))) {
|
|
4854
4900
|
//check also for overhang
|
|
4855
|
-
copyEndColIndex =
|
|
4901
|
+
copyEndColIndex = _x4;
|
|
4856
4902
|
_copyPossible2 = true;
|
|
4857
4903
|
} else {
|
|
4858
4904
|
break; //when you find one situation where it is not valid skip outside.
|
|
4859
4905
|
}
|
|
4860
4906
|
}
|
|
4861
4907
|
if (!_copyPossible2) return undefined;
|
|
4862
|
-
copyStartColIndex = endColIndex
|
|
4908
|
+
copyStartColIndex = endColIndex;
|
|
4863
4909
|
copyEndRowIndex = endRowIndex;
|
|
4864
4910
|
freeCells = this.createEmptyCells(copyStartColIndex, copyStartRowIndex, copyEndColIndex, copyEndRowIndex, element.getWidth(), element.getHeight());
|
|
4865
4911
|
break;
|
|
@@ -4876,7 +4922,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4876
4922
|
}, {
|
|
4877
4923
|
key: "createLocationInformation",
|
|
4878
4924
|
value: function createLocationInformation(element, fromBackside, cells, cellsStartColIndex, cellsStartRowIndex, cellsColCount, cellsRowCount) {
|
|
4879
|
-
var curGrid = fromBackside ? this.
|
|
4925
|
+
var curGrid = fromBackside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
|
|
4880
4926
|
var elementLocation = {
|
|
4881
4927
|
cells: cells,
|
|
4882
4928
|
widthPerCell: this.gridSetupParams.forceFixCellRasterSize ? this.gridSetupParams.fixCellRasterWidth : element.getWidth(),
|
|
@@ -4892,14 +4938,16 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4892
4938
|
} else {
|
|
4893
4939
|
var distToOriginX = 0;
|
|
4894
4940
|
for (var i = 0; i < cellsStartColIndex; i++) {
|
|
4895
|
-
|
|
4941
|
+
var _plannedElement$size$2, _plannedElement2;
|
|
4942
|
+
distToOriginX += (_plannedElement$size$2 = (_plannedElement2 = curGrid[i][0].plannedElement) === null || _plannedElement2 === void 0 ? void 0 : _plannedElement2.size.width) !== null && _plannedElement$size$2 !== void 0 ? _plannedElement$size$2 : 0;
|
|
4896
4943
|
}
|
|
4897
4944
|
if (cellsStartColIndex < 0) {
|
|
4898
4945
|
distToOriginX = -element.getWidth();
|
|
4899
4946
|
}
|
|
4900
4947
|
var distToOriginY = 0;
|
|
4901
4948
|
for (var i = 0; i < cellsStartRowIndex; i++) {
|
|
4902
|
-
|
|
4949
|
+
var _plannedElement$size$3, _plannedElement3;
|
|
4950
|
+
distToOriginY += (_plannedElement$size$3 = (_plannedElement3 = curGrid[cellsStartColIndex][i].plannedElement) === null || _plannedElement3 === void 0 ? void 0 : _plannedElement3.size.width) !== null && _plannedElement$size$3 !== void 0 ? _plannedElement$size$3 : 0;
|
|
4903
4951
|
}
|
|
4904
4952
|
elementLocation.startIndexWorldPos = new Vector2(distToOriginX, distToOriginY);
|
|
4905
4953
|
}
|
|
@@ -4915,7 +4963,8 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4915
4963
|
for (var i = 0; i < allElements.length; i++) {
|
|
4916
4964
|
var element = allElements[i];
|
|
4917
4965
|
var elementCells = this.getCellsInGridByElementId(element.getElementId());
|
|
4918
|
-
var
|
|
4966
|
+
var area = elementCells.cells[0].plannedElement.area;
|
|
4967
|
+
var elementLocation = this.createLocationInformation(element, elementCells.backside, elementCells.cells, area.fromX, area.toX, area.fromY, area.toY);
|
|
4919
4968
|
var planningLeftLocation = this.getFreePlanningLocation(element.getElementId(), 'LEFT');
|
|
4920
4969
|
var planningRightLocation = this.getFreePlanningLocation(element.getElementId(), 'RIGHT');
|
|
4921
4970
|
var planningTopLocation = this.getFreePlanningLocation(element.getElementId(), 'TOP');
|
|
@@ -4942,9 +4991,11 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4942
4991
|
}, {
|
|
4943
4992
|
key: "getGeneralPlanningState",
|
|
4944
4993
|
value: function getGeneralPlanningState(selectedElementId) {
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4994
|
+
return this.generalPlanningState;
|
|
4995
|
+
/*
|
|
4996
|
+
let matrix: Cell[][] = [];
|
|
4997
|
+
let selectedElement: SelectedElement | undefined = undefined;
|
|
4998
|
+
const plannedElements: PlannedElement[] = Array.from(this.plannerElements.values()).map((p) => {
|
|
4948
4999
|
return {
|
|
4949
5000
|
basketId: p.getBasketId(),
|
|
4950
5001
|
elementId: p.getElementId(),
|
|
@@ -4952,67 +5003,67 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
4952
5003
|
size: {
|
|
4953
5004
|
width: p.getWidth(),
|
|
4954
5005
|
height: p.getHeight(),
|
|
4955
|
-
depth: p.getDepth()
|
|
5006
|
+
depth: p.getDepth(),
|
|
4956
5007
|
},
|
|
4957
5008
|
area: {
|
|
4958
5009
|
fromX: undefined,
|
|
4959
5010
|
toX: undefined,
|
|
4960
5011
|
fromY: undefined,
|
|
4961
|
-
toY: undefined
|
|
4962
|
-
}
|
|
5012
|
+
toY: undefined,
|
|
5013
|
+
} as any,
|
|
4963
5014
|
};
|
|
4964
5015
|
});
|
|
4965
|
-
|
|
5016
|
+
let frontGrid = this.generalPlanningState.grids[0].matrix;
|
|
5017
|
+
let index = { x: 0, y: 0 };
|
|
5018
|
+
for (let i = 0; i < frontGrid.length; i++) {
|
|
4966
5019
|
matrix.push([]);
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
5020
|
+
const frontGridRow = frontGrid[i];
|
|
5021
|
+
for (let j = 0; j < frontGridRow.length; j++) {
|
|
5022
|
+
const cell = frontGridRow[j];
|
|
5023
|
+
let elementId = cell.plannedElement?.elementId;
|
|
5024
|
+
if (elementId && cell) {
|
|
5025
|
+
const plannedElement = plannedElements.find((p) => p.elementId === elementId);
|
|
5026
|
+
let matrixIndex = 0;
|
|
5027
|
+
for (let idx = cell.index.x - 1; idx >= 0; idx--)
|
|
5028
|
+
matrixIndex += frontGridRow[idx]!.plannedElement!.size.width / 19.2;
|
|
5029
|
+
if (plannedElement) {
|
|
5030
|
+
|
|
5031
|
+
plannedElement.area.fromX = matrixIndex;
|
|
5032
|
+
plannedElement.area.toX = matrixIndex + cell.plannedElement!.size.width / 19.2;
|
|
5033
|
+
plannedElement.area.fromY = cell.index.y;
|
|
5034
|
+
plannedElement.area.toY = cell.index.y + cell.plannedElement!.size.height / 19.2;
|
|
5035
|
+
for (let x = plannedElement.area.fromX; x < plannedElement.area.toX; x++) {
|
|
5036
|
+
for (let y = plannedElement.area.fromY; y < plannedElement.area.toY; y++) {
|
|
5037
|
+
if (!matrix[x]) matrix[x] = [];
|
|
5038
|
+
matrix[x][y] = { index: { x, y }, plannedElement };
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
continue;
|
|
4979
5042
|
}
|
|
4980
|
-
matrix[
|
|
4981
|
-
index: cell.index,
|
|
4982
|
-
plannedElement: plannedElement
|
|
4983
|
-
});
|
|
5043
|
+
matrix[matrixIndex].push({ index: index, plannedElement });
|
|
4984
5044
|
}
|
|
4985
|
-
};
|
|
4986
|
-
for (var j = 0; j < frontGridRow.length; j++) {
|
|
4987
|
-
_loop();
|
|
4988
5045
|
}
|
|
4989
5046
|
}
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
return row.length;
|
|
4994
|
-
})));
|
|
4995
|
-
matrix.forEach(function (row) {
|
|
5047
|
+
// Fill matrix rows to equal length
|
|
5048
|
+
const maxLength = Math.max(...matrix.map((row) => row.length));
|
|
5049
|
+
matrix.forEach((row) => {
|
|
4996
5050
|
while (row.length < maxLength) {
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
var newY = lastCell ? lastCell.index.y + 1 : 0;
|
|
5051
|
+
const lastCell = row[row.length - 1];
|
|
5052
|
+
const newY = lastCell ? lastCell.index.y + 1 : 0;
|
|
5000
5053
|
row.push({
|
|
5001
|
-
index: new Vector2(
|
|
5002
|
-
plannedElement: undefined
|
|
5054
|
+
index: new Vector2(row[0]?.index.x || 0, newY),
|
|
5055
|
+
plannedElement: undefined,
|
|
5003
5056
|
});
|
|
5004
5057
|
}
|
|
5005
5058
|
});
|
|
5006
|
-
|
|
5007
|
-
return p.elementId === selectedElementId;
|
|
5008
|
-
}) : undefined;
|
|
5059
|
+
let selectedPlannedElement = selectedElementId ? plannedElements.find((p) => p.elementId === selectedElementId) : undefined;
|
|
5009
5060
|
if (selectedPlannedElement) {
|
|
5010
5061
|
//add the free let planningLeftLocation = this.getFreePlanningLocation(element.getElementId(), 'LEFT');
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5062
|
+
let planningLeftLocation = this.getFreePlanningLocation(selectedPlannedElement.elementId, 'LEFT');
|
|
5063
|
+
let planningRightLocation = this.getFreePlanningLocation(selectedPlannedElement.elementId, 'RIGHT');
|
|
5064
|
+
let planningTopLocation = this.getFreePlanningLocation(selectedPlannedElement.elementId, 'TOP');
|
|
5065
|
+
let fixedPositionRules: FixedPositonRule[] = [];
|
|
5066
|
+
if (planningLeftLocation) {
|
|
5016
5067
|
this.addFreeCellsToMatrix(matrix, planningLeftLocation.cells, fixedPositionRules);
|
|
5017
5068
|
}
|
|
5018
5069
|
if (planningRightLocation) {
|
|
@@ -5021,27 +5072,28 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
5021
5072
|
if (planningTopLocation) {
|
|
5022
5073
|
this.addFreeCellsToMatrix(matrix, planningTopLocation.cells, fixedPositionRules);
|
|
5023
5074
|
}
|
|
5024
|
-
|
|
5075
|
+
selectedElement = {
|
|
5025
5076
|
articleCodex: selectedPlannedElement.articleCodex,
|
|
5026
5077
|
size: selectedPlannedElement.size,
|
|
5027
5078
|
gridSpace: {
|
|
5028
5079
|
rows: selectedPlannedElement.area.toY - selectedPlannedElement.area.fromY + 1,
|
|
5029
|
-
colums: selectedPlannedElement.area.toX - selectedPlannedElement.area.fromX + 1
|
|
5080
|
+
colums: selectedPlannedElement.area.toX - selectedPlannedElement.area.fromX + 1,
|
|
5030
5081
|
},
|
|
5031
5082
|
rules: fixedPositionRules,
|
|
5032
|
-
elementId: selectedElementId
|
|
5083
|
+
elementId: selectedElementId!,
|
|
5033
5084
|
};
|
|
5034
5085
|
}
|
|
5035
5086
|
return {
|
|
5036
|
-
grids: [
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5087
|
+
grids: [
|
|
5088
|
+
{
|
|
5089
|
+
index: 0, // boxplanner usecase grid index always 0
|
|
5090
|
+
rowSizes: this.getRowSizes(matrix, selectedElement),
|
|
5091
|
+
columnSizes: this.getColumnSizes(matrix, selectedElement),
|
|
5092
|
+
matrix,
|
|
5093
|
+
},
|
|
5094
|
+
],
|
|
5095
|
+
selectedElement,
|
|
5096
|
+
}; */
|
|
5045
5097
|
}
|
|
5046
5098
|
}, {
|
|
5047
5099
|
key: "getRowSizes",
|
|
@@ -5050,7 +5102,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
5050
5102
|
//system 4 useacse
|
|
5051
5103
|
var totalColCount = matrix[0].length;
|
|
5052
5104
|
var colSizes = Array(totalColCount).fill(-1);
|
|
5053
|
-
var
|
|
5105
|
+
var _loop3 = function _loop3(i) {
|
|
5054
5106
|
var _matrix$find;
|
|
5055
5107
|
var cell = (_matrix$find = matrix.find(function (row) {
|
|
5056
5108
|
var _row$i$plannedElement, _row$i$plannedElement2;
|
|
@@ -5064,7 +5116,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
5064
5116
|
if (colSizes[i] === -1) return 1; // break
|
|
5065
5117
|
};
|
|
5066
5118
|
for (var i = 0; i < totalColCount; i++) {
|
|
5067
|
-
if (
|
|
5119
|
+
if (_loop3(i)) break;
|
|
5068
5120
|
}
|
|
5069
5121
|
if (colSizes.includes(-1)) LOG$1.error(new Error('Column sizes are not set'));
|
|
5070
5122
|
return colSizes;
|
|
@@ -5127,9 +5179,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
|
|
|
5127
5179
|
});
|
|
5128
5180
|
if (!column) {
|
|
5129
5181
|
matrix.map(function (row) {
|
|
5130
|
-
var _row
|
|
5182
|
+
var _row$;
|
|
5131
5183
|
return row.push({
|
|
5132
|
-
index: new Vector2(((_row$
|
|
5184
|
+
index: new Vector2(((_row$ = row[0]) === null || _row$ === void 0 ? void 0 : _row$.index.x) || 0, y),
|
|
5133
5185
|
plannedElement: undefined
|
|
5134
5186
|
});
|
|
5135
5187
|
});
|
|
@@ -5336,7 +5388,7 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
|
|
|
5336
5388
|
key: "addPlannerElement",
|
|
5337
5389
|
value: (function () {
|
|
5338
5390
|
var _addPlannerElement = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(basketID, params) {
|
|
5339
|
-
var plannerElement, data;
|
|
5391
|
+
var plannerElement, data, constructionRules, _constructionRules$co, _constructionRules$co2;
|
|
5340
5392
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5341
5393
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5342
5394
|
case 0:
|
|
@@ -5355,7 +5407,19 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
|
|
|
5355
5407
|
return handler2D.loadSVG(plannerElement, this.set);
|
|
5356
5408
|
case 9:
|
|
5357
5409
|
if (!this.constructionRulesHandler.getConstructionRulesLoaded()) {
|
|
5358
|
-
this.
|
|
5410
|
+
constructionRules = this.set.getConstructionRuleOfElementId(plannerElement.ElementId);
|
|
5411
|
+
if (constructionRules) {
|
|
5412
|
+
this.boxPlannerGrid.GridSetupParams = {
|
|
5413
|
+
fixCellRasterHeight: 19.2,
|
|
5414
|
+
fixCellRasterWidth: 19.2,
|
|
5415
|
+
forceFixCellRasterSize: (_constructionRules$co = constructionRules.constructionRules.forceFixCellRasterSize) !== null && _constructionRules$co !== void 0 ? _constructionRules$co : true,
|
|
5416
|
+
forceSingleCellPerElement: (_constructionRules$co2 = constructionRules.constructionRules.forceSingleCellPerElement) !== null && _constructionRules$co2 !== void 0 ? _constructionRules$co2 : true,
|
|
5417
|
+
hasMaxGridRasterHeight: constructionRules.constructionRules.hasMaxGridRasterHeight,
|
|
5418
|
+
maxGridRasterHeight: constructionRules.constructionRules.maxGridRasterHeight,
|
|
5419
|
+
hasMaxGridRasterWidth: constructionRules.constructionRules.hasMaxGridRasterWidth,
|
|
5420
|
+
maxGridRasterWidth: constructionRules.constructionRules.maxGridRasterWidth
|
|
5421
|
+
}, this.constructionRulesHandler.setConstructionRules(constructionRules);
|
|
5422
|
+
}
|
|
5359
5423
|
}
|
|
5360
5424
|
this.boxPlannerGrid.addElementAtGridPos(plannerElement, params.boxCol, params.boxRow, params.backside != undefined ? params.backside : false);
|
|
5361
5425
|
if (!params.boxUpdateWholePlanning) {
|
|
@@ -5549,7 +5613,7 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
|
|
|
5549
5613
|
result.backside;
|
|
5550
5614
|
} else {
|
|
5551
5615
|
var _result = this.boxPlannerGrid.getAllElementsToFillUp(elementId, copyInfo.copyIndex.x > 0 ? 'RIGHT' : 'LEFT');
|
|
5552
|
-
allElementsToCopy =
|
|
5616
|
+
allElementsToCopy = _result.elements;
|
|
5553
5617
|
_result.backside;
|
|
5554
5618
|
}
|
|
5555
5619
|
}
|