From 61713ca829abe8d8b72ccc1707e5a02dd30b392f Mon Sep 17 00:00:00 2001 From: Bui Trong Vuong Date: Fri, 31 May 2024 11:00:53 +0700 Subject: [PATCH] refactoring --- package-lock.json | 987 +++++++++++++++++- package.json | 1 + src/BimModel/index.ts | 35 +- .../04-draw-tool => DrawTool}/index.ts | 20 +- .../04-draw-tool => DrawTool}/src/BaseDraw.ts | 6 +- .../04-draw-tool => DrawTool}/src/DrawArc.ts | 14 +- .../src/DrawCircle.ts | 52 +- .../04-draw-tool => DrawTool}/src/DrawLine.ts | 2 +- .../src/DrawPickLine.ts | 0 .../src/DrawPoint.ts | 0 .../src/DrawPolyLines.ts | 0 .../src/DrawRectangular.ts | 0 .../04-draw-tool => DrawTool}/src/index.ts | 0 src/BimModel/src/ElementId.ts | 5 + .../{system/08-level => LevelSystem}/index.ts | 9 +- .../{system/08-level => LevelSystem}/types.ts | 0 .../ModelingComponent/src/InitComponents.tsx | 2 + .../ElementType/ElementType.tsx | 38 + .../ElementType/ElementTypeOption.tsx | 72 ++ .../ElementType/ElementTypeProperty.tsx | 7 + .../src/ModelingOption/ModelingOption.tsx | 6 +- .../src/Project/NewProject.tsx | 3 +- .../src/Project/ProjectInfo.tsx | 2 +- .../src/VisibilityOption/Elevations.tsx | 22 + .../src/VisibilityOption/Levels.tsx | 36 + .../src/VisibilityOption/VisibilityOption.tsx | 58 +- .../src/ModelingComponent/src/utils.ts | 100 +- src/BimModel/src/ProjectComponent/index.ts | 13 +- .../src/InitComponents.tsx | 6 +- .../src/ModelStructure/ModelStructure.tsx | 14 +- .../src/ModelStructure/StructureItem.tsx | 2 +- .../src/ModelStructure/StructureTitle.tsx | 2 +- .../src/ProjectComponent/src/ifc/IfcBase.ts | 90 ++ .../ProjectComponent/src/ifc/IfcBuilding.ts | 137 +++ .../src/ifc/IfcBuildingStorey.ts | 170 +++ .../ProjectComponent/src/ifc/IfcElement.ts | 134 +++ .../src/ProjectComponent/src/ifc/IfcInfo.ts | 154 +++ .../ProjectComponent/src/ifc/IfcProject.ts | 107 ++ .../src/ProjectComponent/src/ifc/IfcSite.ts | 141 +++ .../src/ProjectComponent/src/ifc/IfcUnit.ts | 123 +++ .../src/ProjectComponent/src/ifc/index.ts | 7 + .../src/ProjectComponent/src/index.ts | 3 +- src/BimModel/src/ProjectComponent/types.ts | 7 + src/BimModel/src/PropertyComponent/index.ts | 25 - src/BimModel/src/RendererComponent/index.ts | 4 +- src/BimModel/src/Signals/ElementType/index.ts | 69 ++ src/BimModel/src/Signals/Level/index.ts | 2 +- src/BimModel/src/Signals/Structure/index.ts | 2 +- src/BimModel/src/Signals/index.ts | 3 + src/BimModel/src/Snapper/index.ts | 26 + src/BimModel/src/StructureComponent/index.ts | 44 - .../src/StructureComponent/src/index.ts | 1 - src/BimModel/src/StructureComponent/types.ts | 7 - .../12-work-plane => WorkPlane}/index.ts | 25 +- src/BimModel/src/index.ts | 6 +- src/BimModel/src/system/00-base/IfcEnum.ts | 24 - src/BimModel/src/system/01-geometry/index.ts | 31 - .../src/system/01-geometry/src/index.ts | 1 - .../01-geometry/src/location/LocationArc.ts | 116 -- src/BimModel/src/system/02-element/index.ts | 27 - .../src/system/02-element/src/ElementId.ts | 6 - .../src/system/02-element/src/index.ts | 1 - .../src/system/03-element-type/index.ts | 27 - src/BimModel/src/system/05-parameter/index.ts | 27 - .../src/system/05-parameter/src/Parameter.ts | 5 - src/BimModel/src/system/06-category/index.ts | 27 - src/BimModel/src/system/07-family/index.ts | 27 - src/BimModel/src/system/09-grid/index.ts | 27 - src/BimModel/src/system/10-project/index.ts | 27 - src/BimModel/src/system/11-snapper/index.ts | 27 - .../{00-base => base}/IfcCategoryMap.ts | 0 .../system/{00-base => base}/IfcElements.ts | 0 src/BimModel/src/system/base/IfcEnum.ts | 25 + .../src/system/{00-base => base}/index.ts | 0 .../{00-base/Utils.ts => base/utils.ts} | 0 src/BimModel/src/system/constants.ts | 14 - .../system/element-type/BaseElementType.ts | 8 + .../src/system/element-type/BeamType.ts | 54 + .../src/system/element-type/ColumnType.ts | 53 + .../src/system/element-type/FoundationType.ts | 56 + .../system/element-type/ReinforcementType.ts | 61 ++ .../src/system/element-type/SlabType.ts | 52 + .../src/system/element-type/WallType.ts | 53 + src/BimModel/src/system/element-type/index.ts | 38 + src/BimModel/src/system/element-type/types.ts | 12 + .../src/system/element/BaseElement.ts | 5 + src/BimModel/src/system/element/index.ts | 1 + src/BimModel/src/system/element/types.ts | 17 + src/BimModel/src/system/family/index.ts | 1 + src/BimModel/src/system/geometry/index.ts | 3 + .../src => geometry}/location/BaseLocation.ts | 0 .../src => geometry}/location/Dimension.ts | 3 +- .../system/geometry/location/LocationArc.ts | 191 ++++ .../location/LocationCurve.ts | 0 .../src => geometry}/location/LocationLine.ts | 2 +- .../location/LocationPoint.ts | 0 .../location/LocationUtils.ts | 62 +- .../src => geometry}/location/index.ts | 0 .../src/system/geometry/shape/index.ts | 8 + .../system/{01-geometry => geometry}/types.ts | 2 +- src/BimModel/src/system/grid/index.ts | 1 + src/BimModel/src/system/index.ts | 65 +- src/BimModel/src/types/categories.ts | 17 + src/BimModel/src/types/constants.ts | 6 +- src/BimModel/src/types/index.ts | 1 + src/BimModel/src/utils/vectorUtils.ts | 17 +- tsconfig.json | 4 +- vite.config.ts | 10 +- 108 files changed, 3270 insertions(+), 773 deletions(-) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/index.ts (74%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/BaseDraw.ts (96%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawArc.ts (87%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawCircle.ts (55%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawLine.ts (98%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawPickLine.ts (100%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawPoint.ts (100%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawPolyLines.ts (100%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/DrawRectangular.ts (100%) rename src/BimModel/src/{system/04-draw-tool => DrawTool}/src/index.ts (100%) create mode 100644 src/BimModel/src/ElementId.ts rename src/BimModel/src/{system/08-level => LevelSystem}/index.ts (90%) rename src/BimModel/src/{system/08-level => LevelSystem}/types.ts (100%) create mode 100644 src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementType.tsx create mode 100644 src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeOption.tsx create mode 100644 src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeProperty.tsx create mode 100644 src/BimModel/src/ModelingComponent/src/VisibilityOption/Elevations.tsx create mode 100644 src/BimModel/src/ModelingComponent/src/VisibilityOption/Levels.tsx rename src/BimModel/src/{StructureComponent => ProjectComponent}/src/InitComponents.tsx (55%) rename src/BimModel/src/{StructureComponent => ProjectComponent}/src/ModelStructure/ModelStructure.tsx (88%) rename src/BimModel/src/{StructureComponent => ProjectComponent}/src/ModelStructure/StructureItem.tsx (100%) rename src/BimModel/src/{StructureComponent => ProjectComponent}/src/ModelStructure/StructureTitle.tsx (97%) create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcBase.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcBuilding.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcBuildingStorey.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcElement.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcInfo.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcProject.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcSite.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/IfcUnit.ts create mode 100644 src/BimModel/src/ProjectComponent/src/ifc/index.ts delete mode 100644 src/BimModel/src/PropertyComponent/index.ts create mode 100644 src/BimModel/src/Signals/ElementType/index.ts create mode 100644 src/BimModel/src/Snapper/index.ts delete mode 100644 src/BimModel/src/StructureComponent/index.ts delete mode 100644 src/BimModel/src/StructureComponent/src/index.ts delete mode 100644 src/BimModel/src/StructureComponent/types.ts rename src/BimModel/src/{system/12-work-plane => WorkPlane}/index.ts (87%) delete mode 100644 src/BimModel/src/system/00-base/IfcEnum.ts delete mode 100644 src/BimModel/src/system/01-geometry/index.ts delete mode 100644 src/BimModel/src/system/01-geometry/src/index.ts delete mode 100644 src/BimModel/src/system/01-geometry/src/location/LocationArc.ts delete mode 100644 src/BimModel/src/system/02-element/index.ts delete mode 100644 src/BimModel/src/system/02-element/src/ElementId.ts delete mode 100644 src/BimModel/src/system/02-element/src/index.ts delete mode 100644 src/BimModel/src/system/03-element-type/index.ts delete mode 100644 src/BimModel/src/system/05-parameter/index.ts delete mode 100644 src/BimModel/src/system/05-parameter/src/Parameter.ts delete mode 100644 src/BimModel/src/system/06-category/index.ts delete mode 100644 src/BimModel/src/system/07-family/index.ts delete mode 100644 src/BimModel/src/system/09-grid/index.ts delete mode 100644 src/BimModel/src/system/10-project/index.ts delete mode 100644 src/BimModel/src/system/11-snapper/index.ts rename src/BimModel/src/system/{00-base => base}/IfcCategoryMap.ts (100%) rename src/BimModel/src/system/{00-base => base}/IfcElements.ts (100%) create mode 100644 src/BimModel/src/system/base/IfcEnum.ts rename src/BimModel/src/system/{00-base => base}/index.ts (100%) rename src/BimModel/src/system/{00-base/Utils.ts => base/utils.ts} (100%) delete mode 100644 src/BimModel/src/system/constants.ts create mode 100644 src/BimModel/src/system/element-type/BaseElementType.ts create mode 100644 src/BimModel/src/system/element-type/BeamType.ts create mode 100644 src/BimModel/src/system/element-type/ColumnType.ts create mode 100644 src/BimModel/src/system/element-type/FoundationType.ts create mode 100644 src/BimModel/src/system/element-type/ReinforcementType.ts create mode 100644 src/BimModel/src/system/element-type/SlabType.ts create mode 100644 src/BimModel/src/system/element-type/WallType.ts create mode 100644 src/BimModel/src/system/element-type/index.ts create mode 100644 src/BimModel/src/system/element-type/types.ts create mode 100644 src/BimModel/src/system/element/BaseElement.ts create mode 100644 src/BimModel/src/system/element/index.ts create mode 100644 src/BimModel/src/system/element/types.ts create mode 100644 src/BimModel/src/system/family/index.ts create mode 100644 src/BimModel/src/system/geometry/index.ts rename src/BimModel/src/system/{01-geometry/src => geometry}/location/BaseLocation.ts (100%) rename src/BimModel/src/system/{01-geometry/src => geometry}/location/Dimension.ts (98%) create mode 100644 src/BimModel/src/system/geometry/location/LocationArc.ts rename src/BimModel/src/system/{01-geometry/src => geometry}/location/LocationCurve.ts (100%) rename src/BimModel/src/system/{01-geometry/src => geometry}/location/LocationLine.ts (96%) rename src/BimModel/src/system/{01-geometry/src => geometry}/location/LocationPoint.ts (100%) rename src/BimModel/src/system/{01-geometry/src => geometry}/location/LocationUtils.ts (67%) rename src/BimModel/src/system/{01-geometry/src => geometry}/location/index.ts (100%) create mode 100644 src/BimModel/src/system/geometry/shape/index.ts rename src/BimModel/src/system/{01-geometry => geometry}/types.ts (97%) create mode 100644 src/BimModel/src/system/grid/index.ts create mode 100644 src/BimModel/src/types/categories.ts diff --git a/package-lock.json b/package-lock.json index 3cc68f6..3476cbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ "eslint-plugin-react-refresh": "^0.3.4", "postcss": "^8.4.35", "tailwindcss": "^3.4.1", + "tsup": "^8.0.2", "typescript": "^5.0.2", "vite": "^4.3.9", "vite-plugin-glsl": "^1.3.0", @@ -455,6 +456,23 @@ "node": ">=6.9.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", @@ -1858,6 +1876,230 @@ } } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", @@ -2654,6 +2896,32 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bundle-require": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.1.0.tgz", + "integrity": "sha512-FeArRFM+ziGkRViKRnSTbHZc35dgmR9yNog05Kn0+ItI59pOAISGvnnIwW1WgFZQW59IxD9QpJnUPkdIPfZuXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.17" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3387,6 +3655,37 @@ "node": ">=0.10.0" } }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3612,6 +3911,19 @@ "node": ">=6" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3698,6 +4010,16 @@ "node": ">= 0.4" } }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -3828,6 +4150,19 @@ "node": ">=8" } }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3858,6 +4193,16 @@ "jiti": "bin/jiti.js" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3958,6 +4303,16 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -3979,6 +4334,13 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true, + "license": "MIT" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -4022,6 +4384,13 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4067,6 +4436,16 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4185,6 +4564,19 @@ "node": ">=0.10.0" } }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -4210,6 +4602,22 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -5008,6 +5416,19 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, + "node_modules/source-map": { + "version": "0.8.0-beta.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", + "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "whatwg-url": "^7.0.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/source-map-js": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", @@ -5099,10 +5520,20 @@ "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "engines": { "node": ">=8" @@ -5342,6 +5773,26 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -5353,6 +5804,515 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsup": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.0.2.tgz", + "integrity": "sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^4.0.0", + "cac": "^6.7.12", + "chokidar": "^3.5.1", + "debug": "^4.3.1", + "esbuild": "^0.19.2", + "execa": "^5.0.0", + "globby": "^11.0.3", + "joycon": "^3.0.1", + "postcss-load-config": "^4.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.0.2", + "source-map": "0.8.0-beta.0", + "sucrase": "^3.20.3", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/@esbuild/android-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/android-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/android-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/darwin-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/darwin-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/freebsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-loong64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-mips64el": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-riscv64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-s390x": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/linux-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/netbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/openbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/sunos-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/win32-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/win32-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/@esbuild/win32-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsup/node_modules/esbuild": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, + "node_modules/tsup/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/tsup/node_modules/rollup": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", + "fsevents": "~2.3.2" + } + }, "node_modules/tsutils": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", @@ -5616,6 +6576,25 @@ "resolved": "https://registry.npmjs.org/web-ifc/-/web-ifc-0.0.54.tgz", "integrity": "sha512-jWCcYbWQWY8t55JJHC9E5CKhAXOjHvKJN9b/qk2iUMS3rQE77Ve5ThxJMRw9XGW6oyHKKgOebIp9ho88f52AbA==" }, + "node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 8bd2ab5..0162f2a 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "eslint-plugin-react-refresh": "^0.3.4", "postcss": "^8.4.35", "tailwindcss": "^3.4.1", + "tsup": "^8.0.2", "typescript": "^5.0.2", "vite": "^4.3.9", "vite-plugin-glsl": "^1.3.0", diff --git a/src/BimModel/index.ts b/src/BimModel/index.ts index 7f6dda5..7dc3e2e 100644 --- a/src/BimModel/index.ts +++ b/src/BimModel/index.ts @@ -4,12 +4,13 @@ import { CubeMapComponent, MaterialComponent, ModelingComponent, - PropertyComponent, RendererComponent, RaycasterComponent, - StructureComponent, ProjectComponent, - SystemComponent, + WorkPlane, + Snapper, + DrawTool, + LevelSystem, } from "./src"; export class BimModel { @@ -42,7 +43,7 @@ export class BimModel { /* =====ProjectComponent===== */ const projectComponent = this.components.tools.get(ProjectComponent); projectComponent.enabled = true; - + projectComponent.init(this.structure); /* =====RendererComponent===== */ const renderer = this.components.tools.get(RendererComponent); renderer.enabled = true; @@ -54,22 +55,28 @@ export class BimModel { /* =====CubeMapComponent===== */ const cubeMapComponent = this.components.tools.get(CubeMapComponent); cubeMapComponent.enabled = true; + /* =====WorkPlane===== */ + const workPlane = this.components.tools.get(WorkPlane); + workPlane.enabled = true; + + /* =====Snapper===== */ + const snapper = this.components.tools.get(Snapper); + snapper.enabled = true; + + /* =====DrawTool===== */ + const drawTool = this.components.tools.get(DrawTool); + drawTool.enabled = true; + + /* =====LevelSystem===== */ + const levelSystem = this.components.tools.get(LevelSystem); + levelSystem.enabled = true; /* =====ModelingComponent===== */ const modelingComponent = this.components.tools.get(ModelingComponent); modelingComponent.enabled = true; modelingComponent.init(this.modeling, this.option); - /* =====PropertyComponent===== */ - const propertyComponent = this.components.tools.get(PropertyComponent); - propertyComponent.enabled = true; - - /* =====StructureComponent===== */ - const structureComponent = this.components.tools.get(StructureComponent); - structureComponent.enabled = true; - structureComponent.init(this.structure); - - new SystemComponent(this.components); this.components.gameLoop(); } } +// diff --git a/src/BimModel/src/system/04-draw-tool/index.ts b/src/BimModel/src/DrawTool/index.ts similarity index 74% rename from src/BimModel/src/system/04-draw-tool/index.ts rename to src/BimModel/src/DrawTool/index.ts index 0042ecb..cf636a6 100644 --- a/src/BimModel/src/system/04-draw-tool/index.ts +++ b/src/BimModel/src/DrawTool/index.ts @@ -1,12 +1,11 @@ /** - * @module DrawToolSystem + * @module DrawTool */ import * as THREE from "three"; -import {Components, RaycasterComponent} from "@BimModel/src"; +import {Components, Dimension, RaycasterComponent} from "@BimModel/src"; import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; +import {Component, Disposable, UUID} from "@BimModel/src/types"; import { BaseDraw, DrawArc, @@ -19,9 +18,10 @@ import { } from "./src"; import {effect} from "@preact/signals-react"; import {drawingTypeSignal} from "@BimModel/src/Signals"; -export class DrawToolSystem extends Component implements Disposable { - static readonly uuid = systemGUID.drawTool; +export class DrawTool extends Component implements Disposable { + static readonly uuid = UUID.DrawTool; enabled = false; + drawingDimension!: Dimension; private draws: {[name: string]: BaseDraw} = {}; /** @@ -29,7 +29,8 @@ export class DrawToolSystem extends Component implements Disposable { */ constructor(components: Components) { super(components); - this.components.tools.add(DrawToolSystem.uuid, this); + this.components.tools.add(DrawTool.uuid, this); + this.drawingDimension = new Dimension(components); this.initDraws(); effect(() => { for (const name in this.draws) { @@ -46,6 +47,7 @@ export class DrawToolSystem extends Component implements Disposable { }); } async dispose() { + this.drawingDimension?.dispose(); for (const name in this.draws) { this.draws[name]?.dispose(); } @@ -53,7 +55,7 @@ export class DrawToolSystem extends Component implements Disposable { } get() { - return DrawToolSystem.uuid; + return DrawTool.uuid; } private initDraws() { this.draws["Line"] = new DrawLine(this.components); @@ -65,4 +67,4 @@ export class DrawToolSystem extends Component implements Disposable { this.draws["Circle"] = new DrawCircle(this.components); } } -ToolComponent.libraryUUIDs.add(DrawToolSystem.uuid); +ToolComponent.libraryUUIDs.add(DrawTool.uuid); diff --git a/src/BimModel/src/system/04-draw-tool/src/BaseDraw.ts b/src/BimModel/src/DrawTool/src/BaseDraw.ts similarity index 96% rename from src/BimModel/src/system/04-draw-tool/src/BaseDraw.ts rename to src/BimModel/src/DrawTool/src/BaseDraw.ts index 9736010..1875081 100644 --- a/src/BimModel/src/system/04-draw-tool/src/BaseDraw.ts +++ b/src/BimModel/src/DrawTool/src/BaseDraw.ts @@ -8,11 +8,11 @@ import { MaterialComponent, lengthUnitSignal, Dimension, - GeometrySystem, + DrawTool, } from "@BimModel/src"; import {LineMaterial} from "three/examples/jsm/lines/LineMaterial"; -import {ILevel} from "@system/08-level/types"; import {getLocalVectorOnFace} from "@BimModel/src/utils"; +import {ILevel} from "@BimModel/src/LevelSystem/types"; const upDirection = new THREE.Vector3(0, 1, 0); export abstract class BaseDraw { @@ -29,7 +29,7 @@ export abstract class BaseDraw { ?.LocationMaterial as LineMaterial; } get drawingDimension(): Dimension { - return this.components.tools.get(GeometrySystem)?.drawingDimension; + return this.components.tools.get(DrawTool)?.drawingDimension; } get RaycasterComponent() { return this.components.tools.get(RaycasterComponent); diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawArc.ts b/src/BimModel/src/DrawTool/src/DrawArc.ts similarity index 87% rename from src/BimModel/src/system/04-draw-tool/src/DrawArc.ts rename to src/BimModel/src/DrawTool/src/DrawArc.ts index 54f1a90..106dd34 100644 --- a/src/BimModel/src/system/04-draw-tool/src/DrawArc.ts +++ b/src/BimModel/src/DrawTool/src/DrawArc.ts @@ -4,7 +4,8 @@ import * as THREE from "three"; import {Components} from "@BimModel/src/Components"; import {BaseDraw} from "./BaseDraw"; -import {LocationArc} from "@system/01-geometry"; +import {LocationArc} from "@system/geometry"; +import {getDirection} from "@BimModel/src/utils"; export class DrawArc extends BaseDraw { private tempLocation!: LocationArc; @@ -55,11 +56,12 @@ export class DrawArc extends BaseDraw { this.end, this.movingPoint ); - this.drawingDimension.updateRadius( - this.start, - this.movingPoint, - this.workPlane - ); + if (this.tempLocation.location) { + const {center, radius} = this.tempLocation.location; + const dir = getDirection(center, this.movingPoint); + const newMoving = center.clone().add(dir.multiplyScalar(radius)); + this.drawingDimension.updateRadius(center, newMoving, this.workPlane); + } } this.tempLocation.visible = true; this.drawingDimension.visible = true; diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawCircle.ts b/src/BimModel/src/DrawTool/src/DrawCircle.ts similarity index 55% rename from src/BimModel/src/system/04-draw-tool/src/DrawCircle.ts rename to src/BimModel/src/DrawTool/src/DrawCircle.ts index 693a1ca..dfec358 100644 --- a/src/BimModel/src/system/04-draw-tool/src/DrawCircle.ts +++ b/src/BimModel/src/DrawTool/src/DrawCircle.ts @@ -4,10 +4,12 @@ import * as THREE from "three"; import {Components} from "@BimModel/src/Components"; import {BaseDraw} from "./BaseDraw"; -import {LocationArc} from "@system/01-geometry"; +import {LocationArc} from "@system/geometry"; +import {getDirection} from "@BimModel/src/utils"; export class DrawCircle extends BaseDraw { - private tempLocation!: LocationArc; + private tempLeftLocation!: LocationArc; + private tempRightLocation!: LocationArc; private count = 0; private start: THREE.Vector3 = new THREE.Vector3(); private end: THREE.Vector3 = new THREE.Vector3(); @@ -17,6 +19,12 @@ export class DrawCircle extends BaseDraw { constructor(components: Components) { super(components); } + private getMirror() { + const dir = getDirection(this.start, this.end); + const dis = this.start.distanceTo(this.end); + return this.start.clone().add(dir.multiplyScalar(-dis)); + } + onClick = (_e: MouseEvent) => { if (!this.foundPoint || this.mousedown) return; this.inputKey = ""; @@ -33,12 +41,17 @@ export class DrawCircle extends BaseDraw { this.RaycasterComponent!.updateInfo(this.foundPoint); if (this.count === 0) return; this.end = this.foundPoint.clone(); - // if measureControl.tempDim is null then create a dimensionLine - if (!this.tempLocation) - this.tempLocation = new LocationArc(this.components, this.workPlane); - // toggle visibility to true - this.tempLocation.updateCircle(this.start, this.end); - this.tempLocation.visible = true; + // update tempLeftLocation + if (!this.tempLeftLocation) + this.tempLeftLocation = new LocationArc(this.components, this.workPlane); + this.tempLeftLocation.updateCircle(this.start, this.end); + this.tempLeftLocation.visible = true; + //update tempRightLocation + if (!this.tempRightLocation) + this.tempRightLocation = new LocationArc(this.components, this.workPlane); + this.tempRightLocation.updateCircle(this.start, this.getMirror()); + this.tempRightLocation.visible = true; + //update drawingDimension this.drawingDimension.updateRadius(this.start, this.end, this.workPlane); this.drawingDimension.visible = true; }; @@ -58,9 +71,10 @@ export class DrawCircle extends BaseDraw { this.inputKey = ""; return; } - if (this.tempLocation) { + if (this.tempLeftLocation && this.tempRightLocation) { this.end = this.getDistance(this.start, this.end, distance); - this.tempLocation.updateCircle(this.start, this.end); + this.tempLeftLocation.updateCircle(this.start, this.end); + this.tempRightLocation.updateCircle(this.start, this.getMirror()); this.onFinished(); this.inputKey = ""; this.count = 0; @@ -71,10 +85,14 @@ export class DrawCircle extends BaseDraw { } }; onFinished = () => { - if (this.tempLocation) { - this.tempLocation.visible = false; - this.drawingDimension.visible = false; - (this.tempLocation as any) = null; + this.drawingDimension.visible = false; + if (this.tempLeftLocation) { + this.tempLeftLocation.visible = false; + (this.tempLeftLocation as any) = null; + } + if (this.tempRightLocation) { + this.tempRightLocation.visible = false; + (this.tempRightLocation as any) = null; } this.inputKey = ""; this.count = 0; @@ -82,8 +100,10 @@ export class DrawCircle extends BaseDraw { onCallBack = (_value?: number) => {}; dispose = () => { this.drawingDimension.visible = false; - this.tempLocation?.dispose(); - (this.tempLocation as any) = null; + this.tempLeftLocation?.dispose(); + (this.tempLeftLocation as any) = null; + this.tempRightLocation?.dispose(); + (this.tempRightLocation as any) = null; this.count = 0; }; } diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawLine.ts b/src/BimModel/src/DrawTool/src/DrawLine.ts similarity index 98% rename from src/BimModel/src/system/04-draw-tool/src/DrawLine.ts rename to src/BimModel/src/DrawTool/src/DrawLine.ts index aa11fa1..fc01d38 100644 --- a/src/BimModel/src/system/04-draw-tool/src/DrawLine.ts +++ b/src/BimModel/src/DrawTool/src/DrawLine.ts @@ -4,7 +4,7 @@ import * as THREE from "three"; import {Components, isOrthoSignal} from "@BimModel/src"; import {BaseDraw} from "./BaseDraw"; -import {LocationLine} from "@system/01-geometry"; +import {LocationLine} from "@system/geometry"; export class DrawLine extends BaseDraw { private tempLocation!: LocationLine; private count = 0; diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawPickLine.ts b/src/BimModel/src/DrawTool/src/DrawPickLine.ts similarity index 100% rename from src/BimModel/src/system/04-draw-tool/src/DrawPickLine.ts rename to src/BimModel/src/DrawTool/src/DrawPickLine.ts diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawPoint.ts b/src/BimModel/src/DrawTool/src/DrawPoint.ts similarity index 100% rename from src/BimModel/src/system/04-draw-tool/src/DrawPoint.ts rename to src/BimModel/src/DrawTool/src/DrawPoint.ts diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawPolyLines.ts b/src/BimModel/src/DrawTool/src/DrawPolyLines.ts similarity index 100% rename from src/BimModel/src/system/04-draw-tool/src/DrawPolyLines.ts rename to src/BimModel/src/DrawTool/src/DrawPolyLines.ts diff --git a/src/BimModel/src/system/04-draw-tool/src/DrawRectangular.ts b/src/BimModel/src/DrawTool/src/DrawRectangular.ts similarity index 100% rename from src/BimModel/src/system/04-draw-tool/src/DrawRectangular.ts rename to src/BimModel/src/DrawTool/src/DrawRectangular.ts diff --git a/src/BimModel/src/system/04-draw-tool/src/index.ts b/src/BimModel/src/DrawTool/src/index.ts similarity index 100% rename from src/BimModel/src/system/04-draw-tool/src/index.ts rename to src/BimModel/src/DrawTool/src/index.ts diff --git a/src/BimModel/src/ElementId.ts b/src/BimModel/src/ElementId.ts new file mode 100644 index 0000000..af03f0a --- /dev/null +++ b/src/BimModel/src/ElementId.ts @@ -0,0 +1,5 @@ +export class ElementId { + static currentId = 0; + static undoIds: Set = new Set(); + static redoIds: Set = new Set(); +} diff --git a/src/BimModel/src/system/08-level/index.ts b/src/BimModel/src/LevelSystem/index.ts similarity index 90% rename from src/BimModel/src/system/08-level/index.ts rename to src/BimModel/src/LevelSystem/index.ts index 45e429d..14965e4 100644 --- a/src/BimModel/src/system/08-level/index.ts +++ b/src/BimModel/src/LevelSystem/index.ts @@ -5,8 +5,7 @@ import * as THREE from "three"; import {Components} from "@BimModel/src/Components"; import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; +import {Component, Disposable, UUID} from "@BimModel/src/types"; import {ILevel} from "./types"; import { clippingPlanesSignal, @@ -14,7 +13,7 @@ import { listLevelSignal, } from "@BimModel/src/Signals"; import {RendererComponent} from "@BimModel/src/RendererComponent"; -import {WorkPlaneSystem} from "../12-work-plane"; +import {WorkPlane} from "../WorkPlane"; const defaultLevels: ILevel[] = [ { @@ -36,13 +35,13 @@ const upPlane = new THREE.Plane(); const downPlane = new THREE.Plane(); export class LevelSystem extends Component implements Disposable { - static readonly uuid = systemGUID.level; + static readonly uuid = UUID.LevelSystem; enabled = false; get renderer() { return this.components.tools.get(RendererComponent); } get workPlane() { - return this.components.tools.get(WorkPlaneSystem); + return this.components.tools.get(WorkPlane); } get camera() { return this.renderer?.camera; diff --git a/src/BimModel/src/system/08-level/types.ts b/src/BimModel/src/LevelSystem/types.ts similarity index 100% rename from src/BimModel/src/system/08-level/types.ts rename to src/BimModel/src/LevelSystem/types.ts diff --git a/src/BimModel/src/ModelingComponent/src/InitComponents.tsx b/src/BimModel/src/ModelingComponent/src/InitComponents.tsx index d48f1b3..46892ca 100644 --- a/src/BimModel/src/ModelingComponent/src/InitComponents.tsx +++ b/src/BimModel/src/ModelingComponent/src/InitComponents.tsx @@ -9,6 +9,7 @@ import NewProject from "./Project/NewProject"; import VisibilityOption from "./VisibilityOption/VisibilityOption"; import LineOption from "./LineOption/LineOption"; import WorkPlaneOption from "./WorkPlaneOption/WorkPlaneOption"; +import ElementType from "./ModelingOption/ElementType/ElementType"; export function createModelingContainer(modeling: ModelingComponent) { const div = document.createElement("div"); @@ -18,6 +19,7 @@ export function createModelingContainer(modeling: ModelingComponent) { + ); return div; diff --git a/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementType.tsx b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementType.tsx new file mode 100644 index 0000000..d4d214b --- /dev/null +++ b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementType.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import {Button} from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import {Input} from "@/components/ui/input"; +import {Label} from "@/components/ui/label"; +import {openElementTypeSignal} from "@BimModel/src/Signals"; +const ElementType = () => { + const handleOK = () => { + openElementTypeSignal.value = false; + }; + return ( + + + + Edit profile + +
+

asdasd

+

asdasd

+
+ + + +
+
+ ); +}; + +export default ElementType; diff --git a/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeOption.tsx b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeOption.tsx new file mode 100644 index 0000000..5c0c750 --- /dev/null +++ b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeOption.tsx @@ -0,0 +1,72 @@ +import React from "react"; +import {Button} from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@components/ui/select"; +import {elementTypesSignal, openElementTypeSignal} from "@BimModel/src/Signals"; +import { + BeamType, + ColumnType, + FoundationType, + ReinforcementType, + SlabType, + WallType, +} from "@system/element-type"; +const ElementTypeOption = () => { + return ( +
+ + + + + + + Edit + + +
+ ); +}; + +export default ElementTypeOption; diff --git a/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeProperty.tsx b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeProperty.tsx new file mode 100644 index 0000000..f1da76e --- /dev/null +++ b/src/BimModel/src/ModelingComponent/src/ModelingOption/ElementType/ElementTypeProperty.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +const ElementTypeProperty = () => { + return
ElementTypeProperty
; +}; + +export default ElementTypeProperty; diff --git a/src/BimModel/src/ModelingComponent/src/ModelingOption/ModelingOption.tsx b/src/BimModel/src/ModelingComponent/src/ModelingOption/ModelingOption.tsx index acd2c21..7767c44 100644 --- a/src/BimModel/src/ModelingComponent/src/ModelingOption/ModelingOption.tsx +++ b/src/BimModel/src/ModelingComponent/src/ModelingOption/ModelingOption.tsx @@ -1,9 +1,13 @@ import React, {useState} from "react"; +import ElementTypeOption from "./ElementType/ElementTypeOption"; +import {modelingSignal} from "@BimModel/src/Signals"; const ModelingOption = () => { const [open, setOpen] = useState(false); return ( -
+
+ {modelingSignal.value && } +
); }; diff --git a/src/BimModel/src/ModelingComponent/src/Project/NewProject.tsx b/src/BimModel/src/ModelingComponent/src/Project/NewProject.tsx index d9db6d3..533094a 100644 --- a/src/BimModel/src/ModelingComponent/src/Project/NewProject.tsx +++ b/src/BimModel/src/ModelingComponent/src/Project/NewProject.tsx @@ -8,8 +8,7 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog"; -import {Input} from "@/components/ui/input"; -import {Label} from "@/components/ui/label"; + import {newProjectInfoSignal} from "@BimModel/src/Signals"; import {ModelingComponent} from "../.."; const NewProject: FC = ({modeling}) => { diff --git a/src/BimModel/src/ModelingComponent/src/Project/ProjectInfo.tsx b/src/BimModel/src/ModelingComponent/src/Project/ProjectInfo.tsx index 13fe7d0..dff53eb 100644 --- a/src/BimModel/src/ModelingComponent/src/Project/ProjectInfo.tsx +++ b/src/BimModel/src/ModelingComponent/src/Project/ProjectInfo.tsx @@ -1,4 +1,4 @@ -import React, {FC, useEffect} from "react"; +import React, {FC} from "react"; import {Button} from "@/components/ui/button"; import { Dialog, diff --git a/src/BimModel/src/ModelingComponent/src/VisibilityOption/Elevations.tsx b/src/BimModel/src/ModelingComponent/src/VisibilityOption/Elevations.tsx new file mode 100644 index 0000000..e18f304 --- /dev/null +++ b/src/BimModel/src/ModelingComponent/src/VisibilityOption/Elevations.tsx @@ -0,0 +1,22 @@ +import React, {memo} from "react"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@components/ui/select"; +const Elevations = () => { + return ( +
+ +
+ ); +}; + +export default memo(Elevations); diff --git a/src/BimModel/src/ModelingComponent/src/VisibilityOption/Levels.tsx b/src/BimModel/src/ModelingComponent/src/VisibilityOption/Levels.tsx new file mode 100644 index 0000000..bca587a --- /dev/null +++ b/src/BimModel/src/ModelingComponent/src/VisibilityOption/Levels.tsx @@ -0,0 +1,36 @@ +import React, {memo} from "react"; +import {listLevelSignal} from "@BimModel/src/Signals"; +import { + Select, + SelectContent, + SelectTrigger, + SelectItem, + SelectValue, +} from "@components/ui/select"; +import {ILevel} from "@BimModel/src/LevelSystem/types"; +const Levels = ({ + level, + onChangeLevel, +}: { + level: ILevel; + onChangeLevel: (value: string) => void; +}) => { + return ( +
+ +
+ ); +}; + +export default memo(Levels); diff --git a/src/BimModel/src/ModelingComponent/src/VisibilityOption/VisibilityOption.tsx b/src/BimModel/src/ModelingComponent/src/VisibilityOption/VisibilityOption.tsx index 534d2de..b0680c3 100644 --- a/src/BimModel/src/ModelingComponent/src/VisibilityOption/VisibilityOption.tsx +++ b/src/BimModel/src/ModelingComponent/src/VisibilityOption/VisibilityOption.tsx @@ -2,58 +2,21 @@ import React, {memo, ReactElement, useState} from "react"; import {VisibilityStates} from "../constants"; import {IVisibilityButton} from "../../types"; import VisibilityButton from "./VisibilityButton"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@components/ui/select"; + import {useSignalEffect} from "@preact/signals-react"; import { + visibilityStateSignal, currentLevelSignal, listLevelSignal, - visibilityStateSignal, } from "@BimModel/src/Signals"; -import {ILevel} from "@BimModel/src/system/08-level/types"; -const Levels = () => { - return ( -
- -
- ); -}; -const Elevations = () => { - return ( -
- -
- ); -}; +import Levels from "./Levels"; +import Elevations from "./Elevations"; const VisibilityOption = () => { const [option, setOption] = useState(<>); + const onChangeLevel = (value: string) => { + currentLevelSignal.value = listLevelSignal.value[+value]; + }; useSignalEffect(() => { switch (visibilityStateSignal.value) { case "3D": @@ -63,7 +26,12 @@ const VisibilityOption = () => { setOption(); break; case "Plane": - setOption(); + setOption( + + ); break; } }); diff --git a/src/BimModel/src/ModelingComponent/src/utils.ts b/src/BimModel/src/ModelingComponent/src/utils.ts index 79424fd..b94704d 100644 --- a/src/BimModel/src/ModelingComponent/src/utils.ts +++ b/src/BimModel/src/ModelingComponent/src/utils.ts @@ -1,69 +1,53 @@ import {IModeling} from "@ModelingComponent/types"; import {Modelings} from "./constants"; -export function getModelings(type: string): IModeling[] { - if (!type) return []; - const { +import {ICategory} from "@BimModel/src/types"; +const { + Finish, + Cancel, + Line, + Rectangular, + Arc, + Circle, + PolyLines, + Point, + PickLine, +} = Modelings; +export const CategoryTool: Record = { + Wall: [Line, Rectangular, Arc, PolyLines], + Floor: [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel], + Ceiling: [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel], + Roof: [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel], + Column: [Point], + Door: [Point], + Window: [Point], + "Structure Beam": [Line, Arc, Circle, PickLine], + "Structure Column": [Point], + "Structure Wall": [Line, Rectangular, Arc, Circle, PolyLines, PickLine], + "Structure Slab": [ Finish, + Line, + Rectangular, + Arc, + PolyLines, + PickLine, Cancel, + ], + "Structure Foundation": [ + Finish, Line, Rectangular, Arc, - Circle, PolyLines, - Point, PickLine, - } = Modelings; - switch (type) { - case "Wall": - return [Line, Rectangular, Arc, PolyLines]; - case "Floor": - return [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel]; - case "Ceiling": - return [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel]; - case "Roof": - return [Finish, Line, Rectangular, Arc, PolyLines, PickLine, Cancel]; - case "Column": - return [Point, Cancel]; - case "Door": - return [Point, Cancel]; - case "Window": - return [Point, Cancel]; - case "Structure Beam": - return [Line, Arc, Circle]; - case "Structure Column": - return [Point, Cancel]; - case "Structure Wall": - return [Line, Rectangular, Arc, Circle, PolyLines]; - case "Structure Slab": - return [ - Finish, - Line, - Rectangular, - Arc, - Circle, - PolyLines, - PickLine, - Cancel, - ]; - case "Structure Foundation": - return [ - Finish, - Line, - Rectangular, - Arc, - Circle, - PolyLines, - PickLine, - Cancel, - ]; - case "ReinForcement": - return []; - case "Duct": - return [Line, Cancel]; - case "Pipe": - return [Line, Cancel]; - default: - return []; - } + Cancel, + ], + ReinForcement: [], + Duct: [Line, Cancel], + Pipe: [Line, Cancel], + AirTerminal: [Line, Cancel], +}; + +export function getModelings(type: string): IModeling[] { + return type ? CategoryTool[type] ?? [] : []; } diff --git a/src/BimModel/src/ProjectComponent/index.ts b/src/BimModel/src/ProjectComponent/index.ts index a239a44..3636bca 100644 --- a/src/BimModel/src/ProjectComponent/index.ts +++ b/src/BimModel/src/ProjectComponent/index.ts @@ -8,13 +8,17 @@ import { currentLevelSignal, visibilityStateSignal, } from "../Signals"; -import {LevelSystem} from "../system"; +import {LevelSystem} from "../LevelSystem"; import {RendererComponent} from "../RendererComponent"; +import {IStructure} from "./types"; +import {createStructureContainer} from "./src"; -export * from "./src"; export class ProjectComponent extends Component implements Disposable { static readonly uuid = UUID.ProjectComponent; enabled = false; + private structureContainer!: HTMLDivElement; + readonly modelStructure = "Model Tree"; + get camera() { return this.components.tools.get(RendererComponent)?.camera; } @@ -48,5 +52,10 @@ export class ProjectComponent extends Component implements Disposable { get() { return ProjectComponent.uuid; } + init(_structure: HTMLDivElement) { + this.structureContainer = createStructureContainer(this); + _structure.appendChild(this.structureContainer); + } + onVisibility = (_visible: boolean, _structure: IStructure) => {}; } ToolComponent.libraryUUIDs.add(ProjectComponent.uuid); diff --git a/src/BimModel/src/StructureComponent/src/InitComponents.tsx b/src/BimModel/src/ProjectComponent/src/InitComponents.tsx similarity index 55% rename from src/BimModel/src/StructureComponent/src/InitComponents.tsx rename to src/BimModel/src/ProjectComponent/src/InitComponents.tsx index 80ff3ea..d701d40 100644 --- a/src/BimModel/src/StructureComponent/src/InitComponents.tsx +++ b/src/BimModel/src/ProjectComponent/src/InitComponents.tsx @@ -1,11 +1,11 @@ import React from "react"; import ReactDOM from "react-dom/client"; -import {StructureComponent} from ".."; +import {ProjectComponent} from ".."; import ModelStructure from "./ModelStructure/ModelStructure"; -export function createStructureContainer(structure: StructureComponent) { +export function createStructureContainer(project: ProjectComponent) { const div = document.createElement("div"); div.className = "h-full w-full relative"; - ReactDOM.createRoot(div).render(); + ReactDOM.createRoot(div).render(); return div; } diff --git a/src/BimModel/src/StructureComponent/src/ModelStructure/ModelStructure.tsx b/src/BimModel/src/ProjectComponent/src/ModelStructure/ModelStructure.tsx similarity index 88% rename from src/BimModel/src/StructureComponent/src/ModelStructure/ModelStructure.tsx rename to src/BimModel/src/ProjectComponent/src/ModelStructure/ModelStructure.tsx index 63e5a35..02eee85 100644 --- a/src/BimModel/src/StructureComponent/src/ModelStructure/ModelStructure.tsx +++ b/src/BimModel/src/ProjectComponent/src/ModelStructure/ModelStructure.tsx @@ -1,22 +1,22 @@ import React, {memo, ReactElement, useEffect, useState} from "react"; import * as THREE from "three"; import {ModelingTools} from "@BimModel/src/ModelingComponent"; -import {StructureComponent} from "../.."; -import {IStructure} from "../../types"; +import {ProjectComponent} from "@BimModel/src/ProjectComponent"; +import {IStructure} from "@BimModel/src/ProjectComponent/types"; import {modelStructureSignal} from "@BimModel/src/Signals"; import {useSignal, useSignalEffect} from "@preact/signals-react"; import StructureItem from "./StructureItem"; const defaultUuid = THREE.MathUtils.generateUUID(); -const ModelStructure = ({structure}: {structure: StructureComponent}) => { +const ModelStructure = ({project}: {project: ProjectComponent}) => { const [modelStructure, setModelStructure] = useState(<>); const expanded = useSignal([defaultUuid]); const getDefaultStructure = (): IStructure => { const modelStructure: IStructure = { - name: structure.modelStructure, + name: project.modelStructure, uuid: defaultUuid, visible: true, children: {}, - onVisibility: structure.onVisibility, + onVisibility: project.onVisibility, }; const childrenModelStructure = modelStructure.children; for (const tool of ModelingTools) { @@ -28,7 +28,7 @@ const ModelStructure = ({structure}: {structure: StructureComponent}) => { uuid: THREE.MathUtils.generateUUID(), visible: true, children: {}, - onVisibility: structure.onVisibility, + onVisibility: project.onVisibility, } as IStructure; const children = childrenModelStructure[discipline].children; for (const {type} of types) { @@ -38,7 +38,7 @@ const ModelStructure = ({structure}: {structure: StructureComponent}) => { uuid: THREE.MathUtils.generateUUID(), visible: true, children: {}, - onVisibility: structure.onVisibility, + onVisibility: project.onVisibility, } as IStructure; } } diff --git a/src/BimModel/src/StructureComponent/src/ModelStructure/StructureItem.tsx b/src/BimModel/src/ProjectComponent/src/ModelStructure/StructureItem.tsx similarity index 100% rename from src/BimModel/src/StructureComponent/src/ModelStructure/StructureItem.tsx rename to src/BimModel/src/ProjectComponent/src/ModelStructure/StructureItem.tsx index 34f5ff5..74eecc7 100644 --- a/src/BimModel/src/StructureComponent/src/ModelStructure/StructureItem.tsx +++ b/src/BimModel/src/ProjectComponent/src/ModelStructure/StructureItem.tsx @@ -1,7 +1,7 @@ import React, {memo, useState} from "react"; -import {IStructure} from "../../types"; import StructureTitle from "./StructureTitle"; import {modelStructureSignal} from "@BimModel/src/Signals"; +import {IStructure} from "../../types"; const isTreeGroupActive = (structure: IStructure): boolean => { let checked = false; diff --git a/src/BimModel/src/StructureComponent/src/ModelStructure/StructureTitle.tsx b/src/BimModel/src/ProjectComponent/src/ModelStructure/StructureTitle.tsx similarity index 97% rename from src/BimModel/src/StructureComponent/src/ModelStructure/StructureTitle.tsx rename to src/BimModel/src/ProjectComponent/src/ModelStructure/StructureTitle.tsx index 329f0b0..2b62c9d 100644 --- a/src/BimModel/src/StructureComponent/src/ModelStructure/StructureTitle.tsx +++ b/src/BimModel/src/ProjectComponent/src/ModelStructure/StructureTitle.tsx @@ -26,7 +26,7 @@ const StructureTitle: FC = ({ )}

+ )[] + | null; + abstract Decomposes: + | (IFC.IfcRelAggregates | Handle)[] + | null; + abstract GlobalId: IFC.IfcGloballyUniqueId; + abstract Name: IFC.IfcLabel | null; + abstract visible: boolean; + abstract onVisibility: (visible: boolean, element: IfcBase) => void; + abstract onIsDecomposedBy?: (Decomposed: IFC.IfcRelAggregates[]) => void; + abstract onDecomposes?: (Composed: IFC.IfcRelAggregates[]) => void; + abstract onContainsElements?: ( + ContainsElements: IFC.IfcRelContainedInSpatialStructure[] + ) => void; + abstract onHasAssociations?: ( + HasAssociations: IFC.IfcRelAssociates[] + ) => void; + abstract onIfc: () => + | IFC.IfcBuildingStorey + | IFC.IfcBuilding + | IFC.IfcSite + | IFC.IfcProject + | IFC.IfcElement; + get uuid() { + return this.GlobalId?.value; + } + get name() { + if (!this.Name) throw new Error(); + return this.Name?.value; + } + get hasChildren() { + if (!this.ContainsElements && !this.Decomposes) return false; + return this.ContainsElements!.length > 0 || this.Decomposes!.length > 0; + } + get children(): IfcBase[] { + if (!this.ContainsElements && !this.Decomposes) return []; + if (this.ContainsElements) { + return this.ContainsElements.reduce((re: IfcBase[], e) => { + return [ + ...re, + ...((e as IFC.IfcRelContainedInSpatialStructure) + .RelatedElements as any[]), + ]; + }, []); + } else if (this.Decomposes) { + return this.Decomposes.reduce((re: IfcBase[], e) => { + return [ + ...re, + ...((e as IFC.IfcRelAggregates).RelatedObjects as any[]), + ]; + }, []); + } else return []; + } + createIfcRelContainedInSpatialStructure(element: IFC.IfcSpatialElement) { + return new IFC.IfcRelContainedInSpatialStructure( + new IFC.IfcGloballyUniqueId(THREE.MathUtils.generateUUID()), + IfcOwnerHistory, + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + [], + element + ); + } + createIfcRelAggregates( + element: IFC.IfcSpatialElement | IFC.IfcObjectDefinition + ) { + return new IFC.IfcRelAggregates( + new IFC.IfcGloballyUniqueId(THREE.MathUtils.generateUUID()), + IfcOwnerHistory, + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + element, + [] + ); + } +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcBuilding.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcBuilding.ts new file mode 100644 index 0000000..7534df9 --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcBuilding.ts @@ -0,0 +1,137 @@ +/** + * @module ifc + */ +import * as THREE from "three"; +import {Handle, IFC4X3 as IFC, IFCBUILDING} from "web-ifc"; +import {IfcOwnerHistory, IfcBuildingAddress} from "./IfcInfo"; +import {IfcBase, IIfcBaseConfig} from "./IfcBase"; + +export interface IIfcBuildingConfig extends IIfcBaseConfig { + ElevationOfRefHeight: number; + ElevationOfTerrain: number; +} + +/** + * + */ +export class IfcBuilding extends IfcBase implements IFC.IfcBuilding { + /** @attributes */ + GlobalId: IFC.IfcGloballyUniqueId = new IFC.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory: IFC.IfcOwnerHistory | Handle | null = + IfcOwnerHistory; + Name!: IFC.IfcLabel | null; + Description!: IFC.IfcText | null; + ObjectType!: IFC.IfcLabel | null; + LongName!: IFC.IfcLabel | null; + ElevationOfRefHeight!: IFC.IfcLengthMeasure | null; + ElevationOfTerrain!: IFC.IfcLengthMeasure | null; + type = IFCBUILDING; + BuildingAddress: IFC.IfcPostalAddress | Handle | null = + IfcBuildingAddress; + + ObjectPlacement!: + | IFC.IfcObjectPlacement + | Handle + | null; + Representation!: + | IFC.IfcProductRepresentation + | Handle + | null; + + CompositionType!: IFC.IfcElementCompositionEnum | null; + ContainsElements!: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null; + ServicedBySystems!: + | (IFC.IfcRelServicesBuildings | Handle)[] + | null; + ReferencesElements!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + ReferencedBy!: + | (IFC.IfcRelAssignsToProduct | Handle)[] + | null; + IsDeclaredBy!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + Declares!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + IsTypedBy!: + | (IFC.IfcRelDefinesByType | Handle)[] + | null; + IsDefinedBy!: + | (IFC.IfcRelDefinesByProperties | Handle)[] + | null; + HasAssignments!: (IFC.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC.IfcRelNests | Handle)[] | null; + HasContext!: (IFC.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC.IfcRelAggregates | Handle)[] + | null; + Decomposes: (IFC.IfcRelAggregates | Handle)[] | null = [ + this.createIfcRelAggregates(this), + ]; + HasAssociations!: + | (IFC.IfcRelAssociates | Handle)[] + | null; + IsInterferedByElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + InterferesElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + PositionedRelativeTo!: + | (IFC.IfcRelPositions | Handle)[] + | null; + ReferencedInStructures!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + expressID!: number; + visible = true; + /** + * + */ + constructor(config: IIfcBuildingConfig) { + super(); + const { + Name, + ObjectType, + Description, + LongName, + ElevationOfRefHeight, + ElevationOfTerrain, + } = config; + this.Name = new IFC.IfcLabel(Name); + this.Description = new IFC.IfcLabel(Description); + this.ObjectType = new IFC.IfcLabel(ObjectType); + this.LongName = new IFC.IfcLabel(LongName); + this.ElevationOfRefHeight = new IFC.IfcLengthMeasure(ElevationOfRefHeight); + this.ElevationOfTerrain = new IFC.IfcLengthMeasure(ElevationOfTerrain); + } + + onVisibility!: (visible: boolean, element: IfcBase) => void; + onIsDecomposedBy?: ((Decomposed: IFC.IfcRelAggregates[]) => void) | undefined; + onDecomposes?: ((Composed: IFC.IfcRelAggregates[]) => void) | undefined; + onContainsElements?: + | ((ContainsElements: IFC.IfcRelContainedInSpatialStructure[]) => void) + | undefined; + onHasAssociations?: + | ((HasAssociations: IFC.IfcRelAssociates[]) => void) + | undefined; + onIfc = () => { + return this; + }; +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcBuildingStorey.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcBuildingStorey.ts new file mode 100644 index 0000000..009ae58 --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcBuildingStorey.ts @@ -0,0 +1,170 @@ +/** + * @module ifc + */ +import * as THREE from "three"; +import {Handle, IFC4X3 as IFC, IFCBUILDINGSTOREY} from "web-ifc"; +import {IfcOwnerHistory} from "./IfcInfo"; +import {IfcBase, IIfcBaseConfig} from "./IfcBase"; +export interface IIfcBuildingStoreyConfig extends IIfcBaseConfig { + Elevation: number; + levelIndex: number; +} +export const defaultLevelConfig: IIfcBuildingStoreyConfig[] = [ + { + Name: "Level 1", + ObjectType: "Level Circle:Level 1", + LongName: "Level Circle", + Description: "", + Elevation: 0.0, + levelIndex: 0, + }, + { + Name: "Level 2", + ObjectType: "Level Circle:Level 2", + LongName: "Level Circle", + Description: "", + Elevation: 4.0, + levelIndex: 1, + }, +]; +/** + * + */ +export class IfcBuildingStorey + extends IfcBase + implements IFC.IfcBuildingStorey +{ + /** @attributes */ + GlobalId: IFC.IfcGloballyUniqueId = new IFC.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory: IFC.IfcOwnerHistory | Handle | null = + IfcOwnerHistory; + Name!: IFC.IfcLabel | null; + Description!: IFC.IfcText | null; + ObjectType!: IFC.IfcLabel | null; + LongName!: IFC.IfcLabel | null; + Elevation!: IFC.IfcLengthMeasure | null; + type = IFCBUILDINGSTOREY; + + ObjectPlacement!: + | IFC.IfcObjectPlacement + | Handle + | null; + Representation!: + | IFC.IfcProductRepresentation + | Handle + | null; + CompositionType!: IFC.IfcElementCompositionEnum | null; + ContainsElements: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null = [this.createIfcRelContainedInSpatialStructure(this)]; + ServicedBySystems!: + | (IFC.IfcRelServicesBuildings | Handle)[] + | null; + ReferencesElements!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + ReferencedBy!: + | (IFC.IfcRelAssignsToProduct | Handle)[] + | null; + IsDeclaredBy!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + Declares!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + IsTypedBy!: + | (IFC.IfcRelDefinesByType | Handle)[] + | null; + IsDefinedBy!: + | (IFC.IfcRelDefinesByProperties | Handle)[] + | null; + HasAssignments!: (IFC.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC.IfcRelNests | Handle)[] | null; + HasContext!: (IFC.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC.IfcRelAssociates | Handle)[] + | null; + IsInterferedByElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + InterferesElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + PositionedRelativeTo!: + | (IFC.IfcRelPositions | Handle)[] + | null; + ReferencedInStructures!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + expressID!: number; + visible = true; + levelIndex!: number; + set elevation(elevation: number) { + if (!this.Elevation) return; + this.Elevation.value = elevation; + } + /** + * + */ + constructor(config: IIfcBuildingStoreyConfig) { + super(); + const {Name, ObjectType, Description, LongName, Elevation, levelIndex} = + config; + this.Name = new IFC.IfcLabel(Name); + this.Description = new IFC.IfcLabel(Description); + this.ObjectType = new IFC.IfcLabel(ObjectType); + this.LongName = new IFC.IfcLabel(LongName); + this.Elevation = new IFC.IfcLengthMeasure(Elevation); + this.levelIndex = levelIndex; + } + + onVisibility!: (visible: boolean, element: IfcBase) => void; + onIsDecomposedBy?: ((Decomposed: IFC.IfcRelAggregates[]) => void) | undefined; + onDecomposes?: ((Composed: IFC.IfcRelAggregates[]) => void) | undefined; + onContainsElements?: + | ((ContainsElements: IFC.IfcRelContainedInSpatialStructure[]) => void) + | undefined; + onHasAssociations?: + | ((HasAssociations: IFC.IfcRelAssociates[]) => void) + | undefined; + onIfc = () => { + return this; + }; + + static createInstanceLevelItem( + Name: string, + ObjectType: string, + Description: string, + LongName: string, + Elevation: number, + levelIndex: number, + onVisibility: (visible: boolean, element: IfcBase) => void + ): IfcBuildingStorey { + const level = new IfcBuildingStorey({ + Name, + Description, + LongName, + ObjectType, + Elevation, + levelIndex, + }); + level.onVisibility = onVisibility; + return level; + } +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcElement.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcElement.ts new file mode 100644 index 0000000..16c105e --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcElement.ts @@ -0,0 +1,134 @@ +/** + * @module ifc + */ + +import * as THREE from "three"; +import {Handle, IFC4X3 as IFC} from "web-ifc"; +import {IfcOwnerHistory} from "./IfcInfo"; +import {IfcBase} from "./IfcBase"; + +/** + * + */ +export class IfcElement extends IfcBase implements IFC.IfcElement { + /** @attributes */ + GlobalId!: IFC.IfcGloballyUniqueId; + OwnerHistory: IFC.IfcOwnerHistory | Handle | null = + IfcOwnerHistory; + Name!: IFC.IfcLabel | null; + Description!: IFC.IfcText | null; + ObjectType!: IFC.IfcLabel | null; + type!: number; + + ObjectPlacement!: + | IFC.IfcObjectPlacement + | Handle + | null; + Representation!: + | IFC.IfcProductRepresentation + | Handle + | null; + Tag!: IFC.IfcIdentifier | null; + FillsVoids!: + | (IFC.IfcRelFillsElement | Handle)[] + | null; + ConnectedTo!: + | (IFC.IfcRelConnectsElements | Handle)[] + | null; + IsInterferedByElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + InterferesElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + HasProjections!: + | (IFC.IfcRelProjectsElement | Handle)[] + | null; + HasOpenings!: + | (IFC.IfcRelVoidsElement | Handle)[] + | null; + IsConnectionRealization!: + | ( + | IFC.IfcRelConnectsWithRealizingElements + | Handle + )[] + | null; + ProvidesBoundaries!: + | (IFC.IfcRelSpaceBoundary | Handle)[] + | null; + ConnectedFrom!: + | (IFC.IfcRelConnectsElements | Handle)[] + | null; + ContainedInStructure!: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null; + HasCoverings!: + | (IFC.IfcRelCoversBldgElements | Handle)[] + | null; + HasSurfaceFeatures!: + | (IFC.IfcRelAdheresToElement | Handle)[] + | null; + ReferencedBy!: + | (IFC.IfcRelAssignsToProduct | Handle)[] + | null; + PositionedRelativeTo!: + | (IFC.IfcRelPositions | Handle)[] + | null; + ReferencedInStructures!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + IsDeclaredBy!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + Declares!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + IsTypedBy!: + | (IFC.IfcRelDefinesByType | Handle)[] + | null; + IsDefinedBy!: + | (IFC.IfcRelDefinesByProperties | Handle)[] + | null; + HasAssignments!: (IFC.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC.IfcRelNests | Handle)[] | null; + HasContext!: (IFC.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC.IfcRelAggregates | Handle)[] + | null; + HasAssociations!: + | (IFC.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + ContainsElements!: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null; + Decomposes!: (IFC.IfcRelAggregates | Handle)[] | null; + + visible!: boolean; + + onVisibility!: (visible: boolean, element: IfcBase) => void; + onIsDecomposedBy?: ((Decomposed: IFC.IfcRelAggregates[]) => void) | undefined; + onDecomposes?: ((Composed: IFC.IfcRelAggregates[]) => void) | undefined; + onContainsElements?: + | ((ContainsElements: IFC.IfcRelContainedInSpatialStructure[]) => void) + | undefined; + onHasAssociations?: + | ((HasAssociations: IFC.IfcRelAssociates[]) => void) + | undefined; + onIfc!: () => + | IFC.IfcElement + | IFC.IfcBuildingStorey + | IFC.IfcBuilding + | IFC.IfcSite + | IFC.IfcProject; +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcInfo.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcInfo.ts new file mode 100644 index 0000000..ad0693f --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcInfo.ts @@ -0,0 +1,154 @@ +import {IFC4X3 as IFC} from "web-ifc"; +const version = "0.0.1"; +const application = "Web application Bim-modeling"; +export const IfcActorRole: IFC.IfcActorRole = new IFC.IfcActorRole( + IFC.IfcRoleEnum.STRUCTURALENGINEER, + new IFC.IfcLabel(""), + new IFC.IfcText("") +); +export const IfcAddress = new IFC.IfcAddress( + IFC.IfcAddressTypeEnum.HOME, + new IFC.IfcText(""), + new IFC.IfcLabel("") +); +export const IfcOrganization = new IFC.IfcOrganization( + new IFC.IfcIdentifier(""), + new IFC.IfcLabel("@ryuga"), + new IFC.IfcText(""), + [IfcActorRole], + [IfcAddress] +); +export const IfcPerson = new IFC.IfcPerson( + new IFC.IfcIdentifier("Structure Modeler"), + new IFC.IfcLabel("Ryuga"), + new IFC.IfcLabel("Ryuzaki"), + [new IFC.IfcLabel("")], + [new IFC.IfcLabel("")], + [new IFC.IfcLabel("")], + [IfcActorRole], + [IfcAddress] +); +export const IfcPersonAndOrganization = new IFC.IfcPersonAndOrganization( + IfcPerson, + IfcOrganization, + [IfcActorRole] +); +export const IfcApplication = new IFC.IfcApplication( + IfcOrganization, + new IFC.IfcLabel(version), + new IFC.IfcLabel(application), + new IFC.IfcIdentifier("") +); +export const IfcOwnerHistory = new IFC.IfcOwnerHistory( + IfcPersonAndOrganization, + IfcApplication, + IFC.IfcStateEnum.READWRITE, + IFC.IfcChangeActionEnum.MODIFIED, + new IFC.IfcTimeStamp(Date.now()), + IfcPersonAndOrganization, + IfcApplication, + new IFC.IfcTimeStamp(Date.now()) +); +export const IfcCartesianPointGlobal2D: IFC.IfcCartesianPoint = + new IFC.IfcCartesianPoint([ + new IFC.IfcLengthMeasure(0), + new IFC.IfcLengthMeasure(0), + ]); +export const IfcCartesianPointLocal2D: IFC.IfcCartesianPoint = { + ...IfcCartesianPointGlobal2D, +}; +export const IfcCartesianPointGlobal3D = new IFC.IfcCartesianPoint([ + new IFC.IfcLengthMeasure(0), + new IFC.IfcLengthMeasure(0), +]); +export const IfcCartesianPointLocal3D: IFC.IfcCartesianPoint = { + ...IfcCartesianPointGlobal3D, +}; +export const IfcDirectionGlobal2D: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(1.0), + new IFC.IfcReal(0.0), +]); +export const IfcDirectionLocal2D: IFC.IfcDirection = {...IfcDirectionGlobal2D}; +export const IfcDirectionGlobal3D: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(0.0), + new IFC.IfcReal(1.0), + new IFC.IfcReal(0.0), +]); +export const IfcDirectionLocal3D: IFC.IfcDirection = {...IfcDirectionGlobal3D}; +export const IfcDirectionTrueNorth3D: IFC.IfcDirection = { + ...IfcDirectionGlobal3D, +}; +export const IfcAxisXPositive: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(1.0), + new IFC.IfcReal(0.0), + new IFC.IfcReal(0.0), +]); +export const IfcAxisXNegative: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(-1.0), + new IFC.IfcReal(0.0), + new IFC.IfcReal(0.0), +]); +export const IfcAxisYPositive: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(0.0), + new IFC.IfcReal(1.0), + new IFC.IfcReal(0.0), +]); +export const IfcAxisYNegative: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(0.0), + new IFC.IfcReal(-1.0), + new IFC.IfcReal(0.0), +]); +export const IfcAxisZPositive: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(0.0), + new IFC.IfcReal(0.0), + new IFC.IfcReal(1.0), +]); +export const IfcAxisZNegative: IFC.IfcDirection = new IFC.IfcDirection([ + new IFC.IfcReal(0.0), + new IFC.IfcReal(0.0), + new IFC.IfcReal(-1.0), +]); +export const IfcAxis2PlacementGlobal3D = new IFC.IfcAxis2Placement3D( + IfcCartesianPointGlobal3D, + IfcDirectionGlobal3D, + IfcDirectionLocal3D +); +export const IfcAxis2PlacementLocal3D = new IFC.IfcAxis2Placement3D( + IfcCartesianPointGlobal3D, + IfcDirectionLocal3D, + IfcDirectionLocal3D +); +export const IfcAxis2PlacementGlobal = new IFC.IfcAxis2Placement3D( + IfcCartesianPointGlobal3D, + IfcDirectionGlobal3D, + IfcDirectionLocal3D +); +export const IfcAxis2PlacementLocal = new IFC.IfcAxis2Placement3D( + IfcCartesianPointGlobal3D, + IfcDirectionLocal3D, + IfcDirectionLocal3D +); +export const IfcBuildingAddress = new IFC.IfcPostalAddress( + IFC.IfcAddressTypeEnum.OFFICE, + new IFC.IfcText(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + [new IFC.IfcLabel("")], + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel("") +); +export const IfcSiteAddress = new IFC.IfcPostalAddress( + IFC.IfcAddressTypeEnum.SITE, + new IFC.IfcText(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + [new IFC.IfcLabel("")], + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel(""), + new IFC.IfcLabel("") +); diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcProject.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcProject.ts new file mode 100644 index 0000000..986b71a --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcProject.ts @@ -0,0 +1,107 @@ +/** + * @module ifc + */ +import * as THREE from "three"; +import {Handle, IFC4X3 as IFC, IFCPROJECT} from "web-ifc"; +import {IfcOwnerHistory} from "./IfcInfo"; +import {IfcBase, IIfcBaseConfig} from "./IfcBase"; +import {IfcUnitAssignment} from "./IfcUnit"; + +export interface IIfcProjectConfig extends IIfcBaseConfig { + Phase: string; +} +const defaultProjectConfig: IIfcProjectConfig = { + Name: "Bim-modeling", + Description: "https://github.com/RyugaRyuzaki/bim-modeling", + ObjectType: "Bim-modeling", + LongName: "Web application Bim-modeling", + Phase: "Concept modeling", +}; +/** + *https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcProject.htm + */ +export class IfcProject extends IfcBase implements IFC.IfcProject { + /** @attributes */ + GlobalId: IFC.IfcGloballyUniqueId = new IFC.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory: IFC.IfcOwnerHistory | Handle | null = + IfcOwnerHistory; + Name!: IFC.IfcLabel | null; + Description!: IFC.IfcText | null; + ObjectType!: IFC.IfcLabel | null; + LongName!: IFC.IfcLabel | null; + Phase!: IFC.IfcLabel | null; + type = IFCPROJECT; + + RepresentationContexts: + | (IFC.IfcRepresentationContext | Handle)[] + | null = [ + new IFC.IfcRepresentationContext( + new IFC.IfcLabel("Model"), + new IFC.IfcLabel("3D") + ), + ]; + UnitsInContext: IFC.IfcUnitAssignment | Handle | null = + IfcUnitAssignment; + IsDefinedBy!: + | (IFC.IfcRelDefinesByProperties | Handle)[] + | null; + Declares!: (IFC.IfcRelDeclares | Handle)[] | null; + HasAssignments!: (IFC.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC.IfcRelNests | Handle)[] | null; + HasContext!: (IFC.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC.IfcRelAggregates | Handle)[] + | null; + Decomposes: IFC.IfcRelAggregates[] | null = [ + this.createIfcRelAggregates(this), + ]; + ContainsElements!: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null; + + HasAssociations!: + | (IFC.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + visible = true; + /** + * + */ + constructor(config: IIfcProjectConfig = defaultProjectConfig) { + super(); + const {Name, Description, LongName, ObjectType, Phase} = config; + this.Name = new IFC.IfcLabel(Name); + this.Description = new IFC.IfcLabel(Description); + this.ObjectType = new IFC.IfcLabel(ObjectType); + this.LongName = new IFC.IfcLabel(LongName); + this.Phase = new IFC.IfcLabel(Phase); + } + onVisibility!: (visible: boolean, element: IfcBase) => void; + onIsDecomposedBy?: ((Decomposed: IFC.IfcRelAggregates[]) => void) | undefined; + onContainsElements?: + | ((ContainsElements: IFC.IfcRelContainedInSpatialStructure[]) => void) + | undefined; + onHasAssociations?: + | ((HasAssociations: IFC.IfcRelAssociates[]) => void) + | undefined; + onDecomposes = (Composed: IFC.IfcRelAggregates[]) => { + if (!this.Decomposes) return; + this.Decomposes = [...this.Decomposes, ...Composed]; + }; + onIfc = () => { + return this; + }; + static createInstance( + onVisibility: (visible: boolean, element: IfcBase) => void + ): IfcProject { + const project = new IfcProject(); + project.onVisibility = onVisibility; + return project; + } +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcSite.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcSite.ts new file mode 100644 index 0000000..9c1e692 --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcSite.ts @@ -0,0 +1,141 @@ +/** + * @module ifc + */ +import * as THREE from "three"; +import {Handle, IFC4X3 as IFC, IFCSITE} from "web-ifc"; +import {IfcOwnerHistory, IfcSiteAddress} from "./IfcInfo"; +import {IfcBase, IIfcBaseConfig} from "./IfcBase"; + +export interface IIfcSiteConfig extends IIfcBaseConfig { + RefLatitude: number[]; + RefLongitude: number[]; + RefElevation: number; +} + +/** + * + */ +export class IfcSite extends IfcBase implements IFC.IfcSite { + /** @attributes */ + GlobalId: IFC.IfcGloballyUniqueId = new IFC.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory: IFC.IfcOwnerHistory | Handle | null = + IfcOwnerHistory; + Name!: IFC.IfcLabel | null; + Description!: IFC.IfcText | null; + ObjectType!: IFC.IfcLabel | null; + LongName!: IFC.IfcLabel | null; + type = IFCSITE; + SiteAddress: IFC.IfcPostalAddress | Handle | null = + IfcSiteAddress; + RefLatitude!: IFC.IfcCompoundPlaneAngleMeasure | null; + RefLongitude!: IFC.IfcCompoundPlaneAngleMeasure | null; + RefElevation!: IFC.IfcLengthMeasure | null; + + ObjectPlacement!: + | IFC.IfcObjectPlacement + | Handle + | null; + Representation!: + | IFC.IfcProductRepresentation + | Handle + | null; + CompositionType!: IFC.IfcElementCompositionEnum | null; + LandTitleNumber!: IFC.IfcLabel | null; + ContainsElements!: + | ( + | IFC.IfcRelContainedInSpatialStructure + | Handle + )[] + | null; + ServicedBySystems!: + | (IFC.IfcRelServicesBuildings | Handle)[] + | null; + ReferencesElements!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + ReferencedBy!: + | (IFC.IfcRelAssignsToProduct | Handle)[] + | null; + IsDeclaredBy!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + Declares!: + | (IFC.IfcRelDefinesByObject | Handle)[] + | null; + IsTypedBy!: + | (IFC.IfcRelDefinesByType | Handle)[] + | null; + IsDefinedBy!: + | (IFC.IfcRelDefinesByProperties | Handle)[] + | null; + HasAssignments!: (IFC.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC.IfcRelNests | Handle)[] | null; + HasContext!: (IFC.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC.IfcRelAggregates | Handle)[] + | null; + Decomposes: (IFC.IfcRelAggregates | Handle)[] | null = [ + this.createIfcRelAggregates(this), + ]; + HasAssociations!: + | (IFC.IfcRelAssociates | Handle)[] + | null; + IsInterferedByElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + InterferesElements!: + | (IFC.IfcRelInterferesElements | Handle)[] + | null; + PositionedRelativeTo!: + | (IFC.IfcRelPositions | Handle)[] + | null; + ReferencedInStructures!: + | ( + | IFC.IfcRelReferencedInSpatialStructure + | Handle + )[] + | null; + expressID!: number; + visible = true; + /** + * + */ + constructor(config: IIfcSiteConfig) { + super(); + const { + Name, + ObjectType, + Description, + LongName, + RefElevation, + RefLatitude, + RefLongitude, + } = config; + this.Name = new IFC.IfcLabel(Name); + this.Description = new IFC.IfcLabel(Description); + this.ObjectType = new IFC.IfcLabel(ObjectType); + this.LongName = new IFC.IfcLabel(LongName); + this.RefElevation = new IFC.IfcLengthMeasure(RefElevation); + this.RefLatitude = new IFC.IfcCompoundPlaneAngleMeasure(RefLatitude); + this.RefLongitude = new IFC.IfcCompoundPlaneAngleMeasure(RefLongitude); + } + + onVisibility!: (visible: boolean, element: IfcBase) => void; + onIsDecomposedBy?: ((Decomposed: IFC.IfcRelAggregates[]) => void) | undefined; + onDecomposes?: ((Composed: IFC.IfcRelAggregates[]) => void) | undefined; + onContainsElements?: + | ((ContainsElements: IFC.IfcRelContainedInSpatialStructure[]) => void) + | undefined; + onHasAssociations?: + | ((HasAssociations: IFC.IfcRelAssociates[]) => void) + | undefined; + onIfc = () => { + return this; + }; +} diff --git a/src/BimModel/src/ProjectComponent/src/ifc/IfcUnit.ts b/src/BimModel/src/ProjectComponent/src/ifc/IfcUnit.ts new file mode 100644 index 0000000..e656ae9 --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/IfcUnit.ts @@ -0,0 +1,123 @@ +import {IFC4X3 as IFC} from "web-ifc"; +import {IfcAxis2PlacementGlobal3D, IfcDirectionTrueNorth3D} from "./IfcInfo"; + +export const IfcDimensionalExponents: IFC.IfcDimensionalExponents = + new IFC.IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0); +export const IfcLengthUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.LENGTHUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcAreaUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.AREAUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcVolumeUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.VOLUMEUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcPlaneAngleUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.PLANEANGLEUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcMassUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.MASSUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcTimeUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.TIMEUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcThermoDynamicTemperatureUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); +export const IfcLuminousIntensityUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.LUMINOUSINTENSITYUNIT, + new IFC.IfcSIPrefix(), + new IFC.IfcSIUnitName() +); + +export const IfcMeasureWithUnit = new IFC.IfcMeasureWithUnit( + new IFC.IfcPlaneAngleMeasure(0.0174532925199433), + IfcPlaneAngleUnit +); +export const IfcConversionBasedUnit = new IFC.IfcConversionBasedUnit( + IfcDimensionalExponents, + IFC.IfcUnitEnum.RADIOACTIVITYUNIT, + new IFC.IfcLabel(""), + IfcMeasureWithUnit +); +export const IfcUnitAssignment = new IFC.IfcUnitAssignment([ + IfcLengthUnit, + IfcAreaUnit, + IfcVolumeUnit, + IfcPlaneAngleUnit, + IfcMassUnit, + IfcTimeUnit, + IfcThermoDynamicTemperatureUnit, + IfcLuminousIntensityUnit, +]); +export const IfcGeometricRepresentationContext = + new IFC.IfcGeometricRepresentationContext( + new IFC.IfcLabel("Model"), + new IFC.IfcLabel("0.0"), + new IFC.IfcDimensionCount(0.0), + new IFC.IfcReal(1e-3), + IfcAxis2PlacementGlobal3D, + IfcDirectionTrueNorth3D + ); +export const IfcGeometricRepresentationSubContext1 = + new IFC.IfcGeometricRepresentationSubContext( + new IFC.IfcLabel("Axis"), + new IFC.IfcLabel("Model"), + IfcAxis2PlacementGlobal3D, + IfcGeometricRepresentationContext, + new IFC.IfcPositiveRatioMeasure(1e-3), + IFC.IfcGeometricProjectionEnum.GRAPH_VIEW, + new IFC.IfcLabel("") + ); +export const IfcGeometricRepresentationSubContext2 = + new IFC.IfcGeometricRepresentationSubContext( + new IFC.IfcLabel("Body"), + new IFC.IfcLabel("Model"), + IfcAxis2PlacementGlobal3D, + IfcGeometricRepresentationContext, + new IFC.IfcPositiveRatioMeasure(1e-3), + IFC.IfcGeometricProjectionEnum.MODEL_VIEW, + new IFC.IfcLabel("") + ); +export const IfcGeometricRepresentationSubContext3 = + new IFC.IfcGeometricRepresentationSubContext( + new IFC.IfcLabel("Box"), + new IFC.IfcLabel("Model"), + IfcAxis2PlacementGlobal3D, + IfcGeometricRepresentationContext, + new IFC.IfcPositiveRatioMeasure(1e-3), + IFC.IfcGeometricProjectionEnum.MODEL_VIEW, + new IFC.IfcLabel("") + ); +export const IfcGeometricRepresentationSubContext4 = + new IFC.IfcGeometricRepresentationSubContext( + new IFC.IfcLabel("Box"), + new IFC.IfcLabel("Model"), + IfcAxis2PlacementGlobal3D, + IfcGeometricRepresentationContext, + new IFC.IfcPositiveRatioMeasure(1e-3), + IFC.IfcGeometricProjectionEnum.USERDEFINED, + new IFC.IfcLabel("") + ); diff --git a/src/BimModel/src/ProjectComponent/src/ifc/index.ts b/src/BimModel/src/ProjectComponent/src/ifc/index.ts new file mode 100644 index 0000000..6092205 --- /dev/null +++ b/src/BimModel/src/ProjectComponent/src/ifc/index.ts @@ -0,0 +1,7 @@ +export * from "./IfcBase"; +export * from "./IfcInfo"; +export * from "./IfcUnit"; +export * from "./IfcBuildingStorey"; +export * from "./IfcBuilding"; +export * from "./IfcSite"; +export * from "./IfcProject"; diff --git a/src/BimModel/src/ProjectComponent/src/index.ts b/src/BimModel/src/ProjectComponent/src/index.ts index d789205..d42708e 100644 --- a/src/BimModel/src/ProjectComponent/src/index.ts +++ b/src/BimModel/src/ProjectComponent/src/index.ts @@ -1 +1,2 @@ -export const element = 5; +export * from "./InitComponents"; +export * from "./ifc"; diff --git a/src/BimModel/src/ProjectComponent/types.ts b/src/BimModel/src/ProjectComponent/types.ts index d13aedd..8e451a7 100644 --- a/src/BimModel/src/ProjectComponent/types.ts +++ b/src/BimModel/src/ProjectComponent/types.ts @@ -15,3 +15,10 @@ export interface IProjectInfo { export interface IProject { info: IProjectInfo; } +export interface IStructure { + name: string; + uuid: string; + visible: boolean; + onVisibility: (visible: boolean, structure: IStructure) => void; + children: {[name: string]: IStructure}; +} diff --git a/src/BimModel/src/PropertyComponent/index.ts b/src/BimModel/src/PropertyComponent/index.ts deleted file mode 100644 index 099f9d3..0000000 --- a/src/BimModel/src/PropertyComponent/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as THREE from "three"; -import {Components} from "../Components"; -import {ToolComponent} from "../Tool"; -import {Component, Disposable, UUID} from "../types"; -import {ProjectComponent} from "../ProjectComponent"; -export class PropertyComponent extends Component implements Disposable { - static readonly uuid = UUID.PropertyComponent; - enabled = false; - get ProjectComponent(): ProjectComponent { - return this.components.tools.get(ProjectComponent); - } - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(PropertyComponent.uuid, this); - } - async dispose() {} - get() { - return PropertyComponent.uuid; - } -} -ToolComponent.libraryUUIDs.add(PropertyComponent.uuid); diff --git a/src/BimModel/src/RendererComponent/index.ts b/src/BimModel/src/RendererComponent/index.ts index 80d6b0e..0c57480 100644 --- a/src/BimModel/src/RendererComponent/index.ts +++ b/src/BimModel/src/RendererComponent/index.ts @@ -14,7 +14,7 @@ import { } from "../types"; import {CSS2DRenderer} from "three/examples/jsm/renderers/CSS2DRenderer"; import {Camera, PostProduction} from "./src"; -import {WorkPlaneSystem} from "../system"; +import {WorkPlane} from "../WorkPlane"; export * from "./src"; /** * @@ -203,7 +203,7 @@ export class RendererComponent }, 100); }; private onUpdate = () => { - const materialGrid = this.components.tools.get(WorkPlaneSystem).material; + const materialGrid = this.components.tools.get(WorkPlane).material; materialGrid.uniforms.uZoom.value = this.camera.currentCamera.zoom; }; } diff --git a/src/BimModel/src/Signals/ElementType/index.ts b/src/BimModel/src/Signals/ElementType/index.ts new file mode 100644 index 0000000..6e60e64 --- /dev/null +++ b/src/BimModel/src/Signals/ElementType/index.ts @@ -0,0 +1,69 @@ +import {ElementTypeSystem} from "@BimModel/src/system"; +import { + WallType, + BeamType, + ColumnType, + SlabType, + FoundationType, + ReinforcementType, +} from "@system/element-type"; +import {signal} from "@preact/signals-react"; +export const openElementTypeSignal = signal(false); +/**===WallType=== */ +export const wallTypesSignal = signal( + ElementTypeSystem.createWallInstance() +); +export const beamTypesSignal = signal( + ElementTypeSystem.createBeamInstance() +); +export const columnTypesSignal = signal( + ElementTypeSystem.createColumnInstance() +); +export const slabTypesSignal = signal( + ElementTypeSystem.createSlabInstance() +); +export const foundationTypesSignal = signal( + ElementTypeSystem.createFoundationInstance() +); +export const reinforcementTypesSignal = signal( + ElementTypeSystem.createReinforcementInstance() +); + +export const selectedWallTypeSignal = signal( + wallTypesSignal.value[0] +); +export const selectedBeamTypeSignal = signal( + beamTypesSignal.value[0] +); +export const selectedColumnTypeSignal = signal( + columnTypesSignal.value[0] +); +export const selectedSlabTypeSignal = signal( + slabTypesSignal.value[0] +); +export const selectedFoundationTypeSignal = signal( + foundationTypesSignal.value[0] +); +export const selectedReinforcementTypeSignal = signal( + reinforcementTypesSignal.value[0] +); + +export const elementTypesSignal = signal< + | WallType[] + | BeamType[] + | ColumnType[] + | SlabType[] + | FoundationType[] + | ReinforcementType[] +>([]); + +export function disposeElementType() { + openElementTypeSignal.value = false; + wallTypesSignal.value = ElementTypeSystem.createWallInstance(); + beamTypesSignal.value = ElementTypeSystem.createBeamInstance(); + columnTypesSignal.value = ElementTypeSystem.createColumnInstance(); + slabTypesSignal.value = ElementTypeSystem.createSlabInstance(); + foundationTypesSignal.value = ElementTypeSystem.createFoundationInstance(); + reinforcementTypesSignal.value = + ElementTypeSystem.createReinforcementInstance(); +} diff --git a/src/BimModel/src/Signals/Level/index.ts b/src/BimModel/src/Signals/Level/index.ts index bff7bfb..df946f3 100644 --- a/src/BimModel/src/Signals/Level/index.ts +++ b/src/BimModel/src/Signals/Level/index.ts @@ -1,5 +1,5 @@ +import {ILevel} from "@BimModel/src/LevelSystem/types"; import {signal} from "@preact/signals-react"; -import {ILevel} from "@system/08-level/types"; export const currentLevelSignal = signal(null); export const listLevelSignal = signal([]); diff --git a/src/BimModel/src/Signals/Structure/index.ts b/src/BimModel/src/Signals/Structure/index.ts index 1dc979e..544355b 100644 --- a/src/BimModel/src/Signals/Structure/index.ts +++ b/src/BimModel/src/Signals/Structure/index.ts @@ -1,4 +1,4 @@ -import {IStructure} from "@BimModel/src/StructureComponent/types"; +import {IStructure} from "@BimModel/src/ProjectComponent/types"; import {signal} from "@preact/signals-react"; export const modelStructureSignal = signal(null); export function disposeStructure() { diff --git a/src/BimModel/src/Signals/index.ts b/src/BimModel/src/Signals/index.ts index f7a5b9e..8cc8fa7 100644 --- a/src/BimModel/src/Signals/index.ts +++ b/src/BimModel/src/Signals/index.ts @@ -6,6 +6,7 @@ import {disposeKeyboard} from "./Keyboard"; import {disposeClippingPlanes} from "./ClippingPlanes"; import {disposeStructure} from "./Structure"; import {disposeWorkPlane} from "./WorkPlane"; +import {disposeElementType} from "./ElementType"; export * from "./Modeling"; export * from "./Project"; @@ -15,6 +16,7 @@ export * from "./Keyboard"; export * from "./ClippingPlanes"; export * from "./Structure"; export * from "./WorkPlane"; +export * from "./ElementType"; export function disposeSignals() { disposeModeling(); @@ -25,4 +27,5 @@ export function disposeSignals() { disposeClippingPlanes(); disposeStructure(); disposeWorkPlane(); + disposeElementType(); } diff --git a/src/BimModel/src/Snapper/index.ts b/src/BimModel/src/Snapper/index.ts new file mode 100644 index 0000000..fbd513a --- /dev/null +++ b/src/BimModel/src/Snapper/index.ts @@ -0,0 +1,26 @@ +/** + * @module Snapper + */ + +import * as THREE from "three"; +import {Components} from "@BimModel/src/Components"; +import {ToolComponent} from "@BimModel/src/Tool"; +import {Component, Disposable, UUID} from "@BimModel/src/types"; +export class Snapper extends Component implements Disposable { + static readonly uuid = UUID.Snapper; + enabled = false; + + /** + * + */ + constructor(components: Components) { + super(components); + this.components.tools.add(Snapper.uuid, this); + } + async dispose() {} + + get() { + return Snapper.uuid; + } +} +ToolComponent.libraryUUIDs.add(Snapper.uuid); diff --git a/src/BimModel/src/StructureComponent/index.ts b/src/BimModel/src/StructureComponent/index.ts deleted file mode 100644 index 959b6b3..0000000 --- a/src/BimModel/src/StructureComponent/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @module StructureComponent - */ -import {Components} from "../Components"; -import {ToolComponent} from "../Tool"; -import {Component, Disposable, UUID} from "../types"; -import {ProjectComponent} from "../ProjectComponent"; -import {createStructureContainer} from "./src"; -import {IStructure} from "./types"; - -export class StructureComponent - extends Component - implements Disposable -{ - static readonly uuid = UUID.StructureComponent; - readonly modelStructure = "Model Structure"; - enabled = false; - private container!: HTMLDivElement; - get ProjectComponent(): ProjectComponent { - return this.components.tools.get(ProjectComponent); - } - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(StructureComponent.uuid, this); - } - async dispose() { - this.container?.remove(); - (this.container as any) = null; - } - get() { - return StructureComponent.uuid; - } - init(_structure: HTMLDivElement) { - this.container = createStructureContainer(this); - _structure.appendChild(this.container); - } - onVisibility = (_visible: boolean, _structure: IStructure) => { - // - }; -} -ToolComponent.libraryUUIDs.add(StructureComponent.uuid); diff --git a/src/BimModel/src/StructureComponent/src/index.ts b/src/BimModel/src/StructureComponent/src/index.ts deleted file mode 100644 index 1a0dce3..0000000 --- a/src/BimModel/src/StructureComponent/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./InitComponents"; diff --git a/src/BimModel/src/StructureComponent/types.ts b/src/BimModel/src/StructureComponent/types.ts deleted file mode 100644 index 4038105..0000000 --- a/src/BimModel/src/StructureComponent/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface IStructure { - name: string; - uuid: string; - visible: boolean; - onVisibility: (visible: boolean, structure: IStructure) => void; - children: {[name: string]: IStructure}; -} diff --git a/src/BimModel/src/system/12-work-plane/index.ts b/src/BimModel/src/WorkPlane/index.ts similarity index 87% rename from src/BimModel/src/system/12-work-plane/index.ts rename to src/BimModel/src/WorkPlane/index.ts index 028c068..7a12620 100644 --- a/src/BimModel/src/system/12-work-plane/index.ts +++ b/src/BimModel/src/WorkPlane/index.ts @@ -1,17 +1,16 @@ /** - * @module WorkPlaneSystem + * @module WorkPlane */ import * as THREE from "three"; import {Components} from "@BimModel/src/Components"; import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -import {Camera, RendererComponent} from "@BimModel/src/RendererComponent"; +import {Component, Disposable, UUID} from "@BimModel/src/types"; +import {RendererComponent} from "@BimModel/src/RendererComponent"; import {effect} from "@preact/signals-react"; import {showWorkPlaneSignal} from "@BimModel/src/Signals"; -export class WorkPlaneSystem extends Component implements Disposable { - static readonly uuid = systemGUID.workPlane; +export class WorkPlane extends Component implements Disposable { + static readonly uuid = UUID.WorkPlane; static readonly size1 = 1; static readonly size2 = 10; static readonly distance = 500; @@ -63,7 +62,7 @@ export class WorkPlaneSystem extends Component implements Disposable { */ constructor(components: Components) { super(components); - this.components.tools.add(WorkPlaneSystem.uuid, this); + this.components.tools.add(WorkPlane.uuid, this); const geometry = new THREE.PlaneGeometry(2, 2, 1, 1); @@ -72,16 +71,16 @@ export class WorkPlaneSystem extends Component implements Disposable { uniforms: { uSize1: { - value: WorkPlaneSystem.size1, + value: WorkPlane.size1, }, uSize2: { - value: WorkPlaneSystem.size2, + value: WorkPlane.size2, }, uColor: { - value: WorkPlaneSystem.color, + value: WorkPlane.color, }, uDistance: { - value: WorkPlaneSystem.distance, + value: WorkPlane.distance, }, uFade: { value: this._fade, @@ -179,7 +178,7 @@ export class WorkPlaneSystem extends Component implements Disposable { } get() { - return WorkPlaneSystem.uuid; + return WorkPlane.uuid; } } -ToolComponent.libraryUUIDs.add(WorkPlaneSystem.uuid); +ToolComponent.libraryUUIDs.add(WorkPlane.uuid); diff --git a/src/BimModel/src/index.ts b/src/BimModel/src/index.ts index 2469a54..d6babdb 100644 --- a/src/BimModel/src/index.ts +++ b/src/BimModel/src/index.ts @@ -3,10 +3,12 @@ export * from "./RendererComponent"; export * from "./RaycasterComponent"; export * from "./MaterialComponent"; export * from "./ModelingComponent"; -export * from "./StructureComponent"; -export * from "./PropertyComponent"; export * from "./CubeMapComponent"; export * from "./ProjectComponent"; export * from "./Signals"; export * from "./system"; +export * from "./WorkPlane"; +export * from "./LevelSystem"; +export * from "./Snapper"; +export * from "./DrawTool"; export * from "./types"; diff --git a/src/BimModel/src/system/00-base/IfcEnum.ts b/src/BimModel/src/system/00-base/IfcEnum.ts deleted file mode 100644 index c5b502e..0000000 --- a/src/BimModel/src/system/00-base/IfcEnum.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {IFC4} from "web-ifc"; -export const IfcRoleEnum = Object.keys(IFC4.IfcRoleEnum); -export const IfcAddressTypeEnum = Object.keys(IFC4.IfcAddressTypeEnum); -export const IfcStateEnum = Object.keys(IFC4.IfcStateEnum); -export const IfcChangeActionEnum = Object.keys(IFC4.IfcChangeActionEnum); -export const IfcUnitEnum = Object.keys(IFC4.IfcUnitEnum); -export const IfcSIUnitName = Object.keys(IFC4.IfcSIUnitName); -export const IfcGeometricProjectionEnum = Object.keys( - IFC4.IfcGeometricProjectionEnum -); -export const IfcSIPrefix = Object.keys(IFC4.IfcSIPrefix); -export const IfcWallTypeEnum = Object.keys(IFC4.IfcWallTypeEnum); -export const IfcColumnTypeEnum = Object.keys(IFC4.IfcColumnTypeEnum); -export const IfcDoorTypeEnum = Object.keys(IFC4.IfcDoorTypeEnum); -export const IfcWindowTypeEnum = Object.keys(IFC4.IfcWindowTypeEnum); -export const IfcBeamTypeEnums = Object.keys(IFC4.IfcBeamTypeEnum); -export const IfcSlabTypeEnums = Object.keys(IFC4.IfcSlabTypeEnum); -export const IfcDuctFittingTypeEnum = Object.keys(IFC4.IfcDuctFittingTypeEnum); -export const IfcDuctSegmentTypeEnum = Object.keys(IFC4.IfcDuctSegmentTypeEnum); -export const IfcPipeFittingTypeEnum = Object.keys(IFC4.IfcPipeFittingTypeEnum); -export const IfcPipeSegmentTypeEnum = Object.keys(IFC4.IfcPipeSegmentTypeEnum); -export const IfcReinforcingBarTypeEnum = Object.keys( - IFC4.IfcReinforcingBarTypeEnum -); diff --git a/src/BimModel/src/system/01-geometry/index.ts b/src/BimModel/src/system/01-geometry/index.ts deleted file mode 100644 index f0f86d9..0000000 --- a/src/BimModel/src/system/01-geometry/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @module GeometrySystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -import {Dimension} from "./src"; -export * from "./src/location"; -export class GeometrySystem extends Component implements Disposable { - static readonly uuid = systemGUID.geometry; - enabled = false; - drawingDimension: Dimension = new Dimension(this.components); - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(GeometrySystem.uuid, this); - } - async dispose() { - this.drawingDimension?.dispose(); - } - - get() { - return GeometrySystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(GeometrySystem.uuid); diff --git a/src/BimModel/src/system/01-geometry/src/index.ts b/src/BimModel/src/system/01-geometry/src/index.ts deleted file mode 100644 index 00f0f51..0000000 --- a/src/BimModel/src/system/01-geometry/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./location"; diff --git a/src/BimModel/src/system/01-geometry/src/location/LocationArc.ts b/src/BimModel/src/system/01-geometry/src/location/LocationArc.ts deleted file mode 100644 index f045ac3..0000000 --- a/src/BimModel/src/system/01-geometry/src/location/LocationArc.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @module GeometrySystem - */ -import * as THREE from "three"; -import {Components, MaterialComponent, Disposable} from "@BimModel/src"; -import {IBaseLocation, ILocationArc} from "@system/01-geometry/types"; -import {BaseLocation} from "./BaseLocation"; -import {Line2} from "three/examples/jsm/lines/Line2"; -import {LocationUtils} from "./LocationUtils"; -import {getProjectPointFrom3Point} from "@BimModel/src/utils"; - -export class LocationArc - extends BaseLocation - implements Disposable, IBaseLocation -{ - static readonly defaultSegment = 24; - static readonly tempVector = new THREE.Vector3(); - /** implements @IBaseLocation */ - location!: ILocationArc; - onChange!: (value: ILocationArc) => void; - - /** abstract @BaseLocation */ - onSelect!: (select: boolean) => void; - onHover!: (hover: boolean) => void; - onVisibility = (visible: boolean) => { - if (!this.segment) return; - if (visible) { - this.components.annotationScene.add(this.segment); - } else { - this.segment.removeFromParent(); - } - }; - - segment!: Line2; - - get material() { - return this.components.tools.get(MaterialComponent)?.LocationMaterial; - } - /** - * - */ - constructor(components: Components, private workPlane: THREE.Plane) { - super(components); - } - /** - * - */ - async dispose() { - this.segment?.geometry.dispose(); - (this.segment!.geometry as any) = null; - this.segment?.removeFromParent(); - (this.segment as any) = null; - (this.location as any) = null; - } - update2PointsArc(start: THREE.Vector3, end: THREE.Vector3) { - const radius = start.distanceTo(end) / 2; - const center = LocationArc.tempVector.lerpVectors(end, start, 0.5); - if (!this.location) - this.location = { - center, - start: start.clone(), - end: end.clone(), - radius, - numberSegment: LocationArc.defaultSegment, - }; - this.location.center.copy(center); - this.location.start!.copy(start); - this.location.end!.copy(end); - this.location.radius = radius; - if (!this.segment) - this.segment = LocationUtils.createLocationArc( - this.material, - this.location - ); - this.segment.geometry.setPositions([ - start.x, - start.y, - start.z, - end.x, - end.y, - end.z, - ]); - if (this.onChange) this.onChange(this.location); - } - update3PointsArc( - start: THREE.Vector3, - end: THREE.Vector3, - movingPoint: THREE.Vector3 - ) { - const pro = getProjectPointFrom3Point(start, end, movingPoint); - const disPro = movingPoint.distanceTo(pro); - const tempRadius = start.distanceTo(end); - if (disPro <= tempRadius * 0.2) return this.update2PointsArc(start, end); - } - updateCircle(center: THREE.Vector3, movingPoint: THREE.Vector3) { - const radius = center.distanceTo(movingPoint); - if (!this.location) - this.location = { - center: center.clone(), - radius, - numberSegment: LocationArc.defaultSegment, - }; - this.location.center.copy(center); - this.location.radius = radius; - if (!this.segment) - this.segment = LocationUtils.createLocationCircle( - this.material, - this.location, - this.workPlane - ); - this.segment.geometry.setPositions( - LocationUtils.getPointsCircle(this.location, this.workPlane) - ); - if (this.onChange) this.onChange(this.location); - } -} diff --git a/src/BimModel/src/system/02-element/index.ts b/src/BimModel/src/system/02-element/index.ts deleted file mode 100644 index 79fc16b..0000000 --- a/src/BimModel/src/system/02-element/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module ElementSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class ElementSystem extends Component implements Disposable { - static readonly uuid = systemGUID.element; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(ElementSystem.uuid, this); - } - async dispose() {} - - get() { - return ElementSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(ElementSystem.uuid); diff --git a/src/BimModel/src/system/02-element/src/ElementId.ts b/src/BimModel/src/system/02-element/src/ElementId.ts deleted file mode 100644 index 176a77d..0000000 --- a/src/BimModel/src/system/02-element/src/ElementId.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class ElementId { - private static readonly limitRedo = 5 as const; - static currentId = 0; - static undoIds: number[] = []; - static redoIds: number[] = []; -} diff --git a/src/BimModel/src/system/02-element/src/index.ts b/src/BimModel/src/system/02-element/src/index.ts deleted file mode 100644 index b2f0471..0000000 --- a/src/BimModel/src/system/02-element/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./ElementId"; diff --git a/src/BimModel/src/system/03-element-type/index.ts b/src/BimModel/src/system/03-element-type/index.ts deleted file mode 100644 index 3ec1f61..0000000 --- a/src/BimModel/src/system/03-element-type/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module ElementTypeSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class ElementTypeSystem extends Component implements Disposable { - static readonly uuid = systemGUID.elementType; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(ElementTypeSystem.uuid, this); - } - async dispose() {} - - get() { - return ElementTypeSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(ElementTypeSystem.uuid); diff --git a/src/BimModel/src/system/05-parameter/index.ts b/src/BimModel/src/system/05-parameter/index.ts deleted file mode 100644 index 47238cf..0000000 --- a/src/BimModel/src/system/05-parameter/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module ParameterSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class ParameterSystem extends Component implements Disposable { - static readonly uuid = systemGUID.parameter; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(ParameterSystem.uuid, this); - } - async dispose() {} - - get() { - return ParameterSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(ParameterSystem.uuid); diff --git a/src/BimModel/src/system/05-parameter/src/Parameter.ts b/src/BimModel/src/system/05-parameter/src/Parameter.ts deleted file mode 100644 index 094bbad..0000000 --- a/src/BimModel/src/system/05-parameter/src/Parameter.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class Parameter { - name!: string; - value!: string; - valueType!: string; -} diff --git a/src/BimModel/src/system/06-category/index.ts b/src/BimModel/src/system/06-category/index.ts deleted file mode 100644 index ee8c315..0000000 --- a/src/BimModel/src/system/06-category/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module CategorySystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class CategorySystem extends Component implements Disposable { - static readonly uuid = systemGUID.category; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(CategorySystem.uuid, this); - } - async dispose() {} - - get() { - return CategorySystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(CategorySystem.uuid); diff --git a/src/BimModel/src/system/07-family/index.ts b/src/BimModel/src/system/07-family/index.ts deleted file mode 100644 index c46628b..0000000 --- a/src/BimModel/src/system/07-family/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module FamilySystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class FamilySystem extends Component implements Disposable { - static readonly uuid = systemGUID.family; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(FamilySystem.uuid, this); - } - async dispose() {} - - get() { - return FamilySystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(FamilySystem.uuid); diff --git a/src/BimModel/src/system/09-grid/index.ts b/src/BimModel/src/system/09-grid/index.ts deleted file mode 100644 index 872a499..0000000 --- a/src/BimModel/src/system/09-grid/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module GridSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class GridSystem extends Component implements Disposable { - static readonly uuid = systemGUID.grid; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(GridSystem.uuid, this); - } - async dispose() {} - - get() { - return GridSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(GridSystem.uuid); diff --git a/src/BimModel/src/system/10-project/index.ts b/src/BimModel/src/system/10-project/index.ts deleted file mode 100644 index 0d6065f..0000000 --- a/src/BimModel/src/system/10-project/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module ProjectSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class ProjectSystem extends Component implements Disposable { - static readonly uuid = systemGUID.project; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(ProjectSystem.uuid, this); - } - async dispose() {} - - get() { - return ProjectSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(ProjectSystem.uuid); diff --git a/src/BimModel/src/system/11-snapper/index.ts b/src/BimModel/src/system/11-snapper/index.ts deleted file mode 100644 index d956c1d..0000000 --- a/src/BimModel/src/system/11-snapper/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @module SnapperSystem - */ - -import * as THREE from "three"; -import {Components} from "@BimModel/src/Components"; -import {ToolComponent} from "@BimModel/src/Tool"; -import {Component, Disposable} from "@BimModel/src/types"; -import {systemGUID} from "../constants"; -export class SnapperSystem extends Component implements Disposable { - static readonly uuid = systemGUID.snapper; - enabled = false; - - /** - * - */ - constructor(components: Components) { - super(components); - this.components.tools.add(SnapperSystem.uuid, this); - } - async dispose() {} - - get() { - return SnapperSystem.uuid; - } -} -ToolComponent.libraryUUIDs.add(SnapperSystem.uuid); diff --git a/src/BimModel/src/system/00-base/IfcCategoryMap.ts b/src/BimModel/src/system/base/IfcCategoryMap.ts similarity index 100% rename from src/BimModel/src/system/00-base/IfcCategoryMap.ts rename to src/BimModel/src/system/base/IfcCategoryMap.ts diff --git a/src/BimModel/src/system/00-base/IfcElements.ts b/src/BimModel/src/system/base/IfcElements.ts similarity index 100% rename from src/BimModel/src/system/00-base/IfcElements.ts rename to src/BimModel/src/system/base/IfcElements.ts diff --git a/src/BimModel/src/system/base/IfcEnum.ts b/src/BimModel/src/system/base/IfcEnum.ts new file mode 100644 index 0000000..f1e9322 --- /dev/null +++ b/src/BimModel/src/system/base/IfcEnum.ts @@ -0,0 +1,25 @@ +import {IFC4X3 as IFC} from "web-ifc"; + +export const IfcRoleEnum = Object.keys(IFC.IfcRoleEnum); +export const IfcAddressTypeEnum = Object.keys(IFC.IfcAddressTypeEnum); +export const IfcStateEnum = Object.keys(IFC.IfcStateEnum); +export const IfcChangeActionEnum = Object.keys(IFC.IfcChangeActionEnum); +export const IfcUnitEnum = Object.keys(IFC.IfcUnitEnum); +export const IfcSIUnitName = Object.keys(IFC.IfcSIUnitName); +export const IfcGeometricProjectionEnum = Object.keys( + IFC.IfcGeometricProjectionEnum +); +export const IfcSIPrefix = Object.keys(IFC.IfcSIPrefix); +export const IfcWallTypeEnum = Object.keys(IFC.IfcWallTypeEnum); +export const IfcColumnTypeEnum = Object.keys(IFC.IfcColumnTypeEnum); +export const IfcDoorTypeEnum = Object.keys(IFC.IfcDoorTypeEnum); +export const IfcWindowTypeEnum = Object.keys(IFC.IfcWindowTypeEnum); +export const IfcBeamTypeEnums = Object.keys(IFC.IfcBeamTypeEnum); +export const IfcSlabTypeEnums = Object.keys(IFC.IfcSlabTypeEnum); +export const IfcDuctFittingTypeEnum = Object.keys(IFC.IfcDuctFittingTypeEnum); +export const IfcDuctSegmentTypeEnum = Object.keys(IFC.IfcDuctSegmentTypeEnum); +export const IfcPipeFittingTypeEnum = Object.keys(IFC.IfcPipeFittingTypeEnum); +export const IfcPipeSegmentTypeEnum = Object.keys(IFC.IfcPipeSegmentTypeEnum); +export const IfcReinforcingBarTypeEnum = Object.keys( + IFC.IfcReinforcingBarTypeEnum +); diff --git a/src/BimModel/src/system/00-base/index.ts b/src/BimModel/src/system/base/index.ts similarity index 100% rename from src/BimModel/src/system/00-base/index.ts rename to src/BimModel/src/system/base/index.ts diff --git a/src/BimModel/src/system/00-base/Utils.ts b/src/BimModel/src/system/base/utils.ts similarity index 100% rename from src/BimModel/src/system/00-base/Utils.ts rename to src/BimModel/src/system/base/utils.ts diff --git a/src/BimModel/src/system/constants.ts b/src/BimModel/src/system/constants.ts deleted file mode 100644 index dffcd3f..0000000 --- a/src/BimModel/src/system/constants.ts +++ /dev/null @@ -1,14 +0,0 @@ -export const systemGUID = { - geometry: "0b2bd272-5c40-4334-8010-5b799211e99e", - element: "c2b0f468-aa98-4ff7-b6f7-d5f932f73a3b", - elementType: "3e788cae-960f-450f-9624-e9d4a5e9fca5", - drawTool: "9f57c4ea-8628-4454-9296-5cc63c93d7af", - parameter: "aaacab20-84c2-4cc3-8a35-84f506ccabe5", - category: "c46a8db0-df2e-48f5-9a17-edf982ec31a2", - family: "80e12dbd-caa6-4bf5-a848-fd9f179cf32f", - level: "53ee394d-abf2-4df2-b362-8a1a845fd4af", - grid: "a867769b-c9e3-4274-a1d2-252332dbbb5d", - project: "19939a5b-bd03-4bca-b736-5abfce4ab3ee", - snapper: "01c5b0e1-561a-4e1b-a170-aa74d32e7287", - workPlane: "9c682b63-417d-41a5-9174-e9c56366fd34", -}; diff --git a/src/BimModel/src/system/element-type/BaseElementType.ts b/src/BimModel/src/system/element-type/BaseElementType.ts new file mode 100644 index 0000000..6978f95 --- /dev/null +++ b/src/BimModel/src/system/element-type/BaseElementType.ts @@ -0,0 +1,8 @@ +import {IBaseElementType, IElementTypeEnum} from "./types"; + +export abstract class BaseElementType implements IBaseElementType { + paramGeometry: any; + abstract typeName: string; + abstract typeEnum: IElementTypeEnum; + abstract dispose: () => void; +} diff --git a/src/BimModel/src/system/element-type/BeamType.ts b/src/BimModel/src/system/element-type/BeamType.ts new file mode 100644 index 0000000..8b832dc --- /dev/null +++ b/src/BimModel/src/system/element-type/BeamType.ts @@ -0,0 +1,54 @@ +import * as THREE from "three"; +import {Handle, IFC4, IFCBEAMTYPE} from "web-ifc"; +import {IElementTypeEnum} from "./types"; +import {BaseElementType} from "./BaseElementType"; +import {IfcElements} from "../base"; + +export class BeamType extends BaseElementType implements IFC4.IfcBeamType { + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcBeamTypeEnum; + type = IFCBEAMTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCBEAMTYPE]; + typeEnum: IElementTypeEnum = "BeamType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/ColumnType.ts b/src/BimModel/src/system/element-type/ColumnType.ts new file mode 100644 index 0000000..071cac5 --- /dev/null +++ b/src/BimModel/src/system/element-type/ColumnType.ts @@ -0,0 +1,53 @@ +import * as THREE from "three"; +import {Handle, IFC4, IFCCOILTYPE} from "web-ifc"; +import {BaseElementType} from "./BaseElementType"; +import {IElementTypeEnum} from "./types"; +import {IfcElements} from "../base"; + +export class ColumnType extends BaseElementType implements IFC4.IfcBeamType { + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcBeamTypeEnum; + type = IFCCOILTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCCOILTYPE]; + typeEnum: IElementTypeEnum = "ColumnType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/FoundationType.ts b/src/BimModel/src/system/element-type/FoundationType.ts new file mode 100644 index 0000000..d13d9ca --- /dev/null +++ b/src/BimModel/src/system/element-type/FoundationType.ts @@ -0,0 +1,56 @@ +import * as THREE from "three"; + +import {Handle, IFC4, IFCSLABTYPE} from "web-ifc"; +import {BaseElementType} from "./BaseElementType"; +import {IElementTypeEnum} from "./types"; +import {IfcElements} from "../base"; +export class FoundationType + extends BaseElementType + implements IFC4.IfcSlabType +{ + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcSlabTypeEnum; + type = IFCSLABTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCSLABTYPE]; + typeEnum: IElementTypeEnum = "FoundationType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/ReinforcementType.ts b/src/BimModel/src/system/element-type/ReinforcementType.ts new file mode 100644 index 0000000..1c67dc4 --- /dev/null +++ b/src/BimModel/src/system/element-type/ReinforcementType.ts @@ -0,0 +1,61 @@ +import * as THREE from "three"; +import {Handle, IFC4, IFCREINFORCINGBARTYPE} from "web-ifc"; +import {BaseElementType} from "./BaseElementType"; +import {IElementTypeEnum} from "./types"; +import {IfcElements} from "../base"; +export class ReinforcementType + extends BaseElementType + implements IFC4.IfcReinforcingBarType +{ + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcReinforcingBarTypeEnum; + NominalDiameter!: IFC4.IfcPositiveLengthMeasure | null; + CrossSectionArea!: IFC4.IfcAreaMeasure | null; + BarLength!: IFC4.IfcPositiveLengthMeasure | null; + BarSurface!: IFC4.IfcReinforcingBarSurfaceEnum | null; + BendingShapeCode!: IFC4.IfcLabel | null; + BendingParameters!: IFC4.IfcBendingParameterSelect[] | null; + type = IFCREINFORCINGBARTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCREINFORCINGBARTYPE]; + typeEnum: IElementTypeEnum = "ReinforcementType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/SlabType.ts b/src/BimModel/src/system/element-type/SlabType.ts new file mode 100644 index 0000000..c4e06ca --- /dev/null +++ b/src/BimModel/src/system/element-type/SlabType.ts @@ -0,0 +1,52 @@ +import * as THREE from "three"; +import {Handle, IFC4, IFCSLABTYPE} from "web-ifc"; +import {BaseElementType} from "./BaseElementType"; +import {IElementTypeEnum} from "./types"; +import {IfcElements} from "../base"; +export class SlabType extends BaseElementType implements IFC4.IfcSlabType { + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcSlabTypeEnum; + type = IFCSLABTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCSLABTYPE]; + typeEnum: IElementTypeEnum = "SlabType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/WallType.ts b/src/BimModel/src/system/element-type/WallType.ts new file mode 100644 index 0000000..22c085f --- /dev/null +++ b/src/BimModel/src/system/element-type/WallType.ts @@ -0,0 +1,53 @@ +import * as THREE from "three"; +import {Handle, IFC4, IFCWALLTYPE} from "web-ifc"; +import {IElementTypeEnum} from "./types"; +import {BaseElementType} from "./BaseElementType"; +import {IfcElements} from "../base"; + +export class WallType extends BaseElementType implements IFC4.IfcWallType { + GlobalId: IFC4.IfcGloballyUniqueId = new IFC4.IfcGloballyUniqueId( + THREE.MathUtils.generateUUID() + ); + OwnerHistory!: IFC4.IfcOwnerHistory | Handle | null; + Name!: IFC4.IfcLabel | null; + Description!: IFC4.IfcText | null; + ApplicableOccurrence!: IFC4.IfcIdentifier | null; + HasPropertySets!: + | (IFC4.IfcPropertySetDefinition | Handle)[] + | null; + RepresentationMaps!: + | (IFC4.IfcRepresentationMap | Handle)[] + | null; + Tag!: IFC4.IfcLabel | null; + ElementType!: IFC4.IfcLabel | null; + PredefinedType!: IFC4.IfcWallTypeEnum; + type = IFCWALLTYPE; + ReferencedBy!: + | (IFC4.IfcRelAssignsToProduct | Handle)[] + | null; + Types!: + | (IFC4.IfcRelDefinesByType | Handle)[] + | null; + HasAssignments!: (IFC4.IfcRelAssigns | Handle)[] | null; + Nests!: (IFC4.IfcRelNests | Handle)[] | null; + IsNestedBy!: (IFC4.IfcRelNests | Handle)[] | null; + HasContext!: (IFC4.IfcRelDeclares | Handle)[] | null; + IsDecomposedBy!: + | (IFC4.IfcRelAggregates | Handle)[] + | null; + Decomposes!: (IFC4.IfcRelAggregates | Handle)[] | null; + HasAssociations!: + | (IFC4.IfcRelAssociates | Handle)[] + | null; + expressID!: number; + typeName = IfcElements[IFCWALLTYPE]; + typeEnum: IElementTypeEnum = "WallType"; + /** + * + */ + constructor(name: string) { + super(); + this.Name = new IFC4.IfcLabel(name); + } + dispose = () => {}; +} diff --git a/src/BimModel/src/system/element-type/index.ts b/src/BimModel/src/system/element-type/index.ts new file mode 100644 index 0000000..1ed8084 --- /dev/null +++ b/src/BimModel/src/system/element-type/index.ts @@ -0,0 +1,38 @@ +import {BeamType} from "./BeamType"; +import {ColumnType} from "./ColumnType"; +import {FoundationType} from "./FoundationType"; +import {ReinforcementType} from "./ReinforcementType"; +import {SlabType} from "./SlabType"; +import {WallType} from "./WallType"; + +export * from "./BaseElementType"; +export * from "./BeamType"; +export * from "./ColumnType"; +export * from "./FoundationType"; +export * from "./ReinforcementType"; +export * from "./SlabType"; +export * from "./WallType"; +export * from "./types"; +export class ElementTypeSystem { + static createWallInstance(): WallType[] { + return [new WallType("BW100"), new WallType("BW200")]; + } + static createBeamInstance(): BeamType[] { + return [new BeamType("R200x400"), new BeamType("R200x300")]; + } + static createColumnInstance(): ColumnType[] { + return [new ColumnType("R200x400"), new ColumnType("R200x300")]; + } + static createSlabInstance(): SlabType[] { + return [new SlabType("R200x400"), new SlabType("R200x300")]; + } + static createFoundationInstance(): FoundationType[] { + return [new FoundationType("R200x400"), new FoundationType("R200x300")]; + } + static createReinforcementInstance(): ReinforcementType[] { + return [ + new ReinforcementType("R200x400"), + new ReinforcementType("R200x300"), + ]; + } +} diff --git a/src/BimModel/src/system/element-type/types.ts b/src/BimModel/src/system/element-type/types.ts new file mode 100644 index 0000000..1dcfeb3 --- /dev/null +++ b/src/BimModel/src/system/element-type/types.ts @@ -0,0 +1,12 @@ +export interface IBaseElementType { + typeName: string; + typeEnum: IElementTypeEnum; +} + +export type IElementTypeEnum = + | "WallType" + | "BeamType" + | "ColumnType" + | "FoundationType" + | "ReinforcementType" + | "SlabType"; diff --git a/src/BimModel/src/system/element/BaseElement.ts b/src/BimModel/src/system/element/BaseElement.ts new file mode 100644 index 0000000..2651978 --- /dev/null +++ b/src/BimModel/src/system/element/BaseElement.ts @@ -0,0 +1,5 @@ +export abstract class BaseElement { + abstract type: number; + abstract category: number; + abstract dispose: () => void; +} diff --git a/src/BimModel/src/system/element/index.ts b/src/BimModel/src/system/element/index.ts new file mode 100644 index 0000000..8ef5e9f --- /dev/null +++ b/src/BimModel/src/system/element/index.ts @@ -0,0 +1 @@ +export const element = 10; diff --git a/src/BimModel/src/system/element/types.ts b/src/BimModel/src/system/element/types.ts new file mode 100644 index 0000000..4526438 --- /dev/null +++ b/src/BimModel/src/system/element/types.ts @@ -0,0 +1,17 @@ +import {ILevel} from "@BimModel/src/LevelSystem/types"; + +export type IParameterType = "Info" | "Geometry" | "Level" | "Reference"; + +export interface IParameter { + id: number; + uuid: string; + name: string; + type: IParameterType; + value: string | number | boolean | IParameter | ILevel; +} +export interface IParameterGroup { + id: number; + uuid: string; + name: string; + HasProperties: {[uuid: string]: IParameter}; +} diff --git a/src/BimModel/src/system/family/index.ts b/src/BimModel/src/system/family/index.ts new file mode 100644 index 0000000..11ab0bf --- /dev/null +++ b/src/BimModel/src/system/family/index.ts @@ -0,0 +1 @@ +export const FamilySystem = "FamilySystem"; diff --git a/src/BimModel/src/system/geometry/index.ts b/src/BimModel/src/system/geometry/index.ts new file mode 100644 index 0000000..4bbb5f2 --- /dev/null +++ b/src/BimModel/src/system/geometry/index.ts @@ -0,0 +1,3 @@ +export * from "./types"; +export * from "./location"; +export * from "./shape"; diff --git a/src/BimModel/src/system/01-geometry/src/location/BaseLocation.ts b/src/BimModel/src/system/geometry/location/BaseLocation.ts similarity index 100% rename from src/BimModel/src/system/01-geometry/src/location/BaseLocation.ts rename to src/BimModel/src/system/geometry/location/BaseLocation.ts diff --git a/src/BimModel/src/system/01-geometry/src/location/Dimension.ts b/src/BimModel/src/system/geometry/location/Dimension.ts similarity index 98% rename from src/BimModel/src/system/01-geometry/src/location/Dimension.ts rename to src/BimModel/src/system/geometry/location/Dimension.ts index e9e0707..2f1ce66 100644 --- a/src/BimModel/src/system/01-geometry/src/location/Dimension.ts +++ b/src/BimModel/src/system/geometry/location/Dimension.ts @@ -11,7 +11,7 @@ import { } from "@BimModel/src"; import {CSS2DObject} from "three/examples/jsm/renderers/CSS2DRenderer"; import {Line2} from "three/examples/jsm/lines/Line2"; -import {dimStyle, GeometryCSS} from "../../types"; +import {dimStyle, GeometryCSS} from "../types"; import {LocationUtils} from "./LocationUtils"; import {BaseLocation} from "./BaseLocation"; import {getDirection} from "@BimModel/src/utils"; @@ -212,6 +212,7 @@ export class Dimension extends BaseLocation implements Disposable { label.userData.content?.remove(); } private static disposeSegment(segment: Line2) { + if (!segment) return; segment?.geometry.dispose(); (segment!.geometry as any) = null; segment?.removeFromParent(); diff --git a/src/BimModel/src/system/geometry/location/LocationArc.ts b/src/BimModel/src/system/geometry/location/LocationArc.ts new file mode 100644 index 0000000..2d26cc6 --- /dev/null +++ b/src/BimModel/src/system/geometry/location/LocationArc.ts @@ -0,0 +1,191 @@ +/** + * @module GeometrySystem + */ +import * as THREE from "three"; +import {LineGeometry} from "three/examples/jsm/lines/LineGeometry"; +import {Components, MaterialComponent, Disposable} from "@BimModel/src"; +import {IBaseLocation, ILocationArc} from "@system/geometry/types"; +import {BaseLocation} from "./BaseLocation"; +import {Line2} from "three/examples/jsm/lines/Line2"; +import {LocationUtils} from "./LocationUtils"; +import { + areEqual, + defaultToleranceDistance, + getDirection, + getProjectPointFrom3Point, +} from "@BimModel/src/utils"; + +export class LocationArc + extends BaseLocation + implements Disposable, IBaseLocation +{ + static readonly defaultSegment = 48; + static readonly tempVector = new THREE.Vector3(); + /** implements @IBaseLocation */ + location!: ILocationArc; + onChange!: (value: ILocationArc) => void; + + /** abstract @BaseLocation */ + onSelect!: (select: boolean) => void; + onHover!: (hover: boolean) => void; + onVisibility = (visible: boolean) => { + if (!this.segment) return; + if (visible) { + this.components.annotationScene.add(this.segment); + } else { + this.segment.removeFromParent(); + } + }; + + segment!: Line2; + + get material() { + return this.components.tools.get(MaterialComponent)?.LocationMaterial; + } + /** + * + */ + constructor(components: Components, private workPlane: THREE.Plane) { + super(components); + } + /** + * + */ + async dispose() { + this.segment?.geometry.dispose(); + (this.segment!.geometry as any) = null; + this.segment?.removeFromParent(); + (this.segment as any) = null; + (this.location as any) = null; + } + update2PointsArc(start: THREE.Vector3, end: THREE.Vector3) { + const radius = start.distanceTo(end) / 2; + const center = LocationArc.tempVector.lerpVectors(end, start, 0.5); + if (!this.location) + this.location = { + center, + start: start.clone(), + end: end.clone(), + radius, + numberSegment: LocationArc.defaultSegment, + }; + this.location.center.copy(center); + this.location.start!.copy(start); + this.location.end!.copy(end); + this.location.radius = radius; + this.initSegment(); + this.segment.geometry.setPositions([ + start.x, + start.y, + start.z, + end.x, + end.y, + end.z, + ]); + if (this.onChange) this.onChange(this.location); + } + update3PointsArc( + start: THREE.Vector3, + end: THREE.Vector3, + movingPoint: THREE.Vector3 + ) { + // get project from moving to line (start-end) + const pro = getProjectPointFrom3Point(start, end, movingPoint); + const dis = start.distanceTo(end); + const disPro = movingPoint.distanceTo(pro); + const uVector = getDirection(start, end); + const vVector = new THREE.Vector3() + .crossVectors(this.workPlane.normal, uVector) + .normalize(); + + if (disPro <= defaultToleranceDistance) + return this.update2PointsArc(start, end); + // find direction + const dirPro = getDirection(movingPoint, pro); + const sameSide = areEqual( + dirPro.angleTo(vVector), + 0.0, + defaultToleranceDistance + ); + // find middle + const mid = new THREE.Vector3().lerpVectors(start, end, 0.5); + const d2 = Math.sqrt(disPro * disPro + (dis * dis) / 4); + const d3 = (d2 * d2) / (2 * disPro) - disPro; + let center: THREE.Vector3, angleArc: number; + if (disPro > dis / 2) { + center = mid.clone().add(dirPro.clone().multiplyScalar(-Math.abs(d3))); + angleArc = 2 * Math.PI - 2 * Math.atan((dis * 0.5) / Math.abs(d3)); + } else { + center = mid.clone().add(dirPro.clone().multiplyScalar(Math.abs(d3))); + angleArc = 2 * Math.atan((dis * 0.5) / Math.abs(d3)); + } + const pS = sameSide ? start : end; + const radius = center.distanceTo(pS); + const position = LocationUtils.getPointsArcFromAngle( + radius, + center, + pS, + this.workPlane.normal, + angleArc, + LocationArc.defaultSegment + ); + this.initLocation(center, radius); + this.location.center.copy(center); + this.location.radius = radius; + this.location.numberSegment = position.length / 3; + if (sameSide) { + this.location.start = end.clone(); + this.location.end = start.clone(); + } else { + this.location.start = start.clone(); + this.location.end = end.clone(); + } + this.initSegment(); + this.segment.geometry.dispose(); + (this.segment.geometry as any) = null; + this.segment.geometry = new LineGeometry(); + this.segment.geometry.setPositions(position); + this.segment.geometry.setColors( + LocationUtils.getColorArray( + this.location.numberSegment, + LocationUtils.colorBaseLine + ) + ); + this.segment.computeLineDistances(); + } + updateCircle(center: THREE.Vector3, movingPoint: THREE.Vector3) { + const radius = center.distanceTo(movingPoint); + const dir = getDirection(center, movingPoint); + this.initLocation(center, radius); + this.location.center.copy(center); + this.location.radius = radius; + this.location.start = movingPoint.clone(); + this.location.end = center.clone().add(dir.multiplyScalar(-radius)); + this.initSegment(); + this.segment.geometry.setPositions( + LocationUtils.getPointsCircle( + this.location, + this.workPlane, + movingPoint, + true + ) + ); + if (this.onChange) this.onChange(this.location); + } + private initLocation(center: THREE.Vector3, radius: number) { + if (!this.location) + this.location = { + center: center.clone(), + radius, + numberSegment: LocationArc.defaultSegment, + }; + } + private initSegment() { + if (!this.segment) + this.segment = LocationUtils.createLocationCircle( + this.material, + this.location, + this.workPlane + ); + } +} diff --git a/src/BimModel/src/system/01-geometry/src/location/LocationCurve.ts b/src/BimModel/src/system/geometry/location/LocationCurve.ts similarity index 100% rename from src/BimModel/src/system/01-geometry/src/location/LocationCurve.ts rename to src/BimModel/src/system/geometry/location/LocationCurve.ts diff --git a/src/BimModel/src/system/01-geometry/src/location/LocationLine.ts b/src/BimModel/src/system/geometry/location/LocationLine.ts similarity index 96% rename from src/BimModel/src/system/01-geometry/src/location/LocationLine.ts rename to src/BimModel/src/system/geometry/location/LocationLine.ts index f209ea3..fb2a11b 100644 --- a/src/BimModel/src/system/01-geometry/src/location/LocationLine.ts +++ b/src/BimModel/src/system/geometry/location/LocationLine.ts @@ -4,7 +4,7 @@ import * as THREE from "three"; import {Components, MaterialComponent, Disposable} from "@BimModel/src"; -import {IBaseLocation, ILocationLine} from "@system/01-geometry/types"; +import {IBaseLocation, ILocationLine} from "@system/geometry/types"; import {BaseLocation} from "./BaseLocation"; import {Line2} from "three/examples/jsm/lines/Line2"; import {LocationUtils} from "./LocationUtils"; diff --git a/src/BimModel/src/system/01-geometry/src/location/LocationPoint.ts b/src/BimModel/src/system/geometry/location/LocationPoint.ts similarity index 100% rename from src/BimModel/src/system/01-geometry/src/location/LocationPoint.ts rename to src/BimModel/src/system/geometry/location/LocationPoint.ts diff --git a/src/BimModel/src/system/01-geometry/src/location/LocationUtils.ts b/src/BimModel/src/system/geometry/location/LocationUtils.ts similarity index 67% rename from src/BimModel/src/system/01-geometry/src/location/LocationUtils.ts rename to src/BimModel/src/system/geometry/location/LocationUtils.ts index 3bdf1e3..eaf4fc2 100644 --- a/src/BimModel/src/system/01-geometry/src/location/LocationUtils.ts +++ b/src/BimModel/src/system/geometry/location/LocationUtils.ts @@ -3,12 +3,11 @@ */ import * as THREE from "three"; -import {Components} from "@BimModel/src"; -import {ILocationArc, ILocationLine} from "@system/01-geometry/types"; +import {ILocationArc, ILocationLine} from "@system/geometry/types"; import {LineMaterial} from "three/examples/jsm/lines/LineMaterial"; import {Line2} from "three/examples/jsm/lines/Line2"; import {LineGeometry} from "three/examples/jsm/lines/LineGeometry"; -import {getLocalVectorOnFace} from "@BimModel/src/utils"; +import {getDirection, getLocalVectorOnFace} from "@BimModel/src/utils"; export class LocationUtils { /** * @@ -94,24 +93,40 @@ export class LocationUtils { segment.scale.set(1, 1, 1); return segment; } - static getPointsCircle(location: ILocationArc, workPlane: THREE.Plane) { + static getPointsCircle( + location: ILocationArc, + workPlane: THREE.Plane, + movingPoint: THREE.Vector3, + isHaft = false + ) { const {radius, center, numberSegment} = location; - const {x, z} = getLocalVectorOnFace(workPlane.normal); + const uVector = getDirection(center, movingPoint); + const vVector = new THREE.Vector3() + .crossVectors(workPlane.normal, uVector) + .normalize(); const angle0 = (2 * Math.PI) / numberSegment; - return this.getPointsArc(radius, center, x, z, angle0, numberSegment); + return this.getPointsArc( + radius, + center, + uVector, + vVector, + angle0, + isHaft ? numberSegment / 2 : numberSegment + ); } + static getPointsArc( minRadius: number, center: THREE.Vector3, uVector: THREE.Vector3, vVector: THREE.Vector3, - angle0: number, + angle: number, numberSegment: number ) { const position: number[] = []; for (let i = 0; i <= numberSegment; i++) { - const cos = minRadius * Math.cos(i * angle0); - const sin = minRadius * Math.sin(i * angle0); + const cos = minRadius * Math.cos(i * angle); + const sin = minRadius * Math.sin(i * angle); const p = center .clone() .add(uVector.clone().multiplyScalar(cos)) @@ -122,4 +137,33 @@ export class LocationUtils { } return position; } + static getPointsArcFromAngle( + radius: number, + p0: THREE.Vector3, + p: THREE.Vector3, + normal: THREE.Vector3, + angleArc: number, + numberSegment: number + ) { + const dir = getDirection(p0, p); + const per = new THREE.Vector3().crossVectors(normal, dir).normalize(); + const position: number[] = []; + position.push(p.x); + position.push(p.y); + position.push(p.z); + const angle0 = angleArc / numberSegment; + for (let i = 0; i < numberSegment; i++) { + const angle = (i + 1) * angle0; + const sin = Math.sin(angle); + const cos = Math.cos(angle); + const pTemp = p0 + .clone() + .add(dir.clone().multiplyScalar(cos * radius)) + .add(per.clone().multiplyScalar(sin * radius)); + position.push(pTemp.x); + position.push(pTemp.y); + position.push(pTemp.z); + } + return position; + } } diff --git a/src/BimModel/src/system/01-geometry/src/location/index.ts b/src/BimModel/src/system/geometry/location/index.ts similarity index 100% rename from src/BimModel/src/system/01-geometry/src/location/index.ts rename to src/BimModel/src/system/geometry/location/index.ts diff --git a/src/BimModel/src/system/geometry/shape/index.ts b/src/BimModel/src/system/geometry/shape/index.ts new file mode 100644 index 0000000..f10194e --- /dev/null +++ b/src/BimModel/src/system/geometry/shape/index.ts @@ -0,0 +1,8 @@ +/** + * @module GeometrySystem + */ +import * as THREE from "three"; +import {Components} from "@BimModel/src"; +export class ShapeGeometry { + static from3D(_workPlane: THREE.Plane, _origin: THREE.Vector3) {} +} diff --git a/src/BimModel/src/system/01-geometry/types.ts b/src/BimModel/src/system/geometry/types.ts similarity index 97% rename from src/BimModel/src/system/01-geometry/types.ts rename to src/BimModel/src/system/geometry/types.ts index ca6cf94..3073fd0 100644 --- a/src/BimModel/src/system/01-geometry/types.ts +++ b/src/BimModel/src/system/geometry/types.ts @@ -1,6 +1,6 @@ import * as THREE from "three"; export const dimStyle = { - arrow: 0.3, + arrow: 0.1, offset: 0.02, extend: 0.3, }; diff --git a/src/BimModel/src/system/grid/index.ts b/src/BimModel/src/system/grid/index.ts new file mode 100644 index 0000000..dcd1bd2 --- /dev/null +++ b/src/BimModel/src/system/grid/index.ts @@ -0,0 +1 @@ +export const GridSystem = "GridSystem"; diff --git a/src/BimModel/src/system/index.ts b/src/BimModel/src/system/index.ts index cbb6eb4..ecf1bce 100644 --- a/src/BimModel/src/system/index.ts +++ b/src/BimModel/src/system/index.ts @@ -1,59 +1,6 @@ -import {Components} from "../Components"; -import {GeometrySystem} from "./01-geometry"; -import {ElementSystem} from "./02-element"; -import {ElementTypeSystem} from "./03-element-type"; -import {DrawToolSystem} from "./04-draw-tool"; -import {ParameterSystem} from "./05-parameter"; -import {CategorySystem} from "./06-category"; -import {FamilySystem} from "./07-family"; -import {LevelSystem} from "./08-level"; -import {GridSystem} from "./09-grid"; -import {ProjectSystem} from "./10-project"; -import {SnapperSystem} from "./11-snapper"; -import {WorkPlaneSystem} from "./12-work-plane"; - -export * from "./00-base"; -export * from "./01-geometry"; -export * from "./02-element"; -export * from "./03-element-type"; -export * from "./04-draw-tool"; -export * from "./05-parameter"; -export * from "./06-category"; -export * from "./07-family"; -export * from "./08-level"; -export * from "./09-grid"; -export * from "./10-project"; -export * from "./11-snapper"; -export * from "./12-work-plane"; - -export class SystemComponent { - /** - * - */ - constructor(components: Components) { - const geometry = components.tools.get(GeometrySystem); - geometry.enabled = true; - const elementSystem = components.tools.get(ElementSystem); - elementSystem.enabled = true; - const elementSystemType = components.tools.get(ElementTypeSystem); - elementSystemType.enabled = true; - const drawToolSystem = components.tools.get(DrawToolSystem); - drawToolSystem.enabled = true; - const parameterSystem = components.tools.get(ParameterSystem); - parameterSystem.enabled = true; - const categorySystem = components.tools.get(CategorySystem); - categorySystem.enabled = true; - const familySystem = components.tools.get(FamilySystem); - familySystem.enabled = true; - const levelSystem = components.tools.get(LevelSystem); - levelSystem.enabled = true; - const gridSystem = components.tools.get(GridSystem); - gridSystem.enabled = true; - const projectSystem = components.tools.get(ProjectSystem); - projectSystem.enabled = true; - const snapperSystem = components.tools.get(SnapperSystem); - snapperSystem.enabled = true; - const workPlaneSystem = components.tools.get(WorkPlaneSystem); - workPlaneSystem.enabled = true; - } -} +export * from "./base"; +export * from "./geometry"; +export * from "./element"; +export * from "./element-type"; +export * from "./family"; +export * from "./grid"; diff --git a/src/BimModel/src/types/categories.ts b/src/BimModel/src/types/categories.ts new file mode 100644 index 0000000..c0d62f0 --- /dev/null +++ b/src/BimModel/src/types/categories.ts @@ -0,0 +1,17 @@ +export type ICategory = + | "Wall" + | "Floor" + | "Ceiling" + | "Roof" + | "Column" + | "Door" + | "Window" + | "Structure Beam" + | "Structure Column" + | "Structure Wall" + | "Structure Slab" + | "Structure Foundation" + | "ReinForcement" + | "Duct" + | "Pipe" + | "AirTerminal"; diff --git a/src/BimModel/src/types/constants.ts b/src/BimModel/src/types/constants.ts index 025fec8..1a643c7 100644 --- a/src/BimModel/src/types/constants.ts +++ b/src/BimModel/src/types/constants.ts @@ -6,7 +6,9 @@ export const UUID = { RaycasterComponent: "1e2f573d-942c-4c3b-ae70-5bb09d34144e", CubeMapComponent: "6d54b78e-443b-41c2-a41b-692359ac6194", ModelingComponent: "387fd9c7-c4b8-4140-ab1e-a704fa2346c8", - StructureComponent: "84f65fed-d260-4abd-9f0b-e5d82f974bb7", - PropertyComponent: "a93ae755-5ad7-4cef-991b-88e91d6c8b06", ProjectComponent: "cc33b376-7b0c-4e3d-a335-7acaf7f625f6", + LevelSystem: "80153232-fa64-42bf-b1a5-71afd7b5db7b", + DrawTool: "9f57c4ea-8628-4454-9296-5cc63c93d7af", + WorkPlane: "1193dbc8-adf8-4a04-be23-8e6a157e55e0", + Snapper: "7507772f-aeab-47d5-8c81-b127a1289d27", }; diff --git a/src/BimModel/src/types/index.ts b/src/BimModel/src/types/index.ts index 2d103c1..034bd9a 100644 --- a/src/BimModel/src/types/index.ts +++ b/src/BimModel/src/types/index.ts @@ -3,3 +3,4 @@ export * from "./component"; export * from "./base-types"; export * from "./cameraData"; export * from "./constants"; +export * from "./categories"; diff --git a/src/BimModel/src/utils/vectorUtils.ts b/src/BimModel/src/utils/vectorUtils.ts index 0c1a359..98ae14b 100644 --- a/src/BimModel/src/utils/vectorUtils.ts +++ b/src/BimModel/src/utils/vectorUtils.ts @@ -1,5 +1,8 @@ import {Box3, BufferGeometry, InstancedMesh, Mesh, Plane, Sphere} from "three"; + import {Vector3} from "three"; + +export const defaultToleranceDistance = 0.01; /** * compare 2 value number using for tolorence * @param {*} firstValue @@ -10,7 +13,7 @@ import {Vector3} from "three"; export function areEqual( firstValue: number, secondValue: number, - tolerance = 1.0e-9 + tolerance = defaultToleranceDistance ) { return ( secondValue - tolerance < firstValue && firstValue < secondValue + tolerance @@ -35,11 +38,15 @@ export function getDirection(start: Vector3, end: Vector3) { * @param {*} v2 * @returns */ -export function areEqualVector(v1: Vector3, v2: Vector3) { +export function areEqualVector( + v1: Vector3, + v2: Vector3, + tolerance = defaultToleranceDistance +) { return ( - areEqual(v1.x, v2.x, 1.0e-3) && - areEqual(v1.y, v2.y, 1.0e-3) && - areEqual(v1.z, v2.z, 1.0e-3) + areEqual(v1.x, v2.x, tolerance) && + areEqual(v1.y, v2.y, tolerance) && + areEqual(v1.z, v2.z, tolerance) ); } diff --git a/tsconfig.json b/tsconfig.json index 22d6ca6..ef6dde4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,8 +38,10 @@ "@ModelingComponent/*": ["src/BimModel/src/ModelingComponent/*"], "@PropertyComponent/*": ["src/BimModel/src/PropertyComponent/*"], "@RendererComponent/*": ["src/BimModel/src/RendererComponent/*"], - "@StructureComponent/*": ["src/BimModel/src/StructureComponent/*"], "@ProjectComponent/*": ["src/BimModel/src/ProjectComponent/*"], + "@LevelSystem/*": ["src/BimModel/src/LevelSystem/*"], + "@WorkPlane/*": ["src/BimModel/src/WorkPlane/*"], + "@DrawTool/*": ["src/BimModel/src/DrawTool/*"], "@system/*": ["src/BimModel/src/system/*"], "@signals/*": ["src/signals/*"], "@pages/*": ["src/pages/*"], diff --git a/vite.config.ts b/vite.config.ts index 5435037..cb5e1bd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -76,14 +76,16 @@ export default defineConfig(() => { __dirname, "./src/BimModel/src/RendererComponent" ), - "@StructureComponent": path.resolve( - __dirname, - "./src/BimModel/src/StructureComponent" - ), "@ProjectComponent": path.resolve( __dirname, "./src/BimModel/src/ProjectComponent" ), + "@LevelSystem": path.resolve( + __dirname, + "./src/BimModel/src/LevelSystem" + ), + "@WorkPlane": path.resolve(__dirname, "./src/BimModel/src/WorkPlane"), + "@DrawTool": path.resolve(__dirname, "./src/BimModel/src/DrawTool"), "@system": path.resolve(__dirname, "./src/BimModel/src/system"), "@components": path.resolve(__dirname, "./src/components"), "@signals": path.resolve(__dirname, "./src/signals"),