mx3d 0.3.0 → 0.3.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 (3) hide show
  1. package/App.d.ts +5 -5
  2. package/mx3d.min.js +1 -1
  3. package/package.json +1 -1
package/App.d.ts CHANGED
@@ -24,11 +24,11 @@ export default class App {
24
24
  rl?: string;
25
25
  });
26
26
  load(_config: {
27
- pk: string;
28
- isDefaultLevel: boolean;
29
- isDefaultMutual: boolean;
30
- progress: Function;
31
- complete: Function;
27
+ pk?: string;
28
+ isDefaultLevel?: boolean;
29
+ isDefaultMutual?: boolean;
30
+ progress?: Function;
31
+ complete?: Function;
32
32
  }): Promise<unknown>;
33
33
  isDefaultMutual: boolean;
34
34
  set defaultMutual(value: boolean);
package/mx3d.min.js CHANGED
@@ -22,7 +22,7 @@
22
22
  diffuseColor = res.rgb;
23
23
  alpha = res.a;
24
24
  }
25
- `),r.freeze()}return r}delete(e=!1){if(this.BOX&&this.BOX.dispose(),this.transparentBox&&this.transparentBox.dispose(!0,!0),this.BOX=null,this.transparentBox=null,e){for(const t in this.resources.map)this.resources.find(t).removeAllFromScene(),this.resources.remove(t);this.resources.clear()}}async GetWalls(e,t){let i=await BABYLON.SceneLoader.LoadAssetContainerAsync(e,t+".gltf",this.app.scene);if(i.meshes){var r=i.meshes[0].getChildMeshes();for(let e=0;e<r.length;e++)this.walls.add(r[e].id,r[e])}}setTransparent(t=1){for(const i in this.resources.map){let e=this.resources.find(i);e.meshes.forEach(e=>e.visibility=t)}}}var t=i(3),v=i.n(t),t=i(29);const b=i.n(t).a.create();b.defaults.headers.post["Content-Type"]="application/json",b.interceptors.request.use(e=>{var t=localStorage.getItem("mx3d-token");return t&&(e.headers.Authorization="Bearer "+t),e},e=>Promise.reject(e)),b.interceptors.response.use(e=>e,e=>{if(e.response)switch(e.response.status){case 401:console.error("开发者授权码异常");break;case 403:console.error("当前用户没有权限");break;case 400:console.error(e.response.data.message)}return Promise.reject(e)});var w,T,A=b,t=i(4),E=i.n(t);(t=w=w||{}).leftClick="leftClick",t.rightClick="rightClick",t.doubleClick="doubleClick",t.eover="eover",t.longPress="longPress",t.out="out",t.click="click";class M{constructor(e){this.app=e}getInto(){}goBack(){}loadProperties(e){this.id="墙角_"+a.getGUID(12),this.name="墙角",this.parentId=e.parentId,this.customNumber=this.id,this.customType=this.objectType,this.height=e.height,this.objectType=f.Corner,this.pints=e.corners}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}optimization(t){this.instance.getChildMeshes().forEach(e=>{t?e.freezeWorldMatrix():e.unfreezeWorldMatrix()}),t?this.instance.freezeWorldMatrix():this.instance.unfreezeWorldMatrix(),this.instance.material&&(t?this.instance.material.freeze():this.instance.material.unfreeze())}setFlash(e){}setTransparent(){}setOpaque(){}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e,t){}removeEventListener(e){}computeView(){}bind(){let i=new Array;for(let t=0;t<this.pints.length;t++)if(2<this.pints[t].pints.length){let e=BABYLON.MeshBuilder.CreatePolygon(this.id,{shape:this.pints[t].pints,sideOrientation:BABYLON.Mesh.FRONTSIDE},this.app.scene);e.setEnabled(!1),e.position.y=this.pints[t].height,e.isPickable=!0,e.enablePointerMoveEvents=!1,i.push(e)}return!(i.length<1)&&(1<i.length?this.instance=p.MergeMeshes(i,this.app):this.instance=i[0],this.instance.id=this.id,this.instance.name=this.id,this.instance.position.y=this.height,this.instance.setEnabled(!1),this.instance.isPickable=!1,!(this.instance.enablePointerMoveEvents=!1))}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType}}completed(){this.alwaysActive(),this.optimization(!0)}}class S{static init(){let e=new v.a.Tween(this.colors[1]).to({r:1,g:0,b:0},500),t=new v.a.Tween(this.colors[1]).to({r:1,g:.5,b:.5},500);t.chain(e),e.chain(t),e.start();let i=new v.a.Tween(this.colors[2]).to({r:1,g:.55,b:0},500),r=new v.a.Tween(this.colors[2]).to({r:0,g:0,b:0},500);i.chain(r),r.chain(i),i.start();let n=new v.a.Tween(this.colors[3]).to({r:1,g:.84,b:0},500),o=new v.a.Tween(this.colors[3]).to({r:0,g:0,b:0},500);n.chain(o),o.chain(n),n.start();let s=new v.a.Tween(this.colors[4]).to({r:0,g:.75,b:1},500),a=new v.a.Tween(this.colors[4]).to({r:0,g:0,b:0},500);s.chain(a),a.chain(s),s.start();let l=new v.a.Tween(this.colors[5]).to({r:.53,g:.8,b:0},500),c=new v.a.Tween(this.colors[5]).to({r:0,g:0,b:0},500);l.chain(c),c.chain(l),l.start();let h=new v.a.Tween(this.colors[6]).to({r:.8,g:.8,b:.8},500),u=new v.a.Tween(this.colors[6]).to({r:0,g:0,b:0},500);h.chain(u),u.chain(h),h.start()}}S.colors={1:BABYLON.Color3.Red(),2:new BABYLON.Color3(1,.5,0),3:BABYLON.Color3.Yellow(),4:new BABYLON.Color3(0,1,1),5:BABYLON.Color3.Green(),6:BABYLON.Color3.Gray()},(t=T=T||{})[t.Opaque=0]="Opaque",t[t.Flash=1]="Flash",t[t.Transparent=2]="Transparent";class C{toJosn(e){e=JSON.parse(e);this.alpha=e.alpha,this.beta=e.beta,this.radius=e.radius,this.minimumLimit=e.minimumLimit,this.maximumLimit=e.maximumLimit,this.minBeta=e.minBeta,this.maxBeta=e.maxBeta,this.focus=p.ToVector3(e.focus)}toString(){return JSON.stringify({alpha:this.alpha,focus:p.vector3ToJson(this.focus),radius:this.radius,beta:this.beta,minimumLimit:this.minimumLimit,maximumLimit:this.maximumLimit,minBeta:this.minBeta,maxBeta:this.maxBeta})}setLimit(e,t){this.minimumLimit=e+.3,this.maximumLimit=t}setBeta(e,t){this.minBeta=e,this.maxBeta=t}}class I{constructor(e){this.executes=new d,this.clickEvents=new d,this.touchtime=(new Date).getTime(),this.statusType=T.Opaque,this.app=e}loadProperties(e){this.id=e.id,this.customNumber=e.customNumber,this.parentId=e.parentId,this.name=e.name,this.baseModel=e.baseModel,this.isLoop=e.isLoop,this.objectType=e.objectType,this.customType=e.customType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.scaling=p.ToVector3(e.scaling)}setEnabled(e){if(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>e.dispose()),e){let t=new BABYLON.Mesh(this.id,this.app.scene),e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e=e.createInstance(this.id);e.isPickable=!1,e.enablePointerMoveEvents=!1,e.parent=t}),t.rotation=p.ToVector3(this.rotation.clone()),t.position=p.ToVector3(this.position.clone()),t.scaling=p.ToVector3(this.scaling.clone()),this.instance.addChild(t),this.alwaysActive(),this.optimization(!0)}this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}set showBoundingBox(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.showBoundingBox=e,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}get showBoundingBox(){return this.instance.showBoundingBox}bind(){var e=this.app.resources.resources.find(this.baseModel.modelId),e=p.computeBounds(e.meshes[0]);this.instance=this.app.resources.BOX.clone(this.id),this.instance.setBoundingInfo(e),this.instance.id=this.id,this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.scaling=new BABYLON.Vector3((e.maximum.x-e.minimum.x)*this.scaling.x,(e.maximum.y-e.minimum.y)*this.scaling.y,(e.maximum.z-e.minimum.z)*this.scaling.z),0==this.instance.scaling.y&&(this.instance.scaling.y=.01),this.instance.position=p.ToVector3(this.position.clone()),this.instance.position=p.ToVector3(this.position.clone()),this.instance.position.y=(e.maximum.y-e.minimum.y)/2+this.position.y,this.instance.rotation=p.ToVector3(this.rotation.clone()),this.instance.setEnabled(!1),this.completed()}completed(){this.alwaysActive(),this.optimization(!0),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.focus=this.instance.getAbsolutePosition(),this.Sight.radius=e.boundingSphere.radiusWorld+3,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}optimization(t){this.instance.getChildMeshes().forEach(e=>{t?e.freezeWorldMatrix():e.unfreezeWorldMatrix()}),t?this.instance.freezeWorldMatrix():this.instance.unfreezeWorldMatrix(),this.instance.material&&(t?this.instance.material.freeze():this.instance.material.unfreeze())}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e),this.touchtime=(new Date).getTime()}),e=w.click):e==w.doubleClick?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger,e=>t(this,e)):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e=w.click}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setFlash(t){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>{e.instancedBuffers&&(e.instancedBuffers.color=S.colors[t])}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Flash)}setOpaque(){this.statusType!=T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>{e.setEnabled(!0),e.instancedBuffers&&(e.instancedBuffers.color=new BABYLON.Color4(1,1,1,1))}),this.instance.disableEdgesRendering(),this.instance.visibility=0,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Opaque)}setTransparent(e=.3){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>e.setEnabled(!1)),this.instance.visibility=e,this.instance.enableEdgesRendering(),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Transparent)}play(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(t=>{let i;t.animations.forEach(e=>{-1!=e.name.indexOf("open")&&(i=e)}),i?this.app.scene.beginDirectAnimation(t,[i],0,10*i.getKeys().length,this.isLoop):t.animations.forEach(e=>this.app.scene.beginDirectAnimation(t,[e],0,10*e.getKeys().length,this.isLoop))}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}stop(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(t=>{let i;t.animations.forEach(e=>{-1!=e.name.indexOf("close")&&(i=e)}),i?this.app.scene.beginDirectAnimation(t,[i],0,10*i.getKeys().length,!1):t.animations.forEach(e=>this.app.scene.beginDirectAnimation(t,[e],10*e.getKeys().length,0,!1))}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType}}getInto(){this.app.cameraController.flyTo(this.Sight)}goBack(){}}class B extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.objectType=f.Floor,this.vectors=e.vectors,this.buckles=e.buckles,this.height=e.height}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=BABYLON.MeshBuilder.CreatePolygon("地板",{shape:p.Expand(this.vectors,-.01),holes:this.buckles,sideOrientation:BABYLON.Mesh.DOUBLESIDE},this.app.scene),this.instance.setEnabled(!1),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,this.instance.position.y=this.height-.01,this.instance.id=this.id,this.instance.name="地板";var e=this.app.resources.GetMaterial(this.baseModel,this.app.scene).clone(this.id),t=this.instance.getBoundingInfo();this.Sight=p.getVisualAngle(t,this.app),this.baseModel.isTiling&&(e.diffuseTexture.uScale=(t.maximum.x-t.minimum.x)/this.baseModel.width,e.diffuseTexture.vScale=(t.maximum.z-t.minimum.z)/this.baseModel.length),this.instance.material=e,this.completed()}}class z extends I{loadProperties(e){this.id="墙_"+a.getGUID(12),this.objectType=f.Wall,this.parentId=e.parentId,this.name="墙体",this.customNumber=this.id,this.customType=this.objectType,this.walls=e.walls,this.height=e.height,this.baseModel=e.baseModel,this.baseModel&&!this.baseModel.length&&(this.baseModel.length=3.1)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=se.Tools.MergeMeshes(this.walls,this.app),this.instance.setEnabled(!1),this.instance.receiveShadows=!0,this.baseModel?this.nativeMaterial=this.app.resources.GetMergeMaterial(this.baseModel,this.app.scene):this.nativeMaterial=null,this.instance.material=this.nativeMaterial,this.instance.id=this.id,this.instance.name=this.id,this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,this.instance.position.y+=this.height,this.completed()}completed(){this.alwaysActive(),this.optimization(!0)}}class k{constructor(e){this.executes=new d,this.clickEvents=new d,this.touchtime=(new Date).getTime(),this.app=e}loadProperties(e){}bind(){}completed(){this.computeView()}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e),this.touchtime=(new Date).getTime()}),e=w.click):e==w.doubleClick?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger,e=>t(this,e)):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e=w.click}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}load(e,n){let s=new Array;for(let t=0;t<n.length;t++){let e=n[t];e.objectType==f.Wall&&(e.height||(e.height=3.1),e.ply||(e.ply=.09),s.push(e))}let o=new d;for(let e=0;e<n.length;e++){let i=n[e];i.objectType==f.Corner&&(o.add(i.id,i.corner),2<i.pints.length&&(i.height=3.1,i.walls.forEach(t=>{s.forEach(e=>{t==e.id&&parseFloat(e.height)<i.height&&(i.height=parseFloat(e.height))})})))}if(!e){let t=new Array;for(let e=0;e<n.length;e++){var i=n[e];i.objectType==f.Corner&&t.push(i)}let e=new M(this.app);e.loadProperties({parentId:this.id,height:this.position.y,corners:t}),e.bind()?this.app.project.objectDatas.add(e.id,e):e=null}for(let i=0;i<n.length;i++){let r=n[i];if(r.objectType==f.Floor){r.vectors=new Array;let e=n[i];e.pints.forEach(e=>{o.find(e)||console.log(e),r.vectors.push(o.find(e))}),r.buckles=new Array,e.holes&&e.holes.forEach(e=>{let t=new Array;e.forEach(e=>t.push(o.find(e))),r.buckles.push(t)}),e.middles&&e.middles.forEach(t=>{let i=Array();for(let e=0;e<n.length;e++)n[e].id==t&&n[e].pints.forEach(e=>{e=o.find(e);i.push(new BABYLON.Vector3(e.x,0,e.z))});r.buckles.push(i)}),r.height=this.position.y;let t=new B(this.app);t.loadProperties(r),t.bind(),this.app.project.objectDatas.add(t.id,t)}}if(o=null,!e){let o=new d;o.add("body",{t:"",walls:new Array});for(let n=0;n<s.length;n++){let r=BABYLON.MeshBuilder.ExtrudePolygon(s[n].id,{shape:[p.ToVector3(s[n].wtop),p.ToVector3(s[n].wleft),p.ToVector3(s[n].wbottom),p.ToVector3(s[n].wright)],depth:parseFloat(s[n].height),sideOrientation:BABYLON.Mesh.FRONTSIDE},this.app.scene);r.setEnabled(!1),r.position.y=parseFloat(s[n].height),r.subMeshes=[];var a=r.getTotalVertices();r.subMeshes.push(new BABYLON.SubMesh(0,0,a,0,6,r)),r.subMeshes.push(new BABYLON.SubMesh(0,1,a,18,6,r)),r.subMeshes.push(new BABYLON.SubMesh(0,2,a,30,6,r));for(let i=0;i<s[n].wallwindows.length;i++){const u=BABYLON.CSG.FromMesh(r);let e=this.app.project.objectDatas.find(s[n].wallwindows[i]);var l=e.instance.getBoundingInfo(),c=BABYLON.MeshBuilder.CreateBox((new Date).getTime().toString(),{height:l.maximum.y-l.minimum.y,width:l.maximum.x-l.minimum.x,depth:2*parseFloat(s[n].ply)+.1},this.app.scene);c.position=e.instance.position.clone(),c.position.y=(l.maximum.y-l.minimum.y)/2+e.height,c.rotation=e.instance.rotation.clone();l=BABYLON.CSG.FromMesh(c);let t=u.subtract(l);c.dispose(),r.dispose(),r=t.toMesh(s[n].id,null,this.app.scene,!0),r.setEnabled(!1)}let t=o.find(s[n].leftMap.modelId);t||(t={t:s[n].leftMap,walls:new Array},o.add(s[n].leftMap.modelId,t));let i=o.find(s[n].rightMap.modelId);i||(i={t:s[n].rightMap,walls:new Array},o.add(s[n].rightMap.modelId,i));var h=p.DeconsTructMesh(r,parseFloat(s[n].height),this.app);for(let e=0;e<h.length;e++)(2==e||3==e?t:4==e||5==e?i:o.find("body")).walls.push(h[e])}for(const r in o.map){var t=o.find(r);if(0<t.walls.length){let e=new z(this.app);e.loadProperties({baseModel:t.t,walls:t.walls,parentId:this.id,height:this.position.y}),e.bind(),this.app.project.objectDatas.add(e.id,e)}}}this.completed(),s=null}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType,index:this.index,layerHeight:this.layerHeight,layerName:this.layerName}}computeView(){var i,r;let n=this.app.project.getChildsById(this.id);0<n.length&&(i=r=n[0].instance.position.clone());for(let e=0;e<n.length;e++){let t=n[e];if(t.objectType!=f.Storey&&t.objectType!=f.Campus){let e=t.instance.getBoundingInfo();i=BABYLON.Vector3.Minimize(i,e.minimum.add(t.instance.position)),r=BABYLON.Vector3.Maximize(r,e.maximum.add(t.instance.position))}}i&&r||(i=BABYLON.Vector3.Zero(),r=new BABYLON.Vector3(12,0,8)),this.Sight=p.getVisualAngle(new BABYLON.BoundingInfo(i,r),this.app)}getInto(){for(var t in this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.app.project.objectDatas.map){let e=this.app.project.objectDatas.find(t);e.setEnabled(e.parentId==this.id)}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}goBack(){}}class P extends k{loadProperties(e){this.id=e.id,this.name=e.name,this.parentId=e.parentId,this.index=e.index,this.layerName=this.index<0?"B"+this.index:"F"+(this.index+1),this.layerHeight=e.layerHeight,this.objectType=e.objectType,this.customNumber=e.customNumber||e.id,this.customType=e.customType||this.objectType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.scaling=p.ToVector3(e.scaling)}bind(){this.instance=BABYLON.MeshBuilder.CreateGround(this.id,{width:this.scaling.x,height:this.scaling.z},this.app.scene),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!0;let e=new BABYLON.StandardMaterial("mat_"+this.id);e.diffuseColor=BABYLON.Color3.White(),e.alpha=.3,e.backFaceCulling=!1,this.instance.material=e,this.instance.position=this.position,this.instance.position.y-=.01,this.instance.rotation=this.rotation.clone(),this.setEnabled(!1)}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}completed(){this.alwaysActive(),this.computeView()}computeView(){var i,r;let n=this.app.project.getChildsById(this.id);0<n.length&&(i=r=n[0].instance.position.clone());for(let e=0;e<n.length;e++){let t=n[e];if(t.objectType!=f.Storey&&t.objectType!=f.Campus&&t.objectType!=f.Wall&&t.objectType!=f.Corner){let e=t.instance.getBoundingInfo();i=BABYLON.Vector3.Minimize(i,e.minimum.add(t.instance.position)),r=BABYLON.Vector3.Maximize(r,e.maximum.add(t.instance.position))}}i&&r||(i=BABYLON.Vector3.Zero(),r=new BABYLON.Vector3(12,0,8)),this.Sight=p.getVisualAngle(new BABYLON.BoundingInfo(i,r),this.app)}}class L extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.objectType=f.LeakWater,this.lines=p.ToARRVector3(e.lines)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=p.createTube(this.id,this.lines,.02,this.app),this.instance.setEnabled(!1);var e=this.app.resources.GetMaterial(this.baseModel,this.app.scene).clone(this.id);BABYLON.Animation.CreateAndStartAnimation("u",e.diffuseTexture,"vOffset",15,30,0,1,1),e.diffuseTexture.vScale=this.instance.getTotalVertices()/50,this.instance.material=e,this.completed()}completed(){this.alwaysActive(),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.radius=e.boundingSphere.radiusWorld+3,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick||e==w.doubleClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e);let r=this.clickEvents.find(w.doubleClick);r&&0==e.sourceEvent.button&&(new Date).getTime()-this.touchtime<500&&r(this,e),this.touchtime=(new Date).getTime()}),e="click"):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e="click"}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action,this.instance.getChildMeshes().forEach(e=>e.actionManager=this.action)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class D extends I{loadProperties(e){this.id=e.id,this.customNumber=e.customNumber,this.parentId=e.parentId,this.name=e.name,this.radius=e.radius,this.pints=p.ToARRVector3(e.pints),this.objectType=e.objectType,this.customType=e.customType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.color=e.color,this.alpha=e.alpha}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id);let e=p.createTube(this.id,this.pints,this.radius,this.app);this.instance.position=e.getBoundingInfo().boundingBox.center.clone(),this.instance.addChild(e),this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),e.setParent(this.instance.parent),this.instance.dispose(),this.instance=e;let t=new BABYLON.StandardMaterial("mat_"+this.id,this.app.scene);t.diffuseColor=BABYLON.Color3.FromHexString(this.color),t.alpha=this.alpha,this.instance.material=t,this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.setEnabled(!1),this.completed()}setColor(e,t,i){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.diffuseColor=new BABYLON.Color3(e/255,i/255,t/255),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}reColor(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.diffuseColor=BABYLON.Color3.FromHexString(this.color),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),e=p.getVisualAngle(e,this.app);this.alpha=e.alpha,this.Sight.beta=e.beta,this.Sight.focus=e.focus,this.Sight.radius=e.radius,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}setFlash(e=1){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.emissiveColor=S.colors[e],this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Flash)}setOpaque(){this.statusType!=T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!0),this.instance.material.alpha=this.alpha,this.instance.material.emissiveColor=null,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Opaque)}setTransparent(e=.3){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.alpha=e,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Transparent)}}class R extends I{setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}loadProperties(e){var t,i;this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.objectType=f.UI3D,this.tconfig.color=e.color,e.size?(this.tconfig.clearColor=null,this.tconfig.position=se.Tools.ToVector3(e.position),i=se.Tools.ToVector3(e.rotation),this.tconfig.rotation=new BABYLON.Vector3(i.x+Math.PI,i.y,i.z),t=Number.parseInt(e.size.replace("px",""))/40,i=e.scaling?se.Tools.ToVector3(e.scaling):BABYLON.Vector3.One(),this.tconfig.scaling=new BABYLON.Vector3(14*t/50*i.x,1,14*t/50*i.z)):(this.tconfig.clearColor=e.clearColor,this.tconfig.position=se.Tools.ToVector3(e.position),this.tconfig.rotation=se.Tools.ToVector3(e.rotation),this.tconfig.scaling=se.Tools.ToVector3(e.scaling))}bind(){var e="bold 100px Arial";let t=new BABYLON.DynamicTexture(this.id,64,this.app.scene,!1);var i=t.getContext();i.font=e;var r=i.measureText(this.name).width+8,i=.02*r;t=new BABYLON.DynamicTexture(this.id,{width:r,height:150},this.app.scene,!1);r=new BABYLON.StandardMaterial(this.id,this.app.scene);r.backFaceCulling=!1,r.diffuseTexture=t,this.tconfig.clearColor||(t.hasAlpha=!0),t.drawText(this.name,null,null,e,this.tconfig.color,this.tconfig.clearColor,!1),this.instance=BABYLON.Mesh.CreateGround(this.id,i,3,1,this.app.scene),this.instance.setEnabled(!1),this.instance.scaling=this.tconfig.scaling,this.instance.position=this.tconfig.position,this.instance.rotation=this.tconfig.rotation,this.instance.material=r,this.completed()}}class O extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.objectType=f.VirtualBox,this.virtualType=e.virtualType,this.color=BABYLON.Color3.FromHexString(e.color),this.alpha=e.alpha,this.isEdges=e.isEdges,this.edgesWidth=e.edgesWidth,this.edgesColor=BABYLON.Color3.FromHexString(e.edgesColor).toColor4(1),this.rotation=se.Tools.ToVector3(e.rotation),this.position=se.Tools.ToVector3(e.position),this.scaling=se.Tools.ToVector3(e.scaling)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){"Cylinder"==this.virtualType?this.instance=BABYLON.MeshBuilder.CreateCylinder(this.id,{height:1,diameterTop:1,diameterBottom:1},this.app.scene):this.instance=BABYLON.MeshBuilder.CreateBox(this.id,{size:1},this.app.scene),this.instance.setEnabled(!1),this.instance.id=this.id;let e=new BABYLON.StandardMaterial(this.id,this.app.scene);e.diffuseColor=this.color,this.alpha<.98&&(e.alpha=this.alpha,e.alphaMode=2,e.useAlphaFromDiffuseTexture=!0),this.instance.material=e,this.isEdges&&(this.instance.enableEdgesRendering(),this.instance.edgesWidth=1,this.instance.edgesColor=new BABYLON.Color4(0,1,1,1)),this.edgesWidth&&0<this.edgesWidth&&(this.instance.enableEdgesRendering(),this.instance.edgesWidth=this.edgesWidth,this.instance.edgesColor=this.edgesColor),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),this.instance.scaling=this.scaling.clone(),this.completed()}}class F extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.height=e.baseModel.height,this.objectType=f.Door,this.rotation=p.ToVector3(e.rotation),this.position=p.ToVector3(e.position)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene);let e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e.createInstance(this.id).parent=this.instance});var t=p.computeBounds(this.instance);this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone();let i=this.app.resources.BOX.createInstance(this.id);i.setBoundingInfo(t),i.enablePointerMoveEvents=!1,i.isPickable=!1,i.scaling=new BABYLON.Vector3((t.maximum.x-t.minimum.x)*this.instance.scaling.x,(t.maximum.y-t.minimum.y)*this.instance.scaling.y,(t.maximum.z-t.minimum.z)*this.instance.scaling.z),i.position=this.instance.position.clone(),i.position.y=(t.maximum.y-t.minimum.y)/2+this.instance.position.y,i.rotation=this.instance.rotation.clone(),this.instance.getChildMeshes().forEach(e=>e.setParent(i)),this.instance.dispose(),this.instance=i,this.instance.setEnabled(!1),this.completed()}}class N extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.height=e.baseModel.height,this.objectType=f.Window,this.rotation=p.ToVector3(e.rotation),this.position=p.ToVector3(e.position)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene);let e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e.createInstance(this.id).parent=this.instance});var t=p.computeBounds(this.instance);this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),this.Sight=p.getVisualAngle(t,this.app);let i=this.app.resources.BOX.createInstance(this.id);i.setBoundingInfo(t),i.enablePointerMoveEvents=!1,i.isPickable=!1,i.scaling=new BABYLON.Vector3((t.maximum.x-t.minimum.x)*this.instance.scaling.x,(t.maximum.y-t.minimum.y)*this.instance.scaling.y,(t.maximum.z-t.minimum.z)*this.instance.scaling.z),i.position=this.instance.position.clone(),i.position.y=(t.maximum.y-t.minimum.y)/2+this.instance.position.y,i.rotation=this.instance.rotation.clone(),this.instance.getChildMeshes().forEach(e=>e.setParent(i)),this.instance.dispose(),this.instance=i,this.instance.setEnabled(!1),this.completed()}}class U extends I{completed(){this.alwaysActive(),this.optimization(!0),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.focus=this.instance.position.clone(),this.Sight.radius=1.5*e.boundingSphere.radiusWorld,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=3*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}getInto(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.app.resources.setTransparent(.2);let n=new d,e=this.app.project.getChildsById(this.id);e.forEach(e=>{let t=!0;var i=this.app.project.getChildsById(e.id);for(let e=0;e<i.length;e++){var r=i[e];(r instanceof z||r instanceof F||r instanceof M||r instanceof N||r instanceof B)&&(n.add(r.id,r.id),t=!1)}n.add(e.id,e.id),e instanceof P&&(t||e.addEventListener(w.leftClick,()=>{this.app.resources.setTransparent(),this.app.project.switchLevel(e.id)}),e.addEventListener(w.eover,()=>{this.app.toolTips.text=e.layerName}),e.addEventListener(w.out,()=>{this.app.toolTips.text=""}))});for(const t in this.app.project.objectDatas.map){let e=this.app.project.objectDatas.find(t);n.find(e.id)||e.parentId==this.parentId?e.setEnabled(!0):e.setEnabled(!1)}this.setEnabled(!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}goBack(){this.app.resources.setTransparent()}}class j extends k{addEventListener(e,t){}removeEventListener(e){}setEnabled(e){this.instance.setEnabled(e)}loadProperties(e){this.id=e.id,this.name=e.name,this.parentId=e.parentId,this.index=e.index,this.layerName=this.index<0?"B"+this.index:"F"+(this.index+1),this.layerHeight=e.layerHeight,this.objectType=e.objectType,this.customNumber=e.customNumber||e.id,this.customType=e.customType||this.objectType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation)}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.position=this.position,this.instance.position.y-=.01,this.instance.rotation=this.rotation.clone(),this.setEnabled(!1)}}class V{constructor(e,t){this.textDics=new Array,this.id=e,this.scene=t}set background(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._background&&this._background.dispose(),this._background=new BABYLON.GUI.Image(a.getGUID(12)+"_Image",e),this._background.width=this.size.width+"px",this._background.height=this.size.height+"px",this.rect.addControl(this._background),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e?(this._background.isPointerBlocker=!1,this._background.onPointerClickObservable.add(()=>{e(this.id)})):this._background.onPointerClickObservable.clear(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setTexts(i){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.textDics.forEach(e=>e.dispose());for(let t=this.textDics.length=0;t<i.length;t++){let e=new BABYLON.GUI.TextBlock;e.text=i[t].text,e.fontSize=i[t].fontSize||"20px",e.color=i[t].color||"white",e.top=i[t].top||0,e.left=i[t].left||0,this.rect.addControl(e),this.textDics.push(e)}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}line(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._line&&this._line.dispose(),this._line=new BABYLON.GUI.Line,this._line.lineWidth=e.width||1.5,this._line.color=e.color||"green",this._line.y2=this.size.height/2,this.container.addControl(this._line),this._line.linkWithMesh(this.pint),this._line.connectedControl=this.rect,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&this.rect.dispose(),this._line&&this._line.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&(this.rect.isVisible=e),this._line&&(this._line.isVisible=e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class G{constructor(e,t,i,r,n,o){this.id=e,this.scene=o,this.url=i,this.scaling=r,this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance=BABYLON.Mesh.CreatePlane(this.id,r,this.scene,!0,BABYLON.Mesh.DOUBLESIDE),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.position=t.clone(),this.instance.position.y+=n,this.instance.billboardMode=BABYLON.Mesh.BILLBOARDMODE_Y;let s=new BABYLON.StandardMaterial("Mat_"+this.id,this.scene);s.diffuseColor=BABYLON.Color3.White(),s.emissiveColor=BABYLON.Color3.White(),this.instance.material=s,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setBackground(){let i=new Image;i.src=this.url,i.onload=()=>{this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.scaling.y=this.scaling/(i.width/i.height)/this.scaling;let e=new BABYLON.DynamicTexture(this.id,{width:i.width,height:i.height},this.scene,!1);e.hasAlpha=!0,this.instance.material.diffuseTexture=e;let t=e.getContext();t.drawImage(i,0,0),e.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}addEventListener(t){if(this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.actionManager&&this.instance.actionManager.dispose(),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,t){this.instance.isPickable=!0,this.instance.enablePointerMoveEvents=!0;let e=new BABYLON.ActionManager(this.scene);e.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>t(this.id))),this.instance.actionManager=e}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setColor(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.material.diffuseColor=BABYLON.Color3.FromHexString(e),this.instance.material.emissiveColor=BABYLON.Color3.FromHexString(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setContents(i){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let r=new Image;r.src=this.url,r.onload=()=>{this.instance.scaling.y=this.scaling/(r.width/r.height)/this.scaling;let t=new BABYLON.DynamicTexture(this.id,{width:r.width,height:r.height},this.scene,!1);t.hasAlpha=!0,this.instance.material.diffuseTexture=t;let e=t.getContext();e.drawImage(r,0,0),i.forEach(e=>t.drawText(e.text,e.left,e.top,"bold "+e.fontSize+" monospace",e.color||"#fffffb","",!0,!0)),t.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class Y{constructor(e,t){this.anchor=e,this.ratio=t}dispose(){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose(),this.textMesh&&this.textMesh.dispose(),this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class Z{constructor(e){this.displayValue=!1,this.anchor=e,this.id=a.getGUID(12),this.texts=new Array}isEnabled(t){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh.setEnabled(t),this.texts.forEach(e=>e.isVisible=!!t&&this.displayValue),this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}set displayValues(t){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.texts.forEach(e=>e.isVisible=t),this.displayValue=t,this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose();for(let e=0;e<this.texts.length;e++)this.texts[e].linkedMesh&&this.texts[e].linkedMesh.dispose(),this.texts[e].dispose();this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var q=i(12);class ${constructor(){this.color="#00ff00",this.width=1}update(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose();let t=[];this.objs.forEach(e=>t.push(e.instance.getAbsolutePosition().clone())),this.instance=p.createTube(this.id,t,this.width/100,this.objs[0].app);let e=new BABYLON.StandardMaterial("mat_"+this.id,this.objs[0].app.scene);e.diffuseColor=BABYLON.Color3.FromHexString(this.color),this.instance.material=e,this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(t){if(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.actionManager&&this.instance.actionManager.dispose(),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,t){this.instance.isPickable=!0,this.instance.enablePointerMoveEvents=!0;let e=new BABYLON.ActionManager(this.objs[0].app.scene);e.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>t(this.id))),this.instance.actionManager=e}this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.instance&&(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1)}dispose(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class W{constructor(){this.color="#00ff00",this.width=5,this.isDotted=!1}update(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.instance=new BABYLON.GUI.MultiLine,this.objs[0].app.container.addControl(this.instance),this.instance.lineWidth=this.width,this.instance.color=this.color,this.isDotted&&(this.instance.dash=[1]),this.objs.forEach(e=>this.instance.add(e.instance)),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e?(this.instance.isPointerBlocker=!1,this.instance.onPointerClickObservable.add(()=>{e(this.id)})):this.instance.onPointerClickObservable.clear(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.instance&&(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.isVisible=e,this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1)}dispose(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var X,t=i(9),H=i.n(t);class K{constructor(e,t="540E5CBA3D09480F8CDE2F69C55934EF",i=[117.28688541016095,39.094144209740534],r=Math.PI){this.type="custom",this.renderingMode="3d",this.drones={x:39.094144209740534,y:117.28688541016095,z:0},this.rotation=Math.PI,this.onAdd=(e,t)=>{this.map=e;const i=new BABYLON.Engine(t,!0,{useHighPrecisionMatrix:!0},!0);this.scene=new BABYLON.Scene(i),this.scene.autoClear=!1,this.scene.detachControl(),this.scene.beforeRender=function(){i.wipeCaches(!0)},this.camera=new BABYLON.Camera("mapbox-camera",new BABYLON.Vector3,this.scene);let r=new BABYLON.HemisphericLight("light",new BABYLON.Vector3(1,1,0),this.scene);r.intensity=1,r.diffuse=BABYLON.Color3.FromHexString("#FFFFFF"),r.specular=BABYLON.Color3.Black();let n=new BABYLON.HemisphericLight("light1",new BABYLON.Vector3(-1,1,0),this.scene);n.intensity=.7,n.diffuse=BABYLON.Color3.FromHexString("#FFFFFF"),n.specular=BABYLON.Color3.Black(),this.recalculateProjectionMatrix(this.initialCoordinates),BABYLON.SceneLoader.LoadAssetContainerAsync(se.rl+"bundle/"+this.modelsId+"/",this.modelsId+".gltf",this.scene).then(e=>{e.addAllToScene();const t=e.meshes[0];e=H.a.MercatorCoordinate.fromLngLat(this.initialCoordinates,0);t.position=new BABYLON.Vector3((e.x-this.sceneOrigin.x)/this.modelScale,0,-(e.y-this.sceneOrigin.y)/this.modelScale),t.rotation=new BABYLON.Vector3(0,this.rotation,0),t.getChildMeshes().forEach(e=>{-1!=e.id.indexOf("B_")&&(console.log(e.id),e.setEnabled(!1))})})},this.render=(e,t)=>{t=BABYLON.Matrix.FromArray(t),t=this.modelMatrix.multiply(t);this.camera.freezeProjectionMatrix(t),this.scene.render(!1),this.map.triggerRepaint()},this.id=e,this.modelsId=t,this.initialCoordinates=i,this.rotation=r}recalculateProjectionMatrix(e){var t=[Math.PI/2,0,0];const i=H.a.MercatorCoordinate.fromLngLat(e,0);this.modelScale=i.meterInMercatorCoordinateUnits(),this.sceneOrigin=new BABYLON.Vector3(i.x,i.y,i.z),this.modelMatrix=BABYLON.Matrix.Compose(new BABYLON.Vector3(this.modelScale,this.modelScale,this.modelScale),BABYLON.Quaternion.FromEulerAngles(t[0],t[1],t[2]),this.sceneOrigin)}}class J{static rand(e,t){return Math.floor(Math.random()*(t-e+1)+e)}static init(){J.canvasThunder=document.getElementById("canvasThunder"),J.canvasCloud=document.getElementById("canvasCloud"),J.canvasRain=document.getElementById("canvasRain"),J.canvasThunder&&J.canvasThunder.getContext||console.error("找不到下雨的画布!"),J.canvasThunderCtx=J.canvasThunder.getContext("2d"),J.canvasCloudCtx=J.canvasCloud.getContext("2d"),J.canvasRainCtx=J.canvasRain.getContext("2d"),J.X=J.canvasThunder.width=J.canvasRain.width=J.canvasCloud.width=window.innerWidth,J.Y=J.canvasThunder.height=J.canvasRain.height=J.canvasCloud.height=window.innerHeight,console.log(J.Y),window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};function e(e,t,i,r){this.ctx=e,this.init(t,i,r)}e.prototype.init=function(e,t,i){this.x=e,this.y=t,this.r=i,this.l=J.rand(J.Y,3*J.Y),this.c="rgb(201, 162, 198)"},e.prototype.draw=function(){var e=this.ctx;e.beginPath(),e.lineWidth=this.r,e.strokeStyle=this.c,e.moveTo(this.x,this.y),this.x+=J.rand(-10,10),this.y+=J.rand(10,15),e.lineTo(this.x,this.y),e.stroke()},e.prototype.updateParams=function(){this.y>this.l&&this.init(J.rand(0,J.X),J.rand(0,J.Y/3),J.rand(1,5))},e.prototype.render=function(){this.updateParams(),this.draw()};for(var t=0;t<10;t++){var i=new e(J.canvasThunderCtx,J.rand(0,J.X),J.rand(0,J.Y/3),J.rand(1,5));J.thunders.push(i)}function r(e,t,i,r){this.ctx=e,this.init(t,i,r)}r.prototype.init=function(e,t,i){this.x=e,this.y=t,this.r=i,this.c="rgb(179, 203, 255)",this.v={y:10}},r.prototype.draw=function(){var e=this.ctx;e.beginPath(),e.fillStyle=this.c,e.arc(this.x,this.y,this.r,0,2*Math.PI,!1),e.fill()},r.prototype.updatePosition=function(){this.y+=this.v.y},r.prototype.wrapPosition=function(){this.y>J.Y&&(this.y=0)},r.prototype.resize=function(){this.x=J.rand(0,J.X),this.y=J.rand(0,J.Y)},r.prototype.render=function(){this.updatePosition(),this.wrapPosition(),this.draw()};for(t=0;t<100;t++){var n=new r(J.canvasRainCtx,J.rand(0,J.X),J.rand(0,J.Y),1);J.rains.push(n)}function o(e,t,i){this.ctx=e,this.init(t,i)}o.prototype.init=function(e,t){this.x=e,this.y=t,this.c="rgb(201, 162, 198)",this.r=J.rand(100,200),this.v={x:.5,y:0},this.color={r:0,g:0,b:0,a:1}},o.prototype.wrapPosition=function(){this.x-this.r>J.X&&(this.x=0-this.r)},o.prototype.updatePosition=function(){this.x+=this.v.x},o.prototype.resize=function(){this.x=J.rand(-100,J.X+100),this.y=J.rand(0,J.Y/2)},o.prototype.render=function(){this.updatePosition(),this.wrapPosition(),this.draw()},o.prototype.gradient=function(){var e=this.color.r+","+this.color.g+","+this.color.b,t=this.ctx.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);return t.addColorStop(0,"rgba("+e+", "+ +this.color.a+")"),t.addColorStop(.5,"rgba("+e+", "+.5*this.color.a+")"),t.addColorStop(1,"rgba("+e+", "+0*this.color.a+")"),t},o.prototype.draw=function(){var e=this.ctx;e.save(),e.scale(2,1),e.beginPath(),e.globalAlpha=.2,e.fillStyle=this.gradient(),e.arc(this.x,this.y,this.r,2*Math.PI,!1),e.fill(),e.scale(.5,1),e.restore()};for(t=0;t<50;t++){var s=new o(J.canvasCloudCtx,J.rand(-100,J.X+100),J.rand(0,J.Y/2));J.clouds.push(s)}J.render(),window.addEventListener("resize",function(){J.onResize()})}static onResize(){J.X=J.canvasThunder.width=J.canvasRain.width=J.canvasCloud.width=window.innerWidth,J.Y=J.canvasThunder.height=J.canvasRain.height=J.canvasCloud.height=window.innerHeight;for(var e=0;e<J.rains.length;e++)J.rains[e].resize()}static clearCanvasThunder(){J.canvasThunderCtx.globalCompositeOperation="darken",J.canvasThunderCtx.globalAlpha=.01,J.canvasThunderCtx.fillStyle="rgb(19, 16, 65)",J.canvasThunderCtx.fillRect(0,0,J.X,J.Y),J.canvasThunderCtx.globalCompositeOperation="source-over",J.canvasThunderCtx.globalAlpha=1,Math.random()<.02&&(J.canvasThunderCtx.fillStyle="rgb(128, 128, 128)",J.canvasThunderCtx.fillRect(0,0,J.X,J.Y))}static clearCanvasRain(){J.canvasRainCtx.clearRect(0,0,J.X,J.Y)}static clearCanvasCloud(){J.canvasCloudCtx.clearRect(0,0,J.X,J.Y)}static render(){J.clearCanvasThunder(),J.clearCanvasCloud(),J.clearCanvasRain();for(var e=0;e<J.thunders.length;e++)J.thunders[e].render();for(e=0;e<J.clouds.length;e++)J.clouds[e].render();for(e=0;e<J.rains.length;e++)J.rains[e].render();requestAnimationFrame(J.render)}static stop(){J.canvasCloud.style.display="none",J.canvasRain.style.display="none",J.canvasThunder.style.display="none"}static start(){J.canvasCloud.style.display="",J.canvasRain.style.display="",J.canvasThunder.style.display=""}}J.thunders=[],J.clouds=[],J.rains=[];class Q{constructor(e){this.thunderNum=20,this.thunders=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="thunderEffect",this.canvas.style.cssText="width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent;z-index: 0;background: #000F1E;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasThunderCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight,this.app.environment.setTransparent(.5);for(var e=0;e<this.thunderNum;e++){var t=new ee(this.canvasThunderCtx,p.rand(0,this.X),p.rand(0,this.Y/3),p.rand(1,5),this.X,this.Y);this.thunders.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas),this.app.environment.setTransparent(1)}render(){this.clearCanvasThunder();for(var e=0;e<this.thunders.length;e++)this.thunders[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasThunder(){this.canvasThunderCtx.globalCompositeOperation="darken",this.canvasThunderCtx.globalAlpha=.01,this.canvasThunderCtx.fillStyle="rgb(19, 16, 65)",this.canvasThunderCtx.fillRect(0,0,this.X,this.Y),this.canvasThunderCtx.globalCompositeOperation="source-over",this.canvasThunderCtx.globalAlpha=1,Math.random()<.02&&(this.canvasThunderCtx.fillStyle="rgb(128, 128, 128)",this.canvasThunderCtx.fillRect(0,0,this.X,this.Y))}}class ee{constructor(e,t,i,r,n,o){this.ctx=e,this.X=n,this.Y=o,this.init(t,i,r)}init(e,t,i){this.x=e,this.y=t,this.r=i,this.l=p.rand(this.Y,3*this.Y),this.c="rgb(201, 162, 198)"}draw(){this.ctx.beginPath(),this.ctx.lineWidth=this.r,this.ctx.strokeStyle=this.c,this.ctx.moveTo(this.x,this.y),this.x+=p.rand(-10,10),this.y+=p.rand(10,15),this.ctx.lineTo(this.x,this.y),this.ctx.stroke()}updateParams(){this.y>this.l&&this.init(p.rand(0,this.X),p.rand(0,this.Y/3),p.rand(1,5))}render(){this.updateParams(),this.draw()}}class te{constructor(e){this.rainNum=1e3,this.rains=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="RainEffect",this.canvas.style.cssText="width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent; z-index: 3;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasRainCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight;for(var e=0;e<this.rainNum;e++){var t=new ie(this.canvasRainCtx,p.rand(0,this.X),p.rand(0,this.Y),1,this.Y);this.rains.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas)}render(){this.clearCanvasRain();for(var e=0;e<this.rains.length;e++)this.rains[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasRain(){this.canvasRainCtx.clearRect(0,0,this.X,this.Y)}}class ie{constructor(e,t,i,r,n){this.rainSpeed=10,this.ctx=e,this.Y=n,this.init(t,i,r)}init(e,t,i){this.x=e,this.y=t,this.r=i,this.c="rgb(179, 203, 255)",this.v={y:this.rainSpeed}}draw(){var e=this.ctx;e.beginPath(),e.fillStyle=this.c,e.arc(this.x,this.y,this.r,0,2*Math.PI,!1),e.fill()}updatePosition(){this.y+=this.v.y}wrapPosition(){this.y>this.Y&&(this.y=0)}render(){this.updatePosition(),this.wrapPosition(),this.draw()}}class re{constructor(e){this.cloudNum=50,this.clouds=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="CloudEffect",this.canvas.style.cssText="width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent; z-index: 1;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasCloudCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight;for(var e=0;e<this.cloudNum;e++){var t=new ne(this.canvasCloudCtx,p.rand(-100,this.X+100),p.rand(0,this.Y/2),this.X);this.clouds.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas)}render(){this.clearCanvasCloud();for(var e=0;e<this.clouds.length;e++)this.clouds[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasCloud(){this.canvasCloudCtx.clearRect(0,0,this.X,this.Y)}}class ne{constructor(e,t,i,r){this.rainSpeed=10,this.ctx=e,this.X=r,this.init(t,i)}init(e,t){this.x=e,this.y=t,this.c="rgb(201, 162, 198)",this.r=p.rand(100,200),this.v={x:.5,y:0},this.color={r:0,g:0,b:0,a:1}}draw(){this.ctx.save(),this.ctx.scale(2,1),this.ctx.beginPath(),this.ctx.globalAlpha=.2,this.ctx.fillStyle=this.gradient(),this.ctx.arc(this.x,this.y,this.r,2*Math.PI,0,!1),this.ctx.fill(),this.ctx.scale(.5,1),this.ctx.restore()}gradient(){var e=this.color.r+","+this.color.g+","+this.color.b,t=this.ctx.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);return t.addColorStop(0,"rgba("+e+", "+ +this.color.a+")"),t.addColorStop(.5,"rgba("+e+", "+.5*this.color.a+")"),t.addColorStop(1,"rgba("+e+", "+0*this.color.a+")"),t}updatePosition(){this.x+=this.v.x}wrapPosition(){this.x-this.r>this.X&&(this.x=0-this.r)}render(){this.updatePosition(),this.wrapPosition(),this.draw()}}(t=X=X||{}).Thunder="Thunder",t.Rain="Rain",t.Cloud="Cloud";class oe{static add(e,t){switch(e){case X.Thunder:{let e=new Q(t);e.start(),this.effects.add(X.Thunder,e)}break;case X.Rain:{let e=new te(t);e.start(),this.effects.add(X.Rain,e)}break;case X.Cloud:{let e=new re(t);e.start(),this.effects.add(X.Cloud,e)}}}static remove(e){let t=this.effects.find(e);t&&t.close(),this.effects.remove(e)}}oe.effects=new d;class se{}se.sl="https://www.wodashijie.com/",se.rl="https://models.wodashijie.com/",se.App=class{constructor(e){this.isDefaultMutual=!1,e.sl&&(se.sl=e.sl),e.rl&&(se.rl=e.rl),A.defaults.baseURL=se.sl,this.canvas=document.createElement("canvas"),this.canvas.style.cssText="position: absolute;width: 100%;height: 100%;background-color: transparent;outline-width: 0;-webkit-tap-highlight-color:transparent;z-index: 2;",e.container.appendChild(this.canvas),this.engine=new BABYLON.Engine(this.canvas,!0,{premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,doNotHandleContextLost:!1}),this.engine.setHardwareScalingLevel(.5),this.scene=new BABYLON.Scene(this.engine,{useGeometryUniqueIdsMap:!0,useClonedMeshMap:!0,useMaterialMeshMap:!0}),this.scene.useRightHandedSystem=!0,this.scene.getBoundingBoxRenderer().frontColor=BABYLON.Color3.Green(),this.scene.getBoundingBoxRenderer().showBackLines=!1,this.cameraController=new s(this),this.highlightLayer=new BABYLON.HighlightLayer("highlightLayer",this.scene),this.iEvent=new r(this),this.gl=new BABYLON.GlowLayer("glow2",this.scene),this.container=BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("screenUI"),this.toolTips=new _(this),this.environment=new g(this),this.environment.defaultLights(),this.environment.openAllLight(),this.resources=new x(this),this.project=new y(this),se.AlarmFlashing.init(),this.engine.runRenderLoop(()=>{this.fps&&(this.fps.innerText=this.engine.getFps().toFixed()+" fps"),this.scene.render(),v.a.update(),this.iEvent&&this.iEvent.runRender()}),window.addEventListener("resize",()=>{this.engine.resize()}),this.scene.onPointerObservable.add(e=>{this.iEvent&&this.iEvent.onPointer(e)}),this.scene.onKeyboardObservable.add(e=>{this.iEvent&&this.iEvent.onKeyboard(e)})}async load(h){h.pk=null==h.pk?"project":h.pk,h.isDefaultLevel=null==h.isDefaultLevel||h.isDefaultLevel,h.isDefaultMutual=null==h.isDefaultMutual||h.isDefaultMutual,se.pk=h.pk;var e=await A.get(`api/service/GetToken?accessToken=${se.accessToken}`);if(200==e.status){localStorage.setItem("mx3d-token",e.data);e=await A.get("api/service");if(200==e.status){localStorage.setItem("mx3d-long",e.data);e=await A.get(`api/service/${se.pk}`);if(200==e.status){let c=JSON.parse(class{static de(e){let t=localStorage.getItem("mx3d-long");var i=E.a.enc.Utf8.parse(t.substring(0,32)),r=E.a.enc.Utf8.parse(t.substring(32,48)),e=E.a.enc.Hex.parse(e),e=E.a.enc.Base64.stringify(e);return E.a.AES.decrypt(e,i,{iv:r,mode:E.a.mode.CBC,padding:E.a.pad.Pkcs7}).toString(E.a.enc.Utf8).toString()}}.de(e.data));return console.log(c),new Promise(async(e,t)=>{try{console.log((new Date).toLocaleString()),this.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let r=new d,n=new d;for(let i=0;i<c.objectDatas.length;i++){let e=c.objectDatas[i],t;!e.baseModel||".gltf"!=e.baseModel.extension||r.find(e.baseModel.modelId)||this.resources.resources.find(e.baseModel.modelId)||(e.baseModel.objectType=e.objectType,r.add(e.baseModel.modelId,e.baseModel)),e.objectType!=f.Corner&&e.objectType!=f.Wall&&e.objectType!=f.Floor&&(e.objectType==f.Window?t=new N(this):e.objectType==f.Door?t=new F(this):e.objectType==f.Campus?(t=new j(this),n.add(e.id,new Array)):e.objectType==f.Storey?(t=new P(this),n.add(e.id,new Array)):t=new(e.objectType==f.LeakWater?L:e.objectType==f.Conduit?D:e.objectType==f.UI3D?R:e.objectType==f.VirtualBox?O:e.objectType==f.Building?U:I)(this),t.loadProperties(e),this.project.objectDatas.add(t.id,t))}for(let e=0;e<c.objectDatas.length;e++){var o=c.objectDatas[e];if(o.objectType==f.Corner||o.objectType==f.Wall||o.objectType==f.Floor){let e=n.find(o.parentId);e.push(o)}}let t=0,i=r.count();for(const s in r.map)await this.resources.loadModelMesh(r.find(s)),t++,h&&h.progress&&h.progress(t/i*.3);t=0,r=null,i=this.project.objectDatas.count();for(const a in this.project.objectDatas.map){let e=this.project.objectDatas.find(a);await e.bind(),t++,h&&h.progress&&h.progress(.3+t/i*.5)}t=0,i=n.count();for(const l in n.map){t++,h&&h.progress&&h.progress(.8+t/i*.2);let e=this.project.objectDatas.find(l);e&&e instanceof k?e.load(!1,n.find(l)):console.error("出现错误,场景不存在或未创建成功",l,e)}this.project.root=this.project.objectDatas.find(c.id),this.project.optimization(),h.isDefaultMutual&&(this.defaultMutual=!0),h.isDefaultLevel&&this.project.switchLevel(null,!0),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1,console.log((new Date).toLocaleString()),e(null),this.engine.resize(),h&&h.complete&&h.complete()}catch(e){t(e)}})}}}}set defaultMutual(e){for(var t in this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.isDefaultMutual=e,this.project.objectDatas.map){let e=this.project.objectDatas.find(t);e instanceof U&&(this.project.getChildsById(e.id).length<1||(this.isDefaultMutual?e.addEventListener(w.leftClick,()=>this.project.switchLevel(e.id)):e.removeEventListener(w.leftClick)))}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.environment.hideFps(),this.project.clear(),this.resources.delete(),this.engine.dispose()}},se.Earth=class{constructor(e,t=[117.28688541016095,39.094144209740534]){this.initialCoordinates=[117.28688541016095,39.094144209740534],this.initialCoordinates=t,H.a.accessToken="pk.eyJ1IjoibGl1ayIsImEiOiJjanczNmJoZjkwY3IxM3lxcTd1NmMwZWxjIn0.11SpcY8De0c1q6S3a-2Qcg",this.map=new H.a.Map({container:e,style:"mapbox://styles/mapbox/satellite-streets-v11",zoom:1.5,center:this.initialCoordinates,projection:"globe"})}load(e){this.map.on("style.load",()=>{this.map.setFog({color:"rgb(220, 159, 159)","high-color":"rgb(36, 92, 223)","horizon-blend":.4}),this.map.addSource("mapbox-dem",{type:"raster-dem",url:"mapbox://mapbox.terrain-rgb"}),this.map.setTerrain({source:"mapbox-dem",exaggeration:1.5}),e&&e()})}laodScene(e,t=this.initialCoordinates,i=Math.PI){i=new K("babylon-layer",e,t,i);this.map.addLayer(i)}flyTo(e=this.initialCoordinates,t=18,i=130,r=75,n=12e3){this.map.flyTo({center:e,zoom:t,bearing:i,pitch:r,duration:n,essential:!0})}},se.Tools=p,se.AlarmFlashing=S,se.UI=class{static createIconFromMesh(e,t,i,r,n){let o=t.Sight.focus.clone();var s=t.instance.getBoundingInfo();return o.y+=(s.boundingBox.maximum.y-s.boundingBox.minimum.y)/2,new G(e,o,i,r,n,t.app.scene)}static createIcon(e,t,i,r){let n;t.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,n=new V(e,t.app.scene),n.size=i,n.height=r,n.pint=new BABYLON.Mesh(e+"_pint");e=t.Sight.focus.clone();return n.pint.position=e,n.pint.position.y+=r,n.rect=new BABYLON.GUI.Rectangle,n.rect.isPointerBlocker=!1,n.rect.width=i.width+"px",n.rect.height=i.height+"px",n.rect.thickness=0,t.app.container.addControl(n.rect),n.rect.linkWithMesh(n.pint),t.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,n}},se.Builder=class{static createMatrixCloud(n){n.displayValues=null!=n.displayValues&&n.displayValues,n.isAlpha=null==n.isAlpha||n.isAlpha,n.isParticle=null==n.isParticle||n.isParticle,n.height=n.height||.5,n.radius=n.radius||2.8,n.isLevelRender=null==n.isLevelRender||n.isLevelRender,n.range=n.range||{max:30,min:16};let o;if(!(n.value||n.value.maxX||n.value.maxY||n.value.data||n.anchor))return o;n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,o=new Z(n.anchor);var s=n.anchor.instance.getBoundingInfo();o.mesh=n.anchor.instance.clone(o.id),o.mesh.position.y+=n.height;var a=s.maximum.x-s.minimum.x,l=a/(2*n.value.maxX),c=s.maximum.z-s.minimum.z,h=c/(2*n.value.maxY);let e=new Array;for(let r=0;r<2*n.value.maxX;r++)for(let i=0;i<2*n.value.maxY;i++){let t={x:r,y:i,value:n.range.min};for(let e=0;e<n.value.data.length;e++){var u=n.value.data[e];2*u.x+1==r&&2*u.y+1==i&&(t.value=u.value,u=new BABYLON.Vector3(s.boundingSphere.center.x-(a/2-l*r),o.mesh.position.y,s.boundingSphere.center.z-(c/2-h*i)),o.texts.push(this.createTempVlaue(t.value+"℃",u,n.anchor.app.scene,n.anchor.app.container)))}e.push(t)}o.displayValues=n.displayValues;let t=q.create({width:2*n.value.maxX,height:2*n.value.maxY,radius:n.radius});t.setData({min:n.range.min,max:n.range.max,data:e});let i=new BABYLON.StandardMaterial(o.id,n.anchor.app.scene);return i.diffuseTexture=new BABYLON.Texture(t.getDataURL(),n.anchor.app.scene,!1,!1),i.specularColor=new BABYLON.Color3(0,0,0),i.alpha=.5,n.isAlpha&&(i.diffuseTexture.hasAlpha=!0),n.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getMatrixParticleTex(se.rl,n.anchor.app.resources.FogTex,i.diffuseTexture,o.mesh,n.anchor.app.scene,n.isLevelRender),o.mesh.isVisible=!1),n.isLevelRender&&(o.mesh.renderingGroupId=1),o.mesh.material=i,o.mesh.alwaysSelectAsActiveMesh=!0,o.mesh.freezeWorldMatrix(),n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,o}static _getMatrixParticleTex(e,t,i,r,n,o){let s,a=t.clone(),l=r.getBoundingInfo().boundingBox;var c=(l.extendSizeWorld.x+l.extendSizeWorld.z)/9,t=1500*c*c;l.minimumWorld.subtract(new BABYLON.Vector3(-0,0,-0)),l.maximumWorld.subtract(new BABYLON.Vector3(0,0,0));s&&s.dispose(),BABYLON.GPUParticleSystem.IsSupported&&(s=new BABYLON.GPUParticleSystem("particles",{capacity:t},n),s.activeParticleCount=t,s.manualEmitCount=s.activeParticleCount,s.minEmitBox=l.minimumWorld,s.maxEmitBox=l.maximumWorld),s.particleTexture=a,s.emitter=r,o&&(s.renderingGroupId=1),s.isLocal=!0;let h=new BABYLON.NodeMaterial("nm_heatmapBox_"+r.id,n);return h.loadAsync(e+"resources/horizontalNodeMat.json").then(()=>{h.build(!1),h.getBlockByName("boxTex").texture=i,h.getBlockByName("emitXMin").value=s.minEmitBox.x,h.getBlockByName("emitXMax").value=s.maxEmitBox.x,h.getBlockByName("emitYMin").value=s.minEmitBox.z,h.getBlockByName("emitYMax").value=s.maxEmitBox.z,h.createEffectForParticles(s)}),r.onDispose=()=>{s&&s.dispose()},s.onDispose=()=>{h&&h.dispose(),a&&a.dispose()},s.color1=new BABYLON.Color4(.8,.8,.8,.1),s.color2=new BABYLON.Color4(.95,.95,.95,.15),s.colorDead=new BABYLON.Color4(.9,.9,.9,.1),s.minSize=1.4,s.maxSize=2,s.minLifeTime=Number.MAX_SAFE_INTEGER,s.emitRate=5e4*c,s.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,s.gravity=new BABYLON.Vector3(0,0,0),s.direction1=new BABYLON.Vector3(0,0,0),s.direction2=new BABYLON.Vector3(0,0,0),s.minAngularSpeed=-2,s.maxAngularSpeed=2,s.minEmitPower=.5,s.maxEmitPower=1,s.updateSpeed=.005,s.start(),s}static createPunctateCloud(r){if(r.displayValues=null!=r.displayValues&&r.displayValues,r.isAlpha=null==r.isAlpha||r.isAlpha,r.isParticle=null==r.isParticle||r.isParticle,r.radius=r.radius||1,r.isLevelRender=null==r.isLevelRender||r.isLevelRender,r.range=r.range||{max:30,min:16},!r.value&&!r.anchor)return console.error("要创建的云图数值为空!"),null;let e;r.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e=new Z(r.anchor),e.mesh=BABYLON.MeshBuilder.CreatePlane(e.id,{width:1,height:1,sideOrientation:2},r.anchor.app.scene),e.mesh.scaling=new BABYLON.Vector3(r.radius,r.radius,r.radius),e.mesh.alwaysSelectAsActiveMesh=!0,e.mesh.enablePointerMoveEvents=!1,e.mesh.isPickable=!1,e.mesh.position=r.anchor.instance.position.clone(),e.mesh.rotation.x=Math.PI/2;let n=[];for(let i=0;i<6;i++)for(let t=0;t<6;t++){let e={x:i,y:t,value:r.range.min};2==i&&2==t||3==i&&2==t||2==i&&3==t||3==i&&3==t?e.value=r.value:e.value=r.value-2*(Math.abs(2-i)+Math.abs(2-t)),n.push(e)}e.displayValues=r.displayValues;let t=q.create({width:5,height:5,radius:2});t.setData({min:r.range.min,max:r.range.max,data:n});let i=new BABYLON.StandardMaterial(e.id,r.anchor.app.scene);return i.diffuseTexture=new BABYLON.Texture(t.getDataURL(),r.anchor.app.scene,!1,!1),i.specularColor=new BABYLON.Color3(0,0,0),i.alpha=.5,r.isAlpha&&(i.diffuseTexture.hasAlpha=!0),r.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getColumnarParticleTex(i.diffuseTexture,e.mesh,r.anchor.app.scene,e.anchor.app.resources.FogTex,r.isLevelRender),e.mesh.isVisible=!1),r.isLevelRender&&(e.mesh.renderingGroupId=1),e.mesh.material=i,e.mesh.alwaysSelectAsActiveMesh=!0,e.mesh.freezeWorldMatrix(),r.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,e}static createColumnCloud(n){if(n.displayValues=null!=n.displayValues&&n.displayValues,n.isAlpha=null==n.isAlpha||n.isAlpha,n.isParticle=null==n.isParticle||n.isParticle,n.radius=n.radius||4,n.isLevelRender=null==n.isLevelRender||n.isLevelRender,n.range=n.range||{max:30,min:16},!n.data&&n.data.length<1&&!n.anchor)return console.error("要创建的云图数值为空!"),null;let i;n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,i=new Z(n.anchor);var r=.98*n.anchor.instance.scaling.y;i.mesh=BABYLON.MeshBuilder.CreatePlane(i.id,{width:.98*n.anchor.instance.scaling.x,height:r,sideOrientation:2},n.anchor.app.scene),i.mesh.alwaysSelectAsActiveMesh=!0,i.mesh.enablePointerMoveEvents=!1,i.mesh.isPickable=!1,i.mesh.position=n.anchor.instance.position.clone(),i.mesh.rotation.z=Math.PI,i.mesh.rotation.y=n.anchor.instance.rotation.y,n.isLevelRender&&(i.mesh.renderingGroupId=1);let e=[];for(let r=0;r<4;r++)for(let i=0;i<3*n.data.length;i++){let t={x:r,y:i,value:n.range.min};for(let e=0;e<n.data.length;e++){var o=n.data[e];2==r&&3*e+2==i&&(t.value=o.value)}e.push(t)}var s=r/n.data.length;for(let t=0;t<n.data.length;t++){let e=i.mesh.position.clone();e.y=e.y-r/2+(r-s*t-s/2),i.texts.push(this.createTempVlaue(n.data[t].value+"℃",e,n.anchor.app.scene,i.anchor.app.container))}i.displayValues=n.displayValues;let t=q.create({width:4,height:3*n.data.length,radius:n.radius});t.setData({min:n.range.min,max:n.range.max,data:e});let a=new BABYLON.StandardMaterial(i.id,n.anchor.app.scene);return a.diffuseTexture=new BABYLON.Texture(t.getDataURL(),n.anchor.app.scene,!1,!1),a.specularColor=new BABYLON.Color3(0,0,0),a.alpha=.5,n.isAlpha&&(a.diffuseTexture.hasAlpha=!0),n.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getColumnarParticleTex(a.diffuseTexture,i.mesh,n.anchor.app.scene,i.anchor.app.resources.FogTex,n.isLevelRender),i.mesh.isVisible=!1),i.mesh.material=a,i.mesh.alwaysSelectAsActiveMesh=!0,i.mesh.freezeWorldMatrix(),n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,i}static _getColumnarParticleTex(e,t,i,r,n){let o,s=r.clone();r=t.getBoundingInfo().boundingBox,r.extendSizeWorld.x,r.extendSizeWorld.z;BABYLON.Effect.ShadersStore.particlesVertexShader=`
25
+ `),r.freeze()}return r}delete(e=!1){if(this.BOX&&this.BOX.dispose(),this.transparentBox&&this.transparentBox.dispose(!0,!0),this.BOX=null,this.transparentBox=null,e){for(const t in this.resources.map)this.resources.find(t).removeAllFromScene(),this.resources.remove(t);this.resources.clear()}}async GetWalls(e,t){let i=await BABYLON.SceneLoader.LoadAssetContainerAsync(e,t+".gltf",this.app.scene);if(i.meshes){var r=i.meshes[0].getChildMeshes();for(let e=0;e<r.length;e++)this.walls.add(r[e].id,r[e])}}setTransparent(t=1){for(const i in this.resources.map){let e=this.resources.find(i);e.meshes.forEach(e=>e.visibility=t)}}}var t=i(3),v=i.n(t),t=i(29);const b=i.n(t).a.create();b.defaults.headers.post["Content-Type"]="application/json",b.interceptors.request.use(e=>{var t=localStorage.getItem("mx3d-token");return t&&(e.headers.Authorization="Bearer "+t),e},e=>Promise.reject(e)),b.interceptors.response.use(e=>e,e=>{if(e.response)switch(e.response.status){case 401:console.error("开发者授权码异常");break;case 403:console.error("当前用户没有权限");break;case 400:console.error(e.response.data.message)}return Promise.reject(e)});var w,T,A=b,t=i(4),E=i.n(t);(t=w=w||{}).leftClick="leftClick",t.rightClick="rightClick",t.doubleClick="doubleClick",t.eover="eover",t.longPress="longPress",t.out="out",t.click="click";class M{constructor(e){this.app=e}getInto(){}goBack(){}loadProperties(e){this.id="墙角_"+a.getGUID(12),this.name="墙角",this.parentId=e.parentId,this.customNumber=this.id,this.customType=this.objectType,this.height=e.height,this.objectType=f.Corner,this.pints=e.corners}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}optimization(t){this.instance.getChildMeshes().forEach(e=>{t?e.freezeWorldMatrix():e.unfreezeWorldMatrix()}),t?this.instance.freezeWorldMatrix():this.instance.unfreezeWorldMatrix(),this.instance.material&&(t?this.instance.material.freeze():this.instance.material.unfreeze())}setFlash(e){}setTransparent(){}setOpaque(){}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e,t){}removeEventListener(e){}computeView(){}bind(){let i=new Array;for(let t=0;t<this.pints.length;t++)if(2<this.pints[t].pints.length){let e=BABYLON.MeshBuilder.CreatePolygon(this.id,{shape:this.pints[t].pints,sideOrientation:BABYLON.Mesh.FRONTSIDE},this.app.scene);e.setEnabled(!1),e.position.y=this.pints[t].height,e.isPickable=!0,e.enablePointerMoveEvents=!1,i.push(e)}return!(i.length<1)&&(1<i.length?this.instance=p.MergeMeshes(i,this.app):this.instance=i[0],this.instance.id=this.id,this.instance.name=this.id,this.instance.position.y=this.height,this.instance.setEnabled(!1),this.instance.isPickable=!1,!(this.instance.enablePointerMoveEvents=!1))}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType}}completed(){this.alwaysActive(),this.optimization(!0)}}class S{static init(){let e=new v.a.Tween(this.colors[1]).to({r:1,g:0,b:0},500),t=new v.a.Tween(this.colors[1]).to({r:1,g:.5,b:.5},500);t.chain(e),e.chain(t),e.start();let i=new v.a.Tween(this.colors[2]).to({r:1,g:.55,b:0},500),r=new v.a.Tween(this.colors[2]).to({r:0,g:0,b:0},500);i.chain(r),r.chain(i),i.start();let n=new v.a.Tween(this.colors[3]).to({r:1,g:.84,b:0},500),o=new v.a.Tween(this.colors[3]).to({r:0,g:0,b:0},500);n.chain(o),o.chain(n),n.start();let s=new v.a.Tween(this.colors[4]).to({r:0,g:.75,b:1},500),a=new v.a.Tween(this.colors[4]).to({r:0,g:0,b:0},500);s.chain(a),a.chain(s),s.start();let l=new v.a.Tween(this.colors[5]).to({r:.53,g:.8,b:0},500),c=new v.a.Tween(this.colors[5]).to({r:0,g:0,b:0},500);l.chain(c),c.chain(l),l.start();let h=new v.a.Tween(this.colors[6]).to({r:.8,g:.8,b:.8},500),u=new v.a.Tween(this.colors[6]).to({r:0,g:0,b:0},500);h.chain(u),u.chain(h),h.start()}}S.colors={1:BABYLON.Color3.Red(),2:new BABYLON.Color3(1,.5,0),3:BABYLON.Color3.Yellow(),4:new BABYLON.Color3(0,1,1),5:BABYLON.Color3.Green(),6:BABYLON.Color3.Gray()},(t=T=T||{})[t.Opaque=0]="Opaque",t[t.Flash=1]="Flash",t[t.Transparent=2]="Transparent";class C{toJosn(e){e=JSON.parse(e);this.alpha=e.alpha,this.beta=e.beta,this.radius=e.radius,this.minimumLimit=e.minimumLimit,this.maximumLimit=e.maximumLimit,this.minBeta=e.minBeta,this.maxBeta=e.maxBeta,this.focus=p.ToVector3(e.focus)}toString(){return JSON.stringify({alpha:this.alpha,focus:p.vector3ToJson(this.focus),radius:this.radius,beta:this.beta,minimumLimit:this.minimumLimit,maximumLimit:this.maximumLimit,minBeta:this.minBeta,maxBeta:this.maxBeta})}setLimit(e,t){this.minimumLimit=e+.3,this.maximumLimit=t}setBeta(e,t){this.minBeta=e,this.maxBeta=t}}class I{constructor(e){this.executes=new d,this.clickEvents=new d,this.touchtime=(new Date).getTime(),this.statusType=T.Opaque,this.app=e}loadProperties(e){this.id=e.id,this.customNumber=e.customNumber,this.parentId=e.parentId,this.name=e.name,this.baseModel=e.baseModel,this.isLoop=e.isLoop,this.objectType=e.objectType,this.customType=e.customType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.scaling=p.ToVector3(e.scaling)}setEnabled(e){if(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>e.dispose()),e){let t=new BABYLON.Mesh(this.id,this.app.scene),e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e=e.createInstance(this.id);e.isPickable=!1,e.enablePointerMoveEvents=!1,e.parent=t}),t.rotation=p.ToVector3(this.rotation.clone()),t.position=p.ToVector3(this.position.clone()),t.scaling=p.ToVector3(this.scaling.clone()),this.instance.addChild(t),this.alwaysActive(),this.optimization(!0)}this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}set showBoundingBox(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.showBoundingBox=e,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}get showBoundingBox(){return this.instance.showBoundingBox}bind(){var e=this.app.resources.resources.find(this.baseModel.modelId),e=p.computeBounds(e.meshes[0]);this.instance=this.app.resources.BOX.clone(this.id),this.instance.setBoundingInfo(e),this.instance.id=this.id,this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.scaling=new BABYLON.Vector3((e.maximum.x-e.minimum.x)*this.scaling.x,(e.maximum.y-e.minimum.y)*this.scaling.y,(e.maximum.z-e.minimum.z)*this.scaling.z),0==this.instance.scaling.y&&(this.instance.scaling.y=.01),this.instance.position=p.ToVector3(this.position.clone()),this.instance.position=p.ToVector3(this.position.clone()),this.instance.position.y=(e.maximum.y-e.minimum.y)/2+this.position.y,this.instance.rotation=p.ToVector3(this.rotation.clone()),this.instance.setEnabled(!1),this.completed()}completed(){this.alwaysActive(),this.optimization(!0),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.focus=this.instance.getAbsolutePosition(),this.Sight.radius=e.boundingSphere.radiusWorld+3,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}optimization(t){this.instance.getChildMeshes().forEach(e=>{t?e.freezeWorldMatrix():e.unfreezeWorldMatrix()}),t?this.instance.freezeWorldMatrix():this.instance.unfreezeWorldMatrix(),this.instance.material&&(t?this.instance.material.freeze():this.instance.material.unfreeze())}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e),this.touchtime=(new Date).getTime()}),e=w.click):e==w.doubleClick?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger,e=>t(this,e)):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e=w.click}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setFlash(t){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>{e.instancedBuffers&&(e.instancedBuffers.color=S.colors[t])}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Flash)}setOpaque(){this.statusType!=T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>{e.setEnabled(!0),e.instancedBuffers&&(e.instancedBuffers.color=new BABYLON.Color4(1,1,1,1))}),this.instance.disableEdgesRendering(),this.instance.visibility=0,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Opaque)}setTransparent(e=.3){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(e=>e.setEnabled(!1)),this.instance.visibility=e,this.instance.enableEdgesRendering(),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Transparent)}play(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(t=>{let i;t.animations.forEach(e=>{-1!=e.name.indexOf("open")&&(i=e)}),i?this.app.scene.beginDirectAnimation(t,[i],0,10*i.getKeys().length,this.isLoop):t.animations.forEach(e=>this.app.scene.beginDirectAnimation(t,[e],0,10*e.getKeys().length,this.isLoop))}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}stop(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.getChildMeshes().forEach(t=>{let i;t.animations.forEach(e=>{-1!=e.name.indexOf("close")&&(i=e)}),i?this.app.scene.beginDirectAnimation(t,[i],0,10*i.getKeys().length,!1):t.animations.forEach(e=>this.app.scene.beginDirectAnimation(t,[e],10*e.getKeys().length,0,!1))}),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType}}getInto(){this.app.cameraController.flyTo(this.Sight)}goBack(){}}class B extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.objectType=f.Floor,this.vectors=e.vectors,this.buckles=e.buckles,this.height=e.height}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=BABYLON.MeshBuilder.CreatePolygon("地板",{shape:p.Expand(this.vectors,-.01),holes:this.buckles,sideOrientation:BABYLON.Mesh.DOUBLESIDE},this.app.scene),this.instance.setEnabled(!1),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,this.instance.position.y=this.height-.01,this.instance.id=this.id,this.instance.name="地板";var e=this.app.resources.GetMaterial(this.baseModel,this.app.scene).clone(this.id),t=this.instance.getBoundingInfo();this.Sight=p.getVisualAngle(t,this.app),this.baseModel.isTiling&&(e.diffuseTexture.uScale=(t.maximum.x-t.minimum.x)/this.baseModel.width,e.diffuseTexture.vScale=(t.maximum.z-t.minimum.z)/this.baseModel.length),this.instance.material=e,this.completed()}}class z extends I{loadProperties(e){this.id="墙_"+a.getGUID(12),this.objectType=f.Wall,this.parentId=e.parentId,this.name="墙体",this.customNumber=this.id,this.customType=this.objectType,this.walls=e.walls,this.height=e.height,this.baseModel=e.baseModel,this.baseModel&&!this.baseModel.length&&(this.baseModel.length=3.1)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=se.Tools.MergeMeshes(this.walls,this.app),this.instance.setEnabled(!1),this.instance.receiveShadows=!0,this.baseModel?this.nativeMaterial=this.app.resources.GetMergeMaterial(this.baseModel,this.app.scene):this.nativeMaterial=null,this.instance.material=this.nativeMaterial,this.instance.id=this.id,this.instance.name=this.id,this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,this.instance.position.y+=this.height,this.completed()}completed(){this.alwaysActive(),this.optimization(!0)}}class k{constructor(e){this.executes=new d,this.clickEvents=new d,this.touchtime=(new Date).getTime(),this.app=e}loadProperties(e){}bind(){}completed(){this.computeView()}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e),this.touchtime=(new Date).getTime()}),e=w.click):e==w.doubleClick?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger,e=>t(this,e)):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e=w.click}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}load(e,n){let s=new Array;for(let t=0;t<n.length;t++){let e=n[t];e.objectType==f.Wall&&(e.height||(e.height=3.1),e.ply||(e.ply=.09),s.push(e))}let o=new d;for(let e=0;e<n.length;e++){let i=n[e];i.objectType==f.Corner&&(o.add(i.id,i.corner),2<i.pints.length&&(i.height=3.1,i.walls.forEach(t=>{s.forEach(e=>{t==e.id&&parseFloat(e.height)<i.height&&(i.height=parseFloat(e.height))})})))}if(!e){let t=new Array;for(let e=0;e<n.length;e++){var i=n[e];i.objectType==f.Corner&&t.push(i)}let e=new M(this.app);e.loadProperties({parentId:this.id,height:this.position.y,corners:t}),e.bind()?this.app.project.objectDatas.add(e.id,e):e=null}for(let i=0;i<n.length;i++){let r=n[i];if(r.objectType==f.Floor){r.vectors=new Array;let e=n[i];e.pints.forEach(e=>{o.find(e)||console.log(e),r.vectors.push(o.find(e))}),r.buckles=new Array,e.holes&&e.holes.forEach(e=>{let t=new Array;e.forEach(e=>t.push(o.find(e))),r.buckles.push(t)}),e.middles&&e.middles.forEach(t=>{let i=Array();for(let e=0;e<n.length;e++)n[e].id==t&&n[e].pints.forEach(e=>{e=o.find(e);i.push(new BABYLON.Vector3(e.x,0,e.z))});r.buckles.push(i)}),r.height=this.position.y;let t=new B(this.app);t.loadProperties(r),t.bind(),this.app.project.objectDatas.add(t.id,t)}}if(o=null,!e){let o=new d;o.add("body",{t:"",walls:new Array});for(let n=0;n<s.length;n++){let r=BABYLON.MeshBuilder.ExtrudePolygon(s[n].id,{shape:[p.ToVector3(s[n].wtop),p.ToVector3(s[n].wleft),p.ToVector3(s[n].wbottom),p.ToVector3(s[n].wright)],depth:parseFloat(s[n].height),sideOrientation:BABYLON.Mesh.FRONTSIDE},this.app.scene);r.setEnabled(!1),r.position.y=parseFloat(s[n].height),r.subMeshes=[];var a=r.getTotalVertices();r.subMeshes.push(new BABYLON.SubMesh(0,0,a,0,6,r)),r.subMeshes.push(new BABYLON.SubMesh(0,1,a,18,6,r)),r.subMeshes.push(new BABYLON.SubMesh(0,2,a,30,6,r));for(let i=0;i<s[n].wallwindows.length;i++){const u=BABYLON.CSG.FromMesh(r);let e=this.app.project.objectDatas.find(s[n].wallwindows[i]);var l=e.instance.getBoundingInfo(),c=BABYLON.MeshBuilder.CreateBox((new Date).getTime().toString(),{height:l.maximum.y-l.minimum.y,width:l.maximum.x-l.minimum.x,depth:2*parseFloat(s[n].ply)+.1},this.app.scene);c.position=e.instance.position.clone(),c.position.y=(l.maximum.y-l.minimum.y)/2+e.height,c.rotation=e.instance.rotation.clone();l=BABYLON.CSG.FromMesh(c);let t=u.subtract(l);c.dispose(),r.dispose(),r=t.toMesh(s[n].id,null,this.app.scene,!0),r.setEnabled(!1)}let t=o.find(s[n].leftMap.modelId);t||(t={t:s[n].leftMap,walls:new Array},o.add(s[n].leftMap.modelId,t));let i=o.find(s[n].rightMap.modelId);i||(i={t:s[n].rightMap,walls:new Array},o.add(s[n].rightMap.modelId,i));var h=p.DeconsTructMesh(r,parseFloat(s[n].height),this.app);for(let e=0;e<h.length;e++)(2==e||3==e?t:4==e||5==e?i:o.find("body")).walls.push(h[e])}for(const r in o.map){var t=o.find(r);if(0<t.walls.length){let e=new z(this.app);e.loadProperties({baseModel:t.t,walls:t.walls,parentId:this.id,height:this.position.y}),e.bind(),this.app.project.objectDatas.add(e.id,e)}}}this.completed(),s=null}toJson(){return{id:this.id,parentId:this.parentId,name:this.name,customNumber:this.customNumber,customType:this.customType,objectType:this.objectType,index:this.index,layerHeight:this.layerHeight,layerName:this.layerName}}computeView(){var i,r;let n=this.app.project.getChildsById(this.id);0<n.length&&(i=r=n[0].instance.position.clone());for(let e=0;e<n.length;e++){let t=n[e];if(t.objectType!=f.Storey&&t.objectType!=f.Campus){let e=t.instance.getBoundingInfo();i=BABYLON.Vector3.Minimize(i,e.minimum.add(t.instance.position)),r=BABYLON.Vector3.Maximize(r,e.maximum.add(t.instance.position))}}i&&r||(i=BABYLON.Vector3.Zero(),r=new BABYLON.Vector3(12,0,8)),this.Sight=p.getVisualAngle(new BABYLON.BoundingInfo(i,r),this.app)}getInto(){for(var t in this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.app.project.objectDatas.map){let e=this.app.project.objectDatas.find(t);e.setEnabled(e.parentId==this.id)}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}goBack(){}}class P extends k{loadProperties(e){this.id=e.id,this.name=e.name,this.parentId=e.parentId,this.index=e.index,this.layerName=this.index<0?"B"+this.index:"F"+(this.index+1),this.layerHeight=e.layerHeight,this.objectType=e.objectType,this.customNumber=e.customNumber||e.id,this.customType=e.customType||this.objectType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.scaling=p.ToVector3(e.scaling)}bind(){this.instance=BABYLON.MeshBuilder.CreateGround(this.id,{width:this.scaling.x,height:this.scaling.z},this.app.scene),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!0;let e=new BABYLON.StandardMaterial("mat_"+this.id);e.diffuseColor=BABYLON.Color3.White(),e.alpha=.3,e.backFaceCulling=!1,this.instance.material=e,this.instance.position=this.position,this.instance.position.y-=.01,this.instance.rotation=this.rotation.clone(),this.setEnabled(!1)}alwaysActive(){this.instance.getChildMeshes().forEach(e=>{e.alwaysSelectAsActiveMesh=!0,e.doNotSyncBoundingInfo=!1,e.ignoreNonUniformScaling=!0}),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.doNotSyncBoundingInfo=!1}completed(){this.alwaysActive(),this.computeView()}computeView(){var i,r;let n=this.app.project.getChildsById(this.id);0<n.length&&(i=r=n[0].instance.position.clone());for(let e=0;e<n.length;e++){let t=n[e];if(t.objectType!=f.Storey&&t.objectType!=f.Campus&&t.objectType!=f.Wall&&t.objectType!=f.Corner){let e=t.instance.getBoundingInfo();i=BABYLON.Vector3.Minimize(i,e.minimum.add(t.instance.position)),r=BABYLON.Vector3.Maximize(r,e.maximum.add(t.instance.position))}}i&&r||(i=BABYLON.Vector3.Zero(),r=new BABYLON.Vector3(12,0,8)),this.Sight=p.getVisualAngle(new BABYLON.BoundingInfo(i,r),this.app)}}class L extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.objectType=f.LeakWater,this.lines=p.ToARRVector3(e.lines)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=p.createTube(this.id,this.lines,.02,this.app),this.instance.setEnabled(!1);var e=this.app.resources.GetMaterial(this.baseModel,this.app.scene).clone(this.id);BABYLON.Animation.CreateAndStartAnimation("u",e.diffuseTexture,"vOffset",15,30,0,1,1),e.diffuseTexture.vScale=this.instance.getTotalVertices()/50,this.instance.material=e,this.completed()}completed(){this.alwaysActive(),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.radius=e.boundingSphere.radiusWorld+3,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}addEventListener(e,t){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let i=null;var r;e==w.leftClick||e==w.rightClick||e==w.doubleClick?(this.clickEvents.remove(e),this.clickEvents.add(e,t),this.instance.isPickable=!0,i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>{let t=this.clickEvents.find(w.leftClick);t&&0==e.sourceEvent.button&&t(this,e);let i=this.clickEvents.find(w.rightClick);i&&2==e.sourceEvent.button&&i(this,e);let r=this.clickEvents.find(w.doubleClick);r&&0==e.sourceEvent.button&&(new Date).getTime()-this.touchtime<500&&r(this,e),this.touchtime=(new Date).getTime()}),e="click"):e==w.eover?(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0):e==w.longPress?i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger,e=>t(this,e)):e==w.out&&(i=new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,e=>t(this,e)),this.instance.enablePointerMoveEvents=!0),i&&(this.action||(this.action=new BABYLON.ActionManager(this.app.scene),this.instance.actionManager=this.action),(r=this.executes.find(e))&&this.action.unregisterAction(r),this.executes.remove(e),this.executes.add(e,i),this.action.registerAction(i)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}removeEventListener(e){if(e==w.leftClick||e==w.rightClick||e==w.doubleClick){if(this.clickEvents.remove(e),0<this.clickEvents.count())return;e="click"}this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;var t=this.executes.find(e);t&&this.action.unregisterAction(t),this.executes.remove(e),0==this.executes.count()&&(this.action=null,this.instance.actionManager=this.action,this.instance.getChildMeshes().forEach(e=>e.actionManager=this.action)),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class D extends I{loadProperties(e){this.id=e.id,this.customNumber=e.customNumber,this.parentId=e.parentId,this.name=e.name,this.radius=e.radius,this.pints=p.ToARRVector3(e.pints),this.objectType=e.objectType,this.customType=e.customType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation),this.color=e.color,this.alpha=e.alpha}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id);let e=p.createTube(this.id,this.pints,this.radius,this.app);this.instance.position=e.getBoundingInfo().boundingBox.center.clone(),this.instance.addChild(e),this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),e.setParent(this.instance.parent),this.instance.dispose(),this.instance=e;let t=new BABYLON.StandardMaterial("mat_"+this.id,this.app.scene);t.diffuseColor=BABYLON.Color3.FromHexString(this.color),t.alpha=this.alpha,this.instance.material=t,this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.setEnabled(!1),this.completed()}setColor(e,t,i){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.diffuseColor=new BABYLON.Color3(e/255,i/255,t/255),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}reColor(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.diffuseColor=BABYLON.Color3.FromHexString(this.color),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),e=p.getVisualAngle(e,this.app);this.alpha=e.alpha,this.Sight.beta=e.beta,this.Sight.focus=e.focus,this.Sight.radius=e.radius,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=2*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}setFlash(e=1){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.emissiveColor=S.colors[e],this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Flash)}setOpaque(){this.statusType!=T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!0),this.instance.material.alpha=this.alpha,this.instance.material.emissiveColor=null,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Opaque)}setTransparent(e=.3){this.statusType==T.Opaque&&(this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.optimization(!1),this.instance.material.alpha=e,this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,this.statusType=T.Transparent)}}class R extends I{setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}loadProperties(e){var t,i;this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.objectType=f.UI3D,this.tconfig.color=e.color,e.size?(this.tconfig.clearColor=null,this.tconfig.position=se.Tools.ToVector3(e.position),i=se.Tools.ToVector3(e.rotation),this.tconfig.rotation=new BABYLON.Vector3(i.x+Math.PI,i.y,i.z),t=Number.parseInt(e.size.replace("px",""))/40,i=e.scaling?se.Tools.ToVector3(e.scaling):BABYLON.Vector3.One(),this.tconfig.scaling=new BABYLON.Vector3(14*t/50*i.x,1,14*t/50*i.z)):(this.tconfig.clearColor=e.clearColor,this.tconfig.position=se.Tools.ToVector3(e.position),this.tconfig.rotation=se.Tools.ToVector3(e.rotation),this.tconfig.scaling=se.Tools.ToVector3(e.scaling))}bind(){var e="bold 100px Arial";let t=new BABYLON.DynamicTexture(this.id,64,this.app.scene,!1);var i=t.getContext();i.font=e;var r=i.measureText(this.name).width+8,i=.02*r;t=new BABYLON.DynamicTexture(this.id,{width:r,height:150},this.app.scene,!1);r=new BABYLON.StandardMaterial(this.id,this.app.scene);r.backFaceCulling=!1,r.diffuseTexture=t,this.tconfig.clearColor||(t.hasAlpha=!0),t.drawText(this.name,null,null,e,this.tconfig.color,this.tconfig.clearColor,!1),this.instance=BABYLON.Mesh.CreateGround(this.id,i,3,1,this.app.scene),this.instance.setEnabled(!1),this.instance.scaling=this.tconfig.scaling,this.instance.position=this.tconfig.position,this.instance.rotation=this.tconfig.rotation,this.instance.material=r,this.completed()}}class O extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.objectType=f.VirtualBox,this.virtualType=e.virtualType,this.color=BABYLON.Color3.FromHexString(e.color),this.alpha=e.alpha,this.isEdges=e.isEdges,this.edgesWidth=e.edgesWidth,this.edgesColor=BABYLON.Color3.FromHexString(e.edgesColor).toColor4(1),this.rotation=se.Tools.ToVector3(e.rotation),this.position=se.Tools.ToVector3(e.position),this.scaling=se.Tools.ToVector3(e.scaling)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){"Cylinder"==this.virtualType?this.instance=BABYLON.MeshBuilder.CreateCylinder(this.id,{height:1,diameterTop:1,diameterBottom:1},this.app.scene):this.instance=BABYLON.MeshBuilder.CreateBox(this.id,{size:1},this.app.scene),this.instance.setEnabled(!1),this.instance.id=this.id;let e=new BABYLON.StandardMaterial(this.id,this.app.scene);e.diffuseColor=this.color,this.alpha<.98&&(e.alpha=this.alpha,e.alphaMode=2,e.useAlphaFromDiffuseTexture=!0),this.instance.material=e,this.isEdges&&(this.instance.enableEdgesRendering(),this.instance.edgesWidth=1,this.instance.edgesColor=new BABYLON.Color4(0,1,1,1)),this.edgesWidth&&0<this.edgesWidth&&(this.instance.enableEdgesRendering(),this.instance.edgesWidth=this.edgesWidth,this.instance.edgesColor=this.edgesColor),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),this.instance.scaling=this.scaling.clone(),this.completed()}}class F extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.height=e.baseModel.height,this.objectType=f.Door,this.rotation=p.ToVector3(e.rotation),this.position=p.ToVector3(e.position)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene);let e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e.createInstance(this.id).parent=this.instance});var t=p.computeBounds(this.instance);this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone();let i=this.app.resources.BOX.createInstance(this.id);i.setBoundingInfo(t),i.enablePointerMoveEvents=!1,i.isPickable=!1,i.scaling=new BABYLON.Vector3((t.maximum.x-t.minimum.x)*this.instance.scaling.x,(t.maximum.y-t.minimum.y)*this.instance.scaling.y,(t.maximum.z-t.minimum.z)*this.instance.scaling.z),i.position=this.instance.position.clone(),i.position.y=(t.maximum.y-t.minimum.y)/2+this.instance.position.y,i.rotation=this.instance.rotation.clone(),this.instance.getChildMeshes().forEach(e=>e.setParent(i)),this.instance.dispose(),this.instance=i,this.instance.setEnabled(!1),this.completed()}}class N extends I{loadProperties(e){this.id=e.id,this.name=e.name,this.customNumber=e.customNumber,this.customType=e.customType,this.parentId=e.parentId,this.baseModel=e.baseModel,this.height=e.baseModel.height,this.objectType=f.Window,this.rotation=p.ToVector3(e.rotation),this.position=p.ToVector3(e.position)}setEnabled(e){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),e?(this.instance.isPickable=0<this.executes.count(),this.executes.find(w.eover)||this.executes.find(w.out)?this.instance.enablePointerMoveEvents=!0:this.instance.enablePointerMoveEvents=!1):(this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene);let e=this.app.resources.resources.find(this.baseModel.modelId);e.meshes[0].getChildMeshes().forEach(e=>{e.createInstance(this.id).parent=this.instance});var t=p.computeBounds(this.instance);this.instance.rotation=this.rotation.clone(),this.instance.position=this.position.clone(),this.Sight=p.getVisualAngle(t,this.app);let i=this.app.resources.BOX.createInstance(this.id);i.setBoundingInfo(t),i.enablePointerMoveEvents=!1,i.isPickable=!1,i.scaling=new BABYLON.Vector3((t.maximum.x-t.minimum.x)*this.instance.scaling.x,(t.maximum.y-t.minimum.y)*this.instance.scaling.y,(t.maximum.z-t.minimum.z)*this.instance.scaling.z),i.position=this.instance.position.clone(),i.position.y=(t.maximum.y-t.minimum.y)/2+this.instance.position.y,i.rotation=this.instance.rotation.clone(),this.instance.getChildMeshes().forEach(e=>e.setParent(i)),this.instance.dispose(),this.instance=i,this.instance.setEnabled(!1),this.completed()}}class U extends I{completed(){this.alwaysActive(),this.optimization(!0),this.computeView()}computeView(){this.Sight=new C;var e=this.instance.getBoundingInfo(),t=p.getVisualAngle(e,this.app);this.Sight.alpha=t.alpha,this.Sight.beta=t.beta,this.Sight.focus=this.instance.position.clone(),this.Sight.radius=1.5*e.boundingSphere.radiusWorld,this.Sight.minimumLimit=.3,this.Sight.maximumLimit=3*this.Sight.radius,this.Sight.minBeta=.01,this.Sight.maxBeta=Math.PI/2*.98}getInto(){this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.app.resources.setTransparent(.2);let n=new d,e=this.app.project.getChildsById(this.id);e.forEach(e=>{let t=!0;var i=this.app.project.getChildsById(e.id);for(let e=0;e<i.length;e++){var r=i[e];(r instanceof z||r instanceof F||r instanceof M||r instanceof N||r instanceof B)&&(n.add(r.id,r.id),t=!1)}n.add(e.id,e.id),e instanceof P&&(t||e.addEventListener(w.leftClick,()=>{this.app.resources.setTransparent(),this.app.project.switchLevel(e.id)}),e.addEventListener(w.eover,()=>{this.app.toolTips.text=e.layerName}),e.addEventListener(w.out,()=>{this.app.toolTips.text=""}))});for(const t in this.app.project.objectDatas.map){let e=this.app.project.objectDatas.find(t);n.find(e.id)||e.parentId==this.parentId?e.setEnabled(!0):e.setEnabled(!1)}this.setEnabled(!1),this.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}goBack(){this.app.resources.setTransparent()}}class j extends k{addEventListener(e,t){}removeEventListener(e){}setEnabled(e){this.instance.setEnabled(e)}loadProperties(e){this.id=e.id,this.name=e.name,this.parentId=e.parentId,this.index=e.index,this.layerName=this.index<0?"B"+this.index:"F"+(this.index+1),this.layerHeight=e.layerHeight,this.objectType=e.objectType,this.customNumber=e.customNumber||e.id,this.customType=e.customType||this.objectType,this.position=p.ToVector3(e.position),this.rotation=p.ToVector3(e.rotation)}bind(){this.instance=new BABYLON.Mesh(this.id,this.app.scene),this.instance.enablePointerMoveEvents=!1,this.instance.isPickable=!1,this.instance.position=this.position,this.instance.position.y-=.01,this.instance.rotation=this.rotation.clone(),this.setEnabled(!1)}}class V{constructor(e,t){this.textDics=new Array,this.id=e,this.scene=t}set background(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._background&&this._background.dispose(),this._background=new BABYLON.GUI.Image(a.getGUID(12)+"_Image",e),this._background.width=this.size.width+"px",this._background.height=this.size.height+"px",this.rect.addControl(this._background),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e?(this._background.isPointerBlocker=!1,this._background.onPointerClickObservable.add(()=>{e(this.id)})):this._background.onPointerClickObservable.clear(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setTexts(i){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.textDics.forEach(e=>e.dispose());for(let t=this.textDics.length=0;t<i.length;t++){let e=new BABYLON.GUI.TextBlock;e.text=i[t].text,e.fontSize=i[t].fontSize||"20px",e.color=i[t].color||"white",e.top=i[t].top||0,e.left=i[t].left||0,this.rect.addControl(e),this.textDics.push(e)}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}line(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._line&&this._line.dispose(),this._line=new BABYLON.GUI.Line,this._line.lineWidth=e.width||1.5,this._line.color=e.color||"green",this._line.y2=this.size.height/2,this.container.addControl(this._line),this._line.linkWithMesh(this.pint),this._line.connectedControl=this.rect,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&this.rect.dispose(),this._line&&this._line.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&(this.rect.isVisible=e),this._line&&(this._line.isVisible=e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class G{constructor(e,t,i,r,n,o){this.id=e,this.scene=o,this.url=i,this.scaling=r,this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance=BABYLON.Mesh.CreatePlane(this.id,r,this.scene,!0,BABYLON.Mesh.DOUBLESIDE),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.position=t.clone(),this.instance.position.y+=n,this.instance.billboardMode=BABYLON.Mesh.BILLBOARDMODE_Y;let s=new BABYLON.StandardMaterial("Mat_"+this.id,this.scene);s.diffuseColor=BABYLON.Color3.White(),s.emissiveColor=BABYLON.Color3.White(),this.instance.material=s,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setBackground(){let i=new Image;i.src=this.url,i.onload=()=>{this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.scaling.y=this.scaling/(i.width/i.height)/this.scaling;let e=new BABYLON.DynamicTexture(this.id,{width:i.width,height:i.height},this.scene,!1);e.hasAlpha=!0,this.instance.material.diffuseTexture=e;let t=e.getContext();t.drawImage(i,0,0),e.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}addEventListener(t){if(this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.actionManager&&this.instance.actionManager.dispose(),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,t){this.instance.isPickable=!0,this.instance.enablePointerMoveEvents=!0;let e=new BABYLON.ActionManager(this.scene);e.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>t(this.id))),this.instance.actionManager=e}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setColor(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.material.diffuseColor=BABYLON.Color3.FromHexString(e),this.instance.material.emissiveColor=BABYLON.Color3.FromHexString(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setContents(i){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let r=new Image;r.src=this.url,r.onload=()=>{this.instance.scaling.y=this.scaling/(r.width/r.height)/this.scaling;let t=new BABYLON.DynamicTexture(this.id,{width:r.width,height:r.height},this.scene,!1);t.hasAlpha=!0,this.instance.material.diffuseTexture=t;let e=t.getContext();e.drawImage(r,0,0),i.forEach(e=>t.drawText(e.text,e.left,e.top,"bold "+e.fontSize+" monospace",e.color||"#fffffb","",!0,!0)),t.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class Y{constructor(e,t){this.anchor=e,this.ratio=t}dispose(){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose(),this.textMesh&&this.textMesh.dispose(),this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class Z{constructor(e){this.displayValue=!1,this.anchor=e,this.id=a.getGUID(12),this.texts=new Array}isEnabled(t){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh.setEnabled(t),this.texts.forEach(e=>e.isVisible=!!t&&this.displayValue),this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}set displayValues(t){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.texts.forEach(e=>e.isVisible=t),this.displayValue=t,this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose();for(let e=0;e<this.texts.length;e++)this.texts[e].linkedMesh&&this.texts[e].linkedMesh.dispose(),this.texts[e].dispose();this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var q=i(12);class ${constructor(){this.color="#00ff00",this.width=1}update(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose();let t=[];this.objs.forEach(e=>t.push(e.instance.getAbsolutePosition().clone())),this.instance=p.createTube(this.id,t,this.width/100,this.objs[0].app);let e=new BABYLON.StandardMaterial("mat_"+this.id,this.objs[0].app.scene);e.diffuseColor=BABYLON.Color3.FromHexString(this.color),this.instance.material=e,this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(t){if(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.actionManager&&this.instance.actionManager.dispose(),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,t){this.instance.isPickable=!0,this.instance.enablePointerMoveEvents=!0;let e=new BABYLON.ActionManager(this.objs[0].app.scene);e.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>t(this.id))),this.instance.actionManager=e}this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.instance&&(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1)}dispose(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class W{constructor(){this.color="#00ff00",this.width=5,this.isDotted=!1}update(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.instance=new BABYLON.GUI.MultiLine,this.objs[0].app.container.addControl(this.instance),this.instance.lineWidth=this.width,this.instance.color=this.color,this.isDotted&&(this.instance.dash=[1]),this.objs.forEach(e=>this.instance.add(e.instance)),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}addEventListener(e){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e?(this.instance.isPointerBlocker=!1,this.instance.onPointerClickObservable.add(()=>{e(this.id)})):this.instance.onPointerClickObservable.clear(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.instance&&(this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.isVisible=e,this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1)}dispose(){this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance&&this.instance.dispose(),this.objs[0].app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var X,t=i(9),H=i.n(t);class K{constructor(e,t="540E5CBA3D09480F8CDE2F69C55934EF",i=[117.28688541016095,39.094144209740534],r=Math.PI){this.type="custom",this.renderingMode="3d",this.drones={x:39.094144209740534,y:117.28688541016095,z:0},this.rotation=Math.PI,this.onAdd=(e,t)=>{this.map=e;const i=new BABYLON.Engine(t,!0,{useHighPrecisionMatrix:!0},!0);this.scene=new BABYLON.Scene(i),this.scene.autoClear=!1,this.scene.detachControl(),this.scene.beforeRender=function(){i.wipeCaches(!0)},this.camera=new BABYLON.Camera("mapbox-camera",new BABYLON.Vector3,this.scene);let r=new BABYLON.HemisphericLight("light",new BABYLON.Vector3(1,1,0),this.scene);r.intensity=1,r.diffuse=BABYLON.Color3.FromHexString("#FFFFFF"),r.specular=BABYLON.Color3.Black();let n=new BABYLON.HemisphericLight("light1",new BABYLON.Vector3(-1,1,0),this.scene);n.intensity=.7,n.diffuse=BABYLON.Color3.FromHexString("#FFFFFF"),n.specular=BABYLON.Color3.Black(),this.recalculateProjectionMatrix(this.initialCoordinates),BABYLON.SceneLoader.LoadAssetContainerAsync(se.rl+"bundle/"+this.modelsId+"/",this.modelsId+".gltf",this.scene).then(e=>{e.addAllToScene();const t=e.meshes[0];e=H.a.MercatorCoordinate.fromLngLat(this.initialCoordinates,0);t.position=new BABYLON.Vector3((e.x-this.sceneOrigin.x)/this.modelScale,0,-(e.y-this.sceneOrigin.y)/this.modelScale),t.rotation=new BABYLON.Vector3(0,this.rotation,0),t.getChildMeshes().forEach(e=>{-1!=e.id.indexOf("B_")&&(console.log(e.id),e.setEnabled(!1))})})},this.render=(e,t)=>{t=BABYLON.Matrix.FromArray(t),t=this.modelMatrix.multiply(t);this.camera.freezeProjectionMatrix(t),this.scene.render(!1),this.map.triggerRepaint()},this.id=e,this.modelsId=t,this.initialCoordinates=i,this.rotation=r}recalculateProjectionMatrix(e){var t=[Math.PI/2,0,0];const i=H.a.MercatorCoordinate.fromLngLat(e,0);this.modelScale=i.meterInMercatorCoordinateUnits(),this.sceneOrigin=new BABYLON.Vector3(i.x,i.y,i.z),this.modelMatrix=BABYLON.Matrix.Compose(new BABYLON.Vector3(this.modelScale,this.modelScale,this.modelScale),BABYLON.Quaternion.FromEulerAngles(t[0],t[1],t[2]),this.sceneOrigin)}}class J{static rand(e,t){return Math.floor(Math.random()*(t-e+1)+e)}static init(){J.canvasThunder=document.getElementById("canvasThunder"),J.canvasCloud=document.getElementById("canvasCloud"),J.canvasRain=document.getElementById("canvasRain"),J.canvasThunder&&J.canvasThunder.getContext||console.error("找不到下雨的画布!"),J.canvasThunderCtx=J.canvasThunder.getContext("2d"),J.canvasCloudCtx=J.canvasCloud.getContext("2d"),J.canvasRainCtx=J.canvasRain.getContext("2d"),J.X=J.canvasThunder.width=J.canvasRain.width=J.canvasCloud.width=window.innerWidth,J.Y=J.canvasThunder.height=J.canvasRain.height=J.canvasCloud.height=window.innerHeight,console.log(J.Y),window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};function e(e,t,i,r){this.ctx=e,this.init(t,i,r)}e.prototype.init=function(e,t,i){this.x=e,this.y=t,this.r=i,this.l=J.rand(J.Y,3*J.Y),this.c="rgb(201, 162, 198)"},e.prototype.draw=function(){var e=this.ctx;e.beginPath(),e.lineWidth=this.r,e.strokeStyle=this.c,e.moveTo(this.x,this.y),this.x+=J.rand(-10,10),this.y+=J.rand(10,15),e.lineTo(this.x,this.y),e.stroke()},e.prototype.updateParams=function(){this.y>this.l&&this.init(J.rand(0,J.X),J.rand(0,J.Y/3),J.rand(1,5))},e.prototype.render=function(){this.updateParams(),this.draw()};for(var t=0;t<10;t++){var i=new e(J.canvasThunderCtx,J.rand(0,J.X),J.rand(0,J.Y/3),J.rand(1,5));J.thunders.push(i)}function r(e,t,i,r){this.ctx=e,this.init(t,i,r)}r.prototype.init=function(e,t,i){this.x=e,this.y=t,this.r=i,this.c="rgb(179, 203, 255)",this.v={y:10}},r.prototype.draw=function(){var e=this.ctx;e.beginPath(),e.fillStyle=this.c,e.arc(this.x,this.y,this.r,0,2*Math.PI,!1),e.fill()},r.prototype.updatePosition=function(){this.y+=this.v.y},r.prototype.wrapPosition=function(){this.y>J.Y&&(this.y=0)},r.prototype.resize=function(){this.x=J.rand(0,J.X),this.y=J.rand(0,J.Y)},r.prototype.render=function(){this.updatePosition(),this.wrapPosition(),this.draw()};for(t=0;t<100;t++){var n=new r(J.canvasRainCtx,J.rand(0,J.X),J.rand(0,J.Y),1);J.rains.push(n)}function o(e,t,i){this.ctx=e,this.init(t,i)}o.prototype.init=function(e,t){this.x=e,this.y=t,this.c="rgb(201, 162, 198)",this.r=J.rand(100,200),this.v={x:.5,y:0},this.color={r:0,g:0,b:0,a:1}},o.prototype.wrapPosition=function(){this.x-this.r>J.X&&(this.x=0-this.r)},o.prototype.updatePosition=function(){this.x+=this.v.x},o.prototype.resize=function(){this.x=J.rand(-100,J.X+100),this.y=J.rand(0,J.Y/2)},o.prototype.render=function(){this.updatePosition(),this.wrapPosition(),this.draw()},o.prototype.gradient=function(){var e=this.color.r+","+this.color.g+","+this.color.b,t=this.ctx.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);return t.addColorStop(0,"rgba("+e+", "+ +this.color.a+")"),t.addColorStop(.5,"rgba("+e+", "+.5*this.color.a+")"),t.addColorStop(1,"rgba("+e+", "+0*this.color.a+")"),t},o.prototype.draw=function(){var e=this.ctx;e.save(),e.scale(2,1),e.beginPath(),e.globalAlpha=.2,e.fillStyle=this.gradient(),e.arc(this.x,this.y,this.r,2*Math.PI,!1),e.fill(),e.scale(.5,1),e.restore()};for(t=0;t<50;t++){var s=new o(J.canvasCloudCtx,J.rand(-100,J.X+100),J.rand(0,J.Y/2));J.clouds.push(s)}J.render(),window.addEventListener("resize",function(){J.onResize()})}static onResize(){J.X=J.canvasThunder.width=J.canvasRain.width=J.canvasCloud.width=window.innerWidth,J.Y=J.canvasThunder.height=J.canvasRain.height=J.canvasCloud.height=window.innerHeight;for(var e=0;e<J.rains.length;e++)J.rains[e].resize()}static clearCanvasThunder(){J.canvasThunderCtx.globalCompositeOperation="darken",J.canvasThunderCtx.globalAlpha=.01,J.canvasThunderCtx.fillStyle="rgb(19, 16, 65)",J.canvasThunderCtx.fillRect(0,0,J.X,J.Y),J.canvasThunderCtx.globalCompositeOperation="source-over",J.canvasThunderCtx.globalAlpha=1,Math.random()<.02&&(J.canvasThunderCtx.fillStyle="rgb(128, 128, 128)",J.canvasThunderCtx.fillRect(0,0,J.X,J.Y))}static clearCanvasRain(){J.canvasRainCtx.clearRect(0,0,J.X,J.Y)}static clearCanvasCloud(){J.canvasCloudCtx.clearRect(0,0,J.X,J.Y)}static render(){J.clearCanvasThunder(),J.clearCanvasCloud(),J.clearCanvasRain();for(var e=0;e<J.thunders.length;e++)J.thunders[e].render();for(e=0;e<J.clouds.length;e++)J.clouds[e].render();for(e=0;e<J.rains.length;e++)J.rains[e].render();requestAnimationFrame(J.render)}static stop(){J.canvasCloud.style.display="none",J.canvasRain.style.display="none",J.canvasThunder.style.display="none"}static start(){J.canvasCloud.style.display="",J.canvasRain.style.display="",J.canvasThunder.style.display=""}}J.thunders=[],J.clouds=[],J.rains=[];class Q{constructor(e){this.thunderNum=20,this.thunders=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="thunderEffect",this.canvas.style.cssText="position: absolute;width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent;z-index: 0;background: #000F1E;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasThunderCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight,this.app.environment.setTransparent(.5);for(var e=0;e<this.thunderNum;e++){var t=new ee(this.canvasThunderCtx,p.rand(0,this.X),p.rand(0,this.Y/3),p.rand(1,5),this.X,this.Y);this.thunders.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas),this.app.environment.setTransparent(1)}render(){this.clearCanvasThunder();for(var e=0;e<this.thunders.length;e++)this.thunders[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasThunder(){this.canvasThunderCtx.globalCompositeOperation="darken",this.canvasThunderCtx.globalAlpha=.01,this.canvasThunderCtx.fillStyle="rgb(19, 16, 65)",this.canvasThunderCtx.fillRect(0,0,this.X,this.Y),this.canvasThunderCtx.globalCompositeOperation="source-over",this.canvasThunderCtx.globalAlpha=1,Math.random()<.02&&(this.canvasThunderCtx.fillStyle="rgb(128, 128, 128)",this.canvasThunderCtx.fillRect(0,0,this.X,this.Y))}}class ee{constructor(e,t,i,r,n,o){this.ctx=e,this.X=n,this.Y=o,this.init(t,i,r)}init(e,t,i){this.x=e,this.y=t,this.r=i,this.l=p.rand(this.Y,3*this.Y),this.c="rgb(201, 162, 198)"}draw(){this.ctx.beginPath(),this.ctx.lineWidth=this.r,this.ctx.strokeStyle=this.c,this.ctx.moveTo(this.x,this.y),this.x+=p.rand(-10,10),this.y+=p.rand(10,15),this.ctx.lineTo(this.x,this.y),this.ctx.stroke()}updateParams(){this.y>this.l&&this.init(p.rand(0,this.X),p.rand(0,this.Y/3),p.rand(1,5))}render(){this.updateParams(),this.draw()}}class te{constructor(e){this.rainNum=1e3,this.rains=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="RainEffect",this.canvas.style.cssText="position: absolute;width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent; z-index: 2;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasRainCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight;for(var e=0;e<this.rainNum;e++){var t=new ie(this.canvasRainCtx,p.rand(0,this.X),p.rand(0,this.Y),1,this.Y);this.rains.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas)}render(){this.clearCanvasRain();for(var e=0;e<this.rains.length;e++)this.rains[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasRain(){this.canvasRainCtx.clearRect(0,0,this.X,this.Y)}}class ie{constructor(e,t,i,r,n){this.rainSpeed=10,this.ctx=e,this.Y=n,this.init(t,i,r)}init(e,t,i){this.x=e,this.y=t,this.r=i,this.c="rgb(179, 203, 255)",this.v={y:this.rainSpeed}}draw(){var e=this.ctx;e.beginPath(),e.fillStyle=this.c,e.arc(this.x,this.y,this.r,0,2*Math.PI,!1),e.fill()}updatePosition(){this.y+=this.v.y}wrapPosition(){this.y>this.Y&&(this.y=0)}render(){this.updatePosition(),this.wrapPosition(),this.draw()}}class re{constructor(e){this.cloudNum=50,this.clouds=new Array,this.app=e}start(){this.canvas=document.createElement("canvas"),this.canvas.id="CloudEffect",this.canvas.style.cssText="position: absolute;width: 100%;height: 100%;outline-width: 0;-webkit-tap-highlight-color:transparent; z-index: 1;pointer-events: none;",this.app.canvas.parentElement.appendChild(this.canvas),this.canvasCloudCtx=this.canvas.getContext("2d"),this.X=this.canvas.width=window.innerWidth,this.Y=this.canvas.height=window.innerHeight;for(var e=0;e<this.cloudNum;e++){var t=new ne(this.canvasCloudCtx,p.rand(-100,this.X+100),p.rand(0,this.Y/2),this.X);this.clouds.push(t)}this.render()}close(){this.app.canvas.parentElement.removeChild(this.canvas)}render(){this.clearCanvasCloud();for(var e=0;e<this.clouds.length;e++)this.clouds[e].render();window.requestAnimationFrame(()=>{this.render()})}clearCanvasCloud(){this.canvasCloudCtx.clearRect(0,0,this.X,this.Y)}}class ne{constructor(e,t,i,r){this.rainSpeed=10,this.ctx=e,this.X=r,this.init(t,i)}init(e,t){this.x=e,this.y=t,this.c="rgb(201, 162, 198)",this.r=p.rand(100,200),this.v={x:.5,y:0},this.color={r:0,g:0,b:0,a:1}}draw(){this.ctx.save(),this.ctx.scale(2,1),this.ctx.beginPath(),this.ctx.globalAlpha=.2,this.ctx.fillStyle=this.gradient(),this.ctx.arc(this.x,this.y,this.r,2*Math.PI,0,!1),this.ctx.fill(),this.ctx.scale(.5,1),this.ctx.restore()}gradient(){var e=this.color.r+","+this.color.g+","+this.color.b,t=this.ctx.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);return t.addColorStop(0,"rgba("+e+", "+ +this.color.a+")"),t.addColorStop(.5,"rgba("+e+", "+.5*this.color.a+")"),t.addColorStop(1,"rgba("+e+", "+0*this.color.a+")"),t}updatePosition(){this.x+=this.v.x}wrapPosition(){this.x-this.r>this.X&&(this.x=0-this.r)}render(){this.updatePosition(),this.wrapPosition(),this.draw()}}(t=X=X||{}).Thunder="Thunder",t.Rain="Rain",t.Cloud="Cloud";class oe{static add(e,t){switch(e){case X.Thunder:{let e=new Q(t);e.start(),this.effects.add(X.Thunder,e)}break;case X.Rain:{let e=new te(t);e.start(),this.effects.add(X.Rain,e)}break;case X.Cloud:{let e=new re(t);e.start(),this.effects.add(X.Cloud,e)}}}static remove(e){let t=this.effects.find(e);t&&t.close(),this.effects.remove(e)}}oe.effects=new d;class se{}se.sl="https://www.wodashijie.com/",se.rl="https://models.wodashijie.com/",se.App=class{constructor(e){this.isDefaultMutual=!1,e.sl&&(se.sl=e.sl),e.rl&&(se.rl=e.rl),A.defaults.baseURL=se.sl,this.canvas=document.createElement("canvas"),this.canvas.style.cssText="position: absolute;left: 0;right: 0;top: 0;bottom: 0;width: 100%;height: 100%;background-color: transparent;outline-width: 0;-webkit-tap-highlight-color:transparent;z-index: 2;",e.container.appendChild(this.canvas),this.engine=new BABYLON.Engine(this.canvas,!0,{premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,doNotHandleContextLost:!1}),this.engine.setHardwareScalingLevel(.5),this.scene=new BABYLON.Scene(this.engine,{useGeometryUniqueIdsMap:!0,useClonedMeshMap:!0,useMaterialMeshMap:!0}),this.scene.useRightHandedSystem=!0,this.scene.getBoundingBoxRenderer().frontColor=BABYLON.Color3.Green(),this.scene.getBoundingBoxRenderer().showBackLines=!1,this.cameraController=new s(this),this.highlightLayer=new BABYLON.HighlightLayer("highlightLayer",this.scene),this.iEvent=new r(this),this.gl=new BABYLON.GlowLayer("glow2",this.scene),this.container=BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("screenUI"),this.toolTips=new _(this),this.environment=new g(this),this.environment.defaultLights(),this.environment.openAllLight(),this.resources=new x(this),this.project=new y(this),se.AlarmFlashing.init(),this.engine.runRenderLoop(()=>{this.fps&&(this.fps.innerText=this.engine.getFps().toFixed()+" fps"),this.scene.render(),v.a.update(),this.iEvent&&this.iEvent.runRender()}),window.addEventListener("resize",()=>{this.engine.resize()}),this.scene.onPointerObservable.add(e=>{this.iEvent&&this.iEvent.onPointer(e)}),this.scene.onKeyboardObservable.add(e=>{this.iEvent&&this.iEvent.onKeyboard(e)})}async load(h){h.pk=null==h.pk?"project":h.pk,h.isDefaultLevel=null==h.isDefaultLevel||h.isDefaultLevel,h.isDefaultMutual=null==h.isDefaultMutual||h.isDefaultMutual,se.pk=h.pk;var e=await A.get(`api/service/GetToken?accessToken=${se.accessToken}`);if(200==e.status){localStorage.setItem("mx3d-token",e.data);e=await A.get("api/service");if(200==e.status){localStorage.setItem("mx3d-long",e.data);e=await A.get(`api/service/${se.pk}`);if(200==e.status){let c=JSON.parse(class{static de(e){let t=localStorage.getItem("mx3d-long");var i=E.a.enc.Utf8.parse(t.substring(0,32)),r=E.a.enc.Utf8.parse(t.substring(32,48)),e=E.a.enc.Hex.parse(e),e=E.a.enc.Base64.stringify(e);return E.a.AES.decrypt(e,i,{iv:r,mode:E.a.mode.CBC,padding:E.a.pad.Pkcs7}).toString(E.a.enc.Utf8).toString()}}.de(e.data));return console.log(c),new Promise(async(e,t)=>{try{console.log((new Date).toLocaleString()),this.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let r=new d,n=new d;for(let i=0;i<c.objectDatas.length;i++){let e=c.objectDatas[i],t;!e.baseModel||".gltf"!=e.baseModel.extension||r.find(e.baseModel.modelId)||this.resources.resources.find(e.baseModel.modelId)||(e.baseModel.objectType=e.objectType,r.add(e.baseModel.modelId,e.baseModel)),e.objectType!=f.Corner&&e.objectType!=f.Wall&&e.objectType!=f.Floor&&(e.objectType==f.Window?t=new N(this):e.objectType==f.Door?t=new F(this):e.objectType==f.Campus?(t=new j(this),n.add(e.id,new Array)):e.objectType==f.Storey?(t=new P(this),n.add(e.id,new Array)):t=new(e.objectType==f.LeakWater?L:e.objectType==f.Conduit?D:e.objectType==f.UI3D?R:e.objectType==f.VirtualBox?O:e.objectType==f.Building?U:I)(this),t.loadProperties(e),this.project.objectDatas.add(t.id,t))}for(let e=0;e<c.objectDatas.length;e++){var o=c.objectDatas[e];if(o.objectType==f.Corner||o.objectType==f.Wall||o.objectType==f.Floor){let e=n.find(o.parentId);e.push(o)}}let t=0,i=r.count();for(const s in r.map)await this.resources.loadModelMesh(r.find(s)),t++,h&&h.progress&&h.progress(t/i*.3);t=0,r=null,i=this.project.objectDatas.count();for(const a in this.project.objectDatas.map){let e=this.project.objectDatas.find(a);await e.bind(),t++,h&&h.progress&&h.progress(.3+t/i*.5)}t=0,i=n.count();for(const l in n.map){t++,h&&h.progress&&h.progress(.8+t/i*.2);let e=this.project.objectDatas.find(l);e&&e instanceof k?e.load(!1,n.find(l)):console.error("出现错误,场景不存在或未创建成功",l,e)}this.project.root=this.project.objectDatas.find(c.id),this.project.optimization(),h.isDefaultMutual&&(this.defaultMutual=!0),h.isDefaultLevel&&this.project.switchLevel(null,!0),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1,console.log((new Date).toLocaleString()),e(null),this.engine.resize(),h&&h.complete&&h.complete()}catch(e){t(e)}})}}}}set defaultMutual(e){for(var t in this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.isDefaultMutual=e,this.project.objectDatas.map){let e=this.project.objectDatas.find(t);e instanceof U&&(this.project.getChildsById(e.id).length<1||(this.isDefaultMutual?e.addEventListener(w.leftClick,()=>this.project.switchLevel(e.id)):e.removeEventListener(w.leftClick)))}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.environment.hideFps(),this.project.clear(),this.resources.delete(),this.engine.dispose()}},se.Earth=class{constructor(e,t=[117.28688541016095,39.094144209740534]){this.initialCoordinates=[117.28688541016095,39.094144209740534],this.initialCoordinates=t,H.a.accessToken="pk.eyJ1IjoibGl1ayIsImEiOiJjanczNmJoZjkwY3IxM3lxcTd1NmMwZWxjIn0.11SpcY8De0c1q6S3a-2Qcg",this.map=new H.a.Map({container:e,style:"mapbox://styles/mapbox/satellite-streets-v11",zoom:1.5,center:this.initialCoordinates,projection:"globe"})}load(e){this.map.on("style.load",()=>{this.map.setFog({color:"rgb(220, 159, 159)","high-color":"rgb(36, 92, 223)","horizon-blend":.4}),this.map.addSource("mapbox-dem",{type:"raster-dem",url:"mapbox://mapbox.terrain-rgb"}),this.map.setTerrain({source:"mapbox-dem",exaggeration:1.5}),e&&e()})}laodScene(e,t=this.initialCoordinates,i=Math.PI){i=new K("babylon-layer",e,t,i);this.map.addLayer(i)}flyTo(e=this.initialCoordinates,t=18,i=130,r=75,n=12e3){this.map.flyTo({center:e,zoom:t,bearing:i,pitch:r,duration:n,essential:!0})}},se.Tools=p,se.AlarmFlashing=S,se.UI=class{static createIconFromMesh(e,t,i,r,n){let o=t.Sight.focus.clone();var s=t.instance.getBoundingInfo();return o.y+=(s.boundingBox.maximum.y-s.boundingBox.minimum.y)/2,new G(e,o,i,r,n,t.app.scene)}static createIcon(e,t,i,r){let n;t.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,n=new V(e,t.app.scene),n.size=i,n.height=r,n.pint=new BABYLON.Mesh(e+"_pint");e=t.Sight.focus.clone();return n.pint.position=e,n.pint.position.y+=r,n.rect=new BABYLON.GUI.Rectangle,n.rect.isPointerBlocker=!1,n.rect.width=i.width+"px",n.rect.height=i.height+"px",n.rect.thickness=0,t.app.container.addControl(n.rect),n.rect.linkWithMesh(n.pint),t.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,n}},se.Builder=class{static createMatrixCloud(n){n.displayValues=null!=n.displayValues&&n.displayValues,n.isAlpha=null==n.isAlpha||n.isAlpha,n.isParticle=null==n.isParticle||n.isParticle,n.height=n.height||.5,n.radius=n.radius||2.8,n.isLevelRender=null==n.isLevelRender||n.isLevelRender,n.range=n.range||{max:30,min:16};let o;if(!(n.value||n.value.maxX||n.value.maxY||n.value.data||n.anchor))return o;n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,o=new Z(n.anchor);var s=n.anchor.instance.getBoundingInfo();o.mesh=n.anchor.instance.clone(o.id),o.mesh.position.y+=n.height;var a=s.maximum.x-s.minimum.x,l=a/(2*n.value.maxX),c=s.maximum.z-s.minimum.z,h=c/(2*n.value.maxY);let e=new Array;for(let r=0;r<2*n.value.maxX;r++)for(let i=0;i<2*n.value.maxY;i++){let t={x:r,y:i,value:n.range.min};for(let e=0;e<n.value.data.length;e++){var u=n.value.data[e];2*u.x+1==r&&2*u.y+1==i&&(t.value=u.value,u=new BABYLON.Vector3(s.boundingSphere.center.x-(a/2-l*r),o.mesh.position.y,s.boundingSphere.center.z-(c/2-h*i)),o.texts.push(this.createTempVlaue(t.value+"℃",u,n.anchor.app.scene,n.anchor.app.container)))}e.push(t)}o.displayValues=n.displayValues;let t=q.create({width:2*n.value.maxX,height:2*n.value.maxY,radius:n.radius});t.setData({min:n.range.min,max:n.range.max,data:e});let i=new BABYLON.StandardMaterial(o.id,n.anchor.app.scene);return i.diffuseTexture=new BABYLON.Texture(t.getDataURL(),n.anchor.app.scene,!1,!1),i.specularColor=new BABYLON.Color3(0,0,0),i.alpha=.5,n.isAlpha&&(i.diffuseTexture.hasAlpha=!0),n.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getMatrixParticleTex(se.rl,n.anchor.app.resources.FogTex,i.diffuseTexture,o.mesh,n.anchor.app.scene,n.isLevelRender),o.mesh.isVisible=!1),n.isLevelRender&&(o.mesh.renderingGroupId=1),o.mesh.material=i,o.mesh.alwaysSelectAsActiveMesh=!0,o.mesh.freezeWorldMatrix(),n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,o}static _getMatrixParticleTex(e,t,i,r,n,o){let s,a=t.clone(),l=r.getBoundingInfo().boundingBox;var c=(l.extendSizeWorld.x+l.extendSizeWorld.z)/9,t=1500*c*c;l.minimumWorld.subtract(new BABYLON.Vector3(-0,0,-0)),l.maximumWorld.subtract(new BABYLON.Vector3(0,0,0));s&&s.dispose(),BABYLON.GPUParticleSystem.IsSupported&&(s=new BABYLON.GPUParticleSystem("particles",{capacity:t},n),s.activeParticleCount=t,s.manualEmitCount=s.activeParticleCount,s.minEmitBox=l.minimumWorld,s.maxEmitBox=l.maximumWorld),s.particleTexture=a,s.emitter=r,o&&(s.renderingGroupId=1),s.isLocal=!0;let h=new BABYLON.NodeMaterial("nm_heatmapBox_"+r.id,n);return h.loadAsync(e+"resources/horizontalNodeMat.json").then(()=>{h.build(!1),h.getBlockByName("boxTex").texture=i,h.getBlockByName("emitXMin").value=s.minEmitBox.x,h.getBlockByName("emitXMax").value=s.maxEmitBox.x,h.getBlockByName("emitYMin").value=s.minEmitBox.z,h.getBlockByName("emitYMax").value=s.maxEmitBox.z,h.createEffectForParticles(s)}),r.onDispose=()=>{s&&s.dispose()},s.onDispose=()=>{h&&h.dispose(),a&&a.dispose()},s.color1=new BABYLON.Color4(.8,.8,.8,.1),s.color2=new BABYLON.Color4(.95,.95,.95,.15),s.colorDead=new BABYLON.Color4(.9,.9,.9,.1),s.minSize=1.4,s.maxSize=2,s.minLifeTime=Number.MAX_SAFE_INTEGER,s.emitRate=5e4*c,s.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,s.gravity=new BABYLON.Vector3(0,0,0),s.direction1=new BABYLON.Vector3(0,0,0),s.direction2=new BABYLON.Vector3(0,0,0),s.minAngularSpeed=-2,s.maxAngularSpeed=2,s.minEmitPower=.5,s.maxEmitPower=1,s.updateSpeed=.005,s.start(),s}static createPunctateCloud(r){if(r.displayValues=null!=r.displayValues&&r.displayValues,r.isAlpha=null==r.isAlpha||r.isAlpha,r.isParticle=null==r.isParticle||r.isParticle,r.radius=r.radius||1,r.isLevelRender=null==r.isLevelRender||r.isLevelRender,r.range=r.range||{max:30,min:16},!r.value&&!r.anchor)return console.error("要创建的云图数值为空!"),null;let e;r.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,e=new Z(r.anchor),e.mesh=BABYLON.MeshBuilder.CreatePlane(e.id,{width:1,height:1,sideOrientation:2},r.anchor.app.scene),e.mesh.scaling=new BABYLON.Vector3(r.radius,r.radius,r.radius),e.mesh.alwaysSelectAsActiveMesh=!0,e.mesh.enablePointerMoveEvents=!1,e.mesh.isPickable=!1,e.mesh.position=r.anchor.instance.position.clone(),e.mesh.rotation.x=Math.PI/2;let n=[];for(let i=0;i<6;i++)for(let t=0;t<6;t++){let e={x:i,y:t,value:r.range.min};2==i&&2==t||3==i&&2==t||2==i&&3==t||3==i&&3==t?e.value=r.value:e.value=r.value-2*(Math.abs(2-i)+Math.abs(2-t)),n.push(e)}e.displayValues=r.displayValues;let t=q.create({width:5,height:5,radius:2});t.setData({min:r.range.min,max:r.range.max,data:n});let i=new BABYLON.StandardMaterial(e.id,r.anchor.app.scene);return i.diffuseTexture=new BABYLON.Texture(t.getDataURL(),r.anchor.app.scene,!1,!1),i.specularColor=new BABYLON.Color3(0,0,0),i.alpha=.5,r.isAlpha&&(i.diffuseTexture.hasAlpha=!0),r.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getColumnarParticleTex(i.diffuseTexture,e.mesh,r.anchor.app.scene,e.anchor.app.resources.FogTex,r.isLevelRender),e.mesh.isVisible=!1),r.isLevelRender&&(e.mesh.renderingGroupId=1),e.mesh.material=i,e.mesh.alwaysSelectAsActiveMesh=!0,e.mesh.freezeWorldMatrix(),r.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,e}static createColumnCloud(n){if(n.displayValues=null!=n.displayValues&&n.displayValues,n.isAlpha=null==n.isAlpha||n.isAlpha,n.isParticle=null==n.isParticle||n.isParticle,n.radius=n.radius||4,n.isLevelRender=null==n.isLevelRender||n.isLevelRender,n.range=n.range||{max:30,min:16},!n.data&&n.data.length<1&&!n.anchor)return console.error("要创建的云图数值为空!"),null;let i;n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,i=new Z(n.anchor);var r=.98*n.anchor.instance.scaling.y;i.mesh=BABYLON.MeshBuilder.CreatePlane(i.id,{width:.98*n.anchor.instance.scaling.x,height:r,sideOrientation:2},n.anchor.app.scene),i.mesh.alwaysSelectAsActiveMesh=!0,i.mesh.enablePointerMoveEvents=!1,i.mesh.isPickable=!1,i.mesh.position=n.anchor.instance.position.clone(),i.mesh.rotation.z=Math.PI,i.mesh.rotation.y=n.anchor.instance.rotation.y,n.isLevelRender&&(i.mesh.renderingGroupId=1);let e=[];for(let r=0;r<4;r++)for(let i=0;i<3*n.data.length;i++){let t={x:r,y:i,value:n.range.min};for(let e=0;e<n.data.length;e++){var o=n.data[e];2==r&&3*e+2==i&&(t.value=o.value)}e.push(t)}var s=r/n.data.length;for(let t=0;t<n.data.length;t++){let e=i.mesh.position.clone();e.y=e.y-r/2+(r-s*t-s/2),i.texts.push(this.createTempVlaue(n.data[t].value+"℃",e,n.anchor.app.scene,i.anchor.app.container))}i.displayValues=n.displayValues;let t=q.create({width:4,height:3*n.data.length,radius:n.radius});t.setData({min:n.range.min,max:n.range.max,data:e});let a=new BABYLON.StandardMaterial(i.id,n.anchor.app.scene);return a.diffuseTexture=new BABYLON.Texture(t.getDataURL(),n.anchor.app.scene,!1,!1),a.specularColor=new BABYLON.Color3(0,0,0),a.alpha=.5,n.isAlpha&&(a.diffuseTexture.hasAlpha=!0),n.isParticle&&BABYLON.GPUParticleSystem.IsSupported&&(this._getColumnarParticleTex(a.diffuseTexture,i.mesh,n.anchor.app.scene,i.anchor.app.resources.FogTex,n.isLevelRender),i.mesh.isVisible=!1),i.mesh.material=a,i.mesh.alwaysSelectAsActiveMesh=!0,i.mesh.freezeWorldMatrix(),n.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,i}static _getColumnarParticleTex(e,t,i,r,n){let o,s=r.clone();r=t.getBoundingInfo().boundingBox,r.extendSizeWorld.x,r.extendSizeWorld.z;BABYLON.Effect.ShadersStore.particlesVertexShader=`
26
26
  precision highp float;
27
27
  in vec3 position;
28
28
  in vec4 color;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mx3d",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "我搭世界SDK",
5
5
  "main": "mx3d.js",
6
6
  "typings": "./index.d.ts",