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,EAChB,MAAMI,EAAYL,EAAaM,eAC3BD,GAAiC,OAApBA,EAAUhF,OACvBrH,KAAKsH,uBAAuB+E,EAAUhF,MAAOT,EAAYY,EAEjE,EAEJhC,EAAciB,KAAO,uCACrB,sBAA+BjB,EAAciB,M","sources":["webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentPlans/src/plan-objects.js","webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentPlans/index.js"],"sourcesContent":["import * as THREE from \"three\";\r\nimport { CSS2DObject } from \"three/examples/jsm/renderers/CSS2DRenderer\";\r\nimport { FragmentBoundingBox } from \"../../FragmentBoundingBox\";\r\nimport { Button } from \"../../../ui\";\r\nimport { Event, UIElement } from \"../../../base-types\";\r\nexport class PlanObjects {\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(active) {\r\n this._visible = active;\r\n const scene = this.components.scene.get();\r\n for (const id in this._objects) {\r\n const { root, marker } = this._objects[id];\r\n if (active) {\r\n scene.add(root);\r\n root.add(marker);\r\n }\r\n else {\r\n root.removeFromParent();\r\n marker.removeFromParent();\r\n }\r\n }\r\n }\r\n constructor(components) {\r\n this.offsetFactor = 0.2;\r\n this.uiElement = new UIElement();\r\n this.planClicked = new Event();\r\n this._scale = new THREE.Vector2(1, 1);\r\n this._min = new THREE.Vector3();\r\n this._max = new THREE.Vector3();\r\n this._objects = {};\r\n this._visible = false;\r\n this._planeGeometry = new THREE.PlaneGeometry(1, 1, 1);\r\n this._linesGeometry = new THREE.BufferGeometry();\r\n this.lineMaterial = new THREE.LineDashedMaterial({\r\n color: 0xbcf124,\r\n dashSize: 0.2,\r\n gapSize: 0.2,\r\n });\r\n this._material = new THREE.MeshBasicMaterial({\r\n transparent: true,\r\n opacity: 0.3,\r\n color: 0x1a2128,\r\n depthTest: false,\r\n });\r\n this.components = components;\r\n this.resetBounds();\r\n this.createPlaneOutlineGeometry();\r\n if (components.uiEnabled) {\r\n this.setUI(components);\r\n }\r\n }\r\n async dispose() {\r\n this.planClicked.reset();\r\n this.visible = false;\r\n for (const id in this._objects) {\r\n const { marker, button, outline, root, plane } = this._objects[id];\r\n await button.dispose();\r\n outline.removeFromParent();\r\n outline.geometry = null;\r\n outline.material = [];\r\n root.removeFromParent();\r\n root.children = [];\r\n plane.removeFromParent();\r\n plane.material = [];\r\n plane.geometry = null;\r\n marker.element.remove();\r\n }\r\n this._objects = {};\r\n this._planeGeometry.dispose();\r\n this._material.dispose();\r\n this.uiElement.dispose();\r\n this.lineMaterial.dispose();\r\n this._material.dispose();\r\n this.components = null;\r\n }\r\n add(config) {\r\n const { id, point, name } = config;\r\n const root = new THREE.Group();\r\n root.position.copy(point);\r\n const plane = new THREE.Mesh(this._planeGeometry, this._material);\r\n plane.rotation.x = -Math.PI / 2;\r\n root.add(plane);\r\n const outline = new THREE.LineSegments(this._linesGeometry, this.lineMaterial);\r\n outline.computeLineDistances();\r\n outline.rotation.x = -Math.PI / 2;\r\n root.add(outline);\r\n const button = new Button(this.components, {\r\n materialIconName: \"location_on\",\r\n tooltip: name,\r\n });\r\n button.onClick.add(async () => {\r\n await this.planClicked.trigger({ id: config.id });\r\n });\r\n const { domElement } = button;\r\n domElement.classList.remove(\"bg-transparent\");\r\n domElement.className += \" transition-none rounded-full\";\r\n // element.className = this.pointClass;\r\n const marker = new CSS2DObject(domElement);\r\n root.add(marker);\r\n this._objects[id] = { root, plane, outline, marker, button };\r\n }\r\n setBounds(points, override = false) {\r\n if (override) {\r\n this.resetBounds();\r\n }\r\n const bbox = FragmentBoundingBox.getBounds(points, this._min, this._max);\r\n this._min = bbox.min;\r\n this._max = bbox.max;\r\n const dimensions = FragmentBoundingBox.getDimensions(bbox);\r\n const { width, depth, center } = dimensions;\r\n const offset = (width + depth / 2) * this.offsetFactor;\r\n const newScale = new THREE.Vector2(width + offset, depth + offset);\r\n const previousScaleMatrix = this.newScaleMatrix(this._scale);\r\n const newScaleMatrix = this.newScaleMatrix(newScale);\r\n previousScaleMatrix.invert();\r\n this._planeGeometry.applyMatrix4(previousScaleMatrix);\r\n this._linesGeometry.applyMatrix4(previousScaleMatrix);\r\n this._planeGeometry.applyMatrix4(newScaleMatrix);\r\n this._linesGeometry.applyMatrix4(newScaleMatrix);\r\n for (const id in this._objects) {\r\n const { root, outline } = this._objects[id];\r\n outline.computeLineDistances();\r\n root.position.x = center.x;\r\n root.position.z = center.z;\r\n }\r\n }\r\n setUI(components) {\r\n const button = new Button(components, {\r\n materialIconName: \"layers\",\r\n tooltip: \"3D Plans\",\r\n });\r\n button.onClick.add(() => {\r\n this.visible = !this.visible;\r\n });\r\n this.uiElement.set({ main: button });\r\n }\r\n resetBounds() {\r\n this._min = FragmentBoundingBox.newBound(true);\r\n this._max = FragmentBoundingBox.newBound(false);\r\n }\r\n newScaleMatrix(scale) {\r\n const { x, y } = scale;\r\n // prettier-ignore\r\n return new THREE.Matrix4().fromArray([\r\n x, 0, 0, 0,\r\n 0, y, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1\r\n ]);\r\n }\r\n createPlaneOutlineGeometry() {\r\n // prettier-ignore\r\n const vertices = new Float32Array([\r\n -0.5, -0.5, 0,\r\n -0.5, 0.5, 0,\r\n -0.5, 0.5, 0,\r\n 0.5, 0.5, 0,\r\n 0.5, 0.5, 0,\r\n 0.5, -0.5, 0,\r\n 0.5, -0.5, 0,\r\n -0.5, -0.5, 0,\r\n ]);\r\n const posAttr = new THREE.BufferAttribute(vertices, 3);\r\n this._linesGeometry.setAttribute(\"position\", posAttr);\r\n }\r\n}\r\n//# sourceMappingURL=plan-objects.js.map","import * as THREE from \"three\";\r\nimport * as WEBIFC from \"web-ifc\";\r\nimport { Component, Event, UIElement } from \"../../base-types\";\r\nimport { IfcPropertiesUtils } from \"../../ifc\";\r\nimport { PlanObjects } from \"./src/plan-objects\";\r\nimport { ToolComponent } from \"../../core\";\r\nimport { Button, FloatingWindow, SimpleUICard, SimpleUIComponent, Toolbar, CommandsMenu, } from \"../../ui\";\r\nimport { EdgesClipper, EdgesPlane } from \"../../navigation/EdgesClipper\";\r\n/**\r\n * Helper to control the camera and easily define and navigate 2D floor plans.\r\n */\r\nexport class FragmentPlans extends Component {\r\n get commands() {\r\n return this.uiElement.get(\"commandsMenu\").commands;\r\n }\r\n set commands(commands) {\r\n this.uiElement.get(\"commandsMenu\").commands =\r\n commands;\r\n }\r\n constructor(components) {\r\n super(components);\r\n /** {@link Disposable.onDisposed} */\r\n this.onDisposed = new Event();\r\n this.onNavigated = new Event();\r\n this.onExited = new Event();\r\n /** {@link Component.enabled} */\r\n this.enabled = false;\r\n /** The floorplan that is currently selected. */\r\n this.currentPlan = null;\r\n /** The offset from the clipping planes to their respective floor plan elevation. */\r\n this.defaultSectionOffset = 1.5;\r\n /** The offset of the 2D camera to the floor plan elevation. */\r\n this.defaultCameraOffset = 30;\r\n /** The created floor plans. */\r\n this.storeys = [];\r\n /** {@link UI.uiElement} */\r\n this.uiElement = new UIElement();\r\n this._plans = [];\r\n this._floorPlanViewCached = false;\r\n this._previousCamera = new THREE.Vector3();\r\n this._previousTarget = new THREE.Vector3();\r\n this._previousProjection = \"Perspective\";\r\n this.components.tools.add(FragmentPlans.uuid, this);\r\n this.objects = new PlanObjects(components);\r\n if (components.uiEnabled) {\r\n this.setUI(components);\r\n }\r\n }\r\n /** {@link Component.get} */\r\n get() {\r\n return this._plans;\r\n }\r\n /** {@link Disposable.dispose} */\r\n async dispose() {\r\n this.onExited.reset();\r\n this.onNavigated.reset();\r\n this.storeys = [];\r\n this._plans = [];\r\n await this.objects.dispose();\r\n await this.uiElement.dispose();\r\n await this.onDisposed.trigger(FragmentPlans.uuid);\r\n this.onDisposed.reset();\r\n }\r\n // TODO: Compute georreference matrix when generating fragmentsgroup\r\n // so that we can correctly add floors in georreferenced models\r\n // where the IfcSite / IfcBuilding have location information\r\n async computeAllPlanViews(model) {\r\n if (!model.properties) {\r\n throw new Error(\"Properties are needed to compute plan views!\");\r\n }\r\n const { properties } = model;\r\n const floorsProps = IfcPropertiesUtils.getAllItemsOfType(properties, WEBIFC.IFCBUILDINGSTOREY);\r\n const coordHeight = model.coordinationMatrix.elements[13];\r\n const units = IfcPropertiesUtils.getUnits(properties);\r\n for (const floor of floorsProps) {\r\n const floorHeight = { value: 0 };\r\n this.getAbsoluteFloorHeight(floor.ObjectPlacement.value, model.properties, floorHeight);\r\n const height = floorHeight.value * units + coordHeight;\r\n await this.create({\r\n name: floor.Name.value,\r\n id: floor.GlobalId.value,\r\n normal: new THREE.Vector3(0, -1, 0),\r\n point: new THREE.Vector3(0, height, 0),\r\n ortho: true,\r\n offset: this.defaultSectionOffset,\r\n });\r\n }\r\n const { min, max } = model.boundingBox;\r\n this.objects.setBounds([min, max]);\r\n }\r\n /**\r\n * Creates a new floor plan in the navigator.\r\n *\r\n * @param config - Necessary data to initialize the floor plan.\r\n */\r\n async create(config) {\r\n const previousPlan = this._plans.find((plan) => plan.id === config.id);\r\n if (previousPlan) {\r\n console.warn(`There's already a plan with the id: ${config.id}`);\r\n return;\r\n }\r\n const plane = await this.createClippingPlane(config);\r\n plane.visible = false;\r\n const plan = { ...config, plane };\r\n this._plans.push(plan);\r\n this.objects.add(config);\r\n }\r\n /**\r\n * Make the navigator go to the specified floor plan.\r\n *\r\n * @param id - Floor plan to go to.\r\n * @param animate - Whether to animate the camera transition.\r\n */\r\n async goTo(id, animate = false) {\r\n var _a;\r\n if (((_a = this.currentPlan) === null || _a === void 0 ? void 0 : _a.id) === id) {\r\n return;\r\n }\r\n this.objects.visible = false;\r\n await this.onNavigated.trigger({ id });\r\n this.storeCameraPosition();\r\n await this.hidePreviousClippingPlane();\r\n this.updateCurrentPlan(id);\r\n await this.activateCurrentPlan();\r\n if (!this.enabled) {\r\n await this.moveCameraTo2DPlanPosition(animate);\r\n this.enabled = true;\r\n }\r\n if (this.components.uiEnabled) {\r\n this.uiElement.get(\"exitButton\").enabled = true;\r\n }\r\n }\r\n /**\r\n * Deactivate navigator and go back to the previous view.\r\n *\r\n * @param animate - Whether to animate the camera transition.\r\n */\r\n async exitPlanView(animate = false) {\r\n if (!this.enabled)\r\n return;\r\n this.enabled = false;\r\n await this.onExited.trigger();\r\n this.cacheFloorplanView();\r\n const camera = this.components.camera;\r\n camera.setNavigationMode(\"Orbit\");\r\n await camera.setProjection(this._previousProjection);\r\n if (this.currentPlan && this.currentPlan.plane) {\r\n await this.currentPlan.plane.setEnabled(false);\r\n await this.currentPlan.plane.edges.setVisible(false);\r\n }\r\n this.currentPlan = null;\r\n await camera.controls.setLookAt(this._previousCamera.x, this._previousCamera.y, this._previousCamera.z, this._previousTarget.x, this._previousTarget.y, this._previousTarget.z, animate);\r\n if (this.components.uiEnabled) {\r\n this.uiElement.get(\"exitButton\").enabled = false;\r\n }\r\n }\r\n async updatePlansList() {\r\n if (!this.components.uiEnabled) {\r\n return;\r\n }\r\n const defaultText = this.uiElement.get(\"defaultText\");\r\n const planList = this.uiElement.get(\"planList\");\r\n const commandsMenu = this.uiElement.get(\"commandsMenu\");\r\n await planList.dispose(true);\r\n if (!this._plans.length) {\r\n defaultText.visible = true;\r\n return;\r\n }\r\n defaultText.visible = false;\r\n commandsMenu.update();\r\n const commandsExist = commandsMenu.hasCommands;\r\n for (const plan of this._plans) {\r\n const height = Math.trunc(plan.point.y * 10) / 10;\r\n const description = `Height: ${height}`;\r\n const simpleCard = new SimpleUICard(this.components);\r\n simpleCard.title = plan.name;\r\n simpleCard.description = description;\r\n const toolbar = new Toolbar(this.components);\r\n this.components.ui.addToolbar(toolbar);\r\n simpleCard.addChild(toolbar);\r\n toolbar.domElement.classList.remove(\"shadow-md\", \"backdrop-blur-xl\", \"bg-ifcjs-100\");\r\n const planButton = new Button(this.components, {\r\n materialIconName: \"arrow_outward\",\r\n });\r\n planButton.onClick.add(async () => {\r\n await this.goTo(plan.id);\r\n });\r\n toolbar.addChild(planButton);\r\n const extraButton = new Button(this.components, {\r\n materialIconName: \"expand_more\",\r\n });\r\n extraButton.onClick.add((event) => {\r\n if (event) {\r\n commandsMenu.commandData = plan;\r\n commandsMenu.popup(event.x, event.y);\r\n }\r\n });\r\n if (!commandsExist) {\r\n extraButton.enabled = false;\r\n }\r\n toolbar.addChild(extraButton);\r\n simpleCard.domElement.classList.remove(\"bg-ifcjs-120\");\r\n simpleCard.domElement.classList.remove(\"border-transparent\");\r\n simpleCard.domElement.className += ` min-w-[300px] my-2 border-1 border-solid border-[#3A444E] `;\r\n planList.addChild(simpleCard);\r\n }\r\n }\r\n setUI(components) {\r\n this.setupPlanObjectUI();\r\n const topButtonContainer = new SimpleUIComponent(this.components, `
`);\r\n const exitButton = new Button(components);\r\n exitButton.materialIcon = \"logout\";\r\n topButtonContainer.addChild(exitButton);\r\n exitButton.enabled = false;\r\n exitButton.onClick.add(() => this.exitPlanView());\r\n const main = new Button(components, {\r\n tooltip: \"Plans list\",\r\n });\r\n main.materialIcon = \"folder_copy\";\r\n const floatingWindow = new FloatingWindow(components);\r\n floatingWindow.title = \"Floor Plans\";\r\n components.ui.add(floatingWindow);\r\n floatingWindow.visible = false;\r\n floatingWindow.addChild(topButtonContainer);\r\n const planList = new SimpleUIComponent(components, ``);\r\n floatingWindow.addChild(planList);\r\n const defaultText = new SimpleUIComponent(components, `No plans yet.
`);\r\n floatingWindow.addChild(defaultText);\r\n const commandsMenu = new CommandsMenu(components);\r\n components.ui.add(commandsMenu);\r\n commandsMenu.visible = false;\r\n this.uiElement.set({\r\n main,\r\n floatingWindow,\r\n planList,\r\n defaultText,\r\n exitButton,\r\n commandsMenu,\r\n });\r\n main.onClick.add(() => {\r\n floatingWindow.visible = !floatingWindow.visible;\r\n });\r\n }\r\n storeCameraPosition() {\r\n if (this.enabled) {\r\n this.cacheFloorplanView();\r\n }\r\n else {\r\n this.store3dCameraPosition();\r\n }\r\n }\r\n async createClippingPlane(config) {\r\n const { normal, point } = config;\r\n const clippingPoint = point.clone();\r\n if (config.offset) {\r\n clippingPoint.y += config.offset;\r\n }\r\n const clipper = this.components.tools.get(EdgesClipper);\r\n const plane = clipper.createFromNormalAndCoplanarPoint(normal, clippingPoint);\r\n await plane.setEnabled(false);\r\n await plane.edges.update();\r\n await plane.edges.setVisible(false);\r\n return plane;\r\n }\r\n cacheFloorplanView() {\r\n this._floorPlanViewCached = true;\r\n const camera = this.components.camera;\r\n camera.controls.saveState();\r\n }\r\n async moveCameraTo2DPlanPosition(animate) {\r\n const camera = this.components.camera;\r\n if (this._floorPlanViewCached) {\r\n await camera.controls.reset(animate);\r\n }\r\n else {\r\n await camera.controls.setLookAt(0, 100, 0, 0, 0, 0, animate);\r\n }\r\n }\r\n async activateCurrentPlan() {\r\n if (!this.currentPlan)\r\n throw new Error(\"Current plan is not defined.\");\r\n const camera = this.components.camera;\r\n if (this.currentPlan.plane) {\r\n await this.currentPlan.plane.setEnabled(true);\r\n this.currentPlan.plane.edges.fillNeedsUpdate = true;\r\n await this.currentPlan.plane.edges.setVisible(true);\r\n }\r\n camera.setNavigationMode(\"Plan\");\r\n const projection = this.currentPlan.ortho ? \"Orthographic\" : \"Perspective\";\r\n await camera.setProjection(projection);\r\n }\r\n store3dCameraPosition() {\r\n const camera = this.components.camera;\r\n const activeCamera = this.components.camera.get();\r\n activeCamera.getWorldPosition(this._previousCamera);\r\n camera.controls.getTarget(this._previousTarget);\r\n this._previousProjection = camera.getProjection();\r\n }\r\n updateCurrentPlan(id) {\r\n const foundPlan = this._plans.find((plan) => plan.id === id);\r\n if (!foundPlan) {\r\n throw new Error(\"The specified plan is undefined!\");\r\n }\r\n this.currentPlan = foundPlan;\r\n }\r\n async hidePreviousClippingPlane() {\r\n if (this.currentPlan) {\r\n const plane = this.currentPlan.plane;\r\n if (plane) {\r\n await plane.setEnabled(false);\r\n }\r\n if (this.currentPlan.plane instanceof EdgesPlane) {\r\n await this.currentPlan.plane.edges.setVisible(false);\r\n }\r\n }\r\n }\r\n setupPlanObjectUI() {\r\n this.objects.planClicked.add(async ({ id }) => {\r\n const button = this.objects.uiElement.get(\"main\");\r\n if (!this.enabled) {\r\n if (button.innerElements.icon && button.innerElements.tooltip) {\r\n button.materialIcon = \"logout\";\r\n button.tooltip = \"Exit floorplans\";\r\n }\r\n button.onClick.add(() => {\r\n this.exitPlanView();\r\n if (button.innerElements.icon && button.innerElements.tooltip) {\r\n button.materialIcon = \"layers\";\r\n button.tooltip = \"3D plans\";\r\n }\r\n button.onClick.add(() => (this.objects.visible = !this.objects.visible));\r\n });\r\n }\r\n this.goTo(id);\r\n });\r\n }\r\n getAbsoluteFloorHeight(placementID, properties, height) {\r\n const placementRef = properties[placementID];\r\n if (!placementRef)\r\n return;\r\n const placement = properties[placementRef.RelativePlacement.value];\r\n const location = properties[placement.Location.value];\r\n const currentHeight = location.Coordinates[2].value;\r\n height.value += currentHeight;\r\n const parentRef = placementRef.PlacementRelTo;\r\n if (parentRef && parentRef.value !== null) {\r\n this.getAbsoluteFloorHeight(parentRef.value, properties, height);\r\n }\r\n }\r\n}\r\nFragmentPlans.uuid = \"a80874aa-1c93-43a4-80f2-df346da086b1\";\r\nToolComponent.libraryUUIDs.add(FragmentPlans.uuid);\r\n//# sourceMappingURL=index.js.map"],"names":["PlanObjects","visible","this","_visible","active","scene","components","get","id","_objects","root","marker","add","removeFromParent","constructor","offsetFactor","uiElement","planClicked","_scale","_min","_max","_planeGeometry","_linesGeometry","lineMaterial","color","dashSize","gapSize","_material","transparent","opacity","depthTest","resetBounds","createPlaneOutlineGeometry","uiEnabled","setUI","async","reset","button","outline","plane","dispose","geometry","material","children","element","remove","config","point","name","position","copy","rotation","x","Math","PI","computeLineDistances","materialIconName","tooltip","onClick","trigger","domElement","classList","className","setBounds","points","override","bbox","FragmentBoundingBox","min","max","dimensions","width","depth","center","offset","newScale","previousScaleMatrix","newScaleMatrix","invert","applyMatrix4","z","set","main","scale","y","fromArray","vertices","Float32Array","posAttr","setAttribute","FragmentPlans","commands","super","onDisposed","onNavigated","onExited","enabled","currentPlan","defaultSectionOffset","defaultCameraOffset","storeys","_plans","_floorPlanViewCached","_previousCamera","_previousTarget","_previousProjection","tools","uuid","objects","model","properties","Error","floorsProps","coordHeight","coordinationMatrix","elements","units","floor","floorHeight","value","getAbsoluteFloorHeight","ObjectPlacement","height","create","Name","GlobalId","normal","ortho","boundingBox","previousPlan","find","plan","console","warn","createClippingPlane","push","animate","_a","storeCameraPosition","hidePreviousClippingPlane","updateCurrentPlan","activateCurrentPlan","moveCameraTo2DPlanPosition","cacheFloorplanView","camera","setNavigationMode","setProjection","setEnabled","edges","setVisible","controls","setLookAt","defaultText","planList","commandsMenu","length","update","commandsExist","hasCommands","description","trunc","simpleCard","title","toolbar","ui","addToolbar","addChild","planButton","goTo","extraButton","event","commandData","popup","setupPlanObjectUI","topButtonContainer","exitButton","materialIcon","exitPlanView","floatingWindow","store3dCameraPosition","clippingPoint","clone","EdgesClipper","createFromNormalAndCoplanarPoint","saveState","fillNeedsUpdate","projection","getWorldPosition","getTarget","getProjection","foundPlan","innerElements","icon","placementID","placementRef","currentHeight","RelativePlacement","Location","Coordinates","parentRef","PlacementRelTo"],"sourceRoot":""}