-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
364 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,59 @@ | ||
// import * as THREE from "three"; | ||
// import { FragmentsGroup } from "bim-fragment"; | ||
// import { Component, UI, UIElement } from "../../base-types"; | ||
// import { Drawer } from "../../ui"; | ||
// import { Components, Simple2DScene } from "../../core"; | ||
// import { CivilUtils } from "../CivilUtils"; | ||
// | ||
// export class RoadElevationNavigator extends Component<any> implements UI { | ||
// static readonly uuid = "097eea29-2d5a-431a-a247-204d44670621" as const; | ||
// | ||
// enabled = true; | ||
// | ||
// uiElement = new UIElement<{ | ||
// drawer: Drawer; | ||
// }>(); | ||
// | ||
// scene: Simple2DScene; | ||
// | ||
// caster = new THREE.Raycaster(); | ||
// | ||
// private readonly _alignment: THREE.LineSegments; | ||
// | ||
// constructor(components: Components) { | ||
// super(components); | ||
// | ||
// this.caster.params.Line = { threshold: 5 }; | ||
// | ||
// this.components.tools.add(RoadElevationNavigator.uuid, this); | ||
// | ||
// this.scene = new Simple2DScene(this.components, false); | ||
// | ||
// this._alignment = new THREE.LineSegments( | ||
// new THREE.BufferGeometry(), | ||
// new THREE.LineBasicMaterial() | ||
// ); | ||
// | ||
// const scene = this.scene.get(); | ||
// scene.add(this._alignment); | ||
// | ||
// this.setUI(); | ||
// } | ||
// | ||
// get() { | ||
// return this._alignment; | ||
// } | ||
// | ||
// draw(model: FragmentsGroup) { | ||
// if (!model.ifcCivil) { | ||
// console.warn("The provided model doesn't have civil data!"); | ||
// return; | ||
// } | ||
// const alignment = model.ifcCivil.verticalAlignments; | ||
// const { geometry } = this._alignment; | ||
// CivilUtils.getAlignmentGeometry(alignment, geometry, false); | ||
// } | ||
// | ||
// private setUI() { | ||
// const drawer = new Drawer(this.components); | ||
// this.components.ui.add(drawer); | ||
// drawer.alignment = "top"; | ||
// | ||
// drawer.onVisible.add(() => { | ||
// this.scene.grid.regenerate(); | ||
// }); | ||
// drawer.visible = false; | ||
// | ||
// drawer.slots.content.domElement.style.padding = "0"; | ||
// drawer.slots.content.domElement.style.overflow = "hidden"; | ||
// | ||
// const { clientWidth, clientHeight } = drawer.domElement; | ||
// this.scene.setSize(clientHeight, clientWidth); | ||
// | ||
// const vContainer = this.scene.uiElement.get("container"); | ||
// drawer.addChild(vContainer); | ||
// | ||
// this.uiElement.set({ drawer }); | ||
// | ||
// if (this.components.renderer.isUpdateable()) { | ||
// this.components.renderer.onAfterUpdate.add(async () => { | ||
// if (drawer.visible) { | ||
// await this.scene.update(); | ||
// } | ||
// }); | ||
// } | ||
// } | ||
// } | ||
import { UI, UIElement } from "../../base-types"; | ||
import { Drawer } from "../../ui"; | ||
import { Components } from "../../core"; | ||
import { RoadNavigator } from "../RoadNavigator"; | ||
|
||
export class RoadElevationNavigator extends RoadNavigator implements UI { | ||
static readonly uuid = "097eea29-2d5a-431a-a247-204d44670621" as const; | ||
|
||
readonly view = "vertical"; | ||
|
||
uiElement = new UIElement<{ | ||
drawer: Drawer; | ||
}>(); | ||
|
||
constructor(components: Components) { | ||
super(components); | ||
this.setUI(); | ||
} | ||
|
||
get() { | ||
return null as any; | ||
} | ||
|
||
private setUI() { | ||
const drawer = new Drawer(this.components); | ||
this.components.ui.add(drawer); | ||
drawer.alignment = "top"; | ||
|
||
drawer.onVisible.add(() => { | ||
this.scene.grid.regenerate(); | ||
}); | ||
drawer.visible = false; | ||
|
||
drawer.slots.content.domElement.style.padding = "0"; | ||
drawer.slots.content.domElement.style.overflow = "hidden"; | ||
|
||
const { clientWidth, clientHeight } = drawer.domElement; | ||
this.scene.setSize(clientHeight, clientWidth); | ||
|
||
const vContainer = this.scene.uiElement.get("container"); | ||
drawer.addChild(vContainer); | ||
|
||
this.uiElement.set({ drawer }); | ||
|
||
drawer.onResized.add(() => { | ||
const width = window.innerWidth; | ||
const height = this.scene.size.y; | ||
this.scene.setSize(height, width); | ||
}); | ||
|
||
if (this.components.renderer.isUpdateable()) { | ||
this.components.renderer.onAfterUpdate.add(async () => { | ||
if (drawer.visible) { | ||
await this.scene.update(); | ||
} | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.