@openglobus/openglobus-react 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -21
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -642,7 +642,7 @@ vec2 project(vec4 p,vec2 viewport){return(0.5*p.xyz/p.w+0.5).xy*viewport;}mat2 r
|
|
|
642
642
|
</g>
|
|
643
643
|
</g>
|
|
644
644
|
</svg>`});a.appendTo(this.renderer.div),a.events.on("change",e=>{e?this.onactivate():this.ondeactivate()})}},ScaleControl:xa,Selection:class extends ee{constructor(a={}){super(a),this._selectorScene=new uh({name:`selectionScene:${this.__id}`,ignoreTerrain:a.ignoreTerrain,onSelect:a.onSelect,autoSelectionHide:a.autoSelectionHide}),this._toggleBtn=new _e({classList:["og-map-button","og-selection_button"],icon:`<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
645
|
-
<svg width="800px" height="800px" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--gis" preserveAspectRatio="xMidYMid meet"><path d="M2.1 0v1.914H0v6h3V3h5.1V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h1.8v1.2h3V0h-4.8zm1.8 7.2v6h3v-6h-3zM0 10.913v6h3v-6H0zM66.9 16.2v6h3v-6h-3zM0 19.914v6h3v-6H0zM66.9 25.2v6h3v-6h-3zM0 28.914v6h3v-6H0zM66.9 34.2v6h3v-6h-3zM0 37.914v6h3v-6H0zM66.9 43.2v6h3v-6h-3zM0 46.914v6h3v-6H0zM66.9 52.2v6h3v-6h-3zM0 55.914v5.191h3.809v-3H3v-2.19H0zm6.809 2.191v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9.648 1.899a2.076 2.076 0 0 0-2.19 2.324l3.137 33.676c.2 1.635 2.135 2.399 3.397 1.34l6.623-5.371l2.969 5.142c1.707 2.958 4.417 3.684 7.375 1.977c2.957-1.708 3.684-4.417 1.976-7.375l-2.959-5.125l7.848-3.008c1.548-.564 1.855-2.62.539-3.611L71.576 60.416a2.073 2.073 0 0 0-1.119-.412z" fill="#000000"></path></svg>`})}set ignoreTerrain(a){this._selectorScene.ignoreTerrain=a}oninit(){this._toggleBtn.appendTo(this.renderer.div),this._toggleBtn.events.on("change",a=>{a?this.activate():this.deactivate()}),this._selectorScene.bindPlanet(this.planet)}onactivate(){this.renderer.addNode(this._selectorScene)}ondeactivate(){this.renderer.removeNode(this._selectorScene)}},ShowFps:class extends ee{constructor(a){super(a)}oninit(){let a=document.createElement("div");a.className="defaultText ",a.id="ogShowFpsControl",document.body.appendChild(a),this.renderer.events.on("draw",this._draw,this)}_draw(){zs("ogShowFpsControl",(1e3/this.renderer.handler.deltaTime).toFixed(1),this.renderer.handler.canvas.clientWidth-60,0)}},SimpleNavigation:class extends ee{constructor(a={}){super({name:"SimpleNavigation",autoActivate:!0,...a}),this.
|
|
645
|
+
<svg width="800px" height="800px" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--gis" preserveAspectRatio="xMidYMid meet"><path d="M2.1 0v1.914H0v6h3V3h5.1V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h6V0h-6zm9 0v3h1.8v1.2h3V0h-4.8zm1.8 7.2v6h3v-6h-3zM0 10.913v6h3v-6H0zM66.9 16.2v6h3v-6h-3zM0 19.914v6h3v-6H0zM66.9 25.2v6h3v-6h-3zM0 28.914v6h3v-6H0zM66.9 34.2v6h3v-6h-3zM0 37.914v6h3v-6H0zM66.9 43.2v6h3v-6h-3zM0 46.914v6h3v-6H0zM66.9 52.2v6h3v-6h-3zM0 55.914v5.191h3.809v-3H3v-2.19H0zm6.809 2.191v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9 0v3h6v-3h-6zm9.648 1.899a2.076 2.076 0 0 0-2.19 2.324l3.137 33.676c.2 1.635 2.135 2.399 3.397 1.34l6.623-5.371l2.969 5.142c1.707 2.958 4.417 3.684 7.375 1.977c2.957-1.708 3.684-4.417 1.976-7.375l-2.959-5.125l7.848-3.008c1.548-.564 1.855-2.62.539-3.611L71.576 60.416a2.073 2.073 0 0 0-1.119-.412z" fill="#000000"></path></svg>`})}set ignoreTerrain(a){this._selectorScene.ignoreTerrain=a}oninit(){this._toggleBtn.appendTo(this.renderer.div),this._toggleBtn.events.on("change",a=>{a?this.activate():this.deactivate()}),this._selectorScene.bindPlanet(this.planet)}onactivate(){this.renderer.addNode(this._selectorScene)}ondeactivate(){this.renderer.removeNode(this._selectorScene)}},ShowFps:class extends ee{constructor(a){super(a)}oninit(){let a=document.createElement("div");a.className="defaultText ",a.id="ogShowFpsControl",document.body.appendChild(a),this.renderer.events.on("draw",this._draw,this)}_draw(){zs("ogShowFpsControl",(1e3/this.renderer.handler.deltaTime).toFixed(1),this.renderer.handler.canvas.clientWidth-60,0)}},SimpleNavigation:class extends ee{constructor(a={}){super({name:"SimpleNavigation",autoActivate:!0,...a}),this.focusVel=0,this.focusForce=0,this._nx=0,this._ny=0,this._onMouseLeftButtonDown=e=>{this._active&&this.renderer&&(this.stop(),this.renderer.handler.canvas.classList.add("ogGrabbingPoiner"),this._grabbedPoint=this.renderer.getCartesianFromPixel(e),this._grabbedScreenPoint.set(e.nx,e.ny),this._grabbedPoint&&this._eye0.copy(this.renderer.activeCamera.eye))},this._onMouseLeftButtonUp=e=>{this.renderer.handler.canvas.classList.remove("ogGrabbingPoiner"),e.x===e.prev_x&&(e.y,e.prev_y)},this._onMouseLeftButtonHold=e=>{if(this.renderer&&this._grabbedPoint&&e.moving){let t=this.renderer.activeCamera;if(t.isOrthographic){let i=e.nx-this._grabbedScreenPoint.x,r=e.ny-this._grabbedScreenPoint.y,s=t.frustum,n=-(s.right-s.left)*i,o=(s.top-s.bottom)*r,l=t.getUp().scale(o),h=t.getRight().scale(n);t.eye=this._eye0.add(h.add(l))}else{let i,r,s=Math.abs(t.getForward().dot(m.UP)),n=this._grabbedPoint;s>.7?(i=m.add(n,m.LEFT),r=m.add(n,t.getRight())):(i=m.add(n,t.getRight()),r=m.add(n,m.UP));let o=new m;new H(t.eye,e.direction).hitPlaneRes(we.fromPoints(n,i,r),o)===H.INSIDE&&(t.eye=t.eye.add(n.sub(o)))}t.update()}},this._onRHold=e=>{if(this._lookPos&&e.moving&&this.renderer){const t=this.renderer.activeCamera;this.renderer.controlsBag.scaleRot=1;let i=.5/t.eye.distance(this._lookPos)*U;i>.007?i=.007:i<.003&&(i=.003),t.rotateHorizontal(i*(e.x-e.prev_x),!1,this._lookPos,this._up),t.rotateVertical(i*(e.y-e.prev_y),this._lookPos),t.update()}},this._onRDown=e=>{if(this.renderer)if(this.stop(),this._lookPos=void 0,this._lookPos=this.renderer.getCartesianFromPixel(e.pos),this._lookPos)this._up=m.UP;else{const t=this.renderer.activeCamera;let i=new we(m.ZERO,m.UP),r=new H(t.eye,e.direction);this._lookPos=new m,r.hitPlaneRes(i,this._lookPos),this._up=m.UP}},this._onMouseWheel=e=>{if(this.renderer){let t=this.renderer.activeCamera;if(t.isOrthographic){let i=t.frustums[0],r=-(i.right-i.left)*(.5-e.nx),s=(i.top-i.bottom)*(.5-e.ny),n=t.getUp().scale(s),o=t.getRight().scale(r),l=t.eye.add(o.add(n));this._wheelPos=l.add(t.getForward()),this._wheelDist=1,this._nx=e.nx,this._ny=e.ny,this.focusForce=.05*e.wheelDelta}else{let i=this.renderer.getCartesianFromPixel(e);if(!i){i=new m;let n=new we(m.ZERO,m.UP);new H(t.eye,e.direction).hitPlaneRes(n,i)}let r=i.sub(t.eye).normalize(),s=8*t.eye.distance(i);this.force.addA(r.scale(e.wheelDelta)).normalize().scale(s)}}},this.onCameraMoveForward=()=>{this.force.addA(this.renderer.activeCamera.getForward()).normalize()},this.onCameraMoveBackward=()=>{this.force.addA(this.renderer.activeCamera.getBackward()).normalize()},this.onCameraStrifeLeft=()=>{this.force.addA(this.renderer.activeCamera.getLeft()).normalize()},this.onCameraStrifeRight=()=>{this.force.addA(this.renderer.activeCamera.getRight()).normalize()},this.onCameraLookUp=()=>{this.renderer.activeCamera.update()},this.onCameraLookDown=()=>{this.renderer.activeCamera.update()},this.onCameraTurnLeft=()=>{this.renderer.activeCamera.update()},this.onCameraTurnRight=()=>{this.renderer.activeCamera.update()},this.onCameraRollLeft=()=>{this.renderer.activeCamera.update()},this.onCameraRollRight=()=>{this.renderer.activeCamera.update()},this.speed=a.speed||1,this.force=new m,this.vel=new m,this.mass=1,this._lookPos=void 0,this._grabbedPoint=void 0,this._grabbedScreenPoint=new N,this._up=null,this._eye0=new m,this._wheelDist=0,this._wheelPos=new m}oninit(){}onactivate(){super.onactivate();let a=this.renderer;a.activeCamera.isOrthographic&&a.getDepthMinDistanceAsync().then(e=>{a.activeCamera.focusDistance=e}),a.events.on("mousewheel",this._onMouseWheel),a.events.on("keypress",W.KEY_W,this.onCameraMoveForward,this),a.events.on("keypress",W.KEY_S,this.onCameraMoveBackward,this),a.events.on("keypress",W.KEY_A,this.onCameraStrifeLeft,this),a.events.on("keypress",W.KEY_D,this.onCameraStrifeRight,this),a.events.on("keypress",W.KEY_UP,this.onCameraLookUp,this),a.events.on("keypress",W.KEY_DOWN,this.onCameraLookDown,this),a.events.on("keypress",W.KEY_LEFT,this.onCameraTurnLeft,this),a.events.on("keypress",W.KEY_RIGHT,this.onCameraTurnRight,this),a.events.on("keypress",W.KEY_Q,this.onCameraRollLeft,this),a.events.on("keypress",W.KEY_E,this.onCameraRollRight,this),a.events.on("rhold",this._onRHold,this),a.events.on("rdown",this._onRDown,this),a.events.on("lhold",this._onMouseLeftButtonHold),a.events.on("ldown",this._onMouseLeftButtonDown),a.events.on("lup",this._onMouseLeftButtonUp),a.events.on("draw",this.onDraw,this,-1e3)}ondeactivate(){super.ondeactivate();let a=this.renderer;a.events.off("mousewheel",this._onMouseWheel),a.events.off("keypress",W.KEY_W,this.onCameraMoveForward),a.events.off("keypress",W.KEY_S,this.onCameraMoveBackward),a.events.off("keypress",W.KEY_A,this.onCameraStrifeLeft),a.events.off("keypress",W.KEY_D,this.onCameraStrifeRight),a.events.off("keypress",W.KEY_UP,this.onCameraLookUp),a.events.off("keypress",W.KEY_DOWN,this.onCameraLookDown),a.events.off("keypress",W.KEY_LEFT,this.onCameraTurnLeft),a.events.off("keypress",W.KEY_RIGHT,this.onCameraTurnRight),a.events.off("keypress",W.KEY_Q,this.onCameraRollLeft),a.events.off("keypress",W.KEY_E,this.onCameraRollRight),a.events.off("rhold",this._onRHold),a.events.off("rdown",this._onRDown),a.events.off("lhold",this._onMouseLeftButtonHold),a.events.off("ldown",this._onMouseLeftButtonDown),a.events.off("lup",this._onMouseLeftButtonUp),a.events.off("draw",this.onDraw)}_handleMouseWheel(){let a=this.renderer.activeCamera;if(a.isOrthographic&&Math.abs(this.focusVel)>.01){a.eye=this._wheelPos.add(a.getBackward().scale(this._wheelDist)),a.focusDistance-=a.focusDistance*this.focusVel*this.dt;let e=a.frustums[0],t=(e.right-e.left)*(.5-this._nx),i=-(e.top-e.bottom)*(.5-this._ny),r=a.getUp().scale(i),s=a.getRight().scale(t);a.eye.addA(s.add(r)),a.update()}else this.vel.length()>.01&&(a.eye=a.eye.add(this.vel.scaleTo(this.dt)),a.update())}onDraw(){this._updateVel(),this._handleMouseWheel()}get dt(){return .001*this.renderer.handler.deltaTime}_updateVel(){let a=this.force.scale(1/this.mass);this.vel.addA(a),this.vel.scale(.77),this.force.set(0,0,0),this.focusVel+=this.focusForce,this.focusVel*=.77,this.focusForce=0}stop(){this.focusVel=0,this.vel.clear()}},SimpleSkyBackground:ba,Sun:qr,TimelineControl:class extends ee{constructor(a={}){super({name:"timeline",...a});let e=a.current||new Date,t=a.rangeStart||La(e,-12),i=a.rangeEnd||La(e,12);this._timelineView=new xh({rangeStart:t,rangeEnd:i,currentDate:e}),this._toggleBtn=new _e({classList:["og-map-button","og-timeline_button"],icon:`<?xml version="1.0" encoding="utf-8"?>
|
|
646
646
|
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
|
|
647
647
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
648
648
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
|
@@ -937,5 +937,5 @@ vec3 Uncharted2ToneMapping(vec3 color){color*=exposure;return saturate(Uncharted
|
|
|
937
937
|
void main(void) {
|
|
938
938
|
float c = LinearizeDepth(tc);
|
|
939
939
|
fragColor = vec4(c, c, c, 1.0);
|
|
940
|
-
}`})]),this.sceneFramebuffer=new Qa(this.handler,{size:1,msaa:this._msaa,internalFormat:this._internalFormat,filter:"LINEAR"}),this.sceneFramebuffer.init(),this.blitFramebuffer=new Se(this.handler,{size:1,useDepth:!1,targets:[{internalFormat:this._internalFormat,format:this._format,type:this._type,filter:"NEAREST"}]}),this.blitFramebuffer.init(),this.toneMappingFramebuffer=new Se(this.handler,{useDepth:!1}),this.toneMappingFramebuffer.init(),this._fnScreenFrame=this._screenFrameMSAA,this.screenTexture={screen:this.toneMappingFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0],frustum:this.depthFramebuffer.textures[0]}}this.handler.ONCANVASRESIZE=()=>{this._resizeStart(),this.events.dispatch(this.events.resize,this.handler.canvas),this._resizeEnd(),this.events.dispatch(this.events.resizeend,this.handler.canvas)},this.screenFramePositionBuffer=this.handler.createArrayBuffer(new Float32Array([1,1,-1,1,1,-1,-1,-1]),2,4),this.outputTexture=this.screenTexture.screen,this._initializeRenderNodes(),this._initializeControls()}}_initializeControls(){let e=this.controls;this.controls={};for(let t in e)this.addControl(e[t])}resize(){this._resizeEnd()}setCurrentScreen(e){this._currentOutput=e,this.screenTexture[e]&&(this.outputTexture=this.screenTexture[e])}_resizeStart(){let e=this.handler.canvas;this.activeCamera.setViewportSize(e.width,e.height),this.sceneFramebuffer.setSize(.5*e.width,.5*e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(.5*e.width,.5*e.height,!0)}_resizeEnd(){let e=this.handler.canvas;this.activeCamera.setViewportSize(e.width,e.height),this.sceneFramebuffer.setSize(e.width,e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width,e.height,!0),this.toneMappingFramebuffer&&this.toneMappingFramebuffer.setSize(e.width,e.height,!0),this.screenDepthFramebuffer&&this.screenDepthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.handler.gl.type==="webgl"?(this.screenTexture.screen=this.sceneFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]):(this.screenTexture.screen=this.toneMappingFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]),this.setCurrentScreen(this._currentOutput)}removeNode(e){e.remove()}addNode(e){this.renderNodes[e.name]?Ke.logWrn(`Node name ${e.name} already exists.`):(e.assign(this),this._renderNodesArr.unshift(e),this.renderNodes[e.name]=e)}_initializeRenderNodes(){for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].initialize()}addNodeBefore(e,t){if(this.renderNodes[e.name])Ke.logWrn(`Node name ${e.name} already exists.`);else{e.assign(this),this.renderNodes[e.name]=e;for(let i=0;i<this._renderNodesArr.length;i++)if(this._renderNodesArr[i].isEqual(t)){this._renderNodesArr.splice(i,0,e);break}this._renderNodesArr.unshift(e)}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t])}getMaxMSAA(e){let t=this.handler.gl;return t.getInternalformatParameter(t.RENDERBUFFER,t[e],t.SAMPLES)[0]}getMSAA(){return this._msaa}enqueueEntityCollectionsToDraw(e,t=0){this._entityCollections[t]||(this._entityCollections[t]=[]),this._entityCollections[t].push(...e)}_drawEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=this.handler.gl;this.enableBlendDefault();let r=t.length;for(;r--;)t[r]._fadingOpacity&&t[r].pointCloudHandler.draw();for(r=t.length;r--;){let n=t[r];t[r]._fadingOpacity&&(n.events.dispatch(n.events.draw,n),t[r].geoObjectHandler.draw())}for(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.billboardsTextureAtlas.texture),r=t.length;r--;){let n=t[r];n._fadingOpacity&&n.billboardHandler.draw()}let s=this.fontAtlas.atlasesArr;for(r=0;r<s.length;r++)i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,s[r].texture);for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].labelHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].rayHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].polylineHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].stripHandler.draw()}}_drawPickingEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=t.length;for(;i--;)t[i]._fadingOpacity&&t[i].billboardHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].geoObjectHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].labelHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].rayHandler.drawPicking();for(i=t.length;i--;)t[i]._visibility&&t[i].polylineHandler.drawPicking();for(i=t.length;i--;)t[i]._visibility&&t[i].stripHandler.drawPicking()}}_drawDepthEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=t.length;for(;i--;)t[i]._fadingOpacity&&t[i].geoObjectHandler.drawDepth()}}_clearEntityCollectionQueue(e){this._entityCollections[e].length=0,this._entityCollections[e]=[]}draw(){this.activeCamera.checkMoveEnd();let e=this.events;e.handleEvents();let t=this.sceneFramebuffer;t.activate();let i=this.handler.gl;i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT),this.enableBlendDefault(),e.dispatch(e.draw,this),this.activeCamera.checkFly();let r=this.activeCamera.frustums,s=e.pointerEvent(),n=!(e.mouseState.leftButtonDown||e.mouseState.rightButtonDown||e.touchState.touching||e.touchState.moving),o=this._renderNodesArr,l=r.length;for(;l--;){this.activeCamera.setCurrentFrustum(l),i.clear(i.DEPTH_BUFFER_BIT);let h=o.length;for(;h--;)o[h].preDrawNode();for(h=o.length;h--;)this.enableBlendDefault(),o[h].drawNode();this._drawEntityCollections(0),e.dispatch(e.drawtransparent,this),s&&n&&this._drawPickingBuffer(0),this._drawDepthBuffer(0),this._clearEntityCollectionQueue(0)}for(let h=1;h<this._entityCollections.length;h++){i.clear(i.DEPTH_BUFFER_BIT);let c=r.length;for(;c--;)this.activeCamera.setCurrentFrustum(c),this._drawEntityCollections(h),s&&n&&this._drawPickingBuffer(h),this._drawDepthBuffer(h);this._clearEntityCollectionQueue(h)}t.deactivate(),this.blitFramebuffer&&t.blitTo(this.blitFramebuffer,0),s&&n&&(this._readPickingBuffer(),this._readDepthBuffer()),this._fnScreenFrame(),e.dispatch(e.postdraw,this),e.mouseState.wheelDelta=0,e.mouseState.justStopped=!1,e.mouseState.moving=!1,e.touchState.moving=!1}getImageDataURL(e="image/png",t=1){return this.draw(),this.handler.canvas?this.handler.canvas.toDataURL(e,t):""}_screenFrameMSAA(){let e=this.handler,t=e.programs.toneMapping,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),this.toneMappingFramebuffer.activate(),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.blitFramebuffer.textures[0]),r.uniform1i(i.uniforms.hdrBuffer,0),r.uniform1f(i.uniforms.gamma,this.gamma),r.uniform1f(i.uniforms.exposure,this.exposure),r.uniform1f(i.uniforms.whitepoint,this.whitepoint),r.drawArrays(r.TRIANGLE_STRIP,0,4),this.toneMappingFramebuffer.deactivate(),t=e.programs.screenFrame,i=t._program,t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_screenFrameNoMSAA(){let e=this.handler,t=e.programs.screenFrame,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_drawPickingBuffer(e){this.pickingFramebuffer.activate();let t=this.handler.gl;if(this.activeCamera.isFirstPass&&e===0?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND),e===0){let i=this._pickingCallbacks;for(let r=0,s=i.length;r<s;r++)i[r].callback.call(i[r].sender)}this._drawPickingEntityCollections(e),t.enable(t.BLEND),this.pickingFramebuffer.deactivate()}_drawDepthBuffer(e){this.depthFramebuffer.activate();let t=this.handler,i=t.gl;if(i.disable(i.BLEND),this.activeCamera.isFirstPass&&e===0?(i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)):i.clear(i.DEPTH_BUFFER_BIT),e===0){let r=this._depthCallbacks,s=r.length;for(;s--;)r[s].callback.call(r[s].sender)}if(this._drawDepthEntityCollections(e),this.depthFramebuffer.deactivate(),this._currentOutput==="depth"||this._currentOutput==="frustum"){this.screenDepthFramebuffer.activate();let r=t.programs.depth,s=r._program;i.bindBuffer(i.ARRAY_BUFFER,this.screenFramePositionBuffer),i.vertexAttribPointer(s.attributes.corners,2,i.FLOAT,!1,0,0),r.activate(),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.depthFramebuffer.textures[1]),i.uniform1i(s.uniforms.depthTexture,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.screenDepthFramebuffer.deactivate(),i.enable(i.BLEND)}}_readDepthBuffer(e){this.depthFramebuffer.readPixelBuffersAsync(e)}_readPickingBuffer_webgl1(){this.pickingFramebuffer.readPixelBuffersAsync()}_readPickingBuffer_webgl2(){this.pickingFramebuffer.readPixelBuffersAsync()}readPickingColor(e,t,i){var r;let s=this.pickingFramebuffer.width,n=this.pickingFramebuffer.height;e=Math.round(e*s);let o=4*((t=Math.round(t*n))*s+e),l=(r=this.pickingFramebuffer)==null?void 0:r.pixelBuffers[0].data;l&&(i[0]=l[o],i[1]=l[o+1],i[2]=l[o+2])}readDepth(e,t,i){let r=new Float32Array(4),s=new Uint8Array(4);this.depthFramebuffer.readData(e,t,s,0),this.depthFramebuffer.readData(e,t,r,1),i[0]=r[0],i[1]=Math.round(s[0]/10)-1}getDistanceFromPixel(e){let t=this.activeCamera,i=this.handler.canvas,r=e.x/i.width,s=(i.height-e.y)/i.height;if(jt[0]=jt[1]=0,this.readDepth(r,s,jt),jt[1]===-1)return;let n=jt[0],o=t.frustums[jt[1]];if(!o)return;let l=new te(2*r-1,2*s-1,2*n-1,1),h=o.inverseProjectionMatrix.mulVec4(l),c=-h.z/h.w;if(t.isOrthographic)return c;let d=e.direction||t.unproject(e.x,e.y);return c/Math.max(1e-6,d.dot(t.getForward()))}getCartesianFromPixel(e){let t=this.getDistanceFromPixel(e);if(t){if(this.activeCamera.isOrthographic){let i=new m;return this.activeCamera.unproject(e.x,e.y,t,i),i}return(e.direction||this.activeCamera.unproject(e.x,e.y)).scaleTo(t).addA(this.activeCamera.eye)}}getDepthMinDistance(){let e=this.handler.canvas,t=e.width,i=e.height,r=tr,s=i*t,n=new N;for(let o=0;o<s;o++){n.x=o%t,n.y=Math.floor(o/t);let l=this.getDistanceFromPixel(n);l&&l<r&&(r=l)}return r<tr?r:0}getDepthMinDistanceAsync(){return new Promise((e,t)=>{this._readDepthBuffer(()=>{e(this.getDepthMinDistance())})})}async setOrthographicProjection(e){if(e!==this.activeCamera.isOrthographic){let t=await this.getDepthMinDistanceAsync();t&&e&&(this.activeCamera.focusDistance=t),this.activeCamera.isOrthographic=e,this.events.dispatch(this.events.projchanged,this.activeCamera)}}start(){this._initialized||this.initialize(),this.handler.start()}destroy(){for(let e in this.controls)this.controls[e].remove();for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].remove();this.div=null,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.controls={},this.controlsBag={},this.colorObjects.clear(),this.colorObjects=null,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=null,this._depthCallbacks=[],this.depthFramebuffer=null,this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._entityCollections=[[]],this.handler.ONCANVASRESIZE=null,this.handler.destroy(),this.handler=null,this._initialized=!1}}const bo="/res",wo=class er{constructor(e){this.$target=null,this._instanceID=`__globus${er.__counter__++?er.__counter__:""}__`,window[this._instanceID]=this,this._canvas=document.createElement("canvas"),this._canvas.id=`canvas${this._instanceID}`,this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._canvas.style.opacity="0.0",this._canvas.style.transition="opacity 150ms",this.$inner=document.createElement("div"),this.$inner.classList.add("og-inner"),this.$inner.appendChild(this._canvas),this.$inner.attributions=document.createElement("div"),e.attributionContainer?e.attributionContainer.appendChild(this.$inner.attributions):(this.$inner.attributions.classList.add("og-attribution"),this.$inner.appendChild(this.$inner.attributions)),e.target&&this.attachTo(e.target);const t=n=>{n.preventDefault()};this._canvas.onmouseenter=function(){document.addEventListener("mousewheel",t,{capture:!1,passive:!1})},this._canvas.onmouseleave=function(){document.removeEventListener("mousewheel",t)},this.renderer=new sd(new bt(this._canvas,{autoActivate:!1,pixelRatio:e.dpi||window.devicePixelRatio+.15,context:{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1}}),{autoActivate:!1,msaa:e.msaa,fontsSrc:e.fontsSrc,gamma:e.gamma,exposure:e.exposure}),this.renderer.div=this.$inner,e.skybox&&this.renderer.addNode(e.skybox),this._planetName=e.name?e.name:"globus_planet_"+er.__counter__,this.planet=new yi({name:this._planetName,frustums:e.frustums,ellipsoid:e.ellipsoid,maxGridSize:e.maxGridSize,nightTextureSrc:e.nightTextureSrc===null?null:e.nightTextureSrc||`${e.resourcesSrc||bo}/night.png`,specularTextureSrc:e.specularTextureSrc===null?null:e.specularTextureSrc||`${e.resourcesSrc||bo}/spec.png`,minAltitude:e.minAltitude,maxAltitude:e.maxAltitude||15e6,maxEqualZoomAltitude:e.maxEqualZoomAltitude,minEqualZoomAltitude:e.minEqualZoomAltitude,minEqualZoomCameraSlope:e.minEqualZoomCameraSlope,quadTreeStrategyPrototype:e.quadTreeStrategyPrototype,maxLoadingRequests:e.maxLoadingRequests,atmosphereEnabled:e.atmosphereEnabled,transitionOpacityEnabled:e.transitionOpacityEnabled,atmosphereParameters:e.atmosphereParameters,minDistanceBeforeMemClear:e.minDistanceBeforeMemClear,vectorTileSize:e.vectorTileSize,maxNodesCount:e.maxNodesCount}),e.terrain?Array.isArray(e.terrain)?this.planet.setTerrain(e.terrain[0]):this.planet.setTerrain(e.terrain):this.planet.setTerrain(new ds),this.renderer.addNode(this.planet),e.controls?this.planet.addControls(e.controls):this.planet.addControls([new Ta,new ua,new Ca,new ha,new xa,new Qs,new Jr]);const i=this.renderer.controls;let r;for(let n in i)if(i[n]instanceof qr){r=i[n];break}r?this.sun=r:(this.sun=new qr,this.planet.addControl(this.sun)),e.sun&&(e.sun.active===void 0||e.sun.active||this.sun.deactivate(),e.sun.stopped===!0&&this.sun.stop()),e.layers&&this.planet.addLayers(e.layers);let s=e.viewExtent;s&&(s instanceof Array?this.planet.viewExtentArr(s):this.planet.viewExtent(s)),(e.autoActivate||Ge(e.autoActivate))&&this.start()}start(){this.renderer.start(),this.fadeIn()}fadeIn(){this._canvas.style.opacity="1.0"}fadeOut(){this._canvas.style.opacity="0"}attachTo(e,t){let i;this.detach(),i=e instanceof HTMLElement?e:document.getElementById(e)||document.querySelector(e),i?(this.$target=i,t&&this.$target.firstChild?this.$target.insertBefore(this.$inner,this.$target.firstChild):i.appendChild(this.$inner)):console.warn(`Target container not found. Provided target: ${e}`)}detach(){this.$target&&(this.$target.removeChild(this.$inner),this.$target=null)}destroy(){this.detach(),this.planet.layers.forEach(e=>e.remove()),this.planet.destroy(),this.renderer.destroy(),window[this._instanceID]=null}};wo.__counter__=0;let nd=wo;new cr(3396200,3389508),new cr(1737400,1737400);var ad=(a=>(a[a.byte=5120]="byte",a[a.ubyte=5121]="ubyte",a[a.short=5122]="short",a[a.ushort=5123]="ushort",a[a.uint=5125]="uint",a[a.float=5126]="float",a))(ad||{}),od=(a=>(a.scalar="SCALAR",a.vec2="VEC2",a.vec3="VEC3",a.vec4="VEC4",a.mat2="MAT2",a.mat3="MAT3",a.mat4="MAT4",a))(od||{}),ld=(a=>(a[a.points=0]="points",a[a.lines=1]="lines",a[a.lineLoop=2]="lineLoop",a[a.lineStrip=3]="lineStrip",a[a.triangles=4]="triangles",a[a.triangleStrip=5]="triangleStrip",a[a.triangleFan=6]="triangleFan",a))(ld||{});const hd=({children:a,onDraw:e,...t})=>{const i=S.useRef(null),{setGlobe:r}=dt(),[s,n]=S.useState(t),o=S.useRef(null);return S.useEffect(()=>{if(o&&o.current&&t.viewExtent!==void 0){const l=t.viewExtent instanceof j?t.viewExtent:new j(new A(t.viewExtent[0],t.viewExtent[1]),new A(t.viewExtent[2],t.viewExtent[3]));o.current.planet.viewExtent(l)}},[t.viewExtent]),S.useEffect(()=>{o&&o.current&&t.atmosphereEnabled!==void 0&&(o.current.planet.atmosphereEnabled=t.atmosphereEnabled)},[t.atmosphereEnabled]),S.useEffect(()=>{var l,h;o&&o.current&&t.sunActive!==void 0&&(t.sunActive?(l=o.current)==null||l.sun.activate():(h=o.current)==null||h.sun.deactivate())},[t.sunActive]),S.useEffect(()=>{if(o.current)i.current=o.current.$target;else{const l=new vo("OSM"),h=new yo("Microsoft Bing");o.current=new nd({target:i.current,name:"Earth",terrain:new po,layers:[l,h],autoActivate:!0,atmosphereEnabled:!0,...s}),e&&o.current.planet.events.on("draw",e)}return r(o.current),()=>{o.current&&(e&&o.current.planet.events.off("draw",e),o.current.destroy(),o.current=null)}},[s]),Fe.createElement("div",{style:{width:"100%",height:"100%"},ref:i},a)},cd=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.src=="string"&&i.current&&((r=i.current)==null||r.setSrc(e.src))},[e.src]),S.useEffect(()=>{if(t)return i.current=new rs(a,e),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),null},dd=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.src=="string"&&i.current&&((r=i.current)==null||r.setSrc(e.src))},[e.src]),S.useEffect(()=>{if(t)return i.current=new mo(a,e),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),null},ud=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.url=="string"&&i.current&&((r=i.current)==null||r.setUrl(e.url))},[e.url]),S.useEffect(()=>{if(t)return i.current=new xi(a,{...e}),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),Fe.createElement(ps,{layerRef:i,name:a,...e})},ps=({opacity:a,children:e,name:t,layerRef:i,...r})=>{const[s,n]=Fe.useState(!1);return S.useEffect(()=>{i&&i.current&&typeof a=="number"&&s&&(i.current.opacity=a)},[a]),S.useEffect(()=>{var o,l,h,c,d,u,g,f,p,_,v,x,y,w,b,E,C,T,L,M,R,z,F,P,D,k;return s&&i&&i.current&&(r.onVisibilityChange&&((o=i.current)==null||o.events.on("visibilitychange",r.onVisibilityChange)),r.onAdd&&((l=i.current)==null||l.events.on("add",r.onAdd)),r.onRemove&&((h=i.current)==null||h.events.on("remove",r.onRemove)),r.onMouseMove&&((c=i.current)==null||c.events.on("mousemove",r.onMouseMove)),r.onMouseEnter&&((d=i.current)==null||d.events.on("mouseenter",r.onMouseEnter)),r.onMouseLeave&&((u=i.current)==null||u.events.on("mouseleave",r.onMouseLeave)),r.onLclick&&((g=i.current)==null||g.events.on("lclick",r.onLclick)),r.onRclick&&((f=i.current)==null||f.events.on("rclick",r.onRclick)),r.onMclick&&((p=i.current)==null||p.events.on("mclick",r.onMclick)),r.onLdblclick&&((_=i.current)==null||_.events.on("ldblclick",r.onLdblclick)),r.onRdblclick&&((v=i.current)==null||v.events.on("rdblclick",r.onRdblclick)),r.onMdblclick&&((x=i.current)==null||x.events.on("mdblclick",r.onMdblclick)),r.onLup&&((y=i.current)==null||y.events.on("lup",r.onLup)),r.onRup&&((w=i.current)==null||w.events.on("rup",r.onRup)),r.onMup&&((b=i.current)==null||b.events.on("mup",r.onMup)),r.onLdown&&((E=i.current)==null||E.events.on("ldown",r.onLdown)),r.onRdown&&((C=i.current)==null||C.events.on("rdown",r.onRdown)),r.onMdown&&((T=i.current)==null||T.events.on("mdown",r.onMdown)),r.onLhold&&((L=i.current)==null||L.events.on("lhold",r.onLhold)),r.onRhold&&((M=i.current)==null||M.events.on("rhold",r.onRhold)),r.onMhold&&((R=i.current)==null||R.events.on("mhold",r.onMhold)),r.onMouseWheel&&((z=i.current)==null||z.events.on("mousewheel",r.onMouseWheel)),r.onTouchMove&&((F=i.current)==null||F.events.on("touchmove",r.onTouchMove)),r.onTouchStart&&((P=i.current)==null||P.events.on("touchstart",r.onTouchStart)),r.onTouchEnd&&((D=i.current)==null||D.events.on("touchend",r.onTouchEnd)),r.onDoubleTouch&&((k=i.current)==null||k.events.on("doubletouch",r.onDoubleTouch))),()=>{var I;r.onLclick&&((I=i==null?void 0:i.current)==null||I.events.off("lclick",r.onLclick)),n(!1)}},[s]),i!=null&&i.current&&!s&&n(!0),Fe.createElement(Fe.Fragment,null,e)},ms=S.createContext({addEntity:()=>{},removeEntity:()=>{},addLabel:()=>{},removeLabel:()=>{},addBillboard:()=>{},removeBillboard:()=>{},addGeoObject:()=>{},removeGeoObject:()=>{},addGeometry:()=>{},removeGeometry:()=>{},addPolyline:()=>{},removePolyline:()=>{},addStrip:()=>{},removeStrip:()=>{}}),_d=({visibility:a,children:e,name:t,...i})=>{const{globe:r}=dt(),s=S.useRef(null),[n,o]=S.useState([]),l=S.useRef(new Set);S.useEffect(()=>{typeof a=="boolean"&&s.current&&s.current.setVisibility(a)},[a]),S.useEffect(()=>{var C,T;if(r)return s.current=new fe(t,i),r.planet.addLayer(s.current),i.onDraw&&((C=s.current)==null||C.events.on("draw",i.onDraw)),i.onMouseEnter&&((T=s.current)==null||T.events.on("mouseenter",i.onMouseEnter)),()=>{var L,M;s.current&&(r.planet.removeLayer(s.current),i.onDraw&&((L=s.current)==null||L.events.off("draw",i.onDraw)),i.onMouseEnter&&((M=s.current)==null||M.events.off("mouseenter",i.onMouseEnter)))}},[r]),S.useEffect(()=>{if(s.current&&n.length>0){const C=n.filter(T=>!l.current.has(T));s.current.addEntities(C),C.forEach(T=>l.current.add(T))}},[n]);const h=S.useCallback(C=>{o(T=>T.includes(C)?T:[...T,C])},[]),c=S.useCallback(C=>{o(T=>T.filter(L=>L!==C)),s.current&&(s.current.removeEntity(C),l.current.delete(C))},[]),d=S.useCallback((C,T)=>{C.setBillboard(T)},[]),u=S.useCallback(C=>{var T;(T=C.billboard)==null||T.remove()},[]),g=S.useCallback((C,T)=>{C.setGeoObject(T)},[]),f=S.useCallback(C=>{var T;(T=C.geoObject)==null||T.remove()},[]),p=S.useCallback((C,T)=>{C.setLabel(T)},[]),_=S.useCallback(C=>{var T;(T=C.label)==null||T.remove()},[]),v=S.useCallback((C,T)=>{C.setGeometry(T)},[]),x=S.useCallback(C=>{var T;(T=C.geometry)==null||T.remove()},[]),y=S.useCallback((C,T)=>{C.setPolyline(T)},[]),w=S.useCallback(C=>{var T;(T=C.polyline)==null||T.remove()},[]),b=S.useCallback((C,T)=>{C.setStrip(T)},[]),E=S.useCallback(C=>{var T;(T=C.strip)==null||T.remove()},[]);return Fe.createElement(ms.Provider,{value:{addEntity:h,removeEntity:c,addBillboard:d,removeBillboard:u,addGeoObject:g,removeGeoObject:f,addLabel:p,removeLabel:_,addGeometry:v,removeGeometry:x,addPolyline:y,removePolyline:w,addStrip:b,removeStrip:E}},Fe.createElement(ps,{layerRef:s,name:t,...i},e))},fd=({visibility:a,src:e,size:t,color:i,rotation:r,offset:s,_addBillboard:n,_removeBillboard:o,...l})=>{const h=S.useRef(null);return S.useEffect(()=>{var c;typeof a=="boolean"&&h.current&&((c=h.current)==null||c.setVisibility(a))},[a]),S.useEffect(()=>{var c;typeof e=="string"&&h.current&&((c=h.current)==null||c.setSrc(e))},[e]),S.useEffect(()=>{var c;typeof r=="number"&&h.current&&((c=h.current)==null||c.setRotation(r*Math.PI/180))},[r]),S.useEffect(()=>{var c,d,u;s&&h.current&&(s instanceof m?(c=h.current)==null||c.setOffset(s.x,s.y,s.z):s instanceof N?(d=h.current)==null||d.setOffset(s.x,s.y):(u=h.current)==null||u.setOffset(s[0],s[1],s[2]))},[s]),S.useEffect(()=>{var c;t&&h.current&&((c=h.current)==null||c.setSize(t[0],t[1]))},[t]),S.useEffect(()=>{var c;typeof i=="string"&&h.current&&((c=h.current)==null||c.setColorHTML(i))},[i]),S.useEffect(()=>(h.current=new cn({...l,color:i,size:t,src:e,offset:s,visibility:a,rotation:r?r*Math.PI/180:0}),h.current&&n&&n(h.current),()=>{h.current&&o&&o(h.current)}),[n,o]),null},gd=({color:a,objSrc:e,scale:t,visibility:i,_addGeoObject:r,_removeGeoObject:s,...n})=>{const o=S.useRef(null);return S.useEffect(()=>{var l;t&&o.current&&((l=o.current)==null||l.setScale(t))},[t]),S.useEffect(()=>{var l,h,c;o.current&&(typeof a=="string"?(l=o.current)==null||l.setColorHTML(a):a instanceof te?(h=o.current)==null||h.setColor4v(a):Array.isArray(a)&&((c=o.current)==null||c.setColor(...a)))},[a]),S.useEffect(()=>{var l;e&&o.current&&((l=o.current)==null||l.setObjectSrc(e))},[e]),S.useEffect(()=>{var l;typeof i=="boolean"&&o.current&&((l=o.current)==null||l.setVisibility(i))},[i]),S.useEffect(()=>(o.current=new gn({color:a,objSrc:e,scale:t,visibility:i,...n}),o.current&&r&&r(o.current),()=>{o.current&&s&&s(o.current)}),[r,s]),null},pd=({visibility:a,size:e,color:t,rotation:i,offset:r,text:s,face:n,isRTL:o,align:l,outline:h,outlineColor:c,opacity:d,_addLabel:u,_removeLabel:g,...f})=>{const p=S.useRef(null);return S.useEffect(()=>{var _;typeof a=="boolean"&&p.current&&((_=p.current)==null||_.setVisibility(a))},[a]),S.useEffect(()=>{var _;typeof i=="number"&&p.current&&((_=p.current)==null||_.setRotation(i*Math.PI/180))},[i]),S.useEffect(()=>{var _;typeof e=="number"&&p.current&&((_=p.current)==null||_.setSize(e))},[e]),S.useEffect(()=>{var _;typeof h=="number"&&p.current&&((_=p.current)==null||_.setOutline(h))},[h]),S.useEffect(()=>{var _;typeof d=="number"&&p.current&&((_=p.current)==null||_.setOpacity(d))},[d]),S.useEffect(()=>{var _;typeof o=="boolean"&&p.current&&((_=p.current)==null||_.setRtl(o))},[o]),S.useEffect(()=>{var _,v,x;r&&p.current&&(r instanceof m?(_=p.current)==null||_.setOffset(r.x,r.y,r.z):r instanceof N?(v=p.current)==null||v.setOffset(r.x,r.y):(x=p.current)==null||x.setOffset(r[0],r[1],r[2]))},[r]),S.useEffect(()=>{var _;typeof s=="string"&&p.current&&((_=p.current)==null||_.setText(s))},[s]),S.useEffect(()=>{var _;typeof n=="string"&&p.current&&((_=p.current)==null||_.setFace(n))},[n]),S.useEffect(()=>{var _;typeof l=="string"&&p.current&&((_=p.current)==null||_.setAlign(l))},[l]),S.useEffect(()=>{var _;typeof t=="string"&&p.current&&((_=p.current)==null||_.setColorHTML(t))},[t]),S.useEffect(()=>{var _;typeof c=="string"&&p.current&&((_=p.current)==null||_.setOutlineColorHTML(c))},[c]),S.useEffect(()=>(p.current=new mn({...f,color:t,size:e,text:s,face:n,isRTL:o,align:l,outline:h,outlineColor:c,opacity:d,offset:r,visibility:a,rotation:i?i*Math.PI/180:0}),p.current&&u&&u(p.current),()=>{p.current&&g&&g(p.current)}),[u,g]),null};function md(a){switch(a.type){case"POINT":return Array.isArray(a.coordinates)&&a.coordinates.length>=2&&typeof a.coordinates[0]=="number";case"LINESTRING":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.length>=2&&typeof e[0]=="number");case"POLYGON":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"));case"MULTIPOLYGON":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.every(i=>Array.isArray(i)&&i.length>=2&&typeof i[0]=="number")));case"MULTILINESTRING":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"));default:return!1}}const vd=a=>{const{visibility:e,fillColor:t,lineColor:i,strokeColor:r,lineWidth:s,strokeWidth:n,type:o,coordinates:l,_addGeometry:h,_removeGeometry:c}=a,d=S.useRef(null);if(!md({type:o,coordinates:l}))throw new Error(`Invalid coordinates for type ${o}`);return S.useEffect(()=>{typeof e=="boolean"&&d.current&&d.current.setVisibility(e)},[e]),S.useEffect(()=>{if(t!==void 0&&d.current){if(t instanceof te)d.current.setFillColor4v(t);else if(Array.isArray(t))d.current.setFillColor(...t);else if(typeof t=="string"&&d.current){const u=Hi.htmlColorToRgba(t);d.current.setFillColor4v(u)}}},[t]),S.useEffect(()=>{if(i!==void 0&&d.current){if(i instanceof te)d.current.setLineColor4v(i);else if(Array.isArray(i))d.current.setLineColor(...i);else if(typeof i=="string"&&d.current){const u=Hi.htmlColorToRgba(i);d.current.setLineColor4v(u)}}},[i]),S.useEffect(()=>{if(r!==void 0&&d.current){if(r instanceof te)d.current.setStrokeColor4v(r);else if(Array.isArray(r))d.current.setStrokeColor(...r);else if(typeof r=="string"&&d.current){const u=Hi.htmlColorToRgba(r);d.current.setStrokeColor4v(u)}}},[r]),S.useEffect(()=>{typeof s=="number"&&d.current&&d.current.setLineWidth(s)},[s]),S.useEffect(()=>{typeof n=="number"&&d.current&&d.current.setStrokeWidth(n)},[n]),S.useEffect(()=>(d.current=new un({...a,type:o,coordinates:l,style:{fillColor:t,lineColor:i,strokeColor:r,lineWidth:s,strokeWidth:n},visibility:e}),d.current&&h&&h(d.current),()=>{d.current&&c&&c(d.current)}),[h,c]),null},Co=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof m,To=a=>Array.isArray(a)&&a.length>0&&(a[0][0]instanceof A||a[0][0]instanceof Array),yd=a=>a.map(e=>e.map(t=>A.createFromArray(t))),xd=a=>typeof a=="string"||Array.isArray(a),Eo=a=>Array.isArray(a)&&a.every(e=>Array.isArray(e)&&e.every(xd)),bd=a=>Array.isArray(a)&&a.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length===4&&t.every(i=>typeof i=="number"))),Ao=a=>Eo(a)?a.map(e=>e.map(t=>{const i=Hi.htmlColorToRgba(t);return[i.x,i.y,i.z,i.w]})):a,wd=({visibility:a,color:e,altitude:t,thickness:i,opacity:r,isClosed:s,pathColors:n,path:o,_addPolyline:l,_removePolyline:h,...c})=>{const d=S.useRef(null);return S.useEffect(()=>{var u;typeof a=="boolean"&&d.current&&((u=d.current)==null||u.setVisibility(a))},[a]),S.useEffect(()=>{var u;typeof e=="string"&&d.current&&((u=d.current)==null||u.setColorHTML(e))},[e]),S.useEffect(()=>{var u;typeof t=="number"&&d.current&&((u=d.current)==null||u.setAltitude(t))},[t]),S.useEffect(()=>{var u;typeof i=="number"&&d.current&&((u=d.current)==null||u.setThickness(i))},[i]),S.useEffect(()=>{var u;typeof r=="number"&&d.current&&((u=d.current)==null||u.setOpacity(r))},[r]),S.useEffect(()=>{var u,g,f;if(d.current&&o!==void 0)if(To(o))(u=d.current)==null||u.setPathLonLat(o);else if(Co(o))(g=d.current)==null||g.setPath3v(o);else{const p=yd(o);p&&((f=d.current)==null||f.setPathLonLat(p))}},[o]),S.useEffect(()=>{var u,g;if(n&&Array.isArray(n)&&n.length>0)if(Eo(n)){const f=Ao(n);f&&((u=d.current)==null||u.setPathColors(f))}else bd(n)&&((g=d.current)==null||g.setPathColors(n))},[n]),S.useEffect(()=>(d.current=new xn({...c,color:e,visibility:a,opacity:r,thickness:i,pathLonLat:o&&To(o)?o:void 0,path3v:o&&Co(o)?o:void 0,pathColors:Ao(n),altitude:t}),d.current&&l&&l(d.current),()=>{d.current&&h&&h(d.current)}),[l,h]),null},Cd=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof m,Td=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof A,Lo=(a,e)=>e?Cd(e)?e:Td(e)?e.map(t=>t.map(i=>a.lonLatToCartesian(i))):e.map(t=>t.map(i=>a.lonLatToCartesian(A.createFromArray(i)))):[],Ed=({visibility:a,color:e,opacity:t,path:i,_addStrip:r,_removeStrip:s,...n})=>{const o=S.useRef(null),{globe:l}=dt();return S.useEffect(()=>{var h;typeof a=="boolean"&&o.current&&((h=o.current)==null||h.setVisibility(a))},[a]),S.useEffect(()=>{var h;typeof t=="number"&&o.current&&((h=o.current)==null||h.setOpacity(t))},[t]),S.useEffect(()=>{var h;l&&i!==void 0&&o.current&&((h=o.current)==null||h.setPath(Lo(l.planet.ellipsoid,i)))},[i]),S.useEffect(()=>{var h;typeof e=="string"&&o.current&&((h=o.current)==null||h.setColorHTML(e))},[e]),S.useEffect(()=>(l&&(o.current=new Cn({...n,color:e,visibility:a,path:Lo(l.planet.ellipsoid,i),opacity:t}),o.current&&r&&r(o.current)),()=>{o.current&&s&&s(o.current)}),[r,s,l]),null},Ad=({visibility:a,lon:e,lat:t,alt:i,lonlat:r,name:s,children:n,...o})=>{const{globe:l}=dt(),{addEntity:h,removeEntity:c,addBillboard:d,removeBillboard:u,addGeoObject:g,removeGeoObject:f,addLabel:p,removeLabel:_,addGeometry:v,removeGeometry:x,addPolyline:y,removePolyline:w,addStrip:b,removeStrip:E}=S.useContext(ms),C=S.useRef(null),[T,L]=S.useState(null),[M,R]=S.useState(null),[z,F]=S.useState(null),[P,D]=S.useState(null),[k,I]=S.useState(null),[B,G]=S.useState(null);S.useEffect(()=>{var $;r&&(r instanceof A||(r=A.createFromArray(r)),($=C.current)==null||$.setLonLat(r))},[r,T]),S.useEffect(()=>{var $;s&&(($=C.current)==null||$.setLonLat2(e,t,i))},[e,t,i]),S.useEffect(()=>{var $;typeof a=="boolean"&&C.current&&(($=C.current)==null||$.setVisibility(a))},[a]),S.useEffect(()=>{if(l)return C.current=new V({lonlat:r||new A(e,t,i),name:s,...o}),h(C.current),()=>{l&&C.current&&c(C.current)}},[l,h,c]),S.useEffect(()=>{var $,Be;T&&!(($=C.current)!=null&&$.billboard)&&((Be=C.current)==null||Be.setBillboard(T))},[T]),S.useEffect(()=>{var $,Be;M&&!(($=C.current)!=null&&$.geoObject)&&((Be=C.current)==null||Be.setGeoObject(M))},[M]),S.useEffect(()=>{var $,Be;z&&!(($=C.current)!=null&&$.label)&&((Be=C.current)==null||Be.setLabel(z))},[z]),S.useEffect(()=>{var $,Be;P&&!(($=C.current)!=null&&$.geometry)&&((Be=C.current)==null||Be.setGeometry(P))},[P]),S.useEffect(()=>{var $,Be;k&&!(($=C.current)!=null&&$.polyline)&&((Be=C.current)==null||Be.setPolyline(k))},[k]),S.useEffect(()=>{var $,Be;B&&!(($=C.current)!=null&&$.strip)&&((Be=C.current)==null||Be.setStrip(B))},[B]);const Ve=S.useCallback($=>{L($),C.current&&d(C.current,$)},[d]),ve=S.useCallback(()=>{C.current&&u(C.current),L(null)},[u]),ze=S.useCallback($=>{R($),C.current&&g(C.current,$)},[g]),Re=S.useCallback(()=>{C.current&&f(C.current),R(null)},[f]),ie=S.useCallback($=>{F($),C.current&&p(C.current,$)},[p]),Ue=S.useCallback(()=>{C.current&&_(C.current),R(null)},[_]),De=S.useCallback($=>{D($),C.current&&v(C.current,$)},[v]),Ei=S.useCallback(()=>{C.current&&x(C.current),R(null)},[x]),Ai=S.useCallback($=>{I($),C.current&&y(C.current,$)},[y]),Li=S.useCallback(()=>{C.current&&w(C.current),I(null)},[w]),Pd=S.useCallback($=>{G($),C.current&&b(C.current,$)},[b]),Sd=S.useCallback(()=>{C.current&&E(C.current),G(null)},[E]),Po={_addGeometry:De,_removeGeometry:Ei,_addLabel:ie,_removeLabel:Ue,_addBillboard:Ve,_removeBillboard:ve,_addGeoObject:ze,_removeGeoObject:Re,_addPolyline:Ai,_removePolyline:Li,_addStrip:Pd,_removeStrip:Sd};return n?Fe.createElement(Fe.Fragment,null,Array.isArray(n)?n.map($=>Fe.isValidElement($)?Fe.cloneElement($,Po):$):Fe.isValidElement(n)?Fe.cloneElement(n,Po):n):null},Ld=({lon:a,lat:e,alt:t,lookLon:i,lookLat:r,lookAlt:s,viewAngle:n,...o})=>{const{globe:l}=dt();return S.useEffect(()=>{l&&typeof a=="number"&&typeof e=="number"&&typeof t=="number"&&l.planet.flyLonLat(new A(a,e,t),new A(i,r,s))},[a,e,t,i,r,s,l]),S.useEffect(()=>{l&&typeof n=="number"&&l.planet.camera.setViewAngle(n)},[n,l]),null};ce.Billboard=fd,ce.Entity=Ad,ce.GeoImage=cd,ce.GeoObject=gd,ce.GeoVideo=dd,ce.Geometry=vd,ce.Globe=hd,ce.GlobeContextProvider=Jo,ce.Label=pd,ce.Layer=ps,ce.PlanetCamera=Ld,ce.Polyline=wd,ce.Strip=Ed,ce.Vector=_d,ce.VectorContext=ms,ce.XYZ=ud,ce.useGlobeContext=dt,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})});
|
|
940
|
+
}`})]),this.sceneFramebuffer=new Qa(this.handler,{size:1,msaa:this._msaa,internalFormat:this._internalFormat,filter:"LINEAR"}),this.sceneFramebuffer.init(),this.blitFramebuffer=new Se(this.handler,{size:1,useDepth:!1,targets:[{internalFormat:this._internalFormat,format:this._format,type:this._type,filter:"NEAREST"}]}),this.blitFramebuffer.init(),this.toneMappingFramebuffer=new Se(this.handler,{useDepth:!1}),this.toneMappingFramebuffer.init(),this._fnScreenFrame=this._screenFrameMSAA,this.screenTexture={screen:this.toneMappingFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0],frustum:this.depthFramebuffer.textures[0]}}this.handler.ONCANVASRESIZE=()=>{this._resizeStart(),this.events.dispatch(this.events.resize,this.handler.canvas),this._resizeEnd(),this.events.dispatch(this.events.resizeend,this.handler.canvas)},this.screenFramePositionBuffer=this.handler.createArrayBuffer(new Float32Array([1,1,-1,1,1,-1,-1,-1]),2,4),this.outputTexture=this.screenTexture.screen,this._initializeRenderNodes(),this._initializeControls()}}_initializeControls(){let e=this.controls;this.controls={};for(let t in e)this.addControl(e[t])}resize(){this._resizeEnd()}setCurrentScreen(e){this._currentOutput=e,this.screenTexture[e]&&(this.outputTexture=this.screenTexture[e])}_resizeStart(){let e=this.handler.canvas;this.activeCamera.setViewportSize(e.width,e.height),this.sceneFramebuffer.setSize(.5*e.width,.5*e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(.5*e.width,.5*e.height,!0)}_resizeEnd(){let e=this.handler.canvas;this.activeCamera.setViewportSize(e.width,e.height),this.sceneFramebuffer.setSize(e.width,e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width,e.height,!0),this.toneMappingFramebuffer&&this.toneMappingFramebuffer.setSize(e.width,e.height,!0),this.screenDepthFramebuffer&&this.screenDepthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.handler.gl.type==="webgl"?(this.screenTexture.screen=this.sceneFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]):(this.screenTexture.screen=this.toneMappingFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]),this.setCurrentScreen(this._currentOutput)}removeNode(e){e.remove()}addNode(e){this.renderNodes[e.name]?Ke.logWrn(`Node name ${e.name} already exists.`):(e.assign(this),this._renderNodesArr.unshift(e),this.renderNodes[e.name]=e)}_initializeRenderNodes(){for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].initialize()}addNodeBefore(e,t){if(this.renderNodes[e.name])Ke.logWrn(`Node name ${e.name} already exists.`);else{e.assign(this),this.renderNodes[e.name]=e;for(let i=0;i<this._renderNodesArr.length;i++)if(this._renderNodesArr[i].isEqual(t)){this._renderNodesArr.splice(i,0,e);break}this._renderNodesArr.unshift(e)}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t])}getMaxMSAA(e){let t=this.handler.gl;return t.getInternalformatParameter(t.RENDERBUFFER,t[e],t.SAMPLES)[0]}getMSAA(){return this._msaa}enqueueEntityCollectionsToDraw(e,t=0){this._entityCollections[t]||(this._entityCollections[t]=[]),this._entityCollections[t].push(...e)}_drawEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=this.handler.gl;this.enableBlendDefault();let r=t.length;for(;r--;)t[r]._fadingOpacity&&t[r].pointCloudHandler.draw();for(r=t.length;r--;){let n=t[r];t[r]._fadingOpacity&&(n.events.dispatch(n.events.draw,n),t[r].geoObjectHandler.draw())}for(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.billboardsTextureAtlas.texture),r=t.length;r--;){let n=t[r];n._fadingOpacity&&n.billboardHandler.draw()}let s=this.fontAtlas.atlasesArr;for(r=0;r<s.length;r++)i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,s[r].texture);for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].labelHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].rayHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].polylineHandler.draw();for(r=t.length;r--;)t[r]._fadingOpacity&&t[r].stripHandler.draw()}}_drawPickingEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=t.length;for(;i--;)t[i]._fadingOpacity&&t[i].billboardHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].geoObjectHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].labelHandler.drawPicking();for(i=t.length;i--;)t[i]._fadingOpacity&&t[i].rayHandler.drawPicking();for(i=t.length;i--;)t[i]._visibility&&t[i].polylineHandler.drawPicking();for(i=t.length;i--;)t[i]._visibility&&t[i].stripHandler.drawPicking()}}_drawDepthEntityCollections(e){let t=this._entityCollections[e];if(t.length){let i=t.length;for(;i--;)t[i]._fadingOpacity&&t[i].geoObjectHandler.drawDepth()}}_clearEntityCollectionQueue(e){this._entityCollections[e].length=0,this._entityCollections[e]=[]}draw(){this.activeCamera.checkMoveEnd();let e=this.events;e.handleEvents();let t=this.sceneFramebuffer;t.activate();let i=this.handler.gl;i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT),this.enableBlendDefault(),e.dispatch(e.draw,this),this.activeCamera.checkFly();let r=this.activeCamera.frustums,s=e.pointerEvent(),n=!(e.mouseState.leftButtonDown||e.mouseState.rightButtonDown||e.touchState.touching||e.touchState.moving),o=this._renderNodesArr,l=r.length;for(;l--;){this.activeCamera.setCurrentFrustum(l),i.clear(i.DEPTH_BUFFER_BIT);let h=o.length;for(;h--;)o[h].preDrawNode();for(h=o.length;h--;)this.enableBlendDefault(),o[h].drawNode();this._drawEntityCollections(0),e.dispatch(e.drawtransparent,this),s&&n&&this._drawPickingBuffer(0),this._drawDepthBuffer(0),this._clearEntityCollectionQueue(0)}for(let h=1;h<this._entityCollections.length;h++){i.clear(i.DEPTH_BUFFER_BIT);let c=r.length;for(;c--;)this.activeCamera.setCurrentFrustum(c),this._drawEntityCollections(h),s&&n&&this._drawPickingBuffer(h),this._drawDepthBuffer(h);this._clearEntityCollectionQueue(h)}t.deactivate(),this.blitFramebuffer&&t.blitTo(this.blitFramebuffer,0),s&&n&&(this._readPickingBuffer(),this._readDepthBuffer()),this._fnScreenFrame(),e.dispatch(e.postdraw,this),e.mouseState.wheelDelta=0,e.mouseState.justStopped=!1,e.mouseState.moving=!1,e.touchState.moving=!1}getImageDataURL(e="image/png",t=1){return this.draw(),this.handler.canvas?this.handler.canvas.toDataURL(e,t):""}_screenFrameMSAA(){let e=this.handler,t=e.programs.toneMapping,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),this.toneMappingFramebuffer.activate(),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.blitFramebuffer.textures[0]),r.uniform1i(i.uniforms.hdrBuffer,0),r.uniform1f(i.uniforms.gamma,this.gamma),r.uniform1f(i.uniforms.exposure,this.exposure),r.uniform1f(i.uniforms.whitepoint,this.whitepoint),r.drawArrays(r.TRIANGLE_STRIP,0,4),this.toneMappingFramebuffer.deactivate(),t=e.programs.screenFrame,i=t._program,t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_screenFrameNoMSAA(){let e=this.handler,t=e.programs.screenFrame,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_drawPickingBuffer(e){this.pickingFramebuffer.activate();let t=this.handler.gl;if(this.activeCamera.isFirstPass&&e===0?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND),e===0){let i=this._pickingCallbacks;for(let r=0,s=i.length;r<s;r++)i[r].callback.call(i[r].sender)}this._drawPickingEntityCollections(e),t.enable(t.BLEND),this.pickingFramebuffer.deactivate()}_drawDepthBuffer(e){this.depthFramebuffer.activate();let t=this.handler,i=t.gl;if(i.disable(i.BLEND),this.activeCamera.isFirstPass&&e===0?(i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)):i.clear(i.DEPTH_BUFFER_BIT),e===0){let r=this._depthCallbacks,s=r.length;for(;s--;)r[s].callback.call(r[s].sender)}if(this._drawDepthEntityCollections(e),this.depthFramebuffer.deactivate(),this._currentOutput==="depth"||this._currentOutput==="frustum"){this.screenDepthFramebuffer.activate();let r=t.programs.depth,s=r._program;i.bindBuffer(i.ARRAY_BUFFER,this.screenFramePositionBuffer),i.vertexAttribPointer(s.attributes.corners,2,i.FLOAT,!1,0,0),r.activate(),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.depthFramebuffer.textures[1]),i.uniform1i(s.uniforms.depthTexture,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.screenDepthFramebuffer.deactivate(),i.enable(i.BLEND)}}_readDepthBuffer(e){this.depthFramebuffer.readPixelBuffersAsync(e)}_readPickingBuffer_webgl1(){this.pickingFramebuffer.readPixelBuffersAsync()}_readPickingBuffer_webgl2(){this.pickingFramebuffer.readPixelBuffersAsync()}readPickingColor(e,t,i){var r;let s=this.pickingFramebuffer.width,n=this.pickingFramebuffer.height;e=Math.round(e*s);let o=4*((t=Math.round(t*n))*s+e),l=(r=this.pickingFramebuffer)==null?void 0:r.pixelBuffers[0].data;l&&(i[0]=l[o],i[1]=l[o+1],i[2]=l[o+2])}readDepth(e,t,i){let r=new Float32Array(4),s=new Uint8Array(4);this.depthFramebuffer.readData(e,t,s,0),this.depthFramebuffer.readData(e,t,r,1),i[0]=r[0],i[1]=Math.round(s[0]/10)-1}getDistanceFromPixel(e){let t=this.activeCamera,i=this.handler.canvas,r=e.x/i.width,s=(i.height-e.y)/i.height;if(jt[0]=jt[1]=0,this.readDepth(r,s,jt),jt[1]===-1)return;let n=jt[0],o=t.frustums[jt[1]];if(!o)return;let l=new te(2*r-1,2*s-1,2*n-1,1),h=o.inverseProjectionMatrix.mulVec4(l),c=-h.z/h.w;if(t.isOrthographic)return c;let d=e.direction||t.unproject(e.x,e.y);return c/Math.max(1e-6,d.dot(t.getForward()))}getCartesianFromPixel(e){let t=this.getDistanceFromPixel(e);if(t){if(this.activeCamera.isOrthographic){let i=new m;return this.activeCamera.unproject(e.x,e.y,t,i),i}return(e.direction||this.activeCamera.unproject(e.x,e.y)).scaleTo(t).addA(this.activeCamera.eye)}}getCartesianFromPixelAsync(e){return new Promise((t,i)=>{this._readDepthBuffer(()=>{t(this.getCartesianFromPixel(e))})})}getDepthMinDistance(){let e=this.handler.canvas,t=e.width,i=e.height,r=tr,s=i*t,n=new N;for(let o=0;o<s;o++){n.x=o%t,n.y=Math.floor(o/t);let l=this.getDistanceFromPixel(n);l&&l<r&&(r=l)}return r<tr?r:0}getDepthMinDistanceAsync(){return new Promise((e,t)=>{this._readDepthBuffer(()=>{e(this.getDepthMinDistance())})})}async setOrthographicProjection(e){if(e!==this.activeCamera.isOrthographic){let t=await this.getDepthMinDistanceAsync();t&&e&&(this.activeCamera.focusDistance=t),this.activeCamera.isOrthographic=e,this.events.dispatch(this.events.projchanged,this.activeCamera)}}start(){this._initialized||this.initialize(),this.handler.start()}destroy(){for(let e in this.controls)this.controls[e].remove();for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].remove();this.div=null,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.controls={},this.controlsBag={},this.colorObjects.clear(),this.colorObjects=null,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=null,this._depthCallbacks=[],this.depthFramebuffer=null,this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._entityCollections=[[]],this.handler.ONCANVASRESIZE=null,this.handler.destroy(),this.handler=null,this._initialized=!1}}const bo="/res",wo=class er{constructor(e){this.$target=null,this._instanceID=`__globus${er.__counter__++?er.__counter__:""}__`,window[this._instanceID]=this,this._canvas=document.createElement("canvas"),this._canvas.id=`canvas${this._instanceID}`,this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._canvas.style.opacity="0.0",this._canvas.style.transition="opacity 150ms",this.$inner=document.createElement("div"),this.$inner.classList.add("og-inner"),this.$inner.appendChild(this._canvas),this.$inner.attributions=document.createElement("div"),e.attributionContainer?e.attributionContainer.appendChild(this.$inner.attributions):(this.$inner.attributions.classList.add("og-attribution"),this.$inner.appendChild(this.$inner.attributions)),e.target&&this.attachTo(e.target);const t=n=>{n.preventDefault()};this._canvas.onmouseenter=function(){document.addEventListener("mousewheel",t,{capture:!1,passive:!1})},this._canvas.onmouseleave=function(){document.removeEventListener("mousewheel",t)},this.renderer=new sd(new bt(this._canvas,{autoActivate:!1,pixelRatio:e.dpi||window.devicePixelRatio+.15,context:{antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1}}),{autoActivate:!1,msaa:e.msaa,fontsSrc:e.fontsSrc,gamma:e.gamma,exposure:e.exposure}),this.renderer.div=this.$inner,e.skybox&&this.renderer.addNode(e.skybox),this._planetName=e.name?e.name:"globus_planet_"+er.__counter__,this.planet=new yi({name:this._planetName,frustums:e.frustums,ellipsoid:e.ellipsoid,maxGridSize:e.maxGridSize,nightTextureSrc:e.nightTextureSrc===null?null:e.nightTextureSrc||`${e.resourcesSrc||bo}/night.png`,specularTextureSrc:e.specularTextureSrc===null?null:e.specularTextureSrc||`${e.resourcesSrc||bo}/spec.png`,minAltitude:e.minAltitude,maxAltitude:e.maxAltitude||15e6,maxEqualZoomAltitude:e.maxEqualZoomAltitude,minEqualZoomAltitude:e.minEqualZoomAltitude,minEqualZoomCameraSlope:e.minEqualZoomCameraSlope,quadTreeStrategyPrototype:e.quadTreeStrategyPrototype,maxLoadingRequests:e.maxLoadingRequests,atmosphereEnabled:e.atmosphereEnabled,transitionOpacityEnabled:e.transitionOpacityEnabled,atmosphereParameters:e.atmosphereParameters,minDistanceBeforeMemClear:e.minDistanceBeforeMemClear,vectorTileSize:e.vectorTileSize,maxNodesCount:e.maxNodesCount}),e.terrain?Array.isArray(e.terrain)?this.planet.setTerrain(e.terrain[0]):this.planet.setTerrain(e.terrain):this.planet.setTerrain(new ds),this.renderer.addNode(this.planet),e.controls?this.planet.addControls(e.controls):this.planet.addControls([new Ta,new ua,new Ca,new ha,new xa,new Qs,new Jr]);const i=this.renderer.controls;let r;for(let n in i)if(i[n]instanceof qr){r=i[n];break}r?this.sun=r:(this.sun=new qr,this.planet.addControl(this.sun)),e.sun&&(e.sun.active===void 0||e.sun.active||this.sun.deactivate(),e.sun.stopped===!0&&this.sun.stop()),e.layers&&this.planet.addLayers(e.layers);let s=e.viewExtent;s&&(s instanceof Array?this.planet.viewExtentArr(s):this.planet.viewExtent(s)),(e.autoActivate||Ge(e.autoActivate))&&this.start()}start(){this.renderer.start(),this.fadeIn()}fadeIn(){this._canvas.style.opacity="1.0"}fadeOut(){this._canvas.style.opacity="0"}attachTo(e,t){let i;this.detach(),i=e instanceof HTMLElement?e:document.getElementById(e)||document.querySelector(e),i?(this.$target=i,t&&this.$target.firstChild?this.$target.insertBefore(this.$inner,this.$target.firstChild):i.appendChild(this.$inner)):console.warn(`Target container not found. Provided target: ${e}`)}detach(){this.$target&&(this.$target.removeChild(this.$inner),this.$target=null)}destroy(){this.detach(),this.planet.layers.forEach(e=>e.remove()),this.planet.destroy(),this.renderer.destroy(),window[this._instanceID]=null}};wo.__counter__=0;let nd=wo;new cr(3396200,3389508),new cr(1737400,1737400);var ad=(a=>(a[a.byte=5120]="byte",a[a.ubyte=5121]="ubyte",a[a.short=5122]="short",a[a.ushort=5123]="ushort",a[a.uint=5125]="uint",a[a.float=5126]="float",a))(ad||{}),od=(a=>(a.scalar="SCALAR",a.vec2="VEC2",a.vec3="VEC3",a.vec4="VEC4",a.mat2="MAT2",a.mat3="MAT3",a.mat4="MAT4",a))(od||{}),ld=(a=>(a[a.points=0]="points",a[a.lines=1]="lines",a[a.lineLoop=2]="lineLoop",a[a.lineStrip=3]="lineStrip",a[a.triangles=4]="triangles",a[a.triangleStrip=5]="triangleStrip",a[a.triangleFan=6]="triangleFan",a))(ld||{});const hd=({children:a,onDraw:e,...t})=>{const i=S.useRef(null),{setGlobe:r}=dt(),[s,n]=S.useState(t),o=S.useRef(null);return S.useEffect(()=>{if(o&&o.current&&t.viewExtent!==void 0){const l=t.viewExtent instanceof j?t.viewExtent:new j(new A(t.viewExtent[0],t.viewExtent[1]),new A(t.viewExtent[2],t.viewExtent[3]));o.current.planet.viewExtent(l)}},[t.viewExtent]),S.useEffect(()=>{o&&o.current&&t.atmosphereEnabled!==void 0&&(o.current.planet.atmosphereEnabled=t.atmosphereEnabled)},[t.atmosphereEnabled]),S.useEffect(()=>{var l,h;o&&o.current&&t.sunActive!==void 0&&(t.sunActive?(l=o.current)==null||l.sun.activate():(h=o.current)==null||h.sun.deactivate())},[t.sunActive]),S.useEffect(()=>{if(o.current)i.current=o.current.$target;else{const l=new vo("OSM"),h=new yo("Microsoft Bing");o.current=new nd({target:i.current,name:"Earth",terrain:new po,layers:[l,h],autoActivate:!0,atmosphereEnabled:!0,...s}),e&&o.current.planet.events.on("draw",e)}return r(o.current),()=>{o.current&&(e&&o.current.planet.events.off("draw",e),o.current.destroy(),o.current=null)}},[s]),Fe.createElement("div",{style:{width:"100%",height:"100%"},ref:i},a)},cd=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.src=="string"&&i.current&&((r=i.current)==null||r.setSrc(e.src))},[e.src]),S.useEffect(()=>{if(t)return i.current=new rs(a,e),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),null},dd=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.src=="string"&&i.current&&((r=i.current)==null||r.setSrc(e.src))},[e.src]),S.useEffect(()=>{if(t)return i.current=new mo(a,e),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),null},ud=({name:a,...e})=>{const{globe:t}=dt(),i=S.useRef(null);return S.useEffect(()=>{var r;typeof e.url=="string"&&i.current&&((r=i.current)==null||r.setUrl(e.url))},[e.url]),S.useEffect(()=>{if(t)return i.current=new xi(a,{...e}),t.planet.addLayer(i.current),()=>{i.current&&t.planet.removeLayer(i.current)}},[t]),Fe.createElement(ps,{layerRef:i,name:a,...e})},ps=({opacity:a,children:e,name:t,layerRef:i,...r})=>{const[s,n]=Fe.useState(!1);return S.useEffect(()=>{i&&i.current&&typeof a=="number"&&s&&(i.current.opacity=a)},[a]),S.useEffect(()=>{var o,l,h,c,d,u,g,f,p,_,v,x,y,w,b,E,C,T,L,M,R,z,F,P,D,k;return s&&i&&i.current&&(r.onVisibilityChange&&((o=i.current)==null||o.events.on("visibilitychange",r.onVisibilityChange)),r.onAdd&&((l=i.current)==null||l.events.on("add",r.onAdd)),r.onRemove&&((h=i.current)==null||h.events.on("remove",r.onRemove)),r.onMouseMove&&((c=i.current)==null||c.events.on("mousemove",r.onMouseMove)),r.onMouseEnter&&((d=i.current)==null||d.events.on("mouseenter",r.onMouseEnter)),r.onMouseLeave&&((u=i.current)==null||u.events.on("mouseleave",r.onMouseLeave)),r.onLclick&&((g=i.current)==null||g.events.on("lclick",r.onLclick)),r.onRclick&&((f=i.current)==null||f.events.on("rclick",r.onRclick)),r.onMclick&&((p=i.current)==null||p.events.on("mclick",r.onMclick)),r.onLdblclick&&((_=i.current)==null||_.events.on("ldblclick",r.onLdblclick)),r.onRdblclick&&((v=i.current)==null||v.events.on("rdblclick",r.onRdblclick)),r.onMdblclick&&((x=i.current)==null||x.events.on("mdblclick",r.onMdblclick)),r.onLup&&((y=i.current)==null||y.events.on("lup",r.onLup)),r.onRup&&((w=i.current)==null||w.events.on("rup",r.onRup)),r.onMup&&((b=i.current)==null||b.events.on("mup",r.onMup)),r.onLdown&&((E=i.current)==null||E.events.on("ldown",r.onLdown)),r.onRdown&&((C=i.current)==null||C.events.on("rdown",r.onRdown)),r.onMdown&&((T=i.current)==null||T.events.on("mdown",r.onMdown)),r.onLhold&&((L=i.current)==null||L.events.on("lhold",r.onLhold)),r.onRhold&&((M=i.current)==null||M.events.on("rhold",r.onRhold)),r.onMhold&&((R=i.current)==null||R.events.on("mhold",r.onMhold)),r.onMouseWheel&&((z=i.current)==null||z.events.on("mousewheel",r.onMouseWheel)),r.onTouchMove&&((F=i.current)==null||F.events.on("touchmove",r.onTouchMove)),r.onTouchStart&&((P=i.current)==null||P.events.on("touchstart",r.onTouchStart)),r.onTouchEnd&&((D=i.current)==null||D.events.on("touchend",r.onTouchEnd)),r.onDoubleTouch&&((k=i.current)==null||k.events.on("doubletouch",r.onDoubleTouch))),()=>{var I;r.onLclick&&((I=i==null?void 0:i.current)==null||I.events.off("lclick",r.onLclick)),n(!1)}},[s]),i!=null&&i.current&&!s&&n(!0),Fe.createElement(Fe.Fragment,null,e)},ms=S.createContext({addEntity:()=>{},removeEntity:()=>{},addLabel:()=>{},removeLabel:()=>{},addBillboard:()=>{},removeBillboard:()=>{},addGeoObject:()=>{},removeGeoObject:()=>{},addGeometry:()=>{},removeGeometry:()=>{},addPolyline:()=>{},removePolyline:()=>{},addStrip:()=>{},removeStrip:()=>{}}),_d=({visibility:a,children:e,name:t,...i})=>{const{globe:r}=dt(),s=S.useRef(null),[n,o]=S.useState([]),l=S.useRef(new Set);S.useEffect(()=>{typeof a=="boolean"&&s.current&&s.current.setVisibility(a)},[a]),S.useEffect(()=>{var C,T;if(r)return s.current=new fe(t,i),r.planet.addLayer(s.current),i.onDraw&&((C=s.current)==null||C.events.on("draw",i.onDraw)),i.onMouseEnter&&((T=s.current)==null||T.events.on("mouseenter",i.onMouseEnter)),()=>{var L,M;s.current&&(r.planet.removeLayer(s.current),i.onDraw&&((L=s.current)==null||L.events.off("draw",i.onDraw)),i.onMouseEnter&&((M=s.current)==null||M.events.off("mouseenter",i.onMouseEnter)))}},[r]),S.useEffect(()=>{if(s.current&&n.length>0){const C=n.filter(T=>!l.current.has(T));s.current.addEntities(C),C.forEach(T=>l.current.add(T))}},[n]);const h=S.useCallback(C=>{o(T=>T.includes(C)?T:[...T,C])},[]),c=S.useCallback(C=>{o(T=>T.filter(L=>L!==C)),s.current&&(s.current.removeEntity(C),l.current.delete(C))},[]),d=S.useCallback((C,T)=>{C.setBillboard(T)},[]),u=S.useCallback(C=>{var T;(T=C.billboard)==null||T.remove()},[]),g=S.useCallback((C,T)=>{C.setGeoObject(T)},[]),f=S.useCallback(C=>{var T;(T=C.geoObject)==null||T.remove()},[]),p=S.useCallback((C,T)=>{C.setLabel(T)},[]),_=S.useCallback(C=>{var T;(T=C.label)==null||T.remove()},[]),v=S.useCallback((C,T)=>{C.setGeometry(T)},[]),x=S.useCallback(C=>{var T;(T=C.geometry)==null||T.remove()},[]),y=S.useCallback((C,T)=>{C.setPolyline(T)},[]),w=S.useCallback(C=>{var T;(T=C.polyline)==null||T.remove()},[]),b=S.useCallback((C,T)=>{C.setStrip(T)},[]),E=S.useCallback(C=>{var T;(T=C.strip)==null||T.remove()},[]);return Fe.createElement(ms.Provider,{value:{addEntity:h,removeEntity:c,addBillboard:d,removeBillboard:u,addGeoObject:g,removeGeoObject:f,addLabel:p,removeLabel:_,addGeometry:v,removeGeometry:x,addPolyline:y,removePolyline:w,addStrip:b,removeStrip:E}},Fe.createElement(ps,{layerRef:s,name:t,...i},e))},fd=({visibility:a,src:e,size:t,color:i,rotation:r,offset:s,_addBillboard:n,_removeBillboard:o,...l})=>{const h=S.useRef(null);return S.useEffect(()=>{var c;typeof a=="boolean"&&h.current&&((c=h.current)==null||c.setVisibility(a))},[a]),S.useEffect(()=>{var c;typeof e=="string"&&h.current&&((c=h.current)==null||c.setSrc(e))},[e]),S.useEffect(()=>{var c;typeof r=="number"&&h.current&&((c=h.current)==null||c.setRotation(r*Math.PI/180))},[r]),S.useEffect(()=>{var c,d,u;s&&h.current&&(s instanceof m?(c=h.current)==null||c.setOffset(s.x,s.y,s.z):s instanceof N?(d=h.current)==null||d.setOffset(s.x,s.y):(u=h.current)==null||u.setOffset(s[0],s[1],s[2]))},[s]),S.useEffect(()=>{var c;t&&h.current&&((c=h.current)==null||c.setSize(t[0],t[1]))},[t]),S.useEffect(()=>{var c;typeof i=="string"&&h.current&&((c=h.current)==null||c.setColorHTML(i))},[i]),S.useEffect(()=>(h.current=new cn({...l,color:i,size:t,src:e,offset:s,visibility:a,rotation:r?r*Math.PI/180:0}),h.current&&n&&n(h.current),()=>{h.current&&o&&o(h.current)}),[n,o]),null},gd=({color:a,objSrc:e,scale:t,visibility:i,_addGeoObject:r,_removeGeoObject:s,...n})=>{const o=S.useRef(null);return S.useEffect(()=>{var l;t&&o.current&&((l=o.current)==null||l.setScale(t))},[t]),S.useEffect(()=>{var l,h,c;o.current&&(typeof a=="string"?(l=o.current)==null||l.setColorHTML(a):a instanceof te?(h=o.current)==null||h.setColor4v(a):Array.isArray(a)&&((c=o.current)==null||c.setColor(...a)))},[a]),S.useEffect(()=>{var l;e&&o.current&&((l=o.current)==null||l.setObjectSrc(e))},[e]),S.useEffect(()=>{var l;typeof i=="boolean"&&o.current&&((l=o.current)==null||l.setVisibility(i))},[i]),S.useEffect(()=>(o.current=new gn({color:a,objSrc:e,scale:t,visibility:i,...n}),o.current&&r&&r(o.current),()=>{o.current&&s&&s(o.current)}),[r,s]),null},pd=({visibility:a,size:e,color:t,rotation:i,offset:r,text:s,face:n,isRTL:o,align:l,outline:h,outlineColor:c,opacity:d,_addLabel:u,_removeLabel:g,...f})=>{const p=S.useRef(null);return S.useEffect(()=>{var _;typeof a=="boolean"&&p.current&&((_=p.current)==null||_.setVisibility(a))},[a]),S.useEffect(()=>{var _;typeof i=="number"&&p.current&&((_=p.current)==null||_.setRotation(i*Math.PI/180))},[i]),S.useEffect(()=>{var _;typeof e=="number"&&p.current&&((_=p.current)==null||_.setSize(e))},[e]),S.useEffect(()=>{var _;typeof h=="number"&&p.current&&((_=p.current)==null||_.setOutline(h))},[h]),S.useEffect(()=>{var _;typeof d=="number"&&p.current&&((_=p.current)==null||_.setOpacity(d))},[d]),S.useEffect(()=>{var _;typeof o=="boolean"&&p.current&&((_=p.current)==null||_.setRtl(o))},[o]),S.useEffect(()=>{var _,v,x;r&&p.current&&(r instanceof m?(_=p.current)==null||_.setOffset(r.x,r.y,r.z):r instanceof N?(v=p.current)==null||v.setOffset(r.x,r.y):(x=p.current)==null||x.setOffset(r[0],r[1],r[2]))},[r]),S.useEffect(()=>{var _;typeof s=="string"&&p.current&&((_=p.current)==null||_.setText(s))},[s]),S.useEffect(()=>{var _;typeof n=="string"&&p.current&&((_=p.current)==null||_.setFace(n))},[n]),S.useEffect(()=>{var _;typeof l=="string"&&p.current&&((_=p.current)==null||_.setAlign(l))},[l]),S.useEffect(()=>{var _;typeof t=="string"&&p.current&&((_=p.current)==null||_.setColorHTML(t))},[t]),S.useEffect(()=>{var _;typeof c=="string"&&p.current&&((_=p.current)==null||_.setOutlineColorHTML(c))},[c]),S.useEffect(()=>(p.current=new mn({...f,color:t,size:e,text:s,face:n,isRTL:o,align:l,outline:h,outlineColor:c,opacity:d,offset:r,visibility:a,rotation:i?i*Math.PI/180:0}),p.current&&u&&u(p.current),()=>{p.current&&g&&g(p.current)}),[u,g]),null};function md(a){switch(a.type){case"POINT":return Array.isArray(a.coordinates)&&a.coordinates.length>=2&&typeof a.coordinates[0]=="number";case"LINESTRING":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.length>=2&&typeof e[0]=="number");case"POLYGON":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"));case"MULTIPOLYGON":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.every(i=>Array.isArray(i)&&i.length>=2&&typeof i[0]=="number")));case"MULTILINESTRING":return Array.isArray(a.coordinates)&&a.coordinates.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="number"));default:return!1}}const vd=a=>{const{visibility:e,fillColor:t,lineColor:i,strokeColor:r,lineWidth:s,strokeWidth:n,type:o,coordinates:l,_addGeometry:h,_removeGeometry:c}=a,d=S.useRef(null);if(!md({type:o,coordinates:l}))throw new Error(`Invalid coordinates for type ${o}`);return S.useEffect(()=>{typeof e=="boolean"&&d.current&&d.current.setVisibility(e)},[e]),S.useEffect(()=>{if(t!==void 0&&d.current){if(t instanceof te)d.current.setFillColor4v(t);else if(Array.isArray(t))d.current.setFillColor(...t);else if(typeof t=="string"&&d.current){const u=Hi.htmlColorToRgba(t);d.current.setFillColor4v(u)}}},[t]),S.useEffect(()=>{if(i!==void 0&&d.current){if(i instanceof te)d.current.setLineColor4v(i);else if(Array.isArray(i))d.current.setLineColor(...i);else if(typeof i=="string"&&d.current){const u=Hi.htmlColorToRgba(i);d.current.setLineColor4v(u)}}},[i]),S.useEffect(()=>{if(r!==void 0&&d.current){if(r instanceof te)d.current.setStrokeColor4v(r);else if(Array.isArray(r))d.current.setStrokeColor(...r);else if(typeof r=="string"&&d.current){const u=Hi.htmlColorToRgba(r);d.current.setStrokeColor4v(u)}}},[r]),S.useEffect(()=>{typeof s=="number"&&d.current&&d.current.setLineWidth(s)},[s]),S.useEffect(()=>{typeof n=="number"&&d.current&&d.current.setStrokeWidth(n)},[n]),S.useEffect(()=>(d.current=new un({...a,type:o,coordinates:l,style:{fillColor:t,lineColor:i,strokeColor:r,lineWidth:s,strokeWidth:n},visibility:e}),d.current&&h&&h(d.current),()=>{d.current&&c&&c(d.current)}),[h,c]),null},Co=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof m,To=a=>Array.isArray(a)&&a.length>0&&(a[0][0]instanceof A||a[0][0]instanceof Array),yd=a=>a.map(e=>e.map(t=>A.createFromArray(t))),xd=a=>typeof a=="string"||Array.isArray(a),Eo=a=>Array.isArray(a)&&a.every(e=>Array.isArray(e)&&e.every(xd)),bd=a=>Array.isArray(a)&&a.every(e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length===4&&t.every(i=>typeof i=="number"))),Ao=a=>Eo(a)?a.map(e=>e.map(t=>{const i=Hi.htmlColorToRgba(t);return[i.x,i.y,i.z,i.w]})):a,wd=({visibility:a,color:e,altitude:t,thickness:i,opacity:r,isClosed:s,pathColors:n,path:o,_addPolyline:l,_removePolyline:h,...c})=>{const d=S.useRef(null);return S.useEffect(()=>{var u;typeof a=="boolean"&&d.current&&((u=d.current)==null||u.setVisibility(a))},[a]),S.useEffect(()=>{var u;typeof e=="string"&&d.current&&((u=d.current)==null||u.setColorHTML(e))},[e]),S.useEffect(()=>{var u;typeof t=="number"&&d.current&&((u=d.current)==null||u.setAltitude(t))},[t]),S.useEffect(()=>{var u;typeof i=="number"&&d.current&&((u=d.current)==null||u.setThickness(i))},[i]),S.useEffect(()=>{var u;typeof r=="number"&&d.current&&((u=d.current)==null||u.setOpacity(r))},[r]),S.useEffect(()=>{var u,g,f;if(d.current&&o!==void 0)if(To(o))(u=d.current)==null||u.setPathLonLat(o);else if(Co(o))(g=d.current)==null||g.setPath3v(o);else{const p=yd(o);p&&((f=d.current)==null||f.setPathLonLat(p))}},[o]),S.useEffect(()=>{var u,g;if(n&&Array.isArray(n)&&n.length>0)if(Eo(n)){const f=Ao(n);f&&((u=d.current)==null||u.setPathColors(f))}else bd(n)&&((g=d.current)==null||g.setPathColors(n))},[n]),S.useEffect(()=>(d.current=new xn({...c,color:e,visibility:a,opacity:r,thickness:i,pathLonLat:o&&To(o)?o:void 0,path3v:o&&Co(o)?o:void 0,pathColors:Ao(n),altitude:t}),d.current&&l&&l(d.current),()=>{d.current&&h&&h(d.current)}),[l,h]),null},Cd=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof m,Td=a=>Array.isArray(a)&&a.length>0&&a[0][0]instanceof A,Lo=(a,e)=>e?Cd(e)?e:Td(e)?e.map(t=>t.map(i=>a.lonLatToCartesian(i))):e.map(t=>t.map(i=>a.lonLatToCartesian(A.createFromArray(i)))):[],Ed=({visibility:a,color:e,opacity:t,path:i,_addStrip:r,_removeStrip:s,...n})=>{const o=S.useRef(null),{globe:l}=dt();return S.useEffect(()=>{var h;typeof a=="boolean"&&o.current&&((h=o.current)==null||h.setVisibility(a))},[a]),S.useEffect(()=>{var h;typeof t=="number"&&o.current&&((h=o.current)==null||h.setOpacity(t))},[t]),S.useEffect(()=>{var h;l&&i!==void 0&&o.current&&((h=o.current)==null||h.setPath(Lo(l.planet.ellipsoid,i)))},[i]),S.useEffect(()=>{var h;typeof e=="string"&&o.current&&((h=o.current)==null||h.setColorHTML(e))},[e]),S.useEffect(()=>(l&&(o.current=new Cn({...n,color:e,visibility:a,path:Lo(l.planet.ellipsoid,i),opacity:t}),o.current&&r&&r(o.current)),()=>{o.current&&s&&s(o.current)}),[r,s,l]),null},Ad=({visibility:a,lon:e,lat:t,alt:i,lonlat:r,name:s,children:n,...o})=>{const{globe:l}=dt(),{addEntity:h,removeEntity:c,addBillboard:d,removeBillboard:u,addGeoObject:g,removeGeoObject:f,addLabel:p,removeLabel:_,addGeometry:v,removeGeometry:x,addPolyline:y,removePolyline:w,addStrip:b,removeStrip:E}=S.useContext(ms),C=S.useRef(null),[T,L]=S.useState(null),[M,R]=S.useState(null),[z,F]=S.useState(null),[P,D]=S.useState(null),[k,I]=S.useState(null),[B,G]=S.useState(null);S.useEffect(()=>{var $;r&&(r instanceof A||(r=A.createFromArray(r)),($=C.current)==null||$.setLonLat(r))},[r,T]),S.useEffect(()=>{var $;s&&(($=C.current)==null||$.setLonLat2(e,t,i))},[e,t,i]),S.useEffect(()=>{var $;typeof a=="boolean"&&C.current&&(($=C.current)==null||$.setVisibility(a))},[a]),S.useEffect(()=>{if(l)return C.current=new V({lonlat:r||new A(e,t,i),name:s,...o}),h(C.current),()=>{l&&C.current&&c(C.current)}},[l,h,c]),S.useEffect(()=>{var $,Be;T&&!(($=C.current)!=null&&$.billboard)&&((Be=C.current)==null||Be.setBillboard(T))},[T]),S.useEffect(()=>{var $,Be;M&&!(($=C.current)!=null&&$.geoObject)&&((Be=C.current)==null||Be.setGeoObject(M))},[M]),S.useEffect(()=>{var $,Be;z&&!(($=C.current)!=null&&$.label)&&((Be=C.current)==null||Be.setLabel(z))},[z]),S.useEffect(()=>{var $,Be;P&&!(($=C.current)!=null&&$.geometry)&&((Be=C.current)==null||Be.setGeometry(P))},[P]),S.useEffect(()=>{var $,Be;k&&!(($=C.current)!=null&&$.polyline)&&((Be=C.current)==null||Be.setPolyline(k))},[k]),S.useEffect(()=>{var $,Be;B&&!(($=C.current)!=null&&$.strip)&&((Be=C.current)==null||Be.setStrip(B))},[B]);const Ve=S.useCallback($=>{L($),C.current&&d(C.current,$)},[d]),ve=S.useCallback(()=>{C.current&&u(C.current),L(null)},[u]),ze=S.useCallback($=>{R($),C.current&&g(C.current,$)},[g]),Re=S.useCallback(()=>{C.current&&f(C.current),R(null)},[f]),ie=S.useCallback($=>{F($),C.current&&p(C.current,$)},[p]),Ue=S.useCallback(()=>{C.current&&_(C.current),R(null)},[_]),De=S.useCallback($=>{D($),C.current&&v(C.current,$)},[v]),Ei=S.useCallback(()=>{C.current&&x(C.current),R(null)},[x]),Ai=S.useCallback($=>{I($),C.current&&y(C.current,$)},[y]),Li=S.useCallback(()=>{C.current&&w(C.current),I(null)},[w]),Pd=S.useCallback($=>{G($),C.current&&b(C.current,$)},[b]),Sd=S.useCallback(()=>{C.current&&E(C.current),G(null)},[E]),Po={_addGeometry:De,_removeGeometry:Ei,_addLabel:ie,_removeLabel:Ue,_addBillboard:Ve,_removeBillboard:ve,_addGeoObject:ze,_removeGeoObject:Re,_addPolyline:Ai,_removePolyline:Li,_addStrip:Pd,_removeStrip:Sd};return n?Fe.createElement(Fe.Fragment,null,Array.isArray(n)?n.map($=>Fe.isValidElement($)?Fe.cloneElement($,Po):$):Fe.isValidElement(n)?Fe.cloneElement(n,Po):n):null},Ld=({lon:a,lat:e,alt:t,lookLon:i,lookLat:r,lookAlt:s,viewAngle:n,...o})=>{const{globe:l}=dt();return S.useEffect(()=>{l&&typeof a=="number"&&typeof e=="number"&&typeof t=="number"&&l.planet.flyLonLat(new A(a,e,t),new A(i,r,s))},[a,e,t,i,r,s,l]),S.useEffect(()=>{l&&typeof n=="number"&&l.planet.camera.setViewAngle(n)},[n,l]),null};ce.Billboard=fd,ce.Entity=Ad,ce.GeoImage=cd,ce.GeoObject=gd,ce.GeoVideo=dd,ce.Geometry=vd,ce.Globe=hd,ce.GlobeContextProvider=Jo,ce.Label=pd,ce.Layer=ps,ce.PlanetCamera=Ld,ce.Polyline=wd,ce.Strip=Ed,ce.Vector=_d,ce.VectorContext=ms,ce.XYZ=ud,ce.useGlobeContext=dt,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})});
|
|
941
941
|
//# sourceMappingURL=index.umd.cjs.map
|