@giro3d/piero 1.0.0-beta.0 → 1.0.0-beta.2

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.
Files changed (59) hide show
  1. package/dist/Components.cjs.js +5 -1
  2. package/dist/Components.cjs.js.map +1 -1
  3. package/dist/Components.es.js +6286 -432
  4. package/dist/Components.es.js.map +1 -1
  5. package/dist/assets/piero.css +2 -2
  6. package/dist/index.cjs.js +11 -3
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.es.js +8206 -4441
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/modules.cjs.js +2 -1
  11. package/dist/modules.cjs.js.map +1 -1
  12. package/dist/modules.es.js +1051 -414
  13. package/dist/modules.es.js.map +1 -1
  14. package/dist/src/api/AnalysisApi.d.ts +15 -0
  15. package/dist/src/api/DatasetApi.d.ts +28 -0
  16. package/dist/src/api/NotificationApi.d.ts +10 -0
  17. package/dist/src/api/ViewApi.d.ts +4 -0
  18. package/dist/src/api/index.d.ts +2 -2
  19. package/dist/src/components/panels/AnalysisPanel.vue.d.ts +1 -1
  20. package/dist/src/components/panels/DatasetOrGroupItem.vue.d.ts +0 -2
  21. package/dist/src/components/panels/analysis/ToolWrapper.vue.d.ts +1 -6
  22. package/dist/src/context.d.ts +7 -0
  23. package/dist/src/index.d.ts +2 -1
  24. package/dist/src/module.d.ts +4 -0
  25. package/dist/src/modules/ClippingBoxAnalysis.d.ts +18 -0
  26. package/dist/src/modules/CrossSectionAnalysis.d.ts +11 -0
  27. package/dist/src/modules/DownloadDataset.d.ts +12 -0
  28. package/dist/src/modules/FloodingPlaneAnalysis.d.ts +11 -0
  29. package/dist/src/modules/IFCLoader.d.ts +1 -0
  30. package/dist/src/modules/PLYLoader.d.ts +1 -0
  31. package/dist/src/modules/PotreeLoader.d.ts +1 -0
  32. package/dist/src/modules/Tour.d.ts +1 -0
  33. package/dist/src/{services/analysis → modules/clippingBoxAnalysis}/ClippingBoxManager.d.ts +9 -3
  34. package/dist/src/modules/clippingBoxAnalysis/store.d.ts +2268 -0
  35. package/dist/src/modules/crossSectionAnalysis/CrossSectionManager.d.ts +8 -0
  36. package/dist/src/modules/crossSectionAnalysis/store.d.ts +522 -0
  37. package/dist/src/modules/floodingPlaneAnalysis/FloodingPlaneManager.d.ts +9 -0
  38. package/dist/src/{types/FloodingPlane.d.ts → modules/floodingPlaneAnalysis/FloodingPlaneObject.d.ts} +2 -2
  39. package/dist/src/modules/floodingPlaneAnalysis/store.d.ts +16 -0
  40. package/dist/src/modules/index.d.ts +5 -1
  41. package/dist/src/services/Giro3DManager.d.ts +0 -2
  42. package/dist/src/services/Picker.d.ts +1 -1
  43. package/dist/src/stores/analysis.d.ts +19 -1569
  44. package/dist/src/stores/datasets.d.ts +23 -1
  45. package/dist/src/stores/modules.d.ts +5 -1
  46. package/dist/src/stores/modules.test.d.ts +1 -0
  47. package/dist/src/stores/notifications.d.ts +1 -0
  48. package/package.json +1 -5
  49. package/dist/src/components/charts/BarChart.vue.d.ts +0 -4
  50. package/dist/src/components/charts/DoughnutChart.vue.d.ts +0 -4
  51. package/dist/src/components/panels/LoadingIndicator.vue.d.ts +0 -6
  52. package/dist/src/components/panels/analysis/FloodingPlane.vue.d.ts +0 -2
  53. package/dist/src/services/AnalysisManager.d.ts +0 -10
  54. package/dist/src/services/analysis/CrossSectionManager.d.ts +0 -9
  55. package/dist/src/services/analysis/FloodingPlaneManager.d.ts +0 -11
  56. package/dist/src/stores/statistics.d.ts +0 -8
  57. /package/dist/src/{components/panels/analysis → modules/clippingBoxAnalysis}/ClippingBox.vue.d.ts +0 -0
  58. /package/dist/src/{components/panels/analysis → modules/crossSectionAnalysis}/CrossSection.vue.d.ts +0 -0
  59. /package/dist/src/{components/panels/analysis/Statistics.vue.d.ts → modules/floodingPlaneAnalysis/FloodingPlane.vue.d.ts} +0 -0
@@ -1,2 +1,3 @@
1
- "use strict";var O=Object.defineProperty;var D=(l,a,t)=>a in l?O(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t;var h=(l,a,t)=>D(l,typeof a!="symbol"?a+"":a,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("/builds/giro3d/piero/node_modules/@giro3d/giro3d/gui/EntityPanel.js"),g=require("/builds/giro3d/piero/node_modules/openbim-components/index.js"),f=require("./Components.cjs.js"),B=require("/builds/giro3d/piero/node_modules/@giro3d/giro3d/entities/Entity3D.js"),_=require("/builds/giro3d/piero/node_modules/three"),z=require("/builds/giro3d/piero/node_modules/@giro3d/giro3d/gui/EntityInspector.js"),c=require("/builds/giro3d/piero/node_modules/vue/dist/vue.runtime.esm-bundler.js"),j=require("/builds/giro3d/piero/node_modules/three/examples/jsm/loaders/PLYLoader.js"),V=require("/builds/giro3d/piero/node_modules/@giro3d/giro3d/entities/PointCloud.js"),R=require("/builds/giro3d/piero/node_modules/@giro3d/giro3d/sources/PotreeSource.js"),w=require("/builds/giro3d/piero/node_modules/shepherd.js/dist/js/shepherd.esm.js"),x=new _.Matrix4,U={bbox:new _.MeshBasicMaterial({color:"#FFFF00",depthTest:!0,opacity:.2,transparent:!0}),selection:new _.MeshBasicMaterial({color:"#FF0000",depthTest:!1,opacity:.6,transparent:!0})},Y=4186316022,q=781010003,G=2655215786,W=3242617779,H=919958153,$=1307041759,F=1451395588,L=1883228015,Q=[F,L],J=[Y,q,G,W,H,$],M=l=>f.isObject(l)&&l.isIFCPickResult,P=class P extends B{constructor(t){super(new _.Group);h(this,"isIfcEntity",!0);h(this,"isPickableFeatures",!0);h(this,"type","IfcEntity");h(this,"_classificationCache");h(this,"_components");h(this,"_fragmentBoundingBox");h(this,"_fragmentClassifier");h(this,"_fragmentManager");h(this,"_ifcSelection");h(this,"_indexMap");h(this,"_model");h(this,"_source");this._source=t,this._components=new g.Components,this._components.ui.enabled=!1,this._components.scene=new g.SimpleScene(this._components),this._components.renderer=new g.SimpleRenderer(this._components,document.createElement("div")),this._components.camera=new g.SimpleCamera(this._components),this._components.raycaster=new g.SimpleRaycaster(this._components),this._components.init(),this._ifcSelection={bbox:{},selection:{}},this._indexMap={},this._classificationCache=null,this._fragmentBoundingBox=null}clearHighlight(t="selection"){for(const e of Object.keys(this._ifcSelection[t])){const o=this._fragmentManager.list[e],n=o==null?void 0:o.fragments[t];n!=null&&n.mesh.removeFromParent()}this.notifyChange(this),this._ifcSelection[t]={}}getBoundingBoxById(t){this.clearHighlight("bbox"),this.highlightById(t,"bbox");const e=this._fragmentBoundingBox;if(e===null)throw new Error("Must call initClassification before getBoundingBoxById");const o=this._fragmentManager;e.reset();const n=this._ifcSelection.bbox;if(!Object.keys(n).length)return;for(const d of Object.keys(n)){const y=o.list[d].fragments.bbox;e.addMesh(y.mesh)}const s=e.get(),{y:r,z:u}=s.min,{y:m,z:i}=s.max;return s.min.y=-i,s.max.y=-u,s.min.z=r,s.max.z=m,s.translate(this._model.position),this.clearHighlight("bbox"),s}getClassification(){if(this._classificationCache===null)throw new Error("Must call initClassification before getClassification");return this._classificationCache}getProperties(t){const e=[],o=this._model.properties;if(!o)return[];for(const n of this._indexMap[t]){const s=o[n];if(s==null)continue;const{name:r}=g.IfcPropertiesUtils.getEntityName(o,n);if(r!==null){if(s.type===F){const u=g.IfcPropertiesUtils.getPsetProps(o,n);if(u!==null)for(const m of u){if(o[m]==null)continue;const d=this.getProperty(m);d!==null&&e.push({parentName:r,...d})}}else if(s.type===L){const u=g.IfcPropertiesUtils.getQsetQuantities(o,n);if(u!==null)for(const m of u){const{key:i}=g.IfcPropertiesUtils.getQuantityValue(o,m);if(i===null)continue;const d=this.getProperty(m);d!==null&&e.push({parentName:r,...d})}}}}return e}getProperty(t){const e=this._model.properties;if(e===void 0)return null;const{name:o}=g.IfcPropertiesUtils.getEntityName(e,t);if(o===null)return null;const{value:n}=g.IfcPropertiesUtils.getQuantityValue(e,t);return{name:o,value:n}}highlight(t,e,o){this._ifcSelection[t][e.uuid]=new Set;const n=parseInt(o,10);this._ifcSelection[t][e.uuid].add(o),this.addComposites(t,e,n),this.regenerate(t,e.uuid);const s=e.fragment.group;if(s){const r=s.data[n][0];for(let u=0;u<r.length;u++){const m=r[u],i=s.keyFragments[m],d=this._fragmentManager.list[i];i in this._ifcSelection[t]||(this._ifcSelection[t][i]=new Set),this._ifcSelection[t][i].add(o),this.addComposites(t,d.mesh,n),this.regenerate(t,i)}}this.notifyChange(this)}highlightById(t,e="selection"){for(const o of Object.keys(t)){o in this._ifcSelection[e]||(this._ifcSelection[e][o]=new Set);const n=this._fragmentManager.list[o],s=new Set;for(const r of t[o])this._ifcSelection[e][o].add(r),s.add(parseInt(r,10));for(const r of s)this.addComposites(e,n.mesh,r);this.regenerate(e,o)}this.notifyChange(this)}pick(t,e){return super.pick(t,e).map(o=>({...o,entity:this,features:o.features,isIFCPickResult:!0,object:o.object}))}pickFeaturesFrom(t){var o,n,s;const e=t.object;if(e.fragment!=null&&t.instanceId!=null&&t.face){const r=e.fragment.getVertexBlockID(e.geometry,t.face.a),u=(o=e.fragment.getItemID(t.instanceId,r))==null?void 0:o.replace(/\..*/,"");if(u&&((s=(n=e.fragment.group)==null?void 0:n.properties)==null?void 0:s[u])!=null){const i=e.fragment.group.properties[u],p=[{ifcProperties:this.getProperties(u),itemProperties:i}];return t.features=p,p}}return[]}async initClassification(){this._classificationCache=await this.regenerateClassification(["storeys","entities"]),this._classificationCache.length===0&&(this._classificationCache=await this.regenerateClassification(["entities"])),this._fragmentBoundingBox=await this._components.tools.get(g.FragmentBoundingBox)}async preprocess(){const t=await f.Fetcher.fetchArrayBuffer(this._source.url);this._fragmentManager=await this._components.tools.get(g.FragmentManager),this._fragmentClassifier=await this._components.tools.get(g.FragmentClassifier);const e=new g.FragmentIfcLoader(this._components);e.settings.webIfc.COORDINATE_TO_ORIGIN=!0,e.settings.webIfc.OPTIMIZE_PROFILES=!0;const o=new Uint8Array(t);this._model=await e.load(o,this._source.name),this._model.rotateX(Math.PI/2);const n=new _.Vector3;if(this._source.at)this._source.at.toVector3(n),this._model.position.copy(n);else{const r=this._model.coordinationMatrix.clone().invert();n.applyMatrix4(r),this._model.position.set(n.x,-n.z,n.y)}this._model.updateWorldMatrix(!0,!0),this._model.updateMatrix(),this._model.updateMatrixWorld(!0),this.initializeEntityIndexes(),this._fragmentClassifier.byStorey(this._model),this._fragmentClassifier.byEntity(this._model),await this.initClassification(),this.object3d.add(this._model),this.onObjectCreated(this._model);const s=f.Fetcher.getContext(this._source.url);f.fillObject3DUserData(this,{filename:s.filename}),this.notifyChange(this.object3d)}addComposites(t,e,o){this.addHighlightToFragment(t,e.fragment);const n=e.fragment.composites[o];if(n)for(let s=1;s<n;s++){const r=g.toCompositeID(o,s);this._ifcSelection[t][e.uuid].add(r)}}addHighlightToFragment(t,e){if(!(t in e.fragments)){const o=e.addFragment(t,[U[t]]);e.blocks.count>1&&(o.setInstance(0,{ids:Array.from(e.ids),transform:x}),o.blocks.setVisibility(!1)),this._model.add(o.mesh),o.mesh.renderOrder=30,o.mesh.frustumCulled=!1,o.mesh.name=t,o.mesh.updateMatrixWorld(!0)}}initializeEntityIndexes(){this._indexMap={};const t=this._model.properties;if(t!==void 0)for(const e of J)g.IfcPropertiesUtils.getRelationMap(t,e,(o,n)=>{const s=t[o];Q.includes(s.type)||this.setEntityIndex(o);for(const r of n)this.setEntityIndex(r).add(o)})}regenerate(t,e){this.updateFragmentFill(t,e)}async regenerateClassification(t,e={}){const o=this._fragmentClassifier.get(),n=[],s=t[0],r=o[s];if(s==null||r==null)return n;for(const u of Object.keys(r)){const m={...e,[s]:[u]},i=await this._fragmentClassifier.find(m);if(Object.keys(i).length>0){const y=s[0].toUpperCase()+s.slice(1),b=await this.regenerateClassification(t.slice(1),m);n.push({children:b,fragments:i,name:u,treeItemName:y})}}return n}setEntityIndex(t){return t in this._indexMap||(this._indexMap[t]=new Set),this._indexMap[t]}updateFragmentFill(t,e){const o=this._ifcSelection[t][e],n=this._fragmentManager.list[e];if(n==null)return;const s=n.fragments[t];if(s==null)return;const r=n.mesh.parent;if(r==null)return;if(r.add(s.mesh),s.blocks.count>1)n.getInstance(0,x),s.setInstance(0,{ids:Array.from(n.ids),transform:x}),s.blocks.setVisibility(!0,o,!0);else{let m=0;for(const i of o){s.mesh.count=m+1;const{instanceID:d}=n.getInstanceAndBlockID(i);n.getInstance(d,x),s.setInstance(m,{ids:[i],transform:x}),m++}}}};h(P,"isIFCEntity",t=>f.isObject(t)&&t.isIfcEntity),h(P,"isIFCPickResult",t=>f.isObject(t)&&P.isIFCEntity(t.entity));let k=P;class Z extends z{constructor(a,t,e){super(a,t,e,{visibility:!0})}}const K={class:"d-flex"},X=["title"],tt=["id"],et={class:"list-unstyled border-start"},ot=c.defineComponent({__name:"IfcSubtree",props:{classificationElement:{},ifcEntity:{}},setup(l){const a=l,t=_.MathUtils.generateUUID(),e=`#${t}`,o=c.ref(!1),n=f.useCameraStore(),s=f.useAnalysisStore();function r(){const i=a.ifcEntity.getBoundingBoxById(a.classificationElement.fragments);i&&!i.isEmpty()&&(s.setClippingBox(i),s.enableClippingBox(!0))}function u(){o.value=!0,a.ifcEntity.clearHighlight(),a.ifcEntity.highlightById(a.classificationElement.fragments),setTimeout(()=>o.value=!1,2e3)}function m(){const i=a.ifcEntity.getBoundingBoxById(a.classificationElement.fragments);i&&!i.isEmpty()&&n.lookTopDownAt(i)}return(i,d)=>{const p=c.resolveComponent("IfcSubtree",!0);return c.openBlock(),c.createElementBlock("div",null,[c.createElementVNode("div",K,[c.createElementVNode("span",{class:c.normalizeClass(["border rounded px-1 py-0 fw-normal",o.value?"text-danger border-danger":"text-secondary border-secondary"]),title:i.classificationElement.treeItemName},c.toDisplayString(i.classificationElement.treeItemName),11,X),i.classificationElement.children.length>0?(c.openBlock(),c.createBlock(f.IconList,{key:0},{default:c.withCtx(()=>[c.createVNode(f.IconListButton,{title:"Expand group",icon:"bi-chevron-down","data-bs-toggle":"collapse","data-bs-target":e,"aria-controls":c.unref(t),"aria-expanded":"true"},null,8,["aria-controls"])]),_:1})):c.createCommentVNode("",!0),c.createVNode(f._sfc_main$2,{class:c.normalizeClass(["label",o.value?"text-danger-emphasis":"text-muted"]),text:i.classificationElement.name,title:`Zoom to ${i.classificationElement.name}`,onClick:m},null,8,["class","text","title"]),c.createVNode(f.IconList,{class:"ms-1"},{default:c.withCtx(()=>[c.createVNode(f.IconListButton,{title:"Highlight",icon:"bi-highlighter",onClick:u}),c.createVNode(f.IconListButton,{title:"Clip to",icon:"bi-bounding-box",onClick:r})]),_:1})]),i.classificationElement.children.length>0?(c.openBlock(),c.createElementBlock("div",{key:0,id:c.unref(t),class:"collapse show"},[c.createElementVNode("ul",et,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.classificationElement.children,(y,b)=>(c.openBlock(),c.createElementBlock("li",{key:b},[c.createVNode(p,{"ifc-entity":a.ifcEntity,"classification-element":y},null,8,["ifc-entity","classification-element"])]))),128))])],8,tt)):c.createCommentVNode("",!0)])}}}),nt=f._export_sfc(ot,[["__scopeId","data-v-c2ab888d"]]),st={key:0},it=c.defineComponent({__name:"IfcPropertyView",props:{dataset:{}},setup(l){const a=f.useDatasetStore(),t=l,e=f.refAndWatch(t.dataset,"isPreloaded");function o(){const s=n();return s==null?null:s.getClassification()}function n(){const s=a.getEntity(t.dataset);return s??null}return(s,r)=>c.unref(e)?(c.openBlock(),c.createElementBlock("div",st,[c.createElementVNode("ul",null,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o(),(u,m)=>(c.openBlock(),c.createElementBlock("li",{key:m},[c.createVNode(nt,{"ifc-entity":n(),"classification-element":u},null,8,["ifc-entity","classification-element"])]))),128))])])):c.createCommentVNode("",!0)}}),at=f._export_sfc(it,[["__scopeId","data-v-d2d82ae7"]]),rt=l=>{if(M(l)){const a=l.object;if(a.fragment!=null&&l.face&&l.instanceId!=null){const t=a.fragment.getVertexBlockID(a.geometry,l.face.a),e=a.fragment.getItemID(l.instanceId,t).replace(/\..*/,"");return l.entity.highlight("selection",a,e),()=>l.entity.clearHighlight()}}return null},ct=l=>({name:l.filename,source:{url:l.file},type:"ifc",visible:!0}),lt=(l,a)=>{var u,m,i,d,p,y,b,I,C;if(!M(l))return;const t=(u=l.features)==null?void 0:u.at(0);if(!t)return;a.has("IFC")||a.set("IFC",[]);const e=a.get("IFC"),{ifcProperties:o,itemProperties:n}=t,s="NULL",r=((m=n.Name)==null?void 0:m.value)??s;e.push({key:"Site",value:((d=(i=l.entity.object3d.userData)==null?void 0:i.dataset)==null?void 0:d.name)??s}),e.push({key:"IFCType",value:g.IfcCategoryMap[n.type]??s}),e.push({key:"Name",value:r}),e.push({key:"ID",value:n.expressID}),e.push({key:"GlobalId",value:((p=n.GlobalId)==null?void 0:p.value)??s}),((y=n.Description)==null?void 0:y.value)!=null&&e.push({key:"Description",value:n.Description.value}),((b=n.PredefinedType)==null?void 0:b.value)!=null&&e.push({key:"PredefinedType",value:n.PredefinedType.value}),((I=n.ObjectType)==null?void 0:I.value)!=null&&e.push({key:"ObjectType",value:n.ObjectType.value});for(const{name:S,parentName:T,value:N}of o)a.has(T)||a.set(T,[]),(C=a.get(T))==null||C.push({key:S,value:N})},ut=l=>{const a=l.dataset,t=a.config,e=f.getCoordinates(t.source.position??a.get("position")),o=new k({...t.source,at:e,name:a.name});return Promise.resolve(o)};class dt{constructor(){h(this,"name","IFC")}async initialize(a){a.datasets.registerDatasetType("ifc",{attributeExtractor:lt,entityBuilder:ut,fileExtensions:["ifc"],highlight:rt,icon:"bi-building",loader:ct,name:"IFC",propertyView:at}),A.registerInspector("IfcEntity",Z),await f.Fetcher.fetch("web-ifc.wasm").catch(t=>{console.warn("Could not load web-ifc.wasm",t)})}}const v=class v extends _.Mesh{constructor(){super(...arguments);h(this,"isPickableFeatures",!0);h(this,"isPlyMesh",!0)}pickFeaturesFrom(t){if(this.geometry.hasAttribute("color")&&t.face){const e=this.geometry.getAttribute("color").array,o=t.face,s=[{color:new _.Color(e[o.a*3],e[o.a*3+1],e[o.a*3+2])}];return t.features=s,s}return[]}};h(v,"isPlyMesh",t=>f.isObject(t)&&t.isPlyMesh),h(v,"isPlyPickResult",t=>f.isObject(t)&&v.isPlyMesh(t==null?void 0:t.object));let E=v;class ht extends B{constructor(t){super(new _.Group);h(this,"isPlyEntity",!0);h(this,"source");this.source=t}async preprocess(){const t=await f.Fetcher.fetchArrayBuffer(this.source.url),e=this.source.at.as(this.source.featureProjection).toVector3(),n=new j.PLYLoader().parse(t),s=new _.MeshLambertMaterial({side:_.DoubleSide});n.hasAttribute("color")&&(s.vertexColors=!0),n.computeVertexNormals();const r=new E(n,s);r.name="plyModel",n.computeBoundingBox(),r.position.copy(e),r.updateWorldMatrix(!0,!0),this.object3d.add(r),this.onObjectCreated(r);const u=f.Fetcher.getContext(this.source.url);f.fillObject3DUserData(this,{filename:u.filename}),this.notifyChange(this.object3d)}}const mt=l=>{const{dataset:a,instance:t}=l,e=a.config,o=f.getCoordinates(e.source.position??a.get("position")),n=new ht({...e.source,at:o,featureProjection:t.referenceCrs});return Promise.resolve(n)},ft=(l,a)=>{var o;if(!E.isPlyPickResult(l))return;const t=(o=l.features)==null?void 0:o.at(0);if(!t)return;a.has("PLY")||a.set("PLY",[]),a.get("PLY").push({key:"Color",value:t.color})};class pt{constructor(){h(this,"name","PLY")}initialize(a){a.datasets.registerDatasetType("ply",{attributeExtractor:ft,entityBuilder:mt,icon:"bi-file-earmark-binary",name:"PLY"})}}const gt=l=>{const a=l.dataset.config,t=new V({source:new R({url:`${a.source.url}/${a.source.filename}`})});return f.fillObject3DUserData(t,{filename:a.source.url}),Promise.resolve(t)};class yt{constructor(){h(this,"name","Potree")}initialize(a){a.datasets.registerDatasetType("potree",{entityBuilder:gt,icon:"fg-multipoint",name:"Potree Point Cloud"})}}class bt{constructor(){h(this,"name","Tour");h(this,"_camera",null);h(this,"_cameraCallback",null);h(this,"_context",null);h(this,"_tours",null)}initialize(a){this._context=a,a.events.addEventListener("ready",this.start.bind(this))}buildTours(){const a=this._camera,t=new w.Tour({tourName:"main",useModalOverlay:!0}),e=new w.Tour({tourName:"navigating",useModalOverlay:!0}),o=new w.Tour({tourName:"analyzing",useModalOverlay:!0}),n=[{action:()=>{var i;return(i=w.activeTour)==null?void 0:i.next()},text:"Next"},{action:()=>{var i;return(i=w.activeTour)==null?void 0:i.cancel()},secondary:!0,text:"Exit"}],s=()=>{var C,S;const i=(C=w.activeTour)==null?void 0:C.getCurrentStep(),d=i==null?void 0:i.getElement(),p=d==null?void 0:d.querySelector(".shepherd-text"),y=(S=w.activeTour)==null?void 0:S.steps;if(i==null||d==null||p==null||y==null)return;const b=document.createElement("div");b.className="progress mt-3",b.setAttribute("role","progressbar"),b.style.height="2px";const I=document.createElement("div");I.className="progress-bar bg-success",I.style.width=`${100*(y.indexOf(i)/y.length)}%`,b.appendChild(I),p.appendChild(b)},r=async(i,d)=>new Promise(p=>{const y=document.getElementById(i);if(y&&!y.classList.contains("active")&&y.click(),document.querySelector(d))return p(document.querySelector(d));const b=new MutationObserver(()=>{document.querySelector(d)&&(b.disconnect(),p(document.querySelector(d)))});b.observe(document.body,{childList:!0,subtree:!0})});t.addStep({buttons:[{action:()=>{var i;(i=w.activeTour)==null||i.complete(),e.show(0)},text:"Navigating"},{action:()=>{var i;(i=w.activeTour)==null||i.complete(),o.show(0)},text:"Analyzing data"},{action:()=>{var i;return(i=w.activeTour)==null?void 0:i.cancel()},secondary:!0,text:"Exit"}],cancelIcon:{enabled:!0,label:"Exit tutorial"},id:"example-step",text:"<p>Welcome to <strong>Piero</strong>, the Giro3D application.<br/>We can guide you through the different features.</p>",title:"Welcome!",when:{show:s}}),e.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:n,id:"view",text:"<p>This is the <b>main view</b>.</p><p>Giro3D natively supports a broad range of data sources, from 2D raster and vector data, to 3D point clouds and tilesets.</p><p>Piero adds support for CityJSON and IFC files.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:n,id:"navigate",text:'<p>This application integrates <a href="https://github.com/yomotsu/camera-controls">camera-controls</a>, a camera control for three.js.</p><p><b>Click</b> to move the camera. <b>Right-click</b> to rotate around a point. <b>Scroll</b> to zoom in or out.</p>',when:{hide:()=>{this._cameraCallback&&a.removeEventListener("interaction-end",this._cameraCallback),this._cameraCallback=null},show:()=>{let i=0;this._cameraCallback=()=>{var d;i+=1,i>2&&((d=w.activeTour)==null||d.next())},a.addEventListener("interaction-end",this._cameraCallback),s()}}}),e.addStep({attachTo:{element:"#toolbar",on:"right"},beforeShowPromise:()=>r("toolbar-datasets","#datasets-drop-zone"),buttons:n,id:"toolbar-layers",text:"<p>Giro3D supports multiple datasets.</p><p>You can toggle datasets as you wish with the <b>Datasets</b> panel.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#basemap-list",on:"right"},beforeShowPromise:()=>r("toolbar-datasets","#datasets-drop-zone"),buttons:n,id:"basemaps",text:"<p><b>Basemaps</b> are color and elevation layers that make the basic shape and aspect of the <b>Map</b>.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#overlay-list",on:"right"},beforeShowPromise:()=>r("toolbar-datasets","#datasets-drop-zone"),buttons:n,id:"overlays",text:"<p><b>Overlays</b> are vector layers in various formats (WFS, GML, GeoJSON...).</p>",when:{show:s}}),e.addStep({attachTo:{element:"#dataset-list",on:"right"},beforeShowPromise:()=>r("toolbar-datasets","#datasets-drop-zone"),buttons:n,id:"layers",text:"<p>The <b>Datasets</b> panel contains all 3D objects in the scene.</><p>You can toggle their visibility and delete them.<p><p>Most objects leverage Giro3D's adaptive resolution to optimize their display.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#datasets-drop-zone",on:"right"},beforeShowPromise:()=>r("toolbar-datasets","#datasets-drop-zone"),buttons:n,id:"adddata",text:"<p>You can add your own data from your computer by <b>dragging the file</b> into this page.</p><p>While you won't benefit from Giro3D's tiling mechanism, this can be a great way to quickly visualize datasets up to 100MB.</p><p>This application supports CityJSONs, IFCs, LAS/LAZs, CSV pointclouds, and simple GeoJSON features.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:n,id:"attributes",text:"<p>By clicking on any feature on the map, you can see its <strong>Attribute table</strong>. Clickable features display a cursor when hovered.</p>",when:{show:s}}),e.addStep({attachTo:{element:"#search-place-autocomplete",on:"bottom"},buttons:[{action:()=>{var i;(i=w.activeTour)==null||i.complete(),o.show(0)},text:"Analyzing data"},{action:()=>{var i;return(i=w.activeTour)==null?void 0:i.complete()},secondary:!0,text:"Exit"}],id:"widgets",text:"Giro3D is highly extensible. Here we added a widget to search and navigate to locations based on the French address database.",when:{show:s}}),o.addStep({attachTo:{element:"#annotations-fieldset",on:"right"},beforeShowPromise:()=>r("toolbar-annotations","#annotations-fieldset"),buttons:n,id:"annotation",text:"<p>You can <strong>annotate</strong> any data displayed using Giro3D native tools.<br>Select the <strong>geometry</strong> of your annotation, and <strong>click</strong> on the scene to add points. <strong>Right-click</strong> to end the shape.</p>",when:{show:s}}),o.addStep({attachTo:{element:"#annotations-fieldset",on:"right"},beforeShowPromise:()=>r("toolbar-annotations","#annotations-fieldset"),buttons:n,id:"annotations",text:"You can download your annotations as GeoJSON files. You can also upload your own by dragging them into this panel.",when:{show:s}}),f.hasExperimentalFeature("measurements")&&o.addStep({attachTo:{element:"#panel-container",on:"right"},beforeShowPromise:()=>r("toolbar-measures","#measures-fieldset"),buttons:n,id:"measurements",text:"You can add <strong>measurements</strong> to easily get distances betwween objects.<br>Once started, moving the mouse will display the measure. <strong>Click</strong> to save the measurement. <strong>Right-click</strong> to end.",when:{show:s}}),o.addStep({attachTo:{element:"#panel-container",on:"right"},beforeShowPromise:()=>r("toolbar-analysis","#panel-container .card"),buttons:[{action:()=>{var i;return(i=w.activeTour)==null?void 0:i.complete()},text:"Done!"}],id:"analysis",text:"In the <strong>Analysis</strong> panel you'll find some advanced analysis tools.",when:{show:s}});const u=()=>{const i=new URL(document.URL);i.searchParams.delete("tourStep"),i.searchParams.set("tour","none"),window.history.replaceState({},"",i.toString())},m=i=>{const d=new URL(document.URL);let p="main";i.tour.id.startsWith("navigating")?p="navigating":i.tour.id.startsWith("analyzing")&&(p="analyzing"),d.searchParams.set("tour",p),d.searchParams.set("tourStep",i.step.id),window.history.replaceState({},"",d.toString())};return t.on("cancel",u),t.on("complete",u),t.on("show",m),e.on("cancel",u),e.on("complete",u),e.on("show",m),o.on("cancel",u),o.on("complete",u),o.on("show",m),{analyzingTour:o,mainTour:t,navigatingTour:e}}getTours(){return this._tours||(this._tours=this.buildTours()),this._tours}restart(){const{mainTour:a}=this.getTours();a.show(0)}start(){if(!this._context)throw new Error("module is not initialized");const{analyzingTour:a,mainTour:t,navigatingTour:e}=this.getTours();this._camera=this._context.view.getCameraController();const o=new URL(document.URL),n=o.searchParams.get("tour")??"main";if(n!=="none"){const s=o.searchParams.get("tourStep")??0;n==="navigating"?e.show(s):n==="analyzing"?a.show(s):t.show(s)}}}exports.IFCLoader=dt;exports.PLYLoader=pt;exports.PotreeLoader=yt;exports.Tour=bt;
1
+ "use strict";var W=Object.defineProperty;var X=(c,t,e)=>t in c?W(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var y=(c,t,e)=>X(c,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./Components.cjs.js"),r=require("vue"),U=require("pinia"),Z=require("@giro3d/giro3d/core/geographic/Coordinates"),R=require("@giro3d/giro3d/entities/Entity3D"),Q=require("@giro3d/giro3d/gui/EntityPanel"),T=require("openbim-components"),J=require("@giro3d/giro3d/gui/EntityInspector"),K=require("@giro3d/giro3d/entities/PointCloud"),ee=require("@giro3d/giro3d/sources/PotreeSource"),F=require("shepherd.js"),Y=U.defineStore("crossSection",()=>{const c=r.ref(0),t=r.ref(new p.Vector3(0,0,0)),e=r.ref(!1);function o(n){e.value=n}function s(n){c.value=n}function i(n){t.value=n}return{center:t,enable:e,orientation:c,setCenter:i,setEnabled:o,setOrientation:s}}),te={class:"input-group mb-3"},ne={class:"input-group mb-3"},oe=["value"],se={class:"input-group mb-3"},ie=["value"],re={class:"input-group"},ae={class:"input-group"},le=["value"],ce=["value"],ue=r.defineComponent({__name:"CrossSection",setup(c){const t=Y();function e(i){t.setOrientation(i)}function o(i){const n=t.center.clone();n.setX(i),t.setCenter(n)}function s(i){const n=t.center.clone();n.setY(i),t.setCenter(n)}return(i,n)=>(r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("div",te,[r.createVNode(p._sfc_main,{"model-value":r.unref(t).enable,"onUpdate:modelValue":n[0]||(n[0]=l=>r.unref(t).setEnabled(l)),id:"cross-section-enable",title:"foo"},null,8,["model-value"]),n[5]||(n[5]=r.createElementVNode("label",{for:"cross-section-enable",class:"form-label"},"Enable cross section",-1))]),r.createElementVNode("div",ne,[n[6]||(n[6]=r.createElementVNode("label",{for:"plane-orientation-range",class:"form-label"},"Plane orientation (0-360°)",-1)),r.createElementVNode("input",{id:"plane-orientation-range",title:"Altitude",type:"range",class:"form-range",min:"0",step:"0.1",max:"360",value:r.unref(t).orientation,onInput:n[1]||(n[1]=l=>e(Number.parseFloat(l.target.value)))},null,40,oe)]),r.createElementVNode("div",se,[r.createElementVNode("input",{type:"number",class:"form-control",id:"plane-orientation-number",step:"0.1",value:r.unref(t).orientation,onInput:n[2]||(n[2]=l=>e(Number.parseFloat(l.target.value)))},null,40,ie)]),n[8]||(n[8]=r.createElementVNode("hr",null,null,-1)),r.createElementVNode("div",re,[n[7]||(n[7]=r.createElementVNode("label",{class:"form-label"},"Center (x, y)",-1)),r.createElementVNode("div",ae,[r.createElementVNode("input",{type:"number",class:"form-control",id:"plane-center-x",value:r.unref(t).center.x,onInput:n[3]||(n[3]=l=>o(Number.parseFloat(l.target.value)))},null,40,le),r.createElementVNode("input",{type:"number",class:"form-control",id:"plane-center-y",value:r.unref(t).center.y,onInput:n[4]||(n[4]=l=>s(Number.parseFloat(l.target.value)))},null,40,ce)])])]))}});class de{constructor(t){y(this,"_store",Y());this.context=t,t.events.addEventListener("ready",()=>{const e=t.configuration.default_crs,o=t.configuration.analysis.cross_section;this._store.setOrientation(o.orientation);const s=o.pivot,i=new Z(s.crs??e,s.x,s.y,0).as(e);this._store.setCenter(i.toVector3()),this._store.$onAction(({after:n,name:l})=>{n(()=>{switch(l){case"setCenter":case"setEnabled":case"setOrientation":this.updateCrossSection();break}})}),this.updateCrossSection()})}dispose(){}updateCrossSection(){const t=[];if(this._store.enable){const o=p.MathUtils.DEG2RAD*this._store.orientation,s=Math.cos(o),i=Math.sin(o),n=new p.Vector3(s,i,0),l=new p.Plane(n,0).distanceToPoint(this._store.center),b=new p.Plane(n,-l);t.push(b)}const e=this.context.view.getInstance();e.renderer.clippingPlanes=t;for(const o of this.context.view.getInstance().getEntities())R.isEntity3D(o)&&o.dispatchEvent({clippingPlanes:t,type:"clippingPlanes-property-changed"});e.notifyChange()}}class pe{constructor(){y(this,"id","builtin-cross-section-analysis");y(this,"name","Cross section");y(this,"_manager",null)}initialize(t){t.analysis.registerTool({component:ue,icon:"bi-circle-half",name:"Cross section"}),this._manager=new de(t)}}function z(c){if("url"in c.config&&typeof c.config.url=="string")return c.config.url;if("source"in c.config&&typeof c.config.source=="object"&&"url"in c.config.source&&typeof c.config.source.url=="string")return c.config.source.url}function he(c){return z(c)!=null}class fe{constructor(){y(this,"id","builtin-download-dataset");y(this,"name","Download dataset");y(this,"_context",null)}initialize(t){this._context=t,t.datasets.registerDatasetAction({action:this.download.bind(this),icon:"bi-download",predicate:he,title:"Download dataset"})}download(t){const e=z(t);if(e==null){console.warn("invalid");return}const o=this._context,s=new URL(e).pathname.split("/"),i=s[s.length-1];console.info(`download ${z(t)}`),p.Fetcher.fetch(e).then(n=>{if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.blob()}).then(n=>{p.Download.downloadBlob(n,i),o.notifications.pushNotification({level:"success",text:i,title:"Download successful"})}).catch(n=>{console.error(n);const l=n instanceof Error?n.message:"Download failed";o.notifications.pushNotification({level:"error",text:l,title:t.name})})}}const $=U.defineStore("floodingPlane",()=>{const c=r.ref(0),t=r.ref(!1);function e(){return c.value}function o(i){c.value=i}function s(i){t.value=i}return{enable:t,getHeight:e,setEnabled:s,setHeight:o}}),me={class:"input-group mb-3"},ge={class:"input-group mb-3"},ye=["value"],be={class:"input-group mb-3"},_e=["value"],we=r.defineComponent({__name:"FloodingPlane",setup(c){const t=$();function e(o){t.setHeight(o)}return(o,s)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",me,[r.createVNode(p._sfc_main,{"model-value":r.unref(t).enable,"onUpdate:modelValue":s[0]||(s[0]=i=>r.unref(t).setEnabled(i)),id:"flooding-plane-enable",title:"foo"},null,8,["model-value"]),s[3]||(s[3]=r.createElementVNode("label",{for:"flooding-plane-enable",class:"form-label"},"Enable flooding plane",-1))]),r.createElementVNode("div",ge,[s[5]||(s[5]=r.createElementVNode("label",{for:"flooding-altitude-range",class:"form-label"},"Altitude",-1)),r.createElementVNode("input",{id:"flooding-altitude-range",title:"Altitude",type:"range",class:"form-range",min:"0",step:"0.1",max:"500",value:r.unref(t).getHeight(),onInput:s[1]||(s[1]=i=>e(Number.parseFloat(i.target.value)))},null,40,ye),r.createElementVNode("div",be,[r.createElementVNode("input",{type:"number",class:"form-control",id:"flooding-altitude-number",step:"0.1",value:r.unref(t).getHeight(),onInput:s[2]||(s[2]=i=>e(Number.parseFloat(i.target.value)))},null,40,_e),s[4]||(s[4]=r.createElementVNode("span",{class:"input-group-text"},"m",-1))])])],64))}});class ve{constructor(){y(this,"geometry");y(this,"material");y(this,"object3D");y(this,"_height");this.geometry=new p.PlaneGeometry(1,1,1,1),this.material=new p.MeshBasicMaterial({color:43690,opacity:.5,transparent:!0}),this.object3D=new p.Mesh(this.geometry,this.material),this.object3D.renderOrder=2,this.visible=!1,this._height=0}set height(t){this._height=t}get height(){return this._height}set visible(t){this.object3D.visible=t}get visible(){return this.object3D.visible}dispose(){this.object3D.removeFromParent(),this.geometry.dispose(),this.material.dispose()}setPosition(t,e,o,s,i){this.object3D.scale.set(s,i,1),this.object3D.position.set(t,e,o),this.object3D.updateMatrixWorld()}}class xe{constructor(t){y(this,"_context");y(this,"_plane");y(this,"_store",$());this._context=t,this._plane=null,t.events.addEventListener("ready",()=>{this._store.$onAction(({after:e,name:o})=>{e(()=>{switch(o){case"setEnabled":this.updatePlane();break;case"setHeight":this.updatePlane();break}})})})}dispose(){this._plane&&(this._context.view.getInstance().remove(this._plane.object3D),this._plane.dispose())}async updatePlane(){this._plane||(this._plane=new ve,await this._context.view.getInstance().add(this._plane.object3D));const t=this._context.view.getBoundingBox(),e=t.getCenter(new p.Vector3),o=t.getSize(new p.Vector3);this._plane.visible=this._store.enable,this._plane.setPosition(e.x,e.y,this._store.getHeight(),o.x,o.y),this._context.view.getInstance().notifyChange()}}class Ce{constructor(){y(this,"id","builtin-flooding-plane-analysis");y(this,"name","Flooding plane");y(this,"_manager",null)}initialize(t){t.analysis.registerTool({component:we,icon:"bi-layers-half",name:"Flooding plane"}),this._manager=new xe(t)}}const D=new p.Matrix4,Ie={bbox:new p.MeshBasicMaterial({color:"#FFFF00",depthTest:!0,opacity:.2,transparent:!0}),selection:new p.MeshBasicMaterial({color:"#FF0000",depthTest:!1,opacity:.6,transparent:!0})},Pe=4186316022,Se=781010003,Ee=2655215786,Te=3242617779,Be=919958153,Ne=1307041759,G=1451395588,q=1883228015,Fe=[G,q],ke=[Pe,Se,Ee,Te,Be,Ne],H=c=>p.isObject(c)&&c.isIFCPickResult,A=class A extends R{constructor(e){super(new p.Group);y(this,"isIfcEntity",!0);y(this,"isPickableFeatures",!0);y(this,"type","IfcEntity");y(this,"_classificationCache");y(this,"_components");y(this,"_fragmentBoundingBox");y(this,"_fragmentClassifier");y(this,"_fragmentManager");y(this,"_ifcSelection");y(this,"_indexMap");y(this,"_model");y(this,"_source");this._source=e,this._components=new T.Components,this._components.ui.enabled=!1,this._components.scene=new T.SimpleScene(this._components),this._components.renderer=new T.SimpleRenderer(this._components,document.createElement("div")),this._components.camera=new T.SimpleCamera(this._components),this._components.raycaster=new T.SimpleRaycaster(this._components),this._components.init(),this._ifcSelection={bbox:{},selection:{}},this._indexMap={},this._classificationCache=null,this._fragmentBoundingBox=null}clearHighlight(e="selection"){for(const o of Object.keys(this._ifcSelection[e])){const s=this._fragmentManager.list[o],i=s==null?void 0:s.fragments[e];i!=null&&i.mesh.removeFromParent()}this.notifyChange(this),this._ifcSelection[e]={}}getBoundingBoxById(e){this.clearHighlight("bbox"),this.highlightById(e,"bbox");const o=this._fragmentBoundingBox;if(o===null)throw new Error("Must call initClassification before getBoundingBoxById");const s=this._fragmentManager;o.reset();const i=this._ifcSelection.bbox;if(!Object.keys(i).length)return;for(const g of Object.keys(i)){const S=s.list[g].fragments.bbox;o.addMesh(S.mesh)}const n=o.get(),{y:l,z:b}=n.min,{y:x,z:d}=n.max;return n.min.y=-d,n.max.y=-b,n.min.z=l,n.max.z=x,n.translate(this._model.position),this.clearHighlight("bbox"),n}getClassification(){if(this._classificationCache===null)throw new Error("Must call initClassification before getClassification");return this._classificationCache}getProperties(e){const o=[],s=this._model.properties;if(!s)return[];for(const i of this._indexMap[e]){const n=s[i];if(n==null)continue;const{name:l}=T.IfcPropertiesUtils.getEntityName(s,i);if(l!==null){if(n.type===G){const b=T.IfcPropertiesUtils.getPsetProps(s,i);if(b!==null)for(const x of b){if(s[x]==null)continue;const g=this.getProperty(x);g!==null&&o.push({parentName:l,...g})}}else if(n.type===q){const b=T.IfcPropertiesUtils.getQsetQuantities(s,i);if(b!==null)for(const x of b){const{key:d}=T.IfcPropertiesUtils.getQuantityValue(s,x);if(d===null)continue;const g=this.getProperty(x);g!==null&&o.push({parentName:l,...g})}}}}return o}getProperty(e){const o=this._model.properties;if(o===void 0)return null;const{name:s}=T.IfcPropertiesUtils.getEntityName(o,e);if(s===null)return null;const{value:i}=T.IfcPropertiesUtils.getQuantityValue(o,e);return{name:s,value:i}}highlight(e,o,s){this._ifcSelection[e][o.uuid]=new Set;const i=parseInt(s,10);this._ifcSelection[e][o.uuid].add(s),this.addComposites(e,o,i),this.regenerate(e,o.uuid);const n=o.fragment.group;if(n){const l=n.data[i][0];for(let b=0;b<l.length;b++){const x=l[b],d=n.keyFragments[x],g=this._fragmentManager.list[d];d in this._ifcSelection[e]||(this._ifcSelection[e][d]=new Set),this._ifcSelection[e][d].add(s),this.addComposites(e,g.mesh,i),this.regenerate(e,d)}}this.notifyChange(this)}highlightById(e,o="selection"){for(const s of Object.keys(e)){s in this._ifcSelection[o]||(this._ifcSelection[o][s]=new Set);const i=this._fragmentManager.list[s],n=new Set;for(const l of e[s])this._ifcSelection[o][s].add(l),n.add(parseInt(l,10));for(const l of n)this.addComposites(o,i.mesh,l);this.regenerate(o,s)}this.notifyChange(this)}pick(e,o){return super.pick(e,o).map(s=>({...s,entity:this,features:s.features,isIFCPickResult:!0,object:s.object}))}pickFeaturesFrom(e){var s,i,n;const o=e.object;if(o.fragment!=null&&e.instanceId!=null&&e.face){const l=o.fragment.getVertexBlockID(o.geometry,e.face.a),b=(s=o.fragment.getItemID(e.instanceId,l))==null?void 0:s.replace(/\..*/,"");if(b&&((n=(i=o.fragment.group)==null?void 0:i.properties)==null?void 0:n[b])!=null){const d=o.fragment.group.properties[b],I=[{ifcProperties:this.getProperties(b),itemProperties:d}];return e.features=I,I}}return[]}async initClassification(){this._classificationCache=await this.regenerateClassification(["storeys","entities"]),this._classificationCache.length===0&&(this._classificationCache=await this.regenerateClassification(["entities"])),this._fragmentBoundingBox=await this._components.tools.get(T.FragmentBoundingBox)}async preprocess(){const e=await p.Fetcher.fetchArrayBuffer(this._source.url);this._fragmentManager=await this._components.tools.get(T.FragmentManager),this._fragmentClassifier=await this._components.tools.get(T.FragmentClassifier);const o=new T.FragmentIfcLoader(this._components);o.settings.webIfc.COORDINATE_TO_ORIGIN=!0,o.settings.webIfc.OPTIMIZE_PROFILES=!0;const s=new Uint8Array(e);this._model=await o.load(s,this._source.name),this._model.rotateX(Math.PI/2);const i=new p.Vector3;if(this._source.at)this._source.at.toVector3(i),this._model.position.copy(i);else{const l=this._model.coordinationMatrix.clone().invert();i.applyMatrix4(l),this._model.position.set(i.x,-i.z,i.y)}this._model.updateWorldMatrix(!0,!0),this._model.updateMatrix(),this._model.updateMatrixWorld(!0),this.initializeEntityIndexes(),this._fragmentClassifier.byStorey(this._model),this._fragmentClassifier.byEntity(this._model),await this.initClassification(),this.object3d.add(this._model),this.onObjectCreated(this._model);const n=p.Fetcher.getContext(this._source.url);p.fillObject3DUserData(this,{filename:n.filename}),this.notifyChange(this.object3d)}addComposites(e,o,s){this.addHighlightToFragment(e,o.fragment);const i=o.fragment.composites[s];if(i)for(let n=1;n<i;n++){const l=T.toCompositeID(s,n);this._ifcSelection[e][o.uuid].add(l)}}addHighlightToFragment(e,o){if(!(e in o.fragments)){const s=o.addFragment(e,[Ie[e]]);o.blocks.count>1&&(s.setInstance(0,{ids:Array.from(o.ids),transform:D}),s.blocks.setVisibility(!1)),this._model.add(s.mesh),s.mesh.renderOrder=30,s.mesh.frustumCulled=!1,s.mesh.name=e,s.mesh.updateMatrixWorld(!0)}}initializeEntityIndexes(){this._indexMap={};const e=this._model.properties;if(e!==void 0)for(const o of ke)T.IfcPropertiesUtils.getRelationMap(e,o,(s,i)=>{const n=e[s];Fe.includes(n.type)||this.setEntityIndex(s);for(const l of i)this.setEntityIndex(l).add(s)})}regenerate(e,o){this.updateFragmentFill(e,o)}async regenerateClassification(e,o={}){const s=this._fragmentClassifier.get(),i=[],n=e[0],l=s[n];if(n==null||l==null)return i;for(const b of Object.keys(l)){const x={...o,[n]:[b]},d=await this._fragmentClassifier.find(x);if(Object.keys(d).length>0){const S=n[0].toUpperCase()+n.slice(1),P=await this.regenerateClassification(e.slice(1),x);i.push({children:P,fragments:d,name:b,treeItemName:S})}}return i}setEntityIndex(e){return e in this._indexMap||(this._indexMap[e]=new Set),this._indexMap[e]}updateFragmentFill(e,o){const s=this._ifcSelection[e][o],i=this._fragmentManager.list[o];if(i==null)return;const n=i.fragments[e];if(n==null)return;const l=i.mesh.parent;if(l==null)return;if(l.add(n.mesh),n.blocks.count>1)i.getInstance(0,D),n.setInstance(0,{ids:Array.from(i.ids),transform:D}),n.blocks.setVisibility(!0,s,!0);else{let x=0;for(const d of s){n.mesh.count=x+1;const{instanceID:g}=i.getInstanceAndBlockID(d);i.getInstance(g,D),n.setInstance(x,{ids:[d],transform:D}),x++}}}};y(A,"isIFCEntity",e=>p.isObject(e)&&e.isIfcEntity),y(A,"isIFCPickResult",e=>p.isObject(e)&&A.isIFCEntity(e.entity));let j=A;class Me extends J{constructor(t,e,o){super(t,e,o,{visibility:!0})}}const De={class:"d-flex"},Ae=["title"],Ve=["id"],Le={class:"list-unstyled border-start"},Oe=r.defineComponent({__name:"IfcSubtree",props:{classificationElement:{},ifcEntity:{}},setup(c){const t=c,e=p.MathUtils.generateUUID(),o=`#${e}`,s=r.ref(!1),i=p.useCameraStore(),l=p.useModuleStore().getModule(p.moduleId);function b(){if(l==null){console.warn("Cannot clip IFC element, ClippingBoxAnalysis module is not present");return}const g=t.ifcEntity.getBoundingBoxById(t.classificationElement.fragments);g&&!g.isEmpty()&&l.setClippingBox(g)}function x(){s.value=!0,t.ifcEntity.clearHighlight(),t.ifcEntity.highlightById(t.classificationElement.fragments),setTimeout(()=>s.value=!1,2e3)}function d(){const g=t.ifcEntity.getBoundingBoxById(t.classificationElement.fragments);g&&!g.isEmpty()&&i.lookTopDownAt(g)}return(g,I)=>{const S=r.resolveComponent("IfcSubtree",!0);return r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("div",De,[r.createElementVNode("span",{class:r.normalizeClass(["border rounded px-1 py-0 fw-normal",s.value?"text-danger border-danger":"text-secondary border-secondary"]),title:g.classificationElement.treeItemName},r.toDisplayString(g.classificationElement.treeItemName),11,Ae),g.classificationElement.children.length>0?(r.openBlock(),r.createBlock(p.IconList,{key:0},{default:r.withCtx(()=>[r.createVNode(p.IconListButton,{title:"Expand group",icon:"bi-chevron-down","data-bs-toggle":"collapse","data-bs-target":o,"aria-controls":r.unref(e),"aria-expanded":"true"},null,8,["aria-controls"])]),_:1})):r.createCommentVNode("",!0),r.createVNode(p._sfc_main$3,{class:r.normalizeClass(["label",s.value?"text-danger-emphasis":"text-muted"]),text:g.classificationElement.name,title:`Zoom to ${g.classificationElement.name}`,onClick:d},null,8,["class","text","title"]),r.createVNode(p.IconList,{class:"ms-1"},{default:r.withCtx(()=>[r.createVNode(p.IconListButton,{title:"Highlight",icon:"bi-highlighter",onClick:x}),r.unref(l)!=null?(r.openBlock(),r.createBlock(p.IconListButton,{key:0,title:"Clip to",icon:"bi-bounding-box",onClick:b})):r.createCommentVNode("",!0)]),_:1})]),g.classificationElement.children.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,id:r.unref(e),class:"collapse show"},[r.createElementVNode("ul",Le,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(g.classificationElement.children,(P,B)=>(r.openBlock(),r.createElementBlock("li",{key:B},[r.createVNode(S,{"ifc-entity":t.ifcEntity,"classification-element":P},null,8,["ifc-entity","classification-element"])]))),128))])],8,Ve)):r.createCommentVNode("",!0)])}}}),ze=p._export_sfc(Oe,[["__scopeId","data-v-804ca598"]]),je={key:0},Re=r.defineComponent({__name:"IfcPropertyView",props:{dataset:{}},setup(c){const t=p.useDatasetStore(),e=c,o=p.refAndWatch(e.dataset,"isPreloaded");function s(){const n=i();return n==null?null:n.getClassification()}function i(){const n=t.getEntity(e.dataset);return n??null}return(n,l)=>r.unref(o)?(r.openBlock(),r.createElementBlock("div",je,[r.createElementVNode("ul",null,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s(),(b,x)=>(r.openBlock(),r.createElementBlock("li",{key:x},[r.createVNode(ze,{"ifc-entity":i(),"classification-element":b},null,8,["ifc-entity","classification-element"])]))),128))])])):r.createCommentVNode("",!0)}}),Ue=p._export_sfc(Re,[["__scopeId","data-v-d2d82ae7"]]),Ye=c=>{if(H(c)){const t=c.object;if(t.fragment!=null&&c.face&&c.instanceId!=null){const e=t.fragment.getVertexBlockID(t.geometry,c.face.a),o=t.fragment.getItemID(c.instanceId,e).replace(/\..*/,"");return c.entity.highlight("selection",t,o),()=>c.entity.clearHighlight()}}return null},$e=c=>({name:c.filename,source:{url:c.file},type:"ifc",visible:!0}),Ge=(c,t)=>{var b,x,d,g,I,S,P,B,a;if(!H(c))return;const e=(b=c.features)==null?void 0:b.at(0);if(!e)return;t.has("IFC")||t.set("IFC",[]);const o=t.get("IFC"),{ifcProperties:s,itemProperties:i}=e,n="NULL",l=((x=i.Name)==null?void 0:x.value)??n;o.push({key:"Site",value:((g=(d=c.entity.object3d.userData)==null?void 0:d.dataset)==null?void 0:g.name)??n}),o.push({key:"IFCType",value:T.IfcCategoryMap[i.type]??n}),o.push({key:"Name",value:l}),o.push({key:"ID",value:i.expressID}),o.push({key:"GlobalId",value:((I=i.GlobalId)==null?void 0:I.value)??n}),((S=i.Description)==null?void 0:S.value)!=null&&o.push({key:"Description",value:i.Description.value}),((P=i.PredefinedType)==null?void 0:P.value)!=null&&o.push({key:"PredefinedType",value:i.PredefinedType.value}),((B=i.ObjectType)==null?void 0:B.value)!=null&&o.push({key:"ObjectType",value:i.ObjectType.value});for(const{name:f,parentName:h,value:u}of s)t.has(h)||t.set(h,[]),(a=t.get(h))==null||a.push({key:f,value:u})},qe=c=>{const t=c.dataset,e=t.config,o=p.getCoordinates(e.source.position??t.get("position")),s=new j({...e.source,at:o,name:t.name});return Promise.resolve(s)};class He{constructor(){y(this,"id","builtin-ifc-loader");y(this,"name","IFC")}async initialize(t){t.datasets.registerDatasetType("ifc",{attributeExtractor:Ge,entityBuilder:qe,fileExtensions:["ifc"],highlight:Ye,icon:"bi-building",loader:$e,name:"IFC",propertyView:Ue}),Q.registerInspector("IfcEntity",Me),await p.Fetcher.fetch("web-ifc.wasm").catch(e=>{console.warn("Could not load web-ifc.wasm",e)})}}const k=new p.Color;let We=class extends p.Loader{constructor(t){super(t),this.propertyNameMapping={},this.customPropertyMapping={}}load(t,e,o,s){const i=this,n=new p.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(l){try{e(i.parse(l))}catch(b){s?s(b):console.error(b),i.manager.itemError(t)}},o,s)}setPropertyNameMapping(t){this.propertyNameMapping=t}setCustomPropertyNameMapping(t){this.customPropertyMapping=t}parse(t){function e(a,f=0){const h=/^ply([\s\S]*)end_header(\r\n|\r|\n)/;let u="";const m=h.exec(a);m!==null&&(u=m[1]);const _={comments:[],elements:[],headerLength:f,objInfo:""},v=u.split(/\r\n|\r|\n/);let w;function M(E,N){const C={type:E[0]};return C.type==="list"?(C.name=E[3],C.countType=E[1],C.itemType=E[2]):C.name=E[1],C.name in N&&(C.name=N[C.name]),C}for(let E=0;E<v.length;E++){let N=v[E];if(N=N.trim(),N==="")continue;const C=N.split(/\s+/),L=C.shift();switch(N=C.join(" "),L){case"format":_.format=C[0],_.version=C[1];break;case"comment":_.comments.push(N);break;case"element":w!==void 0&&_.elements.push(w),w={},w.name=C[0],w.count=parseInt(C[1]),w.properties=[];break;case"property":w.properties.push(M(C,B.propertyNameMapping));break;case"obj_info":_.objInfo=N;break;default:console.log("unhandled",L,C)}}return w!==void 0&&_.elements.push(w),_}function o(a,f){switch(f){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(a);case"float":case"double":case"float32":case"float64":return parseFloat(a)}}function s(a,f){const h={};for(let u=0;u<a.length;u++){if(f.empty())return null;if(a[u].type==="list"){const m=[],_=o(f.next(),a[u].countType);for(let v=0;v<_;v++){if(f.empty())return null;m.push(o(f.next(),a[u].itemType))}h[a[u].name]=m}else h[a[u].name]=o(f.next(),a[u].type)}return h}function i(){const a={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(const f of Object.keys(B.customPropertyMapping))a[f]=[];return a}function n(a){const f=a.map(u=>u.name);function h(u){for(let m=0,_=u.length;m<_;m++){const v=u[m];if(f.includes(v))return v}return null}return{attrX:h(["x","px","posx"])||"x",attrY:h(["y","py","posy"])||"y",attrZ:h(["z","pz","posz"])||"z",attrNX:h(["nx","normalx"]),attrNY:h(["ny","normaly"]),attrNZ:h(["nz","normalz"]),attrS:h(["s","u","texture_u","tx"]),attrT:h(["t","v","texture_v","ty"]),attrR:h(["red","diffuse_red","r","diffuse_r"]),attrG:h(["green","diffuse_green","g","diffuse_g"]),attrB:h(["blue","diffuse_blue","b","diffuse_b"])}}function l(a,f){const h=i(),u=/end_header\s+(\S[\s\S]*\S|\S)\s*$/;let m,_;(_=u.exec(a))!==null?m=_[1].split(/\s+/):m=[];const v=new Xe(m);e:for(let w=0;w<f.elements.length;w++){const M=f.elements[w],E=n(M.properties);for(let N=0;N<M.count;N++){const C=s(M.properties,v);if(!C)break e;x(h,M.name,C,E)}}return b(h)}function b(a){let f=new p.BufferGeometry;a.indices.length>0&&f.setIndex(a.indices),f.setAttribute("position",new p.Float32BufferAttribute(a.vertices,3)),a.normals.length>0&&f.setAttribute("normal",new p.Float32BufferAttribute(a.normals,3)),a.uvs.length>0&&f.setAttribute("uv",new p.Float32BufferAttribute(a.uvs,2)),a.colors.length>0&&f.setAttribute("color",new p.Float32BufferAttribute(a.colors,3)),(a.faceVertexUvs.length>0||a.faceVertexColors.length>0)&&(f=f.toNonIndexed(),a.faceVertexUvs.length>0&&f.setAttribute("uv",new p.Float32BufferAttribute(a.faceVertexUvs,2)),a.faceVertexColors.length>0&&f.setAttribute("color",new p.Float32BufferAttribute(a.faceVertexColors,3)));for(const h of Object.keys(B.customPropertyMapping))a[h].length>0&&f.setAttribute(h,new p.Float32BufferAttribute(a[h],B.customPropertyMapping[h].length));return f.computeBoundingSphere(),f}function x(a,f,h,u){if(f==="vertex"){a.vertices.push(h[u.attrX],h[u.attrY],h[u.attrZ]),u.attrNX!==null&&u.attrNY!==null&&u.attrNZ!==null&&a.normals.push(h[u.attrNX],h[u.attrNY],h[u.attrNZ]),u.attrS!==null&&u.attrT!==null&&a.uvs.push(h[u.attrS],h[u.attrT]),u.attrR!==null&&u.attrG!==null&&u.attrB!==null&&(k.setRGB(h[u.attrR]/255,h[u.attrG]/255,h[u.attrB]/255,p.SRGBColorSpace),a.colors.push(k.r,k.g,k.b));for(const m of Object.keys(B.customPropertyMapping))for(const _ of B.customPropertyMapping[m])a[m].push(h[_])}else if(f==="face"){const m=h.vertex_indices||h.vertex_index,_=h.texcoord;m.length===3?(a.indices.push(m[0],m[1],m[2]),_&&_.length===6&&(a.faceVertexUvs.push(_[0],_[1]),a.faceVertexUvs.push(_[2],_[3]),a.faceVertexUvs.push(_[4],_[5]))):m.length===4&&(a.indices.push(m[0],m[1],m[3]),a.indices.push(m[1],m[2],m[3])),u.attrR!==null&&u.attrG!==null&&u.attrB!==null&&(k.setRGB(h[u.attrR]/255,h[u.attrG]/255,h[u.attrB]/255,p.SRGBColorSpace),a.faceVertexColors.push(k.r,k.g,k.b),a.faceVertexColors.push(k.r,k.g,k.b),a.faceVertexColors.push(k.r,k.g,k.b))}}function d(a,f){const h={};let u=0;for(let m=0;m<f.length;m++){const _=f[m],v=_.valueReader;if(_.type==="list"){const w=[],M=_.countReader.read(a+u);u+=_.countReader.size;for(let E=0;E<M;E++)w.push(v.read(a+u)),u+=v.size;h[_.name]=w}else h[_.name]=v.read(a+u),u+=v.size}return[h,u]}function g(a,f,h){function u(m,_,v){switch(_){case"int8":case"char":return{read:w=>m.getInt8(w),size:1};case"uint8":case"uchar":return{read:w=>m.getUint8(w),size:1};case"int16":case"short":return{read:w=>m.getInt16(w,v),size:2};case"uint16":case"ushort":return{read:w=>m.getUint16(w,v),size:2};case"int32":case"int":return{read:w=>m.getInt32(w,v),size:4};case"uint32":case"uint":return{read:w=>m.getUint32(w,v),size:4};case"float32":case"float":return{read:w=>m.getFloat32(w,v),size:4};case"float64":case"double":return{read:w=>m.getFloat64(w,v),size:8}}}for(let m=0,_=a.length;m<_;m++){const v=a[m];v.type==="list"?(v.countReader=u(f,v.countType,h),v.valueReader=u(f,v.itemType,h)):v.valueReader=u(f,v.type,h)}}function I(a,f){const h=i(),u=f.format==="binary_little_endian",m=new DataView(a,f.headerLength);let _,v=0;for(let w=0;w<f.elements.length;w++){const M=f.elements[w],E=M.properties,N=n(E);g(E,m,u);for(let C=0;C<M.count;C++){_=d(v,E),v+=_[1];const L=_[0];x(h,M.name,L,N)}}return b(h)}function S(a){let f=0,h=!0,u="";const m=[],_=new TextDecoder().decode(a.subarray(0,5)),v=/^ply\r\n/.test(_);do{const w=String.fromCharCode(a[f++]);w!==`
2
+ `&&w!=="\r"?u+=w:(u==="end_header"&&(h=!1),u!==""&&(m.push(u),u=""))}while(h&&f<a.length);return v===!0&&f++,{headerText:m.join("\r")+"\r",headerLength:f}}let P;const B=this;if(t instanceof ArrayBuffer){const a=new Uint8Array(t),{headerText:f,headerLength:h}=S(a),u=e(f,h);if(u.format==="ascii"){const m=new TextDecoder().decode(a);P=l(m,u)}else P=I(t,u)}else P=l(t,e(t));return P}};class Xe{constructor(t){this.arr=t,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}}const V=class V extends p.Mesh{constructor(){super(...arguments);y(this,"isPickableFeatures",!0);y(this,"isPlyMesh",!0)}pickFeaturesFrom(e){if(this.geometry.hasAttribute("color")&&e.face){const o=this.geometry.getAttribute("color").array,s=e.face,n=[{color:new p.Color(o[s.a*3],o[s.a*3+1],o[s.a*3+2])}];return e.features=n,n}return[]}};y(V,"isPlyMesh",e=>p.isObject(e)&&e.isPlyMesh),y(V,"isPlyPickResult",e=>p.isObject(e)&&V.isPlyMesh(e==null?void 0:e.object));let O=V;class Ze extends R{constructor(e){super(new p.Group);y(this,"isPlyEntity",!0);y(this,"source");this.source=e}async preprocess(){const e=await p.Fetcher.fetchArrayBuffer(this.source.url),o=this.source.at.as(this.source.featureProjection).toVector3(),i=new We().parse(e),n=new p.MeshLambertMaterial({side:p.DoubleSide});i.hasAttribute("color")&&(n.vertexColors=!0),i.computeVertexNormals();const l=new O(i,n);l.name="plyModel",i.computeBoundingBox(),l.position.copy(o),l.updateWorldMatrix(!0,!0),this.object3d.add(l),this.onObjectCreated(l);const b=p.Fetcher.getContext(this.source.url);p.fillObject3DUserData(this,{filename:b.filename}),this.notifyChange(this.object3d)}}const Qe=c=>{const{dataset:t,instance:e}=c,o=t.config,s=p.getCoordinates(o.source.position??t.get("position")),i=new Ze({...o.source,at:s,featureProjection:e.referenceCrs});return Promise.resolve(i)},Je=(c,t)=>{var s;if(!O.isPlyPickResult(c))return;const e=(s=c.features)==null?void 0:s.at(0);if(!e)return;t.has("PLY")||t.set("PLY",[]),t.get("PLY").push({key:"Color",value:e.color})};class Ke{constructor(){y(this,"id","builtin-ply-loader");y(this,"name","PLY")}initialize(t){t.datasets.registerDatasetType("ply",{attributeExtractor:Je,entityBuilder:Qe,icon:"bi-file-earmark-binary",name:"PLY"})}}const et=c=>{const t=c.dataset.config,e=new K({source:new ee({url:`${t.source.url}/${t.source.filename}`})});return p.fillObject3DUserData(e,{filename:t.source.url}),Promise.resolve(e)};class tt{constructor(){y(this,"id","builtin-potree-loader");y(this,"name","Potree")}initialize(t){t.datasets.registerDatasetType("potree",{entityBuilder:et,icon:"fg-multipoint",name:"Potree Point Cloud"})}}class nt{constructor(){y(this,"id","builtin-tour");y(this,"name","Tour");y(this,"_camera",null);y(this,"_cameraCallback",null);y(this,"_context",null);y(this,"_tours",null)}initialize(t){this._context=t,t.events.addEventListener("ready",this.start.bind(this))}buildTours(){const t=this._camera,e=new F.Tour({tourName:"main",useModalOverlay:!0}),o=new F.Tour({tourName:"navigating",useModalOverlay:!0}),s=new F.Tour({tourName:"analyzing",useModalOverlay:!0}),i=[{action:()=>{var d;return(d=F.activeTour)==null?void 0:d.next()},text:"Next"},{action:()=>{var d;return(d=F.activeTour)==null?void 0:d.cancel()},secondary:!0,text:"Exit"}],n=()=>{var a,f;const d=(a=F.activeTour)==null?void 0:a.getCurrentStep(),g=d==null?void 0:d.getElement(),I=g==null?void 0:g.querySelector(".shepherd-text"),S=(f=F.activeTour)==null?void 0:f.steps;if(d==null||g==null||I==null||S==null)return;const P=document.createElement("div");P.className="progress mt-3",P.setAttribute("role","progressbar"),P.style.height="2px";const B=document.createElement("div");B.className="progress-bar bg-success",B.style.width=`${100*(S.indexOf(d)/S.length)}%`,P.appendChild(B),I.appendChild(P)},l=async(d,g)=>new Promise(I=>{const S=document.getElementById(d);if(S&&!S.classList.contains("active")&&S.click(),document.querySelector(g))return I(document.querySelector(g));const P=new MutationObserver(()=>{document.querySelector(g)&&(P.disconnect(),I(document.querySelector(g)))});P.observe(document.body,{childList:!0,subtree:!0})});e.addStep({buttons:[{action:()=>{var d;(d=F.activeTour)==null||d.complete(),o.show(0)},text:"Navigating"},{action:()=>{var d;(d=F.activeTour)==null||d.complete(),s.show(0)},text:"Analyzing data"},{action:()=>{var d;return(d=F.activeTour)==null?void 0:d.cancel()},secondary:!0,text:"Exit"}],cancelIcon:{enabled:!0,label:"Exit tutorial"},id:"example-step",text:"<p>Welcome to <strong>Piero</strong>, the Giro3D application.<br/>We can guide you through the different features.</p>",title:"Welcome!",when:{show:n}}),o.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:i,id:"view",text:"<p>This is the <b>main view</b>.</p><p>Giro3D natively supports a broad range of data sources, from 2D raster and vector data, to 3D point clouds and tilesets.</p><p>Piero adds support for CityJSON and IFC files.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:i,id:"navigate",text:'<p>This application integrates <a href="https://github.com/yomotsu/camera-controls">camera-controls</a>, a camera control for three.js.</p><p><b>Click</b> to move the camera. <b>Right-click</b> to rotate around a point. <b>Scroll</b> to zoom in or out.</p>',when:{hide:()=>{this._cameraCallback&&t.removeEventListener("interaction-end",this._cameraCallback),this._cameraCallback=null},show:()=>{let d=0;this._cameraCallback=()=>{var g;d+=1,d>2&&((g=F.activeTour)==null||g.next())},t.addEventListener("interaction-end",this._cameraCallback),n()}}}),o.addStep({attachTo:{element:"#toolbar",on:"right"},beforeShowPromise:()=>l("toolbar-datasets","#datasets-drop-zone"),buttons:i,id:"toolbar-layers",text:"<p>Giro3D supports multiple datasets.</p><p>You can toggle datasets as you wish with the <b>Datasets</b> panel.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#basemap-list",on:"right"},beforeShowPromise:()=>l("toolbar-datasets","#datasets-drop-zone"),buttons:i,id:"basemaps",text:"<p><b>Basemaps</b> are color and elevation layers that make the basic shape and aspect of the <b>Map</b>.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#overlay-list",on:"right"},beforeShowPromise:()=>l("toolbar-datasets","#datasets-drop-zone"),buttons:i,id:"overlays",text:"<p><b>Overlays</b> are vector layers in various formats (WFS, GML, GeoJSON...).</p>",when:{show:n}}),o.addStep({attachTo:{element:"#dataset-list",on:"right"},beforeShowPromise:()=>l("toolbar-datasets","#datasets-drop-zone"),buttons:i,id:"layers",text:"<p>The <b>Datasets</b> panel contains all 3D objects in the scene.</><p>You can toggle their visibility and delete them.<p><p>Most objects leverage Giro3D's adaptive resolution to optimize their display.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#datasets-drop-zone",on:"right"},beforeShowPromise:()=>l("toolbar-datasets","#datasets-drop-zone"),buttons:i,id:"adddata",text:"<p>You can add your own data from your computer by <b>dragging the file</b> into this page.</p><p>While you won't benefit from Giro3D's tiling mechanism, this can be a great way to quickly visualize datasets up to 100MB.</p><p>This application supports CityJSONs, IFCs, LAS/LAZs, CSV pointclouds, and simple GeoJSON features.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#main-view",on:"bottom"},buttons:i,id:"attributes",text:"<p>By clicking on any feature on the map, you can see its <strong>Attribute table</strong>. Clickable features display a cursor when hovered.</p>",when:{show:n}}),o.addStep({attachTo:{element:"#search-place-autocomplete",on:"bottom"},buttons:[{action:()=>{var d;(d=F.activeTour)==null||d.complete(),s.show(0)},text:"Analyzing data"},{action:()=>{var d;return(d=F.activeTour)==null?void 0:d.complete()},secondary:!0,text:"Exit"}],id:"widgets",text:"Giro3D is highly extensible. Here we added a widget to search and navigate to locations based on the French address database.",when:{show:n}}),s.addStep({attachTo:{element:"#annotations-fieldset",on:"right"},beforeShowPromise:()=>l("toolbar-annotations","#annotations-fieldset"),buttons:i,id:"annotation",text:"<p>You can <strong>annotate</strong> any data displayed using Giro3D native tools.<br>Select the <strong>geometry</strong> of your annotation, and <strong>click</strong> on the scene to add points. <strong>Right-click</strong> to end the shape.</p>",when:{show:n}}),s.addStep({attachTo:{element:"#annotations-fieldset",on:"right"},beforeShowPromise:()=>l("toolbar-annotations","#annotations-fieldset"),buttons:i,id:"annotations",text:"You can download your annotations as GeoJSON files. You can also upload your own by dragging them into this panel.",when:{show:n}}),p.hasExperimentalFeature("measurements")&&s.addStep({attachTo:{element:"#panel-container",on:"right"},beforeShowPromise:()=>l("toolbar-measures","#measures-fieldset"),buttons:i,id:"measurements",text:"You can add <strong>measurements</strong> to easily get distances betwween objects.<br>Once started, moving the mouse will display the measure. <strong>Click</strong> to save the measurement. <strong>Right-click</strong> to end.",when:{show:n}}),s.addStep({attachTo:{element:"#panel-container",on:"right"},beforeShowPromise:()=>l("toolbar-analysis","#panel-container .card"),buttons:[{action:()=>{var d;return(d=F.activeTour)==null?void 0:d.complete()},text:"Done!"}],id:"analysis",text:"In the <strong>Analysis</strong> panel you'll find some advanced analysis tools.",when:{show:n}});const b=()=>{const d=new URL(document.URL);d.searchParams.delete("tourStep"),d.searchParams.set("tour","none"),window.history.replaceState({},"",d.toString())},x=d=>{const g=new URL(document.URL);let I="main";d.tour.id.startsWith("navigating")?I="navigating":d.tour.id.startsWith("analyzing")&&(I="analyzing"),g.searchParams.set("tour",I),g.searchParams.set("tourStep",d.step.id),window.history.replaceState({},"",g.toString())};return e.on("cancel",b),e.on("complete",b),e.on("show",x),o.on("cancel",b),o.on("complete",b),o.on("show",x),s.on("cancel",b),s.on("complete",b),s.on("show",x),{analyzingTour:s,mainTour:e,navigatingTour:o}}getTours(){return this._tours||(this._tours=this.buildTours()),this._tours}restart(){const{mainTour:t}=this.getTours();t.show(0)}start(){if(!this._context)throw new Error("module is not initialized");const{analyzingTour:t,mainTour:e,navigatingTour:o}=this.getTours();this._camera=this._context.view.getCameraController();const s=new URL(document.URL),i=s.searchParams.get("tour")??"main";if(i!=="none"){const n=s.searchParams.get("tourStep")??0;i==="navigating"?o.show(n):i==="analyzing"?t.show(n):e.show(n)}}}exports.ClippingBoxAnalysis=p.ClippingBoxAnalysis;exports.CrossSectionAnalysis=pe;exports.DownloadDataset=fe;exports.FloodingPlaneAnalysis=Ce;exports.IFCLoader=He;exports.PLYLoader=Ke;exports.PotreeLoader=tt;exports.Tour=nt;
2
3
  //# sourceMappingURL=modules.cjs.js.map