@aibee/crc-bmap 0.14.13 → 0.14.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/meta.json +3 -3
- package/lib/src/elements/poi2.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -433,7 +433,7 @@
|
|
|
433
433
|
gl_FragColor = vec4(newColor, vOpacity);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
`;return this.instancedWallMaterial=new $.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};at(Lt,"lineMaterialMap",new Map),at(Lt,"meshStandardMaterialMap",new Map),at(Lt,"meshBasicMaterialMap",new Map),at(Lt,"shaderMaterialMap",new Map),at(Lt,"line2MaterialMap",new Map),at(Lt,"mergeAttributeGraphicMaterial",null),at(Lt,"mergeAttributeWallMaterial",null),at(Lt,"mergeAttributeGraphicLineMaterial",null),at(Lt,"instancedGraphicMaterial",null),at(Lt,"instancedWallMaterial",null),at(Lt,"lineDashedMaterialMap",new Map);var si=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};at(si,"keySet",new Set);function oi(a,t,e){return new Promise((i,s)=>{let o=si.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(si.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}var Gr=require("three");var Us=class extends Gr.EventDispatcher{constructor(e=10,i){super();at(this,"max",10);at(this,"workerConstructor");at(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};var Sh={};function Xo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",Sh.url))}var Xi=require("three");var ni=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Xi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Xi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Xi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};at(ni,"WorkerPool",new Us(10,Xo));var Yi=class extends q{getCenter(){return new Ft.Box3().setFromObject(this).getCenter(new Ft.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),I(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Xe(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new ri(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new Ie(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometry(t);if(I(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new ri(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometryLine(t);if(I(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new Ie(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new Ft.Matrix4().fromArray(r),c=new Ft.Vector3,l=new Ft.Quaternion,p=new Ft.Vector3;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new Ft.Group,this.mergedLineGroup=new Ft.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var Mf=require("core-js/modules/web.dom-collections.iterator.js"),_f=require("core-js/modules/es.array.push.js");var pt=require("three");var mf=require("core-js/modules/es.string.replace.js"),ff=require("core-js/modules/es.regexp.exec.js"),gf=require("core-js/modules/es.error.cause.js"),yf=require("core-js/modules/web.dom-collections.iterator.js"),Hs=require("three");var qi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Hs.SRGBColorSpace,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Hs.TextureLoader,t&&this.setBaseUrl(t)}};var zr=require("lodash");var Fr={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},Re=class a extends q{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new pt.Raycaster,i=new pt.Vector2,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new pt.Vector3(0,0,1),m=new pt.Vector3(0,0,0),v=new pt.Plane().setFromNormalAndCoplanarPoint(u,m),g=new pt.Vector3;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let C=v;C<=g;C++)for(let S=x;S<=M;S++)P.push({x:C,y:S,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new pt.MeshBasicMaterial({map:c,transparent:!0}),p=new pt.Mesh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new pt.PlaneGeometry(1,1),this.options=Fr,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=(0,zr.debounce)(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Fr,e),this.tileGroup=new pt.Group;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new qi(this.options.base_url),this.initEvents(),this.updateTiles()}};Re.WORLD_WIDTH=4007501668e-2;Re.WORLD_WIDTH_HALF=Re.WORLD_WIDTH/2;var Cf=require("core-js/modules/es.array.push.js"),Tf=require("core-js/modules/web.dom-collections.iterator.js"),kf=require("core-js/modules/es.string.trim.js");var Mt=require("three");var ee=require("lodash");var Eh={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},tt=class extends Mt.Object3D{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!(0,ee.isNil)(t)&&!(0,ee.isNil)(e)&&!(0,ee.isNil)(i)&&!(0,ee.isNil)(s)&&!(0,ee.isNil)(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=(0,ee.once)(this._initTextTexture),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield lt.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield lt.getTextureByUrl(this.options.icon);let i=new Mt.Sprite(new Mt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Mt.Sprite(new Mt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new Mt.Box2(new Mt.Vector2(s-n,o-this.iconHeight),new Mt.Vector2(s+n,o)),h=this.textWidth/2,c=new Mt.Box2(new Mt.Vector2(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new Mt.Vector2(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new Mt.Box2,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield Q.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=(0,ee.once)(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield Q.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=Ue(w({},Eh,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var ie=class extends zt.Object3D{getPosition(){return this.box.getCenter(new zt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new ot(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new zt.Box3().setFromObject(this).getCenter(new zt.Vector3)}addModel(t){let e=new Ui(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new zt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new zt.Vector3),i=t.getSize(new zt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new tt(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof ot)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Wi,this.groundUpper=new zt.Object3D,this.models=new zt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new zt.Box3,this.groundLayer=new q(this.context),this.graphicLayer=new Hi(this.context),this.poiLayer=new Ni(this.context),this.poiLayer2=new Zi(this.context),this.parkingSpaceLayer=new ji(this.context),this.wallLayer=new q(this.context),this.textureLayer=new q(this.context),this.glbModelLayer=new Vi(this.context),this.laneLayer=new q(this.context),this.mergeGraphicLayer=new Yi(this.context),this.textTextureLayer=new q(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var _t=require("three"),Br=require("@mars3d/heatmap.js"),Ns=require("@turf/turf");var $i=class extends _t.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=(0,Br.create)(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new _t.PlaneGeometry(t,e),s=new _t.Texture(this.div.firstChild);s.needsUpdate=!0;let o=new _t.MeshBasicMaterial({transparent:!0,side:_t.FrontSide,map:s});o.needsUpdate=!0,this.plane=new _t.Mesh(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new _t.Matrix3().makeScale(this.box.scale,-this.box.scale).multiply(new _t.Matrix3().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new _t.Vector2(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=(0,Ns.bbox)(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=(0,Ns.center)(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),I(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var tg=require("core-js/modules/es.array.push.js"),eg=require("core-js/modules/web.dom-collections.iterator.js");var Zs=require("three");var Bt=class extends Zs.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new Zs.Vector3(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return D(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=So(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Ji=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);Le(this.circles[0],s.x,s.y),jt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);Le(this.circles[1],s.x,s.y),jt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",jt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];Le(h,n,r),this.points.length||jt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[Qe(e.radius,e.fill),Qe(e.radius,e.fill)],this.line=ki(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var ng=require("core-js/modules/es.array.push.js");var Qi=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&Le(this.circles[i],s.x,s.y),i!==0&&jt(this.lines[i-1],void 0,s),this.lines[i]&&jt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",jt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=Qe(r,n);Le(c,s,o),this.addCircle(c)}if(this.lines.length&&jt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ki(h);jt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};var Wr=require("three");var Yo=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new Wr.Box3().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=D(r,s,o,n),l=D(h,s,o,n);bt(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let S=0;S<g.length;S++)bt(this.cornerRect[S],g[S].x,g[S].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,C=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let S=0;S<C.length;S++)bt(this.centerRect[S],C[S].x,C[S].y,x*2,x*2)}else{bt(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)bt(this.cornerRect[i],0,0,0,0),bt(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=Me(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Me(e.stroke,"#ffffff"),this.centerRect[i]=Me(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};var dg=require("core-js/modules/es.array.push.js"),Pt=require("three");var Ur=require("three/examples/jsm/utils/BufferGeometryUtils.js");var ts=class extends Pt.Object3D{initGeometry(){return f(this,null,function*(){let t=yield te.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
436
|
+
`;return this.instancedWallMaterial=new $.ShaderMaterial({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};at(Lt,"lineMaterialMap",new Map),at(Lt,"meshStandardMaterialMap",new Map),at(Lt,"meshBasicMaterialMap",new Map),at(Lt,"shaderMaterialMap",new Map),at(Lt,"line2MaterialMap",new Map),at(Lt,"mergeAttributeGraphicMaterial",null),at(Lt,"mergeAttributeWallMaterial",null),at(Lt,"mergeAttributeGraphicLineMaterial",null),at(Lt,"instancedGraphicMaterial",null),at(Lt,"instancedWallMaterial",null),at(Lt,"lineDashedMaterialMap",new Map);var si=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};at(si,"keySet",new Set);function oi(a,t,e){return new Promise((i,s)=>{let o=si.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(si.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}var Gr=require("three");var Us=class extends Gr.EventDispatcher{constructor(e=10,i){super();at(this,"max",10);at(this,"workerConstructor");at(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};var Sh={};function Xo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",Sh.url))}var Xi=require("three");var ni=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Xi.BufferGeometry;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Xi.BufferAttribute(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Xi.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield oi(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ei(Ei({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};at(ni,"WorkerPool",new Us(10,Xo));var Yi=class extends q{getCenter(){return new Ft.Box3().setFromObject(this).getCenter(new Ft.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),I(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Xe(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new ri(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new Ie(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometry(t);if(I(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new ri(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield ni.GetMergedGeometryLine(t);if(I(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new Ie(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new Ft.Matrix4().fromArray(r),c=new Ft.Vector3,l=new Ft.Quaternion,p=new Ft.Vector3;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new Ft.Group,this.mergedLineGroup=new Ft.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var Mf=require("core-js/modules/web.dom-collections.iterator.js"),_f=require("core-js/modules/es.array.push.js");var pt=require("three");var mf=require("core-js/modules/es.string.replace.js"),ff=require("core-js/modules/es.regexp.exec.js"),gf=require("core-js/modules/es.error.cause.js"),yf=require("core-js/modules/web.dom-collections.iterator.js"),Hs=require("three");var qi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Hs.SRGBColorSpace,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Hs.TextureLoader,t&&this.setBaseUrl(t)}};var zr=require("lodash");var Fr={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},Re=class a extends q{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new pt.Raycaster,i=new pt.Vector2,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new pt.Vector3(0,0,1),m=new pt.Vector3(0,0,0),v=new pt.Plane().setFromNormalAndCoplanarPoint(u,m),g=new pt.Vector3;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let C=v;C<=g;C++)for(let S=x;S<=M;S++)P.push({x:C,y:S,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new pt.MeshBasicMaterial({map:c,transparent:!0}),p=new pt.Mesh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new pt.PlaneGeometry(1,1),this.options=Fr,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=(0,zr.debounce)(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Fr,e),this.tileGroup=new pt.Group;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new qi(this.options.base_url),this.initEvents(),this.updateTiles()}};Re.WORLD_WIDTH=4007501668e-2;Re.WORLD_WIDTH_HALF=Re.WORLD_WIDTH/2;var Cf=require("core-js/modules/es.array.push.js"),Tf=require("core-js/modules/web.dom-collections.iterator.js"),kf=require("core-js/modules/es.string.trim.js");var Mt=require("three");var ee=require("lodash");var Eh={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1,icon_alpha_test:.2,text_alpha_test:.2},tt=class extends Mt.Object3D{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!(0,ee.isNil)(t)&&!(0,ee.isNil)(e)&&!(0,ee.isNil)(i)&&!(0,ee.isNil)(s)&&!(0,ee.isNil)(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=(0,ee.once)(this._initTextTexture),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield lt.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield lt.getTextureByUrl(this.options.icon);let i=new Mt.Sprite(new Mt.SpriteMaterial({map:e,transparent:!0,alphaTest:this.options.icon_alpha_test,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Mt.Sprite(new Mt.SpriteMaterial({map:t,transparent:!0,alphaTest:this.options.text_alpha_test,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new Mt.Box2(new Mt.Vector2(s-n,o-this.iconHeight),new Mt.Vector2(s+n,o)),h=this.textWidth/2,c=new Mt.Box2(new Mt.Vector2(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new Mt.Vector2(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new Mt.Box2,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield Q.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=(0,ee.once)(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield Q.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=(0,ee.once)(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=Ue(w({},Eh,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var ie=class extends zt.Object3D{getPosition(){return this.box.getCenter(new zt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new ot(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new zt.Box3().setFromObject(this).getCenter(new zt.Vector3)}addModel(t){let e=new Ui(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new zt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new zt.Vector3),i=t.getSize(new zt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new tt(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof ot)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Wi,this.groundUpper=new zt.Object3D,this.models=new zt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new zt.Box3,this.groundLayer=new q(this.context),this.graphicLayer=new Hi(this.context),this.poiLayer=new Ni(this.context),this.poiLayer2=new Zi(this.context),this.parkingSpaceLayer=new ji(this.context),this.wallLayer=new q(this.context),this.textureLayer=new q(this.context),this.glbModelLayer=new Vi(this.context),this.laneLayer=new q(this.context),this.mergeGraphicLayer=new Yi(this.context),this.textTextureLayer=new q(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var _t=require("three"),Br=require("@mars3d/heatmap.js"),Ns=require("@turf/turf");var $i=class extends _t.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=(0,Br.create)(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new _t.PlaneGeometry(t,e),s=new _t.Texture(this.div.firstChild);s.needsUpdate=!0;let o=new _t.MeshBasicMaterial({transparent:!0,side:_t.FrontSide,map:s});o.needsUpdate=!0,this.plane=new _t.Mesh(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new _t.Matrix3().makeScale(this.box.scale,-this.box.scale).multiply(new _t.Matrix3().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new _t.Vector2(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=(0,Ns.bbox)(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=(0,Ns.center)(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),I(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var tg=require("core-js/modules/es.array.push.js"),eg=require("core-js/modules/web.dom-collections.iterator.js");var Zs=require("three");var Bt=class extends Zs.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new Zs.Vector3(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return D(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=So(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Ji=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);Le(this.circles[0],s.x,s.y),jt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);Le(this.circles[1],s.x,s.y),jt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",jt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];Le(h,n,r),this.points.length||jt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[Qe(e.radius,e.fill),Qe(e.radius,e.fill)],this.line=ki(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var ng=require("core-js/modules/es.array.push.js");var Qi=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&Le(this.circles[i],s.x,s.y),i!==0&&jt(this.lines[i-1],void 0,s),this.lines[i]&&jt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",jt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=Qe(r,n);Le(c,s,o),this.addCircle(c)}if(this.lines.length&&jt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ki(h);jt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};var Wr=require("three");var Yo=class extends Bt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new Wr.Box3().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=D(r,s,o,n),l=D(h,s,o,n);bt(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let S=0;S<g.length;S++)bt(this.cornerRect[S],g[S].x,g[S].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,C=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let S=0;S<C.length;S++)bt(this.centerRect[S],C[S].x,C[S].y,x*2,x*2)}else{bt(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)bt(this.cornerRect[i],0,0,0,0),bt(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=Me(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Me(e.stroke,"#ffffff"),this.centerRect[i]=Me(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};var dg=require("core-js/modules/es.array.push.js"),Pt=require("three");var Ur=require("three/examples/jsm/utils/BufferGeometryUtils.js");var ts=class extends Pt.Object3D{initGeometry(){return f(this,null,function*(){let t=yield te.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
437
437
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
438
438
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
439
439
|
uniform vec3 uColor;
|
package/lib/index.esm.min.js
CHANGED
|
@@ -433,7 +433,7 @@ var ha=Object.create;var Fs=Object.defineProperty;var ca=Object.getOwnPropertyDe
|
|
|
433
433
|
gl_FragColor = vec4(newColor, vOpacity);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
`;return this.instancedWallMaterial=new Ee({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};K(nt,"lineMaterialMap",new Map),K(nt,"meshStandardMaterialMap",new Map),K(nt,"meshBasicMaterialMap",new Map),K(nt,"shaderMaterialMap",new Map),K(nt,"line2MaterialMap",new Map),K(nt,"mergeAttributeGraphicMaterial",null),K(nt,"mergeAttributeWallMaterial",null),K(nt,"mergeAttributeGraphicLineMaterial",null),K(nt,"instancedGraphicMaterial",null),K(nt,"instancedWallMaterial",null),K(nt,"lineDashedMaterialMap",new Map);var Le=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};K(Le,"keySet",new Set);function Ce(a,t,e){return new Promise((i,s)=>{let o=Le.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(Le.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}import{EventDispatcher as Hh}from"three";var Ri=class extends Hh{constructor(e=10,i){super();K(this,"max",10);K(this,"workerConstructor");K(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};function oo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",import.meta.url))}import{BufferGeometry as Nh,BufferAttribute as Un}from"three";var Te=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Nh;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Un(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Un(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ue(Ue({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ue(Ue({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};K(Te,"WorkerPool",new Ri(10,oo));var Gi=class extends H{getCenter(){return new Zh().setFromObject(this).getCenter(new no)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),D(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Se(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new Ye(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new le(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield Te.GetMergedGeometry(t);if(D(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new Ye(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield Te.GetMergedGeometryLine(t);if(D(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new le(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new jh().fromArray(r),c=new no,l=new Vh,p=new no;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new Hn,this.mergedLineGroup=new Hn,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Group as Yh,Mesh as qh,MeshBasicMaterial as $h,PlaneGeometry as Jh,Vector2 as Qh,Vector3 as ro,Raycaster as tc,Plane as ec}from"three";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.error.cause.js";import"core-js/modules/web.dom-collections.iterator.js";import{SRGBColorSpace as Kh,TextureLoader as Xh}from"three";var Fi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Kh,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Xh,t&&this.setBaseUrl(t)}};import{debounce as ic}from"lodash";var Nn={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},pe=class a extends H{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new tc,i=new Qh,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new ro(0,0,1),m=new ro(0,0,0),v=new ec().setFromNormalAndCoplanarPoint(u,m),g=new ro;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let E=v;E<=g;E++)for(let b=x;b<=M;b++)P.push({x:E,y:b,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new $h({map:c,transparent:!0}),p=new qh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new Jh(1,1),this.options=Nn,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=ic(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Nn,e),this.tileGroup=new Yh;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new Fi(this.options.base_url),this.initEvents(),this.updateTiles()}};pe.WORLD_WIDTH=4007501668e-2;pe.WORLD_WIDTH_HALF=pe.WORLD_WIDTH/2;import"core-js/modules/es.array.push.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.string.trim.js";import{Box2 as ao,Object3D as sc,Sprite as Zn,SpriteMaterial as jn,Vector2 as zi}from"three";import{isNil as qe,once as Bi}from"lodash";var oc={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},j=class extends sc{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!qe(t)&&!qe(e)&&!qe(i)&&!qe(s)&&!qe(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=Bi(this._initTextTexture),this.initTextTextureRect=Bi(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield J.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield J.getTextureByUrl(this.options.icon);let i=new Zn(new jn({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Zn(new jn({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new ao(new zi(s-n,o-this.iconHeight),new zi(s+n,o)),h=this.textWidth/2,c=new ao(new zi(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new zi(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new ao,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield U.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=Bi(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield U.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=Bi(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=fe(w({},oc,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var At=class extends co{getPosition(){return this.box.getCenter(new Wi)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new Y(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new ho().setFromObject(this).getCenter(new Wi)}addModel(t){let e=new Ci(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new ho().setFromObject(this.groundUpper),e=t.getCenter(new Wi),i=t.getSize(new Wi);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new j(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof Y)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Li,this.groundUpper=new co,this.models=new co,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new ho,this.groundLayer=new H(this.context),this.graphicLayer=new Ti(this.context),this.poiLayer=new ki(this.context),this.poiLayer2=new Di(this.context),this.parkingSpaceLayer=new Ai(this.context),this.wallLayer=new H(this.context),this.textureLayer=new H(this.context),this.glbModelLayer=new Oi(this.context),this.laneLayer=new H(this.context),this.mergeGraphicLayer=new Gi(this.context),this.textTextureLayer=new H(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};import{MeshBasicMaterial as nc,Object3D as rc,PlaneGeometry as ac,Texture as hc,Mesh as cc,Matrix3 as Vn,Vector2 as lc,FrontSide as pc}from"three";import{create as dc}from"@mars3d/heatmap.js";import{bbox as uc,center as mc}from"@turf/turf";var Ui=class extends rc{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=dc(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new ac(t,e),s=new hc(this.div.firstChild);s.needsUpdate=!0;let o=new nc({transparent:!0,side:pc,map:s});o.needsUpdate=!0,this.plane=new cc(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new Vn().makeScale(this.box.scale,-this.box.scale).multiply(new Vn().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new lc(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=uc(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=mc(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),D(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};import"core-js/modules/es.array.push.js";import"core-js/modules/web.dom-collections.iterator.js";import{EventDispatcher as fc,Vector3 as gc}from"three";var vt=class extends fc{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new gc(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return C(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=Zo(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Hi=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);se(this.circles[0],s.x,s.y),Mt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);se(this.circles[1],s.x,s.y),Mt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",Mt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];se(h,n,r),this.points.length||Mt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[He(e.radius,e.fill),He(e.radius,e.fill)],this.line=ui(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};import"core-js/modules/es.array.push.js";var Ni=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&se(this.circles[i],s.x,s.y),i!==0&&Mt(this.lines[i-1],void 0,s),this.lines[i]&&Mt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Mt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=He(r,n);se(c,s,o),this.addCircle(c)}if(this.lines.length&&Mt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ui(h);Mt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};import{Box3 as yc}from"three";var Kn=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new yc().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=C(r,s,o,n),l=C(h,s,o,n);ot(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let b=0;b<g.length;b++)ot(this.cornerRect[b],g[b].x,g[b].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,E=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let b=0;b<E.length;b++)ot(this.centerRect[b],E[b].x,E[b].y,x*2,x*2)}else{ot(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)ot(this.cornerRect[i],0,0,0,0),ot(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=qt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=qt(e.stroke,"#ffffff"),this.centerRect[i]=qt(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};import"core-js/modules/es.array.push.js";import{BufferGeometry as vc,Color as lo,LineSegments as xc,Mesh as wc,Object3D as Mc,ShaderMaterial as _c,Vector3 as Xn}from"three";import{mergeGeometries as Pc}from"three/examples/jsm/utils/BufferGeometryUtils.js";var Zi=class extends Mc{initGeometry(){return f(this,null,function*(){let t=yield Pt.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
436
|
+
`;return this.instancedWallMaterial=new Ee({vertexShader:t,fragmentShader:e,transparent:!0})}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear(),this.mergeAttributeGraphicMaterial&&(this.mergeAttributeGraphicMaterial.dispose(),this.mergeAttributeGraphicMaterial=null),this.mergeAttributeWallMaterial&&(this.mergeAttributeWallMaterial.dispose(),this.mergeAttributeWallMaterial=null),this.mergeAttributeGraphicLineMaterial&&(this.mergeAttributeGraphicLineMaterial.dispose(),this.mergeAttributeGraphicLineMaterial=null),this.instancedGraphicMaterial&&(this.instancedGraphicMaterial.dispose(),this.instancedGraphicMaterial=null),this.instancedWallMaterial&&(this.instancedWallMaterial.dispose(),this.instancedWallMaterial=null)}};K(nt,"lineMaterialMap",new Map),K(nt,"meshStandardMaterialMap",new Map),K(nt,"meshBasicMaterialMap",new Map),K(nt,"shaderMaterialMap",new Map),K(nt,"line2MaterialMap",new Map),K(nt,"mergeAttributeGraphicMaterial",null),K(nt,"mergeAttributeWallMaterial",null),K(nt,"mergeAttributeGraphicLineMaterial",null),K(nt,"instancedGraphicMaterial",null),K(nt,"instancedWallMaterial",null),K(nt,"lineDashedMaterialMap",new Map);var Le=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};K(Le,"keySet",new Set);function Ce(a,t,e){return new Promise((i,s)=>{let o=Le.genUniqueKey(),n=({data:r})=>{r.type===`${t}_result`&&r.key===o&&(Le.removeKey(o),self.removeEventListener("message",n),r.error?s(r.error):i(r.data))};a.addEventListener("message",n),a.postMessage({type:t,key:o,data:e})})}import{EventDispatcher as Hh}from"three";var Ri=class extends Hh{constructor(e=10,i){super();K(this,"max",10);K(this,"workerConstructor");K(this,"pool",[]);this.max=e,this.workerConstructor=i}getWorker(){return new Promise(e=>{let i=this.pool.find(o=>o.state==="leisure");if(i){i.state="used",e(i.worker);return}if(this.pool.length<this.max&&this.workerConstructor){let o=this.workerConstructor();this.pool.push({worker:o,state:"used"}),e(o);return}let s=()=>{let o=this.pool.find(n=>n.state==="leisure");o&&(this.removeEventListener("release",s),o.state="used",e(o.worker))};this.addEventListener("release",s)})}releaseWorker(e){let i=this.pool.find(s=>s.worker===e);i&&(i.state="leisure",this.dispatchEvent({type:"release",worker:e}))}dispose(){this._listeners={},this.pool.forEach(e=>{e.worker.terminate()}),this.pool=[]}};function oo(){return new Worker(new URL("./worker/merge-geometry.worker-S6YLXRL5.js",import.meta.url))}import{BufferGeometry as Nh,BufferAttribute as Un}from"three";var Te=class{static GetMergeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedShapeGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetMergedTexture2dGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),s=this.GetBufferGeometryByData(i);return this.WorkerPool.releaseWorker(e),s})}static GetBufferGeometryByData(t){let e=new Nh;return Object.keys(t.attributes).forEach(i=>{e.setAttribute(i,new Un(t.attributes[i].array,t.attributes[i].itemSize))}),t.index&&e.setIndex(new Un(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ue(Ue({},t[0]),i):null})}static GetMergedGeometryLine(t){return f(this,null,function*(){let e=yield this.WorkerPool.getWorker(),i=yield Ce(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),i?Ue(Ue({},t[0]),i):null})}static dispose(){this.WorkerPool.dispose()}};K(Te,"WorkerPool",new Ri(10,oo));var Gi=class extends H{getCenter(){return new Zh().setFromObject(this).getCenter(new no)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),D(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Se(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(i=>{this.graphicDataMap.set(i.id,i),this.graphicOriginOptionMap.set(i.id,{fillOpacity:i.fillOpacity,strokeOpacity:i.strokeOpacity})}),e?e.map(i=>{if(i.instancedGeometry&&this.addInstancedGraphic(i.instancedGeometry),i.mergedGeometry){let s=new Ye(this.context,w({},i,{lineGeometry:null}));this.mergedGraphicGroup.add(s)}if(i.lineGeometry){let s=new le(this.context,i.lineGeometry);this.mergedLineGroup.add(s)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return f(this,null,function*(){let e=yield Te.GetMergedGeometry(t);if(D(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let i=new Ye(this.context,e);this.mergedGraphicGroup.add(i)}})}createLine(t){return f(this,null,function*(){let e=yield Te.GetMergedGeometryLine(t);if(D(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let i=new le(this.context,e.lineGeometry);this.mergedLineGroup.add(i)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var i;return!((i=this.instancedGraphicConfig)!=null&&i.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let i=this.instancedGraphicConfig.ids.findIndex(s=>s===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(i*3,3),this.instancedGraphicConfig.matrixes.splice(i*16,16),this.instancedGraphicConfig.opacities.splice(i,1),this.instancedGraphicConfig.maxZs.splice(i,1),this.instancedGraphicConfig.ids.splice(i,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var i;let s,o=this.graphicDataMap.get(t);if(o){if(typeof e=="function"?s=e(o):s=w({},o,e),this.graphicDataMap.set(t,s),(i=this.instancedGraphicConfig)!=null&&i.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,s.fillColor),this.instancedGraphic.setOpacityById(t,s.fillOpacity),this.instancedGraphic.setMaxZById(t,s.deltaHeight+s.airHeight+s.height);let n=this.instancedGraphicConfig.ids.findIndex(d=>d===t),r=this.instancedGraphicConfig.matrixes.slice(n*16,(n+1)*16),h=new jh().fromArray(r),c=new no,l=new Vh,p=new no;h.decompose(c,l,p),p.z=s.height,c.z=s.deltaHeight+s.airHeight+s.height/2,h.compose(c,l,p),this.instancedGraphic.setMatrixById(t,h)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var i;this.graphicDataMap.forEach((s,o)=>{if(e)s.fillOpacity=t,s.strokeOpacity=t;else{let h=this.graphicOriginOptionMap.get(o);var n;s.fillOpacity=Math.min(t,(n=h==null?void 0:h.fillOpacity)!=null?n:1);var r;s.strokeOpacity=Math.min(t,(r=h==null?void 0:h.strokeOpacity)!=null?r:1)}}),(i=this.instancedGraphic)==null||i.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new Hn,this.mergedLineGroup=new Hn,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Group as Yh,Mesh as qh,MeshBasicMaterial as $h,PlaneGeometry as Jh,Vector2 as Qh,Vector3 as ro,Raycaster as tc,Plane as ec}from"three";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.error.cause.js";import"core-js/modules/web.dom-collections.iterator.js";import{SRGBColorSpace as Kh,TextureLoader as Xh}from"three";var Fi=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return f(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,i){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+i+"/"+t+"/"+e+".png"}loadTileTexture(t,e,i){return f(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let s=this.buildTileUrl(t,e,i);if(this.textureCache.has(s)){let n=this.textureCache.get(s);return n instanceof Promise?n:Promise.resolve(n)}let o=this.textureLoader.loadAsync(s).then(n=>(n.flipY=!0,n.colorSpace=Kh,this.textureCache.set(s,n),n)).catch(n=>null);return this.textureCache.set(s,o),o})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new Xh,t&&this.setBaseUrl(t)}};import{debounce as ic}from"lodash";var Nn={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},pe=class a extends H{loadTileConfig(){return f(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new tc,i=new Qh,s=[],[o,n]=this.context.center||[0,0],r=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let d of r){i.set(d.x,d.y),e.setFromCamera(i,t);let u=new ro(0,0,1),m=new ro(0,0,0),v=new ec().setFromNormalAndCoplanarPoint(u,m),g=new ro;e.ray.intersectPlane(v,g)?s.push(g):(e.ray.direction.negate(),e.ray.intersectPlane(v,g)&&s.push(g))}if(s.length<4)return null;let h=1/0,c=1/0,l=-1/0,p=-1/0;return s.forEach(d=>{h=Math.min(h,d.x+o),c=Math.min(c,d.y+n),l=Math.max(l,d.x+o),p=Math.max(p,d.y+n)}),{minX:h,minY:c,maxX:l,maxY:p}}getTileZoomLevel(t,e){let{minZoom:i,maxZoom:s}=e,o=this.context.camera,n=(o.right-o.left)/o.zoom,r=this.context.clientSize.width,h=n/r,c=a.WORLD_WIDTH,l=Math.log2(c/(h*this.tileSize));return Math.min(s,Math.max(i,Math.round(l)))}getTilesInView(t,e,i){let[s,o,n,r]=i.extent,h=Math.max(t.minX,s),c=Math.max(t.minY,o),l=Math.min(t.maxX,n),p=Math.min(t.maxY,r);if(h>=l||c>=p)return[];let d=Math.pow(2,e),u=a.WORLD_WIDTH/d,m=a.WORLD_WIDTH_HALF,v=Math.max(0,Math.floor((h+m)/u)),g=Math.floor((l+m)/u),x=Math.max(0,Math.floor((m-p)/u)),M=Math.floor((m-c)/u),P=[];for(let E=v;E<=g;E++)for(let b=x;b<=M;b++)P.push({x:E,y:b,z:e});return P}renderTiles(t,e){return f(this,null,function*(){let i=t,s=[];if(this.currentLevel!==e)s=[...this.tileGroup.children];else{let r=this.tileGroup.children,h=r.map(l=>l.userData.key),c=t.map(l=>l.z+"/"+l.x+"/"+l.y);i=t.filter(l=>!h.includes(l.z+"/"+l.x+"/"+l.y)),s=r.filter(l=>!c.includes(l.userData.key))}let o=Math.pow(2,e),n=a.WORLD_WIDTH/o;yield Promise.all(i.map(r=>f(this,null,function*(){let h=r.z+"/"+r.x+"/"+r.y,c=yield this.tileLoader.loadTileTexture(r.x,r.y,r.z);if(c){let l=new $h({map:c,transparent:!0}),p=new qh(this.baseGeometry,l);p.scale.setX(n).setY(n),p.position.set((r.x-o/2)*n+n/2,-((r.y-o/2)*n)-n/2,0),p.userData.key=h,this.tileGroup.add(p)}}))),this.tileGroup.children.forEach(r=>{s.includes(r)&&(r.material.dispose(),this.tileGroup.remove(r))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new Jh(1,1),this.options=Nn,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:s}=this.context;this.tileGroup.position.set(-s[0],-s[1],0),this.updateTiles()},this.updateTiles=ic(()=>f(this,null,function*(){if(!this.visible)return;let s=yield this.loadTileConfig(),o=this.context.camera,n=this.getViewBounds();if(!n)return;let r=this.getTileZoomLevel(o.zoom,s),h=this.getTilesInView(n,r,s);this.renderTiles(h,r)}),100),this.options=w({},Nn,e),this.tileGroup=new Yh;let{center:i}=t;this.tileGroup.position.set(-i[0],-i[1],0),this.add(this.tileGroup),this.tileLoader=new Fi(this.options.base_url),this.initEvents(),this.updateTiles()}};pe.WORLD_WIDTH=4007501668e-2;pe.WORLD_WIDTH_HALF=pe.WORLD_WIDTH/2;import"core-js/modules/es.array.push.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.string.trim.js";import{Box2 as ao,Object3D as sc,Sprite as Zn,SpriteMaterial as jn,Vector2 as zi}from"three";import{isNil as qe,once as Bi}from"lodash";var oc={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1,icon_alpha_test:.2,text_alpha_test:.2},j=class extends sc{get textTexture(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureMap[e])==null?void 0:t.texture)!=null?i:null}get textTextureRect(){let t=this.options.text;var e;return t&&(e=this.textTextureRectMap[t])!=null?e:null}get textureLines(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.lines)!=null?i:1}get textAspect(){var t;let e=this.options.text;var i;return e&&(i=(t=this.textTextureRectMap[e])==null?void 0:t.aspect)!=null?i:1}get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:i,text_texture_offset_x:s,text_texture_offset_y:o}=this.options;return!qe(t)&&!qe(e)&&!qe(i)&&!qe(s)&&!qe(o)}get initedTextRect(){return!this.options.text||this.options.text&&this.textTextureRect}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return f(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>f(this,null,function*(){let{value:e}=t;this.initTextTexture=Bi(this._initTextTexture),this.initTextTextureRect=Bi(this._initTextTextureRect),this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>f(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.options.text&&this.context.forceUpdate()})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.initSize(),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return f(this,null,function*(){if(this.options.icon)return new Promise(t=>f(this,null,function*(){let e;if(this.options.icon_border){let{icon:s,icon_size:o,icon_border:n}=this.options;e=yield J.getUrlTextureBorder(s,o[0]-n.width*2,n)}else e=yield J.getTextureByUrl(this.options.icon);let i=new Zn(new jn({map:e,transparent:!0,alphaTest:this.options.icon_alpha_test,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));i.visible=!1,i.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}))})}initText(){return f(this,null,function*(){if(this.hasText){let t=this.textTexture;t||(yield this.initTextTexture()),t=this.textTexture;let e=new Zn(new jn({map:t,transparent:!0,alphaTest:this.options.text_alpha_test,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let i=0,s=0,{icon:o}=this.options;o?this.hasText?(i=0,s=i*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(i=.5,s=0):this.hasText?(s=.5,i=0):(i=0,s=0),(t=this.spriteIcon)==null||t.center.set(.5,i),(e=this.spriteText)==null||e.center.set(.5,s)}init(){return f(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.initedTextRect)return this.initTextTextureRect(),null;let{clientSize:{width:e,height:i}}=this.context,s=e*(t.x+1)/2,o=i*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let n=this.iconWidth/2,r=new ao(new zi(s-n,o-this.iconHeight),new zi(s+n,o)),h=this.textWidth/2,c=new ao(new zi(s-h,o-this.textHeight-this.durIconAndText-this.iconHeight),new zi(s+h,o-this.iconHeight-this.durIconAndText));return this.box=c.union(r),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let i=document.createElement("div");i.style.position="absolute",i.style.zIndex="999",i.style.border="1px solid red",i.style.pointerEvents="none",this.boxHelper=i,this.context.container.appendChild(i)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}setVisible(t){this.visible=t,this.context.forceUpdate()}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.textTextureMap={},this.unRegistryEvent(),this._listeners={}}constructor(t,e){var i;super(),this.context=t,this.box=new ao,this._shouldShow=!1,this.textTextureMap={},this.textTextureRectMap={},this._initTextTexture=()=>f(this,null,function*(){if(!this.options.text||this.textTextureMap[this.options.text])return;let o;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:h,text_texture_offset_x:c,text_texture_offset_y:l}=this.options;o=this.options.text_texture.clone(),o.uuid=n.uuid,o.offset.set(c/o.image.width,1-(h+l)/o.image.height),o.repeat.set(r/o.image.width,h/o.image.height),this.textTextureMap[this.options.text]={texture:o,lines:1,textAspect:r/h}}else{let n=yield U.getTextureByText(this.options.text);this.textTextureMap[this.options.text]=w({},n,{textAspect:n.texture.image.width/n.texture.image.height})}this.dispatchEvent({type:"text-texture-inited"})}),this.initTextTexture=Bi(this._initTextTexture),this._initTextTextureRect=()=>f(this,null,function*(){if(!this.options.text||this.textTextureRectMap[this.options.text])return;let o=yield U.getTextureRectByTexts(this.options.text);this.textTextureRectMap[this.options.text]=w({},o,{aspect:o.width/o.height}),this.dispatchEvent({type:"text-texture-rect-inited"})}),this.initTextTextureRect=Bi(this._initTextTextureRect),this._initScale=o=>{let{zoom:n}=o;if(this.spriteText){let h=this.textHeight/n;this.spriteText.scale.set(this.textAspect*h,h,.1)}if(this.spriteIcon){var r;(r=this.spriteIcon)==null||r.scale.set(this.options.icon_size[0]/n,this.options.icon_size[1]/n,.1)}this.resetZ()};var s;this.options=fe(w({},oc,e,{text:(s=(i=e.text)==null?void 0:i.trim())!=null?s:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var At=class extends co{getPosition(){return this.box.getCenter(new Wi)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new Y(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new ho().setFromObject(this).getCenter(new Wi)}addModel(t){let e=new Ci(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new ho().setFromObject(this.groundUpper),e=t.getCenter(new Wi),i=t.getSize(new Wi);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new j(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof Y)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Li,this.groundUpper=new co,this.models=new co,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new ho,this.groundLayer=new H(this.context),this.graphicLayer=new Ti(this.context),this.poiLayer=new ki(this.context),this.poiLayer2=new Di(this.context),this.parkingSpaceLayer=new Ai(this.context),this.wallLayer=new H(this.context),this.textureLayer=new H(this.context),this.glbModelLayer=new Oi(this.context),this.laneLayer=new H(this.context),this.mergeGraphicLayer=new Gi(this.context),this.textTextureLayer=new H(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};import{MeshBasicMaterial as nc,Object3D as rc,PlaneGeometry as ac,Texture as hc,Mesh as cc,Matrix3 as Vn,Vector2 as lc,FrontSide as pc}from"three";import{create as dc}from"@mars3d/heatmap.js";import{bbox as uc,center as mc}from"@turf/turf";var Ui=class extends rc{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:i,height:s,leftTop:o,center:n,scale:r}=this.box,h=((e=this.context.config.heatMap)==null?void 0:e.radius)||1,c=w({width:i,height:s,container:this.div},this.context.config.heatMap,{radius:h});this.heatmap=dc(c);let l=this.transformData(t,o,r);t.maxValue!==void 0&&(l.max=t.maxValue),t.minValue!==void 0&&(l.min=t.minValue),this.heatmap.setData(l),this.initPlane(i/r,s/r);let p=this.context.center;this.position.set(n[0]-p[0],n[1]-p[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new ac(t,e),s=new hc(this.div.firstChild);s.needsUpdate=!0;let o=new nc({transparent:!0,side:pc,map:s});o.needsUpdate=!0,this.plane=new cc(i,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:i}=t;return new Vn().makeScale(this.box.scale,-this.box.scale).multiply(new Vn().makeTranslation(-e,-i))}transformData(t,e,i){var s,o;let n=this.getTransMatrix(e);var r;let h=(r=(s=t.data[0])==null?void 0:s.value)!=null?r:0;var c;let l=(c=(o=t.data[0])==null?void 0:o.value)!=null?c:0;return{data:t.data.map(d=>{let u=new lc(d.x,d.y).applyMatrix3(n);return d.value>h&&(h=d.value),d.value<l&&(l=d.value),{x:Math.ceil(u.x),y:Math.ceil(u.y),value:d.value}}),max:h,min:l}}getBox(){let t=this.context.range,e=uc(t),i=Math.ceil(e[2]-e[0]),s=Math.ceil(e[3]-e[1]),o=4e3,n=4e3,r=o/i,h=n/s,c=Math.min(r,h);this.scaleRatio=c;let l=i*c,p=s*c,d={x:Math.ceil(e[0]),y:Math.ceil(e[3])},u=mc(t).geometry.coordinates;return{width:l,height:p,leftTop:d,center:u,scale:c}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),D(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};import"core-js/modules/es.array.push.js";import"core-js/modules/web.dom-collections.iterator.js";import{EventDispatcher as fc,Vector3 as gc}from"three";var vt=class extends fc{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:s,offsetY:o}=t,{clientWidth:n,clientHeight:r}=i.domElement,h=s/n*2-1,c=1-o/r*2;return new gc(h,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return C(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:i,height:s}=e;this.svg&&(this.svg.setAttribute("width",""+i),this.svg.setAttribute("height",""+s))},this.svg=Zo(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Hi=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:s}]=this.points;return Math.sqrt((i-t)**2+(s-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let s=this.getSvgCoordinate(this.points[0]);se(this.circles[0],s.x,s.y),Mt(this.line,s)}if(this.points[1]){let s=this.getSvgCoordinate(this.points[1]);se(this.circles[1],s.x,s.y),Mt(this.line,void 0,s)}},this.onPointermove=s=>{this.points.length===1&&(this.line.style.display="block",Mt(this.line,void 0,{x:s.offsetX,y:s.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=s=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(s);if(o){let{offsetX:n,offsetY:r}=s,h=this.circles[this.points.length];se(h,n,r),this.points.length||Mt(this.line,{x:n,y:r},{x:n,y:r}),this.addPoint(o)}};let{config:{svg:{circle:e,line:i}}}=t;this.circles=[He(e.radius,e.fill),He(e.radius,e.fill)],this.line=ui(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};import"core-js/modules/es.array.push.js";var Ni=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let i=this.circles[0],s=+i.getAttribute("cx"),o=+i.getAttribute("cy");return Math.sqrt((t-s)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(s=>[s.x,s.y]),e=0,i=t.length;for(let s=0;s<i;s++){let o=(s+1)%i;e+=t[s][0]*t[o][1]-t[o][0]*t[s][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,i)=>{let s=this.getSvgCoordinate(e);this.circles[i]&&se(this.circles[i],s.x,s.y),i!==0&&Mt(this.lines[i-1],void 0,s),this.lines[i]&&Mt(this.lines[i],s)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Mt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let i=this.getIntersectByPointerEvent(e);if(i){let{offsetX:s,offsetY:o}=e;this.checkAdsorb(s,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(i);let{circle:{fill:n,radius:r},line:{stroke:h}}=this.context.config.svg;if(!this.isClose){let c=He(r,n);se(c,s,o),this.addCircle(c)}if(this.lines.length&&Mt(this.lastLine,void 0,{x:s,y:o}),!this.isClose){let c=ui(h);Mt(c,{x:s,y:o},{x:s,y:o}),this.addLine(c)}}},this.registryEvent()}};import{Box3 as yc}from"three";var Kn=class extends vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let i=new yc().setFromObject(this.graphic),{camera:s,container:{clientWidth:o,clientHeight:n}}=this.context,{min:r,max:h}=i,c=C(r,s,o,n),l=C(h,s,o,n);ot(this.rect,c.x,l.y,Math.abs(l.x-c.x),Math.abs(l.y-c.y));let{x:p,y:d}=c,{x:u,y:m}=l,v=5,g=[{x:p-v,y:m-v},{x:u-v,y:m-v},{x:p-v,y:d-v},{x:u-v,y:d-v}];for(let b=0;b<g.length;b++)ot(this.cornerRect[b],g[b].x,g[b].y,v*2,v*2);let x=4,M=(p+u)/2,P=(d+m)/2,E=[{x:M-x,y:m-x},{x:p-x,y:P-x},{x:u-x,y:P-x},{x:M-x,y:d-x}];for(let b=0;b<E.length;b++)ot(this.centerRect[b],E[b].x,E[b].y,x*2,x*2)}else{ot(this.rect,0,0,0,0);for(let i=0;i<this.cornerRect.length;i++)ot(this.cornerRect[i],0,0,0,0),ot(this.centerRect[i],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=qt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=qt(e.stroke,"#ffffff"),this.centerRect[i]=qt(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}};import"core-js/modules/es.array.push.js";import{BufferGeometry as vc,Color as lo,LineSegments as xc,Mesh as wc,Object3D as Mc,ShaderMaterial as _c,Vector3 as Xn}from"three";import{mergeGeometries as Pc}from"three/examples/jsm/utils/BufferGeometryUtils.js";var Zi=class extends Mc{initGeometry(){return f(this,null,function*(){let t=yield Pt.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
437
437
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
438
438
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
439
439
|
uniform vec3 uColor;
|
package/lib/meta.json
CHANGED
|
@@ -2972,7 +2972,7 @@
|
|
|
2972
2972
|
"format": "esm"
|
|
2973
2973
|
},
|
|
2974
2974
|
"../lib/src/elements/poi2.js": {
|
|
2975
|
-
"bytes":
|
|
2975
|
+
"bytes": 16947,
|
|
2976
2976
|
"imports": [
|
|
2977
2977
|
{
|
|
2978
2978
|
"path": "../../../node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_extends.js",
|
|
@@ -9527,7 +9527,7 @@
|
|
|
9527
9527
|
"bytesInOutput": 1595
|
|
9528
9528
|
},
|
|
9529
9529
|
"../lib/src/elements/poi2.js": {
|
|
9530
|
-
"bytesInOutput":
|
|
9530
|
+
"bytesInOutput": 8928
|
|
9531
9531
|
},
|
|
9532
9532
|
"../lib/src/elements/heatmap.js": {
|
|
9533
9533
|
"bytesInOutput": 2123
|
|
@@ -9764,7 +9764,7 @@
|
|
|
9764
9764
|
"bytesInOutput": 575
|
|
9765
9765
|
}
|
|
9766
9766
|
},
|
|
9767
|
-
"bytes":
|
|
9767
|
+
"bytes": 406133
|
|
9768
9768
|
}
|
|
9769
9769
|
}
|
|
9770
9770
|
}
|