@collabdt/core 0.0.42 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/Toolbar.d.ts.map +1 -1
- package/dist/core/components/Toolbar.js.map +1 -1
- package/dist/core/components/ToolbarBody.js.map +1 -1
- package/dist/core/components/TopNavigationBar.js.map +1 -1
- package/dist/core/components/authentication/ForgotPassword.js.map +1 -1
- package/dist/core/components/authentication/Signin.js.map +1 -1
- package/dist/core/components/authentication/Signup.js.map +1 -1
- package/dist/core/components/settings/src/OrganizationSkeleton.js.map +1 -1
- package/dist/core/components/settings/src/SettingsSkeleton.js.map +1 -1
- package/dist/core/components/ui/Comments/CollapsibleCommentItem.d.ts.map +1 -1
- package/dist/core/components/ui/Comments/CollapsibleCommentItem.js.map +1 -1
- package/dist/core/components/ui/Comments/CommentsSection.d.ts.map +1 -1
- package/dist/core/components/ui/Comments/CommentsSection.js.map +1 -1
- package/dist/core/components/ui/DataTable.d.ts.map +1 -1
- package/dist/core/components/ui/DataTable.js +7 -0
- package/dist/core/components/ui/DataTable.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileMarker.d.ts +5 -2
- package/dist/core/components/ui/FilesManager/src/FileMarker.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileMarker.js +84 -21
- package/dist/core/components/ui/FilesManager/src/FileMarker.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/convertIfcToFragmentsFile.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/convertIfcToFragmentsFile.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileUploadHandler.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileUploadHandler.js.map +1 -1
- package/dist/core/components/ui/Icons/IfcIcon.d.ts.map +1 -1
- package/dist/core/components/ui/Icons/IfcIcon.js.map +1 -1
- package/dist/core/components/ui/InfoSidebar/index.d.ts.map +1 -1
- package/dist/core/components/ui/InfoSidebar/index.js.map +1 -1
- package/dist/core/components/ui/Navbar.d.ts.map +1 -1
- package/dist/core/components/ui/Navbar.js.map +1 -1
- package/dist/core/components/ui/Sensors/CollapsibleSensorItem.d.ts.map +1 -1
- package/dist/core/components/ui/Sensors/CollapsibleSensorItem.js.map +1 -1
- package/dist/core/components/ui/Sensors/SensorTagsSection.d.ts.map +1 -1
- package/dist/core/components/ui/Sensors/SensorTagsSection.js.map +1 -1
- package/dist/core/components/ui/Sensors/SensorsSection.d.ts.map +1 -1
- package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
- package/dist/core/components/ui/ShareFeature/ShareToolSubmenu.d.ts.map +1 -1
- package/dist/core/components/ui/ShareFeature/ShareToolSubmenu.js.map +1 -1
- package/dist/core/components/viewers/Data/buildingDetails/GeocoderInput.js +2 -2
- package/dist/core/components/viewers/Data/buildingDetails/GeocoderInput.js.map +1 -1
- package/dist/core/components/viewers/Data/infrastructureDetails/FieldRenderer.d.ts.map +1 -1
- package/dist/core/components/viewers/Data/infrastructureDetails/FieldRenderer.js.map +1 -1
- package/dist/core/components/viewers/Data/siteDetails/AssociatedBuildings.js +2 -2
- package/dist/core/components/viewers/Data/siteDetails/AssociatedBuildings.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +5 -1
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/bim/BimToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimToolbar.js.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.js +14 -5
- package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js +6 -0
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.js +168 -39
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/ClippingPlane.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/ClippingPlane.js.map +1 -1
- package/dist/core/components/viewers/bim/src/DXFLoader/index.d.ts +14 -37
- package/dist/core/components/viewers/bim/src/DXFLoader/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/DXFLoader/index.js +31 -318
- package/dist/core/components/viewers/bim/src/DXFLoader/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts +66 -7
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js +253 -21
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/ModelManager/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/ModelManager/index.js +9 -0
- package/dist/core/components/viewers/bim/src/ModelManager/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts +3 -2
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/useFriendlyIfcClassName.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/useFriendlyIfcClassName.js +3 -4
- package/dist/core/components/viewers/bim/src/lib/useFriendlyIfcClassName.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/index.js +40 -18
- package/dist/core/components/viewers/bim/src/tools/AddToBim/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddDxf.d.ts +2 -5
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddDxf.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddDxf.js +45 -59
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddDxf.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddSensor.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/AddSensor.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimSensor.js +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimSensor.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileHandler.d.ts +10 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileHandler.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileHandler.js +25 -73
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileHandler.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.d.ts +7 -3
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js +42 -78
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/Position3DCard.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/Position3DCard.js +52 -75
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/Position3DCard.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.d.ts +15 -3
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.js +165 -105
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.js.map +1 -1
- package/dist/core/components/viewers/index.d.ts.map +1 -1
- package/dist/core/components/viewers/index.js.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.js +32 -8
- package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.js +4 -3
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/RowActions.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/RowActions.js +148 -0
- package/dist/core/components/viewers/map/datasets/RowActions.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/index.js +32 -15
- package/dist/core/components/viewers/map/datasets/index.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.d.ts +4 -0
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.js +43 -0
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.js.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/localDatasets.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/localDatasets.js +39 -3
- package/dist/core/components/viewers/map/datasets/src/localDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js +2 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/publishedTiles.d.ts +47 -0
- package/dist/core/components/viewers/map/datasets/src/publishedTiles.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/publishedTiles.js +114 -0
- package/dist/core/components/viewers/map/datasets/src/publishedTiles.js.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/wmsTime.d.ts +49 -0
- package/dist/core/components/viewers/map/datasets/src/wmsTime.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/wmsTime.js +100 -0
- package/dist/core/components/viewers/map/datasets/src/wmsTime.js.map +1 -0
- package/dist/core/components/viewers/map/src/Geocoder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/Geocoder.js +9 -9
- package/dist/core/components/viewers/map/src/Geocoder.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js +25 -43
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.js +19 -2
- package/dist/core/components/viewers/map/src/MapLayers/src/BimLayer/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.d.ts +9 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.js +28 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/countryLayerUtils.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js +1 -16
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/FileModelLayer/FileModelLayer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/FileModelLayer/FileModelLayer.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.js +31 -2
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.d.ts +21 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.js +111 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js +77 -2
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/FilesSection.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/FilesSection.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/ModelsSection.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/ModelsSection.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapProjection.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapProjection.js +19 -9
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapProjection.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/TerrainLevel.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/TerrainLevel.js +10 -3
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/TerrainLevel.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoder.d.ts +6 -2
- package/dist/core/components/viewers/map/utils/geocoder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoder.js +10 -62
- package/dist/core/components/viewers/map/utils/geocoder.js.map +1 -1
- package/dist/core/components/viewers/map/utils/geocoding/adapters.d.ts +5 -0
- package/dist/core/components/viewers/map/utils/geocoding/adapters.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/adapters.js +192 -0
- package/dist/core/components/viewers/map/utils/geocoding/adapters.js.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/config.d.ts +6 -0
- package/dist/core/components/viewers/map/utils/geocoding/config.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/config.js +14 -0
- package/dist/core/components/viewers/map/utils/geocoding/config.js.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/index.d.ts +8 -0
- package/dist/core/components/viewers/map/utils/geocoding/index.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/index.js +44 -0
- package/dist/core/components/viewers/map/utils/geocoding/index.js.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/osm.d.ts +6 -0
- package/dist/core/components/viewers/map/utils/geocoding/osm.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/osm.js +39 -0
- package/dist/core/components/viewers/map/utils/geocoding/osm.js.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/pelias.d.ts +8 -0
- package/dist/core/components/viewers/map/utils/geocoding/pelias.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/geocoding/pelias.js +35 -0
- package/dist/core/components/viewers/map/utils/geocoding/pelias.js.map +1 -0
- package/dist/core/components/viewers/pointcloud/PointCloudToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/PointCloudToolbar.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/PointCloudViewer.js +1 -3
- package/dist/core/components/viewers/pointcloud/PointCloudViewer.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/index.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/index.js +2 -3
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/index.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/FilesSection.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/FilesSection.js +8 -2
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/FilesSection.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/PointCloudSection.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/src/FileTab/src/PointCloudSection.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/PerformanceSettingsTools/NodeSizeSelectionTool.js +9 -9
- package/dist/core/components/viewers/pointcloud/src/tools/PerformanceSettingsTools/NodeSizeSelectionTool.js.map +1 -1
- package/dist/core/hooks/provider.js.map +1 -1
- package/dist/core/plugins/host/provider.d.ts.map +1 -1
- package/dist/core/plugins/host/provider.js.map +1 -1
- package/dist/core/store/AppConfig/context.d.ts.map +1 -1
- package/dist/core/store/AppConfig/context.js.map +1 -1
- package/dist/core/store/BIM/context.d.ts.map +1 -1
- package/dist/core/store/BIM/context.js.map +1 -1
- package/dist/core/store/BIM/reducer.d.ts +0 -1
- package/dist/core/store/BIM/reducer.d.ts.map +1 -1
- package/dist/core/store/BIM/reducer.js +0 -4
- package/dist/core/store/BIM/reducer.js.map +1 -1
- package/dist/core/store/Buildings/context.d.ts.map +1 -1
- package/dist/core/store/Buildings/context.js.map +1 -1
- package/dist/core/store/Content/context.d.ts.map +1 -1
- package/dist/core/store/Content/context.js.map +1 -1
- package/dist/core/store/Datasets/context.d.ts.map +1 -1
- package/dist/core/store/Datasets/context.js +2 -1
- package/dist/core/store/Datasets/context.js.map +1 -1
- package/dist/core/store/Datasets/reducer.d.ts +2 -0
- package/dist/core/store/Datasets/reducer.d.ts.map +1 -1
- package/dist/core/store/Datasets/reducer.js +9 -4
- package/dist/core/store/Datasets/reducer.js.map +1 -1
- package/dist/core/store/Files/context.d.ts.map +1 -1
- package/dist/core/store/Files/context.js.map +1 -1
- package/dist/core/store/Map/context.d.ts.map +1 -1
- package/dist/core/store/Map/context.js.map +1 -1
- package/dist/core/store/Menus/context.d.ts.map +1 -1
- package/dist/core/store/Menus/context.js.map +1 -1
- package/dist/core/store/Permissions/context.d.ts.map +1 -1
- package/dist/core/store/Permissions/context.js.map +1 -1
- package/dist/core/store/PointCloud/context.d.ts.map +1 -1
- package/dist/core/store/PointCloud/context.js.map +1 -1
- package/dist/core/store/Tools/context.d.ts.map +1 -1
- package/dist/core/store/Tools/context.js.map +1 -1
- package/dist/core/types/datasetTypes.d.ts +8 -1
- package/dist/core/types/datasetTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.d.ts +13 -13
- package/dist/core/types/dbTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.js +13 -13
- package/dist/core/types/dbTypes.js.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/types/index.js.map +1 -1
- package/dist/core/utils/imageUtils.js +1 -1
- package/dist/core/utils/imageUtils.js.map +1 -1
- package/package.json +4 -3
- package/dist/core/components/viewers/pointcloud/src/PointCloudManagement/PointCloudViewer-old.d.ts +0 -3
- package/dist/core/components/viewers/pointcloud/src/PointCloudManagement/PointCloudViewer-old.d.ts.map +0 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudManagement/PointCloudViewer-old.js +0 -173
- package/dist/core/components/viewers/pointcloud/src/PointCloudManagement/PointCloudViewer-old.js.map +0 -1
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import * as OBC from "@thatopen/components";
|
|
4
|
-
import type
|
|
4
|
+
import { type PlacedKind } from "./FileHandler";
|
|
5
|
+
import type { FileMarkerAction } from "../../../../../../ui/FilesManager/src/FileMarker";
|
|
6
|
+
import type { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
|
5
7
|
import type { BimToolbarToolsType } from "../../bimToolbar";
|
|
8
|
+
export type GizmoMode = "translate" | "rotate" | "scale";
|
|
9
|
+
export interface PlacedFile {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
kind: PlacedKind;
|
|
13
|
+
marker: CSS2DObject | null;
|
|
14
|
+
object3D: THREE.Object3D;
|
|
15
|
+
}
|
|
6
16
|
export declare function useFilePlacement(bimComponents: OBC.Components | null, world: OBC.World | null, fragments: OBC.FragmentsManager | null, toolsDispatch: React.Dispatch<any>, buildingId: number, uploadFileToDB?: (args: {
|
|
7
17
|
fileData: any;
|
|
8
18
|
buildingId: number;
|
|
9
|
-
}) => Promise<any
|
|
19
|
+
}) => Promise<any>, onMarkerAction?: (id: string, action: FileMarkerAction) => void): {
|
|
10
20
|
selectedFile: File;
|
|
11
|
-
addedFiles: AddedFile[];
|
|
12
21
|
mousePosition: {
|
|
13
22
|
x: number;
|
|
14
23
|
y: number;
|
|
@@ -30,5 +39,8 @@ export declare function useFilePlacement(bimComponents: OBC.Components | null, w
|
|
|
30
39
|
mouse: THREE.Vector2;
|
|
31
40
|
dom: HTMLCanvasElement;
|
|
32
41
|
}) => Promise<any>;
|
|
42
|
+
getPlacedFile: (id: string) => PlacedFile | undefined;
|
|
43
|
+
editPlacedFile: (id: string, mode?: GizmoMode) => void;
|
|
44
|
+
removePlacedFile: (id: string) => void;
|
|
33
45
|
};
|
|
34
46
|
//# sourceMappingURL=useFilePlacement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilePlacement.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useFilePlacement.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAM3C,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,gBAAg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,MAAM,SAAQ,SAAS;2BAYrB,MAAM;EA+BvD"}
|
|
@@ -7,20 +7,33 @@ import { Highlighter } from "../../../Highlighter";
|
|
|
7
7
|
import { Cursor } from "../../../Cursor";
|
|
8
8
|
import { AddDxf } from "./AddDxf";
|
|
9
9
|
import { addFileToScene } from "./FileHandler";
|
|
10
|
+
import { removeMarker } from "./FileMarkerUtils";
|
|
10
11
|
import { getFileExtension } from "../../../../../../../utils/utils";
|
|
11
|
-
|
|
12
|
+
const GROUND_PLANE = new THREE.Plane(new THREE.Vector3(0, 1, 0), 0);
|
|
13
|
+
const pointOnGroundPlane = (camera, canvas, clientX, clientY) => {
|
|
14
|
+
const rect = canvas.getBoundingClientRect();
|
|
15
|
+
const ndc = new THREE.Vector2(
|
|
16
|
+
(clientX - rect.left) / rect.width * 2 - 1,
|
|
17
|
+
-((clientY - rect.top) / rect.height) * 2 + 1
|
|
18
|
+
);
|
|
19
|
+
const raycaster = new THREE.Raycaster();
|
|
20
|
+
raycaster.setFromCamera(ndc, camera);
|
|
21
|
+
const target = new THREE.Vector3();
|
|
22
|
+
return raycaster.ray.intersectPlane(GROUND_PLANE, target) ? target : null;
|
|
23
|
+
};
|
|
24
|
+
function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildingId, uploadFileToDB, onMarkerAction) {
|
|
12
25
|
const [selectedFile, setSelectedFile] = React.useState(null);
|
|
13
|
-
const [addedFiles, setAddedFiles] = React.useState([]);
|
|
14
26
|
const [mousePosition, setMousePosition] = React.useState({ x: 0, y: 0 });
|
|
15
27
|
const [isPlacingFile, setIsPlacingFile] = React.useState(false);
|
|
16
28
|
const [fileScale, setFileScale] = React.useState(1);
|
|
17
29
|
const [fileRotation, setFileRotation] = React.useState(0);
|
|
18
|
-
const [confirmed3DFiles, setConfirmed3DFiles] = React.useState(/* @__PURE__ */ new Set());
|
|
19
30
|
const [show3DScaleCard, setShow3DScaleCard] = React.useState(false);
|
|
20
31
|
const [current3DFileId, setCurrent3DFileId] = React.useState(null);
|
|
21
32
|
const [current3DFileType, setCurrent3DFileType] = React.useState(null);
|
|
22
33
|
const [modelManager, setModelManager] = React.useState(null);
|
|
23
34
|
const [addDxf, setAddDxf] = React.useState(null);
|
|
35
|
+
const placedFilesRef = React.useRef(/* @__PURE__ */ new Map());
|
|
36
|
+
const [markerCount, setMarkerCount] = React.useState(0);
|
|
24
37
|
const highlighter = React.useMemo(() => {
|
|
25
38
|
if (!bimComponents) return null;
|
|
26
39
|
try {
|
|
@@ -35,16 +48,12 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
35
48
|
const manager = bimComponents.get(ModelManager);
|
|
36
49
|
if (manager) setModelManager(manager);
|
|
37
50
|
}
|
|
38
|
-
if (!addDxf)
|
|
39
|
-
const dxfUtility = new AddDxf(bimComponents, world);
|
|
40
|
-
setAddDxf(dxfUtility);
|
|
41
|
-
}
|
|
51
|
+
if (!addDxf) setAddDxf(new AddDxf(bimComponents, world));
|
|
42
52
|
}, [bimComponents, world, modelManager, addDxf]);
|
|
43
53
|
const setCursor = React.useCallback((cursor) => {
|
|
44
54
|
if (!bimComponents) return;
|
|
45
55
|
const currentCursor = bimComponents.get(Cursor);
|
|
46
|
-
if (
|
|
47
|
-
currentCursor.cursor = cursor;
|
|
56
|
+
if (currentCursor) currentCursor.cursor = cursor;
|
|
48
57
|
}, [bimComponents]);
|
|
49
58
|
const raycast = React.useCallback(async (data) => {
|
|
50
59
|
if (!fragments || !highlighter) return null;
|
|
@@ -54,23 +63,18 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
54
63
|
const result = await model.raycast(data);
|
|
55
64
|
if (result) results.push(result);
|
|
56
65
|
}
|
|
57
|
-
await Promise.all(results);
|
|
58
66
|
if (results.length === 0) return null;
|
|
59
|
-
let
|
|
60
|
-
let minDistance = closestResult.distance;
|
|
67
|
+
let closest = results[0];
|
|
61
68
|
for (let i = 1; i < results.length; i++) {
|
|
62
|
-
if (results[i].distance <
|
|
63
|
-
minDistance = results[i].distance;
|
|
64
|
-
closestResult = results[i];
|
|
65
|
-
}
|
|
69
|
+
if (results[i].distance < closest.distance) closest = results[i];
|
|
66
70
|
}
|
|
67
|
-
return
|
|
71
|
+
return closest;
|
|
68
72
|
}, [fragments, highlighter]);
|
|
69
73
|
const processFileObject = React.useCallback((file, addingMode) => {
|
|
70
74
|
const fileName = file.name.toLowerCase();
|
|
71
75
|
if (addingMode === "bim-add-cad") {
|
|
72
76
|
if (!fileName.endsWith(".dxf")) {
|
|
73
|
-
|
|
77
|
+
toast.error("Please select a valid CAD file (.dxf)");
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
setShow3DScaleCard(true);
|
|
@@ -90,7 +94,7 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
90
94
|
setSelectedFile(file);
|
|
91
95
|
setIsPlacingFile(true);
|
|
92
96
|
setCursor("crosshair");
|
|
93
|
-
toast.info(`Double-click
|
|
97
|
+
toast.info(`Double-click in the scene to place: "${file.name}"`, {
|
|
94
98
|
id: "place-bim-file-toast",
|
|
95
99
|
duration: Infinity
|
|
96
100
|
});
|
|
@@ -98,8 +102,7 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
98
102
|
const handleFileSelect = React.useCallback((event, addingMode) => {
|
|
99
103
|
var _a;
|
|
100
104
|
const file = (_a = event.target.files) == null ? void 0 : _a[0];
|
|
101
|
-
if (
|
|
102
|
-
processFileObject(file, addingMode);
|
|
105
|
+
if (file) processFileObject(file, addingMode);
|
|
103
106
|
}, [processFileObject]);
|
|
104
107
|
const handleFileDrop = React.useCallback((file, addingMode) => {
|
|
105
108
|
processFileObject(file, addingMode);
|
|
@@ -116,9 +119,47 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
116
119
|
toast.dismiss("place-bim-file-toast");
|
|
117
120
|
toolsDispatch({ type: "CLEAR-TOOLS" });
|
|
118
121
|
}, [setCursor, toolsDispatch]);
|
|
122
|
+
const uploadPlacedFile = React.useCallback(async (file, point, rotation = 0) => {
|
|
123
|
+
if (!uploadFileToDB || buildingId <= 0) return;
|
|
124
|
+
try {
|
|
125
|
+
const assetId = crypto.randomUUID();
|
|
126
|
+
const presignedResponse = await fetch(`/api/presigned-url-upload?asset=${assetId}`);
|
|
127
|
+
if (!presignedResponse.ok) return;
|
|
128
|
+
const { presignedUrl } = await presignedResponse.json();
|
|
129
|
+
await fetch(presignedUrl, {
|
|
130
|
+
method: "PUT",
|
|
131
|
+
body: file,
|
|
132
|
+
headers: { "Content-Type": file.type }
|
|
133
|
+
});
|
|
134
|
+
await uploadFileToDB({
|
|
135
|
+
fileData: {
|
|
136
|
+
name: file.name,
|
|
137
|
+
type: "bim-file",
|
|
138
|
+
mimeType: file.type,
|
|
139
|
+
extension: getFileExtension(file),
|
|
140
|
+
sizeBytes: file.size,
|
|
141
|
+
tag: "file",
|
|
142
|
+
uploadedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
143
|
+
url: "",
|
|
144
|
+
assetId,
|
|
145
|
+
description: "",
|
|
146
|
+
attachedFilesBuildingId: buildingId,
|
|
147
|
+
isVisible: true,
|
|
148
|
+
x: point.x,
|
|
149
|
+
y: point.y,
|
|
150
|
+
z: point.z,
|
|
151
|
+
rotation
|
|
152
|
+
},
|
|
153
|
+
buildingId
|
|
154
|
+
});
|
|
155
|
+
} catch (err) {
|
|
156
|
+
console.error("Error uploading placed file:", err);
|
|
157
|
+
}
|
|
158
|
+
}, [uploadFileToDB, buildingId]);
|
|
119
159
|
React.useEffect(() => {
|
|
120
160
|
if (!selectedFile || !bimComponents || !world || !isPlacingFile) return;
|
|
121
161
|
const mouse = new THREE.Vector2();
|
|
162
|
+
const canvas = world.renderer.three.domElement;
|
|
122
163
|
const handleMouseMove = (e) => {
|
|
123
164
|
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
124
165
|
mouse.x = e.clientX;
|
|
@@ -127,76 +168,44 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
127
168
|
const handleDblClick = async (e) => {
|
|
128
169
|
mouse.x = e.clientX;
|
|
129
170
|
mouse.y = e.clientY;
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
type: "bim-file",
|
|
168
|
-
mimeType: selectedFile.type,
|
|
169
|
-
extension: getFileExtension(selectedFile),
|
|
170
|
-
sizeBytes: selectedFile.size,
|
|
171
|
-
tag: "file",
|
|
172
|
-
uploadedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
173
|
-
url: "",
|
|
174
|
-
assetId: fileId,
|
|
175
|
-
description: "",
|
|
176
|
-
attachedFilesBuildingId: buildingId,
|
|
177
|
-
isVisible: true,
|
|
178
|
-
x: result.point.x,
|
|
179
|
-
y: result.point.y,
|
|
180
|
-
z: result.point.z
|
|
181
|
-
},
|
|
182
|
-
buildingId
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
} catch (err) {
|
|
186
|
-
console.error("Error uploading file to database:", err);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const fileName = selectedFile.name.toLowerCase();
|
|
190
|
-
const is3DFile = fileName.endsWith(".dxf") || fileName.endsWith(".glb") || fileName.endsWith(".gltf");
|
|
191
|
-
if (is3DFile) {
|
|
192
|
-
setIsPlacingFile(false);
|
|
193
|
-
setCursor("");
|
|
194
|
-
} else {
|
|
195
|
-
cancelPlacement();
|
|
196
|
-
}
|
|
171
|
+
const modelHit = await raycast({ camera: world.camera.three, mouse, dom: canvas });
|
|
172
|
+
const point = (modelHit == null ? void 0 : modelHit.point) ? modelHit.point.clone() : pointOnGroundPlane(world.camera.three, canvas, e.clientX, e.clientY);
|
|
173
|
+
if (!point) return;
|
|
174
|
+
const addedFile = {
|
|
175
|
+
id: Date.now().toString(),
|
|
176
|
+
file: selectedFile,
|
|
177
|
+
position: point,
|
|
178
|
+
imageUrl: selectedFile.type.startsWith("image/") ? URL.createObjectURL(selectedFile) : void 0
|
|
179
|
+
};
|
|
180
|
+
const placed = await addFileToScene(
|
|
181
|
+
addedFile,
|
|
182
|
+
fileScale,
|
|
183
|
+
fileRotation,
|
|
184
|
+
world,
|
|
185
|
+
modelManager,
|
|
186
|
+
addDxf,
|
|
187
|
+
setCurrent3DFileId,
|
|
188
|
+
(action) => onMarkerAction == null ? void 0 : onMarkerAction(addedFile.id, action)
|
|
189
|
+
);
|
|
190
|
+
if (placed) {
|
|
191
|
+
placedFilesRef.current.set(addedFile.id, {
|
|
192
|
+
id: addedFile.id,
|
|
193
|
+
name: selectedFile.name,
|
|
194
|
+
kind: placed.kind,
|
|
195
|
+
marker: placed.marker,
|
|
196
|
+
object3D: placed.object3D
|
|
197
|
+
});
|
|
198
|
+
setMarkerCount((c) => c + 1);
|
|
199
|
+
}
|
|
200
|
+
const fileName = selectedFile.name.toLowerCase();
|
|
201
|
+
const is3DFile = fileName.endsWith(".dxf") || fileName.endsWith(".glb") || fileName.endsWith(".gltf");
|
|
202
|
+
if (is3DFile) {
|
|
203
|
+
setIsPlacingFile(false);
|
|
204
|
+
setCursor("");
|
|
205
|
+
} else {
|
|
206
|
+
void uploadPlacedFile(selectedFile, point);
|
|
207
|
+
cancelPlacement();
|
|
197
208
|
}
|
|
198
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
199
|
-
document.removeEventListener("dblclick", handleDblClick);
|
|
200
209
|
};
|
|
201
210
|
document.addEventListener("mousemove", handleMouseMove);
|
|
202
211
|
document.addEventListener("dblclick", handleDblClick);
|
|
@@ -204,21 +213,27 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
204
213
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
205
214
|
document.removeEventListener("dblclick", handleDblClick);
|
|
206
215
|
};
|
|
207
|
-
}, [selectedFile, bimComponents, world, isPlacingFile, fileScale, fileRotation, modelManager, addDxf, toolsDispatch, raycast, cancelPlacement, setCursor]);
|
|
216
|
+
}, [selectedFile, bimComponents, world, isPlacingFile, fileScale, fileRotation, modelManager, addDxf, toolsDispatch, raycast, cancelPlacement, setCursor, uploadPlacedFile, onMarkerAction]);
|
|
208
217
|
const confirmPlacement = React.useCallback(() => {
|
|
209
|
-
if (!
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
218
|
+
if (!current3DFileId) return;
|
|
219
|
+
let finalPos;
|
|
220
|
+
let finalRot = fileRotation;
|
|
221
|
+
if (current3DFileType === "dxf" && addDxf) {
|
|
222
|
+
const info = addDxf.getDxf(current3DFileId);
|
|
223
|
+
if (info) {
|
|
224
|
+
finalPos = info.group.position.clone();
|
|
225
|
+
finalRot = THREE.MathUtils.radToDeg(info.group.rotation.y);
|
|
226
|
+
}
|
|
227
|
+
addDxf.confirmPlacement(current3DFileId);
|
|
228
|
+
} else if (current3DFileType === "model" && modelManager) {
|
|
229
|
+
const info = modelManager.getModel(current3DFileId);
|
|
230
|
+
if (info) {
|
|
231
|
+
finalPos = info.model.position.clone();
|
|
232
|
+
finalRot = THREE.MathUtils.radToDeg(info.model.rotation.y);
|
|
219
233
|
}
|
|
220
|
-
|
|
234
|
+
modelManager.toggleGizmo(current3DFileId, false);
|
|
221
235
|
}
|
|
236
|
+
if (selectedFile && finalPos) void uploadPlacedFile(selectedFile, finalPos, finalRot);
|
|
222
237
|
setShow3DScaleCard(false);
|
|
223
238
|
setCurrent3DFileId(null);
|
|
224
239
|
setCurrent3DFileType(null);
|
|
@@ -229,7 +244,7 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
229
244
|
setCursor("");
|
|
230
245
|
toast.dismiss("place-bim-file-toast");
|
|
231
246
|
toolsDispatch({ type: "CLEAR-TOOLS" });
|
|
232
|
-
}, [
|
|
247
|
+
}, [current3DFileId, current3DFileType, addDxf, modelManager, selectedFile, fileRotation, uploadPlacedFile, setCursor, toolsDispatch]);
|
|
233
248
|
React.useEffect(() => {
|
|
234
249
|
if (!current3DFileId || !show3DScaleCard || !current3DFileType) return;
|
|
235
250
|
if (current3DFileType === "dxf" && addDxf) {
|
|
@@ -240,9 +255,51 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
240
255
|
modelManager.setRotation(current3DFileId, new THREE.Euler(0, THREE.MathUtils.degToRad(fileRotation), 0));
|
|
241
256
|
}
|
|
242
257
|
}, [fileScale, fileRotation, current3DFileId, show3DScaleCard, current3DFileType, addDxf, modelManager]);
|
|
258
|
+
React.useEffect(() => {
|
|
259
|
+
if (!world || markerCount === 0) return;
|
|
260
|
+
let raf = 0;
|
|
261
|
+
const worldPos = new THREE.Vector3();
|
|
262
|
+
const tick = () => {
|
|
263
|
+
placedFilesRef.current.forEach((placed) => {
|
|
264
|
+
var _a, _b;
|
|
265
|
+
if (!placed.marker) return;
|
|
266
|
+
placed.object3D.getWorldPosition(worldPos);
|
|
267
|
+
placed.marker.position.set(worldPos.x, worldPos.y + 0.2, worldPos.z);
|
|
268
|
+
const editing = placed.kind === "dxf" ? !!((_a = addDxf == null ? void 0 : addDxf.getDxf(placed.id)) == null ? void 0 : _a.gizmoController) : placed.kind === "model" ? !!((_b = modelManager == null ? void 0 : modelManager.getModel(placed.id)) == null ? void 0 : _b.gizmoController) : false;
|
|
269
|
+
placed.marker.visible = !editing;
|
|
270
|
+
});
|
|
271
|
+
raf = requestAnimationFrame(tick);
|
|
272
|
+
};
|
|
273
|
+
raf = requestAnimationFrame(tick);
|
|
274
|
+
return () => cancelAnimationFrame(raf);
|
|
275
|
+
}, [world, addDxf, modelManager, markerCount]);
|
|
276
|
+
const getPlacedFile = React.useCallback((id) => {
|
|
277
|
+
return placedFilesRef.current.get(id);
|
|
278
|
+
}, []);
|
|
279
|
+
const editPlacedFile = React.useCallback((id, mode = "translate") => {
|
|
280
|
+
var _a, _b;
|
|
281
|
+
const placed = placedFilesRef.current.get(id);
|
|
282
|
+
if (!placed) return;
|
|
283
|
+
if (placed.kind === "dxf" && addDxf) {
|
|
284
|
+
addDxf.toggleGizmo(id, true);
|
|
285
|
+
addDxf.setGizmoMode(id, mode);
|
|
286
|
+
} else if (placed.kind === "model" && modelManager) {
|
|
287
|
+
modelManager.toggleGizmo(id, true);
|
|
288
|
+
(_b = (_a = modelManager.getModel(id)) == null ? void 0 : _a.gizmoController) == null ? void 0 : _b.setMode(mode);
|
|
289
|
+
}
|
|
290
|
+
}, [addDxf, modelManager]);
|
|
291
|
+
const removePlacedFile = React.useCallback((id) => {
|
|
292
|
+
const placed = placedFilesRef.current.get(id);
|
|
293
|
+
if (!placed) return;
|
|
294
|
+
if (placed.kind === "dxf") addDxf == null ? void 0 : addDxf.removeDxf(id);
|
|
295
|
+
else if (placed.kind === "model") modelManager == null ? void 0 : modelManager.remove(id);
|
|
296
|
+
else if (world) world.scene.three.remove(placed.object3D);
|
|
297
|
+
removeMarker(placed.marker, world);
|
|
298
|
+
placedFilesRef.current.delete(id);
|
|
299
|
+
setMarkerCount((c) => Math.max(0, c - 1));
|
|
300
|
+
}, [addDxf, modelManager, world]);
|
|
243
301
|
return {
|
|
244
302
|
selectedFile,
|
|
245
|
-
addedFiles,
|
|
246
303
|
mousePosition,
|
|
247
304
|
isPlacingFile,
|
|
248
305
|
fileScale,
|
|
@@ -256,7 +313,10 @@ function useFilePlacement(bimComponents, world, fragments, toolsDispatch, buildi
|
|
|
256
313
|
cancelPlacement,
|
|
257
314
|
confirmPlacement,
|
|
258
315
|
setCursor,
|
|
259
|
-
raycast
|
|
316
|
+
raycast,
|
|
317
|
+
getPlacedFile,
|
|
318
|
+
editPlacedFile,
|
|
319
|
+
removePlacedFile
|
|
260
320
|
};
|
|
261
321
|
}
|
|
262
322
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.ts"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as THREE from \"three\"\r\nimport * as OBC from \"@thatopen/components\"\r\nimport { toast } from \"sonner\"\r\nimport { ModelManager } from \"../../../ModelManager\"\r\nimport { Highlighter } from \"../../../Highlighter\"\r\nimport { Cursor } from \"../../../Cursor\"\r\nimport { AddDxf } from \"./AddDxf\"\r\nimport { addFileToScene } from \"./FileHandler\"\r\nimport type { AddedFile } from \"./FileMarkerUtils\"\r\nimport type { BimToolbarToolsType } from \"../../bimToolbar\"\r\nimport { getFileExtension } from \"../../../../../../../utils/utils\"\r\n\r\nexport function useFilePlacement(\r\n bimComponents: OBC.Components | null,\r\n world: OBC.World | null,\r\n fragments: OBC.FragmentsManager | null,\r\n toolsDispatch: React.Dispatch<any>,\r\n buildingId: number,\r\n uploadFileToDB?: (args: { fileData: any; buildingId: number }) => Promise<any>,\r\n) {\r\n const [selectedFile, setSelectedFile] = React.useState<File | null>(null)\r\n const [addedFiles, setAddedFiles] = React.useState<AddedFile[]>([])\r\n const [mousePosition, setMousePosition] = React.useState({ x: 0, y: 0 })\r\n const [isPlacingFile, setIsPlacingFile] = React.useState(false)\r\n\r\n const [fileScale, setFileScale] = React.useState(1)\r\n const [fileRotation, setFileRotation] = React.useState(0)\r\n const [confirmed3DFiles, setConfirmed3DFiles] = React.useState<Set<string>>(new Set())\r\n const [show3DScaleCard, setShow3DScaleCard] = React.useState(false)\r\n const [current3DFileId, setCurrent3DFileId] = React.useState<string | null>(null)\r\n const [current3DFileType, setCurrent3DFileType] = React.useState<\"dxf\" | \"model\" | null>(null)\r\n\r\n // Managers\r\n const [modelManager, setModelManager] = React.useState<ModelManager | null>(null)\r\n const [addDxf, setAddDxf] = React.useState<AddDxf | null>(null)\r\n\r\n const highlighter = React.useMemo(() => {\r\n if (!bimComponents) return null\r\n try { return bimComponents.get(Highlighter) } catch { return null }\r\n }, [bimComponents])\r\n\r\n React.useEffect(() => {\r\n if (!bimComponents || !world) return\r\n if (!modelManager) {\r\n const manager = bimComponents.get(ModelManager)\r\n if (manager) setModelManager(manager)\r\n }\r\n if (!addDxf) {\r\n const dxfUtility = new AddDxf(bimComponents, world)\r\n setAddDxf(dxfUtility)\r\n }\r\n }, [bimComponents, world, modelManager, addDxf])\r\n\r\n const setCursor = React.useCallback((cursor: string) => {\r\n if (!bimComponents) return\r\n const currentCursor = bimComponents.get(Cursor)\r\n if (!currentCursor) return\r\n currentCursor.cursor = cursor as any\r\n }, [bimComponents])\r\n\r\n const raycast = React.useCallback(async (data: {\r\n camera: THREE.PerspectiveCamera | THREE.OrthographicCamera\r\n mouse: THREE.Vector2\r\n dom: HTMLCanvasElement\r\n }) => {\r\n if (!fragments || !highlighter) return null\r\n\r\n const results = []\r\n for (const [modelName, model] of fragments.core.models.list) {\r\n if (highlighter.isModelDisabled(modelName)) continue\r\n const result = await model.raycast(data)\r\n if (result) results.push(result)\r\n }\r\n\r\n await Promise.all(results)\r\n if (results.length === 0) return null\r\n\r\n let closestResult = results[0]\r\n let minDistance = closestResult.distance\r\n for (let i = 1; i < results.length; i++) {\r\n if (results[i].distance < minDistance) {\r\n minDistance = results[i].distance\r\n closestResult = results[i]\r\n }\r\n }\r\n\r\n return closestResult\r\n }, [fragments, highlighter])\r\n\r\n const processFileObject = React.useCallback((file: File, addingMode: BimToolbarToolsType) => {\r\n const fileName = file.name.toLowerCase()\r\n\r\n if (addingMode === \"bim-add-cad\") {\r\n if (!fileName.endsWith(\".dxf\")) {\r\n alert(\"Please select a valid CAD file (.dxf)\")\r\n return\r\n }\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"dxf\")\r\n setFileScale(0.001)\r\n } else if (addingMode === \"bim-add-file\") {\r\n if (fileName.endsWith(\".glb\") || fileName.endsWith(\".gltf\")) {\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"model\")\r\n setFileScale(1)\r\n } else if (fileName.endsWith(\".dxf\")) {\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"dxf\")\r\n setFileScale(0.001)\r\n }\r\n }\r\n\r\n setSelectedFile(file)\r\n setIsPlacingFile(true)\r\n setCursor(\"crosshair\")\r\n toast.info(`Double-click on the model to place: \"${file.name}\"`, {\r\n id: 'place-bim-file-toast',\r\n duration: Infinity,\r\n })\r\n }, [setCursor])\r\n\r\n const handleFileSelect = React.useCallback((event: React.ChangeEvent<HTMLInputElement>, addingMode: BimToolbarToolsType) => {\r\n const file = event.target.files?.[0]\r\n if (!file) return\r\n processFileObject(file, addingMode)\r\n }, [processFileObject])\r\n\r\n const handleFileDrop = React.useCallback((file: File, addingMode: BimToolbarToolsType) => {\r\n processFileObject(file, addingMode)\r\n }, [processFileObject])\r\n\r\n const cancelPlacement = React.useCallback(() => {\r\n setSelectedFile(null)\r\n setIsPlacingFile(false)\r\n setShow3DScaleCard(false)\r\n setCurrent3DFileId(null)\r\n setCurrent3DFileType(null)\r\n setFileScale(1)\r\n setFileRotation(0)\r\n setCursor(\"\")\r\n toast.dismiss('place-bim-file-toast')\r\n toolsDispatch({ type: \"CLEAR-TOOLS\" })\r\n }, [setCursor, toolsDispatch])\r\n\r\n // Handle file placement on double-click\r\n React.useEffect(() => {\r\n if (!selectedFile || !bimComponents || !world || !isPlacingFile) return\r\n\r\n const mouse = new THREE.Vector2()\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePosition({ x: e.clientX, y: e.clientY })\r\n mouse.x = e.clientX\r\n mouse.y = e.clientY\r\n }\r\n\r\n const handleDblClick = async (e: MouseEvent) => {\r\n mouse.x = e.clientX\r\n mouse.y = e.clientY\r\n\r\n const result = await raycast({\r\n camera: world.camera.three,\r\n mouse,\r\n dom: world.renderer!.three.domElement!,\r\n })\r\n\r\n if (result?.point && (result.point.x !== 0 || result.point.y !== 0 || result.point.z !== 0)) {\r\n const newAddedFile: AddedFile = {\r\n id: Date.now().toString(),\r\n file: selectedFile,\r\n position: result.point.clone(),\r\n imageUrl: selectedFile.type.startsWith(\"image/\")\r\n ? URL.createObjectURL(selectedFile)\r\n : undefined,\r\n }\r\n\r\n setAddedFiles(prev => [...prev, newAddedFile])\r\n await addFileToScene(\r\n newAddedFile, fileScale, fileRotation,\r\n world, modelManager, addDxf, toolsDispatch, setCurrent3DFileId,\r\n )\r\n\r\n // Upload the file to the database with its 3D position\r\n if (uploadFileToDB && buildingId > 0) {\r\n try {\r\n const fileId = crypto.randomUUID()\r\n const presignedResponse = await fetch(`/api/presigned-url-upload?asset=${fileId}`)\r\n if (presignedResponse.ok) {\r\n const { presignedUrl } = await presignedResponse.json()\r\n await fetch(presignedUrl, {\r\n method: \"PUT\",\r\n body: selectedFile,\r\n headers: { \"Content-Type\": selectedFile.type },\r\n })\r\n await uploadFileToDB({\r\n fileData: {\r\n name: selectedFile.name,\r\n type: \"bim-file\",\r\n mimeType: selectedFile.type,\r\n extension: getFileExtension(selectedFile),\r\n sizeBytes: selectedFile.size,\r\n tag: \"file\",\r\n uploadedAt: new Date().toISOString(),\r\n url: \"\",\r\n assetId: fileId,\r\n description: \"\",\r\n attachedFilesBuildingId: buildingId,\r\n isVisible: true,\r\n x: result.point.x,\r\n y: result.point.y,\r\n z: result.point.z,\r\n },\r\n buildingId,\r\n })\r\n }\r\n } catch (err) {\r\n console.error(\"Error uploading file to database:\", err)\r\n }\r\n }\r\n\r\n const fileName = selectedFile.name.toLowerCase()\r\n const is3DFile = fileName.endsWith(\".dxf\") || fileName.endsWith(\".glb\") || fileName.endsWith(\".gltf\")\r\n\r\n if (is3DFile) {\r\n setIsPlacingFile(false)\r\n setCursor(\"\")\r\n } else {\r\n cancelPlacement()\r\n }\r\n }\r\n\r\n document.removeEventListener(\"mousemove\", handleMouseMove)\r\n document.removeEventListener(\"dblclick\", handleDblClick)\r\n }\r\n\r\n document.addEventListener(\"mousemove\", handleMouseMove)\r\n document.addEventListener(\"dblclick\", handleDblClick)\r\n\r\n return () => {\r\n document.removeEventListener(\"mousemove\", handleMouseMove)\r\n document.removeEventListener(\"dblclick\", handleDblClick)\r\n }\r\n }, [selectedFile, bimComponents, world, isPlacingFile, fileScale, fileRotation, modelManager, addDxf, toolsDispatch, raycast, cancelPlacement, setCursor])\r\n\r\n const confirmPlacement = React.useCallback(() => {\r\n if (!selectedFile || addedFiles.length === 0 || !current3DFileId) return\r\n\r\n const latest3DFile = addedFiles.findLast(f => {\r\n const name = f.file.name.toLowerCase()\r\n return name.endsWith(\".dxf\") || name.endsWith(\".glb\") || name.endsWith(\".gltf\")\r\n })\r\n\r\n if (latest3DFile) {\r\n if (current3DFileType === \"dxf\" && addDxf) {\r\n addDxf.confirmPlacement(current3DFileId)\r\n } else if (current3DFileType === \"model\" && modelManager) {\r\n modelManager.toggleGizmo(current3DFileId, false)\r\n }\r\n setConfirmed3DFiles(prev => new Set(prev).add(latest3DFile.id))\r\n }\r\n\r\n setShow3DScaleCard(false)\r\n setCurrent3DFileId(null)\r\n setCurrent3DFileType(null)\r\n setFileRotation(0)\r\n setFileScale(1)\r\n setSelectedFile(null)\r\n setIsPlacingFile(false)\r\n setCursor(\"\")\r\n toast.dismiss('place-bim-file-toast')\r\n toolsDispatch({ type: \"CLEAR-TOOLS\" })\r\n }, [selectedFile, addedFiles, current3DFileId, current3DFileType, addDxf, modelManager, setCursor, toolsDispatch])\r\n\r\n // Real-time scale/rotation updates for 3D files\r\n React.useEffect(() => {\r\n if (!current3DFileId || !show3DScaleCard || !current3DFileType) return\r\n\r\n if (current3DFileType === \"dxf\" && addDxf) {\r\n addDxf.updateScale(current3DFileId, fileScale)\r\n addDxf.updateRotation(current3DFileId, fileRotation)\r\n } else if (current3DFileType === \"model\" && modelManager) {\r\n modelManager.setScale(current3DFileId, fileScale)\r\n modelManager.setRotation(current3DFileId, new THREE.Euler(0, THREE.MathUtils.degToRad(fileRotation), 0))\r\n }\r\n }, [fileScale, fileRotation, current3DFileId, show3DScaleCard, current3DFileType, addDxf, modelManager])\r\n\r\n return {\r\n selectedFile,\r\n addedFiles,\r\n mousePosition,\r\n isPlacingFile,\r\n fileScale,\r\n fileRotation,\r\n show3DScaleCard,\r\n current3DFileType,\r\n setFileScale,\r\n setFileRotation,\r\n handleFileSelect,\r\n handleFileDrop,\r\n cancelPlacement,\r\n confirmPlacement,\r\n setCursor,\r\n raycast,\r\n }\r\n}\r\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,WAAW;AAEvB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAG/B,SAAS,wBAAwB;AAE1B,SAAS,iBACd,eACA,OACA,WACA,eACA,YACA,gBACA;AACA,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAsB,IAAI;AACxE,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAsB,CAAC,CAAC;AAClE,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;AACvE,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,KAAK;AAE9D,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,CAAC;AAClD,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,CAAC;AACxD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAsB,oBAAI,IAAI,CAAC;AACrF,QAAM,CAAC,iBA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CAAC;AAAA,EACvC,GAAG,CAAC,cAAc,YAAY,iBAAiB,mBAAmB,QAAQ,cAAc,WAAW,aAAa,CAAC;AAGjH,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,kBAAmB;AAEhE,QAAI,sBAAsB,SAAS,QAAQ;AACzC,aAAO,YAAY,iBAAiB,SAAS;AAC7C,aAAO,eAAe,iBAAiB,YAAY;AAAA,IACrD,WAAW,sBAAsB,WAAW,cAAc;AACxD,mBAAa,SAAS,iBAAiB,SAAS;AAChD,mBAAa,YAAY,iBAAiB,IAAI,MAAM,MAAM,GAAG,MAAM,UAAU,SAAS,YAAY,GAAG,CAAC,CAAC;AAAA,IACzG;AAAA,EACF,GAAG,CAAC,WAAW,cAAc,iBAAiB,iBAAiB,mBAAmB,QAAQ,YAAY,CAAC;AAEvG,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.ts"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as THREE from \"three\"\r\nimport * as OBC from \"@thatopen/components\"\r\nimport { toast } from \"sonner\"\r\nimport { ModelManager } from \"../../../ModelManager\"\r\nimport { Highlighter } from \"../../../Highlighter\"\r\nimport { Cursor } from \"../../../Cursor\"\r\nimport { AddDxf } from \"./AddDxf\"\r\nimport { addFileToScene, type PlacedKind } from \"./FileHandler\"\r\nimport { type AddedFile, removeMarker } from \"./FileMarkerUtils\"\r\nimport type { FileMarkerAction } from \"../../../../../../ui/FilesManager/src/FileMarker\"\r\nimport type { CSS2DObject } from \"three/addons/renderers/CSS2DRenderer.js\"\r\nimport type { BimToolbarToolsType } from \"../../bimToolbar\"\r\nimport { getFileExtension } from \"../../../../../../../utils/utils\"\r\n\r\nexport type GizmoMode = \"translate\" | \"rotate\" | \"scale\"\r\n\r\nexport interface PlacedFile {\r\n id: string\r\n name: string\r\n kind: PlacedKind\r\n marker: CSS2DObject | null\r\n object3D: THREE.Object3D\r\n}\r\n\r\n// Horizontal floor at world height 0; used when a double-click misses all BIM geometry.\r\nconst GROUND_PLANE = new THREE.Plane(new THREE.Vector3(0, 1, 0), 0)\r\n\r\nconst pointOnGroundPlane = (\r\n camera: THREE.Camera,\r\n canvas: HTMLCanvasElement,\r\n clientX: number,\r\n clientY: number,\r\n): THREE.Vector3 | null => {\r\n const rect = canvas.getBoundingClientRect()\r\n const ndc = new THREE.Vector2(\r\n ((clientX - rect.left) / rect.width) * 2 - 1,\r\n -((clientY - rect.top) / rect.height) * 2 + 1,\r\n )\r\n const raycaster = new THREE.Raycaster()\r\n raycaster.setFromCamera(ndc, camera)\r\n const target = new THREE.Vector3()\r\n return raycaster.ray.intersectPlane(GROUND_PLANE, target) ? target : null\r\n}\r\n\r\nexport function useFilePlacement(\r\n bimComponents: OBC.Components | null,\r\n world: OBC.World | null,\r\n fragments: OBC.FragmentsManager | null,\r\n toolsDispatch: React.Dispatch<any>,\r\n buildingId: number,\r\n uploadFileToDB?: (args: { fileData: any; buildingId: number }) => Promise<any>,\r\n onMarkerAction?: (id: string, action: FileMarkerAction) => void,\r\n) {\r\n const [selectedFile, setSelectedFile] = React.useState<File | null>(null)\r\n const [mousePosition, setMousePosition] = React.useState({ x: 0, y: 0 })\r\n const [isPlacingFile, setIsPlacingFile] = React.useState(false)\r\n\r\n const [fileScale, setFileScale] = React.useState(1)\r\n const [fileRotation, setFileRotation] = React.useState(0)\r\n const [show3DScaleCard, setShow3DScaleCard] = React.useState(false)\r\n const [current3DFileId, setCurrent3DFileId] = React.useState<string | null>(null)\r\n const [current3DFileType, setCurrent3DFileType] = React.useState<\"dxf\" | \"model\" | null>(null)\r\n\r\n const [modelManager, setModelManager] = React.useState<ModelManager | null>(null)\r\n const [addDxf, setAddDxf] = React.useState<AddDxf | null>(null)\r\n\r\n const placedFilesRef = React.useRef<Map<string, PlacedFile>>(new Map())\r\n const [markerCount, setMarkerCount] = React.useState(0)\r\n\r\n const highlighter = React.useMemo(() => {\r\n if (!bimComponents) return null\r\n try { return bimComponents.get(Highlighter) } catch { return null }\r\n }, [bimComponents])\r\n\r\n React.useEffect(() => {\r\n if (!bimComponents || !world) return\r\n if (!modelManager) {\r\n const manager = bimComponents.get(ModelManager)\r\n if (manager) setModelManager(manager)\r\n }\r\n if (!addDxf) setAddDxf(new AddDxf(bimComponents, world))\r\n }, [bimComponents, world, modelManager, addDxf])\r\n\r\n const setCursor = React.useCallback((cursor: string) => {\r\n if (!bimComponents) return\r\n const currentCursor = bimComponents.get(Cursor)\r\n if (currentCursor) currentCursor.cursor = cursor as any\r\n }, [bimComponents])\r\n\r\n const raycast = React.useCallback(async (data: {\r\n camera: THREE.PerspectiveCamera | THREE.OrthographicCamera\r\n mouse: THREE.Vector2\r\n dom: HTMLCanvasElement\r\n }) => {\r\n if (!fragments || !highlighter) return null\r\n\r\n const results = []\r\n for (const [modelName, model] of fragments.core.models.list) {\r\n if (highlighter.isModelDisabled(modelName)) continue\r\n const result = await model.raycast(data)\r\n if (result) results.push(result)\r\n }\r\n if (results.length === 0) return null\r\n\r\n let closest = results[0]\r\n for (let i = 1; i < results.length; i++) {\r\n if (results[i].distance < closest.distance) closest = results[i]\r\n }\r\n return closest\r\n }, [fragments, highlighter])\r\n\r\n const processFileObject = React.useCallback((file: File, addingMode: BimToolbarToolsType) => {\r\n const fileName = file.name.toLowerCase()\r\n\r\n if (addingMode === \"bim-add-cad\") {\r\n if (!fileName.endsWith(\".dxf\")) {\r\n toast.error(\"Please select a valid CAD file (.dxf)\")\r\n return\r\n }\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"dxf\")\r\n setFileScale(0.001)\r\n } else if (addingMode === \"bim-add-file\") {\r\n if (fileName.endsWith(\".glb\") || fileName.endsWith(\".gltf\")) {\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"model\")\r\n setFileScale(1)\r\n } else if (fileName.endsWith(\".dxf\")) {\r\n setShow3DScaleCard(true)\r\n setCurrent3DFileType(\"dxf\")\r\n setFileScale(0.001)\r\n }\r\n }\r\n\r\n setSelectedFile(file)\r\n setIsPlacingFile(true)\r\n setCursor(\"crosshair\")\r\n toast.info(`Double-click in the scene to place: \"${file.name}\"`, {\r\n id: 'place-bim-file-toast',\r\n duration: Infinity,\r\n })\r\n }, [setCursor])\r\n\r\n const handleFileSelect = React.useCallback((event: React.ChangeEvent<HTMLInputElement>, addingMode: BimToolbarToolsType) => {\r\n const file = event.target.files?.[0]\r\n if (file) processFileObject(file, addingMode)\r\n }, [processFileObject])\r\n\r\n const handleFileDrop = React.useCallback((file: File, addingMode: BimToolbarToolsType) => {\r\n processFileObject(file, addingMode)\r\n }, [processFileObject])\r\n\r\n const cancelPlacement = React.useCallback(() => {\r\n setSelectedFile(null)\r\n setIsPlacingFile(false)\r\n setShow3DScaleCard(false)\r\n setCurrent3DFileId(null)\r\n setCurrent3DFileType(null)\r\n setFileScale(1)\r\n setFileRotation(0)\r\n setCursor(\"\")\r\n toast.dismiss('place-bim-file-toast')\r\n toolsDispatch({ type: \"CLEAR-TOOLS\" })\r\n }, [setCursor, toolsDispatch])\r\n\r\n const uploadPlacedFile = React.useCallback(async (file: File, point: THREE.Vector3, rotation = 0) => {\r\n if (!uploadFileToDB || buildingId <= 0) return\r\n try {\r\n const assetId = crypto.randomUUID()\r\n const presignedResponse = await fetch(`/api/presigned-url-upload?asset=${assetId}`)\r\n if (!presignedResponse.ok) return\r\n const { presignedUrl } = await presignedResponse.json()\r\n await fetch(presignedUrl, {\r\n method: \"PUT\",\r\n body: file,\r\n headers: { \"Content-Type\": file.type },\r\n })\r\n await uploadFileToDB({\r\n fileData: {\r\n name: file.name,\r\n type: \"bim-file\",\r\n mimeType: file.type,\r\n extension: getFileExtension(file),\r\n sizeBytes: file.size,\r\n tag: \"file\",\r\n uploadedAt: new Date().toISOString(),\r\n url: \"\",\r\n assetId,\r\n description: \"\",\r\n attachedFilesBuildingId: buildingId,\r\n isVisible: true,\r\n x: point.x,\r\n y: point.y,\r\n z: point.z,\r\n rotation,\r\n },\r\n buildingId,\r\n })\r\n } catch (err) {\r\n console.error(\"Error uploading placed file:\", err)\r\n }\r\n }, [uploadFileToDB, buildingId])\r\n\r\n React.useEffect(() => {\r\n if (!selectedFile || !bimComponents || !world || !isPlacingFile) return\r\n\r\n const mouse = new THREE.Vector2()\r\n const canvas = world.renderer!.three.domElement!\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePosition({ x: e.clientX, y: e.clientY })\r\n mouse.x = e.clientX\r\n mouse.y = e.clientY\r\n }\r\n\r\n const handleDblClick = async (e: MouseEvent) => {\r\n mouse.x = e.clientX\r\n mouse.y = e.clientY\r\n\r\n const modelHit = await raycast({ camera: world.camera.three, mouse, dom: canvas })\r\n const point = modelHit?.point\r\n ? modelHit.point.clone()\r\n : pointOnGroundPlane(world.camera.three, canvas, e.clientX, e.clientY)\r\n if (!point) return\r\n\r\n const addedFile: AddedFile = {\r\n id: Date.now().toString(),\r\n file: selectedFile,\r\n position: point,\r\n imageUrl: selectedFile.type.startsWith(\"image/\")\r\n ? URL.createObjectURL(selectedFile)\r\n : undefined,\r\n }\r\n\r\n const placed = await addFileToScene(\r\n addedFile, fileScale, fileRotation,\r\n world, modelManager, addDxf, setCurrent3DFileId,\r\n (action) => onMarkerAction?.(addedFile.id, action),\r\n )\r\n\r\n if (placed) {\r\n placedFilesRef.current.set(addedFile.id, {\r\n id: addedFile.id,\r\n name: selectedFile.name,\r\n kind: placed.kind,\r\n marker: placed.marker,\r\n object3D: placed.object3D,\r\n })\r\n setMarkerCount(c => c + 1)\r\n }\r\n\r\n const fileName = selectedFile.name.toLowerCase()\r\n const is3DFile = fileName.endsWith(\".dxf\") || fileName.endsWith(\".glb\") || fileName.endsWith(\".gltf\")\r\n if (is3DFile) {\r\n // Persist on confirm instead, so the final position/rotation is saved.\r\n setIsPlacingFile(false)\r\n setCursor(\"\")\r\n } else {\r\n void uploadPlacedFile(selectedFile, point)\r\n cancelPlacement()\r\n }\r\n }\r\n\r\n document.addEventListener(\"mousemove\", handleMouseMove)\r\n document.addEventListener(\"dblclick\", handleDblClick)\r\n return () => {\r\n document.removeEventListener(\"mousemove\", handleMouseMove)\r\n document.removeEventListener(\"dblclick\", handleDblClick)\r\n }\r\n }, [selectedFile, bimComponents, world, isPlacingFile, fileScale, fileRotation, modelManager, addDxf, toolsDispatch, raycast, cancelPlacement, setCursor, uploadPlacedFile, onMarkerAction])\r\n\r\n const confirmPlacement = React.useCallback(() => {\r\n if (!current3DFileId) return\r\n\r\n // Capture the final transform from the placed object, then persist it.\r\n let finalPos: THREE.Vector3 | undefined\r\n let finalRot = fileRotation\r\n if (current3DFileType === \"dxf\" && addDxf) {\r\n const info = addDxf.getDxf(current3DFileId)\r\n if (info) {\r\n finalPos = info.group.position.clone()\r\n finalRot = THREE.MathUtils.radToDeg(info.group.rotation.y)\r\n }\r\n addDxf.confirmPlacement(current3DFileId)\r\n } else if (current3DFileType === \"model\" && modelManager) {\r\n const info = modelManager.getModel(current3DFileId)\r\n if (info) {\r\n finalPos = info.model.position.clone()\r\n finalRot = THREE.MathUtils.radToDeg(info.model.rotation.y)\r\n }\r\n modelManager.toggleGizmo(current3DFileId, false)\r\n }\r\n if (selectedFile && finalPos) void uploadPlacedFile(selectedFile, finalPos, finalRot)\r\n\r\n setShow3DScaleCard(false)\r\n setCurrent3DFileId(null)\r\n setCurrent3DFileType(null)\r\n setFileRotation(0)\r\n setFileScale(1)\r\n setSelectedFile(null)\r\n setIsPlacingFile(false)\r\n setCursor(\"\")\r\n toast.dismiss('place-bim-file-toast')\r\n toolsDispatch({ type: \"CLEAR-TOOLS\" })\r\n }, [current3DFileId, current3DFileType, addDxf, modelManager, selectedFile, fileRotation, uploadPlacedFile, setCursor, toolsDispatch])\r\n\r\n // Real-time scale/rotation updates while the placement card is open.\r\n React.useEffect(() => {\r\n if (!current3DFileId || !show3DScaleCard || !current3DFileType) return\r\n if (current3DFileType === \"dxf\" && addDxf) {\r\n addDxf.updateScale(current3DFileId, fileScale)\r\n addDxf.updateRotation(current3DFileId, fileRotation)\r\n } else if (current3DFileType === \"model\" && modelManager) {\r\n modelManager.setScale(current3DFileId, fileScale)\r\n modelManager.setRotation(current3DFileId, new THREE.Euler(0, THREE.MathUtils.degToRad(fileRotation), 0))\r\n }\r\n }, [fileScale, fileRotation, current3DFileId, show3DScaleCard, current3DFileType, addDxf, modelManager])\r\n\r\n // Markers follow their object every frame and hide while that object's gizmo is active.\r\n React.useEffect(() => {\r\n if (!world || markerCount === 0) return\r\n let raf = 0\r\n const worldPos = new THREE.Vector3()\r\n const tick = () => {\r\n placedFilesRef.current.forEach((placed) => {\r\n if (!placed.marker) return\r\n placed.object3D.getWorldPosition(worldPos)\r\n placed.marker.position.set(worldPos.x, worldPos.y + 0.2, worldPos.z)\r\n const editing = placed.kind === \"dxf\"\r\n ? !!addDxf?.getDxf(placed.id)?.gizmoController\r\n : placed.kind === \"model\"\r\n ? !!modelManager?.getModel(placed.id)?.gizmoController\r\n : false\r\n placed.marker.visible = !editing\r\n })\r\n raf = requestAnimationFrame(tick)\r\n }\r\n raf = requestAnimationFrame(tick)\r\n return () => cancelAnimationFrame(raf)\r\n }, [world, addDxf, modelManager, markerCount])\r\n\r\n const getPlacedFile = React.useCallback((id: string): PlacedFile | undefined => {\r\n return placedFilesRef.current.get(id)\r\n }, [])\r\n\r\n const editPlacedFile = React.useCallback((id: string, mode: GizmoMode = \"translate\") => {\r\n const placed = placedFilesRef.current.get(id)\r\n if (!placed) return\r\n if (placed.kind === \"dxf\" && addDxf) {\r\n addDxf.toggleGizmo(id, true)\r\n addDxf.setGizmoMode(id, mode)\r\n } else if (placed.kind === \"model\" && modelManager) {\r\n modelManager.toggleGizmo(id, true)\r\n modelManager.getModel(id)?.gizmoController?.setMode(mode)\r\n }\r\n }, [addDxf, modelManager])\r\n\r\n const removePlacedFile = React.useCallback((id: string) => {\r\n const placed = placedFilesRef.current.get(id)\r\n if (!placed) return\r\n if (placed.kind === \"dxf\") addDxf?.removeDxf(id)\r\n else if (placed.kind === \"model\") modelManager?.remove(id)\r\n else if (world) world.scene.three.remove(placed.object3D)\r\n removeMarker(placed.marker, world)\r\n placedFilesRef.current.delete(id)\r\n setMarkerCount(c => Math.max(0, c - 1))\r\n }, [addDxf, modelManager, world])\r\n\r\n return {\r\n selectedFile,\r\n mousePosition,\r\n isPlacingFile,\r\n fileScale,\r\n fileRotation,\r\n show3DScaleCard,\r\n current3DFileType,\r\n setFileScale,\r\n setFileRotation,\r\n handleFileSelect,\r\n handleFileDrop,\r\n cancelPlacement,\r\n confirmPlacement,\r\n setCursor,\r\n raycast,\r\n getPlacedFile,\r\n editPlacedFile,\r\n removePlacedFile,\r\n }\r\n}\r\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,WAAW;AAEvB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,sBAAuC;AAChD,SAAyB,oBAAoB;AAI7C,SAAS,wBAAwB;AAajC,MAAM,eAAe,IAAI,MAAM,MAAM,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC;AAElE,MAAM,qBAAqB,CACzB,QACA,QACA,SACA,YACyB;AACzB,QAAM,OAAO,OAAO,sBAAsB;AAC1C,QAAM,MAAM,IAAI,MAAM;AAAA,KAClB,UAAU,KAAK,QAAQ,KAAK,QAAS,IAAI;AAAA,IAC3C,GAAG,UAAU,KAAK,OAAO,KAAK,UAAU,IAAI;AAAA,EAC9C;AACA,QAAM,YAAY,IAAI,MAAM,UAAU;AACtC,YAAU,cAAc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BAAa,SAAS,EAAE,MAAxB,mBAA2B,oBAA3B,mBAA4C,QAAQ;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,QAAQ,YAAY,CAAC;AAEzB,QAAM,mBAAmB,MAAM,YAAY,CAAC,OAAe;AACzD,UAAM,SAAS,eAAe,QAAQ,IAAI,EAAE;AAC5C,QAAI,CAAC,OAAQ;AACb,QAAI,OAAO,SAAS,MAAO,kCAAQ,UAAU;AAAA,aACpC,OAAO,SAAS,QAAS,8CAAc,OAAO;AAAA,aAC9C,MAAO,OAAM,MAAM,MAAM,OAAO,OAAO,QAAQ;AACxD,iBAAa,OAAO,QAAQ,KAAK;AACjC,mBAAe,QAAQ,OAAO,EAAE;AAChC,mBAAe,OAAK,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,EACxC,GAAG,CAAC,QAAQ,cAAc,KAAK,CAAC;AAEhC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/components/viewers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/components/viewers/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/components/viewers/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/components/viewers/index.ts"],"sourcesContent":["export * from './Viewer'\r\nexport * from './map/MapViewer'\r\nexport { fetchArcGISDatasets } from './map/datasets/src/arcGISDatasets'\r\nexport { fetchCkanDatasets } from './map/datasets/src/ckanDatasets'\r\nexport { fetchOpenDataSoftDatasets } from './map/datasets/src/opendatasoftDatasets'\r\nexport { fetchSocrataDatasets } from './map/datasets/src/socrataDatasets'\r\nexport { fetchLocalDatasets } from './map/datasets/src/localDatasets'"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapViewer.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/viewers/map/MapViewer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"MapViewer.d.ts","sourceRoot":"","sources":["../../../../../src/core/components/viewers/map/MapViewer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAerD,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAc,EAAE,MAAe,EAAE,YAAY,EAAE,EAAE,KAAK,qBAsLjF"}
|