@terra.gl/core 0.0.1-alpha.53 → 0.0.1-alpha.54
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.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2522,7 +2522,7 @@ export declare class InfoWindow extends UIComponent {
|
|
|
2522
2522
|
* InfoWindow 配置项
|
|
2523
2523
|
* @category UI
|
|
2524
2524
|
*/
|
|
2525
|
-
declare type InfoWindowOptions = UIComponentOptions & {
|
|
2525
|
+
export declare type InfoWindowOptions = UIComponentOptions & {
|
|
2526
2526
|
/**
|
|
2527
2527
|
* Title text.
|
|
2528
2528
|
* 标题文本
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pt from "three";
|
|
2
2
|
import { REVISION as of, TrianglesDrawMode as Yw, TriangleFanDrawMode as Jl, TriangleStripDrawMode as af, Mesh as Ie, Vector3 as z, Color as ue, FrontSide as na, Plane as lf, Matrix4 as Le, Vector4 as bn, PerspectiveCamera as nr, WebGLRenderTarget as Gr, UniformsUtils as sr, UniformsLib as $o, ShaderMaterial as Rn, MOUSE as pi, TOUCH as mi, Spherical as td, Quaternion as yn, OrthographicCamera as Wr, Vector2 as ce, Ray as Bw, PlaneGeometry as ir, HalfFloatType as Qi, AdditiveBlending as fc, MeshBasicMaterial as _n, RGBAFormat as cf, LinearFilter as Ti, NoBlending as jw, Clock as ia, Loader as pc, LoaderUtils as Rr, FileLoader as Si, MeshPhysicalMaterial as An, SpotLight as uf, PointLight as Ql, DirectionalLight as qo, InstancedMesh as mc, InstancedBufferAttribute as $l, Object3D as vn, TextureLoader as ra, ImageBitmapLoader as Jw, BufferAttribute as Tt, InterleavedBuffer as Qw, InterleavedBufferAttribute as $i, LinearMipmapLinearFilter as Rs, NearestMipmapLinearFilter as $w, LinearMipmapNearestFilter as qw, NearestMipmapNearestFilter as eb, NearestFilter as hf, RepeatWrapping as xn, MirroredRepeatWrapping as tb, ClampToEdgeWrapping as ql, PointsMaterial as sa, Material as Sl, LineBasicMaterial as df, MeshStandardMaterial as Is, DoubleSide as Fr, PropertyBinding as Cs, BufferGeometry as rn, SkinnedMesh as ff, LineSegments as nb, Line as pf, LineLoop as ib, Points as Or, Group as wn, MathUtils as _t, Skeleton as mf, AnimationClip as gf, Bone as ec, InterpolateDiscrete as rb, InterpolateLinear as yf, Texture as Ar, VectorKeyframeTrack as tc, NumberKeyframeTrack as nc, QuaternionKeyframeTrack as ic, Interpolant as sb, Box3 as or, Sphere as gc, Curve as ob, MeshPhongMaterial as Ms, MeshLambertMaterial as _f, EquirectangularReflectionMapping as ab, AmbientLight as vf, Float32BufferAttribute as gi, Uint16BufferAttribute as lb, Matrix3 as cb, Euler as vs, DataTextureLoader as ub, FloatType as Jo, DataUtils as Co, InstancedBufferGeometry as wf, InstancedInterleavedBuffer as rc, WireframeGeometry as hb, Line3 as db, EventDispatcher as bf, Scene as fb, FogExp2 as nd, CubeTextureLoader as pb, WebGLRenderer as mb, PCFSoftShadowMap as gb, ACESFilmicToneMapping as yb, SRGBColorSpace as oa, CameraHelper as _b, CubicBezierCurve3 as vb, Frustum as wb, Raycaster as Zs, CanvasTexture as zr, SpriteMaterial as Dr, Sprite as Pi, DynamicDrawUsage as id, NormalBlending as xf, CurvePath as Tf, LineCurve3 as Ir, QuadraticBezierCurve3 as Sf, TubeGeometry as bb, BackSide as xb, Shape as Tb, ShapeGeometry as Sb, CylinderGeometry as Mb, AnimationMixer as Lb, LoopRepeat as Pb, LoopOnce as Cb, LoadingManager as Zb, Box2 as Gb, ImageLoader as Mf } from "three";
|
|
3
|
-
const Wb = "0.0.1-alpha.
|
|
3
|
+
const Wb = "0.0.1-alpha.54", Ml = {
|
|
4
4
|
name: "Criska"
|
|
5
5
|
};
|
|
6
6
|
var Ls = function() {
|
|
@@ -19052,7 +19052,7 @@ function bL(r, e) {
|
|
|
19052
19052
|
}
|
|
19053
19053
|
const xL = `{
|
|
19054
19054
|
"name": "@terra.gl/core",
|
|
19055
|
-
"version": "0.0.1-alpha.
|
|
19055
|
+
"version": "0.0.1-alpha.54",
|
|
19056
19056
|
"type": "module",
|
|
19057
19057
|
"files": [
|
|
19058
19058
|
"dist"
|
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 of(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const lt=of(p),af="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 of(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const lt=of(p),af="0.0.1-alpha.54",yo={name:"Criska"};var ci=function(){var i=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(),n(++i%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function n(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";i=m}var r=(performance||Date).now(),o=r,a=0,c=t(new ci.Panel("FPS","#0ff","#002")),u=t(new ci.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new ci.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){r=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(u.update(m-r,200),m>=o+1e3&&(c.update(a*1e3/(m-o),100),o=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){r=this.end()},domElement:e,setMode:n}};ci.Panel=function(i,e,t){var n=1/0,r=0,o=Math.round,a=o(window.devicePixelRatio||1),c=80*a,u=48*a,d=3*a,m=2*a,f=3*a,g=15*a,_=74*a,w=30*a,x=document.createElement("canvas");x.width=c,x.height=u,x.style.cssText="width:80px;height:48px";var b=x.getContext("2d");return b.font="bold "+9*a+"px Helvetica,Arial,sans-serif",b.textBaseline="top",b.fillStyle=t,b.fillRect(0,0,c,u),b.fillStyle=e,b.fillText(i,d,m),b.fillRect(f,g,_,w),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(f,g,_,w),{dom:x,update:function(L,M){n=Math.min(n,L),r=Math.max(r,L),b.fillStyle=t,b.globalAlpha=1,b.fillRect(0,0,c,g),b.fillStyle=e,b.fillText(o(L)+" "+i+" ("+o(n)+"-"+o(r)+")",d,m),b.drawImage(x,f+a,g,_-a,w,f,g,_-a,w),b.fillRect(f+_-a,g,a,w),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(f+_-a,g,a,o((1-L/M)*w))}}};const $i=parseInt(p.REVISION.replace(/\D+/g,"")),_o=$i>=125?"uv1":"uv2";function Il(i,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=i.getIndex();if(t===null){const a=[],c=i.getAttribute("position");if(c!==void 0){for(let u=0;u<c.count;u++)a.push(u);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=n;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=i.clone();return o.setIndex(r),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}var Ut=Uint8Array,Dn=Uint16Array,vo=Uint32Array,Al=new Ut([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]),Fl=new Ut([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]),lf=new Ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ol=function(i,e){for(var t=new Dn(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new vo(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return[t,r]},Dl=Ol(Al,2),zl=Dl[0],cf=Dl[1];zl[28]=258,cf[258]=28;for(var uf=Ol(Fl,0),hf=uf[0],wo=new Dn(32768),We=0;We<32768;++We){var zn=(We&43690)>>>1|(We&21845)<<1;zn=(zn&52428)>>>2|(zn&13107)<<2,zn=(zn&61680)>>>4|(zn&3855)<<4,wo[We]=((zn&65280)>>>8|(zn&255)<<8)>>>1}for(var ui=function(i,e,t){for(var n=i.length,r=0,o=new Dn(e);r<n;++r)++o[i[r]-1];var a=new Dn(e);for(r=0;r<e;++r)a[r]=a[r-1]+o[r-1]<<1;var c;if(t){c=new Dn(1<<e);var u=15-e;for(r=0;r<n;++r)if(i[r])for(var d=r<<4|i[r],m=e-i[r],f=a[i[r]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[wo[f]>>>u]=d}else for(c=new Dn(n),r=0;r<n;++r)i[r]&&(c[r]=wo[a[i[r]-1]++]>>>15-i[r]);return c},hi=new Ut(288),We=0;We<144;++We)hi[We]=8;for(var We=144;We<256;++We)hi[We]=9;for(var We=256;We<280;++We)hi[We]=7;for(var We=280;We<288;++We)hi[We]=8;for(var Xl=new Ut(32),We=0;We<32;++We)Xl[We]=5;var df=ui(hi,9,1),ff=ui(Xl,5,1),bo=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},qt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},xo=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},pf=function(i){return(i/8|0)+(i&7&&1)},mf=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var n=new(i instanceof Dn?Dn:i instanceof vo?vo:Ut)(t-e);return n.set(i.subarray(e,t)),n},gf=function(i,e,t){var n=i.length;if(!n||t&&!t.l&&n<5)return e||new Ut(0);var r=!e||t,o=!t||t.i;t||(t={}),e||(e=new Ut(n*3));var a=function(dt){var Je=e.length;if(dt>Je){var Be=new Ut(Math.max(Je*2,dt));Be.set(e),e=Be}},c=t.f||0,u=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,_=t.n,w=n*8;do{if(!m){t.f=c=qt(i,u,1);var x=qt(i,u+1,3);if(u+=3,x)if(x==1)m=df,f=ff,g=9,_=5;else if(x==2){var C=qt(i,u,31)+257,Z=qt(i,u+10,15)+4,z=C+qt(i,u+5,31)+1;u+=14;for(var D=new Ut(z),X=new Ut(19),I=0;I<Z;++I)X[lf[I]]=qt(i,u+I*3,7);u+=Z*3;for(var K=bo(X),V=(1<<K)-1,G=ui(X,K,1),I=0;I<z;){var k=G[qt(i,u,V)];u+=k&15;var b=k>>>4;if(b<16)D[I++]=b;else{var j=0,Y=0;for(b==16?(Y=3+qt(i,u,3),u+=2,j=D[I-1]):b==17?(Y=3+qt(i,u,7),u+=3):b==18&&(Y=11+qt(i,u,127),u+=7);Y--;)D[I++]=j}}var H=D.subarray(0,C),Q=D.subarray(C);g=bo(H),_=bo(Q),m=ui(H,g,1),f=ui(Q,_,1)}else throw"invalid block type";else{var b=pf(u)+4,L=i[b-4]|i[b-3]<<8,M=b+L;if(M>n){if(o)throw"unexpected EOF";break}r&&a(d+L),e.set(i.subarray(b,M),d),t.b=d+=L,t.p=u=M*8;continue}if(u>w){if(o)throw"unexpected EOF";break}}r&&a(d+131072);for(var ie=(1<<g)-1,re=(1<<_)-1,le=u;;le=u){var j=m[xo(i,u)&ie],de=j>>>4;if(u+=j&15,u>w){if(o)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=u,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Al[I];ge=qt(i,u,(1<<fe)-1)+zl[I],u+=fe}var Se=f[xo(i,u)&re],nt=Se>>>4;if(!Se)throw"invalid distance";u+=Se&15;var Q=hf[nt];if(nt>3){var fe=Fl[nt];Q+=xo(i,u)&(1<<fe)-1,u+=fe}if(u>w){if(o)throw"unexpected EOF";break}r&&a(d+131072);for(var rt=d+ge;d<rt;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=rt}}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)},yf=new Ut(0),_f=function(i){if((i[0]&15)!=8||i[0]>>>4>7||(i[0]<<8|i[1])%31)throw"invalid zlib data";if(i[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function vf(i,e){return gf((_f(i),i.subarray(2,-4)),e)}var wf=typeof TextDecoder<"u"&&new TextDecoder,bf=0;try{wf.decode(yf,{stream:!0}),bf=1}catch{}class xf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const n=this,r=t.textureWidth!==void 0?t.textureWidth:512,o=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,u=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,x=t.side!==void 0?t.side:p.FrontSide,b=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,Z=new p.Vector3,z=new p.Matrix4,D=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,K=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,k=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(r,o),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
|
|
|
@@ -904,7 +904,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
904
904
|
}
|
|
905
905
|
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new lt.Box3().setFromObject(e);if(t.isEmpty())return;const n=new lt.Vector3;t.getCenter(n);const r=[new lt.Vector3(t.min.x,t.min.y,t.min.z),new lt.Vector3(t.max.x,t.max.y,t.max.z)];let o=0;r.forEach(a=>{const c=n.distanceTo(a);c>o&&(o=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:n,maxDistance:o},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 K0=Object.defineProperty,N0=(i,e,t)=>e in i?K0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,tn=(i,e,t)=>N0(i,typeof e!="symbol"?e+"":e,t);const B0={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class Ec extends en{constructor(e){super(e),tn(this,"_type","Model"),tn(this,"_emissive",!1),tn(this,"_emissiveIntensity",1),tn(this,"_emissiveColor","#ffffff"),tn(this,"_mixer",null),tn(this,"_currentAction",null),tn(this,"_animations",[]),tn(this,"_clock",new p.Clock),tn(this,"_autoUpdate",!0),tn(this,"_animationRequestId",null),tn(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()}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return ng(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,n){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),n!==void 0&&(this._emissiveColor=n),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(n=>n.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(n=>n.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 u=t.getMap?.()||this.getMap();if(u&&u.prjcenter){const d=u.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const _=m[g],w=m[g+2],x=d.x+_,b=d.z+w;f.push(new p.Vector2(x,b))}if(f.length>=3)return f}}const n=this.getMap();if(!n||!e.geometry)return null;const r=e.geometry;let o;if(r.type==="Polygon")o=r.coordinates;else if(r.type==="MultiPolygon"){if(!r.coordinates.length)return null;o=r.coordinates[0]}else return null;if(!o.length||!o[0].length)return null;const a=o[0],c=[];for(const u of a){const d=u[0],m=u[1],f=n.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 n=e.getRegionOverlays()||[];if(n.length){const r=n.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),o=r[r.length-1];if(o&&(o.geometry||o.feature)){const a=this._computeOverlayVertices(o);a&&a.length>=3&&(t={color:new p.Color(o.color??"#00FF88"),opacity:o.opacity??.3,vertices:a})}}}this.traverse(async n=>{if(n instanceof p.Mesh&&n.material){if(n.castShadow=!0,n.name==="building"){const r=new k0({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}),o=new p.Box3().setFromObject(n);r.updateBoundingBox(o.min.y,o.max.y),r.setDiffusionFromObject(n),n.receiveShadow=!1,n.material=r,n.material.needsUpdate=!0}n.name==="grass"&&(n.castShadow=!1,n.receiveShadow=!0,n.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),n.material.metalness=.2,n.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(r=>{const o=n.material[r];o&&(o.wrapS=o.wrapT=p.RepeatWrapping,o.repeat.set(.3,.3),o.needsUpdate=!0)}),n.material.normalScale=new p.Vector2(3,3))}})}}Ec.mergeOptions(B0);var Y0=Object.defineProperty,R0=(i,e,t)=>e in i?Y0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,j0=(i,e,t)=>R0(i,e+"",t);const J0={};class $c extends en{constructor(e){super(e),j0(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 ag(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}$c.mergeOptions(J0);var Q0=Object.defineProperty,H0=(i,e,t)=>e in i?Q0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,E0=(i,e,t)=>H0(i,e+"",t);const $0={};class qc extends en{constructor(e){super(e),E0(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 cg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return lg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}qc.mergeOptions($0);var q0=Object.defineProperty,ey=(i,e,t)=>e in i?q0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,eu=(i,e,t)=>ey(i,typeof e!="symbol"?e+"":e,t);const ty={};class tu extends en{constructor(e){super(e),eu(this,"_type","TPoints"),eu(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 _g(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}tu.mergeOptions(ty);var ny=Object.defineProperty,ry=(i,e,t)=>e in i?ny(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Rn=(i,e,t)=>ry(i,typeof e!="symbol"?e+"":e,t);class Pi extends Kn(Object){constructor(e,t){super(),Rn(this,"options"),Rn(this,"map"),Rn(this,"_sprite",null),Rn(this,"_isDragging",!1),Rn(this,"_dragStartPosition",null),Rn(this,"_lastCoordinate",null),Rn(this,"_boundOnMouseMove",null),Rn(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"),n=t.getContext("2d");t.width=64,t.height=64;const r=64/2,o=64/2-2;n.clearRect(0,0,t.width,t.height),n.beginPath(),n.arc(r,r,o,0,2*Math.PI),n.fillStyle="#000000",n.fill(),n.beginPath(),n.arc(r,r,o-2,0,2*Math.PI),n.fillStyle=this.options.color,n.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 u=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(u);const _=d.getPixelRatio(),w=this.options.size*_;let x=1;if(f.isPerspectiveCamera){const b=f.fov*Math.PI/180,L=2*Math.tan(b/2)*g;x=w/u.y*L}else if(f.isOrthographicCamera){const b=f.top,L=f.bottom,M=Math.abs(b-L)/f.zoom;x=w/u.y*M}this._sprite.scale.set(x,x,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,n=t[0]-this._lastCoordinate[0],r=t[1]-this._lastCoordinate[1],o=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],o.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:n,dy:r}})}_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 ea(i,e,t){const{currentTarget:n,clientX:r,clientY:o}=i;if(n instanceof HTMLElement){const a=n.clientWidth,c=n.clientHeight,u=new p.Vector2(r/a*2-1,-(o/c)*2+1);return e.getLocalInfoFromScreen(t,u)?.location}else return}var iy=Object.defineProperty,sy=(i,e,t)=>e in i?iy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ut=(i,e,t)=>sy(i,typeof e!="symbol"?e+"":e,t);class oy extends ls{constructor(e,t){super(e),ut(this,"options"),ut(this,"_handles",[]),ut(this,"_middleHandles",[]),ut(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ut(this,"_editing",!1),ut(this,"_shadow",null),ut(this,"_shadowSnapshot",null),ut(this,"_updating",!1),ut(this,"_history",[]),ut(this,"_historyIndex",-1),ut(this,"_draggableOriginalState",!1),ut(this,"_boundOnMapMouseMove",null),ut(this,"_boundOnMapClick",null),ut(this,"_boundOnMapMouseDown",null),ut(this,"_boundOnFeatureDragging",null),ut(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 en?this._createPointHandles(e,t):this.target instanceof xt?this._createLineStringHandles(e,t):this.target instanceof _n&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const n=e.coordinates,r=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),o=new Pi({position:r,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);o.on("dragstart",a=>{this._onHandleDragStart(a,0)}),o.on("dragging",a=>{this._onHandleDragging(a,0)}),o.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(o)}_createLineStringHandles(e,t){const n=e.coordinates;n.forEach((r,o)=>{const a=t.geo2world(new p.Vector3(r[0],r[1],r[2]||0)),c=new Pi({position:a,index:o,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",u=>{this._onHandleDragStart(u,o)}),c.on("dragging",u=>{this._onHandleDragging(u,o)}),c.on("dragend",u=>{this._onHandleDragEnd(u,o)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(n,t)}_onHandleDragging(e,t){this._updating=!0;const r=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(r,t),c=this.target._geometry;this.target instanceof en?c.coordinates=[a.x,a.y,a.z]:this.target instanceof xt&&(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 n=this.target._geometry;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof en?n.coordinates:n.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof en?n.coordinates:n.coordinates[t]})}_createPolygonHandles(e,t){const n=e.coordinates;if(!n||!Array.isArray(n)||n.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}n.forEach((o,a)=>{if(!o||o.length<3)return;const c=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let u=0;u<c;u++){const d=o[u],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Pi({position:m,index:u,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,u,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,u,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,u,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(o,a,t)})}_onPolygonHandleDragStart(e,t,n){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:n,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,n){const o=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(o,t,n),d=this.target._geometry.coordinates;if(d[n]&&d[n][t]&&(d[n][t]=[c.x,c.y,c.z],t===0&&d[n].length>1)){const m=d[n].length-1;d[n][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:n,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:n,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,n){this._updating=!1;const r=this.target._geometry,o=r.coordinates;this._addHistory(r.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:n,coordinate:o[n]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:n,coordinate:o[n]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof en){const n=e.coordinates,r=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[0]&&this._handles[0].updatePosition(r)}else if(this.target instanceof xt)e.coordinates.forEach((r,o)=>{const a=t.geo2world(new p.Vector3(r[0],r[1],r[2]||0));this._handles[o]&&this._handles[o].updatePosition(a)});else if(this.target instanceof _n){const n=e.coordinates;let r=0;n.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a;c++){const u=o[c],d=t.geo2world(new p.Vector3(u[0],u[1],u[2]||0));this._handles[r]&&this._handles[r].updatePosition(d),r++}})}}}_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 n=0;if(this.target instanceof xt){const r=e.coordinates;for(let o=0;o<r.length-1&&!(n>=this._middleHandles.length);o++){const a=r[o],c=r[o+1],u=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(u[0],u[1],u[2]));this._middleHandles[n].updatePosition(d),n++}}else this.target instanceof _n&&e.coordinates.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a&&!(n>=this._middleHandles.length);c++){const u=(c+1)%a,d=o[c],m=o[u],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[n].updatePosition(g),n++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const r=e,o=t.viewer.renderer.domElement,a=o.getBoundingClientRect(),c=new p.Vector2((r.clientX-a.left)/a.width*2-1,-((r.clientY-a.top)/a.height)*2+1);n.setFromCamera(c,t.viewer.camera);const u=[...this._handles,...this._middleHandles];for(const d of u)if(d.intersect(n)){const m=ea({currentTarget:o,clientX:r.clientX,clientY:r.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),r.stopPropagation&&r.stopPropagation(),r.stopImmediatePropagation&&r.stopImmediatePropagation(),r.preventDefault&&r.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const n=this._getMap();if(!n)return;const r=new p.Raycaster;r.params.Points={threshold:.5};const o=e.originEvent;if(!o)return;const a=new p.Vector2(o.offsetX/n.viewer.renderer.domElement.clientWidth*2-1,-(o.offsetY/n.viewer.renderer.domElement.clientHeight)*2+1);r.setFromCamera(a,n.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(r)){this._removeVertex(c),o.stopPropagation&&o.stopPropagation(),o.preventDefault&&o.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(n=>{n.material&&(e?Array.isArray(n.material)?n.material.forEach(r=>{r.userData._originalOpacity||(r.userData._originalOpacity=r.opacity),r.opacity=Math.min(r.opacity*.6,.6),r.transparent=!0}):(n.material.userData._originalOpacity||(n.material.userData._originalOpacity=n.material.opacity),n.material.opacity=Math.min(n.material.opacity*.6,.6),n.material.transparent=!0):Array.isArray(n.material)?n.material.forEach(r=>{r.userData._originalOpacity!==void 0&&(r.opacity=r.userData._originalOpacity,delete r.userData._originalOpacity)}):n.material.userData._originalOpacity!==void 0&&(n.material.opacity=n.material.userData._originalOpacity,delete n.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,n=this._handles[e],r=n.getIndex(),o=n._ringIndex||0;let a=null;if(this.target instanceof xt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[r],c.splice(r,1)}else if(this.target instanceof _n){const u=t.coordinates[o];if(!u)return;const d=u.length>1&&u[0][0]===u[u.length-1][0]&&u[0][1]===u[u.length-1][1],m=d?4:3;if(u.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=u[r],u.splice(r,1),d&&r===0&&u.length>0&&(u[u.length-1]=[...u[0]])}else return;this.target._onPositionChanged(!0),n.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:r,ringIndex:o,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let n=0;n<e.length-1;n++){const r=e[n],o=e[n+1],a=[(r[0]+o[0])/2,(r[1]+o[1])/2,((r[2]||0)+(o[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),u=new Pi({position:c,index:n,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);u.on("dragstart",d=>{this._onMiddleHandleClick(n,"LineString",0)}),this._middleHandles.push(u)}}_createPolygonMiddleHandles(e,t,n){const r=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let o=0;o<r;o++){const a=(o+1)%r,c=e[o],u=e[a],d=[(c[0]+u[0])/2,(c[1]+u[1])/2,((c[2]||0)+(u[2]||0))/2],m=n.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Pi({position:m,index:o,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},n);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(o,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,n){const r=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=r.coordinates,c=a[e],u=a[e+1],d=[(c[0]+u[0])/2,(c[1]+u[1])/2,((c[2]||0)+(u[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=r.coordinates[n];if(!c)return;const u=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%u,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===u-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(r.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:n})}}_updateHandleIndices(){if(this.target instanceof xt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof _n){let e=0;this.target._geometry.coordinates.forEach((r,o)=>{const a=r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]?r.length-1:r.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=o),e++})}}_fixHandlePointCoordinates(e,t,n=0){const r=this._getMap();if(!r)return e;const o=this.target._geometry;let a=null;if(this.target instanceof en)a=o.coordinates;else if(this.target instanceof xt)a=o.coordinates[t];else if(this.target instanceof _n){const u=o.coordinates;u[n]&&u[n][t]&&(a=u[n][t])}if(!a||!a[2]||a[2]===0)return r.world2geo(e);const c=r.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}}ct.prototype.startEdit=function(i){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new oy(this,i),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},ct.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},ct.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},ct.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},ct.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},ct.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function ys(i,e){if(!i||i===!0)return!0;if(!Array.isArray(i))return!!i;switch(i[0]){case"all":return i.slice(1).every(n=>ys(n,e));case"any":return i.slice(1).some(n=>ys(n,e));case"!":return!ys(i[1],e);case"==":{const n=ht(i[1],e),r=ht(i[2],e);return _s(n)==_s(r)}case"!=":{const n=ht(i[1],e),r=ht(i[2],e);return _s(n)!=_s(r)}case">":{const n=ht(i[1],e),r=ht(i[2],e);return jn(n)>jn(r)}case"<":{const n=ht(i[1],e),r=ht(i[2],e);return jn(n)<jn(r)}case">=":{const n=ht(i[1],e),r=ht(i[2],e);return jn(n)>=jn(r)}case"<=":{const n=ht(i[1],e),r=ht(i[2],e);return jn(n)<=jn(r)}case"in":{const n=ht(i[1],e);return i.slice(2).map(o=>ht(o,e)).includes(n)}case"!in":{const n=ht(i[1],e);return!i.slice(2).map(o=>ht(o,e)).includes(n)}case"has":{const n=i[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,n)}case"!has":{const n=i[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,n))}default:return!0}}function ht(i,e){if(Array.isArray(i))switch(i[0]){case"get":return e?e[i[1]]:void 0;default:return i}return i}function _s(i){if(i==null)return null;if(typeof i=="string"){const e=Number(i);if(!isNaN(e)&&i.trim()!=="")return e}return typeof i=="boolean"?i?1:0:i}function jn(i){if(i==null)return 0;if(typeof i=="number")return i;if(typeof i=="boolean")return i?1:0;if(typeof i=="string"){const e=Number(i);return isNaN(e)?0:e}return Number(i)}var ay=Object.defineProperty,ly=(i,e,t)=>e in i?ay(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Ci=(i,e,t)=>ly(i,typeof e!="symbol"?e+"":e,t);class ta extends Bn{constructor(e,t){super(e,t),Ci(this,"TILE_SIZE"),Ci(this,"EXTENT"),Ci(this,"style"),Ci(this,"_tileFeatureMap",new Map),Ci(this,"_activeFeatureFilter"),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,t){const n=this.getMap(),r=`${e.z}-${e.x}-${e.y}`,o=this._tileFeatureMap.get(r);if(o&&o.length>0){o.forEach(d=>{d.visible=!0,this.children.some(m=>m&&d&&m.uuid===d.uuid)||d.addTo(this)});return}const a=t.vectorData;if(!a||!a.layers||!n||this.style.length===0)return;const c=[],u=this.style;Object.keys(a.layers).forEach(d=>{const m=a.layers[d];for(let f=0;f<m.length;f++){const g=m[f],_=g.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(g.properties))continue;let w=null;for(const x of u)if(this._evaluateFilter(x.filter,g.properties,d,g.geometry.type)){w=x.style;break}if(w){const x={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:_,extent:this.EXTENT,tileSize:this.TILE_SIZE},b=this._createFeatureInstance(g.geometry,g.geometry.type,w,g.properties);b&&(b.userData.tileData=x,b.style=Gt.create(w),b.addTo(this),b.initializeGeometry(),c.push(b))}}}),this._tileFeatureMap.set(r,c)}_evaluateFilter(e,t,n,r){if(!e||e===!0)return!0;const o={...t,$layer:n,$type:r};return ys(e,o)}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(n=>{n.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&(t.forEach(n=>{n._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,t,n,r){const a={geometry:{ismvt:!0,...e},style:n,userData:r};switch(t){case"Point":return new Pn(a);case"LineString":return new xt(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(n=>{n.material&&(n.material.opacity=e,n.material.transparent=e<1)})})}_onMapUpdate(){}validateFeature(e){return e instanceof ct}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)}),super.dispose()}}var cy=Object.defineProperty,uy=(i,e,t)=>e in i?cy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Mt=(i,e,t)=>uy(i,typeof e!="symbol"?e+"":e,t);class nu extends ds{constructor(e,t){super(e,t),this.layerId=e,Mt(this,"isTileLayer",!0),Mt(this,"layerType","base"),Mt(this,"isBaseLayer",!1),Mt(this,"_enabled",!0),Mt(this,"_visible",!0),Mt(this,"_rootTile"),Mt(this,"_loader"),Mt(this,"_LODThreshold",1),Mt(this,"isSceneLayer",!1),Mt(this,"opacity",1),Mt(this,"source"),Mt(this,"projection"),Mt(this,"minLevel",2),Mt(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 Nn,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 hy=Object.defineProperty,dy=(i,e,t)=>e in i?hy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,fy=(i,e,t)=>dy(i,e+"",t);class ru extends p.LoadingManager{constructor(){super(...arguments),fy(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const Oe={manager:new ru,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(i){Oe.imgLoaderMap.set(i.dataType,i),i.info.author=i.info.author??yo.name},registerGeometryLoader(i){Oe.demLoaderMap.set(i.dataType,i),i.info.author=i.info.author??yo.name},registerMeshLoader(i){Oe.meshLoaderMap.set(i.dataType,i),i.info.author=i.info.author??yo.name},getMaterialLoader(i){const e=Oe.imgLoaderMap.get(i.dataType);if(e)return e;throw`Source dataType "${i.dataType}" is not support!`},getGeometryLoader(i){const e=Oe.demLoaderMap.get(i.dataType);if(e)return e;throw`Source dataType "${i.dataType}" is not support!`},getMeshLoader(i){const e=Oe.meshLoaderMap.get(i.dataType);if(e)return e;throw`Source dataType "${i.dataType}" is not support!`}};var py=Object.defineProperty,my=(i,e,t)=>e in i?py(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,gy=(i,e,t)=>my(i,e+"",t);class yy{constructor(e){gy(this,"worker"),this.worker=e()}async run(e,t){return new Promise(n=>{this.worker.onmessage=r=>{n(r.data)},this.worker.postMessage(e,t)})}terminate(){this.worker.terminate()}}const _y=4096,iu=Math.PI;function na(i,e){const t=Math.floor(i[0]*e),n=Math.floor(i[1]*e),r=Math.floor((i[2]-i[0])*e),o=Math.floor((i[3]-i[1])*e);return{sx:t,sy:n,sw:r,sh:o}}function ra(i,e,t,n){if(n<i.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=i.maxLevel)return{url:i._getUrl(e,t,n),clipBounds:[0,0,1,1]};const r=vy(e,t,n,i.maxLevel),o=r.parentNO;return{url:i._getUrl(o.x,o.y,o.z),clipBounds:r.bounds}}function vy(i,e,t,n){const r=t-n,o={x:i>>r,y:e>>r,z:t-r},a=Math.pow(2,r),c=Math.pow(.5,r),u=i%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(u,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:o,bounds:g}}function ia(i,e,t,n,r=_y){const{x:o,y:a}=i,c=(e+o/r)/Math.pow(2,n),u=(t+a/r)/Math.pow(2,n),d=c*360-180,f=Math.atan(Math.sinh(iu*(1-2*u)))*180/iu;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function wy(i,e,t,n){if(!i||!i.coordinates)throw new Error("无效的geometry数据格式");const r={type:i.type,coordinates:null};function o(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return ia(a,e,t,n);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(u=>ia(u,e,t,n)):a.map(u=>o(u))}return a}return r.coordinates=o(i.coordinates),r}var by=Object.defineProperty,xy=(i,e,t)=>e in i?by(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,vs=(i,e,t)=>xy(i,typeof e!="symbol"?e+"":e,t);class ws{constructor(){vs(this,"_imgSource",[]),vs(this,"_demSource"),vs(this,"_vtSource"),vs(this,"manager",Oe.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),n=await this.loadMaterial(e);console.assert(!!n&&!!t);for(let r=0;r<n.length;r++)t.addGroup(0,1/0,r);return{materials:n,geometry:t}}unload(e){const t=e.material,n=e.geometry;for(let r=0;r<t.length;r++)t[r].dispose();n.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const n=Oe.getGeometryLoader(this.demSource),r=this.demSource;t=await n.load({source:r,...e}).catch(o=>(console.error("Load material error",r.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{n.unload&&n.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const n=Oe.getMeshLoader(this.vtSource),r=this.vtSource;t=await n.load({source:r,...e}).catch(o=>(console.error("Load geometry error",r.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{n.unload&&n.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const n=this.imgSource.filter(r=>e.z>=r.minLevel&&this._isBoundsInSourceBounds(r,e.bounds)).map(async r=>{const o=Oe.getMaterialLoader(r),a=await o.load({source:r,...e}).catch(u=>(console.error("Load material error",r.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=u=>{o.unload&&o.unload(u.target),u.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(n)}_isBoundsInSourceBounds(e,t){const n=e._projectionBounds;return!(t[2]<n[0]||t[3]<n[1]||t[0]>n[2]||t[1]>n[3])}}function Ti(...i){const e=i,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 n=e.reduce((a,c)=>a+c.length,0),r=new t(n);let o=0;for(const a of e)r.set(a,o),o+=a.length;return r}function su(i,e,t,n){const r=n?Sy(n,i.position.value):My(e),o=r.length,a=new Float32Array(o*6),c=new Float32Array(o*4),u=new e.constructor(o*6),d=new Float32Array(o*6);for(let f=0;f<o;f++)Ly({edge:r[f],edgeIndex:f,attributes:i,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:u,newNormals:d});i.position.value=Ti(i.position.value,a),i.texcoord.value=Ti(i.texcoord.value,c),i.normal.value=Ti(i.normal.value,d);const m=Ti(e,u);return{attributes:i,indices:m}}function My(i){const e=[],t=Array.isArray(i)?i:Array.from(i);for(let r=0;r<t.length;r+=3){const o=t[r],a=t[r+1],c=t[r+2];e.push([o,a],[a,c],[c,o])}e.sort(([r,o],[a,c])=>{const u=Math.min(r,o),d=Math.min(a,c);return u!==d?u-d:Math.max(r,o)-Math.max(a,c)});const n=[];for(let r=0;r<e.length;r++)r+1<e.length&&e[r][0]===e[r+1][1]&&e[r][1]===e[r+1][0]?r++:n.push(e[r]);return n}function Sy(i,e){const t=(r,o)=>{r.sort(o)};t(i.westIndices,(r,o)=>e[3*r+1]-e[3*o+1]),t(i.eastIndices,(r,o)=>e[3*o+1]-e[3*r+1]),t(i.southIndices,(r,o)=>e[3*o]-e[3*r]),t(i.northIndices,(r,o)=>e[3*r]-e[3*o]);const n=[];return Object.values(i).forEach(r=>{if(r.length>1)for(let o=0;o<r.length-1;o++)n.push([r[o],r[o+1]])}),n}function Ly({edge:i,edgeIndex:e,attributes:t,skirtHeight:n,newPosition:r,newTexcoord0:o,newTriangles:a,newNormals:c}){const u=t.position.value.length,d=e*2,m=d+1;r.set(t.position.value.subarray(i[0]*3,i[0]*3+3),d*3),r[d*3+2]=r[d*3+2]-n,r.set(t.position.value.subarray(i[1]*3,i[1]*3+3),m*3),r[m*3+2]=r[m*3+2]-n,o.set(t.texcoord.value.subarray(i[0]*2,i[0]*2+2),d*2),o.set(t.texcoord.value.subarray(i[1]*2,i[1]*2+2),m*2);const f=e*2*3;a[f]=i[0],a[f+1]=u/3+m,a[f+2]=i[1],a[f+3]=u/3+m,a[f+4]=i[0],a[f+5]=u/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 ou(i){if(i.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${i.length}!`);const e=Math.floor(Math.sqrt(i.length)),t=e,n=e,r=sa(n,t);return{attributes:Py(i,n,t),indices:r}}function Py(i,e,t){const n=t*e,r=new Float32Array(n*3),o=new Float32Array(n*2);let a=0;for(let c=0;c<e;c++)for(let u=0;u<t;u++){const d=u/(t-1),m=c/(e-1);o[a*2]=d,o[a*2+1]=m,r[a*3]=d-.5,r[a*3+1]=m-.5,r[a*3+2]=i[(e-c-1)*t+u],a++}return{position:{value:r,size:3},texcoord:{value:o,size:2},normal:{value:oa(r,sa(e,t)),size:3}}}function sa(i,e){const t=6*(e-1)*(i-1),n=new Uint16Array(t);let r=0;for(let o=0;o<i-1;o++)for(let a=0;a<e-1;a++){const c=o*e+a,u=c+1,d=c+e,m=d+1,f=r*6;n[f]=c,n[f+1]=u,n[f+2]=d,n[f+3]=d,n[f+4]=u,n[f+5]=m,r++}return n}function oa(i,e){const t=new Float32Array(i.length);for(let n=0;n<e.length;n+=3){const r=e[n]*3,o=e[n+1]*3,a=e[n+2]*3,c=i[r],u=i[r+1],d=i[r+2],m=i[o],f=i[o+1],g=i[o+2],_=i[a],w=i[a+1],x=i[a+2],b=m-c,L=f-u,M=g-d,C=_-c,Z=w-u,z=x-d,D=L*z-M*Z,X=M*C-b*z,I=b*Z-L*C,K=Math.sqrt(D*D+X*X+I*I),V=[0,0,1];if(K>0){const G=1/K;V[0]=D*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[r+G]=t[o+G]=t[a+G]=V[G]}return t}var Cy=Object.defineProperty,Ty=(i,e,t)=>e in i?Cy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Gy=(i,e,t)=>Ty(i,e+"",t);class Ur extends p.PlaneGeometry{constructor(){super(...arguments),Gy(this,"type","TileGeometry")}setData(e,t=1e3){let n=e instanceof Float32Array?ou(e):e;n=su(n.attributes,n.indices,t);const{attributes:r,indices:o}=n;return this.setIndex(new p.BufferAttribute(o,1)),this.setAttribute("position",new p.BufferAttribute(r.position.value,r.position.size)),this.setAttribute("uv",new p.BufferAttribute(r.texcoord.value,r.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(r.normal.value,r.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var Zy=Object.defineProperty,Wy=(i,e,t)=>e in i?Zy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Jn=(i,e,t)=>Wy(i,typeof e!="symbol"?e+"":e,t);class au{constructor(e=257){Jn(this,"gridSize"),Jn(this,"numTriangles"),Jn(this,"numParentTriangles"),Jn(this,"indices"),Jn(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 n=0;n<this.numTriangles;n++){let r=n+2,o=0,a=0,c=0,u=0,d=0,m=0;for(r&1?c=u=d=t:o=a=m=t;(r>>=1)>1;){const g=o+c>>1,_=a+u>>1;r&1?(c=o,u=a,o=d,a=m):(o=c,a=u,c=d,u=m),d=g,m=_}const f=n*4;this.coords[f+0]=o,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=u}}createTile(e){return new Vy(e,this)}}class Vy{constructor(e,t){Jn(this,"martini"),Jn(this,"terrain"),Jn(this,"errors");const n=t.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:n,gridSize:r}=this.martini,{terrain:o,errors:a}=this;for(let c=e-1;c>=0;c--){const u=c*4,d=n[u+0],m=n[u+1],f=n[u+2],g=n[u+3],_=d+f>>1,w=m+g>>1,x=_+w-m,b=w+d-_,L=(o[m*r+d]+o[g*r+f])/2,M=w*r+_,C=Math.abs(L-o[M]);if(a[M]=Math.max(a[M],C),c<t){const Z=(m+b>>1)*r+(d+x>>1),z=(g+b>>1)*r+(f+x>>1);a[M]=Math.max(a[M],a[Z],a[z])}}}getGeometryData(e=0){const{gridSize:t,indices:n}=this.martini,{errors:r}=this;let o=0,a=0;const c=t-1;let u,d,m=0;n.fill(0);function f(M,C,Z,z,D,X){const I=M+Z>>1,K=C+z>>1;Math.abs(M-D)+Math.abs(C-X)>1&&r[K*t+I]>e?(f(D,X,M,C,I,K),f(Z,z,D,X,I,K)):(u=C*t+M,d=z*t+Z,m=X*t+D,n[u]===0&&(n[u]=++o),n[d]===0&&(n[d]=++o),n[m]===0&&(n[m]=++o),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=o*2,_=a*3,w=new Uint16Array(g),x=new Uint32Array(_);let b=0;function L(M,C,Z,z,D,X){const I=M+Z>>1,K=C+z>>1;if(Math.abs(M-D)+Math.abs(C-X)>1&&r[K*t+I]>e)L(D,X,M,C,I,K),L(Z,z,D,X,I,K);else{const V=n[C*t+M]-1,G=n[z*t+Z]-1,k=n[X*t+D]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=Z,w[2*G+1]=z,w[2*k]=D,w[2*k+1]=X,x[b++]=V,x[b++]=G,x[b++]=k}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,x),indices:x}}_getMeshAttributes(e,t,n){const r=Math.floor(Math.sqrt(e.length)),o=r-1,a=t.length/2,c=new Float32Array(a*3),u=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],_=g*r+f;c[3*m+0]=f/o-.5,c[3*m+1]=.5-g/o,c[3*m+2]=e[_],u[2*m+0]=f/o,u[2*m+1]=1-g/o}const d=oa(c,n);return{position:{value:c,size:3},texcoord:{value:u,size:2},normal:{value:d,size:3}}}}var Iy=Object.defineProperty,Ay=(i,e,t)=>e in i?Iy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,lu=(i,e,t)=>Ay(i,typeof e!="symbol"?e+"":e,t);class aa{constructor(){lu(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),lu(this,"dataType","")}async load(e){const{source:t,x:n,y:r,z:o}=e,{url:a,clipBounds:c}=ra(t,n,r,o);if(!a)return new Ur;const u=await this.doLoad(a,{source:t,x:n,y:r,z:o,bounds:c});return Oe.manager.parseEnd(a),u}}class la 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 tt=(i=>(i[i.Unknown=0]="Unknown",i[i.Point=1]="Point",i[i.Linestring=2]="Linestring",i[i.Polygon=3]="Polygon",i))(tt||{});class cu{render(e,t,n,r,o=1){switch(e.lineCap="round",e.lineJoin="round",(r.shadowBlur??0)>0&&(e.shadowBlur=r.shadowBlur??2,e.shadowColor=r.shadowColor??"black",e.shadowOffsetX=r.shadowOffset?r.shadowOffset[0]:0,e.shadowOffsetY=r.shadowOffset?r.shadowOffset[1]:0),t){case tt.Point:e.textAlign="center",e.textBaseline="middle",e.font=r.font??"14px Arial",e.fillStyle=r.fontColor??"white",this._renderPointText(e,n,o,r.textField??"name",r.fontOffset??[0,-8]);break;case tt.Linestring:this._renderLineString(e,n,o);break;case tt.Polygon:this._renderPolygon(e,n,o);break;default:console.warn(`Unknown feature type: ${t}`)}(r.fill||t===tt.Point)&&(e.globalAlpha=r.fillOpacity||.5,e.fillStyle=r.fillColor||r.color||"#3388ff",e.fill(r.fillRule||"evenodd")),(r.stroke??!0)&&(r.weight??1)>0&&(e.globalAlpha=r.opacity||1,e.lineWidth=r.weight||1,e.strokeStyle=r.color||"#3388ff",e.setLineDash(r.dashArray||[]),e.stroke())}_renderPointText(e,t,n=1,r="name",o=[0,0]){const a=t.geometry;e.beginPath();for(const u of a)for(let d=0;d<u.length;d++){const m=u[d];e.arc(m.x*n,m.y*n,2,0,2*Math.PI)}const c=t.properties;c&&c[r]&&e.fillText(c[r],a[0][0].x*n+o[0],a[0][0].y*n+o[1])}_renderLineString(e,t,n){const r=t.geometry;e.beginPath();for(const o of r)for(let a=0;a<o.length;a++){const{x:c,y:u}=o[a];a===0?e.moveTo(c*n,u*n):e.lineTo(c*n,u*n)}}_renderPolygon(e,t,n){const r=t.geometry;e.beginPath();for(let o=0;o<r.length;o++){const a=r[o];for(let c=0;c<a.length;c++){const{x:u,y:d}=a[c];c===0?e.moveTo(u*n,d*n):e.lineTo(u*n,d*n)}e.closePath()}}}var Fy=Object.defineProperty,Oy=(i,e,t)=>e in i?Fy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,uu=(i,e,t)=>Oy(i,typeof e!="symbol"?e+"":e,t);class ca{constructor(){uu(this,"info",{version:"0.10.0",description:"Image loader base class"}),uu(this,"dataType","")}async load(e){const{source:t,x:n,y:r,z:o}=e,a=new la({}),{url:c,clipBounds:u}=ra(t,n,r,o);if(c){const d=await this.doLoad(c,{source:t,x:n,y:r,z:o,bounds:u});a.map=d,Oe.manager.parseEnd(c)}return a}}var Dy=Object.defineProperty,zy=(i,e,t)=>e in i?Dy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,hu=(i,e,t)=>zy(i,typeof e!="symbol"?e+"":e,t);class Xy{constructor(){hu(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),hu(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const n=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new la({transparent:!0,map:n,opacity:e.source.opacity})}_creatCanvasContext(e,t){const r=new OffscreenCanvas(e,t).getContext("2d");if(!r)throw new Error("create canvas context failed");return r.scale(1,-1),r.translate(0,-t),r}}var Uy=Object.defineProperty,ky=(i,e,t)=>e in i?Uy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ua=(i,e,t)=>ky(i,typeof e!="symbol"?e+"":e,t);class Ky extends ca{constructor(){super(...arguments),ua(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),ua(this,"dataType","image"),ua(this,"loader",new p.ImageLoader(Oe.manager))}async doLoad(e,t){const n=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),r=new p.Texture;r.colorSpace=p.SRGBColorSpace;const{bounds:o}=t;return o[2]-o[0]<1?r.image=Ny(n,o):r.image=n,r.needsUpdate=!0,r}}function Ny(i,e){const t=i.width,n=new OffscreenCanvas(t,t),r=n.getContext("2d"),{sx:o,sy:a,sw:c,sh:u}=na(e,i.width);return r.drawImage(i,o,a,c,u,0,0,t,t),n}const By=`{
|
|
906
906
|
"name": "@terra.gl/core",
|
|
907
|
-
"version": "0.0.1-alpha.
|
|
907
|
+
"version": "0.0.1-alpha.54",
|
|
908
908
|
"type": "module",
|
|
909
909
|
"files": [
|
|
910
910
|
"dist"
|