kitchen-simulator 1.1.1-test.71 → 1.1.1-test.72
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/es/@history.js +5 -2
- package/es/AppContext.js +6 -3
- package/es/KitchenConfigurator.js +86 -87
- package/es/KitchenConfiguratorApp.js +128 -135
- package/es/actions/area-actions.js +8 -5
- package/es/actions/export.js +24 -12
- package/es/actions/groups-actions.js +41 -27
- package/es/actions/holes-actions.js +51 -34
- package/es/actions/items-actions.js +141 -94
- package/es/actions/lines-actions.js +32 -21
- package/es/actions/project-actions.js +141 -94
- package/es/actions/scene-actions.js +17 -11
- package/es/actions/vertices-actions.js +11 -7
- package/es/actions/viewer2d-actions.js +32 -21
- package/es/actions/viewer3d-actions.js +14 -9
- package/es/catalog/areas/area/planner-element.js +5 -2
- package/es/catalog/catalog.js +17 -15
- package/es/catalog/factories/area-factory-3d.js +26 -22
- package/es/catalog/factories/area-factory.js +15 -13
- package/es/catalog/factories/export.js +10 -6
- package/es/catalog/factories/wall-factory-3d.js +36 -31
- package/es/catalog/factories/wall-factory.js +26 -21
- package/es/catalog/holes/door-closet/planner-element.js +19 -15
- package/es/catalog/holes/door-double/planner-element.js +19 -15
- package/es/catalog/holes/door-exterior/planner-element.js +20 -16
- package/es/catalog/holes/door-interior/planner-element.js +20 -16
- package/es/catalog/holes/door-panic/planner-element.js +11 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +19 -15
- package/es/catalog/holes/door-sliding/planner-element.js +21 -17
- package/es/catalog/holes/doorway-framed/planner-element.js +15 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +11 -7
- package/es/catalog/holes/export.js +29 -13
- package/es/catalog/holes/window-clear/planner-element.js +14 -10
- package/es/catalog/holes/window-cross/planner-element.js +14 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +14 -10
- package/es/catalog/holes/window-vertical/planner-element.js +14 -10
- package/es/catalog/lines/wall/planner-element.js +5 -2
- package/es/catalog/molding/molding-dcm/planner-element.js +9 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +9 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +9 -5
- package/es/catalog/properties/export.js +31 -20
- package/es/catalog/properties/property-checkbox.js +29 -28
- package/es/catalog/properties/property-color.js +19 -16
- package/es/catalog/properties/property-enum.js +27 -24
- package/es/catalog/properties/property-hidden.js +12 -9
- package/es/catalog/properties/property-lenght-measure.js +41 -38
- package/es/catalog/properties/property-length-measure.js +39 -36
- package/es/catalog/properties/property-length-measure_hole.js +41 -38
- package/es/catalog/properties/property-number.js +20 -17
- package/es/catalog/properties/property-read-only.js +19 -16
- package/es/catalog/properties/property-string.js +19 -16
- package/es/catalog/properties/property-toggle.js +19 -16
- package/es/catalog/properties/shared-property-style.js +3 -1
- package/es/catalog/utils/FuseUtils.js +13 -12
- package/es/catalog/utils/exporter.js +11 -10
- package/es/catalog/utils/geom-utils.js +24 -13
- package/es/catalog/utils/item-loader.js +92 -86
- package/es/catalog/utils/load-obj.js +24 -20
- package/es/catalog/utils/mtl-loader.js +4 -3
- package/es/catalog/utils/obj-loader.js +4 -3
- package/es/class/FuseUtils.js +13 -12
- package/es/class/area.js +24 -24
- package/es/class/export.js +36 -23
- package/es/class/group.js +55 -53
- package/es/class/guide.js +17 -15
- package/es/class/hole.js +85 -83
- package/es/class/item.js +155 -155
- package/es/class/layer.js +61 -59
- package/es/class/line.js +138 -135
- package/es/class/project.js +94 -93
- package/es/class/vertex.js +31 -29
- package/es/components/content.js +23 -19
- package/es/components/disclaimer/disclaimer.js +13 -10
- package/es/components/export.js +13 -8
- package/es/components/style/button.js +25 -25
- package/es/components/style/cancel-button.js +10 -7
- package/es/components/style/content-container.js +12 -11
- package/es/components/style/content-title.js +15 -13
- package/es/components/style/delete-button.js +12 -8
- package/es/components/style/export.js +46 -30
- package/es/components/style/form-block.js +11 -10
- package/es/components/style/form-color-input.js +10 -7
- package/es/components/style/form-label.js +11 -10
- package/es/components/style/form-number-input.js +43 -45
- package/es/components/style/form-number-input_2.js +39 -41
- package/es/components/style/form-select.js +20 -19
- package/es/components/style/form-slider.js +13 -10
- package/es/components/style/form-submit-button.js +12 -8
- package/es/components/style/form-text-input.js +28 -30
- package/es/components/viewer2d/area.js +20 -17
- package/es/components/viewer2d/export.js +46 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +13 -10
- package/es/components/viewer2d/grids/grids.js +14 -10
- package/es/components/viewer2d/group.js +19 -15
- package/es/components/viewer2d/item.js +65 -61
- package/es/components/viewer2d/layer.js +26 -23
- package/es/components/viewer2d/line.js +106 -101
- package/es/components/viewer2d/ruler.js +25 -22
- package/es/components/viewer2d/rulerDist.js +24 -21
- package/es/components/viewer2d/rulerX.js +44 -46
- package/es/components/viewer2d/rulerY.js +42 -44
- package/es/components/viewer2d/scene.js +34 -35
- package/es/components/viewer2d/snap.js +17 -13
- package/es/components/viewer2d/state.js +22 -18
- package/es/components/viewer2d/utils.js +33 -24
- package/es/components/viewer2d/vertex.js +12 -8
- package/es/components/viewer2d/viewer2d.js +159 -156
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +19 -21
- package/es/components/viewer3d/dcm.js +3 -1
- package/es/components/viewer3d/fbm.js +3 -1
- package/es/components/viewer3d/front3D.js +16 -12
- package/es/components/viewer3d/grid-creator.js +12 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +9 -6
- package/es/components/viewer3d/grids/grid-streak.js +8 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +9 -6
- package/es/components/viewer3d/libs/first-person-controls.js +5 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +3 -1
- package/es/components/viewer3d/libs/mtl-loader.js +3 -1
- package/es/components/viewer3d/libs/obj-loader.js +3 -1
- package/es/components/viewer3d/libs/orbit-controls.js +4 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +4 -2
- package/es/components/viewer3d/lrm.js +3 -1
- package/es/components/viewer3d/model.js +3 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +6 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +21 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +62 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +43 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +13 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +7 -4
- package/es/components/viewer3d/scene-creator.js +223 -197
- package/es/components/viewer3d/three-memory-cleaner.js +7 -3
- package/es/components/viewer3d/viewer3d-first-person.js +42 -42
- package/es/components/viewer3d/viewer3d.js +198 -200
- package/es/constants.js +354 -349
- package/es/index.js +11 -7
- package/es/models.js +191 -193
- package/es/plugins/SVGLoader.js +49 -48
- package/es/plugins/autosave.js +5 -3
- package/es/plugins/console-debugger.js +7 -6
- package/es/plugins/export.js +13 -8
- package/es/plugins/keyboard.js +31 -29
- package/es/reducers/areas-reducer.js +9 -7
- package/es/reducers/export.js +37 -24
- package/es/reducers/groups-reducer.js +33 -31
- package/es/reducers/holes-reducer.js +45 -43
- package/es/reducers/items-reducer.js +108 -106
- package/es/reducers/lines-reducer.js +30 -28
- package/es/reducers/project-reducer.js +107 -105
- package/es/reducers/reducer.js +19 -16
- package/es/reducers/scene-reducer.js +17 -15
- package/es/reducers/user-reducer.js +7 -5
- package/es/reducers/vertices-reducer.js +13 -11
- package/es/reducers/viewer2d-reducer.js +20 -18
- package/es/reducers/viewer3d-reducer.js +18 -16
- package/es/shared-style.js +12 -10
- package/es/styles/export.js +6 -3
- package/es/translator/en.js +3 -1
- package/es/translator/it.js +3 -1
- package/es/translator/ru.js +3 -1
- package/es/translator/translator.js +15 -13
- package/es/utils/browser.js +5 -2
- package/es/utils/convert-units-lite.js +3 -1
- package/es/utils/email-validator.js +3 -1
- package/es/utils/export.js +29 -15
- package/es/utils/geometry.js +280 -190
- package/es/utils/get-edges-of-subgraphs.js +5 -2
- package/es/utils/graph-cycles.js +7 -8
- package/es/utils/graph-inner-cycles.js +14 -10
- package/es/utils/graph.js +13 -9
- package/es/utils/helper.js +58 -41
- package/es/utils/history.js +11 -8
- package/es/utils/id-broker.js +11 -8
- package/es/utils/logger.js +3 -1
- package/es/utils/math.js +8 -5
- package/es/utils/molding.js +146 -130
- package/es/utils/name-generator.js +9 -7
- package/es/utils/objects-utils.js +14 -7
- package/es/utils/phone-validator.js +3 -1
- package/es/utils/process-black-list.js +6 -5
- package/es/utils/react-if.js +9 -7
- package/es/utils/snap-scene.js +30 -27
- package/es/utils/snap.js +57 -53
- package/es/utils/summarizeCart.js +3 -1
- package/es/utils/threeCSG.es6.js +17 -13
- package/es/version.js +3 -1
- package/package.json +1 -1
package/es/utils/molding.js
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
2
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.createMonldingGroup = createMonldingGroup;
|
|
5
|
+
exports.getAllMoldingGroups = getAllMoldingGroups;
|
|
6
|
+
exports.getItemGroupFromMolding = getItemGroupFromMolding;
|
|
7
|
+
exports.getItemRect = getItemRect;
|
|
8
|
+
exports.getLinesFromItems = getLinesFromItems;
|
|
9
|
+
exports.getLinesFromItems2 = getLinesFromItems2;
|
|
10
|
+
exports.getLinesOfItem = getLinesOfItem;
|
|
11
|
+
exports.hasMoldingLayout = hasMoldingLayout;
|
|
12
|
+
exports.isEnableItemForMolding = isEnableItemForMolding;
|
|
13
|
+
exports.isItemSameItemByLocation = isItemSameItemByLocation;
|
|
14
|
+
exports.isItemSnappedGroup = isItemSnappedGroup;
|
|
15
|
+
exports.isItemSnappedItem = isItemSnappedItem;
|
|
16
|
+
exports.isLinesOverlapped = isLinesOverlapped;
|
|
17
|
+
exports.isSameMoldingLayoutpos = isSameMoldingLayoutpos;
|
|
18
|
+
exports.mergeOverlappedLines = mergeOverlappedLines;
|
|
19
|
+
exports.sortItemsByDistance = sortItemsByDistance;
|
|
20
|
+
exports.tryMergeMDItem = tryMergeMDItem;
|
|
21
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
22
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
23
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
|
|
24
|
+
var _constants = require("../constants");
|
|
25
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
26
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
27
|
+
var _idBroker = _interopRequireDefault(require("./id-broker"));
|
|
28
|
+
var _utils = require("../components/viewer2d/utils");
|
|
29
|
+
var _export = require("./export");
|
|
30
|
+
var _helper = require("./helper");
|
|
31
|
+
function getItemRect(item) {
|
|
16
32
|
var x = item.x;
|
|
17
33
|
var y = item.y;
|
|
18
34
|
var rotRad = item.rotation / 180 * Math.PI;
|
|
19
35
|
var itemWidth = item.properties.get('width').get('_length');
|
|
20
36
|
var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
21
|
-
itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
37
|
+
itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
22
38
|
var itemDepth = item.properties.get('depth').get('_length');
|
|
23
39
|
var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
24
|
-
itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
40
|
+
itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
25
41
|
var mx = x - itemWidth * Math.cos(rotRad);
|
|
26
42
|
var my = y - itemWidth * Math.sin(rotRad);
|
|
27
43
|
var x0 = mx + itemDepth * Math.sin(rotRad);
|
|
@@ -48,17 +64,17 @@ export function getItemRect(item) {
|
|
|
48
64
|
}]
|
|
49
65
|
};
|
|
50
66
|
}
|
|
51
|
-
|
|
67
|
+
function hasMoldingLayout(molding, layoutpos) {
|
|
52
68
|
var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
|
|
53
69
|
return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
|
|
54
70
|
}
|
|
55
|
-
|
|
71
|
+
function isEnableItemForMolding(layer, selItem) {
|
|
56
72
|
var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
57
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
58
|
-
var result = !isEmpty(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === BASE_CABINET_LAYOUTPOS && !GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === WALL_CABINET_LAYOUTPOS || selItem.layoutpos === TALL_CABINET_LAYOUTPOS) && GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
73
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
74
|
+
var result = !(0, _helper.isEmpty)(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && !_export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === _constants.WALL_CABINET_LAYOUTPOS || selItem.layoutpos === _constants.TALL_CABINET_LAYOUTPOS) && _export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
59
75
|
|
|
60
76
|
// check this item is enable for any molding
|
|
61
|
-
if (isEmpty(molding)) return result;
|
|
77
|
+
if ((0, _helper.isEmpty)(molding)) return result;
|
|
62
78
|
// check this item is enable for specified molding
|
|
63
79
|
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
64
80
|
}
|
|
@@ -82,66 +98,66 @@ function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
|
82
98
|
// GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
|
|
83
99
|
// GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
|
|
84
100
|
// )
|
|
85
|
-
Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
101
|
+
Math.abs(_export.GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + _export.GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - _export.GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - _export.GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
86
102
|
);
|
|
87
103
|
}
|
|
88
|
-
|
|
104
|
+
function isItemSnappedItem(selItem, curItem) {
|
|
89
105
|
var selRect = getItemRect(selItem).rect;
|
|
90
106
|
var curRect = getItemRect(curItem).rect;
|
|
91
|
-
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
|
|
92
|
-
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
|
|
93
|
-
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
|
|
94
|
-
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
|
|
95
|
-
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
|
|
107
|
+
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < _constants.EPSILON;
|
|
108
|
+
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
109
|
+
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < _constants.EPSILON;
|
|
110
|
+
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
111
|
+
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < _constants.EPSILON;
|
|
96
112
|
return flag30 || flag21 || flag23 || flag01 || flag03;
|
|
97
113
|
}
|
|
98
|
-
|
|
114
|
+
function isItemSnappedGroup(selItem, itemGroup) {
|
|
99
115
|
return itemGroup.some(function (curItem) {
|
|
100
116
|
return isItemSnappedItem(selItem, curItem);
|
|
101
117
|
});
|
|
102
118
|
}
|
|
103
|
-
|
|
119
|
+
function sortItemsByDistance(items, selItem) {
|
|
104
120
|
items.sort(function (a, b) {
|
|
105
|
-
return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
121
|
+
return _export.GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - _export.GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
106
122
|
});
|
|
107
123
|
return items;
|
|
108
124
|
}
|
|
109
|
-
|
|
110
|
-
return curItem.layoutpos === BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
125
|
+
function isSameMoldingLayoutpos(curItem, item) {
|
|
126
|
+
return curItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
111
127
|
}
|
|
112
|
-
|
|
128
|
+
function isItemSameItemByLocation(item1, item2, location) {
|
|
113
129
|
var item1Altitude = item1.properties.get('altitude').get('_length');
|
|
114
130
|
var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
|
|
115
|
-
item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
131
|
+
item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
116
132
|
var item1Height = item1.properties.get('height').get('_length');
|
|
117
133
|
var item1HeightUnit = item1.properties.get('height').get('_unit');
|
|
118
|
-
item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
|
|
134
|
+
item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
|
|
119
135
|
var item2Altitude = item2.properties.get('altitude').get('_length');
|
|
120
136
|
var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
|
|
121
|
-
item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
137
|
+
item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
122
138
|
var item2Height = item2.properties.get('height').get('_length');
|
|
123
139
|
var item2HeightUnit = item2.properties.get('height').get('_unit');
|
|
124
|
-
item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
|
|
140
|
+
item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
|
|
125
141
|
var flag = false;
|
|
126
142
|
switch (location) {
|
|
127
|
-
case TOP_MOLDING_LOCATION:
|
|
128
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
143
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
144
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
129
145
|
break;
|
|
130
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
131
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
146
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
147
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
132
148
|
break;
|
|
133
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
134
|
-
if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
149
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
150
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
135
151
|
break;
|
|
136
152
|
}
|
|
137
153
|
return flag;
|
|
138
154
|
}
|
|
139
|
-
|
|
155
|
+
function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
|
|
140
156
|
return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
|
|
141
157
|
return item.id === curItem.id;
|
|
142
158
|
}) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
|
|
143
159
|
}
|
|
144
|
-
|
|
160
|
+
function getItemGroupFromMolding(layer, curItem, molding) {
|
|
145
161
|
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
146
162
|
var itemGroup = [curItem];
|
|
147
163
|
var temp_layer_items = layer.items.toArray().filter(function (item) {
|
|
@@ -168,7 +184,7 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
|
|
|
168
184
|
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
169
185
|
* @returns MG array
|
|
170
186
|
*/
|
|
171
|
-
|
|
187
|
+
function getAllMoldingGroups(layer) {
|
|
172
188
|
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
173
189
|
if (items === null) items = layer.items.toArray();
|
|
174
190
|
var MGArray = [];
|
|
@@ -190,7 +206,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
190
206
|
return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
|
|
191
207
|
});
|
|
192
208
|
temp_items = sortItemsByDistance(temp_items, curItem);
|
|
193
|
-
MOLDING_LOCATIONS.forEach(function (location) {
|
|
209
|
+
_constants.MOLDING_LOCATIONS.forEach(function (location) {
|
|
194
210
|
if (!MGArray.some(function (mg) {
|
|
195
211
|
return mg.items.some(function (it) {
|
|
196
212
|
return it.id === curItem.id;
|
|
@@ -213,7 +229,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
213
229
|
}
|
|
214
230
|
} while (isChangedItemGroup);
|
|
215
231
|
MGArray.push({
|
|
216
|
-
id:
|
|
232
|
+
id: _idBroker["default"].acquireID(),
|
|
217
233
|
items: itemGroup,
|
|
218
234
|
location_type: location,
|
|
219
235
|
molding: null,
|
|
@@ -230,18 +246,18 @@ export function getAllMoldingGroups(layer) {
|
|
|
230
246
|
});
|
|
231
247
|
return MGArray;
|
|
232
248
|
}
|
|
233
|
-
|
|
249
|
+
function getLinesOfItem(item, allLineRects, catalog) {
|
|
234
250
|
var lines = [];
|
|
235
251
|
var outline = null;
|
|
236
252
|
var element = catalog.elements[item.get('type')];
|
|
237
|
-
if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
|
|
253
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
238
254
|
// get edge lines
|
|
239
255
|
var newWidth = item.properties.get('width').get('_length');
|
|
240
256
|
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
241
|
-
newWidth = convert(newWidth).from(wUnit).to('cm');
|
|
257
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
|
|
242
258
|
var newDepth = item.properties.get('depth').get('_length');
|
|
243
259
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
244
|
-
newDepth = convert(newDepth).from(hUnit).to('cm');
|
|
260
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
245
261
|
if (item) {
|
|
246
262
|
// Get Outline Data of Selected Item
|
|
247
263
|
outline = element.info.outline;
|
|
@@ -251,12 +267,12 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
251
267
|
var outlineWidth = outline.svgWidth;
|
|
252
268
|
var outlineHeight = outline.svgHeight;
|
|
253
269
|
var outlinePoints = []; // Hold Points Of SVG
|
|
254
|
-
var _iterator =
|
|
270
|
+
var _iterator = (0, _createForOfIteratorHelper2["default"])(outlinePaths),
|
|
255
271
|
_step;
|
|
256
272
|
try {
|
|
257
273
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
258
274
|
var path = _step.value;
|
|
259
|
-
var _iterator2 =
|
|
275
|
+
var _iterator2 = (0, _createForOfIteratorHelper2["default"])(path.subPaths),
|
|
260
276
|
_step2;
|
|
261
277
|
try {
|
|
262
278
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -276,18 +292,18 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
276
292
|
}
|
|
277
293
|
outline.reverse && outlinePoints.reverse();
|
|
278
294
|
for (var i = 0; i < outlinePoints.length - 1; i++) {
|
|
279
|
-
lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90),
|
|
295
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _idBroker["default"].acquireID()]);
|
|
280
296
|
}
|
|
281
297
|
} else {
|
|
282
298
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
283
299
|
for (var _i = 0; _i < 4; _i++) {
|
|
284
|
-
lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation),
|
|
300
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _export.GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _idBroker["default"].acquireID()]);
|
|
285
301
|
}
|
|
286
302
|
}
|
|
287
303
|
}
|
|
288
|
-
if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
|
|
304
|
+
if (item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) {
|
|
289
305
|
lines = lines.filter(function (line) {
|
|
290
|
-
return !GeometryUtils.isSnappedLine({
|
|
306
|
+
return !_export.GeometryUtils.isSnappedLine({
|
|
291
307
|
rect: [{
|
|
292
308
|
x: 0,
|
|
293
309
|
y: 0
|
|
@@ -302,29 +318,29 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
302
318
|
}
|
|
303
319
|
function isParallelLines(line1, line2) {
|
|
304
320
|
var isParallel = false;
|
|
305
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
306
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
307
|
-
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= EPSILON) isParallel = true;
|
|
321
|
+
if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
|
|
322
|
+
if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
|
|
323
|
+
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= _constants.EPSILON) isParallel = true;
|
|
308
324
|
if (isParallel) {
|
|
309
325
|
return true;
|
|
310
326
|
}
|
|
311
327
|
return false;
|
|
312
328
|
}
|
|
313
|
-
|
|
329
|
+
function isLinesOverlapped(line1, line2) {
|
|
314
330
|
return isParallelLines(line1, line2) && line1.some(function (l1) {
|
|
315
331
|
return line2.some(function (l2) {
|
|
316
|
-
return GeometryUtils.samePoints(l1, l2);
|
|
332
|
+
return _export.GeometryUtils.samePoints(l1, l2);
|
|
317
333
|
});
|
|
318
334
|
});
|
|
319
335
|
}
|
|
320
|
-
|
|
336
|
+
function mergeOverlappedLines(line1, line2) {
|
|
321
337
|
var line1_idx = 0,
|
|
322
338
|
line2_idx = 0;
|
|
323
339
|
line1.forEach(function (l1, idx1) {
|
|
324
340
|
if (idx1 !== line1.length - 1) {
|
|
325
341
|
line2.forEach(function (l2, idx2) {
|
|
326
342
|
if (idx2 !== line2.length - 1) {
|
|
327
|
-
if (GeometryUtils.samePoints(l1, l2)) {
|
|
343
|
+
if (_export.GeometryUtils.samePoints(l1, l2)) {
|
|
328
344
|
line1_idx = idx1;
|
|
329
345
|
line2_idx = idx2;
|
|
330
346
|
}
|
|
@@ -335,9 +351,9 @@ export function mergeOverlappedLines(line1, line2) {
|
|
|
335
351
|
//If line1 's end point and line2 's start point is same, two lines merge into a line with
|
|
336
352
|
//the line1's start point as the start point and line2's end point as the end point.
|
|
337
353
|
if (line1_idx === 1) {
|
|
338
|
-
return [line1[1 - line1_idx], line2[1 - line2_idx],
|
|
354
|
+
return [line1[1 - line1_idx], line2[1 - line2_idx], _idBroker["default"].acquireID()];
|
|
339
355
|
} else {
|
|
340
|
-
return [line2[1 - line2_idx], line1[1 - line1_idx],
|
|
356
|
+
return [line2[1 - line2_idx], line1[1 - line1_idx], _idBroker["default"].acquireID()];
|
|
341
357
|
}
|
|
342
358
|
}
|
|
343
359
|
|
|
@@ -348,12 +364,12 @@ export function mergeOverlappedLines(line1, line2) {
|
|
|
348
364
|
* @param {*} catalog
|
|
349
365
|
* @returns contour line array of moldingGroup items
|
|
350
366
|
*/
|
|
351
|
-
|
|
367
|
+
function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
352
368
|
// wall lines
|
|
353
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
369
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
354
370
|
var MGlines = [];
|
|
355
371
|
var MGlinesOtherSnapped = [];
|
|
356
|
-
var items =
|
|
372
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
357
373
|
// The other item's lines (these items are snapped to the moldingGroup items)
|
|
358
374
|
var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
|
|
359
375
|
if (items.some(function (it) {
|
|
@@ -363,17 +379,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
363
379
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
364
380
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
365
381
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
366
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
382
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
367
383
|
var itemHeight = item.properties.get('height').get('_length');
|
|
368
384
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
369
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
385
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
370
386
|
itemLines.forEach(function (line) {
|
|
371
387
|
line.push({
|
|
372
388
|
altitude: itemAltitude,
|
|
373
389
|
height: itemHeight
|
|
374
390
|
});
|
|
375
391
|
});
|
|
376
|
-
MGlinesOtherSnapped = [].concat(
|
|
392
|
+
MGlinesOtherSnapped = [].concat((0, _toConsumableArray2["default"])(MGlinesOtherSnapped), (0, _toConsumableArray2["default"])(itemLines));
|
|
377
393
|
return true;
|
|
378
394
|
} else return false;
|
|
379
395
|
});
|
|
@@ -382,10 +398,10 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
382
398
|
items.forEach(function (item) {
|
|
383
399
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
384
400
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
385
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
401
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
386
402
|
var itemHeight = item.properties.get('height').get('_length');
|
|
387
403
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
388
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
404
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
389
405
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
390
406
|
|
|
391
407
|
// remove the edge that overlapped with other snapped items
|
|
@@ -400,17 +416,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
400
416
|
for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
|
|
401
417
|
var bCheck = false;
|
|
402
418
|
switch (moldingGroup.location_type) {
|
|
403
|
-
case TOP_MOLDING_LOCATION:
|
|
419
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
404
420
|
bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
|
|
405
421
|
break;
|
|
406
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
422
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
407
423
|
bCheck = true;
|
|
408
424
|
break;
|
|
409
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
425
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
410
426
|
bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
|
|
411
427
|
break;
|
|
412
428
|
}
|
|
413
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
429
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
414
430
|
if (bCheck) {
|
|
415
431
|
var destLine = {
|
|
416
432
|
x1: MGlinesOtherSnapped[j][0].x,
|
|
@@ -418,8 +434,8 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
418
434
|
x2: MGlinesOtherSnapped[j][1].x,
|
|
419
435
|
y2: MGlinesOtherSnapped[j][1].y
|
|
420
436
|
};
|
|
421
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
422
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
437
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
438
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
423
439
|
ret = false;
|
|
424
440
|
break;
|
|
425
441
|
}
|
|
@@ -427,7 +443,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
427
443
|
}
|
|
428
444
|
return ret;
|
|
429
445
|
});
|
|
430
|
-
MGlines = [].concat(
|
|
446
|
+
MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(itemLines));
|
|
431
447
|
});
|
|
432
448
|
|
|
433
449
|
// Filtering overlapped edges and get contour edges
|
|
@@ -448,16 +464,16 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
448
464
|
x2: MGlines[j][1].x,
|
|
449
465
|
y2: MGlines[j][1].y
|
|
450
466
|
};
|
|
451
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
452
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
467
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
468
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
453
469
|
removeLineIds.push(i);
|
|
454
470
|
return 1; // break
|
|
455
|
-
} else if (rst.result === OVERLAP_SOME) {
|
|
471
|
+
} else if (rst.result === _constants.OVERLAP_SOME) {
|
|
456
472
|
removeLineIds.push(i);
|
|
457
473
|
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
|
|
458
474
|
return idx !== i && idx !== j;
|
|
459
475
|
}), 0);
|
|
460
|
-
if (lineSegs.length > 0) newLines = [].concat(
|
|
476
|
+
if (lineSegs.length > 0) newLines = [].concat((0, _toConsumableArray2["default"])(newLines), (0, _toConsumableArray2["default"])(lineSegs));
|
|
461
477
|
return 1; // break
|
|
462
478
|
}
|
|
463
479
|
},
|
|
@@ -476,7 +492,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
476
492
|
return idx === id;
|
|
477
493
|
});
|
|
478
494
|
});
|
|
479
|
-
if (newLines.length > 0) MGlines = [].concat(
|
|
495
|
+
if (newLines.length > 0) MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(newLines));
|
|
480
496
|
|
|
481
497
|
// merge the collinear linked lines to one line
|
|
482
498
|
var newMGlines = [];
|
|
@@ -536,15 +552,15 @@ function getMergedLine(line, MGlines, cnt) {
|
|
|
536
552
|
x2: newMGlines[i][1].x,
|
|
537
553
|
y2: newMGlines[i][1].y
|
|
538
554
|
};
|
|
539
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
540
|
-
if (rst.result === OVERLAP_LINK) {
|
|
555
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
556
|
+
if (rst.result === _constants.OVERLAP_LINK) {
|
|
541
557
|
var mergedLine = [{
|
|
542
558
|
x: rst.linkedLine.x1,
|
|
543
559
|
y: rst.linkedLine.y1
|
|
544
560
|
}, {
|
|
545
561
|
x: rst.linkedLine.x2,
|
|
546
562
|
y: rst.linkedLine.y2
|
|
547
|
-
},
|
|
563
|
+
}, _idBroker["default"].acquireID()];
|
|
548
564
|
mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
|
|
549
565
|
return idx !== i;
|
|
550
566
|
}), cnt);
|
|
@@ -589,15 +605,15 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
589
605
|
x2: otherLines[j][1].x,
|
|
590
606
|
y2: otherLines[j][1].y
|
|
591
607
|
};
|
|
592
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
593
|
-
if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
|
|
608
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
609
|
+
if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
|
|
594
610
|
bContourSeg = false;
|
|
595
611
|
return 0; // break
|
|
596
|
-
} else if (rst.result == OVERLAP_SOME) {
|
|
612
|
+
} else if (rst.result == _constants.OVERLAP_SOME) {
|
|
597
613
|
var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
|
|
598
614
|
return idx !== j;
|
|
599
615
|
}), cnt);
|
|
600
|
-
if (tLineSegs.length > 0) returnSegs = [].concat(
|
|
616
|
+
if (tLineSegs.length > 0) returnSegs = [].concat((0, _toConsumableArray2["default"])(returnSegs), (0, _toConsumableArray2["default"])(tLineSegs));
|
|
601
617
|
bContourSeg = false;
|
|
602
618
|
return 0; // break
|
|
603
619
|
}
|
|
@@ -613,7 +629,7 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
613
629
|
}, {
|
|
614
630
|
x: lineSegs[i].x2,
|
|
615
631
|
y: lineSegs[i].y2
|
|
616
|
-
},
|
|
632
|
+
}, _idBroker["default"].acquireID()]);
|
|
617
633
|
}
|
|
618
634
|
return returnSegs;
|
|
619
635
|
} catch (e) {
|
|
@@ -621,9 +637,9 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
621
637
|
return [];
|
|
622
638
|
}
|
|
623
639
|
}
|
|
624
|
-
|
|
625
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
626
|
-
var items =
|
|
640
|
+
function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
641
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
642
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
627
643
|
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
628
644
|
items = sortItemsByDistance(items, items[0]);
|
|
629
645
|
var _loop7 = function _loop7() {
|
|
@@ -635,7 +651,7 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
635
651
|
});
|
|
636
652
|
var curItemLine = itemLines[idx];
|
|
637
653
|
if (idx > -1) {
|
|
638
|
-
if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
654
|
+
if (!(_export.GeometryUtils.samePoints(line[0], curItemLine[0]) && _export.GeometryUtils.samePoints(line[1], curItemLine[1]) || _export.GeometryUtils.samePoints(line[0], curItemLine[1]) && _export.GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
639
655
|
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
640
656
|
temp_MGLines.push(MGLine);
|
|
641
657
|
}
|
|
@@ -662,29 +678,29 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
662
678
|
snapped_other_items.forEach(function (item) {
|
|
663
679
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
664
680
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
665
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
681
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
666
682
|
var itemHeight = item.properties.get('height').get('_length');
|
|
667
683
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
668
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
684
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
669
685
|
var mgroupAltitude = items[0].properties.get('altitude').get('_length');
|
|
670
686
|
var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
|
|
671
|
-
mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
687
|
+
mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
672
688
|
var mgroupHeight = items[0].properties.get('height').get('_length');
|
|
673
689
|
var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
|
|
674
|
-
mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
690
|
+
mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
675
691
|
var flag = false;
|
|
676
692
|
switch (moldingGroup.location_type) {
|
|
677
|
-
case TOP_MOLDING_LOCATION:
|
|
693
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
678
694
|
flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
|
|
679
695
|
break;
|
|
680
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
696
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
681
697
|
flag = true;
|
|
682
698
|
break;
|
|
683
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
699
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
684
700
|
flag = itemAltitude < mgroupAltitude;
|
|
685
701
|
break;
|
|
686
702
|
}
|
|
687
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
703
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
688
704
|
if (flag) {
|
|
689
705
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
690
706
|
var temp_MGLines = [];
|
|
@@ -694,8 +710,8 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
694
710
|
});
|
|
695
711
|
var curITL = itemLines[idx];
|
|
696
712
|
if (idx > -1) {
|
|
697
|
-
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
|
|
698
|
-
if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
713
|
+
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < _constants.EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < _constants.EPSILON) {
|
|
714
|
+
if (_export.GeometryUtils.verticesDistance(mgl[0], mgl[1]) > _export.GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
699
715
|
var MGLine = mergeOverlappedLines(mgl, curITL);
|
|
700
716
|
temp_MGLines.push(MGLine);
|
|
701
717
|
}
|
|
@@ -713,7 +729,7 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
713
729
|
return MGlines;
|
|
714
730
|
}
|
|
715
731
|
function getMDPoints(newMD) {
|
|
716
|
-
if (newMD.lines.length < 1) return
|
|
732
|
+
if (newMD.lines.length < 1) return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD), {}, {
|
|
717
733
|
pointGroups: []
|
|
718
734
|
});
|
|
719
735
|
// let maxX = newMD.lines[0][0].x,
|
|
@@ -751,13 +767,13 @@ function getMDPoints(newMD) {
|
|
|
751
767
|
x: (maxX + minX) / 2,
|
|
752
768
|
y: (maxY + minY) / 2
|
|
753
769
|
};
|
|
754
|
-
var newSize =
|
|
770
|
+
var newSize = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD.size), {}, {
|
|
755
771
|
width: maxX - minX,
|
|
756
772
|
depth: maxY - minY
|
|
757
773
|
});
|
|
758
774
|
|
|
759
775
|
// get vertex points
|
|
760
|
-
var MDlines =
|
|
776
|
+
var MDlines = (0, _toConsumableArray2["default"])(newMD.lines);
|
|
761
777
|
var pointGroups = [[]];
|
|
762
778
|
var flag = 1;
|
|
763
779
|
var i = 0;
|
|
@@ -769,10 +785,10 @@ function getMDPoints(newMD) {
|
|
|
769
785
|
if (flag) {
|
|
770
786
|
var lastPoint = pointGroups[i][pointGroups[i].length - 1];
|
|
771
787
|
var res = MDlines.findIndex(function (a) {
|
|
772
|
-
return GeometryUtils.samePoints({
|
|
788
|
+
return _export.GeometryUtils.samePoints({
|
|
773
789
|
x: a[0].x - cPos.x,
|
|
774
790
|
y: a[0].y - cPos.y
|
|
775
|
-
}, lastPoint) || GeometryUtils.samePoints({
|
|
791
|
+
}, lastPoint) || _export.GeometryUtils.samePoints({
|
|
776
792
|
x: a[1].x - cPos.x,
|
|
777
793
|
y: a[1].y - cPos.y
|
|
778
794
|
}, lastPoint);
|
|
@@ -782,7 +798,7 @@ function getMDPoints(newMD) {
|
|
|
782
798
|
x: MDlines[res][0].x - cPos.x,
|
|
783
799
|
y: MDlines[res][0].y - cPos.y
|
|
784
800
|
};
|
|
785
|
-
if (GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
801
|
+
if (_export.GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
786
802
|
newPos = {
|
|
787
803
|
x: MDlines[res][1].x - cPos.x,
|
|
788
804
|
y: MDlines[res][1].y - cPos.y
|
|
@@ -796,10 +812,10 @@ function getMDPoints(newMD) {
|
|
|
796
812
|
} else {
|
|
797
813
|
var firstPoint = pointGroups[i][0];
|
|
798
814
|
var _res = MDlines.findIndex(function (a) {
|
|
799
|
-
return GeometryUtils.samePoints({
|
|
815
|
+
return _export.GeometryUtils.samePoints({
|
|
800
816
|
x: a[0].x - cPos.x,
|
|
801
817
|
y: a[0].y - cPos.y
|
|
802
|
-
}, firstPoint) || GeometryUtils.samePoints({
|
|
818
|
+
}, firstPoint) || _export.GeometryUtils.samePoints({
|
|
803
819
|
x: a[1].x - cPos.x,
|
|
804
820
|
y: a[1].y - cPos.y
|
|
805
821
|
}, firstPoint);
|
|
@@ -809,13 +825,13 @@ function getMDPoints(newMD) {
|
|
|
809
825
|
x: MDlines[_res][0].x - cPos.x,
|
|
810
826
|
y: MDlines[_res][0].y - cPos.y
|
|
811
827
|
};
|
|
812
|
-
if (GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
828
|
+
if (_export.GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
813
829
|
_newPos = {
|
|
814
830
|
x: MDlines[_res][1].x - cPos.x,
|
|
815
831
|
y: MDlines[_res][1].y - cPos.y
|
|
816
832
|
};
|
|
817
833
|
}
|
|
818
|
-
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(
|
|
834
|
+
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat((0, _toConsumableArray2["default"])(pointGroups[i]));
|
|
819
835
|
MDlines.splice(_res, 1);
|
|
820
836
|
} else {
|
|
821
837
|
flag = 1;
|
|
@@ -830,33 +846,33 @@ function getMDPoints(newMD) {
|
|
|
830
846
|
}
|
|
831
847
|
var z = newMD.items[0].properties.get('altitude').get('_length');
|
|
832
848
|
var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
|
|
833
|
-
z = convert(z).from(zUnit).to('cm');
|
|
849
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
834
850
|
var height = newMD.items[0].properties.get('height').get('_length');
|
|
835
851
|
var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
|
|
836
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
852
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
837
853
|
switch (newMD.location_type) {
|
|
838
|
-
case TOP_MOLDING_LOCATION:
|
|
854
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
839
855
|
z += height;
|
|
840
856
|
break;
|
|
841
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
857
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
842
858
|
z += height / 2;
|
|
843
859
|
break;
|
|
844
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
860
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
845
861
|
z += 0;
|
|
846
862
|
break;
|
|
847
863
|
default:
|
|
848
864
|
break;
|
|
849
865
|
}
|
|
850
|
-
return
|
|
866
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD), {}, {
|
|
851
867
|
pointGroups: pointGroups,
|
|
852
|
-
pos:
|
|
868
|
+
pos: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, cPos), {}, {
|
|
853
869
|
z: z
|
|
854
870
|
}),
|
|
855
871
|
size: newSize
|
|
856
872
|
});
|
|
857
873
|
}
|
|
858
|
-
|
|
859
|
-
var newMG =
|
|
874
|
+
function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
875
|
+
var newMG = (0, _objectSpread2["default"])({}, oldMG);
|
|
860
876
|
newMG.molding = molding;
|
|
861
877
|
newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
|
|
862
878
|
newMG.lines.reverse();
|