@terra.gl/core 0.0.1-alpha.68 → 0.0.1-alpha.69
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 +3 -3
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yt from "three";
|
|
2
2
|
import { REVISION as pf, TrianglesDrawMode as ib, TriangleFanDrawMode as ec, TriangleStripDrawMode as mf, Mesh as Ze, Vector3 as O, Color as he, FrontSide as ua, Plane as gf, Matrix4 as Le, Vector4 as Mi, PerspectiveCamera as lr, WebGLRenderTarget as Dr, UniformsUtils as dr, UniformsLib as aa, ShaderMaterial as At, MOUSE as wn, TOUCH as bn, Spherical as ad, Quaternion as bi, OrthographicCamera as cr, Vector2 as ce, Ray as nb, PlaneGeometry as Ti, HalfFloatType as nr, AdditiveBlending as yc, MeshBasicMaterial as xi, RGBAFormat as yf, LinearFilter as Gn, NoBlending as rb, Clock as da, Loader as _c, LoaderUtils as Xr, FileLoader as Wn, MeshPhysicalMaterial as Oi, SpotLight as _f, PointLight as tc, DirectionalLight as la, InstancedMesh as vc, InstancedBufferAttribute as ic, Object3D as Si, TextureLoader as zs, ImageBitmapLoader as sb, BufferAttribute as Mt, InterleavedBuffer as ob, InterleavedBufferAttribute as rr, LinearMipmapLinearFilter as Os, NearestMipmapLinearFilter as ab, LinearMipmapNearestFilter as lb, NearestMipmapNearestFilter as cb, NearestFilter as vf, RepeatWrapping as Li, MirroredRepeatWrapping as hb, ClampToEdgeWrapping as nc, PointsMaterial as fa, Material as Gl, LineBasicMaterial as wc, MeshStandardMaterial as Ds, DoubleSide as Yr, PropertyBinding as As, BufferGeometry as Bt, SkinnedMesh as wf, LineSegments as ub, Line as bc, LineLoop as db, Points as Br, Group as ci, MathUtils as wt, Skeleton as bf, AnimationClip as xf, Bone as rc, InterpolateDiscrete as fb, InterpolateLinear as Tf, Texture as Ur, VectorKeyframeTrack as sc, NumberKeyframeTrack as oc, QuaternionKeyframeTrack as ac, Interpolant as pb, Box3 as mr, Sphere as xc, Curve as mb, MeshPhongMaterial as Rs, MeshLambertMaterial as Sf, EquirectangularReflectionMapping as gb, AmbientLight as Mf, Float32BufferAttribute as xn, Uint16BufferAttribute as yb, Matrix3 as _b, Euler as Ls, DataTextureLoader as vb, FloatType as ra, DataUtils as Ao, InstancedBufferGeometry as Lf, InstancedInterleavedBuffer as lc, WireframeGeometry as wb, Line3 as bb, EventDispatcher as Pf, Scene as Cf, FogExp2 as ld, CubeTextureLoader as xb, WebGLRenderer as Tb, PCFSoftShadowMap as Sb, ACESFilmicToneMapping as Mb, SRGBColorSpace as Kr, CameraHelper as Lb, CubicBezierCurve3 as Pb, Frustum as Cb, Raycaster as Fs, CanvasTexture as gr, SpriteMaterial as Zn, Sprite as Vi, DynamicDrawUsage as cd, NormalBlending as Gf, CurvePath as Wf, LineCurve3 as kr, QuadraticBezierCurve3 as Zf, TubeGeometry as Gb, BackSide as Wb, Shape as Zb, ShapeGeometry as Rb, CylinderGeometry as Ib, AnimationMixer as Eb, LoopRepeat as Ab, LoopOnce as Fb, LoadingManager as Vb, Box2 as zb, ImageLoader as Rf } from "three";
|
|
3
|
-
const Ob = "0.0.1-alpha.
|
|
3
|
+
const Ob = "0.0.1-alpha.69", Wl = {
|
|
4
4
|
name: "Criska"
|
|
5
5
|
};
|
|
6
6
|
var Is = function() {
|
|
@@ -19785,7 +19785,7 @@ function A2(r, e) {
|
|
|
19785
19785
|
}
|
|
19786
19786
|
const F2 = `{
|
|
19787
19787
|
"name": "@terra.gl/core",
|
|
19788
|
-
"version": "0.0.1-alpha.
|
|
19788
|
+
"version": "0.0.1-alpha.69",
|
|
19789
19789
|
"type": "module",
|
|
19790
19790
|
"files": [
|
|
19791
19791
|
"dist"
|
|
@@ -25346,7 +25346,7 @@ class pC extends Hs {
|
|
|
25346
25346
|
* 触发自定义事件
|
|
25347
25347
|
*/
|
|
25348
25348
|
_emitEvent(e) {
|
|
25349
|
-
this.
|
|
25349
|
+
this.trigger(e, { target: this });
|
|
25350
25350
|
}
|
|
25351
25351
|
/**
|
|
25352
25352
|
* Destroy the layer and clean up all resources.
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(q,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],p):(q=typeof globalThis<"u"?globalThis:q||self,p(q["terra-gl"]={},q.THREE))})(this,function(q,p){"use strict";function pf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ut=pf(p),mf="0.0.1-alpha.
|
|
1
|
+
(function(q,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],p):(q=typeof globalThis<"u"?globalThis:q||self,p(q["terra-gl"]={},q.THREE))})(this,function(q,p){"use strict";function pf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ut=pf(p),mf="0.0.1-alpha.69",xo={name:"Criska"};var gr=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++r%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";r=m}var n=(performance||Date).now(),s=n,a=0,c=t(new gr.Panel("FPS","#0ff","#002")),h=t(new gr.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new gr.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){n=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(h.update(m-n,200),m>=s+1e3&&(c.update(a*1e3/(m-s),100),s=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){n=this.end()},domElement:e,setMode:i}};gr.Panel=function(r,e,t){var i=1/0,n=0,s=Math.round,a=s(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,_=74*a,w=30*a,b=document.createElement("canvas");b.width=c,b.height=h,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*a+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=t,x.fillRect(0,0,c,h),x.fillStyle=e,x.fillText(r,d,m),x.fillRect(f,g,_,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,_,w),{dom:b,update:function(L,M){i=Math.min(i,L),n=Math.max(n,L),x.fillStyle=t,x.globalAlpha=1,x.fillRect(0,0,c,g),x.fillStyle=e,x.fillText(s(L)+" "+r+" ("+s(i)+"-"+s(n)+")",d,m),x.drawImage(b,f+a,g,_-a,w,f,g,_-a,w),x.fillRect(f+_-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+_-a,g,a,s((1-L/M)*w))}}};const ns=parseInt(p.REVISION.replace(/\D+/g,"")),Mo=ns>=125?"uv1":"uv2";function Dl(r,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=r.getIndex();if(t===null){const a=[],c=r.getAttribute("position");if(c!==void 0){for(let h=0;h<c.count;h++)a.push(h);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const i=t.count-2,n=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=i;a++)n.push(t.getX(0)),n.push(t.getX(a)),n.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(n.push(t.getX(a)),n.push(t.getX(a+1)),n.push(t.getX(a+2))):(n.push(t.getX(a+2)),n.push(t.getX(a+1)),n.push(t.getX(a)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var Kt=Uint8Array,Xi=Uint16Array,So=Uint32Array,Xl=new Kt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),kl=new Kt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),gf=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ul=function(r,e){for(var t=new Xi(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new So(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return[t,n]},Nl=Ul(Xl,2),Kl=Nl[0],yf=Nl[1];Kl[28]=258,yf[258]=28;for(var _f=Ul(kl,0),vf=_f[0],Lo=new Xi(32768),Ze=0;Ze<32768;++Ze){var ki=(Ze&43690)>>>1|(Ze&21845)<<1;ki=(ki&52428)>>>2|(ki&13107)<<2,ki=(ki&61680)>>>4|(ki&3855)<<4,Lo[Ze]=((ki&65280)>>>8|(ki&255)<<8)>>>1}for(var yr=function(r,e,t){for(var i=r.length,n=0,s=new Xi(e);n<i;++n)++s[r[n]-1];var a=new Xi(e);for(n=0;n<e;++n)a[n]=a[n-1]+s[n-1]<<1;var c;if(t){c=new Xi(1<<e);var h=15-e;for(n=0;n<i;++n)if(r[n])for(var d=n<<4|r[n],m=e-r[n],f=a[r[n]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[Lo[f]>>>h]=d}else for(c=new Xi(i),n=0;n<i;++n)r[n]&&(c[n]=Lo[a[r[n]-1]++]>>>15-r[n]);return c},_r=new Kt(288),Ze=0;Ze<144;++Ze)_r[Ze]=8;for(var Ze=144;Ze<256;++Ze)_r[Ze]=9;for(var Ze=256;Ze<280;++Ze)_r[Ze]=7;for(var Ze=280;Ze<288;++Ze)_r[Ze]=8;for(var Bl=new Kt(32),Ze=0;Ze<32;++Ze)Bl[Ze]=5;var wf=yr(_r,9,1),bf=yr(Bl,5,1),Po=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ii=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Co=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},xf=function(r){return(r/8|0)+(r&7&&1)},Mf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Xi?Xi:r instanceof So?So:Kt)(t-e);return i.set(r.subarray(e,t)),i},Sf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Kt(0);var n=!e||t,s=!t||t.i;t||(t={}),e||(e=new Kt(i*3));var a=function(pt){var $e=e.length;if(pt>$e){var Re=new Kt(Math.max($e*2,pt));Re.set(e),e=Re}},c=t.f||0,h=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,_=t.n,w=i*8;do{if(!m){t.f=c=ii(r,h,1);var b=ii(r,h+1,3);if(h+=3,b)if(b==1)m=wf,f=bf,g=9,_=5;else if(b==2){var C=ii(r,h,31)+257,W=ii(r,h+10,15)+4,D=C+ii(r,h+5,31)+1;h+=14;for(var z=new Kt(D),X=new Kt(19),I=0;I<W;++I)X[gf[I]]=ii(r,h+I*3,7);h+=W*3;for(var U=Po(X),V=(1<<U)-1,G=yr(X,U,1),I=0;I<D;){var N=G[ii(r,h,V)];h+=N&15;var x=N>>>4;if(x<16)z[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ii(r,h,3),h+=2,j=z[I-1]):x==17?(Y=3+ii(r,h,7),h+=3):x==18&&(Y=11+ii(r,h,127),h+=7);Y--;)z[I++]=j}}var H=z.subarray(0,C),Q=z.subarray(C);g=Po(H),_=Po(Q),m=yr(H,g,1),f=yr(Q,_,1)}else throw"invalid block type";else{var x=xf(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(s)throw"unexpected EOF";break}n&&a(d+L),e.set(r.subarray(x,M),d),t.b=d+=L,t.p=h=M*8;continue}if(h>w){if(s)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<_)-1,le=h;;le=h){var j=m[Co(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(s)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=h,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Xl[I];ge=ii(r,h,(1<<fe)-1)+Kl[I],h+=fe}var Se=f[Co(r,h)&ne],st=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=vf[st];if(st>3){var fe=kl[st];Q+=Co(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(s)throw"unexpected EOF";break}n&&a(d+131072);for(var ot=d+ge;d<ot;d+=4)e[d]=e[d-Q],e[d+1]=e[d+1-Q],e[d+2]=e[d+2-Q],e[d+3]=e[d+3-Q];d=ot}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=_)}while(!c);return d==e.length?e:Mf(e,0,d)},Lf=new Kt(0),Pf=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Cf(r,e){return Sf((Pf(r),r.subarray(2,-4)),e)}var Tf=typeof TextDecoder<"u"&&new TextDecoder,Gf=0;try{Tf.decode(Lf,{stream:!0}),Gf=1}catch{}class Wf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,h=t.time!==void 0?t.time:0,d=t.waterNormals!==void 0?t.waterNormals:null,m=t.sunDirection!==void 0?t.sunDirection:new p.Vector3(.70707,.70707,0),f=new p.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new p.Color(t.waterColor!==void 0?t.waterColor:8355711),_=t.eye!==void 0?t.eye:new p.Vector3(0,0,0),w=t.distortionScale!==void 0?t.distortionScale:20,b=t.side!==void 0?t.side:p.FrontSide,x=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,W=new p.Vector3,D=new p.Matrix4,z=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,U=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,N=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,s),Y={uniforms:p.UniformsUtils.merge([p.UniformsLib.fog,p.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new p.Matrix4},sunColor:{value:new p.Color(8355711)},sunDirection:{value:new p.Vector3(.70707,.70707,0)},eye:{value:new p.Vector3},waterColor:{value:new p.Color(5592405)}}]),vertexShader:`
|
|
2
2
|
uniform mat4 textureMatrix;
|
|
3
3
|
uniform float time;
|
|
4
4
|
|
|
@@ -1121,7 +1121,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1121
1121
|
}
|
|
1122
1122
|
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ut.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ut.Vector3;t.getCenter(i);const n=[new ut.Vector3(t.min.x,t.min.y,t.min.z),new ut.Vector3(t.max.x,t.max.y,t.max.z)];let s=0;n.forEach(a=>{const c=i.distanceTo(a);c>s&&(s=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:s},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}var ty=Object.defineProperty,iy=(r,e,t)=>e in r?ty(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ri=(r,e,t)=>iy(r,typeof e!="symbol"?e+"":e,t);const ny={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class sh extends ni{constructor(e){super(e),ri(this,"_type","Model"),ri(this,"_emissive",!1),ri(this,"_emissiveIntensity",1),ri(this,"_emissiveColor","#ffffff"),ri(this,"_mixer",null),ri(this,"_currentAction",null),ri(this,"_animations",[]),ri(this,"_clock",new p.Clock),ri(this,"_autoUpdate",!0),ri(this,"_animationRequestId",null),ri(this,"_iscity",!1),this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity(),this.trigger("loaded",{timestamp:xc(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return mg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const t=e.material;t&&(t.emissiveIntensity=this._emissive?this._emissiveIntensity:0,t.emissive&&t.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,t,i){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(i=>i.name===e.name),t?t.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const t=this._clock.getDelta();this._mixer.update(t)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_computeOverlayVertices(e){const t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const h=t.getMap?.()||this.getMap();if(h&&h.prjcenter){const d=h.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const _=m[g],w=m[g+2],b=d.x+_,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const i=this.getMap();if(!i||!e.geometry)return null;const n=e.geometry;let s;if(n.type==="Polygon")s=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;s=n.coordinates[0]}else return null;if(!s.length||!s[0].length)return null;const a=s[0],c=[];for(const h of a){const d=h[0],m=h[1],f=i.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const n=i.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),s=n[n.length-1];if(s&&(s.geometry||s.feature)){const a=this._computeOverlayVertices(s);a&&a.length>=3&&(t={color:new p.Color(s.color??"#00FF88"),opacity:s.opacity??.3,vertices:a})}}}this.traverse(async i=>{if(i instanceof p.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const n=new ey({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),s=new p.Box3().setFromObject(i);n.updateBoundingBox(s.min.y,s.max.y),n.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=n,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const s=i.material[n];s&&(s.wrapS=s.wrapT=p.RepeatWrapping,s.repeat.set(.3,.3),s.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}sh.mergeOptions(ny);var ry=Object.defineProperty,sy=(r,e,t)=>e in r?ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oy=(r,e,t)=>sy(r,e+"",t);const ay={};class oh extends ni{constructor(e){super(e),oy(this,"_type","Cloud")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._disposeGeometry();const e=this.getLayer();this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=99,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return wg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(ay);var ly=Object.defineProperty,cy=(r,e,t)=>e in r?ly(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,hy=(r,e,t)=>cy(r,e+"",t);const uy={};class ah extends ni{constructor(e){super(e),hy(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return xg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return bg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ah.mergeOptions(uy);var dy=Object.defineProperty,fy=(r,e,t)=>e in r?dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lh=(r,e,t)=>fy(r,typeof e!="symbol"?e+"":e,t);const py={};class ch extends ni{constructor(e){super(e),lh(this,"_type","TPoints"),lh(this,"_geometries"),this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return Zg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ch.mergeOptions(py);var my=Object.defineProperty,gy=(r,e,t)=>e in r?my(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ji=(r,e,t)=>gy(r,typeof e!="symbol"?e+"":e,t);class Vr extends Bi(Object){constructor(e,t){super(),Ji(this,"options"),Ji(this,"map"),Ji(this,"_sprite",null),Ji(this,"_isDragging",!1),Ji(this,"_dragStartPosition",null),Ji(this,"_lastCoordinate",null),Ji(this,"_boundOnMouseMove",null),Ji(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),i=t.getContext("2d");t.width=64,t.height=64;const n=64/2,s=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,s,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,s-2,0,2*Math.PI),i.fillStyle=this.options.color,i.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const h=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(h);const _=d.getPixelRatio(),w=this.options.size*_;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/h.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/h.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,i=t[0]-this._lastCoordinate[0],n=t[1]-this._lastCoordinate[1],s=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],s.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:i,dy:n}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function sa(r,e,t){const{currentTarget:i,clientX:n,clientY:s}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(s/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}var yy=Object.defineProperty,_y=(r,e,t)=>e in r?yy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ft=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t);class vy extends ds{constructor(e,t){super(e),ft(this,"options"),ft(this,"_handles",[]),ft(this,"_middleHandles",[]),ft(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ft(this,"_editing",!1),ft(this,"_shadow",null),ft(this,"_shadowSnapshot",null),ft(this,"_updating",!1),ft(this,"_history",[]),ft(this,"_historyIndex",-1),ft(this,"_draggableOriginalState",!1),ft(this,"_boundOnMapMouseMove",null),ft(this,"_boundOnMapClick",null),ft(this,"_boundOnMapMouseDown",null),ft(this,"_boundOnFeatureDragging",null),ft(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof ni?this._createPointHandles(e,t):this.target instanceof Lt?this._createLineStringHandles(e,t):this.target instanceof wi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),s=new Vr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);s.on("dragstart",a=>{this._onHandleDragStart(a,0)}),s.on("dragging",a=>{this._onHandleDragging(a,0)}),s.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(s)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Vr({position:a,index:s,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,s)}),c.on("dragging",h=>{this._onHandleDragging(h,s)}),c.on("dragend",h=>{this._onHandleDragEnd(h,s)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(i,t)}_onHandleDragging(e,t){this._updating=!0;const n=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(n,t),c=this.target._geometry;this.target instanceof ni?c.coordinates=[a.x,a.y,a.z]:this.target instanceof Lt&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const i=this.target._geometry;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]})}_createPolygonHandles(e,t){const i=e.coordinates;if(!i||!Array.isArray(i)||i.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}i.forEach((s,a)=>{if(!s||s.length<3)return;const c=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let h=0;h<c;h++){const d=s[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Vr({position:m,index:h,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,h,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,h,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,h,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(s,a,t)})}_onPolygonHandleDragStart(e,t,i){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:i,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,i){const s=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(s,t,i),d=this.target._geometry.coordinates;if(d[i]&&d[i][t]&&(d[i][t]=[c.x,c.y,c.z],t===0&&d[i].length>1)){const m=d[i].length-1;d[i][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,i){this._updating=!1;const n=this.target._geometry,s=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ni){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[0]&&this._handles[0].updatePosition(n)}else if(this.target instanceof Lt)e.coordinates.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[s]&&this._handles[s].updatePosition(a)});else if(this.target instanceof wi){const i=e.coordinates;let n=0;i.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a;c++){const h=s[c],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]||0));this._handles[n]&&this._handles[n].updatePosition(d),n++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let i=0;if(this.target instanceof Lt){const n=e.coordinates;for(let s=0;s<n.length-1&&!(i>=this._middleHandles.length);s++){const a=n[s],c=n[s+1],h=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]));this._middleHandles[i].updatePosition(d),i++}}else this.target instanceof wi&&e.coordinates.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=s[c],m=s[h],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[i].updatePosition(g),i++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const n=e,s=t.viewer.renderer.domElement,a=s.getBoundingClientRect(),c=new p.Vector2((n.clientX-a.left)/a.width*2-1,-((n.clientY-a.top)/a.height)*2+1);i.setFromCamera(c,t.viewer.camera);const h=[...this._handles,...this._middleHandles];for(const d of h)if(d.intersect(i)){const m=sa({currentTarget:s,clientX:n.clientX,clientY:n.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.preventDefault&&n.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const i=this._getMap();if(!i)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const s=e.originEvent;if(!s)return;const a=new p.Vector2(s.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(s.offsetY/i.viewer.renderer.domElement.clientHeight)*2+1);n.setFromCamera(a,i.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(n)){this._removeVertex(c),s.stopPropagation&&s.stopPropagation(),s.preventDefault&&s.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(i=>{i.material&&(e?Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity||(n.userData._originalOpacity=n.opacity),n.opacity=Math.min(n.opacity*.6,.6),n.transparent=!0}):(i.material.userData._originalOpacity||(i.material.userData._originalOpacity=i.material.opacity),i.material.opacity=Math.min(i.material.opacity*.6,.6),i.material.transparent=!0):Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity!==void 0&&(n.opacity=n.userData._originalOpacity,delete n.userData._originalOpacity)}):i.material.userData._originalOpacity!==void 0&&(i.material.opacity=i.material.userData._originalOpacity,delete i.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,i=this._handles[e],n=i.getIndex(),s=i._ringIndex||0;let a=null;if(this.target instanceof Lt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[n],c.splice(n,1)}else if(this.target instanceof wi){const h=t.coordinates[s];if(!h)return;const d=h.length>1&&h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1],m=d?4:3;if(h.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=h[n],h.splice(n,1),d&&n===0&&h.length>0&&(h[h.length-1]=[...h[0]])}else return;this.target._onPositionChanged(!0),i.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:n,ringIndex:s,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],s=e[i+1],a=[(n[0]+s[0])/2,(n[1]+s[1])/2,((n[2]||0)+(s[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Vr({position:c,index:i,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);h.on("dragstart",d=>{this._onMiddleHandleClick(i,"LineString",0)}),this._middleHandles.push(h)}}_createPolygonMiddleHandles(e,t,i){const n=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let s=0;s<n;s++){const a=(s+1)%n,c=e[s],h=e[a],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2],m=i.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Vr({position:m,index:s,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(s,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,i){const n=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=n.coordinates,c=a[e],h=a[e+1],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=n.coordinates[i];if(!c)return;const h=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%h,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===h-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(n.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:i})}}_updateHandleIndices(){if(this.target instanceof Lt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof wi){let e=0;this.target._geometry.coordinates.forEach((n,s)=>{const a=n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]?n.length-1:n.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=s),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const s=this.target._geometry;let a=null;if(this.target instanceof ni)a=s.coordinates;else if(this.target instanceof Lt)a=s.coordinates[t];else if(this.target instanceof wi){const h=s.coordinates;h[i]&&h[i][t]&&(a=h[i][t])}if(!a||!a[2]||a[2]===0)return n.world2geo(e);const c=n.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}dt.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new vy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},dt.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},dt.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},dt.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},dt.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},dt.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function bs(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(i=>bs(i,e));case"any":return r.slice(1).some(i=>bs(i,e));case"!":return!bs(r[1],e);case"==":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)==xs(n)}case"!=":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)!=xs(n)}case">":{const i=ze(r[1],e),n=ze(r[2],e);return Qi(i)>Qi(n)}case"<":{const i=ze(r[1],e),n=ze(r[2],e);return Qi(i)<Qi(n)}case">=":{const i=ze(r[1],e),n=ze(r[2],e);return Qi(i)>=Qi(n)}case"<=":{const i=ze(r[1],e),n=ze(r[2],e);return Qi(i)<=Qi(n)}case"in":{const i=ze(r[1],e);return r.slice(2).map(s=>ze(s,e)).includes(i)}case"!in":{const i=ze(r[1],e);return!r.slice(2).map(s=>ze(s,e)).includes(i)}case"has":{const i=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,i)}case"!has":{const i=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,i))}case"like":case"contains":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function ze(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function xs(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function Qi(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var wy=Object.defineProperty,by=(r,e,t)=>e in r?wy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e,t)=>by(r,typeof e!="symbol"?e+"":e,t);class Ms extends Ri{constructor(e,t){super(e,t),It(this,"TILE_SIZE"),It(this,"EXTENT"),It(this,"style"),It(this,"interactive",!1),It(this,"_tileFeatureMap",new Map),It(this,"_activeFeatureFilter"),It(this,"_layerStyleMapCache",null),It(this,"_lastBuiltStyleMap",null),It(this,"_addedFeatureIds",new Set),It(this,"_styleInstanceCache",new Map),It(this,"_totalProcessTime",0),It(this,"_processCount",0),It(this,"_totalFeatureCount",0),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}getProcessStats(){return{totalTime:this._totalProcessTime,processCount:this._processCount,totalFeatures:this._totalFeatureCount,avgTime:this._processCount>0?this._totalProcessTime/this._processCount:0}}resetProcessStats(){this._totalProcessTime=0,this._processCount=0,this._totalFeatureCount=0}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,s=performance.now(),a=this._tileFeatureMap.get(n);if(a&&a.length>0){for(let w=0;w<a.length;w++){const b=a[w];b.visible=!0,this._addedFeatureIds.has(b.uuid)||(b.addTo(this),this._addedFeatureIds.add(b.uuid))}return}const c=t.vectorData;if(!c||!c.layers||!i||this.style.length===0)return;const h=[],d=this.style,m=this._activeFeatureFilter;let f=this._layerStyleMapCache;(!f||f!==this._lastBuiltStyleMap)&&(f=this._buildLayerStyleMap(d),this._layerStyleMapCache=f,this._lastBuiltStyleMap=f);let g=0;Object.keys(c.layers).forEach(w=>{const b=c.layers[w],x=f.get(w)||d;for(let L=0;L<b.length;L++){g++;const M=b[L],C=M.geometry,W=M.properties;if(m&&!m(W))continue;let D=null;for(let z=0;z<x.length;z++){const X=x[z];if(this._evaluateFilter(X.filter,W,w,M.geometry.type)){D=X.style;break}}if(D){const z={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:C,extent:this.EXTENT,tileSize:this.TILE_SIZE},X=this._createFeatureInstance(M.geometry,M.geometry.type,D,{layerName:w,...M.properties});if(X){X.userData.tileData=z;const I=JSON.stringify(D);let U=this._styleInstanceCache.get(I);U||(U=St.create(D),this._styleInstanceCache.set(I,U)),X.style=U,X.addTo(this),this._addedFeatureIds.add(X.uuid),X.initializeGeometry(),h.push(X)}}}}),this._tileFeatureMap.set(n,h);const _=performance.now()-s;this._totalProcessTime+=_,this._processCount++,this._totalFeatureCount+=h.length,this.interactive&&console.log(`[processTileData] ${n} 处理 (${g} -> ${h.length} features) 耗时: ${_.toFixed(2)}ms | 累计: ${this._totalProcessTime.toFixed(2)}ms (${this._processCount}次, ${this._totalFeatureCount}个feature)`)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const s={...t,$layer:i,$type:n};return bs(e,s)}_buildLayerStyleMap(e){const t=new Map;for(let i=0;i<e.length;i++){const n=e[i],s=n.filter;if(s&&typeof s=="object"&&s.$layer){const a=Array.isArray(s.$layer)?s.$layer[0]:s.$layer;t.has(a)||t.set(a,[]),t.get(a).push(n)}}return t}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);if(t){for(let i=0;i<t.length;i++){const n=t[i];this._addedFeatureIds.delete(n.uuid),n._remove()}this._tileFeatureMap.delete(e)}}_createFeatureInstance(e,t,i,n){const a={geometry:{ismvt:!0,...e},style:i,userData:n};switch(t){case"Point":return new Ti(a);case"LineString":return new Lt(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this._layerStyleMapCache=null,this._lastBuiltStyleMap=null,this.style=e,this._tileFeatureMap.forEach((i,n)=>{const s=t.get(n);if(!s||!s.data||!s.data.vectorData)return;const a=s.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,_]of Object.entries(a.layers))if(_.some(b=>b.properties===h||JSON.stringify(b.properties)===JSON.stringify(h))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(h)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,h,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=St.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof dt}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var xy=Object.defineProperty,My=(r,e,t)=>e in r?xy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>My(r,typeof e!="symbol"?e+"":e,t);class hh extends Pr{constructor(e,t){super(e,t),this.layerId=e,Pt(this,"isTileLayer",!0),Pt(this,"layerType","base"),Pt(this,"isBaseLayer",!1),Pt(this,"_enabled",!0),Pt(this,"_visible",!0),Pt(this,"_rootTile"),Pt(this,"_loader"),Pt(this,"_LODThreshold",1),Pt(this,"isSceneLayer",!1),Pt(this,"opacity",1),Pt(this,"source"),Pt(this,"projection"),Pt(this,"minLevel",2),Pt(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Yi,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}var Sy=Object.defineProperty,Ly=(r,e,t)=>e in r?Sy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Py=(r,e,t)=>Ly(r,e+"",t);class uh extends p.LoadingManager{constructor(){super(...arguments),Py(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const De={manager:new uh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){De.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerGeometryLoader(r){De.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerMeshLoader(r){De.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},getMaterialLoader(r){const e=De.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=De.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=De.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Cy=Object.defineProperty,Ty=(r,e,t)=>e in r?Cy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gy=(r,e,t)=>Ty(r,e+"",t);class Wy{constructor(e){Gy(this,"worker"),this.worker=e()}async run(e,t){return new Promise(i=>{this.worker.onmessage=n=>{i(n.data)},this.worker.postMessage(e,t)})}terminate(){this.worker.terminate()}}const Zy=4096,dh=Math.PI;function oa(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),s=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:s}}function aa(r,e,t,i){if(i<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(i<=r.maxLevel)return{url:r._getUrl(e,t,i),clipBounds:[0,0,1,1]};const n=Vy(e,t,i,r.maxLevel),s=n.parentNO;return{url:r._getUrl(s.x,s.y,s.z),clipBounds:n.bounds}}function Vy(r,e,t,i){const n=t-i,s={x:r>>n,y:e>>n,z:t-n},a=Math.pow(2,n),c=Math.pow(.5,n),h=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(h,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:g}}function la(r,e,t,i,n=Zy){const{x:s,y:a}=r,c=(e+s/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(dh*(1-2*h)))*180/dh;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Iy(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function s(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return la(a,e,t,i);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(h=>la(h,e,t,i)):a.map(h=>s(h))}return a}return n.coordinates=s(r.coordinates),n}var Ay=Object.defineProperty,Fy=(r,e,t)=>e in r?Ay(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>Fy(r,typeof e!="symbol"?e+"":e,t);class Ls{constructor(){Ss(this,"_imgSource",[]),Ss(this,"_demSource"),Ss(this,"_vtSource"),Ss(this,"manager",De.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),i=await this.loadMaterial(e);console.assert(!!i&&!!t);for(let n=0;n<i.length;n++)t.addGroup(0,1/0,n);return{materials:i,geometry:t}}unload(e){const t=e.material,i=e.geometry;for(let n=0;n<t.length;n++)t[n].dispose();i.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const i=De.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const i=De.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load geometry error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const i=this.imgSource.filter(n=>e.z>=n.minLevel&&this._isBoundsInSourceBounds(n,e.bounds)).map(async n=>{const s=De.getMaterialLoader(n),a=await s.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{s.unload&&s.unload(h.target),h.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(i)}_isBoundsInSourceBounds(e,t){const i=e._projectionBounds;return!(t[2]<i[0]||t[3]<i[1]||t[0]>i[2]||t[1]>i[3])}}function Ir(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const i=e.reduce((a,c)=>a+c.length,0),n=new t(i);let s=0;for(const a of e)n.set(a,s),s+=a.length;return n}function fh(r,e,t,i){const n=i?zy(i,r.position.value):Oy(e),s=n.length,a=new Float32Array(s*6),c=new Float32Array(s*4),h=new e.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Dy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Ir(r.position.value,a),r.texcoord.value=Ir(r.texcoord.value,c),r.normal.value=Ir(r.normal.value,d);const m=Ir(e,h);return{attributes:r,indices:m}}function Oy(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const s=t[n],a=t[n+1],c=t[n+2];e.push([s,a],[a,c],[c,s])}e.sort(([n,s],[a,c])=>{const h=Math.min(n,s),d=Math.min(a,c);return h!==d?h-d:Math.max(n,s)-Math.max(a,c)});const i=[];for(let n=0;n<e.length;n++)n+1<e.length&&e[n][0]===e[n+1][1]&&e[n][1]===e[n+1][0]?n++:i.push(e[n]);return i}function zy(r,e){const t=(n,s)=>{n.sort(s)};t(r.westIndices,(n,s)=>e[3*n+1]-e[3*s+1]),t(r.eastIndices,(n,s)=>e[3*s+1]-e[3*n+1]),t(r.southIndices,(n,s)=>e[3*s]-e[3*n]),t(r.northIndices,(n,s)=>e[3*n]-e[3*s]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let s=0;s<n.length-1;s++)i.push([n[s],n[s+1]])}),i}function Dy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:s,newTriangles:a,newNormals:c}){const h=t.position.value.length,d=e*2,m=d+1;n.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),n[d*3+2]=n[d*3+2]-i,n.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),n[m*3+2]=n[m*3+2]-i,s.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),s.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=h/3+m,a[f+2]=r[1],a[f+3]=h/3+m,a[f+4]=r[0],a[f+5]=h/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function ph(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,i=e,n=ca(i,t);return{attributes:Xy(r,i,t),indices:n}}function Xy(r,e,t){const i=t*e,n=new Float32Array(i*3),s=new Float32Array(i*2);let a=0;for(let c=0;c<e;c++)for(let h=0;h<t;h++){const d=h/(t-1),m=c/(e-1);s[a*2]=d,s[a*2+1]=m,n[a*3]=d-.5,n[a*3+1]=m-.5,n[a*3+2]=r[(e-c-1)*t+h],a++}return{position:{value:n,size:3},texcoord:{value:s,size:2},normal:{value:ha(n,ca(e,t)),size:3}}}function ca(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let s=0;s<r-1;s++)for(let a=0;a<e-1;a++){const c=s*e+a,h=c+1,d=c+e,m=d+1,f=n*6;i[f]=c,i[f+1]=h,i[f+2]=d,i[f+3]=d,i[f+4]=h,i[f+5]=m,n++}return i}function ha(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,s=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[s],f=r[s+1],g=r[s+2],_=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=_-c,W=w-h,D=b-d,z=L*D-M*W,X=M*C-x*D,I=x*W-L*C,U=Math.sqrt(z*z+X*X+I*I),V=[0,0,1];if(U>0){const G=1/U;V[0]=z*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[s+G]=t[a+G]=V[G]}return t}var ky=Object.defineProperty,Uy=(r,e,t)=>e in r?ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ny=(r,e,t)=>Uy(r,e+"",t);class jn extends p.PlaneGeometry{constructor(){super(...arguments),Ny(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?ph(e):e;i=fh(i.attributes,i.indices,t);const{attributes:n,indices:s}=i;return this.setIndex(new p.BufferAttribute(s,1)),this.setAttribute("position",new p.BufferAttribute(n.position.value,n.position.size)),this.setAttribute("uv",new p.BufferAttribute(n.texcoord.value,n.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(n.normal.value,n.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var Ky=Object.defineProperty,By=(r,e,t)=>e in r?Ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hi=(r,e,t)=>By(r,typeof e!="symbol"?e+"":e,t);class mh{constructor(e=257){Hi(this,"gridSize"),Hi(this,"numTriangles"),Hi(this,"numParentTriangles"),Hi(this,"indices"),Hi(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,s=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:s=a=m=t;(n>>=1)>1;){const g=s+c>>1,_=a+h>>1;n&1?(c=s,h=a,s=d,a=m):(s=c,a=h,c=d,h=m),d=g,m=_}const f=i*4;this.coords[f+0]=s,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Yy(e,this)}}class Yy{constructor(e,t){Hi(this,"martini"),Hi(this,"terrain"),Hi(this,"errors");const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:n}=this.martini,{terrain:s,errors:a}=this;for(let c=e-1;c>=0;c--){const h=c*4,d=i[h+0],m=i[h+1],f=i[h+2],g=i[h+3],_=d+f>>1,w=m+g>>1,b=_+w-m,x=w+d-_,L=(s[m*n+d]+s[g*n+f])/2,M=w*n+_,C=Math.abs(L-s[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),D=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[D])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let s=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e?(f(z,X,M,C,I,U),f(W,D,z,X,I,U)):(h=C*t+M,d=D*t+W,m=X*t+z,i[h]===0&&(i[h]=++s),i[d]===0&&(i[d]=++s),i[m]===0&&(i[m]=++s),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=s*2,_=a*3,w=new Uint16Array(g),b=new Uint32Array(_);let x=0;function L(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;if(Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e)L(z,X,M,C,I,U),L(W,D,z,X,I,U);else{const V=i[C*t+M]-1,G=i[D*t+W]-1,N=i[X*t+z]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=D,w[2*N]=z,w[2*N+1]=X,b[x++]=V,b[x++]=G,b[x++]=N}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,i){const n=Math.floor(Math.sqrt(e.length)),s=n-1,a=t.length/2,c=new Float32Array(a*3),h=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],_=g*n+f;c[3*m+0]=f/s-.5,c[3*m+1]=.5-g/s,c[3*m+2]=e[_],h[2*m+0]=f/s,h[2*m+1]=1-g/s}const d=ha(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var Ry=Object.defineProperty,jy=(r,e,t)=>e in r?Ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gh=(r,e,t)=>jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){gh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),gh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,{url:a,clipBounds:c}=aa(t,i,n,s);if(!a)return new jn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:s,bounds:c});return De.manager.parseEnd(a),h}}class da extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var rt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(rt||{});class yh{render(e,t,i,n,s=1){switch(e.lineCap="round",e.lineJoin="round",(n.shadowBlur??0)>0&&(e.shadowBlur=n.shadowBlur??2,e.shadowColor=n.shadowColor??"black",e.shadowOffsetX=n.shadowOffset?n.shadowOffset[0]:0,e.shadowOffsetY=n.shadowOffset?n.shadowOffset[1]:0),t){case rt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,s,n.textField??"name",n.fontOffset??[0,-8]);break;case rt.Linestring:this._renderLineString(e,i,s);break;case rt.Polygon:this._renderPolygon(e,i,s);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===rt.Point)&&(e.globalAlpha=n.fillOpacity||.5,e.fillStyle=n.fillColor||n.color||"#3388ff",e.fill(n.fillRule||"evenodd")),(n.stroke??!0)&&(n.weight??1)>0&&(e.globalAlpha=n.opacity||1,e.lineWidth=n.weight||1,e.strokeStyle=n.color||"#3388ff",e.setLineDash(n.dashArray||[]),e.stroke())}_renderPointText(e,t,i=1,n="name",s=[0,0]){const a=t.geometry;e.beginPath();for(const h of a)for(let d=0;d<h.length;d++){const m=h[d];e.arc(m.x*i,m.y*i,2,0,2*Math.PI)}const c=t.properties;c&&c[n]&&e.fillText(c[n],a[0][0].x*i+s[0],a[0][0].y*i+s[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const s of n)for(let a=0;a<s.length;a++){const{x:c,y:h}=s[a];a===0?e.moveTo(c*i,h*i):e.lineTo(c*i,h*i)}}_renderPolygon(e,t,i){const n=t.geometry;e.beginPath();for(let s=0;s<n.length;s++){const a=n[s];for(let c=0;c<a.length;c++){const{x:h,y:d}=a[c];c===0?e.moveTo(h*i,d*i):e.lineTo(h*i,d*i)}e.closePath()}}}var Jy=Object.defineProperty,Qy=(r,e,t)=>e in r?Jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_h=(r,e,t)=>Qy(r,typeof e!="symbol"?e+"":e,t);class fa{constructor(){_h(this,"info",{version:"0.10.0",description:"Image loader base class"}),_h(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,a=new da({}),{url:c,clipBounds:h}=aa(t,i,n,s);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:s,bounds:h});a.map=d,De.manager.parseEnd(c)}return a}}var Hy=Object.defineProperty,$y=(r,e,t)=>e in r?Hy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vh=(r,e,t)=>$y(r,typeof e!="symbol"?e+"":e,t);class Ey{constructor(){vh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),vh(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const i=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new da({transparent:!0,map:i,opacity:e.source.opacity})}_creatCanvasContext(e,t){const n=new OffscreenCanvas(e,t).getContext("2d");if(!n)throw new Error("create canvas context failed");return n.scale(1,-1),n.translate(0,-t),n}}var qy=Object.defineProperty,e_=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pa=(r,e,t)=>e_(r,typeof e!="symbol"?e+"":e,t);class t_ extends fa{constructor(){super(...arguments),pa(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),pa(this,"dataType","image"),pa(this,"loader",new p.ImageLoader(De.manager))}async doLoad(e,t){const i=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),n=new p.Texture;n.colorSpace=p.SRGBColorSpace;const{bounds:s}=t;return s[2]-s[0]<1?n.image=i_(i,s):n.image=i,n.needsUpdate=!0,n}}function i_(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:s,sy:a,sw:c,sh:h}=oa(e,r.width);return n.drawImage(r,s,a,c,h,0,0,t,t),i}const n_=`{
|
|
1123
1123
|
"name": "@terra.gl/core",
|
|
1124
|
-
"version": "0.0.1-alpha.
|
|
1124
|
+
"version": "0.0.1-alpha.69",
|
|
1125
1125
|
"type": "module",
|
|
1126
1126
|
"files": [
|
|
1127
1127
|
"dist"
|
|
@@ -1195,4 +1195,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1195
1195
|
font-size: 11px;
|
|
1196
1196
|
white-space: nowrap;
|
|
1197
1197
|
pointer-events: none;
|
|
1198
|
-
">${t(s.timestamp)}</div>`,c=new fw({coordinate:[s.coordinate[0],s.coordinate[1],s.coordinate[2]??0],content:a});c.addTo(e),this._timeLabels.push(c)}}_updateVisuals(){this._updateMarkerPosition(),this._updateActiveLine()}_updateMarkerPosition(){if(!this._marker||this._worldPoints.length<2)return;const e=this._interpolatePosition(this._currentTime),t=this.map.prjcenter;this._marker.position.set(e.x+t.x,e.y+t.y,e.z+t.z),this._marker.visible=!0}_updateActiveLine(){if(!this._activeLine||this._worldPoints.length<2)return;const e=this._timestamps[0]+this._currentTime,t=[];for(let c=0;c<this._timestamps.length&&!(this._timestamps[c]>e);c++){const h=this._worldPoints[c];t.push(h.x,h.y,h.z)}const i=this._interpolatePosition(this._currentTime),n=t.length>0?t[t.length-3]:NaN,s=t.length>0?t[t.length-2]:NaN,a=t.length>0?t[t.length-1]:NaN;if((i.x!==n||i.y!==s||i.z!==a)&&t.push(i.x,i.y,i.z),t.length>=6){const c=this._activeLine.geometry,h=new _n;h.setPositions(t),this._activeLine.geometry=h,c.dispose(),this._activeLine.visible=!0}}_interpolatePosition(e){const t=this._timestamps,i=t[0]+e;if(i<=t[0])return this._worldPoints[0].clone();if(i>=t[t.length-1])return this._worldPoints[t.length-1].clone();let n=0,s=t.length-1;for(;n<s-1;){const d=n+s>>1;t[d]<=i?n=d:s=d}const a=t[n],c=t[s],h=c>a?Math.min(1,Math.max(0,(i-a)/(c-a))):0;return this._worldPoints[n].clone().lerp(this._worldPoints[s],h)}_computeCurrentHeading(){const e=this._timestamps,t=this._currentTime,n=e[0]+t;let s=0;for(let m=0;m<e.length-1;m++){if(e[m]<=n&&e[m+1]>n){s=m;break}m===e.length-2&&(s=m)}const a=this._worldPoints[s],c=this._worldPoints[Math.min(s+1,this._worldPoints.length-1)],h=c.x-a.x,d=c.z-a.z;return Math.atan2(h,d)}_updateCamera(e){if(this._cameraMode==="none"||!this._marker)return;const t=this._marker.position.clone(),i=this._computeCurrentHeading(),n=this._cameraConfig,s=n.smoothing??.08;if(this._cameraMode==="first-person"){const a=i+Math.PI,c=(n.polarAngle??80)*Math.PI/180,h=n.distance??15,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}else if(this._cameraMode==="third-person"){const a=i+Math.PI,c=(n.polarAngle??5)*Math.PI/180,h=n.distance??500,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}e.controls.update()}_disposeAll(){this._disposeTrailLine(),this._disposeActiveLine(),this._disposeMarker(),this._disposeControlPoints(),this._disposeTimeLabels(),this._disposeGifStates(),this._worldPoints=[]}_disposeTrailLine(){if(this._trailLine){this.remove(this._trailLine),this._trailLine.geometry.dispose();const e=this._trailLine.material;this._removeResizeHandler(e),e.dispose(),this._trailLine=null}}_disposeActiveLine(){if(this._activeLine){this.remove(this._activeLine),this._activeLine.geometry.dispose();const e=this._activeLine.material;this._removeResizeHandler(e),e.dispose(),this._activeLine=null}}_disposeMarker(){this._marker&&(this.remove(this._marker),this._marker.traverse(e=>{"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(i=>i.dispose())}),this._marker=null)}_disposeControlPoints(){for(;this._controlPointGroup.children.length>0;){const e=this._controlPointGroup.children[0];this._controlPointGroup.remove(e),e.traverse(t=>{"geometry"in t&&t.geometry&&t.geometry.dispose(),"material"in t&&t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(n=>n.dispose())})}}_disposeTimeLabels(){for(const e of this._timeLabels)e.remove();this._timeLabels=[]}_disposeGifStates(){for(const e of this._gifStates)e.texture.dispose(),e.canvas.width=0,e.canvas.height=0;this._gifStates=[]}_removeResizeHandler(e){const t=e.__resizeHandler;t&&window.removeEventListener("resize",t)}_emitEvent(e){this.
|
|
1198
|
+
">${t(s.timestamp)}</div>`,c=new fw({coordinate:[s.coordinate[0],s.coordinate[1],s.coordinate[2]??0],content:a});c.addTo(e),this._timeLabels.push(c)}}_updateVisuals(){this._updateMarkerPosition(),this._updateActiveLine()}_updateMarkerPosition(){if(!this._marker||this._worldPoints.length<2)return;const e=this._interpolatePosition(this._currentTime),t=this.map.prjcenter;this._marker.position.set(e.x+t.x,e.y+t.y,e.z+t.z),this._marker.visible=!0}_updateActiveLine(){if(!this._activeLine||this._worldPoints.length<2)return;const e=this._timestamps[0]+this._currentTime,t=[];for(let c=0;c<this._timestamps.length&&!(this._timestamps[c]>e);c++){const h=this._worldPoints[c];t.push(h.x,h.y,h.z)}const i=this._interpolatePosition(this._currentTime),n=t.length>0?t[t.length-3]:NaN,s=t.length>0?t[t.length-2]:NaN,a=t.length>0?t[t.length-1]:NaN;if((i.x!==n||i.y!==s||i.z!==a)&&t.push(i.x,i.y,i.z),t.length>=6){const c=this._activeLine.geometry,h=new _n;h.setPositions(t),this._activeLine.geometry=h,c.dispose(),this._activeLine.visible=!0}}_interpolatePosition(e){const t=this._timestamps,i=t[0]+e;if(i<=t[0])return this._worldPoints[0].clone();if(i>=t[t.length-1])return this._worldPoints[t.length-1].clone();let n=0,s=t.length-1;for(;n<s-1;){const d=n+s>>1;t[d]<=i?n=d:s=d}const a=t[n],c=t[s],h=c>a?Math.min(1,Math.max(0,(i-a)/(c-a))):0;return this._worldPoints[n].clone().lerp(this._worldPoints[s],h)}_computeCurrentHeading(){const e=this._timestamps,t=this._currentTime,n=e[0]+t;let s=0;for(let m=0;m<e.length-1;m++){if(e[m]<=n&&e[m+1]>n){s=m;break}m===e.length-2&&(s=m)}const a=this._worldPoints[s],c=this._worldPoints[Math.min(s+1,this._worldPoints.length-1)],h=c.x-a.x,d=c.z-a.z;return Math.atan2(h,d)}_updateCamera(e){if(this._cameraMode==="none"||!this._marker)return;const t=this._marker.position.clone(),i=this._computeCurrentHeading(),n=this._cameraConfig,s=n.smoothing??.08;if(this._cameraMode==="first-person"){const a=i+Math.PI,c=(n.polarAngle??80)*Math.PI/180,h=n.distance??15,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}else if(this._cameraMode==="third-person"){const a=i+Math.PI,c=(n.polarAngle??5)*Math.PI/180,h=n.distance??500,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}e.controls.update()}_disposeAll(){this._disposeTrailLine(),this._disposeActiveLine(),this._disposeMarker(),this._disposeControlPoints(),this._disposeTimeLabels(),this._disposeGifStates(),this._worldPoints=[]}_disposeTrailLine(){if(this._trailLine){this.remove(this._trailLine),this._trailLine.geometry.dispose();const e=this._trailLine.material;this._removeResizeHandler(e),e.dispose(),this._trailLine=null}}_disposeActiveLine(){if(this._activeLine){this.remove(this._activeLine),this._activeLine.geometry.dispose();const e=this._activeLine.material;this._removeResizeHandler(e),e.dispose(),this._activeLine=null}}_disposeMarker(){this._marker&&(this.remove(this._marker),this._marker.traverse(e=>{"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(i=>i.dispose())}),this._marker=null)}_disposeControlPoints(){for(;this._controlPointGroup.children.length>0;){const e=this._controlPointGroup.children[0];this._controlPointGroup.remove(e),e.traverse(t=>{"geometry"in t&&t.geometry&&t.geometry.dispose(),"material"in t&&t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(n=>n.dispose())})}}_disposeTimeLabels(){for(const e of this._timeLabels)e.remove();this._timeLabels=[]}_disposeGifStates(){for(const e of this._gifStates)e.texture.dispose(),e.canvas.width=0,e.canvas.height=0;this._gifStates=[]}_removeResizeHandler(e){const t=e.__resizeHandler;t&&window.removeEventListener("resize",t)}_emitEvent(e){this.trigger(e,{target:this})}destroy(){if(this.stop(),this._cameraMode!=="none"){const t=this.getMap()?.viewer;t&&(t.controls.enabled=this._prevControlsEnabled)}this._disposeAll()}}var _w=Object.defineProperty,vw=(r,e,t)=>e in r?_w(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ww=(r,e,t)=>vw(r,e+"",t);class bw extends hh{constructor(e,t){super(e,t),ww(this,"layerType","raster")}createLoader(){const e=new Ls;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}var xw=Object.defineProperty,Mw=(r,e,t)=>e in r?xw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zs=(r,e,t)=>Mw(r,typeof e!="symbol"?e+"":e,t);class Sw extends bw{constructor(e,t){super(e,t),Zs(this,"layerType","wmts"),Zs(this,"_layerName"),Zs(this,"_style"),Zs(this,"_matrixSet"),this._layerName=t.layerName,this._style=t.style||"default",this._matrixSet=t.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new Ls;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}update(e){this.loader&&super.update(e)}}console.log("%c✨ terra.gl V"+mf+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),q.ArcGisDemSource=Jv,q.ArcGisSource=jv,q.CloudsLayer=hw,q.DrawTool=Qn,q.EventClass=Bo,q.Feature=dt,q.ICloud=oh,q.InfoWindow=Ma,q.Label=ah,q.LineLayer=rw,q.LineString=Lt,q.LoaderFactory=De,q.MVTGeoSource=nw,q.MVTSource=ew,q.Map=Pn,q.MapBoxSource=$v,q.MapTool=Ih,q.Marker=Ti,q.Martini=mh,q.Model=sh,q.MultiLineString=rh,q.PointLayer=sw,q.Polygon=wi,q.PolygonLayer=ow,q.ProjectFactory=Em,q.PromiseWorker=Wy,q.Style=St,q.TDTQMSource=Uv,q.TDTSource=kv,q.TPoints=ch,q.Tile=Yi,q.TileCanvasLoader=Ey,q.TileGeometry=jn,q.TileGeometryLoader=ua,q.TileLoader=Ls,q.TileLoadingManager=uh,q.TileMap=gs,q.TileMaterial=da,q.TileMaterialLoader=fa,q.TileSource=si,q.TrajectoryLayer=yw,q.UIComponent=xa,q.VectorFeatureTypes=rt,q.VectorTileLayer=wa,q.VectorTileRender=yh,q.Viewer=Cc,q.WMTSSource=Bv,q.WMTSTileLayer=Sw,q.WeatherEffect=Pc,q.addSkirt=fh,q.author=l_,q.concatenateTypedArrays=Ir,q.convertGeometryToWGS84=Iy,q.createBillboards=eg,q.getBoundsCoord=oa,q.getGeometryDataFromDem=ph,q.getGridIndices=ca,q.getLocalInfoFromRay=jo,q.getLocalInfoFromScreen=Vc,q.getLocalInfoFromWorld=Jo,q.getNormals=ha,q.getSafeTileUrlAndBounds=aa,q.registerDEMLoader=ga,q.registerImgLoader=ma,q.registerMeshLoader=wh,q.vector2ToWGS84=la,q.version=a_,q.waitFor=c_,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|