@@ -31,12 +31,12 @@ export class IfcManager {
3131 ifc_objects : THREE . Object3D [ ] ,
3232 scene : THREE . Scene ,
3333 camera : THREE . PerspectiveCamera ,
34- mouse : THREE . Vector2
34+ renderer : THREE . WebGLRenderer
3535 ) {
3636 this . loader = new IFCLoader ( ) ;
3737 this . models = ifc_objects ;
3838 this . scene = scene ;
39- this . caster = new IFCRaycaster ( this . models , camera , mouse ) ;
39+ this . caster = new IFCRaycaster ( this . models , camera , renderer ) ;
4040 this . preselection = new IfcSelection ( this . loader , this . scene , this . preselectMat ) ;
4141 this . selection = new IfcSelection ( this . loader , this . scene , this . selectMat ) ;
4242 }
@@ -58,30 +58,32 @@ export class IfcManager {
5858 }
5959 }
6060
61- setWasmPath ( path : string ) {
61+ setWasmPath ( path : string ) {
6262 this . loader . setWasmPath ( path ) ;
6363 }
6464
6565 getSpatialStructure ( modelID : number , recursive = false ) {
6666 return this . loader . getSpatialStructure ( modelID , recursive ) ;
6767 }
6868
69- getProperties ( modelID : number , id : number , indirect = false ) {
69+ getProperties ( modelID : number , id : number , indirect : boolean , recursive : boolean ) {
70+ if ( modelID == null || id == null ) return null ;
7071 const props = this . loader . getItemProperties ( modelID , id ) ;
71- if ( indirect ) {
72- props . psets = this . loader . getPropertySets ( modelID , id , true ) ;
72+ if ( indirect ) {
73+ props . psets = this . loader . getPropertySets ( modelID , id , recursive ) ;
7374 props . type = this . loader . getTypeProperties ( modelID , id ) ;
7475 }
7576 console . log ( props ) ;
7677 return props ;
7778 }
7879
7980 preselect ( event : any ) {
80- const { modelID , id } = this . caster . castRay ( event , this . preselection . select ) ;
81+ this . caster . castRay ( event , this . preselection . select ) ;
8182 }
8283
83- select ( event : any ) {
84- const { modelID, id } = this . caster . castRay ( event , this . selection . select ) ;
85- return this . getProperties ( modelID , id , true ) ;
84+ select ( event : any , indirect : boolean , recursive : boolean ) {
85+ const result = this . caster . castRay ( event , this . selection . select ) ;
86+ if ( result == null || result . modelID == null || result . id == null ) return null ;
87+ return this . getProperties ( result . modelID , result . id , indirect , recursive ) ;
8688 }
8789}
0 commit comments