@collabdt/core 0.10.0 → 0.10.1
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/ui/Comments/Comment.d.ts +3 -1
- package/dist/core/components/ui/Comments/Comment.d.ts.map +1 -1
- package/dist/core/components/ui/Comments/Comment.js +3 -1
- package/dist/core/components/ui/Comments/Comment.js.map +1 -1
- package/dist/core/components/ui/Sensors/Sensor.d.ts +3 -1
- package/dist/core/components/ui/Sensors/Sensor.d.ts.map +1 -1
- package/dist/core/components/ui/Sensors/Sensor.js +3 -1
- package/dist/core/components/ui/Sensors/Sensor.js.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.js +31 -3
- package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js +1 -1
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/index.d.ts +2 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/index.js +4 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.d.ts +2 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.js +3 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.d.ts +2 -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 +116 -112
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.d.ts +2 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.js +52 -48
- package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.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 +3 -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 +2 -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/BuildingLayers/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js +92 -76
- package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js +104 -109
- package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/CountryLayer/index.d.ts +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 +13 -19
- 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/utils/CustomModelLayer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/utils/CustomModelLayer.js +2 -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/MapPopupStack.d.ts +3 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/MapPopupStack.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/MapPopupStack.js +88 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/MapPopupStack.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 +79 -99
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/PlaceOnMap.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js +125 -121
- package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteLayer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteLayer.js +67 -35
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteLayer.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/{SiteContextMenu.d.ts → SiteMenu.d.ts} +4 -5
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteMenu.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/{SiteContextMenu.js → SiteMenu.js} +8 -9
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteMenu.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/clusterPopupEntry.d.ts +23 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/clusterPopupEntry.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/clusterPopupEntry.js +88 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/clusterPopupEntry.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/BuildingVisibility.d.ts +3 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/BuildingVisibility.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/BuildingVisibility.js +28 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/BuildingVisibility.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapCustomization.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapCustomization.js +3 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/SettingsTab/src/MapCustomization.js.map +1 -1
- package/dist/core/components/viewers/map/src/SimpleMap.js +1 -1
- package/dist/core/components/viewers/map/src/SimpleMap.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/FileAdder.js +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/FileAdder.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddSite/SiteAdder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddSite/SiteAdder.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/measureMapTool.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/measureMapTool.js +1 -1
- package/dist/core/components/viewers/map/src/tools/measureMapTool.js.map +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.d.ts +12 -5
- package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.js +46 -12
- package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.js.map +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapHoverManager.d.ts +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapHoverManager.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapHoverManager.js +1 -1
- package/dist/core/components/viewers/map/utils/MapEventManager/MapHoverManager.js.map +1 -1
- package/dist/core/components/viewers/map/utils/getOsmIdFromMartin.d.ts +1 -1
- package/dist/core/components/viewers/map/utils/getOsmIdFromMartin.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/getOsmIdFromMartin.js.map +1 -1
- package/dist/core/components/viewers/map/utils/mapStyleSpec.d.ts +4 -0
- package/dist/core/components/viewers/map/utils/mapStyleSpec.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/mapStyleSpec.js +3 -1
- package/dist/core/components/viewers/map/utils/mapStyleSpec.js.map +1 -1
- package/dist/core/components/viewers/map/utils/modelMatrix.d.ts +8 -0
- package/dist/core/components/viewers/map/utils/modelMatrix.d.ts.map +1 -0
- package/dist/core/components/viewers/map/utils/modelMatrix.js +13 -0
- package/dist/core/components/viewers/map/utils/modelMatrix.js.map +1 -0
- package/dist/core/components/viewers/map/utils/validateBounds.d.ts +5 -10
- package/dist/core/components/viewers/map/utils/validateBounds.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/validateBounds.js +5 -6
- package/dist/core/components/viewers/map/utils/validateBounds.js.map +1 -1
- package/dist/core/i18n/messages/en.json +15 -4
- package/dist/core/i18n/messages/es.json +15 -4
- package/dist/core/i18n/messages/fr.json +15 -4
- package/dist/core/store/Map/context.d.ts.map +1 -1
- package/dist/core/store/Map/context.js +3 -1
- package/dist/core/store/Map/context.js.map +1 -1
- package/dist/core/store/Map/reducer.d.ts +10 -1
- package/dist/core/store/Map/reducer.d.ts.map +1 -1
- package/dist/core/store/Map/reducer.js +20 -0
- package/dist/core/store/Map/reducer.js.map +1 -1
- package/dist/core/types/map.d.ts +17 -1
- package/dist/core/types/map.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteContextMenu.d.ts.map +0 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/SiteContextMenu.js.map +0 -1
package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Dependencies\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\n// Shadcn Components\nimport { DatasetsContext } from '../../../../../../store/Datasets/context'\nimport { Button } from '../../../../../ui/Button'\nimport ColorCircle from '../../../../../ui/ColorCircle'\nimport { PopoverContent } from '../../../../../ui/Popover'\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '../../../../../ui/Table'\n\n// Icons\n\n// Types / Utilities\nimport { stringToColour } from '../../../utils/stringToColour'\n\nimport type { MapGeoJSONFeature } from 'maplibre-gl'\n\ninterface OpenDataFeaturePopoverProps {\n feature: MapGeoJSONFeature\n isOpen: boolean\n onCloseAction: () => void\n}\n\nexport default function OpenDataFeaturePopover({\n feature,\n isOpen,\n onCloseAction,\n}: OpenDataFeaturePopoverProps) {\n // Translation\n const t = useTranslations('OpenDataFeaturePopover')\n\n const {state: datasetsState} = React.useContext(DatasetsContext)\n const {addedDatasets} = datasetsState.datasets\n\n const featureProps = feature?.properties || {}\n // Filter out properties that are null, undefined, empty strings, or coordinate-related\n const validProperties = Object.entries(featureProps)\n .filter(([key, value]) => {\n // Check for null, undefined, or empty string values\n const lowValue = String(value).toLowerCase()\n if (\n value === null\n || value === undefined\n || value === ''\n || lowValue === 'null'\n || lowValue === 'undefined'\n || lowValue === 'none'\n ) {\n return false\n }\n\n // Filter out coordinate-related properties\n const lowerKey = key.toLowerCase()\n const excludingKeys = [\n 'globalid',\n 'latitude',\n 'lat',\n 'longitude',\n 'lng',\n 'lon',\n 'coordinates',\n 'coordina',\n 'x',\n 'y',\n 'z',\n 'geometry',\n 'cluster',\n 'cluster_id',\n 'point_count_abbreviated',\n 'datasetName',\n 'datasetColor',\n ]\n return !excludingKeys.includes(lowerKey)\n })\n .sort(([keyA], [keyB]) => {\n const aHasName = keyA.toLowerCase().includes('name')\n const bHasName = keyB.toLowerCase().includes('name')\n if (aHasName && !bHasName) return -1\n if (!aHasName && bHasName) return 1\n return 0\n })\n\n // Function to format property names (convert snake_case to readable format)\n const formatPropertyName = (key: string): string => {\n return key\n .replaceAll('_', ' ')\n .replaceAll(/\\b\\w/g, l => l.toUpperCase())\n }\n\n // Function to format property values\n const formatPropertyValue = (value: any, key?: string): string => {\n if (typeof value === 'boolean') {\n return value ? 'Yes' : 'No'\n }\n if (typeof value === 'number') {\n // Don't add commas for year-like fields\n if (key && key.toLowerCase().includes('year')) {\n return value.toString()\n }\n return value.toLocaleString()\n }\n if (typeof value === 'string') {\n // Handle URLs\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return value\n }\n return value\n }\n return String(value)\n }\n\n // Function to check if value is a URL\n const isUrl = (value: string): boolean => {\n return value.startsWith('http://') || value.startsWith('https://')\n }\n\n const datasetName = (featureProps.datasetName ? featureProps.datasetName.replaceAll('_', ' ') : t('unknownDataset'))\n const dataset = addedDatasets.find(d => d.name === featureProps.datasetName)\n const datasetColor = dataset ? dataset.layerColor.color : stringToColour(datasetName)\n\n return (\n <PopoverContent className=\"w-80 -m-1\" side=\"top\">\n <div className=\"grid gap-4\">\n <Button\n onClick={onCloseAction}\n variant=\"ghost\"\n className=\"absolute top-1 right-2 p-1 text-muted-foreground hover:text-foreground\"\n aria-label=\"Close\"\n >\n <LR.X className=\"w-4 h-4\" />\n </Button>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <LR.Database className=\"w-4 h-4\" />\n <h4 className=\"font-medium leading-none\">{t('propertiesHeader')}</h4>\n </div>\n {/* Circle with the dataset color */}\n <div className=\"flex items-center gap-2 pl-[2px]\">\n <ColorCircle color={datasetColor} size={14} />\n <p className=\"text-xs text-muted-foreground\">\n {datasetName}\n </p>\n </div>\n </div>\n\n {validProperties.length > 0\n ? (\n <div className=\"max-h-64 overflow-auto\">\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-1/3 text-xs\">{t('propertyTableHead')}</TableHead>\n <TableHead className=\"text-xs\">{t('valueTableHead')}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {validProperties.map(([key, value]) => (\n <TableRow key={key}>\n <TableCell className=\"font-medium text-xs py-2\">\n {formatPropertyName(key)}\n </TableCell>\n <TableCell className=\"text-xs py-2\">\n {isUrl(String(value))\n ? (\n <a\n href={String(value)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-blue-600 hover:text-blue-800 underline break-all\"\n >\n {formatPropertyValue(value, key)}\n </a>\n )\n : (\n <span className=\"break-words\">\n {formatPropertyValue(value, key)}\n </span>\n )}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n )\n : (\n <div className=\"text-center py-4\">\n <LR.FileX className=\"w-8 h-8 text-muted-foreground mx-auto mb-2\" />\n <p className=\"text-sm text-muted-foreground\">\n {t('noPropertyAvail')}\n </p>\n </div>\n )}\n\n {validProperties.length > 10 && (\n <div className=\"text-xs text-muted-foreground text-center\">\n {t('showing')}\n {' '}\n {validProperties.length}\n {' '}\n {t('properties')}\n </div>\n )}\n </div>\n </PopoverContent>\n )\n}\n"],"mappings":";AA+IU,cAGA,YAHA;AAzIV,YAAY,QAAQ;AACpB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sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Dependencies\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\n// Shadcn Components\nimport { DatasetsContext } from '../../../../../../store/Datasets/context'\nimport { Button } from '../../../../../ui/Button'\nimport ColorCircle from '../../../../../ui/ColorCircle'\nimport { PopoverContent } from '../../../../../ui/Popover'\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '../../../../../ui/Table'\n\n// Icons\n\n// Types / Utilities\nimport { stringToColour } from '../../../utils/stringToColour'\n\nimport type { MapGeoJSONFeature } from 'maplibre-gl'\n\ninterface OpenDataFeaturePopoverProps {\n feature: MapGeoJSONFeature\n isOpen: boolean\n onCloseAction: () => void\n header?: React.ReactNode\n}\n\nexport default function OpenDataFeaturePopover({\n header,\n feature,\n isOpen,\n onCloseAction,\n}: OpenDataFeaturePopoverProps) {\n // Translation\n const t = useTranslations('OpenDataFeaturePopover')\n\n const {state: datasetsState} = React.useContext(DatasetsContext)\n const {addedDatasets} = datasetsState.datasets\n\n const featureProps = feature?.properties || {}\n // Filter out properties that are null, undefined, empty strings, or coordinate-related\n const validProperties = Object.entries(featureProps)\n .filter(([key, value]) => {\n // Check for null, undefined, or empty string values\n const lowValue = String(value).toLowerCase()\n if (\n value === null\n || value === undefined\n || value === ''\n || lowValue === 'null'\n || lowValue === 'undefined'\n || lowValue === 'none'\n ) {\n return false\n }\n\n // Filter out coordinate-related properties\n const lowerKey = key.toLowerCase()\n const excludingKeys = [\n 'globalid',\n 'latitude',\n 'lat',\n 'longitude',\n 'lng',\n 'lon',\n 'coordinates',\n 'coordina',\n 'x',\n 'y',\n 'z',\n 'geometry',\n 'cluster',\n 'cluster_id',\n 'point_count_abbreviated',\n 'datasetName',\n 'datasetColor',\n ]\n return !excludingKeys.includes(lowerKey)\n })\n .sort(([keyA], [keyB]) => {\n const aHasName = keyA.toLowerCase().includes('name')\n const bHasName = keyB.toLowerCase().includes('name')\n if (aHasName && !bHasName) return -1\n if (!aHasName && bHasName) return 1\n return 0\n })\n\n // Function to format property names (convert snake_case to readable format)\n const formatPropertyName = (key: string): string => {\n return key\n .replaceAll('_', ' ')\n .replaceAll(/\\b\\w/g, l => l.toUpperCase())\n }\n\n // Function to format property values\n const formatPropertyValue = (value: any, key?: string): string => {\n if (typeof value === 'boolean') {\n return value ? 'Yes' : 'No'\n }\n if (typeof value === 'number') {\n // Don't add commas for year-like fields\n if (key && key.toLowerCase().includes('year')) {\n return value.toString()\n }\n return value.toLocaleString()\n }\n if (typeof value === 'string') {\n // Handle URLs\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return value\n }\n return value\n }\n return String(value)\n }\n\n // Function to check if value is a URL\n const isUrl = (value: string): boolean => {\n return value.startsWith('http://') || value.startsWith('https://')\n }\n\n const datasetName = (featureProps.datasetName ? featureProps.datasetName.replaceAll('_', ' ') : t('unknownDataset'))\n const dataset = addedDatasets.find(d => d.name === featureProps.datasetName)\n const datasetColor = dataset ? dataset.layerColor.color : stringToColour(datasetName)\n\n return (\n <PopoverContent className=\"w-80 -m-1\" side=\"top\">\n {header}\n <div className=\"grid gap-4\">\n <Button\n onClick={onCloseAction}\n variant=\"ghost\"\n className={`absolute top-1 right-2 p-1 text-muted-foreground hover:text-foreground${header ? ' hidden' : ''}`}\n aria-label=\"Close\"\n >\n <LR.X className=\"w-4 h-4\" />\n </Button>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <LR.Database className=\"w-4 h-4\" />\n <h4 className=\"font-medium leading-none\">{t('propertiesHeader')}</h4>\n </div>\n {/* Circle with the dataset color */}\n <div className=\"flex items-center gap-2 pl-[2px]\">\n <ColorCircle color={datasetColor} size={14} />\n <p className=\"text-xs text-muted-foreground\">\n {datasetName}\n </p>\n </div>\n </div>\n\n {validProperties.length > 0\n ? (\n <div className=\"max-h-64 overflow-auto\">\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-1/3 text-xs\">{t('propertyTableHead')}</TableHead>\n <TableHead className=\"text-xs\">{t('valueTableHead')}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {validProperties.map(([key, value]) => (\n <TableRow key={key}>\n <TableCell className=\"font-medium text-xs py-2\">\n {formatPropertyName(key)}\n </TableCell>\n <TableCell className=\"text-xs py-2\">\n {isUrl(String(value))\n ? (\n <a\n href={String(value)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-blue-600 hover:text-blue-800 underline break-all\"\n >\n {formatPropertyValue(value, key)}\n </a>\n )\n : (\n <span className=\"break-words\">\n {formatPropertyValue(value, key)}\n </span>\n )}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n )\n : (\n <div className=\"text-center py-4\">\n <LR.FileX className=\"w-8 h-8 text-muted-foreground mx-auto mb-2\" />\n <p className=\"text-sm text-muted-foreground\">\n {t('noPropertyAvail')}\n </p>\n </div>\n )}\n\n {validProperties.length > 10 && (\n <div className=\"text-xs text-muted-foreground text-center\">\n {t('showing')}\n {' '}\n {validProperties.length}\n {' '}\n {t('properties')}\n </div>\n )}\n </div>\n </PopoverContent>\n )\n}\n"],"mappings":";AAkJU,cAGA,YAHA;AA5IV,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,OAAO,iBAAiB;AACxB,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,sBAAsB;AAWhB,SAAR,uBAAwC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,IAAI,gBAAgB,wBAAwB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ACC,+BAAC,YACC;AAAA,8BAAC,aAAU,WAAU,iBAAiB,YAAE,mBAAmB,GAAE;AAAA,UAC7D,oBAAC,aAAU,WAAU,WAAW,YAAE,gBAAgB,GAAE;AAAA,WACtD,GACF;AAAA,QACA,oBAAC,aACE,0BAAgB,IAAI,CAAC,CAAC,KAAK,KAAK,MAC/B,qBAAC,YACC;AAAA,8BAAC,aAAU,WAAU,4BAClB,6BAAmB,GAAG,GACzB;AAAA,UACA,oBAAC,aAAU,WAAU,gBAClB,gBAAM,OAAO,KAAK,CAAC,IAEd;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,OAAO,KAAK;AAAA,cAClB,QAAO;AAAA,cACP,KAAI;AAAA,cACJ,WAAU;AAAA,cAET,8BAAoB,OAAO,GAAG;AAAA;AAAA,UACjC,IAGA,oBAAC,UAAK,WAAU,eACb,8BAAoB,OAAO,GAAG,GACjC,GAER;AAAA,aArBa,GAsBf,CACD,GACH;AAAA,SACF,GACF,IAGA,qBAAC,SAAI,WAAU,oBACb;AAAA,4BAAC,GAAG,OAAH,EAAS,WAAU,8CAA6C;AAAA,QACjE,oBAAC,OAAE,WAAU,iCACV,YAAE,iBAAiB,GACtB;AAAA,SACF;AAAA,MAGL,gBAAgB,SAAS,MACxB,qBAAC,SAAI,WAAU,6CACZ;AAAA,UAAE,SAAS;AAAA,QACX;AAAA,QACA,gBAAgB;AAAA,QAChB;AAAA,QACA,EAAE,YAAY;AAAA,SACjB;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/map/src/MapLayers/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/map/src/MapLayers/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAahE,eAAO,MAAM,SAAS,GAAI,+BAA+B;IAAE,YAAY,CAAC,EAAE,YAAY,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,sBAc7G,CAAA"}
|
|
@@ -8,6 +8,7 @@ import { BuildingLayer } from "./src/BuildingLayers";
|
|
|
8
8
|
import { CommentLayer } from "./src/CommentLayer";
|
|
9
9
|
import { CountryLayer } from "./src/CountryLayer";
|
|
10
10
|
import { FileLayers } from "./src/FileLayer";
|
|
11
|
+
import { MapPopupStack } from "./src/MapPopupStack";
|
|
11
12
|
import { OpenDataLayers } from "./src/OpenDataLayer/src";
|
|
12
13
|
import { SensorLayers } from "./src/SensorsLayer";
|
|
13
14
|
import { SiteLayer } from "./src/SiteLayer/SiteLayer";
|
|
@@ -29,7 +30,8 @@ const MapLayers = ({ organization, maptilerKey }) => {
|
|
|
29
30
|
/* @__PURE__ */ jsx(CommentLayer, {}),
|
|
30
31
|
/* @__PURE__ */ jsx(SensorLayers, {}),
|
|
31
32
|
/* @__PURE__ */ jsx(FileLayers, {}),
|
|
32
|
-
/* @__PURE__ */ jsx(BimLayerGate, {})
|
|
33
|
+
/* @__PURE__ */ jsx(BimLayerGate, {}),
|
|
34
|
+
/* @__PURE__ */ jsx(MapPopupStack, {})
|
|
33
35
|
] });
|
|
34
36
|
};
|
|
35
37
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/core/components/viewers/map/src/MapLayers/index.tsx"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n'use client'\n\nimport dynamic from 'next/dynamic'\nimport * as React from 'react'\n\nimport { useBimContext } from '../../../../../store'\n\nimport { BuildingLayer } from './src/BuildingLayers'\nimport { CommentLayer } from './src/CommentLayer'\nimport { CountryLayer } from './src/CountryLayer'\nimport { FileLayers } from './src/FileLayer'\nimport { OpenDataLayers } from './src/OpenDataLayer/src'\nimport { SensorLayers } from './src/SensorsLayer'\nimport { SiteLayer } from './src/SiteLayer/SiteLayer'\n\n\nimport type { Organization } from '../../../../../types/dbTypes'\n\nconst LazyBimLayer = dynamic(\n () => import('./src/BimLayer').then(m => ({ default: m.BimLayer })),\n { ssr: false },\n)\n\nfunction BimLayerGate() {\n const { state: bimState } = useBimContext()\n if (bimState.bim.bimModelsAddedToMap.length === 0) return null\n return <LazyBimLayer />\n}\n\nexport const MapLayers = ({ organization, maptilerKey }: { organization?: Organization; maptilerKey?: string }) => {\n return (\n <>\n <SiteLayer />\n <CountryLayer organization={organization} maptilerKey={maptilerKey} />\n <OpenDataLayers />\n <BuildingLayer maptilerKey={maptilerKey} />\n <CommentLayer />\n <SensorLayers />\n <FileLayers />\n <BimLayerGate />\n </>\n )\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/core/components/viewers/map/src/MapLayers/index.tsx"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n'use client'\n\nimport dynamic from 'next/dynamic'\nimport * as React from 'react'\n\nimport { useBimContext } from '../../../../../store'\n\nimport { BuildingLayer } from './src/BuildingLayers'\nimport { CommentLayer } from './src/CommentLayer'\nimport { CountryLayer } from './src/CountryLayer'\nimport { FileLayers } from './src/FileLayer'\nimport { MapPopupStack } from './src/MapPopupStack'\nimport { OpenDataLayers } from './src/OpenDataLayer/src'\nimport { SensorLayers } from './src/SensorsLayer'\nimport { SiteLayer } from './src/SiteLayer/SiteLayer'\n\n\nimport type { Organization } from '../../../../../types/dbTypes'\n\nconst LazyBimLayer = dynamic(\n () => import('./src/BimLayer').then(m => ({ default: m.BimLayer })),\n { ssr: false },\n)\n\nfunction BimLayerGate() {\n const { state: bimState } = useBimContext()\n if (bimState.bim.bimModelsAddedToMap.length === 0) return null\n return <LazyBimLayer />\n}\n\nexport const MapLayers = ({ organization, maptilerKey }: { organization?: Organization; maptilerKey?: string }) => {\n return (\n <>\n <SiteLayer />\n <CountryLayer organization={organization} maptilerKey={maptilerKey} />\n <OpenDataLayers />\n <BuildingLayer maptilerKey={maptilerKey} />\n <CommentLayer />\n <SensorLayers />\n <FileLayers />\n <BimLayerGate />\n <MapPopupStack />\n </>\n )\n}\n"],"mappings":";AA8BS,SAKL,UALK,KAKL,YALK;AAzBT,OAAO,aAAa;AAGpB,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAK1B,MAAM,eAAe;AAAA,EACnB,MAAM,OAAO,gBAAgB,EAAE,KAAK,QAAM,EAAE,SAAS,EAAE,SAAS,EAAE;AAAA,EAClE,EAAE,KAAK,MAAM;AACf;AAEA,SAAS,eAAe;AACtB,QAAM,EAAE,OAAO,SAAS,IAAI,cAAc;AAC1C,MAAI,SAAS,IAAI,oBAAoB,WAAW,EAAG,QAAO;AAC1D,SAAO,oBAAC,gBAAa;AACvB;AAEO,MAAM,YAAY,CAAC,EAAE,cAAc,YAAY,MAA6D;AACjH,SACE,iCACE;AAAA,wBAAC,aAAU;AAAA,IACX,oBAAC,gBAAa,cAA4B,aAA0B;AAAA,IACpE,oBAAC,kBAAe;AAAA,IAChB,oBAAC,iBAAc,aAA0B;AAAA,IACzC,oBAAC,gBAAa;AAAA,IACd,oBAAC,gBAAa;AAAA,IACd,oBAAC,cAAW;AAAA,IACZ,oBAAC,gBAAa;AAAA,IACd,oBAAC,iBAAc;AAAA,KACjB;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BimLayer/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BimLayer/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,eAAO,MAAM,QAAQ,yBAudpB,CAAC"}
|
|
@@ -29,6 +29,7 @@ import * as THREE from "three";
|
|
|
29
29
|
import { BimContext, MapContext } from "../../../../../../../store";
|
|
30
30
|
import { markerOcclusionProps } from "../../../../../../../utils/markerUtils";
|
|
31
31
|
import { ViewerContextMenu } from "../../../../../../ui/FilesManager";
|
|
32
|
+
import { writeModelMatrix } from "../../../../utils/modelMatrix";
|
|
32
33
|
import { disposeThreeScene } from "../disposeThreeScene";
|
|
33
34
|
import { EditPosition, extractPositionAndRotation } from "../EditPosition";
|
|
34
35
|
const BimLayer = () => {
|
|
@@ -243,10 +244,9 @@ const BimLayer = () => {
|
|
|
243
244
|
const terrainElev = editingBimModelRef.current === bimFile.name ? (_a = map.queryTerrainElevation([modelLongitude, modelLatitude])) != null ? _a : cachedTerrainElev : cachedTerrainElev;
|
|
244
245
|
const modelAltitude = modelElevation + terrainElev;
|
|
245
246
|
const scaling = 1;
|
|
246
|
-
const modelMatrix = map.transform.getMatrixForModel(modelOrigin, modelAltitude);
|
|
247
247
|
_scaleVec.set(scaling, scaling, scaling);
|
|
248
248
|
_vp.fromArray(args.defaultProjectionData.mainMatrix);
|
|
249
|
-
_m
|
|
249
|
+
writeModelMatrix(_m, modelOrigin, modelAltitude).scale(_scaleVec);
|
|
250
250
|
renderCamera.projectionMatrix.multiplyMatrices(_vp, _m);
|
|
251
251
|
_p.fromArray(args.projectionMatrix).invert();
|
|
252
252
|
_vm.multiplyMatrices(_p, renderCamera.projectionMatrix).invert();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BimLayer/index.tsx"],"sourcesContent":["\"use client\"\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as OBC from \"@thatopen/components\";\nimport * as LR from \"lucide-react\";\nimport { type CustomLayerInterface, type LngLatLike } from \"maplibre-gl\";\nimport * as React from \"react\";\nimport { Marker } from \"react-map-gl/maplibre\";\nimport * as THREE from \"three\";\n\nimport { BimContext, MapContext } from \"../../../../../../../store\";\nimport { markerOcclusionProps } from \"../../../../../../../utils/markerUtils\";\nimport { ViewerContextMenu } from '../../../../../../ui/FilesManager';\nimport { disposeThreeScene } from \"../disposeThreeScene\";\nimport { EditPosition, extractPositionAndRotation } from \"../EditPosition\";\n\nimport type { Building, DbFile } from \"../../../../../../../types/dbTypes\";\nimport type { FileAction } from \"../../../../../../../types/global\";\nimport type * as FRAGS from \"@thatopen/fragments\";\nimport type { Map } from \"maplibre-gl\";\n\n\nexport const BimLayer = () => {\n\n const { state: mapState } = React.useContext(MapContext);\n const { map } = mapState.map;\n\n const { state: bimState, dispatch: bimDispatch } = React.useContext(BimContext);\n const { bimModelsAddedToMap, editingBimModel } = bimState.bim;\n\n const rendererRef = React.useRef<THREE.WebGLRenderer | null>(null);\n\n const addedLayersRef = React.useRef<Set<string>>(new Set());\n const prevModelsRef = React.useRef<Set<string>>(new Set());\n\n const sharedRef = React.useRef<{\n components: OBC.Components;\n fragments: OBC.FragmentsManager;\n } | null>(null);\n\n const [loadingBuildings, setLoadingBuildings] = React.useState<Set<number>>(new Set());\n const [contextMenu, setContextMenu] = React.useState<{\n x: number; y: number; bimFile: DbFile\n } | null>(null);\n\n const handleContextMenuAction = React.useCallback((action: FileAction, file: DbFile) => {\n if (action === 'view') {\n bimDispatch({ type: 'REMOVE_BIM_FROM_MAP', payload: { bimModelName: file.name } });\n } else if (action === 'move') {\n bimDispatch({ type: 'EDIT_BIM_MODEL_BY_NAME', payload: { editingBimModel: file.name } });\n }\n }, [bimDispatch]);\n\n const tempPositionsRef = React.useRef<Record<string, { lat: number; lng: number }>>({});\n const tempRotationsRef = React.useRef<Record<string, number>>({});\n const tempElevationsRef = React.useRef<Record<string, number>>({});\n\n const editingBimModelRef = React.useRef<string | null>(editingBimModel);\n React.useEffect(() => {\n editingBimModelRef.current = editingBimModel;\n }, [editingBimModel]);\n\n const handleExitEditMode = React.useCallback(() => {\n bimDispatch({ type: \"EDIT_BIM_MODEL_BY_NAME\", payload: { editingBimModel: null } });\n }, [bimDispatch]);\n\n const handleMapRepaint = React.useCallback(() => {\n if (map) map.triggerRepaint();\n }, [map]);\n const getOrCreateShared = React.useCallback(async () => {\n if (sharedRef.current) return sharedRef.current;\n\n const components = new OBC.Components();\n const worlds = components.get(OBC.Worlds);\n const world = worlds.create<OBC.SimpleScene, OBC.SimpleCamera, OBC.SimpleRenderer>();\n world.scene = new OBC.SimpleScene(components);\n world.renderer = new OBC.SimpleRenderer(components, document.createElement(\"div\"));\n world.camera = new OBC.SimpleCamera(components);\n components.init();\n world.scene.setup();\n\n const fragments = components.get(OBC.FragmentsManager);\n const fetchedUrl = await fetch(\"https://thatopen.github.io/engine_fragment/resources/worker.mjs\");\n const workerBlob = await fetchedUrl.blob();\n const workerUrl = URL.createObjectURL(\n new File([workerBlob], \"worker.mjs\", { type: \"text/javascript\" })\n );\n fragments.init(workerUrl);\n\n sharedRef.current = { components, fragments };\n return sharedRef.current;\n }, []);\n\n React.useEffect(() => {\n if (!map) return;\n\n const currentModelNames = new Set(bimModelsAddedToMap.map(bm => bm.bimFile.name));\n\n const modelsToRemove = Array.from(prevModelsRef.current).filter(\n name => !currentModelNames.has(name)\n );\n const modelsToAdd = bimModelsAddedToMap.filter(\n bm => !prevModelsRef.current.has(bm.bimFile.name)\n );\n\n modelsToRemove.forEach(layerName => {\n if (map.getLayer(layerName)) {\n map.removeLayer(layerName);\n addedLayersRef.current.delete(layerName);\n }\n });\n\n prevModelsRef.current = currentModelNames;\n\n if (modelsToAdd.length === 0) return;\n\n // ─── Load a single BIM model ──────────────────────────────────────────\n const loadModel = async (\n buildingModel: { bimFile: DbFile; building?: Building | null },\n fragments: OBC.FragmentsManager,\n scene: THREE.Scene,\n map: Map,\n lodCamera: THREE.PerspectiveCamera\n ): Promise<FRAGS.FragmentsModel | null> => {\n\n const { bimFile, building } = buildingModel;\n if (!bimFile) return null;\n\n const buildingId = building?.id ?? bimFile.id;\n setLoadingBuildings(prev => new Set(prev).add(buildingId));\n\n try {\n const file = await fetch(bimFile.url);\n if (!file.ok) throw new Error(`Fetch failed: ${file.status} ${file.statusText}`);\n\n const buffer = await file.arrayBuffer();\n const model = await fragments.core.load(buffer, { modelId: bimFile.name });\n\n if (!model.box.isEmpty()) {\n const center = model.box.getCenter(new THREE.Vector3());\n const size = model.box.getSize(new THREE.Vector3());\n model.object.position.set(-center.x, 0, -center.z);\n\n // lodCamera: above the model's new IFC-space centre (XZ is now 0,0)\n lodCamera.position.set(0, center.y + Math.max(size.x, size.y, size.z) * 2, 0);\n lodCamera.lookAt(0, center.y, 0);\n } else {\n lodCamera.position.set(0, 100, 0);\n lodCamera.lookAt(0, 0, 0);\n }\n lodCamera.updateMatrixWorld();\n model.useCamera(lodCamera);\n\n model.graphicsQuality = 1;\n scene.add(model.object);\n void fragments.core.update(true);\n map.triggerRepaint();\n\n return model;\n\n } catch (error) {\n console.error(\"Error loading BIM model:\", error);\n return null;\n } finally {\n setLoadingBuildings(prev => {\n const next = new Set(prev);\n next.delete(buildingId);\n return next;\n });\n }\n };\n\n // ─── Build a MapLibre custom layer for one model ──────────────────────\n const createCustomLayer = (\n buildingModel: { bimFile: DbFile; building?: Building | null },\n fragments: OBC.FragmentsManager,\n scene: THREE.Scene\n ): CustomLayerInterface | undefined => {\n\n const { bimFile, building } = buildingModel;\n const {\n lng: baseLng, lat: baseLat,\n rotation: originalRotation,\n } = extractPositionAndRotation(bimFile, building);\n if (baseLng === null || baseLat === null) return undefined;\n\n // Per-layer state kept in closure\n let model: FRAGS.FragmentsModel | null = null;\n let lastAppliedRotation = originalRotation;\n let lastLodUpdate = 0;\n // Render-on-demand: cache terrain elevation off the per-frame path and\n // only keep repainting while the camera recently moved, so an idle map\n // with a placed model stops re-rendering instead of pinning the main\n // thread (this was the freeze after a geocoder flyTo to high zoom).\n let cachedTerrainElev = 0;\n let lastMoveTime = performance.now();\n const SETTLE_MS = 1000;\n const recomputeTerrainElev = () => {\n const { lng, lat } = extractPositionAndRotation(bimFile, building);\n if (lng !== null && lat !== null) {\n const e = map.queryTerrainElevation([lng, lat]);\n if (e !== null && e !== undefined) cachedTerrainElev = e;\n }\n };\n\n let onMapMove: () => void;\n let onMapMoveEnd: () => void;\n const renderCamera = new THREE.PerspectiveCamera();\n const lodCamera = new THREE.PerspectiveCamera();\n // Reused per-frame matrices/vectors — render() must not allocate.\n const _vp = new THREE.Matrix4();\n const _m = new THREE.Matrix4();\n const _p = new THREE.Matrix4();\n const _vm = new THREE.Matrix4();\n const _camPos = new THREE.Vector3();\n const _center = new THREE.Vector3();\n const _lookTarget = new THREE.Vector3();\n const _scaleVec = new THREE.Vector3(1, 1, 1);\n\n return {\n id: bimFile.name,\n type: \"custom\",\n renderingMode: \"3d\",\n\n onAdd(map, gl) {\n scene.rotateY(originalRotation * (Math.PI / 180));\n this.scene = scene;\n\n void loadModel(buildingModel, fragments, scene, map, lodCamera).then(loaded => {\n model = loaded;\n // Open the settle window so the just-loaded fragments stream\n // in and paint over the next frames, then idle.\n lastMoveTime = performance.now();\n recomputeTerrainElev();\n map.triggerRepaint();\n });\n\n if (!rendererRef.current) {\n rendererRef.current = new THREE.WebGLRenderer({\n canvas: map.getCanvas(),\n context: gl,\n alpha: true,\n });\n rendererRef.current.autoClear = false;\n }\n this.renderer = rendererRef.current;\n // Track movement so render() knows when it may stop repainting.\n onMapMove = () => { lastMoveTime = performance.now(); };\n onMapMoveEnd = () => {\n lastMoveTime = performance.now();\n if (model) void fragments.core.update(true);\n // Terrain tiles for the new view are loaded once the camera\n // settles — refresh the cached elevation here, not per frame.\n recomputeTerrainElev();\n map.triggerRepaint();\n };\n map.on(\"move\", onMapMove);\n map.on(\"moveend\", onMapMoveEnd);\n },\n\n render(_, args) {\n if (\n editingBimModelRef.current === bimFile.name &&\n tempRotationsRef.current[bimFile.name] !== undefined\n ) {\n const cur = tempRotationsRef.current[bimFile.name];\n if (cur !== lastAppliedRotation) {\n scene.rotateY((cur - lastAppliedRotation) * (Math.PI / 180));\n lastAppliedRotation = cur;\n map.triggerRepaint();\n }\n } else {\n const { rotation: baseRot } = extractPositionAndRotation(bimFile, building);\n if (baseRot !== lastAppliedRotation) {\n scene.rotateY((baseRot - lastAppliedRotation) * (Math.PI / 180));\n lastAppliedRotation = baseRot;\n map.triggerRepaint();\n }\n }\n\n const {\n lng: baseLngNow, lat: baseLatNow,\n elevation: baseElevNow,\n } = extractPositionAndRotation(bimFile, building);\n\n let modelLongitude = baseLngNow;\n let modelLatitude = baseLatNow;\n let modelElevation = baseElevNow;\n\n if (editingBimModelRef.current === bimFile.name) {\n const tp = tempPositionsRef.current[bimFile.name];\n if (tp) { modelLongitude = tp.lng; modelLatitude = tp.lat; }\n const te = tempElevationsRef.current[bimFile.name];\n if (te !== undefined) modelElevation = te;\n }\n\n const modelOrigin = [modelLongitude, modelLatitude] as LngLatLike;\n // Use the cached terrain elevation (refreshed on moveend); query\n // live only while actively editing this model's position. Keeps\n // the expensive queryTerrainElevation off the hot path — the\n // per-frame query was a main driver of the high-zoom freeze.\n const terrainElev = editingBimModelRef.current === bimFile.name\n ? (map.queryTerrainElevation([modelLongitude, modelLatitude]) ?? cachedTerrainElev)\n : cachedTerrainElev;\n const modelAltitude = modelElevation + terrainElev;\n const scaling = 1;\n\n // ── Build renderCamera (VP × M, for Three.js rendering) ───\n // Reused temps — render() allocates nothing. Math is identical\n // to the prior allocate-every-frame version.\n const modelMatrix = map.transform.getMatrixForModel(modelOrigin, modelAltitude);\n _scaleVec.set(scaling, scaling, scaling);\n _vp.fromArray(args.defaultProjectionData.mainMatrix);\n _m.fromArray(modelMatrix).scale(_scaleVec);\n renderCamera.projectionMatrix.multiplyMatrices(_vp, _m); // VP × M, into the camera's own matrix\n\n // camIFCPos = translation of (P⁻¹ · (VP×M))⁻¹\n _p.fromArray(args.projectionMatrix).invert(); // _p = P⁻¹\n _vm.multiplyMatrices(_p, renderCamera.projectionMatrix).invert();\n _camPos.setFromMatrixPosition(_vm);\n lodCamera.position.copy(_camPos);\n\n if (model) {\n model.box.getCenter(_center);\n _lookTarget.set(0, _center.y, 0);\n } else {\n _lookTarget.set(0, 0, 0);\n }\n lodCamera.lookAt(_lookTarget);\n lodCamera.fov = args.fov * (180 / Math.PI) + 40;\n lodCamera.aspect = map.getCanvas().width / map.getCanvas().height;\n lodCamera.updateProjectionMatrix(); // rebuilds projectionMatrix from fov/aspect\n lodCamera.updateMatrixWorld(); // rebuilds matrixWorld + matrixWorldInverse\n\n if (model) {\n model.useCamera(lodCamera);\n const now = performance.now();\n if (now - lastLodUpdate > 50) {\n lastLodUpdate = now;\n void fragments.core.update();\n }\n // Render-on-demand: only keep the frame loop alive while the\n // camera recently moved (settle window, for fragment\n // streaming) or this model is being edited. Idle map ⇒ no\n // self-scheduled repaints ⇒ main thread freed (no freeze).\n if (\n editingBimModelRef.current === bimFile.name ||\n now - lastMoveTime < SETTLE_MS\n ) {\n map.triggerRepaint();\n }\n }\n\n this.renderer.resetState();\n this.renderer.render(this.scene, renderCamera);\n },\n\n onRemove() {\n if (onMapMove) map.off(\"move\", onMapMove);\n if (onMapMoveEnd) map.off(\"moveend\", onMapMoveEnd);\n if (model) {\n model.dispose().catch(console.warn);\n model = null;\n }\n // Dispose all Three.js GPU resources (geometries, materials, textures)\n disposeThreeScene(scene);\n },\n };\n };\n\n void Promise.all(modelsToAdd.map(async (buildingModel) => {\n try {\n const { fragments } = await getOrCreateShared();\n\n const layerName = buildingModel.bimFile.name;\n if (map.getLayer(layerName)) return;\n const scene = new THREE.Scene();\n scene.add(new THREE.AmbientLight(0xffffff, 0.8));\n const sun = new THREE.DirectionalLight(0xffffff, 1.0);\n sun.position.set(10, 20, 10);\n scene.add(sun);\n\n const customLayer = createCustomLayer(buildingModel, fragments, scene);\n if (!customLayer) return;\n\n map.addLayer(customLayer);\n addedLayersRef.current.add(layerName);\n\n } catch (err) {\n console.error(\"Error adding BIM layer:\", err);\n }\n }));\n\n }, [map, bimModelsAddedToMap]);\n\n // Cleanup on unmount — dispose shared components and renderer\n React.useEffect(() => {\n return () => {\n if (map) {\n addedLayersRef.current.forEach(layerName => {\n if (map.getLayer(layerName)) map.removeLayer(layerName);\n });\n addedLayersRef.current.clear();\n }\n if (sharedRef.current) {\n sharedRef.current.components.dispose();\n sharedRef.current = null;\n }\n if (rendererRef.current) {\n rendererRef.current.dispose();\n rendererRef.current = null;\n }\n };\n }, [map]);\n\n return (\n <>\n {bimModelsAddedToMap.map((buildingModel, index) => {\n const { lng, lat } = extractPositionAndRotation(\n buildingModel.bimFile, buildingModel.building\n );\n const isLoading = loadingBuildings.has(\n buildingModel.building?.id ?? buildingModel.bimFile.id\n );\n if (lng === null || lat === null) return null;\n return (\n <React.Fragment key={buildingModel.bimFile.id + \"-fragment-\" + index}>\n {isLoading && (\n <Marker\n key={buildingModel.bimFile.id + \"-loading-animation\" + index}\n latitude={lat}\n longitude={lng}\n {...markerOcclusionProps}\n >\n <LR.Loader className=\"animate-spin w-6 h-6 text-gray-700\" />\n </Marker>\n )}\n {/* Invisible hit-target for right-click context menu on WebGL-rendered BIM models */}\n {buildingModel.bimFile.name !== editingBimModel && (\n <Marker\n key={buildingModel.bimFile.id + \"-ctx-target-\" + index}\n latitude={lat}\n longitude={lng}\n {...markerOcclusionProps}\n >\n <div\n className=\"w-10 h-10 opacity-0 cursor-context-menu\"\n onContextMenu={(e) => {\n e.preventDefault();\n setContextMenu({ x: e.clientX, y: e.clientY, bimFile: buildingModel.bimFile });\n }}\n />\n </Marker>\n )}\n </React.Fragment>\n );\n })}\n {editingBimModel && (() => {\n const currentModel = bimModelsAddedToMap.find(bm => bm.bimFile.name === editingBimModel);\n if (!currentModel) return null;\n const { lng, lat, rotation, elevation } = extractPositionAndRotation(\n currentModel.bimFile, currentModel.building\n );\n return (\n <EditPosition\n file={currentModel.bimFile}\n displayName={currentModel.building?.buildingName || currentModel.bimFile.name}\n mode=\"3d\"\n initialLat={lat}\n initialLng={lng}\n initialRotation={rotation}\n initialElevation={elevation}\n onExitEditMode={handleExitEditMode}\n tempPositionsRef={tempPositionsRef}\n tempRotationsRef={tempRotationsRef}\n tempElevationsRef={tempElevationsRef}\n onMapRepaint={handleMapRepaint}\n />\n );\n })()}\n\n {contextMenu && (\n <ViewerContextMenu\n x={contextMenu.x}\n y={contextMenu.y}\n file={{ ...contextMenu.bimFile, isVisible: true }}\n options={['view', 'move']}\n onAction={handleContextMenuAction}\n onClose={() => setContextMenu(null)}\n />\n )}\n </>\n );\n\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkaQ,mBAkBwB,KARZ,YAVZ;AA7ZR,YAAY,SAAS;AACrB,YAAY,QAAQ;AAEpB,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,YAAY,WAAW;AAEvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,cAAc,kCAAkC;AAQlD,MAAM,WAAW,MAAM;AAE1B,QAAM,EAAE,OAAO,SAAS,IAAI,MAAM,WAAW,UAAU;AACvD,QAAM,EAAE,IAAI,IAAI,SAAS;AAEzB,QAAM,EAAE,OAAO,UAAU,UAAU,YAAY,IAAI,MAAM,WAAW,UAAU;AAC9E,QAAM,EAAE,qBAAqB,gBAAgB,IAAI,SAAS;AAE1D,QAAM,cAAc,MAAM,OAAmC,IAAI;AAEjE,QAAM,iBAAiB,MAAM,OAAoB,oBAAI,IAAI,CAAC;AAC1D,QAAM,gBAAgB,MAAM,OAAoB,oBAAI,IAAI,CAAC;AAEzD,QAAM,YAAY,MAAM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AAAA,gBACjF;AAAA;AAAA,YACJ;AAAA;AAAA,UAXK,cAAc,QAAQ,KAAK,iBAAiB;AAAA,QAYrD;AAAA,WA1Ba,cAAc,QAAQ,KAAK,eAAe,KA4B/D;AAAA,IAER,CAAC;AAAA,IACA,oBAAoB,MAAM;AA3cvC;AA4cgB,YAAM,eAAe,oBAAoB,KAAK,QAAM,GAAG,QAAQ,SAAS,eAAe;AACvF,UAAI,CAAC,aAAc,QAAO;AAC1B,YAAM,EAAE,KAAK,KAAK,UAAU,UAAU,IAAI;AAAA,QACtC,aAAa;AAAA,QAAS,aAAa;AAAA,MACvC;AACA,aACI;AAAA,QAAC;AAAA;AAAA,UACG,MAAM,aAAa;AAAA,UACnB,eAAa,kBAAa,aAAb,mBAAuB,iBAAgB,aAAa,QAAQ;AAAA,UACzE,MAAK;AAAA,UACL,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,iBAAiB;AAAA,UACjB,kBAAkB;AAAA,UAClB,gBAAgB;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAc;AAAA;AAAA,MAClB;AAAA,IAER,GAAG;AAAA,IAEF,eACG;AAAA,MAAC;AAAA;AAAA,QACG,GAAG,YAAY;AAAA,QACf,GAAG,YAAY;AAAA,QACf,MAAM,iCAAK,YAAY,UAAjB,EAA0B,WAAW,KAAK;AAAA,QAChD,SAAS,CAAC,QAAQ,MAAM;AAAA,QACxB,UAAU;AAAA,QACV,SAAS,MAAM,eAAe,IAAI;AAAA;AAAA,IACtC;AAAA,KAER;AAGR;","names":["map"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BimLayer/index.tsx"],"sourcesContent":["\"use client\"\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as OBC from \"@thatopen/components\";\nimport * as LR from \"lucide-react\";\nimport { type CustomLayerInterface, type LngLatLike } from \"maplibre-gl\";\nimport * as React from \"react\";\nimport { Marker } from \"react-map-gl/maplibre\";\nimport * as THREE from \"three\";\n\nimport { BimContext, MapContext } from \"../../../../../../../store\";\nimport { markerOcclusionProps } from \"../../../../../../../utils/markerUtils\";\nimport { ViewerContextMenu } from '../../../../../../ui/FilesManager';\nimport { writeModelMatrix } from \"../../../../utils/modelMatrix\";\nimport { disposeThreeScene } from \"../disposeThreeScene\";\nimport { EditPosition, extractPositionAndRotation } from \"../EditPosition\";\n\nimport type { Building, DbFile } from \"../../../../../../../types/dbTypes\";\nimport type { FileAction } from \"../../../../../../../types/global\";\nimport type * as FRAGS from \"@thatopen/fragments\";\nimport type { Map } from \"maplibre-gl\";\n\n\nexport const BimLayer = () => {\n\n const { state: mapState } = React.useContext(MapContext);\n const { map } = mapState.map;\n\n const { state: bimState, dispatch: bimDispatch } = React.useContext(BimContext);\n const { bimModelsAddedToMap, editingBimModel } = bimState.bim;\n\n const rendererRef = React.useRef<THREE.WebGLRenderer | null>(null);\n\n const addedLayersRef = React.useRef<Set<string>>(new Set());\n const prevModelsRef = React.useRef<Set<string>>(new Set());\n\n const sharedRef = React.useRef<{\n components: OBC.Components;\n fragments: OBC.FragmentsManager;\n } | null>(null);\n\n const [loadingBuildings, setLoadingBuildings] = React.useState<Set<number>>(new Set());\n const [contextMenu, setContextMenu] = React.useState<{\n x: number; y: number; bimFile: DbFile\n } | null>(null);\n\n const handleContextMenuAction = React.useCallback((action: FileAction, file: DbFile) => {\n if (action === 'view') {\n bimDispatch({ type: 'REMOVE_BIM_FROM_MAP', payload: { bimModelName: file.name } });\n } else if (action === 'move') {\n bimDispatch({ type: 'EDIT_BIM_MODEL_BY_NAME', payload: { editingBimModel: file.name } });\n }\n }, [bimDispatch]);\n\n const tempPositionsRef = React.useRef<Record<string, { lat: number; lng: number }>>({});\n const tempRotationsRef = React.useRef<Record<string, number>>({});\n const tempElevationsRef = React.useRef<Record<string, number>>({});\n\n const editingBimModelRef = React.useRef<string | null>(editingBimModel);\n React.useEffect(() => {\n editingBimModelRef.current = editingBimModel;\n }, [editingBimModel]);\n\n const handleExitEditMode = React.useCallback(() => {\n bimDispatch({ type: \"EDIT_BIM_MODEL_BY_NAME\", payload: { editingBimModel: null } });\n }, [bimDispatch]);\n\n const handleMapRepaint = React.useCallback(() => {\n if (map) map.triggerRepaint();\n }, [map]);\n const getOrCreateShared = React.useCallback(async () => {\n if (sharedRef.current) return sharedRef.current;\n\n const components = new OBC.Components();\n const worlds = components.get(OBC.Worlds);\n const world = worlds.create<OBC.SimpleScene, OBC.SimpleCamera, OBC.SimpleRenderer>();\n world.scene = new OBC.SimpleScene(components);\n world.renderer = new OBC.SimpleRenderer(components, document.createElement(\"div\"));\n world.camera = new OBC.SimpleCamera(components);\n components.init();\n world.scene.setup();\n\n const fragments = components.get(OBC.FragmentsManager);\n const fetchedUrl = await fetch(\"https://thatopen.github.io/engine_fragment/resources/worker.mjs\");\n const workerBlob = await fetchedUrl.blob();\n const workerUrl = URL.createObjectURL(\n new File([workerBlob], \"worker.mjs\", { type: \"text/javascript\" })\n );\n fragments.init(workerUrl);\n\n sharedRef.current = { components, fragments };\n return sharedRef.current;\n }, []);\n\n React.useEffect(() => {\n if (!map) return;\n\n const currentModelNames = new Set(bimModelsAddedToMap.map(bm => bm.bimFile.name));\n\n const modelsToRemove = Array.from(prevModelsRef.current).filter(\n name => !currentModelNames.has(name)\n );\n const modelsToAdd = bimModelsAddedToMap.filter(\n bm => !prevModelsRef.current.has(bm.bimFile.name)\n );\n\n modelsToRemove.forEach(layerName => {\n if (map.getLayer(layerName)) {\n map.removeLayer(layerName);\n addedLayersRef.current.delete(layerName);\n }\n });\n\n prevModelsRef.current = currentModelNames;\n\n if (modelsToAdd.length === 0) return;\n\n // ─── Load a single BIM model ──────────────────────────────────────────\n const loadModel = async (\n buildingModel: { bimFile: DbFile; building?: Building | null },\n fragments: OBC.FragmentsManager,\n scene: THREE.Scene,\n map: Map,\n lodCamera: THREE.PerspectiveCamera\n ): Promise<FRAGS.FragmentsModel | null> => {\n\n const { bimFile, building } = buildingModel;\n if (!bimFile) return null;\n\n const buildingId = building?.id ?? bimFile.id;\n setLoadingBuildings(prev => new Set(prev).add(buildingId));\n\n try {\n const file = await fetch(bimFile.url);\n if (!file.ok) throw new Error(`Fetch failed: ${file.status} ${file.statusText}`);\n\n const buffer = await file.arrayBuffer();\n const model = await fragments.core.load(buffer, { modelId: bimFile.name });\n\n if (!model.box.isEmpty()) {\n const center = model.box.getCenter(new THREE.Vector3());\n const size = model.box.getSize(new THREE.Vector3());\n model.object.position.set(-center.x, 0, -center.z);\n\n // lodCamera: above the model's new IFC-space centre (XZ is now 0,0)\n lodCamera.position.set(0, center.y + Math.max(size.x, size.y, size.z) * 2, 0);\n lodCamera.lookAt(0, center.y, 0);\n } else {\n lodCamera.position.set(0, 100, 0);\n lodCamera.lookAt(0, 0, 0);\n }\n lodCamera.updateMatrixWorld();\n model.useCamera(lodCamera);\n\n model.graphicsQuality = 1;\n scene.add(model.object);\n void fragments.core.update(true);\n map.triggerRepaint();\n\n return model;\n\n } catch (error) {\n console.error(\"Error loading BIM model:\", error);\n return null;\n } finally {\n setLoadingBuildings(prev => {\n const next = new Set(prev);\n next.delete(buildingId);\n return next;\n });\n }\n };\n\n // ─── Build a MapLibre custom layer for one model ──────────────────────\n const createCustomLayer = (\n buildingModel: { bimFile: DbFile; building?: Building | null },\n fragments: OBC.FragmentsManager,\n scene: THREE.Scene\n ): CustomLayerInterface | undefined => {\n\n const { bimFile, building } = buildingModel;\n const {\n lng: baseLng, lat: baseLat,\n rotation: originalRotation,\n } = extractPositionAndRotation(bimFile, building);\n if (baseLng === null || baseLat === null) return undefined;\n\n // Per-layer state kept in closure\n let model: FRAGS.FragmentsModel | null = null;\n let lastAppliedRotation = originalRotation;\n let lastLodUpdate = 0;\n // Render-on-demand: cache terrain elevation off the per-frame path and\n // only keep repainting while the camera recently moved, so an idle map\n // with a placed model stops re-rendering instead of pinning the main\n // thread (this was the freeze after a geocoder flyTo to high zoom).\n let cachedTerrainElev = 0;\n let lastMoveTime = performance.now();\n const SETTLE_MS = 1000;\n const recomputeTerrainElev = () => {\n const { lng, lat } = extractPositionAndRotation(bimFile, building);\n if (lng !== null && lat !== null) {\n const e = map.queryTerrainElevation([lng, lat]);\n if (e !== null && e !== undefined) cachedTerrainElev = e;\n }\n };\n\n let onMapMove: () => void;\n let onMapMoveEnd: () => void;\n const renderCamera = new THREE.PerspectiveCamera();\n const lodCamera = new THREE.PerspectiveCamera();\n // Reused per-frame matrices/vectors — render() must not allocate.\n const _vp = new THREE.Matrix4();\n const _m = new THREE.Matrix4();\n const _p = new THREE.Matrix4();\n const _vm = new THREE.Matrix4();\n const _camPos = new THREE.Vector3();\n const _center = new THREE.Vector3();\n const _lookTarget = new THREE.Vector3();\n const _scaleVec = new THREE.Vector3(1, 1, 1);\n\n return {\n id: bimFile.name,\n type: \"custom\",\n renderingMode: \"3d\",\n\n onAdd(map, gl) {\n scene.rotateY(originalRotation * (Math.PI / 180));\n this.scene = scene;\n\n void loadModel(buildingModel, fragments, scene, map, lodCamera).then(loaded => {\n model = loaded;\n // Open the settle window so the just-loaded fragments stream\n // in and paint over the next frames, then idle.\n lastMoveTime = performance.now();\n recomputeTerrainElev();\n map.triggerRepaint();\n });\n\n if (!rendererRef.current) {\n rendererRef.current = new THREE.WebGLRenderer({\n canvas: map.getCanvas(),\n context: gl,\n alpha: true,\n });\n rendererRef.current.autoClear = false;\n }\n this.renderer = rendererRef.current;\n // Track movement so render() knows when it may stop repainting.\n onMapMove = () => { lastMoveTime = performance.now(); };\n onMapMoveEnd = () => {\n lastMoveTime = performance.now();\n if (model) void fragments.core.update(true);\n // Terrain tiles for the new view are loaded once the camera\n // settles — refresh the cached elevation here, not per frame.\n recomputeTerrainElev();\n map.triggerRepaint();\n };\n map.on(\"move\", onMapMove);\n map.on(\"moveend\", onMapMoveEnd);\n },\n\n render(_, args) {\n if (\n editingBimModelRef.current === bimFile.name &&\n tempRotationsRef.current[bimFile.name] !== undefined\n ) {\n const cur = tempRotationsRef.current[bimFile.name];\n if (cur !== lastAppliedRotation) {\n scene.rotateY((cur - lastAppliedRotation) * (Math.PI / 180));\n lastAppliedRotation = cur;\n map.triggerRepaint();\n }\n } else {\n const { rotation: baseRot } = extractPositionAndRotation(bimFile, building);\n if (baseRot !== lastAppliedRotation) {\n scene.rotateY((baseRot - lastAppliedRotation) * (Math.PI / 180));\n lastAppliedRotation = baseRot;\n map.triggerRepaint();\n }\n }\n\n const {\n lng: baseLngNow, lat: baseLatNow,\n elevation: baseElevNow,\n } = extractPositionAndRotation(bimFile, building);\n\n let modelLongitude = baseLngNow;\n let modelLatitude = baseLatNow;\n let modelElevation = baseElevNow;\n\n if (editingBimModelRef.current === bimFile.name) {\n const tp = tempPositionsRef.current[bimFile.name];\n if (tp) { modelLongitude = tp.lng; modelLatitude = tp.lat; }\n const te = tempElevationsRef.current[bimFile.name];\n if (te !== undefined) modelElevation = te;\n }\n\n const modelOrigin = [modelLongitude, modelLatitude] as LngLatLike;\n // Use the cached terrain elevation (refreshed on moveend); query\n // live only while actively editing this model's position. Keeps\n // the expensive queryTerrainElevation off the hot path — the\n // per-frame query was a main driver of the high-zoom freeze.\n const terrainElev = editingBimModelRef.current === bimFile.name\n ? (map.queryTerrainElevation([modelLongitude, modelLatitude]) ?? cachedTerrainElev)\n : cachedTerrainElev;\n const modelAltitude = modelElevation + terrainElev;\n const scaling = 1;\n\n // ── Build renderCamera (VP × M, for Three.js rendering) ───\n // Reused temps — render() allocates nothing. Math is identical\n // to the prior allocate-every-frame version.\n _scaleVec.set(scaling, scaling, scaling);\n _vp.fromArray(args.defaultProjectionData.mainMatrix);\n writeModelMatrix(_m, modelOrigin, modelAltitude).scale(_scaleVec);\n renderCamera.projectionMatrix.multiplyMatrices(_vp, _m); // VP × M, into the camera's own matrix\n\n // camIFCPos = translation of (P⁻¹ · (VP×M))⁻¹\n _p.fromArray(args.projectionMatrix).invert(); // _p = P⁻¹\n _vm.multiplyMatrices(_p, renderCamera.projectionMatrix).invert();\n _camPos.setFromMatrixPosition(_vm);\n lodCamera.position.copy(_camPos);\n\n if (model) {\n model.box.getCenter(_center);\n _lookTarget.set(0, _center.y, 0);\n } else {\n _lookTarget.set(0, 0, 0);\n }\n lodCamera.lookAt(_lookTarget);\n lodCamera.fov = args.fov * (180 / Math.PI) + 40;\n lodCamera.aspect = map.getCanvas().width / map.getCanvas().height;\n lodCamera.updateProjectionMatrix(); // rebuilds projectionMatrix from fov/aspect\n lodCamera.updateMatrixWorld(); // rebuilds matrixWorld + matrixWorldInverse\n\n if (model) {\n model.useCamera(lodCamera);\n const now = performance.now();\n if (now - lastLodUpdate > 50) {\n lastLodUpdate = now;\n void fragments.core.update();\n }\n // Render-on-demand: only keep the frame loop alive while the\n // camera recently moved (settle window, for fragment\n // streaming) or this model is being edited. Idle map ⇒ no\n // self-scheduled repaints ⇒ main thread freed (no freeze).\n if (\n editingBimModelRef.current === bimFile.name ||\n now - lastMoveTime < SETTLE_MS\n ) {\n map.triggerRepaint();\n }\n }\n\n this.renderer.resetState();\n this.renderer.render(this.scene, renderCamera);\n },\n\n onRemove() {\n if (onMapMove) map.off(\"move\", onMapMove);\n if (onMapMoveEnd) map.off(\"moveend\", onMapMoveEnd);\n if (model) {\n model.dispose().catch(console.warn);\n model = null;\n }\n // Dispose all Three.js GPU resources (geometries, materials, textures)\n disposeThreeScene(scene);\n },\n };\n };\n\n void Promise.all(modelsToAdd.map(async (buildingModel) => {\n try {\n const { fragments } = await getOrCreateShared();\n\n const layerName = buildingModel.bimFile.name;\n if (map.getLayer(layerName)) return;\n const scene = new THREE.Scene();\n scene.add(new THREE.AmbientLight(0xffffff, 0.8));\n const sun = new THREE.DirectionalLight(0xffffff, 1.0);\n sun.position.set(10, 20, 10);\n scene.add(sun);\n\n const customLayer = createCustomLayer(buildingModel, fragments, scene);\n if (!customLayer) return;\n\n map.addLayer(customLayer);\n addedLayersRef.current.add(layerName);\n\n } catch (err) {\n console.error(\"Error adding BIM layer:\", err);\n }\n }));\n\n }, [map, bimModelsAddedToMap]);\n\n // Cleanup on unmount — dispose shared components and renderer\n React.useEffect(() => {\n return () => {\n if (map) {\n addedLayersRef.current.forEach(layerName => {\n if (map.getLayer(layerName)) map.removeLayer(layerName);\n });\n addedLayersRef.current.clear();\n }\n if (sharedRef.current) {\n sharedRef.current.components.dispose();\n sharedRef.current = null;\n }\n if (rendererRef.current) {\n rendererRef.current.dispose();\n rendererRef.current = null;\n }\n };\n }, [map]);\n\n return (\n <>\n {bimModelsAddedToMap.map((buildingModel, index) => {\n const { lng, lat } = extractPositionAndRotation(\n buildingModel.bimFile, buildingModel.building\n );\n const isLoading = loadingBuildings.has(\n buildingModel.building?.id ?? buildingModel.bimFile.id\n );\n if (lng === null || lat === null) return null;\n return (\n <React.Fragment key={buildingModel.bimFile.id + \"-fragment-\" + index}>\n {isLoading && (\n <Marker\n key={buildingModel.bimFile.id + \"-loading-animation\" + index}\n latitude={lat}\n longitude={lng}\n {...markerOcclusionProps}\n >\n <LR.Loader className=\"animate-spin w-6 h-6 text-gray-700\" />\n </Marker>\n )}\n {/* Invisible hit-target for right-click context menu on WebGL-rendered BIM models */}\n {buildingModel.bimFile.name !== editingBimModel && (\n <Marker\n key={buildingModel.bimFile.id + \"-ctx-target-\" + index}\n latitude={lat}\n longitude={lng}\n {...markerOcclusionProps}\n >\n <div\n className=\"w-10 h-10 opacity-0 cursor-context-menu\"\n onContextMenu={(e) => {\n e.preventDefault();\n setContextMenu({ x: e.clientX, y: e.clientY, bimFile: buildingModel.bimFile });\n }}\n />\n </Marker>\n )}\n </React.Fragment>\n );\n })}\n {editingBimModel && (() => {\n const currentModel = bimModelsAddedToMap.find(bm => bm.bimFile.name === editingBimModel);\n if (!currentModel) return null;\n const { lng, lat, rotation, elevation } = extractPositionAndRotation(\n currentModel.bimFile, currentModel.building\n );\n return (\n <EditPosition\n file={currentModel.bimFile}\n displayName={currentModel.building?.buildingName || currentModel.bimFile.name}\n mode=\"3d\"\n initialLat={lat}\n initialLng={lng}\n initialRotation={rotation}\n initialElevation={elevation}\n onExitEditMode={handleExitEditMode}\n tempPositionsRef={tempPositionsRef}\n tempRotationsRef={tempRotationsRef}\n tempElevationsRef={tempElevationsRef}\n onMapRepaint={handleMapRepaint}\n />\n );\n })()}\n\n {contextMenu && (\n <ViewerContextMenu\n x={contextMenu.x}\n y={contextMenu.y}\n file={{ ...contextMenu.bimFile, isVisible: true }}\n options={['view', 'move']}\n onAction={handleContextMenuAction}\n onClose={() => setContextMenu(null)}\n />\n )}\n </>\n );\n\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkaQ,mBAkBwB,KARZ,YAVZ;AA7ZR,YAAY,SAAS;AACrB,YAAY,QAAQ;AAEpB,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,YAAY,WAAW;AAEvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,cAAc,kCAAkC;AAQlD,MAAM,WAAW,MAAM;AAE1B,QAAM,EAAE,OAAO,SAAS,IAAI,MAAM,WAAW,UAAU;AACvD,QAAM,EAAE,IAAI,IAAI,SAAS;AAEzB,QAAM,EAAE,OAAO,UAAU,UAAU,YAAY,IAAI,MAAM,WAAW,UAAU;AAC9E,QAAM,EAAE,qBAAqB,gBAAgB,IAAI,SAAS;AAE1D,QAAM,cAAc,MAAM,OAAmC,IAAI;AAEjE,QAAM,iBAAiB,MAAM,OAAoB,oBAAI,IAAI,CAAC;AAC1D,QAAM,gBAAgB,MAAM,OAAoB,oBAAI,IAAI,CAAC;AAEzD,QAAM,YAAY,MAAM,OAGd,IAAI;AAEd,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAsB,oBAAI,IAAI,CAAC;AACrF,QAAM,CAAC,aAAa,cAAc,IAAI,MAAM,SAElC,IAAI;AAEd,QAAM,0BAA0B,MAAM,YAAY,CAAC,QAAoB,SAA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,QAAQ,SAAS,eAAe;AACvF,UAAI,CAAC,aAAc,QAAO;AAC1B,YAAM,EAAE,KAAK,KAAK,UAAU,UAAU,IAAI;AAAA,QACtC,aAAa;AAAA,QAAS,aAAa;AAAA,MACvC;AACA,aACI;AAAA,QAAC;AAAA;AAAA,UACG,MAAM,aAAa;AAAA,UACnB,eAAa,kBAAa,aAAb,mBAAuB,iBAAgB,aAAa,QAAQ;AAAA,UACzE,MAAK;AAAA,UACL,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,iBAAiB;AAAA,UACjB,kBAAkB;AAAA,UAClB,gBAAgB;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAc;AAAA;AAAA,MAClB;AAAA,IAER,GAAG;AAAA,IAEF,eACG;AAAA,MAAC;AAAA;AAAA,QACG,GAAG,YAAY;AAAA,QACf,GAAG,YAAY;AAAA,QACf,MAAM,iCAAK,YAAY,UAAjB,EAA0B,WAAW,KAAK;AAAA,QAChD,SAAS,CAAC,QAAQ,MAAM;AAAA,QACxB,UAAU;AAAA,QACV,SAAS,MAAM,eAAe,IAAI;AAAA;AAAA,IACtC;AAAA,KAER;AAGR;","names":["map"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyH/B,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,qBA+OtE"}
|
|
@@ -20,9 +20,9 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
return a;
|
|
21
21
|
};
|
|
22
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
import { Fragment, jsx
|
|
23
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
24
|
+
import { useTranslations } from "next-intl";
|
|
24
25
|
import * as React from "react";
|
|
25
|
-
import { Popup } from "react-map-gl/maplibre";
|
|
26
26
|
import { useBuildings } from "../../../../../../../hooks/buildings/buildings";
|
|
27
27
|
import { useBuildingsContext } from "../../../../../../../store";
|
|
28
28
|
import { useBimContext } from "../../../../../../../store/BIM/context";
|
|
@@ -76,11 +76,20 @@ function addOwnBuildingSource(map, key) {
|
|
|
76
76
|
}
|
|
77
77
|
return OWN_SOURCE_ID;
|
|
78
78
|
}
|
|
79
|
+
function removeBasemapBuildingLayers(map, sourceId) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const basemapSources = /* @__PURE__ */ new Set([...REUSABLE_SOURCE_IDS, sourceId]);
|
|
82
|
+
for (const layer of (_b = (_a = map.getStyle()) == null ? void 0 : _a.layers) != null ? _b : []) {
|
|
83
|
+
const isDuplicate = layer.id !== LAYER_ID && layer.type === "fill-extrusion" && layer["source-layer"] === "building" && basemapSources.has(layer.source);
|
|
84
|
+
if (isDuplicate) map.removeLayer(layer.id);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
79
87
|
function addBuildingLayer(map, hiddenBimOsmIds, colourExpr, maptilerKey) {
|
|
80
88
|
try {
|
|
81
89
|
if (map.getLayer(LAYER_ID)) return;
|
|
82
90
|
const sourceId = resolveBuildingSource(map, maptilerKey);
|
|
83
91
|
if (!sourceId) return;
|
|
92
|
+
removeBasemapBuildingLayers(map, sourceId);
|
|
84
93
|
const beforeId = map.getLayer("road_label") ? "road_label" : void 0;
|
|
85
94
|
map.addLayer({
|
|
86
95
|
id: LAYER_ID,
|
|
@@ -110,15 +119,20 @@ function addBuildingLayer(map, hiddenBimOsmIds, colourExpr, maptilerKey) {
|
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
function BuildingLayer({ maptilerKey }) {
|
|
113
|
-
var _a;
|
|
114
|
-
const { state: mapState } = React.useContext(MapContext);
|
|
115
|
-
const { map, mapClickManager } = mapState.map;
|
|
122
|
+
var _a, _b;
|
|
123
|
+
const { state: mapState, dispatch: mapDispatch } = React.useContext(MapContext);
|
|
124
|
+
const { map, mapClickManager, show3dBuildings, popupStack } = mapState.map;
|
|
125
|
+
const t = useTranslations("DatabaseBuildingPopover");
|
|
116
126
|
const { setCompareItems } = useBuildingsContext();
|
|
117
127
|
const { buildings } = useBuildings();
|
|
118
128
|
const { state: bimState } = useBimContext();
|
|
119
129
|
const { bimModelsAddedToMap } = bimState.bim;
|
|
120
130
|
const [hoveredFeature, setHoveredFeature] = React.useState(null);
|
|
121
|
-
const
|
|
131
|
+
const entryFeaturesRef = React.useRef({});
|
|
132
|
+
const closePopups = React.useCallback(
|
|
133
|
+
() => mapDispatch({ type: "SET_POPUP_STACK", payload: null }),
|
|
134
|
+
[mapDispatch]
|
|
135
|
+
);
|
|
122
136
|
const [buildingByOsmId, setBuildingByOsmId] = React.useState({});
|
|
123
137
|
const sensorColours = useBuildingSensorColours(ViewerNames.map);
|
|
124
138
|
const { averages, colourKey } = sensorColours;
|
|
@@ -126,16 +140,15 @@ function BuildingLayer({ maptilerKey }) {
|
|
|
126
140
|
() => osmColourEntries(averages, buildings != null ? buildings : []),
|
|
127
141
|
[averages, buildings]
|
|
128
142
|
);
|
|
143
|
+
const activeEntry = popupStack ? popupStack.entries[popupStack.activeIndex] : null;
|
|
144
|
+
const clickedKey = (activeEntry == null ? void 0 : activeEntry.layerId) === LAYER_ID ? (_b = (_a = entryFeaturesRef.current[activeEntry.id]) == null ? void 0 : _a.id) != null ? _b : null : null;
|
|
129
145
|
const colourExpr = React.useMemo(
|
|
130
|
-
() => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
[osmColours, clickedFeature, hoveredFeature]
|
|
146
|
+
() => buildingColourExpression({
|
|
147
|
+
osmColours,
|
|
148
|
+
clickedKey,
|
|
149
|
+
hoveredKey: hoveredFeature
|
|
150
|
+
}),
|
|
151
|
+
[osmColours, clickedKey, hoveredFeature]
|
|
139
152
|
);
|
|
140
153
|
const colourExprRef = React.useRef(DEFAULT_COLOUR_EXPRESSION);
|
|
141
154
|
colourExprRef.current = colourExpr;
|
|
@@ -166,8 +179,8 @@ function BuildingLayer({ maptilerKey }) {
|
|
|
166
179
|
return mapping;
|
|
167
180
|
}
|
|
168
181
|
const hasChanges = newKeys.some((key) => {
|
|
169
|
-
var _a2,
|
|
170
|
-
return ((_a2 = mapping[key]) == null ? void 0 : _a2.id) !== ((
|
|
182
|
+
var _a2, _b2;
|
|
183
|
+
return ((_a2 = mapping[key]) == null ? void 0 : _a2.id) !== ((_b2 = prevMapping[key]) == null ? void 0 : _b2.id);
|
|
171
184
|
});
|
|
172
185
|
return hasChanges ? mapping : prevMapping;
|
|
173
186
|
});
|
|
@@ -198,39 +211,63 @@ function BuildingLayer({ maptilerKey }) {
|
|
|
198
211
|
map.setPaintProperty(LAYER_ID, "fill-extrusion-height", buildHeightExpression(hiddenBimOsmIds));
|
|
199
212
|
}, [map, hiddenBimOsmIds]);
|
|
200
213
|
React.useEffect(() => {
|
|
201
|
-
if (!map
|
|
202
|
-
const
|
|
203
|
-
var _a2, _b;
|
|
214
|
+
if (!map) return;
|
|
215
|
+
const applyVisibility = () => {
|
|
204
216
|
if (!map.getLayer(LAYER_ID)) return;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
map.setLayoutProperty(LAYER_ID, "visibility", show3dBuildings ? "visible" : "none");
|
|
218
|
+
};
|
|
219
|
+
applyVisibility();
|
|
220
|
+
map.on("styledata", applyVisibility);
|
|
221
|
+
return () => {
|
|
222
|
+
map.off("styledata", applyVisibility);
|
|
223
|
+
};
|
|
224
|
+
}, [map, show3dBuildings]);
|
|
225
|
+
React.useEffect(() => {
|
|
226
|
+
if (!map || !mapClickManager) return;
|
|
227
|
+
const resolvePopups = (e, hits) => {
|
|
228
|
+
entryFeaturesRef.current = {};
|
|
229
|
+
const coordinates = [e.lngLat.lng, e.lngLat.lat];
|
|
230
|
+
return hits.map((feature) => {
|
|
231
|
+
var _a2, _b2;
|
|
232
|
+
const properties = feature.properties || {};
|
|
233
|
+
const featureId = feature.id || properties.osm_id || `temp-${Date.now()}`;
|
|
234
|
+
const normalizedOsmId = String(featureId);
|
|
235
|
+
const dbId = ((_a2 = buildingByOsmId[normalizedOsmId]) == null ? void 0 : _a2.id) || null;
|
|
236
|
+
const _name = ((_b2 = Object.entries(properties).find(
|
|
237
|
+
([key]) => key.toLowerCase().includes("name")
|
|
238
|
+
)) == null ? void 0 : _b2[1]) || void 0;
|
|
239
|
+
const featureClone = __spreadProps(__spreadValues({}, feature), {
|
|
240
|
+
id: featureId,
|
|
241
|
+
properties: __spreadProps(__spreadValues({}, properties), {
|
|
242
|
+
coordinates,
|
|
243
|
+
_name,
|
|
244
|
+
osm_id: normalizedOsmId,
|
|
245
|
+
isBuilding: true,
|
|
246
|
+
isDbBuilding: Boolean(dbId),
|
|
247
|
+
dbId
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
const id = `${LAYER_ID}:${normalizedOsmId}`;
|
|
251
|
+
entryFeaturesRef.current[id] = featureClone;
|
|
252
|
+
return {
|
|
253
|
+
id,
|
|
254
|
+
layerId: LAYER_ID,
|
|
255
|
+
priority: MapLayerClickPriority.BuildingLayersClickPriority,
|
|
256
|
+
title: _name || t("fallbackName"),
|
|
224
257
|
coordinates,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
258
|
+
render: (header) => /* @__PURE__ */ jsx(
|
|
259
|
+
MapFeaturePopoverMenu,
|
|
260
|
+
{
|
|
261
|
+
header,
|
|
262
|
+
feature: featureClone,
|
|
263
|
+
onCloseAction: () => {
|
|
264
|
+
closePopups();
|
|
265
|
+
setCompareItems([]);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
};
|
|
232
270
|
});
|
|
233
|
-
setClickedFeature(featureClone);
|
|
234
271
|
};
|
|
235
272
|
const handleHover = (e) => {
|
|
236
273
|
var _a2;
|
|
@@ -252,7 +289,7 @@ function BuildingLayer({ maptilerKey }) {
|
|
|
252
289
|
mapClickManager.register(
|
|
253
290
|
LAYER_ID,
|
|
254
291
|
MapLayerClickPriority.BuildingLayersClickPriority,
|
|
255
|
-
|
|
292
|
+
resolvePopups
|
|
256
293
|
);
|
|
257
294
|
map.on("mousemove", LAYER_ID, handleHover);
|
|
258
295
|
map.on("mouseleave", LAYER_ID, handleMouseLeave);
|
|
@@ -261,37 +298,16 @@ function BuildingLayer({ maptilerKey }) {
|
|
|
261
298
|
map.off("mousemove", LAYER_ID, handleHover);
|
|
262
299
|
map.off("mouseleave", LAYER_ID, handleMouseLeave);
|
|
263
300
|
};
|
|
264
|
-
}, [map, mapClickManager, buildingByOsmId, hiddenBimOsmIds]);
|
|
301
|
+
}, [map, mapClickManager, buildingByOsmId, hiddenBimOsmIds, t, closePopups, setCompareItems]);
|
|
265
302
|
React.useEffect(() => {
|
|
266
303
|
if (!map || !map.getLayer(LAYER_ID)) return;
|
|
267
|
-
map.setPaintProperty(
|
|
304
|
+
map.setPaintProperty(
|
|
305
|
+
LAYER_ID,
|
|
306
|
+
"fill-extrusion-color",
|
|
307
|
+
colourExpr
|
|
308
|
+
);
|
|
268
309
|
}, [map, colourExpr]);
|
|
269
|
-
return /* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */ jsx(BuildingSensorMarkers, { buildings: buildings != null ? buildings : [], sensorColours }),
|
|
271
|
-
clickedFeature && ((_a = clickedFeature.properties) == null ? void 0 : _a.coordinates) && /* @__PURE__ */ jsx(
|
|
272
|
-
Popup,
|
|
273
|
-
{
|
|
274
|
-
anchor: "bottom",
|
|
275
|
-
closeButton: true,
|
|
276
|
-
closeOnClick: false,
|
|
277
|
-
focusAfterOpen: true,
|
|
278
|
-
latitude: clickedFeature.properties.coordinates[1],
|
|
279
|
-
longitude: clickedFeature.properties.coordinates[0],
|
|
280
|
-
onClose: () => setClickedFeature(null),
|
|
281
|
-
children: /* @__PURE__ */ jsx(
|
|
282
|
-
MapFeaturePopoverMenu,
|
|
283
|
-
{
|
|
284
|
-
feature: clickedFeature,
|
|
285
|
-
onCloseAction: () => {
|
|
286
|
-
setClickedFeature(null);
|
|
287
|
-
setCompareItems([]);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
},
|
|
292
|
-
`maptiler-${clickedFeature.id}-${clickedFeature.properties._popupNonce}`
|
|
293
|
-
)
|
|
294
|
-
] });
|
|
310
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(BuildingSensorMarkers, { buildings: buildings != null ? buildings : [], sensorColours }) });
|
|
295
311
|
}
|
|
296
312
|
export {
|
|
297
313
|
BuildingLayer
|