@thatopen/components 2.3.10 → 2.3.11
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/index.d.ts +1 -1
- package/dist/core/Viewpoints/src/viewpoint.d.ts +4 -4
- package/dist/index.cjs +11 -4
- package/dist/index.mjs +54 -31
- package/dist/namespace.d.ts +3262 -3262
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
|
|
|
6
6
|
/**
|
|
7
7
|
* The version of the @thatopen/components library.
|
|
8
8
|
*/
|
|
9
|
-
static readonly release = "2.3.
|
|
9
|
+
static readonly release = "2.3.11";
|
|
10
10
|
/** {@link Disposable.onDisposed} */
|
|
11
11
|
readonly onDisposed: Event<void>;
|
|
12
12
|
/**
|
|
@@ -35,7 +35,7 @@ export declare class Viewpoint implements BCFViewpoint {
|
|
|
35
35
|
* A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
|
|
36
36
|
* For this to work, call viewpoint.colorize()
|
|
37
37
|
*/
|
|
38
|
-
readonly componentColors: DataMap<
|
|
38
|
+
readonly componentColors: DataMap<THREE.Color, string[]>;
|
|
39
39
|
/**
|
|
40
40
|
* Boolean flags to allow fine control over the visibility of spaces.
|
|
41
41
|
* A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
|
|
@@ -163,6 +163,7 @@ export declare class Viewpoint implements BCFViewpoint {
|
|
|
163
163
|
* @throws An error if the world's renderer is not available.
|
|
164
164
|
*/
|
|
165
165
|
updateCamera(): void;
|
|
166
|
+
applyVisibility(): void;
|
|
166
167
|
/**
|
|
167
168
|
* Applies color to the components in the viewpoint based on their GUIDs.
|
|
168
169
|
*
|
|
@@ -173,14 +174,13 @@ export declare class Viewpoint implements BCFViewpoint {
|
|
|
173
174
|
* The color is applied using the `Classifier.setColor` method, which sets the color of the specified fragments.
|
|
174
175
|
* The color is provided as a hexadecimal string, prefixed with a '#'.
|
|
175
176
|
*/
|
|
176
|
-
|
|
177
|
+
applyColors(): void;
|
|
177
178
|
/**
|
|
178
179
|
* Resets the colors of all components in the viewpoint to their original color.
|
|
179
|
-
* This method iterates through the `componentColors` map, retrieves the fragment IDs
|
|
180
|
-
* corresponding to each color, and then uses the `Classifier` to reset the color of those fragments.
|
|
181
180
|
*/
|
|
182
181
|
resetColors(): void;
|
|
183
182
|
private createComponentTags;
|
|
183
|
+
private createColorTags;
|
|
184
184
|
/**
|
|
185
185
|
* Serializes the viewpoint into a buildingSMART compliant XML string for export.
|
|
186
186
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- If you're the tool creator, you can take one from https://www.uuidgenerator.net/.
|
|
4
4
|
|
|
5
|
-
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};C(Lt,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),C(Lt,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Kt=Lt;class ic extends mt{constructor(t,e){super(t);C(this,"onDisposed",new q);C(this,"onVertexFound",new q);C(this,"onVertexLost",new q);C(this,"onEnabled",new q);C(this,"components");C(this,"workingPlane",null);C(this,"_pickedPoint",null);C(this,"_config");C(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null),this.onEnabled.trigger(t)}get enabled(){return this._enabled}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(t){if(!this.enabled)return this._pickedPoint;const n=this.components.get(ve).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const r=this.getClosestVertex(n);return r?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(r))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(r))&&(this._pickedPoint=r.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new b.Vector3,s=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(t);if(r===null)return null;for(const o of r){if(!o)continue;const a=t.point.distanceTo(o);a>n||a>this._config.snapDistance||(s=!0,e=o,n=t.point.distanceTo(o))}return s?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const s=e.geometry,n=new b.Matrix4,{instanceId:r}=t,o=r!==void 0,a=e instanceof b.InstancedMesh;return a&&o&&e.getMatrixAt(r,n),[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(l=>(l&&(a&&o&&l.applyMatrix4(n),l.applyMatrix4(e.matrixWorld)),l))}getVertex(t,e){if(t===void 0)return null;const s=e.attributes.position;return new b.Vector3(s.getX(t),s.getY(t),s.getZ(t))}}const Rs=class Rs{constructor(){C(this,"onDisposed",new q);C(this,"list",new Map);C(this,"enabled",!1);C(this,"_clock");C(this,"onInit",new q);C(this,"update",()=>{if(!this.enabled)return;const i=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(i);requestAnimationFrame(this.update)});this._clock=new b.Clock,Rs.setupBVH()}add(i,t){if(this.list.has(i))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Kt.validate(i),this.list.set(i,t)}get(i){const t=i.uuid;if(!this.list.has(t)){const e=new i(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update(),this.onInit.trigger()}dispose(){this.enabled=!1;for(const[i,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){b.BufferGeometry.prototype.computeBoundsTree=Ha,b.BufferGeometry.prototype.disposeBoundsTree=Wa,b.Mesh.prototype.raycast=ka}};C(Rs,"release","2.3.10");let Li=Rs;class Hr extends Vs{constructor(){super(...arguments);C(this,"meshes",new Set);C(this,"onAfterUpdate",new q);C(this,"onBeforeUpdate",new q);C(this,"onDisposed",new q);C(this,"isDisposing",!1);C(this,"enabled",!0);C(this,"uuid",Kt.create());C(this,"name");C(this,"_scene");C(this,"_camera");C(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const s=this.components.get(Ce);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const n of this.meshes)s.destroy(n);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.components.get(Pi).list.delete(this.uuid),this.onDisposed.trigger(),this.onDisposed.reset()}}class ye{constructor(i,t,e,s){C(this,"_component");C(this,"name");C(this,"uuid");this._component=i,this.name=e,this.uuid=s??Kt.create(),t.get(Ne).list.set(this.uuid,this)}get controls(){const i={};for(const t in this._config){const e=this._config[t];i[t]=this.copyEntry(e)}return i}copyEntry(i){if(i.type==="Boolean"){const t=i;return{type:t.type,value:t.value}}if(i.type==="Color"){const t=i;return{type:t.type,value:t.value.clone()}}if(i.type==="Text"){const t=i;return{type:t.type,value:t.value}}if(i.type==="Number"){const t=i;return{type:t.type,value:t.value,min:t.min,max:t.max,interpolable:t.interpolable}}if(i.type==="Select"){const t=i;return{type:t.type,value:t.value,multiple:t.multiple,options:new Set(t.options)}}if(i.type==="Vector3"){const t=i;return{type:t.type,value:t.value.clone()}}if(i.type==="TextSet"){const t=i;return{type:t.type,value:new Set(t.value)}}if(i.type==="None"){const t=i;return{type:t.type,value:t.value}}throw new Error("Invalid entry!")}}const gs=class gs extends mt{constructor(t){super(t);C(this,"list",new Qt);C(this,"enabled",!0);t.add(gs.uuid,this)}};C(gs,"uuid","b8c764e0-6b24-4e77-9a32-35fa728ee5b4");let Ne=gs;class sc{constructor(i,t){C(this,"_list");C(this,"_scene");this._list=i,this._scene=t}get color(){return this._list.directionalLight.color.value}set color(i){this._list.directionalLight.color.value=i;for(const[,t]of this._scene.directionalLights)t.color.copy(i)}get intensity(){return this._list.directionalLight.intensity.value}set intensity(i){this._list.directionalLight.intensity.value=i;for(const[,t]of this._scene.directionalLights)t.intensity=i}get position(){return this._list.directionalLight.position.value.clone()}set position(i){this._list.directionalLight.position.value=i;for(const[,t]of this._scene.directionalLights)t.position.copy(i)}}class nc{constructor(i,t){C(this,"_list");C(this,"_scene");this._list=i,this._scene=t}get color(){return this._list.ambientLight.color.value}set color(i){this._list.ambientLight.color.value=i;for(const[,t]of this._scene.ambientLights)t.color.copy(i)}get intensity(){return this._list.ambientLight.intensity.value}set intensity(i){this._list.ambientLight.intensity.value=i;for(const[,t]of this._scene.ambientLights)t.intensity=i}}class Wr extends ye{constructor(){super(...arguments);C(this,"_config",{backgroundColor:{value:new b.Color,type:"Color"},ambientLight:{color:{type:"Color",value:new b.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2}},directionalLight:{color:{type:"Color",value:new b.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2},position:{type:"Vector3",value:new b.Vector3}}});C(this,"ambientLight",new nc(this._config,this._component));C(this,"directionalLight",new sc(this._config,this._component))}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(t){this._config.backgroundColor.value=t,this._component.three.background=t}}class Xr extends zr{constructor(t){super(t);C(this,"onSetup",new q);C(this,"isSetup",!1);C(this,"three");C(this,"config",new Wr(this,this.components,"Scene"));C(this,"_defaultConfig",{backgroundColor:new b.Color(2107698),directionalLight:{color:new b.Color("white"),intensity:1.5,position:new b.Vector3(5,10,3)},ambientLight:{color:new b.Color("white"),intensity:1}});this.three=new b.Scene,this.three.background=new b.Color(2107698)}setup(t){const e={...this._defaultConfig,...t};this.config.backgroundColor=e.backgroundColor;const s=e.ambientLight;this.config.ambientLight.color=s.color,this.config.ambientLight.intensity=s.intensity;const n=e.directionalLight;this.config.directionalLight.color=n.color,this.config.directionalLight.intensity=n.intensity,this.config.directionalLight.position=n.position,this.deleteAllLights();const{color:r,intensity:o}=this.config.directionalLight,a=new b.DirectionalLight(r,o);a.position.copy(n.position);const{color:l,intensity:h}=this.config.directionalLight,f=new b.AmbientLight(l,h);this.three.add(a,f),this.directionalLights.set(a.uuid,a),this.ambientLights.set(f.uuid,f),this.isSetup=!0,this.onSetup.trigger()}dispose(){super.dispose(),this.components.get(Ne).list.delete(this.config.uuid)}}class rc extends Gr{constructor(t,e,s){super(t);C(this,"enabled",!0);C(this,"container");C(this,"three");C(this,"_canvas");C(this,"_parameters");C(this,"_resizeObserver",null);C(this,"onContainerUpdated",new q);C(this,"_resizing",!1);C(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const e=t?t.x:this.container.clientWidth,s=t?t.y:this.container.clientHeight;this.three.setSize(e,s),this.onResize.trigger(new b.Vector2(e,s)),this._resizing=!1});C(this,"resizeEvent",()=>{this.resize()});C(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});C(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new b.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=e,this._parameters=s,this.three=new b.WebGLRenderer({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new b.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*!
|
|
5
|
+
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};C(Lt,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),C(Lt,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Kt=Lt;class ic extends mt{constructor(t,e){super(t);C(this,"onDisposed",new q);C(this,"onVertexFound",new q);C(this,"onVertexLost",new q);C(this,"onEnabled",new q);C(this,"components");C(this,"workingPlane",null);C(this,"_pickedPoint",null);C(this,"_config");C(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null),this.onEnabled.trigger(t)}get enabled(){return this._enabled}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(t){if(!this.enabled)return this._pickedPoint;const n=this.components.get(ve).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const r=this.getClosestVertex(n);return r?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(r))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(r))&&(this._pickedPoint=r.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new b.Vector3,s=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(t);if(r===null)return null;for(const o of r){if(!o)continue;const a=t.point.distanceTo(o);a>n||a>this._config.snapDistance||(s=!0,e=o,n=t.point.distanceTo(o))}return s?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const s=e.geometry,n=new b.Matrix4,{instanceId:r}=t,o=r!==void 0,a=e instanceof b.InstancedMesh;return a&&o&&e.getMatrixAt(r,n),[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(l=>(l&&(a&&o&&l.applyMatrix4(n),l.applyMatrix4(e.matrixWorld)),l))}getVertex(t,e){if(t===void 0)return null;const s=e.attributes.position;return new b.Vector3(s.getX(t),s.getY(t),s.getZ(t))}}const Rs=class Rs{constructor(){C(this,"onDisposed",new q);C(this,"list",new Map);C(this,"enabled",!1);C(this,"_clock");C(this,"onInit",new q);C(this,"update",()=>{if(!this.enabled)return;const i=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(i);requestAnimationFrame(this.update)});this._clock=new b.Clock,Rs.setupBVH()}add(i,t){if(this.list.has(i))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Kt.validate(i),this.list.set(i,t)}get(i){const t=i.uuid;if(!this.list.has(t)){const e=new i(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update(),this.onInit.trigger()}dispose(){this.enabled=!1;for(const[i,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){b.BufferGeometry.prototype.computeBoundsTree=Ha,b.BufferGeometry.prototype.disposeBoundsTree=Wa,b.Mesh.prototype.raycast=ka}};C(Rs,"release","2.3.11");let Li=Rs;class Hr extends Vs{constructor(){super(...arguments);C(this,"meshes",new Set);C(this,"onAfterUpdate",new q);C(this,"onBeforeUpdate",new q);C(this,"onDisposed",new q);C(this,"isDisposing",!1);C(this,"enabled",!0);C(this,"uuid",Kt.create());C(this,"name");C(this,"_scene");C(this,"_camera");C(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const s=this.components.get(Ce);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const n of this.meshes)s.destroy(n);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.components.get(Pi).list.delete(this.uuid),this.onDisposed.trigger(),this.onDisposed.reset()}}class ye{constructor(i,t,e,s){C(this,"_component");C(this,"name");C(this,"uuid");this._component=i,this.name=e,this.uuid=s??Kt.create(),t.get(Ne).list.set(this.uuid,this)}get controls(){const i={};for(const t in this._config){const e=this._config[t];i[t]=this.copyEntry(e)}return i}copyEntry(i){if(i.type==="Boolean"){const t=i;return{type:t.type,value:t.value}}if(i.type==="Color"){const t=i;return{type:t.type,value:t.value.clone()}}if(i.type==="Text"){const t=i;return{type:t.type,value:t.value}}if(i.type==="Number"){const t=i;return{type:t.type,value:t.value,min:t.min,max:t.max,interpolable:t.interpolable}}if(i.type==="Select"){const t=i;return{type:t.type,value:t.value,multiple:t.multiple,options:new Set(t.options)}}if(i.type==="Vector3"){const t=i;return{type:t.type,value:t.value.clone()}}if(i.type==="TextSet"){const t=i;return{type:t.type,value:new Set(t.value)}}if(i.type==="None"){const t=i;return{type:t.type,value:t.value}}throw new Error("Invalid entry!")}}const gs=class gs extends mt{constructor(t){super(t);C(this,"list",new Qt);C(this,"enabled",!0);t.add(gs.uuid,this)}};C(gs,"uuid","b8c764e0-6b24-4e77-9a32-35fa728ee5b4");let Ne=gs;class sc{constructor(i,t){C(this,"_list");C(this,"_scene");this._list=i,this._scene=t}get color(){return this._list.directionalLight.color.value}set color(i){this._list.directionalLight.color.value=i;for(const[,t]of this._scene.directionalLights)t.color.copy(i)}get intensity(){return this._list.directionalLight.intensity.value}set intensity(i){this._list.directionalLight.intensity.value=i;for(const[,t]of this._scene.directionalLights)t.intensity=i}get position(){return this._list.directionalLight.position.value.clone()}set position(i){this._list.directionalLight.position.value=i;for(const[,t]of this._scene.directionalLights)t.position.copy(i)}}class nc{constructor(i,t){C(this,"_list");C(this,"_scene");this._list=i,this._scene=t}get color(){return this._list.ambientLight.color.value}set color(i){this._list.ambientLight.color.value=i;for(const[,t]of this._scene.ambientLights)t.color.copy(i)}get intensity(){return this._list.ambientLight.intensity.value}set intensity(i){this._list.ambientLight.intensity.value=i;for(const[,t]of this._scene.ambientLights)t.intensity=i}}class Wr extends ye{constructor(){super(...arguments);C(this,"_config",{backgroundColor:{value:new b.Color,type:"Color"},ambientLight:{color:{type:"Color",value:new b.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2}},directionalLight:{color:{type:"Color",value:new b.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2},position:{type:"Vector3",value:new b.Vector3}}});C(this,"ambientLight",new nc(this._config,this._component));C(this,"directionalLight",new sc(this._config,this._component))}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(t){this._config.backgroundColor.value=t,this._component.three.background=t}}class Xr extends zr{constructor(t){super(t);C(this,"onSetup",new q);C(this,"isSetup",!1);C(this,"three");C(this,"config",new Wr(this,this.components,"Scene"));C(this,"_defaultConfig",{backgroundColor:new b.Color(2107698),directionalLight:{color:new b.Color("white"),intensity:1.5,position:new b.Vector3(5,10,3)},ambientLight:{color:new b.Color("white"),intensity:1}});this.three=new b.Scene,this.three.background=new b.Color(2107698)}setup(t){const e={...this._defaultConfig,...t};this.config.backgroundColor=e.backgroundColor;const s=e.ambientLight;this.config.ambientLight.color=s.color,this.config.ambientLight.intensity=s.intensity;const n=e.directionalLight;this.config.directionalLight.color=n.color,this.config.directionalLight.intensity=n.intensity,this.config.directionalLight.position=n.position,this.deleteAllLights();const{color:r,intensity:o}=this.config.directionalLight,a=new b.DirectionalLight(r,o);a.position.copy(n.position);const{color:l,intensity:h}=this.config.directionalLight,f=new b.AmbientLight(l,h);this.three.add(a,f),this.directionalLights.set(a.uuid,a),this.ambientLights.set(f.uuid,f),this.isSetup=!0,this.onSetup.trigger()}dispose(){super.dispose(),this.components.get(Ne).list.delete(this.config.uuid)}}class rc extends Gr{constructor(t,e,s){super(t);C(this,"enabled",!0);C(this,"container");C(this,"three");C(this,"_canvas");C(this,"_parameters");C(this,"_resizeObserver",null);C(this,"onContainerUpdated",new q);C(this,"_resizing",!1);C(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const e=t?t.x:this.container.clientWidth,s=t?t.y:this.container.clientHeight;this.three.setSize(e,s),this.onResize.trigger(new b.Vector2(e,s)),this._resizing=!1});C(this,"resizeEvent",()=>{this.resize()});C(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});C(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new b.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=e,this._parameters=s,this.three=new b.WebGLRenderer({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new b.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*!
|
|
6
6
|
* camera-controls
|
|
7
7
|
* https://github.com/yomotsu/camera-controls
|
|
8
8
|
* (c) 2017 @yomotsu
|
|
@@ -223,9 +223,15 @@ ${r}
|
|
|
223
223
|
${o}
|
|
224
224
|
</Users>`:""}
|
|
225
225
|
</Extensions>
|
|
226
|
-
`}processMarkupComment(t){const{Guid:e,Date:s,Author:n,Comment:r,Viewpoint:o}=t;if(!(e&&s&&n&&(Cs||o)))return null;const a=this.components.get(Zt),l=new Cs(this.components,r??"");return l.guid=e,l.date=new Date(s),l.author=n,l.viewpoint=o!=null&&o.Guid?a.list.get(o.Guid):void 0,l.modifiedAuthor=t.ModifiedAuthor,l.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,l}getMarkupComments(t,e){var o;let s;if(e==="2.1"&&(s=t.Comment),e==="3"&&(s=(o=t.Topic.Comments)==null?void 0:o.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map(a=>this.processMarkupComment(a)).filter(a=>a);return Array.isArray(n)?n:[n]}getMarkupLabels(t,e){var r;let s;return e==="2.1"&&(s=t.Topic.Labels),e==="3"&&(s=(r=t.Topic.Labels)==null?void 0:r.Label),s?Array.isArray(s)?s:[s]:[]}getMarkupViewpoints(t,e){var n;let s;return e==="2.1"&&(s=t.Viewpoints),e==="3"&&(s=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(t,e){var r;let s;return e==="2.1"&&(s=t.Topic.RelatedTopic),e==="3"&&(s=(r=t.Topic.RelatedTopics)==null?void 0:r.RelatedTopic),s?(Array.isArray(s)?s:[s]).map(o=>o.Guid):[]}async load(t,e){var m;const{fallbackVersionOnImport:s,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new Lr;await o.loadAsync(t);const a=Object.values(o.files);let l=s;const h=a.find(F=>F.name.endsWith(".version"));if(h){const F=await h.async("string"),R=Fe.xmlParser.parse(F).Version.VersionId;l=String(R)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const f=a.find(F=>F.name.endsWith(".extensions"));if(r&&f){const F=await f.async("string");Fo(this,F)}const I=[],u=this.components.get(Zt),d=a.filter(F=>F.name.endsWith(".bcfv"));for(const F of d){const R=await F.async("string"),S=Fe.xmlParser.parse(R).VisualizationInfo;if(!S){console.warn("Missing VisualizationInfo in Viewpoint");continue}const O={},{Guid:y,ClippingPlanes:w,Components:P,OrthogonalCamera:v,PerspectiveCamera:G}=S;if(y&&(O.guid=y),P){const{Selection:D,Visibility:g}=P;if(D&&D.Component){const Q=Array.isArray(D.Component)?D.Component:[D.Component];O.selectionComponents=Q.map(z=>z.IfcGuid).filter(z=>z)}if(g&&"DefaultVisibility"in g&&(O.defaultVisibility=g.DefaultVisibility),g&&g.Exceptions&&"Component"in g.Exceptions){const{Component:Q}=g.Exceptions,z=Array.isArray(Q)?Q:[Q];O.exceptionComponents=z.map(et=>et.IfcGuid).filter(et=>et)}let U;l==="2.1"&&(U=P.ViewSetupHints),l==="3"&&(U=(m=P.Visibility)==null?void 0:m.ViewSetupHints),U&&("OpeningsVisible"in U&&(O.openingsVisible=U.OpeningsVisible),"SpacesVisible"in U&&(O.spacesVisible=U.SpacesVisible),"SpaceBoundariesVisible"in U&&(O.spaceBoundariesVisible=U.SpaceBoundariesVisible))}if(v||G){const D=S.PerspectiveCamera??S.OrthogonalCamera,{CameraViewPoint:g,CameraDirection:U}=D,Q=new b.Vector3(Number(g.X),Number(g.Z),Number(-g.Y)),z=new b.Vector3(Number(U.X),Number(U.Z),Number(-U.Y)),et={position:{x:Q.x,y:Q.y,z:Q.z},direction:{x:z.x,y:z.y,z:z.z},aspectRatio:"AspectRatio"in D?D.AspectRatio:1};"ViewToWorldScale"in D&&(O.camera={...et,viewToWorldScale:D.ViewToWorldScale}),"FieldOfView"in D&&(O.camera={...et,fov:D.FieldOfView})}const N=new kn(this.components,e,{data:O,setCamera:!1});if(P){const{Coloring:D}=P;if(D&&D.Color){const g=Array.isArray(D.Color)?D.Color:[D.Color];for(const U of g){const{Color:Q,Component:z}=U,X=(Array.isArray(z)?z:[z]).map(nt=>nt.IfcGuid);N.componentColors.set(Q,X)}}}if(I.push(N),w){const D=this.components.get(Is),g=Array.isArray(w.ClippingPlane)?w.ClippingPlane:[w.ClippingPlane];for(const U of g){const{Location:Q,Direction:z}=U;if(!(Q&&z))continue;const et=new b.Vector3(Q.X,Q.Z,-Q.Y),X=new b.Vector3(z.X,-z.Z,z.Y),nt=D.createFromNormalAndCoplanarPoint(e,X,et);nt.visible=!1,nt.enabled=!1,N.clippingPlanes.add(nt)}}}const E={},T=[],p=a.filter(F=>F.name.endsWith(".bcf"));for(const F of p){const R=await F.async("string"),S=Fe.xmlParser.parse(R).Markup,O=S.Topic,{Guid:y,TopicType:w,TopicStatus:P,Title:v,CreationDate:G,CreationAuthor:N}=O;if(n&&!(y&&w&&P&&v&&G&&N))continue;const D=new Mi(this.components);D.guid=y??D.guid;const g=this.getMarkupRelatedTopics(S,l);E[D.guid]=new Set(g),D.type=w??D.type,D.status=P??D.status,D.title=v??D.title,D.creationDate=G?new Date(G):D.creationDate,D.creationAuthor=N??D.creationAuthor,D.serverAssignedId=O.ServerAssignedId,D.priority=O.Priority,D.index=O.Index,D.modifiedDate=O.ModifiedDate?new Date(O.ModifiedDate):void 0,D.modifiedAuthor=O.ModifiedAuthor,D.dueDate=O.DueDate?new Date(O.DueDate):void 0,D.assignedTo=O.AssignedTo,D.description=O.Description,D.stage=O.Stage;const U=this.getMarkupLabels(S,l);for(const et of U)D.labels.add(et);const Q=this.getMarkupComments(S,l);for(const et of Q)D.comments.set(et.guid,et);const z=this.getMarkupViewpoints(S,l);for(const et of z){if(!(et&&et.Guid))continue;const X=u.list.get(et.Guid);X&&D.viewpoints.add(X.guid)}this.list.set(D.guid,D),T.push(D)}for(const F in E){const R=this.list.get(F);if(!R)continue;const S=E[F];for(const O of S)R.relatedTopics.add(O)}return this.onBCFImported.trigger(T),{viewpoints:I,topics:T}}};C(Fe,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),C(Fe,"xmlParser",new Ao.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Mt=Fe;const ie=class ie extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"onDisposed",new q);C(this,"_absoluteMin");C(this,"_absoluteMax");C(this,"_meshes",[]);this.components.add(ie.uuid,this),this._absoluteMin=ie.newBound(!0),this._absoluteMax=ie.newBound(!1)}static getDimensions(t){const{min:e,max:s}=t,n=Math.abs(s.x-e.x),r=Math.abs(s.y-e.y),o=Math.abs(s.z-e.z),a=new b.Vector3;return a.subVectors(s,e).divideScalar(2).add(e),{width:n,height:r,depth:o,center:a}}static newBound(t){const e=t?1:-1;return new b.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,s){const n=s||this.newBound(!1),r=e||this.newBound(!0);for(const o of t)o.x<r.x&&(r.x=o.x),o.y<r.y&&(r.y=o.y),o.z<r.z&&(r.z=o.z),o.x>n.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new b.Box3(e,s)}dispose(){const t=this.components.get(Ce);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(ie.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new b.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),s=Math.abs((e.x-t.x)/2),n=Math.abs((e.y-t.y)/2),r=Math.abs((e.z-t.z)/2),o=new b.Vector3(t.x+s,t.y+n,t.z+r),a=o.distanceTo(t);return new b.Sphere(o,a)}getMesh(){const t=new b.Box3(this._absoluteMin,this._absoluteMax),e=ie.getDimensions(t),{width:s,height:n,depth:r,center:o}=e,a=new b.BoxGeometry(s,n,r),l=new b.Mesh(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=ie.newBound(!0),this._absoluteMax=ie.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const s=ie.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new b.Matrix4,o=t instanceof b.InstancedMesh,a=new Set;if(t instanceof jt.FragmentMesh){e||(e=t.fragment.ids);for(const l of e){const h=t.fragment.getInstancesIDs(l);if(h)for(const f of h)a.add(f)}}else a.add(0);for(const l of a){const h=s.min.clone(),f=s.max.clone();o&&(t.getMatrixAt(l,r),h.applyMatrix4(r),f.applyMatrix4(r)),h.applyMatrix4(n),f.applyMatrix4(n),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),f.x>this._absoluteMax.x&&(this._absoluteMax.x=f.x),f.y>this._absoluteMax.y&&(this._absoluteMax.y=f.y),f.z>this._absoluteMax.z&&(this._absoluteMax.z=f.z),f.x<this._absoluteMin.x&&(this._absoluteMin.x=f.x),f.y<this._absoluteMin.y&&(this._absoluteMin.y=f.y),f.z<this._absoluteMin.z&&(this._absoluteMin.z=f.z)}}addFragmentIdMap(t){const e=this.components.get(pt);for(const s in t){const n=e.list.get(s);if(!n)continue;const r=t[s];this.addMesh(n.mesh,r)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,r=new b.Vector3(s,s,s),o=new b.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let l=0;l<a.length;l++){if(l%3===0&&a[l]===0&&a[l+1]===0&&a[l+2]===0){l+=2;continue}const h=a[l],f=e.getX(h),I=e.getY(h),u=e.getZ(h);f<r.x&&(r.x=f),I<r.y&&(r.y=I),u<r.z&&(r.z=u),f>o.x&&(o.x=f),I>o.y&&(o.y=I),u>o.z&&(o.z=u)}return new b.Box3(r,o)}};C(ie,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Ts=ie;const ys=class ys{constructor(i){C(this,"onProgress",new q);C(this,"inclusive",!1);C(this,"rules",[]);C(this,"ids",{});C(this,"needsUpdate",new Map);C(this,"components");this.components=i}static import(i,t){const e=ys.importers.get(t.type);return e?e(i,t):(console.warn("Invalid query data:.",t),null)}static importRules(i){const t=[];for(const e of i){const s={};for(const n in e){const r=e[n];r.regexp?s[n]=new RegExp(r.value):s[n]=r}t.push(s)}return t}static importIds(i){const t={};for(const e in i.ids)t[e]=new Set(i.ids[e]);return t}clear(i){if(i===void 0){this.ids={},this.needsUpdate.clear();return}delete this.ids[i],this.needsUpdate.delete(i)}addID(i,t){this.ids[i]||(this.ids[i]=new Set),this.ids[i].add(t)}getData(){const i={};for(const e in this.ids)i[e]=Array.from(this.ids[e]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:i,rules:t}}exportRules(){const i=[];for(const t of this.rules){const e={};for(const s in t){const n=t[s];n instanceof RegExp?e[s]={regexp:!0,value:n.source}:e[s]=n}i.push(e)}return i}findInFile(i,t){return new Promise(e=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1e4*1024,o=1e3;let a=0;const l=/;/,h=()=>{if(a>=t.size){e();return}const f=Math.min(a+r+o,t.size),I=t.slice(a,f);s.readAsArrayBuffer(I)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const f=new Uint8Array(s.result),u=n.decode(f).split(l);u.shift(),this.findInLines(i,u),this.onProgress.trigger(a/t.size),a+=r,h()},h()})}getIdFromLine(i){const t=i.slice(i.indexOf("#")+1,i.indexOf("="));return parseInt(t,10)}testRules(i){let t=null,e=null,s=null,n=!1;for(const r of this.rules){if(r.type==="category"){if(t===null&&(t=this.getCategoryFromLine(i),t===null)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0;continue}if(e===null&&(e=this.getAttributesFromLine(i),e===null)){if(this.inclusive)continue;n=!1;break}if(t===null&&(t=this.getCategoryFromLine(i),t===null)){if(this.inclusive)continue;n=!1;break}if(s===null&&(s=Object.keys(new k.IFC4[t]),s=s.slice(2),s===null)){if(this.inclusive)continue;n=!1;break}if(r.type==="property"){const{name:o,value:a}=r;if(!a.test(i)){if(this.inclusive)continue;n=!1;break}let l=!1;for(let h=0;h<e.length;h++){const f=e[h],I=s[h];if(a.test(f)&&o.test(I)){l=!0;break}}if(l)n=!0;else if(!this.inclusive){n=!1;break}}if(r.type==="operator"){const{name:o,value:a,operator:l}=r;let h=!1;for(let f=0;f<e.length;f++){const I=s[f],u=e[f].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(o.test(I)){if(l==="="&&parseFloat(u)===a){h=!0;break}else if(l==="<"&&parseFloat(u)<a){h=!0;break}else if(l===">"&&parseFloat(u)>a){h=!0;break}else if(l===">="&&parseFloat(u)>=a){h=!0;break}else if(l==="<="&&parseFloat(u)<=a){h=!0;break}}}if(h)n=!0;else if(!this.inclusive){n=!1;break}}}return n}getCategoryFromLine(i){const t=i.indexOf("=")+1,e=i.indexOf("("),s=i.slice(t,e).trim(),n=ao[s];return n||null}getAttributesFromLine(i){const t=/\((.*)\)/,e=i.match(t);if(!(e&&e[1]))return null;const s=/,(?![^()]*\))/g;return e[1].split(s).map(r=>r.trim())}};C(ys,"importers",new Map);let qt=ys;class br{constructor(i){C(this,"list",new Map);C(this,"id",b.MathUtils.generateUUID());C(this,"mode","intersect");C(this,"_components");this._components=i}get queries(){return new Set(this.list.values())}get items(){const i=[];for(const t of this.queries)i.push(t.items);return this.mode==="combine"?jt.FragmentUtils.combine(i):jt.FragmentUtils.intersect(i)}add(i){if(this.list.has(i.name))throw new Error(`This group already has a query with the name ${i.name}.`);this.list.set(i.name,i)}clear(i){for(const t of this.queries)t.clear(i)}import(i){this.mode=i.mode,this.id=i.id;for(const t in i.queries){const e=qt.import(this._components,i.queries[t]);e&&this.list.set(t,e)}}export(){const i={};for(const[t,e]of this.list)i[t]=e.export();return{mode:this.mode,id:this.id,queries:i}}async update(i,t){for(const e of this.queries){const s=e.needsUpdate.get(i);(s===void 0||s)&&await e.update(i,t)}}}const Ls=class Ls extends qt{constructor(t,e){super(t);C(this,"name");this.name=e.name,this.rules=e.rules,this.inclusive=e.inclusive}get items(){const t=this.components.get(pt),e=[];for(const s in this.ids){const n=this.ids[s],r=t.groups.get(s);if(!r){console.warn(`Model ${s} not found!`);continue}const o=r.getFragmentMap(n);e.push(o)}return jt.FragmentUtils.combine(e)}export(){const t=this.getData();return t.type=Ls.type,t}async update(t,e){this.ids[t]=new Set,await this.findInFile(t,e),this.needsUpdate.set(t,!1)}findInLines(t,e){for(const s of e)if(this.testRules(s)){const r=this.getIdFromLine(s);this.addID(t,r)}}};C(Ls,"type","IfcBasicQuery");let wi=Ls;qt.importers.set(wi.type,(c,i)=>{const t=new wi(c,{name:i.name,rules:qt.importRules(i.rules),inclusive:i.inclusive});return t.ids=qt.importIds(i),t});const Ps=class Ps extends qt{constructor(t,e){super(t);C(this,"name");C(this,"psets",[]);this.name=e.name,this.rules=e.rules,this.inclusive=e.inclusive}get items(){const t=this.components.get(Bt),e=this.components.get(pt),s=[];for(const n in this.ids){const r=e.groups.get(n);if(!r){console.log(`Model not found: ${n}.`);continue}const o=this.ids[n];for(const a of o){const l=t.getEntityRelations(n,a,"DefinesOcurrence");if(l){const h=r.getFragmentMap(l);s.push(h)}}}return jt.FragmentUtils.combine(s)}export(){const t=this.getData();return t.type=Ps.type,t}async update(t,e){await this.findInFile(t,e);const s=new Set;for(const n of this.psets){const r=this.getAttributesFromLine(n);if(r===null)continue;const o=r[4].replace("(","[").replace(")","]").replace(/#/g,""),a=JSON.parse(o);for(const l of a){const h=this.ids[t];if(h&&h.has(l)){const f=this.getIdFromLine(n);s.add(f);break}}}this.ids[t]=s,this.psets=[],this.needsUpdate.set(t,!1)}findInLines(t,e){for(const s of e){const n=this.getCategoryFromLine(s);if(n==="IfcPropertySet"){this.psets.push(s);continue}if(n!=="IfcPropertySingleValue")continue;if(this.testRules(s)){const o=this.getIdFromLine(s);this.addID(t,o)}}}};C(Ps,"type","IfcPropertyQuery");let Di=Ps;qt.importers.set(Di.type,(c,i)=>{const t=new Di(c,{name:i.name,inclusive:i.inclusive,rules:qt.importRules(i.rules)});return t.ids=qt.importIds(i),t});const _s=class _s extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"list",new Map);t.add(_s.uuid,this)}get queries(){const t=new Set;for(const[,e]of this.list)for(const s of e.queries)t.add(s);return t}import(t){for(const e in t){const s=new br(this.components);s.import(t[e]),this.list.set(e,s)}}export(){const t={};for(const[e,s]of this.list)t[e]=s.export();return t}create(){const t=new br(this.components);return this.list.set(t.id,t),t}delete(t){this.list.delete(t)}clear(){this.list.clear()}};C(_s,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let yn=_s;const Ms=class Ms extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"list",{});C(this,"onDisposed",new q);C(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:s}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(e))delete r[e],Object.values(r).length===0&&delete this.list[n];else for(const a of o){const l=r[a];for(const h of s)delete l.map[h];Object.values(l).length===0&&delete r[a]}}});t.add(Ms.uuid,this),t.get(pt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(pt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const s=this.list[e];for(const n in s){const r=s[n];delete r.map[t]}}}find(t){const e=this.components.get(pt);if(!t){const o={};for(const[a,l]of e.list)o[a]=new Set(l.ids);return o}const s=Object.keys(t).length,n={};for(const o in t){const a=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const f in h.map){n[f]||(n[f]=new Map);for(const I of h.map[f]){const u=n[f].get(I);u===void 0?n[f].set(I,1):n[f].set(I,u+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===s&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(t,e){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={map:{},id:null,name:t});const n=s[t];for(const[r,o]of e.data){const a=o[0];for(const l of a){const h=e.keyFragments.get(l);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(r))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,s=t.getAllPropertiesIDs();for(const r of s){const o=await t.getProperties(r);if(!o)continue;const a=String((n=o.PredefinedType)==null?void 0:n.value).toUpperCase();e[a]||(e[a]={map:{},id:null,name:a});const l=e[a];for(const[h,f]of t.data){const I=f[0];for(const u of I){const d=t.keyFragments.get(u);if(!d)throw new Error("Fragment ID not found!");l.map[d]||(l.map[d]=new Set),l.map[d].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,s]of t.data){const r=s[1][1],o=_i[r];this.saveItem(t,"entities",o,e)}}async byIfcRel(t,e,s){be.isRel(e)&&await be.getRelationMap(t,e,async(n,r)=>{const{name:o}=await be.getEntityName(t,n);for(const a of r)this.saveItem(t,s,o??"NO REL NAME",a)})}async bySpatialStructure(t,e={}){var l,h;const s=this.components.get(Bt),n=s.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const r="spatialStructures",a=e.useProperties===void 0||e.useProperties;for(const[f]of n){if(e.isolate){const E=t.data.get(f);if(!E)continue;const T=E[1][1];if(T===void 0||!e.isolate.has(T))continue}const I=s.getEntityRelations(t,f,"Decomposes");if(I)for(const E of I){let T=E.toString();if(a){const p=await t.getProperties(E);if(!p)continue;T=(l=p.Name)==null?void 0:l.value}this.saveItem(t,r,T,f,E)}const u=s.getEntityRelations(t,f,"ContainsElements");if(!u)continue;let d=f.toString();if(a){const E=await t.getProperties(f);if(!E)continue;d=(h=E.Name)==null?void 0:h.value}for(const E of u){this.saveItem(t,r,d,E,f);const T=s.getEntityRelations(t,Number(E),"IsDecomposedBy");if(T)for(const p of T)this.saveItem(t,r,d,p,f)}}}setColor(t,e,s=!1){const n=this.components.get(pt);for(const r in t){const o=n.list.get(r);if(!o)continue;const a=t[r];o.setColor(e,a,s)}}resetColor(t){const e=this.components.get(pt);for(const s in t){const n=e.list.get(s);if(!n)continue;const r=t[s];n.resetColor(r)}}saveItem(t,e,s,n,r=null){this.list[e]||(this.list[e]={});const o=t.data.get(n);if(o)for(const a of o[0]){const l=t.keyFragments.get(a);if(l){const h=this.list[e];h[s]||(h[s]={map:{},id:r,name:s}),h[s].map[l]||(h[s].map[l]=new Set),h[s].map[l].add(n)}}}};C(Ms,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let ti=Ms;const ws=class ws extends mt{constructor(t){super(t);C(this,"onDisposed",new q);C(this,"enabled",!0);C(this,"height",10);C(this,"groupName","spatialStructures");C(this,"list",new Set);t.add(ws.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(ti),s=this.components.get(pt),n=t?1:-1;let r=0;const o=e.list[this.groupName],a=new b.Matrix4;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l].map){const f=s.list.get(h),I=l+h,u=this.list.has(I);if(!f||t&&u||!t&&!u)continue;t?this.list.add(I):this.list.delete(I);const d=o[l].map[h];f.applyTransform(d,a),f.mesh.computeBoundingSphere(),f.mesh.computeBoundingBox()}r++}}};C(ws,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Ln=ws;const Ds=class Ds extends mt{constructor(t){super(t);C(this,"enabled",!0);this.components.add(Ds.uuid,this)}set(t,e){const s=this.components.get(pt);if(!e){for(const[n,r]of s.list)r&&(r.setVisibility(t),this.updateCulledVisibility(r));return}for(const n in e){const r=e[n],o=s.list.get(n);o&&(o.setVisibility(t,r),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(fs);for(const[s,n]of e.list){const r=n.colorMeshes.get(t.id);r&&(r.count=t.mesh.count)}}};C(Ds,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let ms=Ds;class Oo extends zs{constructor(){super(...arguments);C(this,"minGeometrySize",10);C(this,"minAssetsSize",1e3);C(this,"maxTriangles",null)}}const bs=class bs extends mt{constructor(t){super(t);C(this,"onGeometryStreamed",new fe);C(this,"onAssetStreamed",new fe);C(this,"onProgress",new fe);C(this,"onIfcLoaded",new fe);C(this,"onDisposed",new q);C(this,"settings",new Oo);C(this,"enabled",!0);C(this,"webIfc",new k.IfcAPI);C(this,"_nextAvailableID",0);C(this,"_splittedGeometries",new Map);C(this,"_spatialTree",new co);C(this,"_metaData",new ho);C(this,"_visitedGeometries",new Map);C(this,"_streamSerializer",new jt.StreamSerializer);C(this,"_geometries",new Map);C(this,"_geometryCount",0);C(this,"_civil",new lo);C(this,"_groupSerializer",new jt.Serializer);C(this,"_assets",[]);C(this,"_meshesWithHoles",new Set);this.components.add(bs.uuid,this),this.settings.excludedCategories.add(k.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),n=[[]],r=new jt.FragmentsGroup;r.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let o=0,a=0;for(const E of s){if(!this.webIfc.IsIfcElement(E)&&E!==k.IFCSPACE||this.settings.excludedCategories.has(E))continue;const T=this.webIfc.GetLineIDsWithType(0,E),p=T.size();for(let m=0;m<p;m++){o>t&&(o=0,a++,n.push([]));const F=T.get(m);n[a].push(F);const R=this.webIfc.GetLine(0,F);if(R.GlobalId){const O=(R==null?void 0:R.GlobalId.value)||(R==null?void 0:R.GlobalId);r.globalToExpressIDs.set(O,F)}const S=this._spatialTree.itemsByFloor[F]||0;r.data.set(F,[[],[S,E]]),o++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const E of n){h++,this.webIfc.StreamMeshes(0,E,p=>{this.getMesh(this.webIfc,p,r)}),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const T=h/n.length;T>l&&(l+=.01,l=Math.max(l,T),await this.onProgress.trigger(Math.round(l*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:f,transparent:I}=r.geometryIDs;for(const[E,{index:T,uuid:p}]of this._visitedGeometries)r.keyFragments.set(T,p),(E>1?f:I).set(E,T);uo.get(r,this.webIfc);const u=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(u),r.civilData=this._civil.read(this.webIfc);const d=this._groupSerializer.export(r);await this.onIfcLoaded.trigger(d),r.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new k.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,s){const n=e.geometries.size(),r=e.expressID,o={id:r,geometries:[]};for(let a=0;a<n;a++){const l=e.geometries.get(a),h=l.geometryExpressID,I=l.color.w===1?1:-1,u=h*I;this._visitedGeometries.has(u)||this.getGeometry(t,h,u),this.registerGeometryData(s,r,l,o,h,u);const d=this._splittedGeometries.get(h);if(d)for(const E of d)this.registerGeometryData(s,r,l,o,E,E)}this._assets.push(o)}getGeometry(t,e,s){const n=t.GetGeometry(0,e),r=t.GetIndexArray(n.GetIndexData(),n.GetIndexDataSize()),o=t.GetVertexArray(n.GetVertexData(),n.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let u=0;u<o.length;u+=6)a[u/2]=o[u],a[u/2+1]=o[u+1],a[u/2+2]=o[u+2],l[u/2]=o[u+3],l[u/2+1]=o[u+4],l[u/2+2]=o[u+5];if(r.length===0){const u=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(e,{position:a,normal:l,index:r,boundingBox:u,hasHoles:!1});const d=this._visitedGeometries.size,E=b.MathUtils.generateUUID();this._visitedGeometries.set(s,{uuid:E,index:d}),this._geometryCount++,n.delete();return}const f=(this.settings.maxTriangles||r.length/3)*3;let I=!0;for(let u=0;u<r.length;u+=f){const d=r.length-u,E=Math.min(d,f),T=u+E,p=[],m=[],F=[];let R=0;for(let g=u;g<T;g++){p.push(R++);const U=r[g];m.push(a[U*3]),m.push(a[U*3+1]),m.push(a[U*3+2]),F.push(l[U*3]),F.push(l[U*3+1]),F.push(l[U*3+2])}const S=new Uint32Array(p),O=new Float32Array(m),y=new Float32Array(F),w=kr(O),P=new Float32Array(w.transformation.elements),v=!1,G=I?e:this._nextAvailableID++;this._geometries.set(G,{position:O,normal:y,index:S,boundingBox:P,hasHoles:v}),I||(this._splittedGeometries.has(e)||this._splittedGeometries.set(e,new Set),this._splittedGeometries.get(e).add(G));const N=this._visitedGeometries.size,D=b.MathUtils.generateUUID();this._visitedGeometries.set(s,{uuid:D,index:N}),this._geometryCount++,I=!1}n.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[s,{boundingBox:n,hasHoles:r}]of this._geometries)e[s]={boundingBox:n,hasHoles:r};await this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}registerGeometryData(t,e,s,n,r,o){const a=this._visitedGeometries.get(o);if(a===void 0)throw new Error("Error getting geometry data for streaming!");const l=t.data.get(e);if(!l)throw new Error("Data not found!");l[0].push(a.index);const{x:h,y:f,z:I,w:u}=s.color,d=[h,f,I,u],E=s.flatTransformation;n.geometries.push({color:d,geometryID:r,transformation:E})}};C(bs,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Pn=bs;class No extends zs{constructor(){super(...arguments);C(this,"propertiesSize",100)}}class yo extends mt{constructor(){super(...arguments);C(this,"onPropertiesStreamed",new fe);C(this,"onProgress",new fe);C(this,"onIndicesStreamed",new fe);C(this,"onDisposed",new q);C(this,"enabled",!0);C(this,"settings",new No);C(this,"webIfc",new k.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([k.IFCPROJECT,k.IFCSITE,k.IFCBUILDING,k.IFCBUILDINGSTOREY,k.IFCSPACE]);for(const l of s)e.add(l);let n=.01,r=0;for(const l of e){if(r++,Vn.has(l))continue;const h=s.has(l),f=this.webIfc.GetLineIDsWithType(0,l),I=f.size();let u=0;for(let E=0;E<I-t;E+=t){const T={};for(let p=0;p<t;p++){u++;const m=f.get(E+p);try{const F=this.webIfc.GetLine(0,m,h);T[F.expressID]=F}catch{console.log(`Could not get property: ${m}`)}}await this.onPropertiesStreamed.trigger({type:l,data:T})}if(u!==I){const E={};for(let T=u;T<I;T++){const p=f.get(T);try{const m=this.webIfc.GetLine(0,p,h);E[m.expressID]=m}catch{console.log(`Could not get property: ${p}`)}}await this.onPropertiesStreamed.trigger({type:l,data:E})}r/e.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const a=await this.components.get(Bt).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new k.IfcAPI}}C(yo,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class kn{constructor(i,t,e){C(this,"title");C(this,"guid",Kt.create());C(this,"clippingPlanes",new Ie);C(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});C(this,"exceptionComponents",new Ie);C(this,"selectionComponents",new Ie);C(this,"componentColors",new Qt);C(this,"spacesVisible",!1);C(this,"spaceBoundariesVisible",!1);C(this,"openingsVisible",!1);C(this,"defaultVisibility",!0);C(this,"_components");C(this,"world");const s={setCamera:!0,...e},{data:n,setCamera:r}=s;this._components=i,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const i=this._components.get(pt),t={};for(const[e,s]of i.groups){e in t||(t[e]=new Set);for(const n of this.selectionComponents){const r=s.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get _exceptionModelIdMap(){const i=this._components.get(pt),t={};for(const[e,s]of i.groups){e in t||(t[e]=new Set);for(const n of this.exceptionComponents){const r=s.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get selection(){return this._components.get(pt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(pt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const i=this._components.get(pt),{position:t}=this.camera,{x:e,y:s,z:n}=t,r=new b.Vector3(e,s,n);return i.applyBaseCoordinateSystem(r,new b.Matrix4),r}get direction(){const{direction:i}=this.camera,{x:t,y:e,z:s}=i;return new b.Vector3(t,e,s)}get _managerVersion(){return this._components.get(Mt).config.version}get topics(){return[...this._components.get(Mt).list.values()].filter(s=>s.viewpoints.has(this.guid))}addComponentsFromMap(i){const e=this._components.get(pt).fragmentIdMapToGuids(i);this.selectionComponents.add(...e),this._components.get(Zt).list.set(this.guid,this)}set(i){const t=i,e=this;for(const n in i){if(n==="guid")continue;const r=t[n];if(n==="selectionComponents"){this.selectionComponents.clear(),this.selectionComponents.add(...r);continue}if(n==="exceptionComponents"){this.exceptionComponents.clear(),this.exceptionComponents.add(...r);continue}n in this&&(e[n]=r)}return this._components.get(Zt).list.set(this.guid,this),this}async go(i=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof ro&&t.projection.set(this.projection);const e=this.position,s=this.direction;let n={x:e.x+s.x*80,y:e.y+s.y*80,z:e.z+s.z*80};const r=this.selection;if(Object.keys(r).length===0){const h=this._components.get(ve).get(this.world).castRayFromVector(e,this.direction);h&&(n=h.point)}else{const a=this._components.get(Ts);a.reset(),a.addFragmentIdMap(r),n=a.getSphere().center,a.reset()}const o=this._components.get(ms);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(e.x,e.y,e.z,n.x,n.y,n.z,i)}updateCamera(){const{camera:i,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!i.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const e=new b.Vector3;i.controls.getPosition(e);const s=i.three,n=new b.Vector3(0,0,-1).applyEuler(s.rotation),{width:r,height:o}=t.getSize();let a=r/o;Number.isNaN(a)&&(a=1);const l=this._components.get(pt);e.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:a,position:{x:e.x,y:e.y,z:e.z},direction:{x:n.x,y:n.y,z:n.z}};s instanceof b.PerspectiveCamera?this.camera={...h,fov:s.fov}:s instanceof b.OrthographicCamera&&(this.camera={...h,viewToWorldScale:s.top-s.bottom}),this._components.get(Zt).list.set(this.guid,this)}colorize(){const i=this._components.get(Zt),t=this._components.get(pt),e=this._components.get(ti);for(const[s,n]of this.componentColors){const r=t.guidToFragmentIdMap(n),o=new b.Color(`#${s}`);e.setColor(r,o,i.config.overwriteColors)}}resetColors(){const i=this._components.get(pt),t=this._components.get(ti);for(const[e,s]of this.componentColors){const n=i.guidToFragmentIdMap(s);t.resetColor(n)}}async createComponentTags(i){var n,r;const t=this._components.get(pt),e=this._components.get(Mt);let s="";if(e.config.includeSelectionTag){const o=i==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const a in o){const l=t.groups.get(a);if(!l)continue;const h=o[a];for(const f of h){const I=await l.getProperties(f);if(!I)continue;const u=(n=I.GlobalId)==null?void 0:n.value;if(!u)continue;const d=(r=I.Tag)==null?void 0:r.value;let E=null;d&&(E=`AuthoringToolId="${d}"`),s+=`
|
|
226
|
+
`}processMarkupComment(t){const{Guid:e,Date:s,Author:n,Comment:r,Viewpoint:o}=t;if(!(e&&s&&n&&(Cs||o)))return null;const a=this.components.get(Zt),l=new Cs(this.components,r??"");return l.guid=e,l.date=new Date(s),l.author=n,l.viewpoint=o!=null&&o.Guid?a.list.get(o.Guid):void 0,l.modifiedAuthor=t.ModifiedAuthor,l.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,l}getMarkupComments(t,e){var o;let s;if(e==="2.1"&&(s=t.Comment),e==="3"&&(s=(o=t.Topic.Comments)==null?void 0:o.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map(a=>this.processMarkupComment(a)).filter(a=>a);return Array.isArray(n)?n:[n]}getMarkupLabels(t,e){var r;let s;return e==="2.1"&&(s=t.Topic.Labels),e==="3"&&(s=(r=t.Topic.Labels)==null?void 0:r.Label),s?Array.isArray(s)?s:[s]:[]}getMarkupViewpoints(t,e){var n;let s;return e==="2.1"&&(s=t.Viewpoints),e==="3"&&(s=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(t,e){var r;let s;return e==="2.1"&&(s=t.Topic.RelatedTopic),e==="3"&&(s=(r=t.Topic.RelatedTopics)==null?void 0:r.RelatedTopic),s?(Array.isArray(s)?s:[s]).map(o=>o.Guid):[]}async load(t,e){var m;const{fallbackVersionOnImport:s,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new Lr;await o.loadAsync(t);const a=Object.values(o.files);let l=s;const h=a.find(F=>F.name.endsWith(".version"));if(h){const F=await h.async("string"),R=Fe.xmlParser.parse(F).Version.VersionId;l=String(R)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const f=a.find(F=>F.name.endsWith(".extensions"));if(r&&f){const F=await f.async("string");Fo(this,F)}const I=[],u=this.components.get(Zt),d=a.filter(F=>F.name.endsWith(".bcfv"));for(const F of d){const R=await F.async("string"),S=Fe.xmlParser.parse(R).VisualizationInfo;if(!S){console.warn("Missing VisualizationInfo in Viewpoint");continue}const O={},{Guid:y,ClippingPlanes:w,Components:P,OrthogonalCamera:v,PerspectiveCamera:G}=S;if(y&&(O.guid=y),P){const{Selection:D,Visibility:g}=P;if(D&&D.Component){const Q=Array.isArray(D.Component)?D.Component:[D.Component];O.selectionComponents=Q.map(z=>z.IfcGuid).filter(z=>z)}if(g&&"DefaultVisibility"in g&&(O.defaultVisibility=g.DefaultVisibility),g&&g.Exceptions&&"Component"in g.Exceptions){const{Component:Q}=g.Exceptions,z=Array.isArray(Q)?Q:[Q];O.exceptionComponents=z.map(et=>et.IfcGuid).filter(et=>et)}let U;l==="2.1"&&(U=P.ViewSetupHints),l==="3"&&(U=(m=P.Visibility)==null?void 0:m.ViewSetupHints),U&&("OpeningsVisible"in U&&(O.openingsVisible=U.OpeningsVisible),"SpacesVisible"in U&&(O.spacesVisible=U.SpacesVisible),"SpaceBoundariesVisible"in U&&(O.spaceBoundariesVisible=U.SpaceBoundariesVisible))}if(v||G){const D=S.PerspectiveCamera??S.OrthogonalCamera,{CameraViewPoint:g,CameraDirection:U}=D,Q=new b.Vector3(Number(g.X),Number(g.Z),Number(-g.Y)),z=new b.Vector3(Number(U.X),Number(U.Z),Number(-U.Y)),et={position:{x:Q.x,y:Q.y,z:Q.z},direction:{x:z.x,y:z.y,z:z.z},aspectRatio:"AspectRatio"in D?D.AspectRatio:1};"ViewToWorldScale"in D&&(O.camera={...et,viewToWorldScale:D.ViewToWorldScale}),"FieldOfView"in D&&(O.camera={...et,fov:D.FieldOfView})}const N=new kn(this.components,e,{data:O,setCamera:!1});if(P){const{Coloring:D}=P;if(D&&D.Color){const g=Array.isArray(D.Color)?D.Color:[D.Color];for(const U of g){const{Color:Q,Component:z}=U,X=(Array.isArray(z)?z:[z]).map(nt=>nt.IfcGuid);N.componentColors.set(Q,X)}}}if(I.push(N),w){const D=this.components.get(Is),g=Array.isArray(w.ClippingPlane)?w.ClippingPlane:[w.ClippingPlane];for(const U of g){const{Location:Q,Direction:z}=U;if(!(Q&&z))continue;const et=new b.Vector3(Q.X,Q.Z,-Q.Y),X=new b.Vector3(z.X,-z.Z,z.Y),nt=D.createFromNormalAndCoplanarPoint(e,X,et);nt.visible=!1,nt.enabled=!1,N.clippingPlanes.add(nt)}}}const E={},T=[],p=a.filter(F=>F.name.endsWith(".bcf"));for(const F of p){const R=await F.async("string"),S=Fe.xmlParser.parse(R).Markup,O=S.Topic,{Guid:y,TopicType:w,TopicStatus:P,Title:v,CreationDate:G,CreationAuthor:N}=O;if(n&&!(y&&w&&P&&v&&G&&N))continue;const D=new Mi(this.components);D.guid=y??D.guid;const g=this.getMarkupRelatedTopics(S,l);E[D.guid]=new Set(g),D.type=w??D.type,D.status=P??D.status,D.title=v??D.title,D.creationDate=G?new Date(G):D.creationDate,D.creationAuthor=N??D.creationAuthor,D.serverAssignedId=O.ServerAssignedId,D.priority=O.Priority,D.index=O.Index,D.modifiedDate=O.ModifiedDate?new Date(O.ModifiedDate):void 0,D.modifiedAuthor=O.ModifiedAuthor,D.dueDate=O.DueDate?new Date(O.DueDate):void 0,D.assignedTo=O.AssignedTo,D.description=O.Description,D.stage=O.Stage;const U=this.getMarkupLabels(S,l);for(const et of U)D.labels.add(et);const Q=this.getMarkupComments(S,l);for(const et of Q)D.comments.set(et.guid,et);const z=this.getMarkupViewpoints(S,l);for(const et of z){if(!(et&&et.Guid))continue;const X=u.list.get(et.Guid);X&&D.viewpoints.add(X.guid)}this.list.set(D.guid,D),T.push(D)}for(const F in E){const R=this.list.get(F);if(!R)continue;const S=E[F];for(const O of S)R.relatedTopics.add(O)}return this.onBCFImported.trigger(T),{viewpoints:I,topics:T}}};C(Fe,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),C(Fe,"xmlParser",new Ao.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Mt=Fe;const ie=class ie extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"onDisposed",new q);C(this,"_absoluteMin");C(this,"_absoluteMax");C(this,"_meshes",[]);this.components.add(ie.uuid,this),this._absoluteMin=ie.newBound(!0),this._absoluteMax=ie.newBound(!1)}static getDimensions(t){const{min:e,max:s}=t,n=Math.abs(s.x-e.x),r=Math.abs(s.y-e.y),o=Math.abs(s.z-e.z),a=new b.Vector3;return a.subVectors(s,e).divideScalar(2).add(e),{width:n,height:r,depth:o,center:a}}static newBound(t){const e=t?1:-1;return new b.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,s){const n=s||this.newBound(!1),r=e||this.newBound(!0);for(const o of t)o.x<r.x&&(r.x=o.x),o.y<r.y&&(r.y=o.y),o.z<r.z&&(r.z=o.z),o.x>n.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new b.Box3(e,s)}dispose(){const t=this.components.get(Ce);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(ie.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new b.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),s=Math.abs((e.x-t.x)/2),n=Math.abs((e.y-t.y)/2),r=Math.abs((e.z-t.z)/2),o=new b.Vector3(t.x+s,t.y+n,t.z+r),a=o.distanceTo(t);return new b.Sphere(o,a)}getMesh(){const t=new b.Box3(this._absoluteMin,this._absoluteMax),e=ie.getDimensions(t),{width:s,height:n,depth:r,center:o}=e,a=new b.BoxGeometry(s,n,r),l=new b.Mesh(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=ie.newBound(!0),this._absoluteMax=ie.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const s=ie.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new b.Matrix4,o=t instanceof b.InstancedMesh,a=new Set;if(t instanceof jt.FragmentMesh){e||(e=t.fragment.ids);for(const l of e){const h=t.fragment.getInstancesIDs(l);if(h)for(const f of h)a.add(f)}}else a.add(0);for(const l of a){const h=s.min.clone(),f=s.max.clone();o&&(t.getMatrixAt(l,r),h.applyMatrix4(r),f.applyMatrix4(r)),h.applyMatrix4(n),f.applyMatrix4(n),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),f.x>this._absoluteMax.x&&(this._absoluteMax.x=f.x),f.y>this._absoluteMax.y&&(this._absoluteMax.y=f.y),f.z>this._absoluteMax.z&&(this._absoluteMax.z=f.z),f.x<this._absoluteMin.x&&(this._absoluteMin.x=f.x),f.y<this._absoluteMin.y&&(this._absoluteMin.y=f.y),f.z<this._absoluteMin.z&&(this._absoluteMin.z=f.z)}}addFragmentIdMap(t){const e=this.components.get(pt);for(const s in t){const n=e.list.get(s);if(!n)continue;const r=t[s];this.addMesh(n.mesh,r)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,r=new b.Vector3(s,s,s),o=new b.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let l=0;l<a.length;l++){if(l%3===0&&a[l]===0&&a[l+1]===0&&a[l+2]===0){l+=2;continue}const h=a[l],f=e.getX(h),I=e.getY(h),u=e.getZ(h);f<r.x&&(r.x=f),I<r.y&&(r.y=I),u<r.z&&(r.z=u),f>o.x&&(o.x=f),I>o.y&&(o.y=I),u>o.z&&(o.z=u)}return new b.Box3(r,o)}};C(ie,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Ts=ie;const ys=class ys{constructor(i){C(this,"onProgress",new q);C(this,"inclusive",!1);C(this,"rules",[]);C(this,"ids",{});C(this,"needsUpdate",new Map);C(this,"components");this.components=i}static import(i,t){const e=ys.importers.get(t.type);return e?e(i,t):(console.warn("Invalid query data:.",t),null)}static importRules(i){const t=[];for(const e of i){const s={};for(const n in e){const r=e[n];r.regexp?s[n]=new RegExp(r.value):s[n]=r}t.push(s)}return t}static importIds(i){const t={};for(const e in i.ids)t[e]=new Set(i.ids[e]);return t}clear(i){if(i===void 0){this.ids={},this.needsUpdate.clear();return}delete this.ids[i],this.needsUpdate.delete(i)}addID(i,t){this.ids[i]||(this.ids[i]=new Set),this.ids[i].add(t)}getData(){const i={};for(const e in this.ids)i[e]=Array.from(this.ids[e]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:i,rules:t}}exportRules(){const i=[];for(const t of this.rules){const e={};for(const s in t){const n=t[s];n instanceof RegExp?e[s]={regexp:!0,value:n.source}:e[s]=n}i.push(e)}return i}findInFile(i,t){return new Promise(e=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1e4*1024,o=1e3;let a=0;const l=/;/,h=()=>{if(a>=t.size){e();return}const f=Math.min(a+r+o,t.size),I=t.slice(a,f);s.readAsArrayBuffer(I)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const f=new Uint8Array(s.result),u=n.decode(f).split(l);u.shift(),this.findInLines(i,u),this.onProgress.trigger(a/t.size),a+=r,h()},h()})}getIdFromLine(i){const t=i.slice(i.indexOf("#")+1,i.indexOf("="));return parseInt(t,10)}testRules(i){let t=null,e=null,s=null,n=!1;for(const r of this.rules){if(r.type==="category"){if(t===null&&(t=this.getCategoryFromLine(i),t===null)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0;continue}if(e===null&&(e=this.getAttributesFromLine(i),e===null)){if(this.inclusive)continue;n=!1;break}if(t===null&&(t=this.getCategoryFromLine(i),t===null)){if(this.inclusive)continue;n=!1;break}if(s===null&&(s=Object.keys(new k.IFC4[t]),s=s.slice(2),s===null)){if(this.inclusive)continue;n=!1;break}if(r.type==="property"){const{name:o,value:a}=r;if(!a.test(i)){if(this.inclusive)continue;n=!1;break}let l=!1;for(let h=0;h<e.length;h++){const f=e[h],I=s[h];if(a.test(f)&&o.test(I)){l=!0;break}}if(l)n=!0;else if(!this.inclusive){n=!1;break}}if(r.type==="operator"){const{name:o,value:a,operator:l}=r;let h=!1;for(let f=0;f<e.length;f++){const I=s[f],u=e[f].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(o.test(I)){if(l==="="&&parseFloat(u)===a){h=!0;break}else if(l==="<"&&parseFloat(u)<a){h=!0;break}else if(l===">"&&parseFloat(u)>a){h=!0;break}else if(l===">="&&parseFloat(u)>=a){h=!0;break}else if(l==="<="&&parseFloat(u)<=a){h=!0;break}}}if(h)n=!0;else if(!this.inclusive){n=!1;break}}}return n}getCategoryFromLine(i){const t=i.indexOf("=")+1,e=i.indexOf("("),s=i.slice(t,e).trim(),n=ao[s];return n||null}getAttributesFromLine(i){const t=/\((.*)\)/,e=i.match(t);if(!(e&&e[1]))return null;const s=/,(?![^()]*\))/g;return e[1].split(s).map(r=>r.trim())}};C(ys,"importers",new Map);let qt=ys;class br{constructor(i){C(this,"list",new Map);C(this,"id",b.MathUtils.generateUUID());C(this,"mode","intersect");C(this,"_components");this._components=i}get queries(){return new Set(this.list.values())}get items(){const i=[];for(const t of this.queries)i.push(t.items);return this.mode==="combine"?jt.FragmentUtils.combine(i):jt.FragmentUtils.intersect(i)}add(i){if(this.list.has(i.name))throw new Error(`This group already has a query with the name ${i.name}.`);this.list.set(i.name,i)}clear(i){for(const t of this.queries)t.clear(i)}import(i){this.mode=i.mode,this.id=i.id;for(const t in i.queries){const e=qt.import(this._components,i.queries[t]);e&&this.list.set(t,e)}}export(){const i={};for(const[t,e]of this.list)i[t]=e.export();return{mode:this.mode,id:this.id,queries:i}}async update(i,t){for(const e of this.queries){const s=e.needsUpdate.get(i);(s===void 0||s)&&await e.update(i,t)}}}const Ls=class Ls extends qt{constructor(t,e){super(t);C(this,"name");this.name=e.name,this.rules=e.rules,this.inclusive=e.inclusive}get items(){const t=this.components.get(pt),e=[];for(const s in this.ids){const n=this.ids[s],r=t.groups.get(s);if(!r){console.warn(`Model ${s} not found!`);continue}const o=r.getFragmentMap(n);e.push(o)}return jt.FragmentUtils.combine(e)}export(){const t=this.getData();return t.type=Ls.type,t}async update(t,e){this.ids[t]=new Set,await this.findInFile(t,e),this.needsUpdate.set(t,!1)}findInLines(t,e){for(const s of e)if(this.testRules(s)){const r=this.getIdFromLine(s);this.addID(t,r)}}};C(Ls,"type","IfcBasicQuery");let wi=Ls;qt.importers.set(wi.type,(c,i)=>{const t=new wi(c,{name:i.name,rules:qt.importRules(i.rules),inclusive:i.inclusive});return t.ids=qt.importIds(i),t});const Ps=class Ps extends qt{constructor(t,e){super(t);C(this,"name");C(this,"psets",[]);this.name=e.name,this.rules=e.rules,this.inclusive=e.inclusive}get items(){const t=this.components.get(Bt),e=this.components.get(pt),s=[];for(const n in this.ids){const r=e.groups.get(n);if(!r){console.log(`Model not found: ${n}.`);continue}const o=this.ids[n];for(const a of o){const l=t.getEntityRelations(n,a,"DefinesOcurrence");if(l){const h=r.getFragmentMap(l);s.push(h)}}}return jt.FragmentUtils.combine(s)}export(){const t=this.getData();return t.type=Ps.type,t}async update(t,e){await this.findInFile(t,e);const s=new Set;for(const n of this.psets){const r=this.getAttributesFromLine(n);if(r===null)continue;const o=r[4].replace("(","[").replace(")","]").replace(/#/g,""),a=JSON.parse(o);for(const l of a){const h=this.ids[t];if(h&&h.has(l)){const f=this.getIdFromLine(n);s.add(f);break}}}this.ids[t]=s,this.psets=[],this.needsUpdate.set(t,!1)}findInLines(t,e){for(const s of e){const n=this.getCategoryFromLine(s);if(n==="IfcPropertySet"){this.psets.push(s);continue}if(n!=="IfcPropertySingleValue")continue;if(this.testRules(s)){const o=this.getIdFromLine(s);this.addID(t,o)}}}};C(Ps,"type","IfcPropertyQuery");let Di=Ps;qt.importers.set(Di.type,(c,i)=>{const t=new Di(c,{name:i.name,inclusive:i.inclusive,rules:qt.importRules(i.rules)});return t.ids=qt.importIds(i),t});const _s=class _s extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"list",new Map);t.add(_s.uuid,this)}get queries(){const t=new Set;for(const[,e]of this.list)for(const s of e.queries)t.add(s);return t}import(t){for(const e in t){const s=new br(this.components);s.import(t[e]),this.list.set(e,s)}}export(){const t={};for(const[e,s]of this.list)t[e]=s.export();return t}create(){const t=new br(this.components);return this.list.set(t.id,t),t}delete(t){this.list.delete(t)}clear(){this.list.clear()}};C(_s,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let yn=_s;const Ms=class Ms extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"list",{});C(this,"onDisposed",new q);C(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:s}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(e))delete r[e],Object.values(r).length===0&&delete this.list[n];else for(const a of o){const l=r[a];for(const h of s)delete l.map[h];Object.values(l).length===0&&delete r[a]}}});t.add(Ms.uuid,this),t.get(pt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(pt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const s=this.list[e];for(const n in s){const r=s[n];delete r.map[t]}}}find(t){const e=this.components.get(pt);if(!t){const o={};for(const[a,l]of e.list)o[a]=new Set(l.ids);return o}const s=Object.keys(t).length,n={};for(const o in t){const a=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const f in h.map){n[f]||(n[f]=new Map);for(const I of h.map[f]){const u=n[f].get(I);u===void 0?n[f].set(I,1):n[f].set(I,u+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===s&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(t,e){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={map:{},id:null,name:t});const n=s[t];for(const[r,o]of e.data){const a=o[0];for(const l of a){const h=e.keyFragments.get(l);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(r))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,s=t.getAllPropertiesIDs();for(const r of s){const o=await t.getProperties(r);if(!o)continue;const a=String((n=o.PredefinedType)==null?void 0:n.value).toUpperCase();e[a]||(e[a]={map:{},id:null,name:a});const l=e[a];for(const[h,f]of t.data){const I=f[0];for(const u of I){const d=t.keyFragments.get(u);if(!d)throw new Error("Fragment ID not found!");l.map[d]||(l.map[d]=new Set),l.map[d].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,s]of t.data){const r=s[1][1],o=_i[r];this.saveItem(t,"entities",o,e)}}async byIfcRel(t,e,s){be.isRel(e)&&await be.getRelationMap(t,e,async(n,r)=>{const{name:o}=await be.getEntityName(t,n);for(const a of r)this.saveItem(t,s,o??"NO REL NAME",a)})}async bySpatialStructure(t,e={}){var l,h;const s=this.components.get(Bt),n=s.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const r="spatialStructures",a=e.useProperties===void 0||e.useProperties;for(const[f]of n){if(e.isolate){const E=t.data.get(f);if(!E)continue;const T=E[1][1];if(T===void 0||!e.isolate.has(T))continue}const I=s.getEntityRelations(t,f,"Decomposes");if(I)for(const E of I){let T=E.toString();if(a){const p=await t.getProperties(E);if(!p)continue;T=(l=p.Name)==null?void 0:l.value}this.saveItem(t,r,T,f,E)}const u=s.getEntityRelations(t,f,"ContainsElements");if(!u)continue;let d=f.toString();if(a){const E=await t.getProperties(f);if(!E)continue;d=(h=E.Name)==null?void 0:h.value}for(const E of u){this.saveItem(t,r,d,E,f);const T=s.getEntityRelations(t,Number(E),"IsDecomposedBy");if(T)for(const p of T)this.saveItem(t,r,d,p,f)}}}setColor(t,e,s=!1){const n=this.components.get(pt);for(const r in t){const o=n.list.get(r);if(!o)continue;const a=t[r];o.setColor(e,a,s)}}resetColor(t){const e=this.components.get(pt);for(const s in t){const n=e.list.get(s);if(!n)continue;const r=t[s];n.resetColor(r)}}saveItem(t,e,s,n,r=null){this.list[e]||(this.list[e]={});const o=t.data.get(n);if(o)for(const a of o[0]){const l=t.keyFragments.get(a);if(l){const h=this.list[e];h[s]||(h[s]={map:{},id:r,name:s}),h[s].map[l]||(h[s].map[l]=new Set),h[s].map[l].add(n)}}}};C(Ms,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let ti=Ms;const ws=class ws extends mt{constructor(t){super(t);C(this,"onDisposed",new q);C(this,"enabled",!0);C(this,"height",10);C(this,"groupName","spatialStructures");C(this,"list",new Set);t.add(ws.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(ti),s=this.components.get(pt),n=t?1:-1;let r=0;const o=e.list[this.groupName],a=new b.Matrix4;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l].map){const f=s.list.get(h),I=l+h,u=this.list.has(I);if(!f||t&&u||!t&&!u)continue;t?this.list.add(I):this.list.delete(I);const d=o[l].map[h];f.applyTransform(d,a),f.mesh.computeBoundingSphere(),f.mesh.computeBoundingBox()}r++}}};C(ws,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Ln=ws;const Ds=class Ds extends mt{constructor(t){super(t);C(this,"enabled",!0);this.components.add(Ds.uuid,this)}set(t,e){const s=this.components.get(pt);if(!e){for(const[n,r]of s.list)r&&(r.setVisibility(t),this.updateCulledVisibility(r));return}for(const n in e){const r=e[n],o=s.list.get(n);o&&(o.setVisibility(t,r),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(fs);for(const[s,n]of e.list){const r=n.colorMeshes.get(t.id);r&&(r.count=t.mesh.count)}}};C(Ds,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let ms=Ds;class Oo extends zs{constructor(){super(...arguments);C(this,"minGeometrySize",10);C(this,"minAssetsSize",1e3);C(this,"maxTriangles",null)}}const bs=class bs extends mt{constructor(t){super(t);C(this,"onGeometryStreamed",new fe);C(this,"onAssetStreamed",new fe);C(this,"onProgress",new fe);C(this,"onIfcLoaded",new fe);C(this,"onDisposed",new q);C(this,"settings",new Oo);C(this,"enabled",!0);C(this,"webIfc",new k.IfcAPI);C(this,"_nextAvailableID",0);C(this,"_splittedGeometries",new Map);C(this,"_spatialTree",new co);C(this,"_metaData",new ho);C(this,"_visitedGeometries",new Map);C(this,"_streamSerializer",new jt.StreamSerializer);C(this,"_geometries",new Map);C(this,"_geometryCount",0);C(this,"_civil",new lo);C(this,"_groupSerializer",new jt.Serializer);C(this,"_assets",[]);C(this,"_meshesWithHoles",new Set);this.components.add(bs.uuid,this),this.settings.excludedCategories.add(k.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),n=[[]],r=new jt.FragmentsGroup;r.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let o=0,a=0;for(const E of s){if(!this.webIfc.IsIfcElement(E)&&E!==k.IFCSPACE||this.settings.excludedCategories.has(E))continue;const T=this.webIfc.GetLineIDsWithType(0,E),p=T.size();for(let m=0;m<p;m++){o>t&&(o=0,a++,n.push([]));const F=T.get(m);n[a].push(F);const R=this.webIfc.GetLine(0,F);if(R.GlobalId){const O=(R==null?void 0:R.GlobalId.value)||(R==null?void 0:R.GlobalId);r.globalToExpressIDs.set(O,F)}const S=this._spatialTree.itemsByFloor[F]||0;r.data.set(F,[[],[S,E]]),o++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const E of n){h++,this.webIfc.StreamMeshes(0,E,p=>{this.getMesh(this.webIfc,p,r)}),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const T=h/n.length;T>l&&(l+=.01,l=Math.max(l,T),await this.onProgress.trigger(Math.round(l*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:f,transparent:I}=r.geometryIDs;for(const[E,{index:T,uuid:p}]of this._visitedGeometries)r.keyFragments.set(T,p),(E>1?f:I).set(E,T);uo.get(r,this.webIfc);const u=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(u),r.civilData=this._civil.read(this.webIfc);const d=this._groupSerializer.export(r);await this.onIfcLoaded.trigger(d),r.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new k.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,s){const n=e.geometries.size(),r=e.expressID,o={id:r,geometries:[]};for(let a=0;a<n;a++){const l=e.geometries.get(a),h=l.geometryExpressID,I=l.color.w===1?1:-1,u=h*I;this._visitedGeometries.has(u)||this.getGeometry(t,h,u),this.registerGeometryData(s,r,l,o,h,u);const d=this._splittedGeometries.get(h);if(d)for(const E of d)this.registerGeometryData(s,r,l,o,E,E)}this._assets.push(o)}getGeometry(t,e,s){const n=t.GetGeometry(0,e),r=t.GetIndexArray(n.GetIndexData(),n.GetIndexDataSize()),o=t.GetVertexArray(n.GetVertexData(),n.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let u=0;u<o.length;u+=6)a[u/2]=o[u],a[u/2+1]=o[u+1],a[u/2+2]=o[u+2],l[u/2]=o[u+3],l[u/2+1]=o[u+4],l[u/2+2]=o[u+5];if(r.length===0){const u=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(e,{position:a,normal:l,index:r,boundingBox:u,hasHoles:!1});const d=this._visitedGeometries.size,E=b.MathUtils.generateUUID();this._visitedGeometries.set(s,{uuid:E,index:d}),this._geometryCount++,n.delete();return}const f=(this.settings.maxTriangles||r.length/3)*3;let I=!0;for(let u=0;u<r.length;u+=f){const d=r.length-u,E=Math.min(d,f),T=u+E,p=[],m=[],F=[];let R=0;for(let g=u;g<T;g++){p.push(R++);const U=r[g];m.push(a[U*3]),m.push(a[U*3+1]),m.push(a[U*3+2]),F.push(l[U*3]),F.push(l[U*3+1]),F.push(l[U*3+2])}const S=new Uint32Array(p),O=new Float32Array(m),y=new Float32Array(F),w=kr(O),P=new Float32Array(w.transformation.elements),v=!1,G=I?e:this._nextAvailableID++;this._geometries.set(G,{position:O,normal:y,index:S,boundingBox:P,hasHoles:v}),I||(this._splittedGeometries.has(e)||this._splittedGeometries.set(e,new Set),this._splittedGeometries.get(e).add(G));const N=this._visitedGeometries.size,D=b.MathUtils.generateUUID();this._visitedGeometries.set(s,{uuid:D,index:N}),this._geometryCount++,I=!1}n.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[s,{boundingBox:n,hasHoles:r}]of this._geometries)e[s]={boundingBox:n,hasHoles:r};await this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}registerGeometryData(t,e,s,n,r,o){const a=this._visitedGeometries.get(o);if(a===void 0)throw new Error("Error getting geometry data for streaming!");const l=t.data.get(e);if(!l)throw new Error("Data not found!");l[0].push(a.index);const{x:h,y:f,z:I,w:u}=s.color,d=[h,f,I,u],E=s.flatTransformation;n.geometries.push({color:d,geometryID:r,transformation:E})}};C(bs,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Pn=bs;class No extends zs{constructor(){super(...arguments);C(this,"propertiesSize",100)}}class yo extends mt{constructor(){super(...arguments);C(this,"onPropertiesStreamed",new fe);C(this,"onProgress",new fe);C(this,"onIndicesStreamed",new fe);C(this,"onDisposed",new q);C(this,"enabled",!0);C(this,"settings",new No);C(this,"webIfc",new k.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([k.IFCPROJECT,k.IFCSITE,k.IFCBUILDING,k.IFCBUILDINGSTOREY,k.IFCSPACE]);for(const l of s)e.add(l);let n=.01,r=0;for(const l of e){if(r++,Vn.has(l))continue;const h=s.has(l),f=this.webIfc.GetLineIDsWithType(0,l),I=f.size();let u=0;for(let E=0;E<I-t;E+=t){const T={};for(let p=0;p<t;p++){u++;const m=f.get(E+p);try{const F=this.webIfc.GetLine(0,m,h);T[F.expressID]=F}catch{console.log(`Could not get property: ${m}`)}}await this.onPropertiesStreamed.trigger({type:l,data:T})}if(u!==I){const E={};for(let T=u;T<I;T++){const p=f.get(T);try{const m=this.webIfc.GetLine(0,p,h);E[m.expressID]=m}catch{console.log(`Could not get property: ${p}`)}}await this.onPropertiesStreamed.trigger({type:l,data:E})}r/e.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const a=await this.components.get(Bt).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new k.IfcAPI}}C(yo,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class kn{constructor(i,t,e){C(this,"title");C(this,"guid",Kt.create());C(this,"clippingPlanes",new Ie);C(this,"camera",{aspectRatio:1,fov:60,direction:{x:0,y:0,z:0},position:{x:0,y:0,z:0}});C(this,"exceptionComponents",new Ie);C(this,"selectionComponents",new Ie);C(this,"componentColors",new Qt);C(this,"spacesVisible",!1);C(this,"spaceBoundariesVisible",!1);C(this,"openingsVisible",!1);C(this,"defaultVisibility",!0);C(this,"_components");C(this,"world");const s={setCamera:!0,...e},{data:n,setCamera:r}=s;this._components=i,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const i=this._components.get(pt),t={};for(const[e,s]of i.groups){e in t||(t[e]=new Set);for(const n of this.selectionComponents){const r=s.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get _exceptionModelIdMap(){const i=this._components.get(pt),t={};for(const[e,s]of i.groups){e in t||(t[e]=new Set);for(const n of this.exceptionComponents){const r=s.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get selection(){return this._components.get(pt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(pt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const i=this._components.get(pt),{position:t}=this.camera,{x:e,y:s,z:n}=t,r=new b.Vector3(e,s,n);return i.applyBaseCoordinateSystem(r,new b.Matrix4),r}get direction(){const{direction:i}=this.camera,{x:t,y:e,z:s}=i;return new b.Vector3(t,e,s)}get _managerVersion(){return this._components.get(Mt).config.version}get topics(){return[...this._components.get(Mt).list.values()].filter(s=>s.viewpoints.has(this.guid))}addComponentsFromMap(i){const e=this._components.get(pt).fragmentIdMapToGuids(i);this.selectionComponents.add(...e),this._components.get(Zt).list.set(this.guid,this)}set(i){const t=i,e=this;for(const n in i){if(n==="guid")continue;const r=t[n];if(n==="selectionComponents"){this.selectionComponents.clear(),this.selectionComponents.add(...r);continue}if(n==="exceptionComponents"){this.exceptionComponents.clear(),this.exceptionComponents.add(...r);continue}n in this&&(e[n]=r)}return this._components.get(Zt).list.set(this.guid,this),this}async go(i=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof ro&&t.projection.set(this.projection);const e=new b.Vector3(this.camera.position.x,this.camera.position.y,this.camera.position.z),s=new b.Vector3(this.camera.direction.x,this.camera.direction.y,this.camera.direction.z);if(e.equals(new b.Vector3)&&s.equals(new b.Vector3))return;const n=this.position,r=this.direction;let o={x:n.x+r.x*80,y:n.y+r.y*80,z:n.z+r.z*80};const a=this.selection;if(Object.keys(a).length===0){const f=this._components.get(ve).get(this.world).castRayFromVector(n,this.direction);f&&(o=f.point)}else{const l=this._components.get(Ts);l.reset(),l.addFragmentIdMap(a),o=l.getSphere().center,l.reset()}await t.controls.setLookAt(n.x,n.y,n.z,o.x,o.y,o.z,i)}updateCamera(){const{camera:i,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!i.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const e=new b.Vector3;i.controls.getPosition(e);const s=i.three,n=new b.Vector3(0,0,-1).applyEuler(s.rotation),{width:r,height:o}=t.getSize();let a=r/o;Number.isNaN(a)&&(a=1);const l=this._components.get(pt);e.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:a,position:{x:e.x,y:e.y,z:e.z},direction:{x:n.x,y:n.y,z:n.z}};s instanceof b.PerspectiveCamera?this.camera={...h,fov:s.fov}:s instanceof b.OrthographicCamera&&(this.camera={...h,viewToWorldScale:s.top-s.bottom}),this._components.get(Zt).list.set(this.guid,this)}applyVisibility(){const i=this._components.get(ms);i.set(this.defaultVisibility),i.set(!this.defaultVisibility,this.exception),i.set(!0,this.selection)}applyColors(){const i=this._components.get(Zt),t=this._components.get(pt),e=this._components.get(ti);for(const[s,n]of this.componentColors){const r=t.guidToFragmentIdMap(n);e.setColor(r,s,i.config.overwriteColors)}}resetColors(){const i=this._components.get(pt),t=this._components.get(ti);for(const[e,s]of this.componentColors){const n=i.guidToFragmentIdMap(s);t.resetColor(n)}}async createComponentTags(i){var n,r;const t=this._components.get(pt),e=this._components.get(Mt);let s="";if(e.config.includeSelectionTag){const o=i==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const a in o){const l=t.groups.get(a);if(!l)continue;const h=o[a];for(const f of h){const I=await l.getProperties(f);if(!I)continue;const u=(n=I.GlobalId)==null?void 0:n.value;if(!u)continue;const d=(r=I.Tag)==null?void 0:r.value;let E=null;d&&(E=`AuthoringToolId="${d}"`),s+=`
|
|
227
227
|
<Component IfcGuid="${u}" ${E??""} />`}}}else s=[...this.selectionComponents].map(o=>`<Component IfcGuid="${o}" />`).join(`
|
|
228
|
-
`);return s}
|
|
228
|
+
`);return s}createColorTags(){let i="";for(const[t,e]of this.componentColors.entries()){const s=`#${t.getHexString()}`,n=e.map(r=>`
|
|
229
|
+
<Component IfcGuid="${r}" />`).join(`
|
|
230
|
+
`);i+=`<Color Color="${s}">
|
|
231
|
+
${n}
|
|
232
|
+
</Color>`}return i.length!==0?`<Coloring>
|
|
233
|
+
${i}
|
|
234
|
+
</Coloring>`:"<Coloring />"}async serialize(i=this._managerVersion){const t=this._components.get(pt),e=this.position;e.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const n=new b.Matrix4().makeRotationX(Math.PI/2),r=s.clone().applyMatrix4(n);r.normalize();const o=`<CameraViewPoint>
|
|
229
235
|
<X>${e.x}</X>
|
|
230
236
|
<Y>${-e.z}</Y>
|
|
231
237
|
<Z>${e.y}</Z>
|
|
@@ -249,7 +255,7 @@ ${o}
|
|
|
249
255
|
${l}
|
|
250
256
|
${h}
|
|
251
257
|
<FieldOfView>${this.camera.fov}</FieldOfView>
|
|
252
|
-
</PerspectiveCamera>`);const I=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,u=(await this.createComponentTags("selection")).trim(),d=(await this.createComponentTags("exception")).trim();return`<?xml version="1.0" encoding="UTF-8"?>
|
|
258
|
+
</PerspectiveCamera>`);const I=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,u=(await this.createComponentTags("selection")).trim(),d=(await this.createComponentTags("exception")).trim(),E=this.createColorTags();return`<?xml version="1.0" encoding="UTF-8"?>
|
|
253
259
|
<VisualizationInfo Guid="${this.guid}">
|
|
254
260
|
<Components>
|
|
255
261
|
${i==="2.1"?I:""}
|
|
@@ -258,6 +264,7 @@ ${o}
|
|
|
258
264
|
${i==="3"?I:""}
|
|
259
265
|
${d.length!==0?`<Exceptions>${d}</Exceptions>`:""}
|
|
260
266
|
</Visibility>
|
|
267
|
+
${E}
|
|
261
268
|
</Components>
|
|
262
269
|
${f}
|
|
263
270
|
</VisualizationInfo>`}}class zl extends ye{constructor(){super(...arguments);C(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(t){this._config.overwriteColors.value=t}}const yi=class yi extends mt{constructor(t){super(t);C(this,"enabled",!0);C(this,"list",new Qt);C(this,"isSetup",!1);C(this,"onSetup",new q);C(this,"config",new zl(this,this.components,"Viewpoints",yi.uuid));C(this,"onDisposed",new q);t.add(yi.uuid,this)}create(t,e){const s=new kn(this.components,t,{data:e});return e||this.list.set(s.guid,s),s}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};C(yi,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Zt=yi;class Lo extends ye{constructor(){super(...arguments);C(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new b.Color,type:"Color"}})}get visible(){return this._config.visible.value}set visible(t){this._config.visible.value=t;const e=this._component.renderer.domElement.style;e.display=t?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(t){this._config.lockRotation.value=t,this._component.lockRotation=t}get zoom(){return this._config.zoom.value}set zoom(t){this._config.zoom.value=t,this._component.zoom=t}get frontOffset(){return this._config.frontOffset.value}set frontOffset(t){this._config.frontOffset.value=t,this._component.frontOffset=t}get sizeX(){return this._config.sizeX.value}set sizeX(t){this._config.sizeX.value=t;const{sizeX:e,sizeY:s}=this._config,n=new b.Vector2(e.value,s.value);this._component.resize(n)}get sizeY(){return this._config.sizeY.value}set sizeY(t){this._config.sizeY.value=t;const{sizeX:e,sizeY:s}=this._config,n=new b.Vector2(e.value,s.value);this._component.resize(n)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(t){this._config.backgroundColor.value=t,this._component.backgroundColor=t}}class Po{constructor(i,t){C(this,"onDisposed",new q);C(this,"onAfterUpdate",new q);C(this,"onBeforeUpdate",new q);C(this,"onResize",new q);C(this,"onSetup",new q);C(this,"frontOffset",0);C(this,"overrideMaterial",new b.MeshDepthMaterial);C(this,"backgroundColor",new b.Color(395274));C(this,"renderer");C(this,"enabled",!0);C(this,"world");C(this,"config");C(this,"isSetup",!1);C(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new b.Color(395274)});C(this,"_lockRotation",!0);C(this,"_size",new b.Vector2(320,160));C(this,"_camera");C(this,"_plane");C(this,"_tempVector1",new b.Vector3);C(this,"_tempVector2",new b.Vector3);C(this,"_tempTarget",new b.Vector3);C(this,"down",new b.Vector3(0,-1,0));C(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const i=[],t=this.world.renderer.three;for(const e of t.clippingPlanes)i.push(e);i.push(this._plane),this.renderer.clippingPlanes=i});if(this.world=i,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new b.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const e=1,s=this._size.x/this._size.y;this._camera=new b.OrthographicCamera(e*s/-2,e*s/2,e/2,e/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new b.Plane(this.down,200),this.updatePlanes(),this.config=new Lo(this,t,"MiniMap")}get lockRotation(){return this._lockRotation}set lockRotation(i){this._lockRotation=i,i&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(i){this._camera.zoom=i,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const i=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(i instanceof b.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const e=t.controls;if(e.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(e.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){e.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const s=i.background;i.background=this.backgroundColor,this.renderer.render(i,this._camera),i.background=s,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(i=this._size){this._size.copy(i),this.renderer.setSize(i.x,i.y);const t=i.x/i.y,e=1;this._camera.left=e*t/-2,this._camera.right=e*t/2,this._camera.top=e/2,this._camera.bottom=-e/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(i)}setup(i){const t={...this._defaultConfig,...i};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const vs=class vs extends mt{constructor(t){super(t);C(this,"onAfterUpdate",new q);C(this,"onBeforeUpdate",new q);C(this,"onDisposed",new q);C(this,"onSetup",new q);C(this,"enabled",!0);C(this,"list",new Map);this.components.add(vs.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new Po(t,this.components);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};C(vs,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let _n=vs;const Us=class Us extends mt{constructor(t){super(t);C(this,"enabled",!0);t.add(Us.uuid,this)}static distanceFromPointToLine(t,e,s,n=!1){const r=new b.Line3,o=new b.Vector3;return r.set(e,s),r.closestPointToPoint(t,n,o),o.distanceTo(t)}getFace(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,r=t.geometry.index.array,{plane:o}=this.getFaceData(e,s,t),a=[];for(let I=0;I<r.length/3;I++){const{plane:u,edges:d}=this.getFaceData(I,s,t);if(u.equals(o)){a.push({index:I,edges:d});for(const{id:E,points:T,distance:p}of d)n.set(E,{points:T,distance:p})}}let l=0;const h=new Map,f=new Map;for(const{index:I,edges:u}of a){const d=new Map;for(const{id:S}of u)if(h.has(S)){const O=h.get(S);d.set(S,O)}const E=u.map(S=>S.id);if(!d.size){const S=l++;for(const{id:O}of u)h.set(O,S);f.set(S,{edges:new Set(E),indices:new Set([I])});continue}let T=null;const p=new Set,m=new Set(E);for(const[S,O]of d){T===null?T=O:O!==T&&p.add(O),h.delete(S);const{edges:y}=f.get(O);y.delete(S),m.delete(S)}if(T===null)throw new Error("Error computing face!");const F=f.get(T),{indices:R}=F;R.add(I);for(const S of m){h.set(S,T);const{edges:O}=F;O.add(S)}for(const S of p){const O=f.get(S),{edges:y,indices:w}=O,P=f.get(T),{edges:v,indices:G}=P;for(const N of y)v.add(N),h.set(N,T);for(const N of w)G.add(N);f.delete(S)}}for(const[I,{indices:u,edges:d}]of f)if(u.has(e)){const E=[];for(const T of d){const p=n.get(T);E.push(p)}return{edges:E,indices:u}}return null}getVerticesAndNormal(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=t.geometry.index.array,r=t.geometry.attributes.position.array,o=t.geometry.attributes.normal.array,a=n[e*3]*3,l=n[e*3+1]*3,h=n[e*3+2]*3,f=new b.Vector3(r[a],r[a+1],r[a+2]),I=new b.Vector3(r[l],r[l+1],r[l+2]),u=new b.Vector3(r[h],r[h+1],r[h+2]),d=new b.Vector3(o[a],o[a+1],o[a+2]),E=new b.Vector3(o[l],o[l+1],o[l+2]),T=new b.Vector3(o[h],o[h+1],o[h+2]),p=(d.x+E.x+T.x)/3,m=(d.y+E.y+T.y)/3,F=(d.z+E.z+T.z)/3,R=new b.Vector3(p,m,F);if(s!==void 0&&t instanceof b.InstancedMesh){const S=new b.Matrix4;t.getMatrixAt(s,S);const O=new b.Matrix4;O.extractRotation(S),R.applyMatrix4(O),f.applyMatrix4(S),I.applyMatrix4(S),u.applyMatrix4(S)}return{p1:f,p2:I,p3:u,faceNormal:R}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}getVolumeFromFragments(t){const e=this.components.get(pt),s=new b.Matrix4,n=[];for(const o in t){const a=e.list.get(o);if(!a)continue;const l=t[o];let h=0;for(const u of l){const d=a.getInstancesIDs(u);d&&(h+=d.size)}const f=new b.InstancedMesh(a.mesh.geometry,void 0,h);let I=0;for(const u of l){const d=a.getInstancesIDs(u);if(d)for(const E of d)a.mesh.getMatrixAt(E,s),f.setMatrixAt(I++,s)}n.push(f)}const r=this.getVolumeFromMeshes(n);for(const o of n)o.geometry=null,o.material=[],o.dispose();return r}getVolumeFromMeshes(t){let e=0;for(const s of t)e+=this.getVolumeOfMesh(s);return e}getFaceData(t,e,s){const n=this.getVerticesAndNormal(s,t,e),{p1:r,p2:o,p3:a,faceNormal:l}=n;this.round(r),this.round(o),this.round(a),this.round(l);const h=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((F,R)=>F.id<R.id?-1:F.id>R.id?1:0);const[{id:f,value:I},{id:u,value:d},{id:E,value:T}]=h,p=[{id:`${f}|${u}`,distance:I.distanceTo(d),points:[I,d]},{id:`${u}|${E}`,distance:d.distanceTo(T),points:[d,T]},{id:`${f}|${E}`,distance:I.distanceTo(T),points:[I,T]}],m=new b.Plane;return m.setFromNormalAndCoplanarPoint(l,r),m.constant=Math.round(m.constant*10)/10,{plane:m,edges:p}}getVolumeOfMesh(t){let e=0;const s=new b.Vector3,n=new b.Vector3,r=new b.Vector3,{index:o}=t.geometry,a=t.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const l=[];if(t instanceof b.InstancedMesh)for(let f=0;f<t.count;f++){const I=new b.Matrix4;t.getMatrixAt(f,I),l.push(I)}else l.push(new b.Matrix4().identity());const{matrixWorld:h}=t;for(let f=0;f<o.array.length-2;f+=3)for(const I of l){const u=I.multiply(h),d=o.array[f]*3,E=o.array[f+1]*3,T=o.array[f+2]*3;s.set(a[d],a[d+1],a[d+2]).applyMatrix4(u),n.set(a[E],a[E+1],a[E+2]).applyMatrix4(u),r.set(a[T],a[T+1],a[T+2]).applyMatrix4(u),e+=this.getSignedVolumeOfTriangle(s,n,r)}return Math.abs(e)}getSignedVolumeOfTriangle(t,e,s){const n=s.x*e.y*t.z,r=e.x*s.y*t.z,o=s.x*t.y*e.z,a=t.x*s.y*e.z,l=e.x*t.y*s.z,h=t.x*e.y*s.z;return 1/6*(-n+r+o-a-l+h)}};C(Us,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Mn=Us;class bi{constructor(i){C(this,"cardinality","required");C(this,"instructions");C(this,"evalRequirement",(i,t,e,s)=>{const n={parameter:e,currentValue:i,requiredValue:t.parameter,pass:!1};s&&this.addCheckResult(n,s);let r=!1;if(t.type==="simple"){const o=t.parameter;r=i===o}if(t.type==="enumeration"&&(r=t.parameter.includes(i)),t.type==="pattern"){const o=t.parameter;r=new RegExp(o).test(String(i))}if(t.type==="length"){const o=t.parameter,{min:a,length:l,max:h}=o;l!==void 0&&(r=String(i).length===l),a!==void 0&&(r=String(i).length>=a),h!==void 0&&(r=String(i).length<=h)}if(t.type==="bounds"&&typeof i=="number"){const{min:o,minInclusive:a,max:l,maxInclusive:h}=t.parameter;let f=!0,I=!0;o!==void 0&&(f=a?i<=o:i<o),l!==void 0&&(I=h?i>=l:i>l),r=f&&I}return this.cardinality==="prohibited"&&(r=!r),this.cardinality==="optional"&&(r=!0),n.pass=r,n.pass});C(this,"testResult",[]);this.components=i}addCheckResult(i,t){const e=t.findIndex(({parameter:s})=>s===i.parameter);e!==-1?t[e]=i:t.push(i)}saveResult(i,t){const{GlobalId:e}=i;if(!e)return;const{value:s}=e,n={expressID:s,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const de=(c,i)=>{let t="";return i?(i.type==="simple"&&(t=`<ids:simpleValue>${i.parameter}</ids:simpleValue>`),i.type==="enumeration"&&(t=`<xs:restriction base="xs:string">
|
package/dist/index.mjs
CHANGED
|
@@ -3137,7 +3137,7 @@ const Fs = class Fs {
|
|
|
3137
3137
|
/**
|
|
3138
3138
|
* The version of the @thatopen/components library.
|
|
3139
3139
|
*/
|
|
3140
|
-
C(Fs, "release", "2.3.
|
|
3140
|
+
C(Fs, "release", "2.3.11");
|
|
3141
3141
|
let Cs = Fs;
|
|
3142
3142
|
class Qa extends xn {
|
|
3143
3143
|
constructor() {
|
|
@@ -18547,9 +18547,9 @@ class To {
|
|
|
18547
18547
|
*/
|
|
18548
18548
|
C(this, "clippingPlanes", new we());
|
|
18549
18549
|
C(this, "camera", {
|
|
18550
|
-
aspectRatio:
|
|
18551
|
-
fov:
|
|
18552
|
-
direction: { x: 0, y: 0, z:
|
|
18550
|
+
aspectRatio: 1,
|
|
18551
|
+
fov: 60,
|
|
18552
|
+
direction: { x: 0, y: 0, z: 0 },
|
|
18553
18553
|
position: { x: 0, y: 0, z: 0 }
|
|
18554
18554
|
});
|
|
18555
18555
|
/**
|
|
@@ -18747,28 +18747,38 @@ class To {
|
|
|
18747
18747
|
"Viewpoint: the world's camera need controls to set the viewpoint."
|
|
18748
18748
|
);
|
|
18749
18749
|
t instanceof _c && t.projection.set(this.projection);
|
|
18750
|
-
const e =
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18750
|
+
const e = new D.Vector3(
|
|
18751
|
+
this.camera.position.x,
|
|
18752
|
+
this.camera.position.y,
|
|
18753
|
+
this.camera.position.z
|
|
18754
|
+
), s = new D.Vector3(
|
|
18755
|
+
this.camera.direction.x,
|
|
18756
|
+
this.camera.direction.y,
|
|
18757
|
+
this.camera.direction.z
|
|
18758
|
+
);
|
|
18759
|
+
if (e.equals(new D.Vector3()) && s.equals(new D.Vector3()))
|
|
18760
|
+
return;
|
|
18761
|
+
const n = this.position, r = this.direction;
|
|
18762
|
+
let o = {
|
|
18763
|
+
x: n.x + r.x * 80,
|
|
18764
|
+
y: n.y + r.y * 80,
|
|
18765
|
+
z: n.z + r.z * 80
|
|
18755
18766
|
};
|
|
18756
|
-
const
|
|
18757
|
-
if (Object.keys(
|
|
18758
|
-
const
|
|
18759
|
-
|
|
18767
|
+
const a = this.selection;
|
|
18768
|
+
if (Object.keys(a).length === 0) {
|
|
18769
|
+
const f = this._components.get(ci).get(this.world).castRayFromVector(n, this.direction);
|
|
18770
|
+
f && (o = f.point);
|
|
18760
18771
|
} else {
|
|
18761
|
-
const
|
|
18762
|
-
|
|
18763
|
-
}
|
|
18764
|
-
|
|
18765
|
-
o.set(this.defaultVisibility), o.set(!this.defaultVisibility, this.exception), o.set(!0, r), await t.controls.setLookAt(
|
|
18766
|
-
e.x,
|
|
18767
|
-
e.y,
|
|
18768
|
-
e.z,
|
|
18772
|
+
const l = this._components.get(wn);
|
|
18773
|
+
l.reset(), l.addFragmentIdMap(a), o = l.getSphere().center, l.reset();
|
|
18774
|
+
}
|
|
18775
|
+
await t.controls.setLookAt(
|
|
18769
18776
|
n.x,
|
|
18770
18777
|
n.y,
|
|
18771
18778
|
n.z,
|
|
18779
|
+
o.x,
|
|
18780
|
+
o.y,
|
|
18781
|
+
o.z,
|
|
18772
18782
|
i
|
|
18773
18783
|
);
|
|
18774
18784
|
}
|
|
@@ -18811,6 +18821,10 @@ class To {
|
|
|
18811
18821
|
viewToWorldScale: s.top - s.bottom
|
|
18812
18822
|
}), this._components.get(ie).list.set(this.guid, this);
|
|
18813
18823
|
}
|
|
18824
|
+
applyVisibility() {
|
|
18825
|
+
const i = this._components.get(Mn);
|
|
18826
|
+
i.set(this.defaultVisibility), i.set(!this.defaultVisibility, this.exception), i.set(!0, this.selection);
|
|
18827
|
+
}
|
|
18814
18828
|
/**
|
|
18815
18829
|
* Applies color to the components in the viewpoint based on their GUIDs.
|
|
18816
18830
|
*
|
|
@@ -18821,21 +18835,15 @@ class To {
|
|
|
18821
18835
|
* The color is applied using the `Classifier.setColor` method, which sets the color of the specified fragments.
|
|
18822
18836
|
* The color is provided as a hexadecimal string, prefixed with a '#'.
|
|
18823
18837
|
*/
|
|
18824
|
-
|
|
18838
|
+
applyColors() {
|
|
18825
18839
|
const i = this._components.get(ie), t = this._components.get(Tt), e = this._components.get(Bi);
|
|
18826
18840
|
for (const [s, n] of this.componentColors) {
|
|
18827
|
-
const r = t.guidToFragmentIdMap(n)
|
|
18828
|
-
e.setColor(
|
|
18829
|
-
r,
|
|
18830
|
-
o,
|
|
18831
|
-
i.config.overwriteColors
|
|
18832
|
-
);
|
|
18841
|
+
const r = t.guidToFragmentIdMap(n);
|
|
18842
|
+
e.setColor(r, s, i.config.overwriteColors);
|
|
18833
18843
|
}
|
|
18834
18844
|
}
|
|
18835
18845
|
/**
|
|
18836
18846
|
* Resets the colors of all components in the viewpoint to their original color.
|
|
18837
|
-
* This method iterates through the `componentColors` map, retrieves the fragment IDs
|
|
18838
|
-
* corresponding to each color, and then uses the `Classifier` to reset the color of those fragments.
|
|
18839
18847
|
*/
|
|
18840
18848
|
resetColors() {
|
|
18841
18849
|
const i = this._components.get(Tt), t = this._components.get(Bi);
|
|
@@ -18873,6 +18881,20 @@ class To {
|
|
|
18873
18881
|
`);
|
|
18874
18882
|
return s;
|
|
18875
18883
|
}
|
|
18884
|
+
createColorTags() {
|
|
18885
|
+
let i = "";
|
|
18886
|
+
for (const [t, e] of this.componentColors.entries()) {
|
|
18887
|
+
const s = `#${t.getHexString()}`, n = e.map((r) => `
|
|
18888
|
+
<Component IfcGuid="${r}" />`).join(`
|
|
18889
|
+
`);
|
|
18890
|
+
i += `<Color Color="${s}">
|
|
18891
|
+
${n}
|
|
18892
|
+
</Color>`;
|
|
18893
|
+
}
|
|
18894
|
+
return i.length !== 0 ? `<Coloring>
|
|
18895
|
+
${i}
|
|
18896
|
+
</Coloring>` : "<Coloring />";
|
|
18897
|
+
}
|
|
18876
18898
|
/**
|
|
18877
18899
|
* Serializes the viewpoint into a buildingSMART compliant XML string for export.
|
|
18878
18900
|
*
|
|
@@ -18919,7 +18941,7 @@ class To {
|
|
|
18919
18941
|
${h}
|
|
18920
18942
|
<FieldOfView>${this.camera.fov}</FieldOfView>
|
|
18921
18943
|
</PerspectiveCamera>`);
|
|
18922
|
-
const I = `<ViewSetupHints SpacesVisible="${this.spacesVisible ?? !1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible ?? !1}" OpeningsVisible="${this.openingsVisible ?? !1}" />`, u = (await this.createComponentTags("selection")).trim(), d = (await this.createComponentTags("exception")).trim();
|
|
18944
|
+
const I = `<ViewSetupHints SpacesVisible="${this.spacesVisible ?? !1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible ?? !1}" OpeningsVisible="${this.openingsVisible ?? !1}" />`, u = (await this.createComponentTags("selection")).trim(), d = (await this.createComponentTags("exception")).trim(), E = this.createColorTags();
|
|
18923
18945
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
18924
18946
|
<VisualizationInfo Guid="${this.guid}">
|
|
18925
18947
|
<Components>
|
|
@@ -18929,6 +18951,7 @@ class To {
|
|
|
18929
18951
|
${i === "3" ? I : ""}
|
|
18930
18952
|
${d.length !== 0 ? `<Exceptions>${d}</Exceptions>` : ""}
|
|
18931
18953
|
</Visibility>
|
|
18954
|
+
${E}
|
|
18932
18955
|
</Components>
|
|
18933
18956
|
${f}
|
|
18934
18957
|
</VisualizationInfo>`;
|