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UvE,OAAO,iBAC/B8F,EAAcvB,UAAUvJ,IAAI,qBAC5BvD,EAAWwO,GAAGjL,IAAIqB,GAClBA,EAAO8E,SAAU,EACjB,MAAM+E,EAAO,IAAI,KAAOzO,GACxByO,EAAKC,QAAU,SACfD,EAAKpB,aAAe,QACpBoB,EAAKnB,QAAQ/J,KAAI,KACbqB,EAAO8E,SAAW9E,EAAO8E,OAAO,IAEpCvJ,KAAKoL,UAAU7H,IAAI,CAAE+K,OAAM7J,WAC3BzE,KAAKkL,kBAAkB9H,KAAI,IAAMpD,KAAKoM,gBAC1C,EAEJzB,EAAgBc,KAAO,uCACvB,IAAc+C,aAAapL,IAAIuH,EAAgBc,K","sources":["webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentIfcStreamer/src/geometry-culler-renderer.js","webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentIfcStreamer/src/streamer-db.js","webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentIfcStreamer/src/streaming-settings.js","webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentManager/index.js"],"sourcesContent":["import * as FRAGS from \"bim-fragment\";\r\nimport * as THREE from \"three\";\r\nimport { Event } from \"../../../base-types\";\r\nimport { CullerRenderer, } from \"../../../core/ScreenCuller/src\";\r\n/**\r\n * A renderer to determine a geometry visibility on screen\r\n */\r\nexport class GeometryCullerRenderer extends CullerRenderer {\r\n constructor(components, settings) {\r\n super(components, settings);\r\n /* Pixels in screen a geometry must occupy to be considered \"seen\". */\r\n this.threshold = 50;\r\n this.bboxThreshold = 200;\r\n this.maxLostTime = 30000;\r\n this.maxHiddenTime = 5000;\r\n this.boxes = new Map();\r\n this.useLowLod = false;\r\n this.lowLod = new Map();\r\n this._material = new THREE.MeshBasicMaterial({\r\n transparent: true,\r\n side: 2,\r\n opacity: 1,\r\n });\r\n this._lodMaterial = new THREE.MeshLambertMaterial();\r\n this.onViewUpdated = new Event();\r\n this._modelIDIndex = new Map();\r\n this._indexModelID = new Map();\r\n this._nextModelID = 0;\r\n this._geometries = new Map();\r\n this._geometriesGroups = new Map();\r\n this._foundGeometries = new Set();\r\n this.codes = new Map();\r\n this.handleWorkerMessage = async (event) => {\r\n const colors = event.data.colors;\r\n const toLoad = {};\r\n const toRemove = {};\r\n const toHide = {};\r\n const toShow = {};\r\n const now = performance.now();\r\n let viewWasUpdated = false;\r\n const lodsToShow = new Set();\r\n const lodsToHide = new Set();\r\n let bboxAmount = 0;\r\n for (const [color, number] of colors) {\r\n if (number < this.threshold) {\r\n continue;\r\n }\r\n const found = this._geometries.get(color);\r\n if (!found) {\r\n continue;\r\n }\r\n const isBoundingBox = found.fragment === undefined;\r\n if (isBoundingBox) {\r\n bboxAmount += number;\r\n }\r\n }\r\n const lostGeometries = new Set(this._foundGeometries);\r\n for (const [color, number] of colors) {\r\n const geometry = this._geometries.get(color);\r\n if (!geometry) {\r\n continue;\r\n }\r\n const isFound = number > this.threshold;\r\n const { exists } = geometry;\r\n if (!isFound && !exists) {\r\n // Geometry doesn't exist and is not visible\r\n continue;\r\n }\r\n const modelID = this._indexModelID.get(geometry.modelIndex);\r\n lostGeometries.delete(color);\r\n if (isFound && exists) {\r\n // Geometry was visible, and still is\r\n geometry.time = now;\r\n if (!toShow[modelID]) {\r\n toShow[modelID] = new Set();\r\n }\r\n toShow[modelID].add(geometry.geometryID);\r\n this._foundGeometries.add(color);\r\n viewWasUpdated = true;\r\n if (this.useLowLod) {\r\n lodsToHide.add(geometry);\r\n }\r\n }\r\n else if (isFound && !exists) {\r\n // New geometry found\r\n if (!toLoad[modelID]) {\r\n toLoad[modelID] = new Map();\r\n }\r\n geometry.time = now;\r\n geometry.exists = true;\r\n if (!toLoad[modelID].has(number)) {\r\n toLoad[modelID].set(number, new Set());\r\n }\r\n const set = toLoad[modelID].get(number);\r\n set.add(geometry.geometryID);\r\n this._foundGeometries.add(color);\r\n viewWasUpdated = true;\r\n if (this.useLowLod) {\r\n lodsToHide.add(geometry);\r\n }\r\n }\r\n else if (!isFound && exists) {\r\n // Geometry is hardly seen, so it can be considered lost\r\n if (bboxAmount < this.bboxThreshold) {\r\n // When too many bounding boxes on sight\r\n // don't hide / destroy geometry to prevent flickering\r\n this.handleLostGeometries(now, color, geometry, toRemove, toHide);\r\n if (this.useLowLod) {\r\n lodsToShow.add(geometry);\r\n }\r\n viewWasUpdated = true;\r\n }\r\n }\r\n }\r\n if (bboxAmount <= this.bboxThreshold) {\r\n // When too many bounding boxes on sight\r\n // don't hide / destroy geometry to prevent flickering\r\n for (const color of lostGeometries) {\r\n const geometry = this._geometries.get(color);\r\n if (!geometry) {\r\n throw new Error(\"Geometry not found!\");\r\n }\r\n this.handleLostGeometries(now, color, geometry, toRemove, toHide);\r\n if (this.useLowLod) {\r\n lodsToShow.add(geometry);\r\n }\r\n viewWasUpdated = true;\r\n }\r\n }\r\n if (viewWasUpdated) {\r\n await this.onViewUpdated.trigger({ toLoad, toRemove, toHide, toShow });\r\n }\r\n if (this.useLowLod) {\r\n for (const geometry of lodsToShow) {\r\n this.setLodVisibility(true, geometry);\r\n }\r\n for (const geometry of lodsToHide) {\r\n this.setLodVisibility(false, geometry);\r\n }\r\n }\r\n if (bboxAmount > this.bboxThreshold) {\r\n this.needsUpdate = true;\r\n }\r\n };\r\n this.updateInterval = 500;\r\n this._geometry = new THREE.BoxGeometry(1, 1, 1);\r\n this._geometry.groups = [];\r\n this._geometry.deleteAttribute(\"uv\");\r\n const position = this._geometry.attributes.position.array;\r\n for (let i = 0; i < position.length; i++) {\r\n position[i] += 0.5;\r\n }\r\n this._geometry.attributes.position.needsUpdate = true;\r\n this.worker.addEventListener(\"message\", this.handleWorkerMessage);\r\n if (this.autoUpdate) {\r\n window.setInterval(this.updateVisibility, this.updateInterval);\r\n }\r\n }\r\n async dispose() {\r\n await super.dispose();\r\n this.onViewUpdated.reset();\r\n this._lodMaterial.dispose();\r\n for (const [_id, fragment] of this.lowLod) {\r\n fragment.dispose(true);\r\n }\r\n this.lowLod.clear();\r\n for (const [_id, group] of this._geometriesGroups) {\r\n group.removeFromParent();\r\n const children = [...group.children];\r\n for (const child of children) {\r\n child.removeFromParent();\r\n }\r\n }\r\n this._geometriesGroups.clear();\r\n for (const [_id, frag] of this.boxes) {\r\n frag.dispose(true);\r\n }\r\n this.boxes.clear();\r\n for (const [_id, box] of this._geometries) {\r\n if (box.fragment) {\r\n box.fragment.dispose(true);\r\n box.fragment = undefined;\r\n }\r\n }\r\n this._geometries.clear();\r\n this._geometry.dispose();\r\n this._material.dispose();\r\n this._modelIDIndex.clear();\r\n this._indexModelID.clear();\r\n this.codes.clear();\r\n }\r\n add(modelID, assets, geometries) {\r\n const modelIndex = this.createModelIndex(modelID);\r\n const colorEnabled = THREE.ColorManagement.enabled;\r\n THREE.ColorManagement.enabled = false;\r\n const visitedGeometries = new Map();\r\n const tempMatrix = new THREE.Matrix4();\r\n const bboxes = new FRAGS.Fragment(this._geometry, this._material, 10);\r\n this.boxes.set(modelIndex, bboxes);\r\n this.scene.add(bboxes.mesh);\r\n if (this.useLowLod) {\r\n const lowLod = new FRAGS.Fragment(this._geometry, this._lodMaterial, 10);\r\n this.lowLod.set(modelIndex, lowLod);\r\n }\r\n const fragmentsGroup = new THREE.Group();\r\n this.scene.add(fragmentsGroup);\r\n this._geometriesGroups.set(modelIndex, fragmentsGroup);\r\n const items = new Map();\r\n for (const asset of assets) {\r\n // if (asset.id !== 664833) continue;\r\n for (const geometryData of asset.geometries) {\r\n const { geometryID, transformation, color } = geometryData;\r\n const geometryColor = new THREE.Color();\r\n geometryColor.setRGB(color[0], color[1], color[2], \"srgb\");\r\n const instanceID = this.getInstanceID(asset.id, geometryID);\r\n const geometry = geometries[geometryID];\r\n if (!geometry) {\r\n console.log(`Geometry not found: ${geometryID}`);\r\n continue;\r\n }\r\n const { boundingBox } = geometry;\r\n // Get bounding box color\r\n let nextColor;\r\n if (visitedGeometries.has(geometryID)) {\r\n nextColor = visitedGeometries.get(geometryID);\r\n }\r\n else {\r\n nextColor = this.getAvailableColor();\r\n this.increaseColor();\r\n visitedGeometries.set(geometryID, nextColor);\r\n }\r\n const { r, g, b, code } = nextColor;\r\n const threeColor = new THREE.Color();\r\n threeColor.setRGB(r / 255, g / 255, b / 255, \"srgb\");\r\n // Save color code by model and geometry\r\n if (!this.codes.has(modelIndex)) {\r\n this.codes.set(modelIndex, new Map());\r\n }\r\n const map = this.codes.get(modelIndex);\r\n map.set(geometryID, code);\r\n // Get bounding box transform\r\n const instanceMatrix = new THREE.Matrix4();\r\n const boundingBoxArray = Object.values(boundingBox);\r\n instanceMatrix.fromArray(transformation);\r\n tempMatrix.fromArray(boundingBoxArray);\r\n instanceMatrix.multiply(tempMatrix);\r\n if (items.has(instanceID)) {\r\n // This geometry exists multiple times in this asset\r\n const item = items.get(instanceID);\r\n if (item === undefined || !item.colors) {\r\n throw new Error(\"Malformed item!\");\r\n }\r\n item.colors.push(threeColor);\r\n item.geometryColors.push(geometryColor);\r\n item.transforms.push(instanceMatrix);\r\n }\r\n else {\r\n // This geometry exists only once in this asset (for now)\r\n items.set(instanceID, {\r\n id: instanceID,\r\n colors: [threeColor],\r\n geometryColors: [geometryColor],\r\n transforms: [instanceMatrix],\r\n });\r\n }\r\n if (!this._geometries.has(code)) {\r\n const assetIDs = new Set([asset.id]);\r\n this._geometries.set(code, {\r\n modelIndex,\r\n geometryID,\r\n assetIDs,\r\n exists: false,\r\n hidden: false,\r\n time: 0,\r\n });\r\n }\r\n else {\r\n const box = this._geometries.get(code);\r\n box.assetIDs.add(asset.id);\r\n }\r\n }\r\n }\r\n const itemsArray = Array.from(items.values());\r\n bboxes.add(itemsArray);\r\n if (this.useLowLod) {\r\n for (const item of itemsArray) {\r\n item.colors = item.geometryColors;\r\n }\r\n const lowLod = this.lowLod.get(modelIndex);\r\n lowLod.add(itemsArray);\r\n }\r\n THREE.ColorManagement.enabled = colorEnabled;\r\n // const { geometry, material, count, instanceMatrix, instanceColor } = [\r\n // ...this.boxes.values(),\r\n // ][0].mesh;\r\n // const mesh = new THREE.InstancedMesh(geometry, material, count);\r\n // mesh.instanceMatrix = instanceMatrix;\r\n // mesh.instanceColor = instanceColor;\r\n // this.components.scene.get().add(mesh);\r\n }\r\n remove(modelID) {\r\n const index = this._modelIDIndex.get(modelID);\r\n if (index === undefined) {\r\n throw new Error(\"Model doesn't exist!\");\r\n }\r\n const group = this._geometriesGroups.get(index);\r\n group.removeFromParent();\r\n const children = [...group.children];\r\n for (const child of children) {\r\n child.removeFromParent();\r\n }\r\n this._geometriesGroups.delete(index);\r\n const box = this.boxes.get(index);\r\n box.dispose(false);\r\n this.boxes.delete(index);\r\n const frag = this.lowLod.get(index);\r\n frag.dispose(false);\r\n this.lowLod.delete(index);\r\n const codes = this.codes.get(index);\r\n this.codes.delete(index);\r\n for (const [_id, code] of codes) {\r\n const geometry = this._geometries.get(code);\r\n if (geometry && geometry.fragment) {\r\n geometry.fragment.dispose(false);\r\n geometry.fragment = undefined;\r\n }\r\n this._geometries.delete(code);\r\n }\r\n this._modelIDIndex.delete(modelID);\r\n this._indexModelID.delete(index);\r\n this._foundGeometries.clear();\r\n }\r\n addFragment(modelID, geometryID, frag) {\r\n const colorEnabled = THREE.ColorManagement.enabled;\r\n THREE.ColorManagement.enabled = false;\r\n const modelIndex = this._modelIDIndex.get(modelID);\r\n // Hide bounding box\r\n const map = this.codes.get(modelIndex);\r\n const code = map.get(geometryID);\r\n const geometry = this._geometries.get(code);\r\n this.setGeometryVisibility(geometry, false, false);\r\n // Substitute it by fragment with same color\r\n if (!geometry.fragment) {\r\n geometry.fragment = new FRAGS.Fragment(frag.mesh.geometry, this._material, frag.capacity);\r\n const group = this._geometriesGroups.get(modelIndex);\r\n if (!group) {\r\n throw new Error(\"Group not found!\");\r\n }\r\n group.add(geometry.fragment.mesh);\r\n }\r\n const [r, g, b] = code.split(\"-\").map((value) => parseInt(value, 10));\r\n const items = [];\r\n for (const itemID of frag.ids) {\r\n const item = frag.get(itemID);\r\n if (!item.colors) {\r\n throw new Error(\"Malformed fragments!\");\r\n }\r\n for (const color of item.colors) {\r\n color.setRGB(r / 255, g / 255, b / 255, \"srgb\");\r\n }\r\n items.push(item);\r\n }\r\n geometry.fragment.add(items);\r\n THREE.ColorManagement.enabled = colorEnabled;\r\n this.needsUpdate = true;\r\n }\r\n removeFragment(modelID, geometryID) {\r\n const modelIndex = this._modelIDIndex.get(modelID);\r\n const map = this.codes.get(modelIndex);\r\n const code = map.get(geometryID);\r\n const geometry = this._geometries.get(code);\r\n if (!geometry.hidden) {\r\n this.setGeometryVisibility(geometry, true, false);\r\n }\r\n if (geometry.fragment) {\r\n const { fragment } = geometry;\r\n fragment.dispose(false);\r\n geometry.fragment = undefined;\r\n }\r\n }\r\n setModelTransformation(modelID, transform) {\r\n const modelIndex = this._modelIDIndex.get(modelID);\r\n if (modelIndex === undefined) {\r\n throw new Error(\"Model not found!\");\r\n }\r\n const bbox = this.boxes.get(modelIndex);\r\n if (bbox) {\r\n bbox.mesh.position.set(0, 0, 0);\r\n bbox.mesh.rotation.set(0, 0, 0);\r\n bbox.mesh.scale.set(1, 1, 1);\r\n bbox.mesh.applyMatrix4(transform);\r\n }\r\n const group = this._geometriesGroups.get(modelIndex);\r\n if (group) {\r\n group.position.set(0, 0, 0);\r\n group.rotation.set(0, 0, 0);\r\n group.scale.set(1, 1, 1);\r\n group.applyMatrix4(transform);\r\n }\r\n }\r\n setVisibility(visible, modelID, geometryIDsAssetIDs) {\r\n const modelIndex = this._modelIDIndex.get(modelID);\r\n if (modelIndex === undefined) {\r\n return;\r\n }\r\n for (const [geometryID, assets] of geometryIDsAssetIDs) {\r\n const map = this.codes.get(modelIndex);\r\n if (map === undefined) {\r\n throw new Error(\"Map not found!\");\r\n }\r\n const code = map.get(geometryID);\r\n const geometry = this._geometries.get(code);\r\n if (geometry === undefined) {\r\n throw new Error(\"Geometry not found!\");\r\n }\r\n geometry.hidden = !visible;\r\n this.setGeometryVisibility(geometry, visible, true, assets);\r\n }\r\n }\r\n setGeometryVisibility(geometry, visible, includeFragments, assets) {\r\n const { modelIndex, geometryID, assetIDs } = geometry;\r\n const bbox = this.boxes.get(modelIndex);\r\n if (bbox === undefined) {\r\n throw new Error(\"Model not found!\");\r\n }\r\n const items = assets || assetIDs;\r\n if (includeFragments && geometry.fragment) {\r\n geometry.fragment.setVisibility(visible, items);\r\n }\r\n else {\r\n const instancesID = new Set();\r\n for (const id of items) {\r\n const instanceID = this.getInstanceID(id, geometryID);\r\n instancesID.add(instanceID);\r\n }\r\n bbox.setVisibility(visible, instancesID);\r\n }\r\n }\r\n handleLostGeometries(now, color, geometry, toRemove, toHide) {\r\n const modelID = this._indexModelID.get(geometry.modelIndex);\r\n const lostTime = now - geometry.time;\r\n if (lostTime > this.maxLostTime) {\r\n // This geometry was lost too long - delete it\r\n if (!toRemove[modelID]) {\r\n toRemove[modelID] = new Set();\r\n }\r\n geometry.exists = false;\r\n toRemove[modelID].add(geometry.geometryID);\r\n this._foundGeometries.delete(color);\r\n }\r\n else if (lostTime > this.maxHiddenTime) {\r\n // This geometry was lost for a while - hide it\r\n if (!toHide[modelID]) {\r\n toHide[modelID] = new Set();\r\n }\r\n toHide[modelID].add(geometry.geometryID);\r\n }\r\n }\r\n setLodVisibility(visible, geometry) {\r\n const lod = this.lowLod.get(geometry.modelIndex);\r\n for (const assetID of geometry.assetIDs) {\r\n const instanceID = this.getInstanceID(assetID, geometry.geometryID);\r\n lod.setVisibility(visible, [instanceID]);\r\n }\r\n }\r\n createModelIndex(modelID) {\r\n if (this._modelIDIndex.has(modelID)) {\r\n throw new Error(\"Can't load the same model twice!\");\r\n }\r\n const count = this._nextModelID;\r\n this._nextModelID++;\r\n this._modelIDIndex.set(modelID, count);\r\n this._indexModelID.set(count, modelID);\r\n return count;\r\n }\r\n getInstanceID(assetID, geometryID) {\r\n // src: https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript\r\n // eslint-disable-next-line no-bitwise\r\n const size = (Math.log(geometryID) * Math.LOG10E + 1) | 0;\r\n const factor = 10 ** size;\r\n return assetID + geometryID / factor;\r\n }\r\n}\r\n//# sourceMappingURL=geometry-culler-renderer.js.map","import Dexie from \"dexie\";\r\nexport class StreamFileDatabase extends Dexie {\r\n constructor() {\r\n super(\"MyAppDatabase\");\r\n this.version(1).stores({\r\n files: \"id, file\",\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=streamer-db.js.map","// eslint-disable-next-line max-classes-per-file\r\nimport { IfcFragmentSettings } from \"../../FragmentIfcLoader/src\";\r\n/** Configuration of the IFC-fragment streaming. */\r\nexport class IfcStreamingSettings extends IfcFragmentSettings {\r\n constructor() {\r\n super(...arguments);\r\n this.minGeometrySize = 10;\r\n this.minAssetsSize = 1000;\r\n }\r\n}\r\n/** Configuration of the IFC-fragment streaming. */\r\nexport class PropertiesStreamingSettings extends IfcFragmentSettings {\r\n constructor() {\r\n super(...arguments);\r\n this.propertiesSize = 100;\r\n }\r\n}\r\n//# sourceMappingURL=streaming-settings.js.map","import { Serializer } from \"bim-fragment\";\r\nimport { Component } from \"../../base-types/component\";\r\nimport { UIElement } from \"../../base-types/ui-element\";\r\nimport { Event } from \"../../base-types\";\r\nimport { ToolComponent } from \"../../core/ToolsComponent\";\r\nimport { Button, FloatingWindow, SimpleUICard, SimpleUIComponent, } from \"../../ui\";\r\n/**\r\n * Object that can efficiently load binary files that contain\r\n * [fragment geometry](https://github.com/ThatOpen/engine_fragment).\r\n */\r\nexport class FragmentManager extends Component {\r\n /** The list of meshes of the created fragments. */\r\n get meshes() {\r\n const allMeshes = [];\r\n for (const fragID in this.list) {\r\n allMeshes.push(this.list[fragID].mesh);\r\n }\r\n return allMeshes;\r\n }\r\n constructor(components) {\r\n super(components);\r\n /** {@link Disposable.onDisposed} */\r\n this.onDisposed = new Event();\r\n /** {@link Component.enabled} */\r\n this.enabled = true;\r\n /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */\r\n this.list = {};\r\n this.groups = [];\r\n this.baseCoordinationModel = \"\";\r\n this.onFragmentsLoaded = new Event();\r\n this.onFragmentsDisposed = new Event();\r\n this.uiElement = new UIElement();\r\n this.commands = [];\r\n this._loader = new Serializer();\r\n this._cards = [];\r\n this.components.tools.add(FragmentManager.uuid, this);\r\n if (components.uiEnabled) {\r\n this.setupUI(components);\r\n }\r\n }\r\n /** {@link Component.get} */\r\n get() {\r\n return Object.values(this.list);\r\n }\r\n /** {@link Component.get} */\r\n async dispose(disposeUI = false) {\r\n if (disposeUI) {\r\n await this.uiElement.dispose();\r\n }\r\n for (const group of this.groups) {\r\n for (const frag of group.items) {\r\n this.components.meshes.delete(frag.mesh);\r\n }\r\n group.dispose(true);\r\n }\r\n for (const command of this.commands) {\r\n await command.dispose();\r\n }\r\n for (const card of this._cards) {\r\n await card.dispose();\r\n }\r\n this.groups = [];\r\n this.list = {};\r\n this.onFragmentsLoaded.reset();\r\n this.onFragmentsDisposed.reset();\r\n await this.onDisposed.trigger(FragmentManager.uuid);\r\n this.onDisposed.reset();\r\n }\r\n async disposeGroup(group) {\r\n const { uuid: groupID } = group;\r\n const fragmentIDs = [];\r\n for (const fragment of group.items) {\r\n fragmentIDs.push(fragment.id);\r\n this.components.meshes.delete(fragment.mesh);\r\n delete this.list[fragment.id];\r\n }\r\n group.dispose(true);\r\n const index = this.groups.indexOf(group);\r\n this.groups.splice(index, 1);\r\n await this.onFragmentsDisposed.trigger({\r\n groupID,\r\n fragmentIDs,\r\n });\r\n await this.updateWindow();\r\n }\r\n /** Disposes all existing fragments */\r\n reset() {\r\n for (const id in this.list) {\r\n const fragment = this.list[id];\r\n fragment.dispose();\r\n }\r\n this.list = {};\r\n }\r\n /**\r\n * Loads one or many fragments into the scene.\r\n * @param data - the bytes containing the data for the fragments to load.\r\n * @param coordinate - whether this fragmentsgroup should be federated with the others.\r\n * @returns the list of IDs of the loaded fragments.\r\n */\r\n async load(data, coordinate = true) {\r\n const model = this._loader.import(data);\r\n const scene = this.components.scene.get();\r\n const ids = [];\r\n scene.add(model);\r\n for (const fragment of model.items) {\r\n fragment.group = model;\r\n this.list[fragment.id] = fragment;\r\n ids.push(fragment.id);\r\n this.components.meshes.add(fragment.mesh);\r\n }\r\n if (coordinate) {\r\n this.coordinate([model]);\r\n }\r\n this.groups.push(model);\r\n await this.onFragmentsLoaded.trigger(model);\r\n return model;\r\n }\r\n /**\r\n * Export the specified fragments.\r\n * @param group - the fragments group to be exported.\r\n * @returns the exported data as binary buffer.\r\n */\r\n export(group) {\r\n return this._loader.export(group);\r\n }\r\n async updateWindow() {\r\n if (!this.components.uiEnabled) {\r\n return;\r\n }\r\n for (const card of this._cards) {\r\n await card.dispose();\r\n }\r\n for (const group of this.groups) {\r\n const card = new SimpleUICard(this.components);\r\n // TODO: Make all cards like this?\r\n card.domElement.classList.remove(\"bg-ifcjs-120\");\r\n card.domElement.classList.remove(\"border-transparent\");\r\n card.domElement.className += ` min-w-[300px] my-2 border-1 border-solid border-[#3A444E] `;\r\n const buttonContainer = new SimpleUIComponent(this.components);\r\n card.addChild(buttonContainer);\r\n card.title = group.name;\r\n this.uiElement.get(\"window\").addChild(card);\r\n this._cards.push(card);\r\n // TODO: Use command list just like in fragment plans\r\n const commandsButton = new Button(this.components);\r\n commandsButton.materialIcon = \"delete\";\r\n buttonContainer.addChild(commandsButton);\r\n commandsButton.onClick.add(() => this.disposeGroup(group));\r\n }\r\n }\r\n coordinate(models = this.groups) {\r\n const isFirstModel = this.baseCoordinationModel.length === 0;\r\n if (isFirstModel) {\r\n const first = models.pop();\r\n if (!first) {\r\n return;\r\n }\r\n this.baseCoordinationModel = first.uuid;\r\n }\r\n if (!models.length) {\r\n return;\r\n }\r\n const baseModel = this.groups.find((group) => group.uuid === this.baseCoordinationModel);\r\n if (!baseModel) {\r\n console.log(\"No base model found for coordination!\");\r\n return;\r\n }\r\n for (const model of models) {\r\n if (model === baseModel) {\r\n continue;\r\n }\r\n model.position.set(0, 0, 0);\r\n model.rotation.set(0, 0, 0);\r\n model.scale.set(1, 1, 1);\r\n model.updateMatrix();\r\n model.applyMatrix4(model.coordinationMatrix.clone().invert());\r\n model.applyMatrix4(baseModel.coordinationMatrix);\r\n }\r\n }\r\n setupUI(components) {\r\n const window = new FloatingWindow(components);\r\n window.title = \"Models\";\r\n window.domElement.style.left = \"70px\";\r\n window.domElement.style.top = \"100px\";\r\n window.domElement.style.width = \"340px\";\r\n window.domElement.style.height = \"400px\";\r\n const windowContent = window.slots.content.domElement;\r\n windowContent.classList.remove(\"overflow-auto\");\r\n windowContent.classList.add(\"overflow-x-hidden\");\r\n components.ui.add(window);\r\n window.visible = false;\r\n const main = new Button(components);\r\n main.tooltip = \"Models\";\r\n main.materialIcon = \"inbox\";\r\n main.onClick.add(() => {\r\n window.visible = !window.visible;\r\n });\r\n this.uiElement.set({ main, window });\r\n this.onFragmentsLoaded.add(() => this.updateWindow());\r\n }\r\n}\r\nFragmentManager.uuid = \"fef46874-46a3-461b-8c44-2922ab77c806\";\r\nToolComponent.libraryUUIDs.add(FragmentManager.uuid);\r\n//# sourceMappingURL=index.js.map"],"names":["GeometryCullerRenderer","constructor","components","settings","super","this","threshold","bboxThreshold","maxLostTime","maxHiddenTime","boxes","Map","useLowLod","lowLod","_material","transparent","side","opacity","_lodMaterial","onViewUpdated","_modelIDIndex","_indexModelID","_nextModelID","_geometries","_geometriesGroups","_foundGeometries","Set","codes","handleWorkerMessage","async","event","colors","data","toLoad","toRemove","toHide","toShow","now","performance","viewWasUpdated","lodsToShow","lodsToHide","bboxAmount","color","number","found","get","undefined","fragment","lostGeometries","geometry","isFound","exists","modelID","modelIndex","delete","time","add","geometryID","has","set","handleLostGeometries","Error","trigger","setLodVisibility","needsUpdate","updateInterval","_geometry","groups","deleteAttribute","position","attributes","array","i","length","worker","addEventListener","autoUpdate","window","setInterval","updateVisibility","dispose","reset","_id","clear","group","removeFromParent","children","child","frag","box","assets","geometries","createModelIndex","colorEnabled","enabled","visitedGeometries","tempMatrix","bboxes","scene","mesh","fragmentsGroup","items","asset","geometryData","transformation","geometryColor","setRGB","instanceID","getInstanceID","id","console","log","boundingBox","nextColor","getAvailableColor","increaseColor","r","g","b","code","threeColor","instanceMatrix","boundingBoxArray","Object","values","fromArray","multiply","item","push","geometryColors","transforms","assetIDs","hidden","itemsArray","Array","from","remove","index","addFragment","setGeometryVisibility","capacity","split","map","value","parseInt","itemID","ids","removeFragment","setModelTransformation","transform","bbox","rotation","scale","applyMatrix4","setVisibility","visible","geometryIDsAssetIDs","includeFragments","instancesID","lostTime","lod","assetID","count","Math","LOG10E","StreamFileDatabase","version","stores","files","IfcStreamingSettings","arguments","minGeometrySize","minAssetsSize","PropertiesStreamingSettings","propertiesSize","FragmentManager","meshes","allMeshes","fragID","list","onDisposed","baseCoordinationModel","onFragmentsLoaded","onFragmentsDisposed","uiElement","commands","_loader","_cards","tools","uuid","uiEnabled","setupUI","disposeUI","command","card","disposeGroup","groupID","fragmentIDs","indexOf","splice","updateWindow","load","coordinate","model","import","export","domElement","classList","className","buttonContainer","addChild","title","name","commandsButton","materialIcon","onClick","models","first","pop","baseModel","find","updateMatrix","coordinationMatrix","clone","invert","style","left","top","width","height","windowContent","slots","content","ui","main","tooltip","libraryUUIDs"],"sourceRoot":""}