kitchen-simulator 1.1.1-test.48 → 1.1.1-test.49
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/lib/KitchenConfiguratorApp.js +3 -0
- package/package.json +1 -1
- package/es/@history.js +0 -2
- package/es/AppContext.js +0 -3
- package/es/KitchenConfigurator.js +0 -645
- package/es/KitchenConfiguratorApp.js +0 -478
- package/es/actions/area-actions.js +0 -14
- package/es/actions/export.js +0 -23
- package/es/actions/groups-actions.js +0 -89
- package/es/actions/holes-actions.js +0 -119
- package/es/actions/items-actions.js +0 -313
- package/es/actions/lines-actions.js +0 -81
- package/es/actions/project-actions.js +0 -281
- package/es/actions/scene-actions.js +0 -33
- package/es/actions/vertices-actions.js +0 -27
- package/es/actions/viewer2d-actions.js +0 -58
- package/es/actions/viewer3d-actions.js +0 -23
- package/es/catalog/areas/area/planner-element.js +0 -40
- package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
- package/es/catalog/areas/area/textures/grass.jpg +0 -0
- package/es/catalog/areas/area/textures/parquet.jpg +0 -0
- package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
- package/es/catalog/areas/area/textures/tile1.jpg +0 -0
- package/es/catalog/catalog.js +0 -277
- package/es/catalog/envMap/nx.hdr +0 -0
- package/es/catalog/envMap/ny.hdr +0 -0
- package/es/catalog/envMap/nz.hdr +0 -0
- package/es/catalog/envMap/px.hdr +0 -0
- package/es/catalog/envMap/py.hdr +0 -0
- package/es/catalog/envMap/pz.hdr +0 -0
- package/es/catalog/factories/area-factory-3d.js +0 -181
- package/es/catalog/factories/area-factory.js +0 -81
- package/es/catalog/factories/export.js +0 -7
- package/es/catalog/factories/wall-factory-3d.js +0 -202
- package/es/catalog/factories/wall-factory.js +0 -268
- package/es/catalog/holes/door-closet/planner-element.js +0 -222
- package/es/catalog/holes/door-double/door_double.png +0 -0
- package/es/catalog/holes/door-double/planner-element.js +0 -315
- package/es/catalog/holes/door-exterior/planner-element.js +0 -215
- package/es/catalog/holes/door-interior/planner-element.js +0 -227
- package/es/catalog/holes/door-panic/panicDoor.png +0 -0
- package/es/catalog/holes/door-panic/planner-element.js +0 -503
- package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
- package/es/catalog/holes/door-panic-double/planner-element.js +0 -463
- package/es/catalog/holes/door-sliding/planner-element.js +0 -225
- package/es/catalog/holes/doorway-framed/planner-element.js +0 -145
- package/es/catalog/holes/doorway-frameless/planner-element.js +0 -104
- package/es/catalog/holes/export.js +0 -13
- package/es/catalog/holes/gate/gate.jpg +0 -0
- package/es/catalog/holes/window-clear/planner-element.js +0 -166
- package/es/catalog/holes/window-clear/texture.png +0 -0
- package/es/catalog/holes/window-cross/planner-element.js +0 -165
- package/es/catalog/holes/window-cross/texture.png +0 -0
- package/es/catalog/holes/window-double-hung/planner-element.js +0 -303
- package/es/catalog/holes/window-double-hung/texture.png +0 -0
- package/es/catalog/holes/window-vertical/planner-element.js +0 -276
- package/es/catalog/holes/window-vertical/texture.png +0 -0
- package/es/catalog/lines/wall/planner-element.js +0 -70
- package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
- package/es/catalog/lines/wall/wall.png +0 -0
- package/es/catalog/molding/molding-dcm/planner-element.js +0 -28
- package/es/catalog/molding/molding-dcm/texture.png +0 -0
- package/es/catalog/molding/molding-fbm/planner-element.js +0 -28
- package/es/catalog/molding/molding-fbm/texture.png +0 -0
- package/es/catalog/molding/molding-lrm/planner-element.js +0 -28
- package/es/catalog/molding/molding-lrm/texture.png +0 -0
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -116
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -97
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -101
- package/es/catalog/properties/property-length-measure.js +0 -134
- package/es/catalog/properties/property-length-measure_hole.js +0 -101
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/catalog/utils/FuseUtils.js +0 -82
- package/es/catalog/utils/exporter.js +0 -148
- package/es/catalog/utils/geom-utils.js +0 -189
- package/es/catalog/utils/item-loader.js +0 -1521
- package/es/catalog/utils/load-obj.js +0 -91
- package/es/catalog/utils/mtl-loader.js +0 -358
- package/es/catalog/utils/obj-loader.js +0 -477
- package/es/class/FuseUtils.js +0 -82
- package/es/class/area.js +0 -145
- package/es/class/export.js +0 -24
- package/es/class/group.js +0 -440
- package/es/class/guide.js +0 -62
- package/es/class/hole.js +0 -929
- package/es/class/item.js +0 -1883
- package/es/class/layer.js +0 -667
- package/es/class/line.js +0 -1180
- package/es/class/project.js +0 -793
- package/es/class/vertex.js +0 -202
- package/es/components/content.js +0 -107
- package/es/components/disclaimer/disclaimer.js +0 -97
- package/es/components/export.js +0 -9
- package/es/components/style/button.js +0 -113
- package/es/components/style/cancel-button.js +0 -22
- package/es/components/style/content-container.js +0 -33
- package/es/components/style/content-title.js +0 -29
- package/es/components/style/delete-button.js +0 -25
- package/es/components/style/export.js +0 -31
- package/es/components/style/form-block.js +0 -24
- package/es/components/style/form-color-input.js +0 -27
- package/es/components/style/form-label.js +0 -26
- package/es/components/style/form-number-input.js +0 -213
- package/es/components/style/form-number-input_2.js +0 -206
- package/es/components/style/form-select.js +0 -68
- package/es/components/style/form-slider.js +0 -61
- package/es/components/style/form-submit-button.js +0 -26
- package/es/components/style/form-text-input.js +0 -95
- package/es/components/viewer2d/area.js +0 -81
- package/es/components/viewer2d/export.js +0 -31
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -37
- package/es/components/viewer2d/grids/grids.js +0 -35
- package/es/components/viewer2d/group.js +0 -53
- package/es/components/viewer2d/item.js +0 -513
- package/es/components/viewer2d/layer.js +0 -164
- package/es/components/viewer2d/line.js +0 -882
- package/es/components/viewer2d/ruler.js +0 -100
- package/es/components/viewer2d/rulerDist.js +0 -146
- package/es/components/viewer2d/rulerX.js +0 -151
- package/es/components/viewer2d/rulerY.js +0 -153
- package/es/components/viewer2d/scene.js +0 -140
- package/es/components/viewer2d/snap.js +0 -74
- package/es/components/viewer2d/state.js +0 -78
- package/es/components/viewer2d/utils.js +0 -198
- package/es/components/viewer2d/vertex.js +0 -65
- package/es/components/viewer2d/viewer2d.js +0 -1398
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2592
- package/es/components/viewer3d/dcm.js +0 -401
- package/es/components/viewer3d/fbm.js +0 -414
- package/es/components/viewer3d/front3D.js +0 -66
- package/es/components/viewer3d/grid-creator.js +0 -25
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +0 -36
- package/es/components/viewer3d/grids/grid-streak.js +0 -27
- package/es/components/viewer3d/grids/grid-vertical-streak.js +0 -36
- package/es/components/viewer3d/libs/first-person-controls.js +0 -67
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1281
- package/es/components/viewer3d/libs/mtl-loader.js +0 -357
- package/es/components/viewer3d/libs/obj-loader.js +0 -462
- package/es/components/viewer3d/libs/orbit-controls.js +0 -699
- package/es/components/viewer3d/libs/pointer-lock-controls.js +0 -46
- package/es/components/viewer3d/lrm.js +0 -305
- package/es/components/viewer3d/model.js +0 -708
- package/es/components/viewer3d/pointer-lock-navigation.js +0 -115
- package/es/components/viewer3d/ruler-utils/itemRect.js +0 -61
- package/es/components/viewer3d/ruler-utils/layer3D.js +0 -495
- package/es/components/viewer3d/ruler-utils/ruler3D.js +0 -227
- package/es/components/viewer3d/ruler-utils/scene3D.js +0 -60
- package/es/components/viewer3d/ruler-utils/state3D.js +0 -18
- package/es/components/viewer3d/scene-creator.js +0 -3608
- package/es/components/viewer3d/three-memory-cleaner.js +0 -51
- package/es/components/viewer3d/viewer3d-first-person.js +0 -315
- package/es/components/viewer3d/viewer3d.js +0 -2527
- package/es/constants.js +0 -636
- package/es/index.js +0 -16
- package/es/models.js +0 -510
- package/es/plugins/SVGLoader.js +0 -1412
- package/es/plugins/autosave.js +0 -33
- package/es/plugins/console-debugger.js +0 -37
- package/es/plugins/export.js +0 -9
- package/es/plugins/keyboard.js +0 -101
- package/es/reducers/areas-reducer.js +0 -12
- package/es/reducers/export.js +0 -25
- package/es/reducers/groups-reducer.js +0 -38
- package/es/reducers/holes-reducer.js +0 -62
- package/es/reducers/items-reducer.js +0 -140
- package/es/reducers/lines-reducer.js +0 -45
- package/es/reducers/project-reducer.js +0 -129
- package/es/reducers/reducer.js +0 -19
- package/es/reducers/scene-reducer.js +0 -28
- package/es/reducers/user-reducer.js +0 -40
- package/es/reducers/vertices-reducer.js +0 -19
- package/es/reducers/viewer2d-reducer.js +0 -75
- package/es/reducers/viewer3d-reducer.js +0 -56
- package/es/shared-style.js +0 -66
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/es/translator/en.js +0 -104
- package/es/translator/it.js +0 -79
- package/es/translator/ru.js +0 -79
- package/es/translator/translator.js +0 -84
- package/es/utils/browser.js +0 -33
- package/es/utils/email-validator.js +0 -4
- package/es/utils/export.js +0 -25
- package/es/utils/geometry.js +0 -2420
- package/es/utils/get-edges-of-subgraphs.js +0 -27
- package/es/utils/graph-cycles.js +0 -237
- package/es/utils/graph-inner-cycles.js +0 -46
- package/es/utils/graph.js +0 -150
- package/es/utils/helper.js +0 -268
- package/es/utils/history.js +0 -29
- package/es/utils/id-broker.js +0 -19
- package/es/utils/logger.js +0 -8
- package/es/utils/math.js +0 -50
- package/es/utils/molding.js +0 -871
- package/es/utils/name-generator.js +0 -18
- package/es/utils/objects-utils.js +0 -50
- package/es/utils/phone-validator.js +0 -4
- package/es/utils/process-black-list.js +0 -18
- package/es/utils/react-if.js +0 -18
- package/es/utils/snap-scene.js +0 -99
- package/es/utils/snap.js +0 -237
- package/es/utils/summarizeCart.js +0 -24
- package/es/utils/threeCSG.es6.js +0 -498
- package/es/version.js +0 -2
- package/lib/catalog/properties/property-string.js +0 -55
- package/lib/catalog/properties/property-toggle.js +0 -46
- package/lib/catalog/properties/shared-property-style.js +0 -20
- package/lib/catalog/utils/FuseUtils.js +0 -88
- package/lib/catalog/utils/exporter.js +0 -155
- package/lib/catalog/utils/geom-utils.js +0 -205
- package/lib/catalog/utils/item-loader.js +0 -1533
- package/lib/catalog/utils/load-obj.js +0 -99
- package/lib/catalog/utils/mtl-loader.js +0 -363
- package/lib/catalog/utils/obj-loader.js +0 -482
- package/lib/class/FuseUtils.js +0 -88
- package/lib/class/area.js +0 -150
- package/lib/class/export.js +0 -96
- package/lib/class/group.js +0 -445
- package/lib/class/guide.js +0 -67
- package/lib/class/hole.js +0 -934
- package/lib/class/item.js +0 -1889
- package/lib/class/layer.js +0 -672
- package/lib/class/line.js +0 -1186
- package/lib/class/project.js +0 -799
- package/lib/class/vertex.js +0 -207
- package/lib/components/content.js +0 -116
- package/lib/components/disclaimer/disclaimer.js +0 -105
- package/lib/components/export.js +0 -33
- package/lib/components/style/button.js +0 -120
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -40
- package/lib/components/style/content-title.js +0 -37
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/export.js +0 -121
- package/lib/components/style/form-block.js +0 -31
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -33
- package/lib/components/style/form-number-input.js +0 -220
- package/lib/components/style/form-number-input_2.js +0 -213
- package/lib/components/style/form-select.js +0 -75
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-submit-button.js +0 -35
- package/lib/components/style/form-text-input.js +0 -101
- package/lib/components/viewer2d/area.js +0 -88
- package/lib/components/viewer2d/export.js +0 -121
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer2d/grids/grids.js +0 -44
- package/lib/components/viewer2d/group.js +0 -62
- package/lib/components/viewer2d/item.js +0 -521
- package/lib/components/viewer2d/layer.js +0 -171
- package/lib/components/viewer2d/line.js +0 -892
- package/lib/components/viewer2d/ruler.js +0 -107
- package/lib/components/viewer2d/rulerDist.js +0 -153
- package/lib/components/viewer2d/rulerX.js +0 -158
- package/lib/components/viewer2d/rulerY.js +0 -160
- package/lib/components/viewer2d/scene.js +0 -147
- package/lib/components/viewer2d/snap.js +0 -83
- package/lib/components/viewer2d/state.js +0 -87
- package/lib/components/viewer2d/utils.js +0 -210
- package/lib/components/viewer2d/vertex.js +0 -74
- package/lib/components/viewer2d/viewer2d.js +0 -1405
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2597
- package/lib/components/viewer3d/dcm.js +0 -407
- package/lib/components/viewer3d/fbm.js +0 -420
- package/lib/components/viewer3d/front3D.js +0 -75
- package/lib/components/viewer3d/grid-creator.js +0 -34
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer3d/grids/grid-streak.js +0 -35
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer3d/libs/first-person-controls.js +0 -74
- package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1287
- package/lib/components/viewer3d/libs/mtl-loader.js +0 -363
- package/lib/components/viewer3d/libs/obj-loader.js +0 -468
- package/lib/components/viewer3d/libs/orbit-controls.js +0 -705
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +0 -52
- package/lib/components/viewer3d/lrm.js +0 -311
- package/lib/components/viewer3d/model.js +0 -714
- package/lib/components/viewer3d/pointer-lock-navigation.js +0 -122
- package/lib/components/viewer3d/ruler-utils/itemRect.js +0 -68
- package/lib/components/viewer3d/ruler-utils/layer3D.js +0 -502
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +0 -234
- package/lib/components/viewer3d/ruler-utils/scene3D.js +0 -68
- package/lib/components/viewer3d/ruler-utils/state3D.js +0 -25
- package/lib/components/viewer3d/scene-creator.js +0 -3642
- package/lib/components/viewer3d/three-memory-cleaner.js +0 -60
- package/lib/components/viewer3d/viewer3d-first-person.js +0 -320
- package/lib/components/viewer3d/viewer3d.js +0 -2532
- package/lib/constants.js +0 -645
- package/lib/index.js +0 -96
- package/lib/models.js +0 -517
- package/lib/plugins/SVGLoader.js +0 -1417
- package/lib/plugins/autosave.js +0 -39
- package/lib/plugins/console-debugger.js +0 -44
- package/lib/plugins/export.js +0 -33
- package/lib/plugins/keyboard.js +0 -107
- package/lib/reducers/areas-reducer.js +0 -18
- package/lib/reducers/export.js +0 -97
- package/lib/reducers/groups-reducer.js +0 -44
- package/lib/reducers/holes-reducer.js +0 -68
- package/lib/reducers/items-reducer.js +0 -146
- package/lib/reducers/lines-reducer.js +0 -51
- package/lib/reducers/project-reducer.js +0 -135
- package/lib/reducers/reducer.js +0 -26
- package/lib/reducers/scene-reducer.js +0 -34
- package/lib/reducers/user-reducer.js +0 -46
- package/lib/reducers/vertices-reducer.js +0 -25
- package/lib/reducers/viewer2d-reducer.js +0 -82
- package/lib/reducers/viewer3d-reducer.js +0 -63
- package/lib/shared-style.js +0 -72
- package/lib/styles/export.js +0 -13
- package/lib/translator/en.js +0 -110
- package/lib/translator/it.js +0 -85
- package/lib/translator/ru.js +0 -85
- package/lib/translator/translator.js +0 -90
- package/lib/utils/browser.js +0 -40
- package/lib/utils/email-validator.js +0 -10
- package/lib/utils/export.js +0 -56
- package/lib/utils/geometry.js +0 -2516
- package/lib/utils/get-edges-of-subgraphs.js +0 -34
- package/lib/utils/graph-cycles.js +0 -240
- package/lib/utils/graph-inner-cycles.js +0 -54
- package/lib/utils/graph.js +0 -157
- package/lib/utils/helper.js +0 -291
- package/lib/utils/history.js +0 -36
- package/lib/utils/id-broker.js +0 -25
- package/lib/utils/logger.js +0 -14
- package/lib/utils/math.js +0 -57
- package/lib/utils/molding.js +0 -895
- package/lib/utils/name-generator.js +0 -23
- package/lib/utils/objects-utils.js +0 -60
- package/lib/utils/phone-validator.js +0 -10
- package/lib/utils/process-black-list.js +0 -24
- package/lib/utils/react-if.js +0 -24
- package/lib/utils/snap-scene.js +0 -105
- package/lib/utils/snap.js +0 -249
- package/lib/utils/summarizeCart.js +0 -30
- package/lib/utils/threeCSG.es6.js +0 -503
- package/lib/version.js +0 -8
package/es/utils/molding.js
DELETED
|
@@ -1,871 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
-
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; } } }; }
|
|
12
|
-
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; } }
|
|
13
|
-
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; }
|
|
14
|
-
import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
|
|
15
|
-
import * as Three from 'three';
|
|
16
|
-
import convert from 'convert-units';
|
|
17
|
-
import IDBroker from "./id-broker";
|
|
18
|
-
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
19
|
-
import { GeometryUtils } from "./export";
|
|
20
|
-
import { isEmpty } from "./helper";
|
|
21
|
-
export function getItemRect(item) {
|
|
22
|
-
var x = item.x;
|
|
23
|
-
var y = item.y;
|
|
24
|
-
var rotRad = item.rotation / 180 * Math.PI;
|
|
25
|
-
var itemWidth = item.properties.get('width').get('_length');
|
|
26
|
-
var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
27
|
-
itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
28
|
-
var itemDepth = item.properties.get('depth').get('_length');
|
|
29
|
-
var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
30
|
-
itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
31
|
-
var mx = x - itemWidth * Math.cos(rotRad);
|
|
32
|
-
var my = y - itemWidth * Math.sin(rotRad);
|
|
33
|
-
var x0 = mx + itemDepth * Math.sin(rotRad);
|
|
34
|
-
var y0 = my - itemDepth * Math.cos(rotRad);
|
|
35
|
-
var x3 = mx * 2 - x0;
|
|
36
|
-
var y3 = my * 2 - y0;
|
|
37
|
-
var x1 = x * 2 - x3;
|
|
38
|
-
var y1 = y * 2 - y3;
|
|
39
|
-
var x2 = x * 2 - x0;
|
|
40
|
-
var y2 = y * 2 - y0;
|
|
41
|
-
return {
|
|
42
|
-
rect: [{
|
|
43
|
-
x: x0,
|
|
44
|
-
y: y0
|
|
45
|
-
}, {
|
|
46
|
-
x: x1,
|
|
47
|
-
y: y1
|
|
48
|
-
}, {
|
|
49
|
-
x: x2,
|
|
50
|
-
y: y2
|
|
51
|
-
}, {
|
|
52
|
-
x: x3,
|
|
53
|
-
y: y3
|
|
54
|
-
}]
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function hasMoldingLayout(molding, layoutpos) {
|
|
58
|
-
var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
|
|
59
|
-
return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
|
|
60
|
-
}
|
|
61
|
-
export function isEnableItemForMolding(layer, selItem) {
|
|
62
|
-
var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
63
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
64
|
-
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));
|
|
65
|
-
|
|
66
|
-
// check this item is enable for any molding
|
|
67
|
-
if (isEmpty(molding)) return result;
|
|
68
|
-
// check this item is enable for specified molding
|
|
69
|
-
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
74
|
-
* s1 c2 s2 c1
|
|
75
|
-
* |--------|------|-----------|
|
|
76
|
-
* Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
|
|
77
|
-
* @param {*} selRectPos1
|
|
78
|
-
* @param {*} selRectPos2
|
|
79
|
-
* @param {*} curRectPos1
|
|
80
|
-
* @param {*} curRectPos2
|
|
81
|
-
* @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
|
|
82
|
-
*/
|
|
83
|
-
function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
84
|
-
return (
|
|
85
|
-
// GeometryUtils.verticesDistance(curRectPos1, selRectPos2) +
|
|
86
|
-
// GeometryUtils.verticesDistance(selRectPos1, curRectPos2) -
|
|
87
|
-
// Math.abs(
|
|
88
|
-
// GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
|
|
89
|
-
// GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
|
|
90
|
-
// )
|
|
91
|
-
Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
export function isItemSnappedItem(selItem, curItem) {
|
|
95
|
-
var selRect = getItemRect(selItem).rect;
|
|
96
|
-
var curRect = getItemRect(curItem).rect;
|
|
97
|
-
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
|
|
98
|
-
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
|
|
99
|
-
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
|
|
100
|
-
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
|
|
101
|
-
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
|
|
102
|
-
return flag30 || flag21 || flag23 || flag01 || flag03;
|
|
103
|
-
}
|
|
104
|
-
export function isItemSnappedGroup(selItem, itemGroup) {
|
|
105
|
-
return itemGroup.some(function (curItem) {
|
|
106
|
-
return isItemSnappedItem(selItem, curItem);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
export function sortItemsByDistance(items, selItem) {
|
|
110
|
-
items.sort(function (a, b) {
|
|
111
|
-
return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
112
|
-
});
|
|
113
|
-
return items;
|
|
114
|
-
}
|
|
115
|
-
export function isSameMoldingLayoutpos(curItem, item) {
|
|
116
|
-
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);
|
|
117
|
-
}
|
|
118
|
-
export function isItemSameItemByLocation(item1, item2, location) {
|
|
119
|
-
var item1Altitude = item1.properties.get('altitude').get('_length');
|
|
120
|
-
var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
|
|
121
|
-
item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
122
|
-
var item1Height = item1.properties.get('height').get('_length');
|
|
123
|
-
var item1HeightUnit = item1.properties.get('height').get('_unit');
|
|
124
|
-
item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
|
|
125
|
-
var item2Altitude = item2.properties.get('altitude').get('_length');
|
|
126
|
-
var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
|
|
127
|
-
item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
128
|
-
var item2Height = item2.properties.get('height').get('_length');
|
|
129
|
-
var item2HeightUnit = item2.properties.get('height').get('_unit');
|
|
130
|
-
item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
|
|
131
|
-
var flag = false;
|
|
132
|
-
switch (location) {
|
|
133
|
-
case TOP_MOLDING_LOCATION:
|
|
134
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
135
|
-
break;
|
|
136
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
137
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
138
|
-
break;
|
|
139
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
140
|
-
if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
return flag;
|
|
144
|
-
}
|
|
145
|
-
export function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
|
|
146
|
-
return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
|
|
147
|
-
return item.id === curItem.id;
|
|
148
|
-
}) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
|
|
149
|
-
}
|
|
150
|
-
export function getItemGroupFromMolding(layer, curItem, molding) {
|
|
151
|
-
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
152
|
-
var itemGroup = [curItem];
|
|
153
|
-
var temp_layer_items = layer.items.toArray().filter(function (item) {
|
|
154
|
-
return item.category === 'cabinet' && item.id !== curItem.id && item.id !== (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id);
|
|
155
|
-
});
|
|
156
|
-
temp_layer_items = sortItemsByDistance(temp_layer_items, curItem);
|
|
157
|
-
for (var idx = 0; idx < temp_layer_items.length; idx++) {
|
|
158
|
-
if (tryMergeMDItem(layer, curItem, temp_layer_items[idx], itemGroup, molding)) {
|
|
159
|
-
itemGroup.push(temp_layer_items[idx]);
|
|
160
|
-
idx = -1;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return itemGroup;
|
|
164
|
-
}
|
|
165
|
-
function tryMergeItemWithLocation(curItem, itemGroup, location) {
|
|
166
|
-
return itemGroup.some(function (item) {
|
|
167
|
-
return isItemSnappedItem(curItem, item) && isItemSameItemByLocation(curItem, item, location);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Make the molding group array with [items].
|
|
173
|
-
* @param {*} layer
|
|
174
|
-
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
175
|
-
* @returns MG array
|
|
176
|
-
*/
|
|
177
|
-
export function getAllMoldingGroups(layer) {
|
|
178
|
-
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
179
|
-
if (items === null) items = layer.items.toArray();
|
|
180
|
-
var MGArray = [];
|
|
181
|
-
items.forEach(function (curItem) {
|
|
182
|
-
// let allLineRects = GeometryUtils.buildRectFromLines(
|
|
183
|
-
// layer,
|
|
184
|
-
// GeometryUtils.getAllLines(layer)
|
|
185
|
-
// );
|
|
186
|
-
// if (
|
|
187
|
-
// (curItem.category === 'cabinet' &&
|
|
188
|
-
// curItem.layoutpos === BASE_CABINET_LAYOUTPOS &&
|
|
189
|
-
// !GeometryUtils.isSnappedLine(getItemRect(curItem), allLineRects)) ||
|
|
190
|
-
// ((curItem.layoutpos === WALL_CABINET_LAYOUTPOS ||
|
|
191
|
-
// curItem.layoutpos === TALL_CABINET_LAYOUTPOS) &&
|
|
192
|
-
// GeometryUtils.isSnappedLine(getItemRect(curItem), allLineRects))
|
|
193
|
-
// ) {
|
|
194
|
-
if (curItem.category === 'cabinet') {
|
|
195
|
-
var temp_items = items.filter(function (it) {
|
|
196
|
-
return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
|
|
197
|
-
});
|
|
198
|
-
temp_items = sortItemsByDistance(temp_items, curItem);
|
|
199
|
-
MOLDING_LOCATIONS.forEach(function (location) {
|
|
200
|
-
if (!MGArray.some(function (mg) {
|
|
201
|
-
return mg.items.some(function (it) {
|
|
202
|
-
return it.id === curItem.id;
|
|
203
|
-
}) && mg.location_type === location;
|
|
204
|
-
})) {
|
|
205
|
-
var itemGroup = [curItem];
|
|
206
|
-
var isChangedItemGroup = false;
|
|
207
|
-
do {
|
|
208
|
-
isChangedItemGroup = false;
|
|
209
|
-
var _loop = function _loop(idx) {
|
|
210
|
-
if (!itemGroup.some(function (it) {
|
|
211
|
-
return it.id === temp_items[idx].id;
|
|
212
|
-
}) && tryMergeItemWithLocation(temp_items[idx], itemGroup, location)) {
|
|
213
|
-
itemGroup.push(temp_items[idx]);
|
|
214
|
-
isChangedItemGroup = true;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
for (var idx = 0; idx < temp_items.length; idx++) {
|
|
218
|
-
_loop(idx);
|
|
219
|
-
}
|
|
220
|
-
} while (isChangedItemGroup);
|
|
221
|
-
MGArray.push({
|
|
222
|
-
id: IDBroker.acquireID(),
|
|
223
|
-
items: itemGroup,
|
|
224
|
-
location_type: location,
|
|
225
|
-
molding: null,
|
|
226
|
-
lines: null,
|
|
227
|
-
pointGroups: null,
|
|
228
|
-
meshes: [],
|
|
229
|
-
rot: 0,
|
|
230
|
-
pos: 0
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
// }
|
|
236
|
-
});
|
|
237
|
-
return MGArray;
|
|
238
|
-
}
|
|
239
|
-
export function getLinesOfItem(item, allLineRects, catalog) {
|
|
240
|
-
var lines = [];
|
|
241
|
-
var outline = null;
|
|
242
|
-
var element = catalog.elements[item.get('type')];
|
|
243
|
-
if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
|
|
244
|
-
// get edge lines
|
|
245
|
-
var newWidth = item.properties.get('width').get('_length');
|
|
246
|
-
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
247
|
-
newWidth = convert(newWidth).from(wUnit).to('cm');
|
|
248
|
-
var newDepth = item.properties.get('depth').get('_length');
|
|
249
|
-
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
250
|
-
newDepth = convert(newDepth).from(hUnit).to('cm');
|
|
251
|
-
if (item) {
|
|
252
|
-
// Get Outline Data of Selected Item
|
|
253
|
-
outline = element.info.outline;
|
|
254
|
-
if (outline) {
|
|
255
|
-
// Extract Points from `outline`
|
|
256
|
-
var outlinePaths = outline.paths;
|
|
257
|
-
var outlineWidth = outline.svgWidth;
|
|
258
|
-
var outlineHeight = outline.svgHeight;
|
|
259
|
-
var outlinePoints = []; // Hold Points Of SVG
|
|
260
|
-
var _iterator = _createForOfIteratorHelper(outlinePaths),
|
|
261
|
-
_step;
|
|
262
|
-
try {
|
|
263
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
264
|
-
var path = _step.value;
|
|
265
|
-
var _iterator2 = _createForOfIteratorHelper(path.subPaths),
|
|
266
|
-
_step2;
|
|
267
|
-
try {
|
|
268
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
269
|
-
var subPath = _step2.value;
|
|
270
|
-
outlinePoints = outlinePoints.concat(subPath.getPoints());
|
|
271
|
-
}
|
|
272
|
-
} catch (err) {
|
|
273
|
-
_iterator2.e(err);
|
|
274
|
-
} finally {
|
|
275
|
-
_iterator2.f();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
} catch (err) {
|
|
279
|
-
_iterator.e(err);
|
|
280
|
-
} finally {
|
|
281
|
-
_iterator.f();
|
|
282
|
-
}
|
|
283
|
-
outline.reverse && outlinePoints.reverse();
|
|
284
|
-
for (var i = 0; i < outlinePoints.length - 1; i++) {
|
|
285
|
-
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), IDBroker.acquireID()]);
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
289
|
-
for (var _i = 0; _i < 4; _i++) {
|
|
290
|
-
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), IDBroker.acquireID()]);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
|
|
295
|
-
lines = lines.filter(function (line) {
|
|
296
|
-
return !GeometryUtils.isSnappedLine({
|
|
297
|
-
rect: [{
|
|
298
|
-
x: 0,
|
|
299
|
-
y: 0
|
|
300
|
-
}, {
|
|
301
|
-
x: 0,
|
|
302
|
-
y: 0
|
|
303
|
-
}, line[0], line[1]]
|
|
304
|
-
}, allLineRects);
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
return lines;
|
|
308
|
-
}
|
|
309
|
-
function isParallelLines(line1, line2) {
|
|
310
|
-
var isParallel = false;
|
|
311
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
312
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
313
|
-
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;
|
|
314
|
-
if (isParallel) {
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
export function isLinesOverlapped(line1, line2) {
|
|
320
|
-
return isParallelLines(line1, line2) && line1.some(function (l1) {
|
|
321
|
-
return line2.some(function (l2) {
|
|
322
|
-
return GeometryUtils.samePoints(l1, l2);
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
export function mergeOverlappedLines(line1, line2) {
|
|
327
|
-
var line1_idx = 0,
|
|
328
|
-
line2_idx = 0;
|
|
329
|
-
line1.forEach(function (l1, idx1) {
|
|
330
|
-
if (idx1 !== line1.length - 1) {
|
|
331
|
-
line2.forEach(function (l2, idx2) {
|
|
332
|
-
if (idx2 !== line2.length - 1) {
|
|
333
|
-
if (GeometryUtils.samePoints(l1, l2)) {
|
|
334
|
-
line1_idx = idx1;
|
|
335
|
-
line2_idx = idx2;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
//If line1 's end point and line2 's start point is same, two lines merge into a line with
|
|
342
|
-
//the line1's start point as the start point and line2's end point as the end point.
|
|
343
|
-
if (line1_idx === 1) {
|
|
344
|
-
return [line1[1 - line1_idx], line2[1 - line2_idx], IDBroker.acquireID()];
|
|
345
|
-
} else {
|
|
346
|
-
return [line2[1 - line2_idx], line1[1 - line1_idx], IDBroker.acquireID()];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Get the contour line array of moldingGroup items
|
|
352
|
-
* @param {*} moldingGroup
|
|
353
|
-
* @param {*} layer
|
|
354
|
-
* @param {*} catalog
|
|
355
|
-
* @returns contour line array of moldingGroup items
|
|
356
|
-
*/
|
|
357
|
-
export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
358
|
-
// wall lines
|
|
359
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
360
|
-
var MGlines = [];
|
|
361
|
-
var MGlinesOtherSnapped = [];
|
|
362
|
-
var items = _toConsumableArray(moldingGroup.items);
|
|
363
|
-
// The other item's lines (these items are snapped to the moldingGroup items)
|
|
364
|
-
var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
|
|
365
|
-
if (items.some(function (it) {
|
|
366
|
-
return item.id === it.id;
|
|
367
|
-
})) return false;
|
|
368
|
-
if (isItemSnappedGroup(item, items)) {
|
|
369
|
-
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
370
|
-
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
371
|
-
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
372
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
373
|
-
var itemHeight = item.properties.get('height').get('_length');
|
|
374
|
-
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
375
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
376
|
-
itemLines.forEach(function (line) {
|
|
377
|
-
line.push({
|
|
378
|
-
altitude: itemAltitude,
|
|
379
|
-
height: itemHeight
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
MGlinesOtherSnapped = [].concat(_toConsumableArray(MGlinesOtherSnapped), _toConsumableArray(itemLines));
|
|
383
|
-
return true;
|
|
384
|
-
} else return false;
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
// get all lines of moldingGroup items
|
|
388
|
-
items.forEach(function (item) {
|
|
389
|
-
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
390
|
-
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
391
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
392
|
-
var itemHeight = item.properties.get('height').get('_length');
|
|
393
|
-
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
394
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
395
|
-
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
396
|
-
|
|
397
|
-
// remove the edge that overlapped with other snapped items
|
|
398
|
-
itemLines = itemLines.filter(function (itLine) {
|
|
399
|
-
var ret = true;
|
|
400
|
-
var srcLine = {
|
|
401
|
-
x1: itLine[0].x,
|
|
402
|
-
y1: itLine[0].y,
|
|
403
|
-
x2: itLine[1].x,
|
|
404
|
-
y2: itLine[1].y
|
|
405
|
-
};
|
|
406
|
-
for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
|
|
407
|
-
var bCheck = false;
|
|
408
|
-
switch (moldingGroup.location_type) {
|
|
409
|
-
case TOP_MOLDING_LOCATION:
|
|
410
|
-
bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
|
|
411
|
-
break;
|
|
412
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
413
|
-
bCheck = true;
|
|
414
|
-
break;
|
|
415
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
416
|
-
bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
420
|
-
if (bCheck) {
|
|
421
|
-
var destLine = {
|
|
422
|
-
x1: MGlinesOtherSnapped[j][0].x,
|
|
423
|
-
y1: MGlinesOtherSnapped[j][0].y,
|
|
424
|
-
x2: MGlinesOtherSnapped[j][1].x,
|
|
425
|
-
y2: MGlinesOtherSnapped[j][1].y
|
|
426
|
-
};
|
|
427
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
428
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
429
|
-
ret = false;
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
return ret;
|
|
435
|
-
});
|
|
436
|
-
MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(itemLines));
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
// Filtering overlapped edges and get contour edges
|
|
440
|
-
var removeLineIds = []; // remove the edge that fully overlapped to other edge
|
|
441
|
-
var newLines = []; // new countour edge segment that except the overlapped part
|
|
442
|
-
var _loop2 = function _loop2(i) {
|
|
443
|
-
var srcLine = {
|
|
444
|
-
x1: MGlines[i][0].x,
|
|
445
|
-
y1: MGlines[i][0].y,
|
|
446
|
-
x2: MGlines[i][1].x,
|
|
447
|
-
y2: MGlines[i][1].y
|
|
448
|
-
};
|
|
449
|
-
var _loop4 = function _loop4(j) {
|
|
450
|
-
if (i === j) return 0; // continue
|
|
451
|
-
var destLine = {
|
|
452
|
-
x1: MGlines[j][0].x,
|
|
453
|
-
y1: MGlines[j][0].y,
|
|
454
|
-
x2: MGlines[j][1].x,
|
|
455
|
-
y2: MGlines[j][1].y
|
|
456
|
-
};
|
|
457
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
458
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
459
|
-
removeLineIds.push(i);
|
|
460
|
-
return 1; // break
|
|
461
|
-
} else if (rst.result === OVERLAP_SOME) {
|
|
462
|
-
removeLineIds.push(i);
|
|
463
|
-
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
|
|
464
|
-
return idx !== i && idx !== j;
|
|
465
|
-
}), 0);
|
|
466
|
-
if (lineSegs.length > 0) newLines = [].concat(_toConsumableArray(newLines), _toConsumableArray(lineSegs));
|
|
467
|
-
return 1; // break
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
_ret2;
|
|
471
|
-
for (var j = 0; j < MGlines.length; j++) {
|
|
472
|
-
_ret2 = _loop4(j);
|
|
473
|
-
if (_ret2 === 0) continue;
|
|
474
|
-
if (_ret2 === 1) break;
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
for (var i = 0; i < MGlines.length; i++) {
|
|
478
|
-
_loop2(i);
|
|
479
|
-
}
|
|
480
|
-
MGlines = MGlines.filter(function (line, idx) {
|
|
481
|
-
return !removeLineIds.some(function (id) {
|
|
482
|
-
return idx === id;
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
|
-
if (newLines.length > 0) MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(newLines));
|
|
486
|
-
|
|
487
|
-
// merge the collinear linked lines to one line
|
|
488
|
-
var newMGlines = [];
|
|
489
|
-
var filteredMGlines = MGlines;
|
|
490
|
-
var _loop3 = function _loop3(_i2) {
|
|
491
|
-
if (filteredMGlines.length < 1) return 0; // break
|
|
492
|
-
if (!filteredMGlines.some(function (v) {
|
|
493
|
-
return v[2] === MGlines[_i2][2];
|
|
494
|
-
})) return 1; // continue
|
|
495
|
-
var mergedResult = getMergedLine(MGlines[_i2], filteredMGlines, 0);
|
|
496
|
-
if (mergedResult) {
|
|
497
|
-
newMGlines.push(mergedResult.mergedLine);
|
|
498
|
-
filteredMGlines = mergedResult.filteredMGlines;
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
_ret;
|
|
502
|
-
for (var _i2 = 0; _i2 < MGlines.length; _i2++) {
|
|
503
|
-
_ret = _loop3(_i2);
|
|
504
|
-
if (_ret === 0) break;
|
|
505
|
-
if (_ret === 1) continue;
|
|
506
|
-
}
|
|
507
|
-
return newMGlines;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* Get the line that colinear linked with [line], and merge them to a new line
|
|
512
|
-
* @param {*} line
|
|
513
|
-
* @param {*} MGlines
|
|
514
|
-
* @returns
|
|
515
|
-
* - returns merged new line
|
|
516
|
-
* - returns filtered new line group (remove linked line from [MGlines])
|
|
517
|
-
*/
|
|
518
|
-
function getMergedLine(line, MGlines, cnt) {
|
|
519
|
-
try {
|
|
520
|
-
cnt++;
|
|
521
|
-
if (cnt > 5000) {
|
|
522
|
-
console.log('getMergedLine has limited!');
|
|
523
|
-
return null;
|
|
524
|
-
}
|
|
525
|
-
var newMGlines = MGlines.filter(function (v) {
|
|
526
|
-
return line[2] !== v[2];
|
|
527
|
-
});
|
|
528
|
-
var mergeResult = {
|
|
529
|
-
mergedLine: line,
|
|
530
|
-
filteredMGlines: newMGlines
|
|
531
|
-
};
|
|
532
|
-
var srcLine = {
|
|
533
|
-
x1: line[0].x,
|
|
534
|
-
y1: line[0].y,
|
|
535
|
-
x2: line[1].x,
|
|
536
|
-
y2: line[1].y
|
|
537
|
-
};
|
|
538
|
-
var _loop5 = function _loop5(i) {
|
|
539
|
-
var destLine = {
|
|
540
|
-
x1: newMGlines[i][0].x,
|
|
541
|
-
y1: newMGlines[i][0].y,
|
|
542
|
-
x2: newMGlines[i][1].x,
|
|
543
|
-
y2: newMGlines[i][1].y
|
|
544
|
-
};
|
|
545
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
546
|
-
if (rst.result === OVERLAP_LINK) {
|
|
547
|
-
var mergedLine = [{
|
|
548
|
-
x: rst.linkedLine.x1,
|
|
549
|
-
y: rst.linkedLine.y1
|
|
550
|
-
}, {
|
|
551
|
-
x: rst.linkedLine.x2,
|
|
552
|
-
y: rst.linkedLine.y2
|
|
553
|
-
}, IDBroker.acquireID()];
|
|
554
|
-
mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
|
|
555
|
-
return idx !== i;
|
|
556
|
-
}), cnt);
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
for (var i = 0; i < newMGlines.length; i++) {
|
|
560
|
-
_loop5(i);
|
|
561
|
-
}
|
|
562
|
-
return mergeResult;
|
|
563
|
-
} catch (e) {
|
|
564
|
-
console.log('getMergedLine catched :', e);
|
|
565
|
-
return null;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Get the contour line segments from [lineSegs]
|
|
571
|
-
* @param {*} lineSegs
|
|
572
|
-
* @param {*} otherLines
|
|
573
|
-
* @returns
|
|
574
|
-
*/
|
|
575
|
-
function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
576
|
-
try {
|
|
577
|
-
cnt++;
|
|
578
|
-
if (cnt > 5000) {
|
|
579
|
-
console.log('getTrimmedContourLineSegs has limited!');
|
|
580
|
-
return [];
|
|
581
|
-
}
|
|
582
|
-
var returnSegs = [];
|
|
583
|
-
for (var i = 0; i < lineSegs.length; i++) {
|
|
584
|
-
var srcLine = {
|
|
585
|
-
x1: lineSegs[i].x1,
|
|
586
|
-
y1: lineSegs[i].y1,
|
|
587
|
-
x2: lineSegs[i].x2,
|
|
588
|
-
y2: lineSegs[i].y2
|
|
589
|
-
};
|
|
590
|
-
var bContourSeg = true;
|
|
591
|
-
var _loop6 = function _loop6(j) {
|
|
592
|
-
var destLine = {
|
|
593
|
-
x1: otherLines[j][0].x,
|
|
594
|
-
y1: otherLines[j][0].y,
|
|
595
|
-
x2: otherLines[j][1].x,
|
|
596
|
-
y2: otherLines[j][1].y
|
|
597
|
-
};
|
|
598
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
599
|
-
if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
|
|
600
|
-
bContourSeg = false;
|
|
601
|
-
return 0; // break
|
|
602
|
-
} else if (rst.result == OVERLAP_SOME) {
|
|
603
|
-
var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
|
|
604
|
-
return idx !== j;
|
|
605
|
-
}), cnt);
|
|
606
|
-
if (tLineSegs.length > 0) returnSegs = [].concat(_toConsumableArray(returnSegs), _toConsumableArray(tLineSegs));
|
|
607
|
-
bContourSeg = false;
|
|
608
|
-
return 0; // break
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
_ret3;
|
|
612
|
-
for (var j = 0; j < otherLines.length; j++) {
|
|
613
|
-
_ret3 = _loop6(j);
|
|
614
|
-
if (_ret3 === 0) break;
|
|
615
|
-
}
|
|
616
|
-
if (bContourSeg) returnSegs.push([{
|
|
617
|
-
x: lineSegs[i].x1,
|
|
618
|
-
y: lineSegs[i].y1
|
|
619
|
-
}, {
|
|
620
|
-
x: lineSegs[i].x2,
|
|
621
|
-
y: lineSegs[i].y2
|
|
622
|
-
}, IDBroker.acquireID()]);
|
|
623
|
-
}
|
|
624
|
-
return returnSegs;
|
|
625
|
-
} catch (e) {
|
|
626
|
-
console.log('getTrimmedContourLineSegs catched :', e);
|
|
627
|
-
return [];
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
631
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
632
|
-
var items = _toConsumableArray(moldingGroup.items);
|
|
633
|
-
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
634
|
-
items = sortItemsByDistance(items, items[0]);
|
|
635
|
-
var _loop7 = function _loop7() {
|
|
636
|
-
var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
|
|
637
|
-
var temp_MGLines = [];
|
|
638
|
-
MGlines.forEach(function (line) {
|
|
639
|
-
var idx = itemLines.findIndex(function (itemLine) {
|
|
640
|
-
return isLinesOverlapped(line, itemLine);
|
|
641
|
-
});
|
|
642
|
-
var curItemLine = itemLines[idx];
|
|
643
|
-
if (idx > -1) {
|
|
644
|
-
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]))) {
|
|
645
|
-
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
646
|
-
temp_MGLines.push(MGLine);
|
|
647
|
-
}
|
|
648
|
-
itemLines.splice(idx, 1);
|
|
649
|
-
} else {
|
|
650
|
-
temp_MGLines.push(line);
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
itemLines.forEach(function (itemLine) {
|
|
654
|
-
return temp_MGLines.push(itemLine);
|
|
655
|
-
});
|
|
656
|
-
MGlines = [].concat(temp_MGLines);
|
|
657
|
-
};
|
|
658
|
-
for (var i = 1; i < items.length; i++) {
|
|
659
|
-
_loop7();
|
|
660
|
-
}
|
|
661
|
-
// return MGlines;
|
|
662
|
-
var snapped_other_items = layer.items.toArray().filter(function (item) {
|
|
663
|
-
if (items.some(function (it) {
|
|
664
|
-
return item.id === it.id;
|
|
665
|
-
})) return false;
|
|
666
|
-
return isItemSnappedGroup(item, items);
|
|
667
|
-
});
|
|
668
|
-
snapped_other_items.forEach(function (item) {
|
|
669
|
-
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
670
|
-
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
671
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
672
|
-
var itemHeight = item.properties.get('height').get('_length');
|
|
673
|
-
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
674
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
675
|
-
var mgroupAltitude = items[0].properties.get('altitude').get('_length');
|
|
676
|
-
var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
|
|
677
|
-
mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
678
|
-
var mgroupHeight = items[0].properties.get('height').get('_length');
|
|
679
|
-
var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
|
|
680
|
-
mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
681
|
-
var flag = false;
|
|
682
|
-
switch (moldingGroup.location_type) {
|
|
683
|
-
case TOP_MOLDING_LOCATION:
|
|
684
|
-
flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
|
|
685
|
-
break;
|
|
686
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
687
|
-
flag = true;
|
|
688
|
-
break;
|
|
689
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
690
|
-
flag = itemAltitude < mgroupAltitude;
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
694
|
-
if (flag) {
|
|
695
|
-
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
696
|
-
var temp_MGLines = [];
|
|
697
|
-
MGlines.forEach(function (mgl) {
|
|
698
|
-
var idx = itemLines.findIndex(function (itl) {
|
|
699
|
-
return isLinesOverlapped(mgl, itl);
|
|
700
|
-
});
|
|
701
|
-
var curITL = itemLines[idx];
|
|
702
|
-
if (idx > -1) {
|
|
703
|
-
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
|
|
704
|
-
if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
705
|
-
var MGLine = mergeOverlappedLines(mgl, curITL);
|
|
706
|
-
temp_MGLines.push(MGLine);
|
|
707
|
-
}
|
|
708
|
-
itemLines.splice(idx, 1);
|
|
709
|
-
} else {
|
|
710
|
-
temp_MGLines.push(mgl);
|
|
711
|
-
}
|
|
712
|
-
} else {
|
|
713
|
-
temp_MGLines.push(mgl);
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
MGlines = [].concat(temp_MGLines);
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
return MGlines;
|
|
720
|
-
}
|
|
721
|
-
function getMDPoints(newMD) {
|
|
722
|
-
if (newMD.lines.length < 1) return _objectSpread(_objectSpread({}, newMD), {}, {
|
|
723
|
-
pointGroups: []
|
|
724
|
-
});
|
|
725
|
-
// let maxX = newMD.lines[0][0].x,
|
|
726
|
-
var maxX = newMD.lines[0][0].x,
|
|
727
|
-
minX = newMD.lines[0][0].x;
|
|
728
|
-
var maxY = newMD.lines[0][0].y,
|
|
729
|
-
minY = newMD.lines[0][0].y;
|
|
730
|
-
newMD.lines.forEach(function (line) {
|
|
731
|
-
if (line[0].x > maxX) {
|
|
732
|
-
maxX = line[0].x;
|
|
733
|
-
}
|
|
734
|
-
if (line[0].x < minX) {
|
|
735
|
-
minX = line[0].x;
|
|
736
|
-
}
|
|
737
|
-
if (line[1].x > maxX) {
|
|
738
|
-
maxX = line[1].x;
|
|
739
|
-
}
|
|
740
|
-
if (line[1].x < minX) {
|
|
741
|
-
minX = line[1].x;
|
|
742
|
-
}
|
|
743
|
-
if (line[0].y > maxY) {
|
|
744
|
-
maxY = line[0].y;
|
|
745
|
-
}
|
|
746
|
-
if (line[0].y < minY) {
|
|
747
|
-
minY = line[0].y;
|
|
748
|
-
}
|
|
749
|
-
if (line[1].y > maxY) {
|
|
750
|
-
maxY = line[1].y;
|
|
751
|
-
}
|
|
752
|
-
if (line[1].y < minY) {
|
|
753
|
-
minY = line[1].y;
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
var cPos = {
|
|
757
|
-
x: (maxX + minX) / 2,
|
|
758
|
-
y: (maxY + minY) / 2
|
|
759
|
-
};
|
|
760
|
-
var newSize = _objectSpread(_objectSpread({}, newMD.size), {}, {
|
|
761
|
-
width: maxX - minX,
|
|
762
|
-
depth: maxY - minY
|
|
763
|
-
});
|
|
764
|
-
|
|
765
|
-
// get vertex points
|
|
766
|
-
var MDlines = _toConsumableArray(newMD.lines);
|
|
767
|
-
var pointGroups = [[]];
|
|
768
|
-
var flag = 1;
|
|
769
|
-
var i = 0;
|
|
770
|
-
var _loop8 = function _loop8() {
|
|
771
|
-
if (pointGroups[i].length === 0) {
|
|
772
|
-
pointGroups[i].push(new Three.Vector2(MDlines[0][0].x - cPos.x, MDlines[0][0].y - cPos.y), new Three.Vector2(MDlines[0][1].x - cPos.x, MDlines[0][1].y - cPos.y));
|
|
773
|
-
MDlines.splice(0, 1);
|
|
774
|
-
} else {
|
|
775
|
-
if (flag) {
|
|
776
|
-
var lastPoint = pointGroups[i][pointGroups[i].length - 1];
|
|
777
|
-
var res = MDlines.findIndex(function (a) {
|
|
778
|
-
return GeometryUtils.samePoints({
|
|
779
|
-
x: a[0].x - cPos.x,
|
|
780
|
-
y: a[0].y - cPos.y
|
|
781
|
-
}, lastPoint) || GeometryUtils.samePoints({
|
|
782
|
-
x: a[1].x - cPos.x,
|
|
783
|
-
y: a[1].y - cPos.y
|
|
784
|
-
}, lastPoint);
|
|
785
|
-
});
|
|
786
|
-
if (res > -1) {
|
|
787
|
-
var newPos = {
|
|
788
|
-
x: MDlines[res][0].x - cPos.x,
|
|
789
|
-
y: MDlines[res][0].y - cPos.y
|
|
790
|
-
};
|
|
791
|
-
if (GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
792
|
-
newPos = {
|
|
793
|
-
x: MDlines[res][1].x - cPos.x,
|
|
794
|
-
y: MDlines[res][1].y - cPos.y
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
pointGroups[i].push(new Three.Vector2(newPos.x, newPos.y));
|
|
798
|
-
MDlines.splice(res, 1);
|
|
799
|
-
} else {
|
|
800
|
-
flag = 0;
|
|
801
|
-
}
|
|
802
|
-
} else {
|
|
803
|
-
var firstPoint = pointGroups[i][0];
|
|
804
|
-
var _res = MDlines.findIndex(function (a) {
|
|
805
|
-
return GeometryUtils.samePoints({
|
|
806
|
-
x: a[0].x - cPos.x,
|
|
807
|
-
y: a[0].y - cPos.y
|
|
808
|
-
}, firstPoint) || GeometryUtils.samePoints({
|
|
809
|
-
x: a[1].x - cPos.x,
|
|
810
|
-
y: a[1].y - cPos.y
|
|
811
|
-
}, firstPoint);
|
|
812
|
-
});
|
|
813
|
-
if (_res > -1) {
|
|
814
|
-
var _newPos = {
|
|
815
|
-
x: MDlines[_res][0].x - cPos.x,
|
|
816
|
-
y: MDlines[_res][0].y - cPos.y
|
|
817
|
-
};
|
|
818
|
-
if (GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
819
|
-
_newPos = {
|
|
820
|
-
x: MDlines[_res][1].x - cPos.x,
|
|
821
|
-
y: MDlines[_res][1].y - cPos.y
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(_toConsumableArray(pointGroups[i]));
|
|
825
|
-
MDlines.splice(_res, 1);
|
|
826
|
-
} else {
|
|
827
|
-
flag = 1;
|
|
828
|
-
i++;
|
|
829
|
-
if (MDlines.length !== 0) pointGroups.push([]);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
while (MDlines.length !== 0) {
|
|
835
|
-
_loop8();
|
|
836
|
-
}
|
|
837
|
-
var z = newMD.items[0].properties.get('altitude').get('_length');
|
|
838
|
-
var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
|
|
839
|
-
z = convert(z).from(zUnit).to('cm');
|
|
840
|
-
var height = newMD.items[0].properties.get('height').get('_length');
|
|
841
|
-
var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
|
|
842
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
843
|
-
switch (newMD.location_type) {
|
|
844
|
-
case TOP_MOLDING_LOCATION:
|
|
845
|
-
z += height;
|
|
846
|
-
break;
|
|
847
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
848
|
-
z += height / 2;
|
|
849
|
-
break;
|
|
850
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
851
|
-
z += 0;
|
|
852
|
-
break;
|
|
853
|
-
default:
|
|
854
|
-
break;
|
|
855
|
-
}
|
|
856
|
-
return _objectSpread(_objectSpread({}, newMD), {}, {
|
|
857
|
-
pointGroups: pointGroups,
|
|
858
|
-
pos: _objectSpread(_objectSpread({}, cPos), {}, {
|
|
859
|
-
z: z
|
|
860
|
-
}),
|
|
861
|
-
size: newSize
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
export function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
865
|
-
var newMG = _objectSpread({}, oldMG);
|
|
866
|
-
newMG.molding = molding;
|
|
867
|
-
newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
|
|
868
|
-
newMG.lines.reverse();
|
|
869
|
-
newMG = getMDPoints(newMG);
|
|
870
|
-
return newMG;
|
|
871
|
-
}
|