You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

777 lines
424 KiB

9 months ago
var dg=Object.defineProperty,pg=Object.defineProperties;var fg=Object.getOwnPropertyDescriptors;var Ri=Object.getOwnPropertySymbols;var Fa=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable;var tn=(j,Q,K)=>Q in j?dg(j,Q,{enumerable:!0,configurable:!0,writable:!0,value:K}):j[Q]=K,N=(j,Q)=>{for(var K in Q||(Q={}))Fa.call(Q,K)&&tn(j,K,Q[K]);if(Ri)for(var K of Ri(Q))Na.call(Q,K)&&tn(j,K,Q[K]);return j},ue=(j,Q)=>pg(j,fg(Q));var te=(j,Q)=>{var K={};for(var _e in j)Fa.call(j,_e)&&Q.indexOf(_e)<0&&(K[_e]=j[_e]);if(j!=null&&Ri)for(var _e of Ri(j))Q.indexOf(_e)<0&&Na.call(j,_e)&&(K[_e]=j[_e]);return K};var b=(j,Q,K)=>(tn(j,typeof Q!="symbol"?Q+"":Q,K),K);(function(j,Q){typeof exports=="object"&&typeof module!="undefined"?module.exports=Q():typeof define=="function"&&define.amd?define(Q):(j=typeof globalThis!="undefined"?globalThis:j||self,j.VE=Q())})(this,function(){"use strict";function j(i){return i!=null&&typeof i=="object"&&i["@@functional/placeholder"]===!0}function Q(i){return function e(t){return arguments.length===0||j(t)?e:i.apply(this,arguments)}}function K(i){return function e(t,r){switch(arguments.length){case 0:return e;case 1:return j(t)?e:Q(function(n){return i(t,n)});default:return j(t)&&j(r)?e:j(t)?Q(function(n){return i(n,r)}):j(r)?Q(function(n){return i(t,n)}):i(t,r)}}}function _e(i,e){switch(i){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,r){return e.apply(this,arguments)};case 3:return function(t,r,n){return e.apply(this,arguments)};case 4:return function(t,r,n,s){return e.apply(this,arguments)};case 5:return function(t,r,n,s,o){return e.apply(this,arguments)};case 6:return function(t,r,n,s,o,l){return e.apply(this,arguments)};case 7:return function(t,r,n,s,o,l,c){return e.apply(this,arguments)};case 8:return function(t,r,n,s,o,l,c,h){return e.apply(this,arguments)};case 9:return function(t,r,n,s,o,l,c,h,u){return e.apply(this,arguments)};case 10:return function(t,r,n,s,o,l,c,h,u,p){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function rn(i,e,t){return function(){for(var r=[],n=0,s=i,o=0;o<e.length||n<arguments.length;){var l;o<e.length&&(!j(e[o])||n>=arguments.length)?l=e[o]:(l=arguments[n],n+=1),r[o]=l,j(l)||(s-=1),o+=1}return s<=0?t.apply(this,r):_e(s,rn(i,r,t))}}var Ua=K(function(e,t){return e===1?Q(t):_e(e,rn(e,[],t))}),Tt=Ua;function je(i){return function e(t,r,n){switch(arguments.length){case 0:return e;case 1:return j(t)?e:K(function(s,o){return i(t,s,o)});case 2:return j(t)&&j(r)?e:j(t)?K(function(s,o){return i(s,r,o)}):j(r)?K(function(s,o){return i(t,s,o)}):Q(function(s){return i(t,r,s)});default:return j(t)&&j(r)&&j(n)?e:j(t)&&j(r)?K(function(s,o){return i(s,o,n)}):j(t)&&j(n)?K(function(s,o){return i(s,r,o)}):j(r)&&j(n)?K(function(s,o){return i(t,s,o)}):j(t)?Q(function(s){return i(s,r,n)}):j(r)?Q(function(s){return i(t,s,n)}):j(n)?Q(function(s){return i(t,r,s)}):i(t,r,n)}}}var ei=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function Wa(i){return i!=null&&typeof i["@@transducer/step"]=="function"}function ti(i,e,t){return function(){if(arguments.length===0)return t();var r=Array.prototype.slice.call(arguments,0),n=r.pop();if(!ei(n)){for(var s=0;s<i.length;){if(typeof n[i[s]]=="function")return n[i[s]].apply(n,r);s+=1}if(Wa(n)){var o=e.apply(null,r);return o(n)}}return t.apply(this,arguments)}}function nn(i){return i&&i["@@transducer/reduced"]?i:{"@@transducer/value":i,"@@transducer/reduced":!0}}var ct={init:function(){return this.xf["@@transducer/init"]()},result:function(i){return this.xf["@@transducer/result"](i)}},Va=function(){function i(e,t){this.xf=t,this.f=e,this.all=!0}return i.prototype["@@transducer/init"]=ct.init,i.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},i.prototype["@@transducer/step"]=function(e,t){return this.f(t)||(this.a
`+t.map(function(r,n){return n+1+") "+r.toString()}).join(`
`):"",this.name="UnsubscriptionError",this.errors=t}});function tr(i,e){if(i){var t=i.indexOf(e);0<=t&&i.splice(t,1)}}var si=function(){function i(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var e,t,r,n,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var l=mt(o),c=l.next();!c.done;c=l.next()){var h=c.value;h.remove(this)}}catch(g){e={error:g}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(ae(u))try{u()}catch(g){s=g instanceof er?g.errors:[g]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var d=mt(p),f=d.next();!f.done;f=d.next()){var m=f.value;try{Vn(m)}catch(g){s=s!=null?s:[],g instanceof er?s=Te(Te([],Se(s)),Se(g.errors)):s.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(s)throw new er(s)}},i.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Vn(e);else{if(e instanceof i){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},i.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},i.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},i.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&tr(t,e)},i.prototype.remove=function(e){var t=this._finalizers;t&&tr(t,e),e instanceof i&&e._removeParent(this)},i.EMPTY=function(){var e=new i;return e.closed=!0,e}(),i}(),Un=si.EMPTY;function Wn(i){return i instanceof si||i&&"closed"in i&&ae(i.remove)&&ae(i.add)&&ae(i.unsubscribe)}function Vn(i){ae(i)?i():i.unsubscribe()}var ir={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},rr={setTimeout:function(i,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var n=rr.delegate;return(n==null?void 0:n.setTimeout)?n.setTimeout.apply(n,Te([i,e],Se(t))):setTimeout.apply(void 0,Te([i,e],Se(t)))},clearTimeout:function(i){var e=rr.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(i)},delegate:void 0};function jn(i){rr.setTimeout(function(){throw i})}function qn(){}var oi=null;function ai(i){if(ir.useDeprecatedSynchronousErrorHandling){var e=!oi;if(e&&(oi={errorThrown:!1,error:null}),i(),e){var t=oi,r=t.errorThrown,n=t.error;if(oi=null,r)throw n}}else i()}var nr=function(i){ft(e,i);function e(t){var r=i.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Wn(t)&&t.add(r)):r.destination=xh,r}return e.create=function(t,r,n){return new kt(t,r,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(si),Ch=Function.prototype.bind;function sr(i,e){return Ch.call(i,e)}var wh=function(){function i(e){this.partialObserver=e}return i.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(r){li(r)}},i.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(r){li(r)}else li(e)},i.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){li(t)}},i}(),kt=function(i){ft(e,i);function e(t,r,n){var s=i.call(this)||this,o;if(ae(t)||!t)o={next:t!=null?t:void 0,error:r!=null?r:void 0,complete:n!=null?n:void 0};else{var l;s&&ir.useDeprecatedNextContext?(l=Object.create(t),l.unsubscribe=f
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float angle;
angle = speed * czm_frameNumber/600.0;
st-=0.5;
st = mat2(cos(angle),-sin(angle),
sin(angle),cos(angle)) * st;
st+=0.5;
vec4 imgC = texture2D(image, st);
if(imgC.a>.0){
material.diffuse = color.rgb;
}
material.alpha = imgC.a * color.a;
return material;
}
`;class Me{constructor(e){this.options=e,this._definitionChanged=new a.Event}get typeName(){return`${this.type}Type`}getType(){return this.type}get isConstant(){return!0}equals(e){return e===this}get definitionChanged(){return this._definitionChanged}getValue(e,t){return t||(t={}),t.isStart||(t.isStart=!0,Object.keys(this.options).forEach(r=>{t[r]=this.options[r]})),t}}const gu={image:"",color:new a.Color(1,0,0,0),speed:10},vu=[Z("color")];class yu extends Me{constructor(e){super(re(vu,e));b(this,"type","CircleScan");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:gu,source:mu},translucent:function(){return!0}}))}}var _u=`
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = 1.5 * color.rgb;
vec2 st = materialInput.st;
float dis = distance(st, vec2(0.5, 0.5));
float per = fract(speed*czm_frameNumber/1000.0);
if(count==1.0){
if(dis > per * 0.5){
discard;
}else {
material.alpha = color.a * dis / per / 2.0;
}
}
else{
vec3 str = materialInput.str;
if(abs(str.z)>0.001){
discard;
}
if(dis >0.5){
discard;
}
else {
float perDis = 0.5/count;
float disNum;
float bl = 0.0;
for(int i=0;i<=999;i++){
if(float(i)<=count){
disNum = perDis*float(i) - dis + per/count;
if(disNum>0.0){
if(disNum<perDis){
bl = 1.0-disNum/perDis;
}
else if(disNum-perDis<perDis){
bl = 1.0 - abs(1.0-disNum/perDis);
}
material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));
}
}
}
}
}
return material;
}
`;const Cu={speed:10,color:new a.Color(1,1,0,1),count:1,gradient:.1},wu=[Z("color")];class bu extends Me{constructor(e){super(re(wu,e));b(this,"type","CircleWave");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:Cu,source:_u},translucent:function(){return!0}}))}}const xu=[Z("color")];class Au extends a.ColorMaterialProperty{constructor(e){super(re(xu,e).color);this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Pu=[Z("color"),J("lineCount",a.Cartesian2),J("lineThickness",a.Cartesian2),J("lineOffset",a.Cartesian2)];class Su extends a.GridMaterialProperty{constructor(e){super(re(Pu,e));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Tu=[Z("color"),J("repeat",a.Cartesian2)];class Mu extends a.ImageMaterialProperty{constructor(e){super(N({transparent:!0},re(Tu,e)));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}var Eu=`czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = repeat * materialInput.st;
float currTime;
if(time < 0.0){
currTime = speed*czm_frameNumber/1000.0;
}
else{
currTime = time;
}
vec4 colorImage = texture2D(image, vec2(fract((axisY?st.t:st.s) - currTime), st.t));
if(color.a == 0.0) {
if(colorImage.rgb == vec3(1.0)){
discard;
}
material.alpha = colorImage.a;
material.diffuse = colorImage.rgb;
}
else {
material.alpha = colorImage.a * color.a;
material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);
}
if(hasImage2) {
vec4 colorBG = texture2D(image2,materialInput.st);
if(colorBG.a>0.5){
material.diffuse = color2.rgb;
}
}
return material;
}
`;const Du={time:-1,image:"",color:new a.Color(1,0,0,1),repeat:new a.Cartesian2(1,1),axisY:!1,speed:10,hasImage2:!1,image2:"",color2:new a.Color(1,1,1)},ku=[Z("color"),Z("color2"),J("repeat",a.Cartesian2),i=>{i.image2&&(i.hasImage2=!0)}];class Iu extends Me{constructor(e){super(re(ku,e));b(this,"type","LineFlow");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:Du,source:Eu},translucent:function(){return!0}}))}}const Ou=[Z("color")];class Ru extends a.PolylineArrowMaterialProperty{constructor(e){super(re(Ou,e).color);this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Bu=[Z("color"),Z("gapColor")];class Lu extends a.PolylineDashMaterialProperty{constructor(e){super(re(Bu,e));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const zu=[Z("color")];class Gu extends a.PolylineGlowMaterialProperty{constructor(e){super(re(zu,e));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Hu=[Z("color"),Z("outlineColor")];class Fu extends a.PolylineOutlineMaterialProperty{constructor(e){super(re(Hu,e));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Nu=[Z("evenColor"),Z("oddColor"),X("orientation",a.StripeOrientation)];class Uu extends a.StripeMaterialProperty{constructor(e){super(re(Nu,e));this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}const Wu=[Z("baseWaterColor"),Z("blendColor")];class Vu extends Me{constructor(e){super(re(Wu,e));b(this,"type","Water");this.depthTest=e.depthTest}getValue(e,t){const r=super.getValue(e,t);return H(this.depthTest)&&(r.depthTest=this.depthTest),r}}var ju=`
uniform vec4 color;
uniform vec4 bgColor;
uniform float speed;
uniform float startTime;
uniform float bidirectional;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float t = fract(startTime + czm_frameNumber * speed / 1000.0);
t *= 1.03;
float alpha0 = smoothstep(t - 0.03, t, st.s) * step(st.s, t);
float mt = 1. - t;
float alpha1 = smoothstep(mt + 0.03, mt, st.s) * step(mt, st.s);
float a0 = step(abs(bidirectional - 0.0) - 0.001, 0.);
float a1 = step(abs(bidirectional - 1.0) - 0.001, 0.);
float db = step(abs(bidirectional - 2.0) - 0.001, 0.);
float alpha = alpha0 * (a0 + db) + alpha1 * (a1 + db);
alpha = clamp(alpha, 0., 1.);
material.diffuse = color.rgb * alpha + bgColor.rgb * (1. - alpha);
material.alpha = color.a * alpha + bgColor.a * (1. - alpha);
// if (useImageAndRepeat.x != 0.) {
// float repeat = useImageAndRepeat.y;
// vec4 marsImageColor = texture2D(image, fract(vec2(fract((st.s-t)*repeat), st.t)));
// material.diffuse = marsImageColor.rgb;
// material.alpha = marsImageColor.a;
// }
return material;
}
`;const qu={bgColor:new a.Color(1,1,0,.1),color:new a.Color(1,1,0,.7),startTime:0,speed:20,bidirectional:0},Qu=[Z("color"),Z("bgColor")];class Yu extends Me{constructor(e){super(re(Qu,e));b(this,"type","ODLine");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:qu,source:ju},translucent:function(){return!0}}))}}var Ku=`uniform vec4 bgColor;
uniform vec4 color;
uniform float speed;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float time = fract(czm_frameNumber * speed / 1000.0);
vec3 fragColor = color.rgb;
if(st.t > 0.45 && st.t < 0.55 ) {
fragColor = vec3(1.0);
}
material.alpha = color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));
material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);
if(material.alpha < bgColor.a){
material.alpha = bgColor.a;
material.diffuse = bgColor.rgb;
}
return material;
}
`;const Ju={color:new a.Color(1,1,0,.7),bgColor:new a.Color(0,0,0,0),speed:5},Xu=[Z("color"),Z("bgColor")];class Zu extends Me{constructor(e){super(re(Xu,e));b(this,"type","LineTrail");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:Ju,source:Ku},translucent:function(){return!0}}))}}var $u=`
uniform vec4 color;
uniform float speed;
uniform float startTime;
uniform float percent;
uniform float alpha;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float t =fract(startTime +czm_frameNumber * speed / 1000.0);
t *= (1.0 + percent);
float alpha1 = smoothstep(t- percent, t, st.s) * step(-t, -st.s);
alpha1 += alpha;
material.diffuse = color.rgb;
material.alpha = alpha1;
return material;
}
`;const ed={color:new a.Color(1,0,0,.7),alpha:.1,speed:20,percent:.04,startTime:0},td=[Z("color")];class id extends Me{constructor(e){super(re(td,e));b(this,"type","LineFlowColor");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:ed,source:$u},translucent:function(){return!0}}))}}var rd=`
uniform vec4 color;
uniform float speed;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
float time = fract( czm_frameNumber * speed / 1000.0);
vec2 st = materialInput.st;
float scalar = smoothstep(0.0,1.0,time);
material.diffuse = color.rgb * scalar;
material.alpha = color.a * scalar ;
return material;
}
`;const nd={color:new a.Color(1,0,0,.7),speed:10},sd=[Z("color")];class od extends Me{constructor(e){super(re(sd,e));b(this,"type","LineFlicker");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:nd,source:rd},translucent:function(){return!0}}))}}var ad=`uniform vec4 grassColor;
uniform vec4 dirtColor;
uniform float patchiness;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float noise1 = (czm_snoise(st * patchiness * 1.0)) * 1.0;
float noise2 = (czm_snoise(st * patchiness * 2.0)) * 0.5;
float noise3 = (czm_snoise(st * patchiness * 4.0)) * 0.25;
float noise = sin(noise1 + noise2 + noise3) * 0.1;
vec4 color = mix(grassColor, dirtColor, noise);
//Make thatch patterns
float verticalNoise = czm_snoise(vec2(st.x * 100.0, st.y * 20.0)) * 0.02;
float horizontalNoise = czm_snoise(vec2(st.x * 20.0, st.y * 100.0)) * 0.02;
float stripeNoise = min(verticalNoise, horizontalNoise);
color.rgb += stripeNoise;
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`,ld=`/**
* @license
* Description : Array and textureless GLSL 2D/3D/4D simplex
* noise functions.
* Author : Ian McEwan, Ashima Arts.
* Maintainer : ijm
* Lastmod : 20110822 (ijm)
* License : Copyright (C) 2011 Ashima Arts. All rights reserved.
* Distributed under the MIT License. See LICENSE file.
* https://github.com/ashima/webgl-noise
*/
vec4 _czm_mod289(vec4 x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec3 _czm_mod289(vec3 x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec2 _czm_mod289(vec2 x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
float _czm_mod289(float x)
{
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 _czm_permute(vec4 x)
{
return _czm_mod289(((x*34.0)+1.0)*x);
}
vec3 _czm_permute(vec3 x)
{
return _czm_mod289(((x*34.0)+1.0)*x);
}
float _czm_permute(float x)
{
return _czm_mod289(((x*34.0)+1.0)*x);
}
vec4 _czm_taylorInvSqrt(vec4 r)
{
return 1.79284291400159 - 0.85373472095314 * r;
}
float _czm_taylorInvSqrt(float r)
{
return 1.79284291400159 - 0.85373472095314 * r;
}
vec4 _czm_grad4(float j, vec4 ip)
{
const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);
vec4 p,s;
p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;
p.w = 1.5 - dot(abs(p.xyz), ones.xyz);
s = vec4(lessThan(p, vec4(0.0)));
p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;
return p;
}
/**
* DOC_TBA
*
* Implemented by Ian McEwan, Ashima Arts, and distributed under the MIT License. {@link https://github.com/ashima/webgl-noise}
*
* @name czm_snoise
* @glslFunction
*
* @see <a href="https://github.com/ashima/webgl-noise">https://github.com/ashima/webgl-noise</a>
* @see Stefan Gustavson's paper <a href="http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf">Simplex noise demystified</a>
*/
float czm_snoise(vec2 v)
{
const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0
0.366025403784439, // 0.5*(sqrt(3.0)-1.0)
-0.577350269189626, // -1.0 + 2.0 * C.x
0.024390243902439); // 1.0 / 41.0
// First corner
vec2 i = floor(v + dot(v, C.yy) );
vec2 x0 = v - i + dot(i, C.xx);
// Other corners
vec2 i1;
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
//i1.y = 1.0 - i1.x;
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
// x0 = x0 - 0.0 + 0.0 * C.xx ;
// x1 = x0 - i1 + 1.0 * C.xx ;
// x2 = x0 - 1.0 + 2.0 * C.xx ;
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
// Permutations
i = _czm_mod289(i); // Avoid truncation effects in permutation
vec3 p = _czm_permute( _czm_permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
m = m*m ;
m = m*m ;
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
vec3 x = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x) - 0.5;
vec3 ox = floor(x + 0.5);
vec3 a0 = x - ox;
// Normalise gradients implicitly by scaling m
// Approximation of: m *= inversesqrt( a0*a0 + h*h );
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
// Compute final noise value at P
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
float czm_snoise(vec3 v)
{
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
// First corner
vec3 i = floor(v + dot(v, C.yyy) );
vec3 x0 = v - i + dot(i, C.xxx) ;
// Other corners
vec3 g = step(x0.yzx, x0.xyz);
vec3 l = 1.0 - g;
vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max( g.xyz, l.zxy );
// x0 = x0 - 0.0 + 0.0 * C.xxx;
// x1 = x0 - i1 + 1.0 * C.xxx;
// x2 = x0 - i2 + 2.0 * C.xxx;
// x3 = x0 - 1.0 + 3.0 * C.xxx;
vec3 x1 = x0 - i1 + C.xxx;
vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = _czm_mod289(i);
vec4 p = _czm_permute( _czm_permute( _czm_permute(
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
float n_ = 0.142857142857; // 1.0/7.0
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)
vec4 x_ = floor(j * ns.z);
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs(x) - abs(y);
vec4 b0 = vec4( x.xy, y.xy );
vec4 b1 = vec4( x.zw, y.zw );
//vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
//vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
vec4 s0 = floor(b0)*2.0 + 1.0;
vec4 s1 = floor(b1)*2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0));
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
vec3 p0 = vec3(a0.xy,h.x);
vec3 p1 = vec3(a0.zw,h.y);
vec3 p2 = vec3(a1.xy,h.z);
vec3 p3 = vec3(a1.zw,h.w);
//Normalise gradients
vec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
m = m * m;
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
dot(p2,x2), dot(p3,x3) ) );
}
float czm_snoise(vec4 v)
{
const vec4 C = vec4( 0.138196601125011, // (5 - sqrt(5))/20 G4
0.276393202250021, // 2 * G4
0.414589803375032, // 3 * G4
-0.447213595499958); // -1 + 4 * G4
// (sqrt(5) - 1)/4 = F4, used once below
#define F4 0.309016994374947451
// First corner
vec4 i = floor(v + dot(v, vec4(F4)) );
vec4 x0 = v - i + dot(i, C.xxxx);
// Other corners
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
vec4 i0;
vec3 isX = step( x0.yzw, x0.xxx );
vec3 isYZ = step( x0.zww, x0.yyz );
// i0.x = dot( isX, vec3( 1.0 ) );
i0.x = isX.x + isX.y + isX.z;
i0.yzw = 1.0 - isX;
// i0.y += dot( isYZ.xy, vec2( 1.0 ) );
i0.y += isYZ.x + isYZ.y;
i0.zw += 1.0 - isYZ.xy;
i0.z += isYZ.z;
i0.w += 1.0 - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
vec4 i3 = clamp( i0, 0.0, 1.0 );
vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );
vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );
// x0 = x0 - 0.0 + 0.0 * C.xxxx
// x1 = x0 - i1 + 1.0 * C.xxxx
// x2 = x0 - i2 + 2.0 * C.xxxx
// x3 = x0 - i3 + 3.0 * C.xxxx
// x4 = x0 - 1.0 + 4.0 * C.xxxx
vec4 x1 = x0 - i1 + C.xxxx;
vec4 x2 = x0 - i2 + C.yyyy;
vec4 x3 = x0 - i3 + C.zzzz;
vec4 x4 = x0 + C.wwww;
// Permutations
i = _czm_mod289(i);
float j0 = _czm_permute( _czm_permute( _czm_permute( _czm_permute(i.w) + i.z) + i.y) + i.x);
vec4 j1 = _czm_permute( _czm_permute( _czm_permute( _czm_permute (
i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))
+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))
+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))
+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;
vec4 p0 = _czm_grad4(j0, ip);
vec4 p1 = _czm_grad4(j1.x, ip);
vec4 p2 = _czm_grad4(j1.y, ip);
vec4 p3 = _czm_grad4(j1.z, ip);
vec4 p4 = _czm_grad4(j1.w, ip);
// Normalise gradients
vec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
p4 *= _czm_taylorInvSqrt(dot(p4,p4));
// Mix contributions from the five corners
vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);
vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);
m0 = m0 * m0;
m1 = m1 * m1;
return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))
+ dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;
}
`;const cd={grassColor:new a.Color(.25,.4,.1,1),dirtColor:new a.Color(.1,.1,.1,1),patchiness:1.5},hd=[Z("grassColor"),Z("dirtColor")];class ud extends Me{constructor(e){super(re(hd,e));b(this,"type","PolyGrass");this._initMaterial()}_initMaterial(){a.ShaderSource._czmBuiltinsAndUniforms.czm_snoise||(a.ShaderSource._czmBuiltinsAndUniforms.czm_snoise=ld),a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:cd,source:ad},translucent:function(){return!0}}))}}var dd=`
uniform vec4 color;
uniform sampler2D image;
uniform float dashPattern;
varying float v_polylineAngle;
varying float v_width;
const float maskLength = 64.0;
mat2 rotate(float rad) {
float c = cos(rad);
float s = sin(rad);
return mat2(
c, s,
-s, c
);
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
// Get the relative position within the dash from 0 to 1
float dashPosition = fract(pos.x / (v_width * 4.0 * czm_pixelRatio));
// Figure out the mask index.
float maskIndex = floor(dashPosition * maskLength);
// Test the bit mask.
float maskTest = floor(dashPattern / pow(2.0, maskIndex));
vec2 st = materialInput.st;
vec4 fragColor = color;
if (mod(maskTest, 2.0) < 1.0){
vec4 c= texture2D(image, vec2(dashPosition, st.t));
if (c.w>=0.01){
fragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
}
if (fragColor.a < 0.005) { // matches 0/255 and 1/255
discard;
}
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`;const pd={color:new a.Color(1,0,1,1),dashPattern:255,image:""},fd=[Z("color")];class ys extends Me{constructor(e){super(re(fd,e));b(this,"type","PolylineArrowLine");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:pd,source:dd},translucent:function(){return!0}}))}}var md=`uniform vec4 bgColor;
uniform vec4 color;
uniform float speed;
uniform float startTime;
czm_material czm_getMaterial(czm_materialInput materialInput){
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float time = (czm_frameNumber - startTime) * speed / 1000.0;
vec3 fragColor = color.rgb;
if(time - st.s < 0.0) {
material.alpha = 0.0;
} else {
material.alpha = color.a;
}
material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);
return material;
}
`;const gd={color:new a.Color(1,1,0,.7),speed:5,startTime:0},vd=[Z("color")];class yd extends Me{constructor(e){super(re(vd,e));b(this,"type","LineTrailOnce");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:this.type,uniforms:gd,source:md},translucent:function(){return!0}}))}}const _d=[Z("color")];class Cd extends Me{constructor(e){super(re(_d,e));b(this,"type","MaterialColor");this._initMaterial()}_initMaterial(){a.Material[this.typeName]||(a.Material[this.typeName]=this.type,a.Material._materialCache.addMaterial(this.type,{fabric:{type:"Color",uniforms:{color:{red:1,green:0,blue:0,alpha:.5}},components:{diffuse:"color.rgb",alpha:"color.a"}}}))}}const wd={[se.Checkerboard]:fu,[se.CircleScan]:yu,[se.CircleWave]:bu,[se.MaterialColor]:Cd,[se.Color]:Au,[se.Grid]:Su,[se.Image]:Mu,[se.LineFlow]:Iu,[se.PolylineArrow]:Ru,[se.PolylineDash]:Lu,[se.PolylineGlow]:Gu,[se.PolylineOutline]:Fu,[se.Stripe]:Uu,[se.Water]:Vu,[se.ODLine]:Yu,[se.LineTrail]:Zu,[se.LineTrailOnce]:yd,[se.LineFlowColor]:id,[se.LineFlicker]:od,[se.PolyGrass]:ud,[se.PolylineArrowLine]:ys,[se.PolylineArrowLine]:ys},bd=t=>{var r=t,{type:i}=r,e=te(r,["type"]);const n=wd[i];if(n)return new n(e);console.error(`\u4E0D\u5B58\u5728\u7C7B\u578B\u4E3A${i}\u7684material`)},xd=i=>{const e=i.opacity;H(e)&&(i.color=(i.color||a.Color.WHITE).withAlpha(e))},Ad=i=>{H(i.text)&&(i.text=i.text.replace(new RegExp("<br/>","gm"),`
`),Rt([i.fontStyle,i.fontWeight,i.fontSize,i.fontFamily])&&(i.font=`${i.fontStyle||"normal"} small-caps ${i.fontWeight||"normal"} ${i.fontSize||"30"}px ${i.fontFamily||"\u9ED1\u4F53"}`))},Pd=i=>{const e=i.color||i.fillColor;H(e)&&(i.fillColor=Ze(e),i.fill=!0)},Ie=i=>{const e=i.material||i.color;if(!ne(e)){if(e instanceof a.Color){i.material=e;return}if(xe(e)){i.material=Ze(e);return}pe(e)&&(i.material=bd(e))}},$e=i=>{H(i.outlineWidth)&&(i.style=i.outlineWidth?a.LabelStyle.FILL_AND_OUTLINE:a.LabelStyle.FILL)},Oe=i=>{const e=i.outlineColor||i.borderColor;H(e)&&(i.outlineColor=Ze(e))},Sd=i=>{const e=i.backgroundColor;H(e)&&(i.showBackground=!0,i.backgroundColor=Ze(e))},dr=i=>{const e=i.clampToTerrain;H(e)&&(i.heightReference=e?a.HeightReference.CLAMP_TO_GROUND:a.HeightReference.NONE)},pr=i=>{const e=i.clampToTerrain;H(e)&&(i.classificationType=e?a.ClassificationType.TERRAIN:a.ClassificationType.CESIUM_3D_TILE,e&&(i.clampToGround=!0))},fr=i=>{const e=i.visibleDepth;H(e)&&(e?i.disableDepthTestDistance=0:i.disableDepthTestDistance=Number.POSITIVE_INFINITY)},Td=i=>{const e=i.modelMatrix;H(e)&&(i.modelMatrix=Ee(e)?a.Matrix4.fromArray(e):e)},Ye=i=>{H(i.outlineWidth)&&(i.outline=!!i.outlineWidth)},mr=i=>{const e=i.clampToGround;H(e)&&(i.height=e?void 0:i.height,i.extrudedHeight=e?void 0:i.extrudedHeight)},gr=i=>{ne(i.extrudedHeight)&&i.lineHelper&&(i.outline=!1)},Md=[ke("heading","rotateX"),ke("pitch","rotateY"),ke("roll","rotateZ")],Ed={billboard:{adaptors:[ke("url","image"),J("alignedAxis",a.Cartesian3),J("pixelOffset",a.Cartesian2),J("eyeOffset",a.Cartesian3),X("horizontalOrigin",a.HorizontalOrigin),X("verticalOrigin",a.VerticalOrigin),Z("color"),J("scaleByDistance",a.NearFarScalar),J("translucencyByDistance",a.NearFarScalar),J("pixelOffsetScaleByDistance",a.NearFarScalar),J("distanceDisplayCondition",a.DistanceDisplayCondition),dr,fr,X("heightReference",a.HeightReference),ge(["color"])],defaultStyle:{horizontalOrigin:a.HorizontalOrigin.CENTER,verticalOrigin:a.VerticalOrigin.BOTTOM,isLabelInImage:!1}},label:{adaptors:[Ad,Pd,Sd,J("backgroundPadding",a.Cartesian2),J("pixelOffset",a.Cartesian2),J("eyeOffset",a.Cartesian3),X("horizontalOrigin",a.HorizontalOrigin),X("verticalOrigin",a.VerticalOrigin),Oe,ke("outlineWidth","borderWidth"),J("translucencyByDistance",a.NearFarScalar),J("pixelOffsetScaleByDistance",a.NearFarScalar),J("scaleByDistance",a.NearFarScalar),J("distanceDisplayCondition",a.DistanceDisplayCondition),$e,fr,dr,X("heightReference",a.HeightReference),ge(["fillColor","outlineColor","backgroundColor"])],defaultStyle:{}},point:{adaptors:[Z("color"),Oe,ke("outlineWidth","borderWidth"),J("scaleByDistance",a.NearFarScalar),J("translucencyByDistance",a.NearFarScalar),J("distanceDisplayCondition",a.DistanceDisplayCondition),fr,dr,X("heightReference",a.HeightReference),ge(["color","outlineColor"])],defaultStyle:{pixelSize:10}},divPoint:{adaptors:[X("verticalOrigin",a.VerticalOrigin),X("horizontalOrigin",a.HorizontalOrigin),J("distanceDisplayCondition",a.DistanceDisplayCondition),J("scaleByDistance",a.NearFarScalar),J("pixelOffset",a.Cartesian2)],defaultStyle:{horizontalOrigin:a.HorizontalOrigin.CENTER,verticalOrigin:a.VerticalOrigin.BOTTOM,scale:1}},geoJson:{adaptors:[ke("url","uri")],defaultStyle:{}},group:{adaptors:[],defaultStyle:{}},polyline:{adaptors:[Ie,J("distanceDisplayCondition",a.DistanceDisplayCondition),X("arcType",a.ArcType),Z("depthFailMaterial"),ge(["material"]),i=>{const e=i.clampToTerrain;H(e)&&(i.classificationType=e?a.ClassificationType.TERRAIN:a.ClassificationType.CESIUM_3D_TILE,e&&(i.clampToGround=!0))},X("classificationType",a.ClassificationType)],defaultStyle:{}},polygon:{adaptors:[X("extrudedHeightReference",a.HeightReference),Ie,Oe,Z("outlineColor"),ke("outlineWidth","borderWidth"),X("arcType",a.ArcType),J("distanceDisplayCondition",a.DistanceDisplayCondition),Ye,gr,pr,i=>{const e=i.clampToGround;H(e)&&(i.perPositionHeight=!e,i.height=e?void 0:i.height,i.extrudedHeight=e?void 0:i.extrudedHeight),H(i.height)&&(i.perPositionHeight=void 0)},X("heightReference",a.HeightReference),ge(["material","outlineCo
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
vec4 position = czm_inverseModelView * vec4(fsInput.attributes.positionEC,1); // \u4F4D\u7F6E
// \u6CE8\u610Fshader\u4E2D\u5199\u6D6E\u70B9\u6570\u662F\uFF0C\u4E00\u5B9A\u8981\u5E26\u5C0F\u6570\u70B9\uFF0C\u5426\u5219\u4F1A\u62A5\u9519\uFF0C\u6BD4\u59820\u9700\u8981\u5199\u62100.0\uFF0C1\u8981\u5199\u62101.0
float _baseHeight = 0.0; // \u7269\u4F53\u7684\u57FA\u7840\u9AD8\u5EA6\uFF0C\u9700\u8981\u4FEE\u6539\u6210\u4E00\u4E2A\u5408\u9002\u7684\u5EFA\u7B51\u57FA\u7840\u9AD8\u5EA6
float _heightRange = 60.0; // \u9AD8\u4EAE\u7684\u8303\u56F4(_baseHeight ~ _baseHeight + _heightRange)
float _glowRange = 100.0; // \u5149\u73AF\u7684\u79FB\u52A8\u8303\u56F4(\u9AD8\u5EA6)
// \u5EFA\u7B51\u57FA\u7840\u8272
float mars_height = position.z - _baseHeight;
float mars_a11 = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;
float mars_a12 = mars_height / _heightRange + sin(mars_a11) * 0.1;
material.diffuse = vec3(1.0, 1.0, 1.0); // \u989C\u8272
material.diffuse *= vec3(mars_a12);// \u6E10\u53D8
// \u52A8\u6001\u5149\u73AF
float time = fract(czm_frameNumber / 360.0);
time = abs(time - 0.5) * 2.0;
float mars_h = clamp(mars_height / _glowRange, 0.0, 1.0);
float mars_diff = step(0.005, abs(mars_h - time));
material.diffuse += material.diffuse * (1.0 - mars_diff);
} `,_p=`
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
vec3 finalColor = material.diffuse;
vec3 rgba = material.diffuse;
//\u8C03\u6574\u4EAE\u5EA6
finalColor = finalColor * brightness;
//\u8C03\u6574\u9971\u548C\u5EA6
float luminance = 0.2125 * rgba.r + 0.7154 * rgba.g + 0.0721 * rgba.b;
vec3 saturationTarget = vec3(luminance, luminance, luminance);
finalColor = mix(saturationTarget, finalColor, saturation);
//\u8C03\u6574\u5BF9\u6BD4\u5EA6
vec3 contrastTarget = vec3(0.5,0.5,0.5);
finalColor = mix(contrastTarget, finalColor, contrast);
material.diffuse = finalColor;
} `;class yi extends Ke{constructor(e){super(e);b(this,"type",R.Tileset);b(this,"resourceStyleFields",["url","uri"]);b(this,"sceneTreePromise",Od());b(this,"_color",{conditions:[]});b(this,"_height",0);b(this,"_positionEdit",null);this.style.url||console.warn("tilest url is required\uFF01"),this.primitive=new a.Cesium3DTileset(N({},Ce(this.style,this.type))),this._getSceneTree(),this.primitive.readyPromise.then(()=>{this.fire("ready"),(e.position||e.rotate)&&this.moveTo(e.position,e.rotate)}),["allTilesLoaded","initialTilesLoaded","tileFailed","tileLoad","tileUnload"].forEach(t=>{this.primitive[t].addEventListener((...r)=>{this.fire(t,...r)})})}_getTileProperty(e){if(!(e.content&&e.content.featuresLength))return;const t=e.content.featuresLength,r=[];for(let n=0;n<t;n++){const s=e.content.getFeature(n),o=s.getPropertyNames();r.push(o.reduce((l,c)=>ue(N({},l),{[c]:s.getProperty(c),feature:s}),{}))}return r}getAllPropertyWithTile(){return this.primitive._root.children.map(e=>{const t=this._getTileProperty(e);return{tile:e,property:t}}).filter(e=>e&&e.property&&e.property.length>0)}getAllProperty(){return this.primitive._root.children.map(this._getTileProperty).filter(e=>e&&e.length>0)}async _getSceneTree(){try{const e=await Rd({type:"GET",url:this.style.url.replace(/tileset.json/g,"scenetree.json")});this.sceneTree=e.scenes,this.sceneTreePromise.resolve()}catch{this.sceneTree=[],this.sceneTreePromise.resolve()}}findElementByName(e,t=this.sceneTree){for(const r of t){if(r.name===e)return r;if(r.children){const n=this.findElementByName(e,r.children);if(n)return n}}}locateScene(e,t={}){var o;if(xe(e)&&(e=this.findElementByName(e)),!e)return;const r=e.sphere,n=this.primitive;if(!r||r[3]<=0)return;let s=new a.Cartesian3(r[0],r[1],r[2]);try{let l=n._root.transform;l=a.Matrix4.inverse(l,new a.Matrix4);let c=n.root.computedTransform,h=a.Matrix4.multiply(c,l,new a.Matrix4);s=a.Matrix4.multiplyByPoint(h,s,new a.Cartesian3),this._map.viewer.camera.flyToBoundingSphere(new a.BoundingSphere(s,(o=t.range)!=null?o:r[3]+t.offsetRange||0),N({duration:.5},t)),t.lookAt&&this._map.viewer.camera.lookAt(s)}catch{}}_addedHook(){super._addedHook(),this.setStyle(this.style)}flyTo(e){return this.primitive.readyPromise.then(()=>{super.flyTo(e)}),this}get boundingSphere(){try{return this.primitive.boundingSphere}catch{return null}}get readyPromise(){return Promise.all([this.primitive.readyPromise,this.sceneTreePromise])}get point(){return new L(Cp(this.primitive))}get center(){return this.point}get position(){return this.point}set position(e){this.moveTo(e)}get hpr(){const{heading:e,roll:t,pitch:r}=a.Transforms.fixedFrameToHeadingPitchRoll(this.primitive.root.transform);return{heading:a.Math.toDegrees(e),roll:a.Math.toDegrees(t),pitch:a.Math.toDegrees(r)}}set hpr(e){this.rotate(e)}rotate(e){this.moveTo(null,e)}async moveTo(e,t={}){var c,h,u,p,d,f;await this.readyPromise;const r=new L(e||this.point);if(r.isZero())return;const n=this.hpr,s=(h=(c=t.heading)!=null?c:t.rotateZ)!=null?h:n.heading,o=(p=(u=t.pitch)!=null?u:t.rotateY)!=null?p:n.pitch,l=(f=(d=t.roll)!=null?d:t.rotateX)!=null?f:n.roll;if(!r.isZero()){this._position=e;const{modelMatrix:m,transform:g}=jc(r,{heading:s,pitch:o,roll:l},this.primitive);H(m)&&this.setStyle({modelMatrix:m}),H(g)&&(this.primitive.root.transform=g),requestAnimationFrame(()=>{e&&this.fire("update:position",this.point),t&&this.fire("update:hpr",this.hpr)})}return this}setColorStyle(e=this._color,t){H(e)&&(this._color=Cr(e)),xe(e)&&(e={conditions:[["true",e]]}),Ee(t)&&(e.conditions=[...t,...e.conditions]);const r=this.primitive.style||new a.Cesium3DTileStyle;return r.color=e,this.primitive.style=null,this.primitive.style=r,this}setShowStyle(e){const t=this.primitive.style||new a.Cesium3DTileStyle;return t.show=e,this.primitive.style=null,this.primitive.style=t,this}async setStyle(e={}){var u;if(!this.primitive)return;this.options.style=ie(this.style,e),this.fire("update:style",this.style);const h=Ce(this.options.style,this.type),{modelMatrix:t,color:r,opacity:n,height:s,leJzwStyle:o,visualImpact:l}=h,c=te(h,["mod
(+${n})`}return r}function Qp(i,e){if(i==null)return"";(e==null||e=="auto")&&(i<1e6?e="m":e="km");let t="";switch(e){default:case"m":t=`${i.toFixed(2)}\u5E73\u65B9\u7C73`;break;case"km":t=`${(i/1e6).toFixed(2)}\u5E73\u65B9\u516C\u91CC`;break;case"mu":t=`${(i*.0015).toFixed(2)}\u4EA9`;break;case"ha":t=`${(i*1e-4).toFixed(2)}\u516C\u9877`;break}return t}function Yp(i){return`\u89D2\u5EA6\uFF1A${i}\xB0`}class bi{constructor({map:e}){this._map=e,this._parent=e.addGraphic({type:"group",attr:{isHelper:!0}})}finish(){this._map.drawTool.finish()}destroy(){this._map=null,this._parent&&(this._parent.destroy(),this._parent=null),this.graphic&&(this.graphic.destroy(),this.graphic=null)}}class Kp extends bi{constructor(){super(...arguments);b(this,"labelGraphics",[])}start({lineStyle:e={},labelStyle:t={},unit:r,splitNum:n,format:s=qp,clampToGround:o=!1}={}){return new Promise(l=>{const c=this._map.drawTool;c.draw({type:"polyline",style:ue(N({},e),{clampToGround:o}),parent:this._parent}).then(({target:p})=>{this.graphic=p});const h=c.on("drawPoint",p=>{const d=new _i({position:p.point,style:N({text:"",color:"#ffffff",fontSize:18,outlineColor:"#000000",outlineWidth:3,pixelOffset:[0,-15],visibleDepth:!1},t)}).addTo(this._parent);let f=p.points;if(f.length===1)d.setStyle({text:"\u8D77\u70B9"});else{let m=Br(f),g=Br([f[f.length-2],f[f.length-1]]);g<.001&&d.hide(),d.setOptions({style:{text:s({unit:r,partDistance:g,totalDistance:m})},attr:{partDistance:g}})}this.labelGraphics.push(d)}),u=c.on("drawRemovePoint",()=>{this.labelGraphics.pop().destroy()});c.once("drawEnd",p=>{if(h(),u(),o){const d=1.2;let f=0;const m=this.labelGraphics,g=p.points;Vp({viewer:this._map.viewer,positions:g,splitNum:n,calbakStep:function(x,y,v){let _=Br(x);y&&(_=_*d),f+=_,v++;let P=m[v];P&&(P.setOptions({style:{text:s({unit:r,partDistance:_,totalDistance:f})},attr:{partDistance:_,totalDistance:f}}),P.setStyle({}))},calbakEnd:()=>{l({distance:f,points:this.labelGraphics.map(w=>({position:w.point,distance:w.attr.totalDistance})),group:this._parent})}})}else l({distance:this.labelGraphics.reduce((d,f)=>d+f.attr.partDistance||0,0),points:this.labelGraphics.map(d=>({position:d.point,distance:d.attr.partDistance||0})),group:this._parent})})})}destroy(){super.destroy(),this.labelGraphics&&(this.labelGraphics=null)}}class Jp extends bi{start({lineStyle:e={},labelStyle:t={},unit:r,format:n=jp}={}){return new Promise((s,o)=>{this._map.drawTool.draw({type:"polyline",minPointNum:2,maxPointNum:2,style:N({color:"#ffff00"},e),parent:this._parent}).then(({target:c,points:h})=>{this.graphic=c;const u=Math.abs(h[0].height-h[1].height);this._parent.addGraphic({type:"label",position:c.center.addHeight(5),style:N({text:n(u,r),fontSize:18,outlineColor:"#000",verticalOrigin:"BOTTOM",color:"#ffffff",outlineWidth:3,visibleDepth:!1},t)}),s({height:u,target:c,group:this._parent})}).catch(()=>{o()})})}}class Xp extends bi{start({polygonStyle:e={},labelStyle:t={},unit:r,format:n=Qp}={}){return new Promise((s,o)=>{this._map.drawTool.draw({type:"polygon",style:N({},e),parent:this._parent}).then(({target:c,points:h})=>{const u=fh(h.map(p=>p.toLatLngArray()));new _i({position:c.center,style:N({text:n(u,r),color:"#ffffff",fontSize:18,outlineColor:"#000000",outlineWidth:3,pixelOffset:[0,-15],visibleDepth:!1},t)}).addTo(this._parent),s({area:u,target:c,group:this._parent})}).catch(()=>{o()})})}}class Zp extends bi{start({lineStyle:e={},dashLineStyle:t={},labelStyle:r={},format:n=Yp}={}){return new Promise((s,o)=>{this._map.drawTool.draw({type:"polyline",minPointNum:2,maxPointNum:2,style:N({color:"#ffff00",width:5,material:{type:"PolylineArrow",color:"yellow"}},e),parent:this._parent}).then(({target:c,points:h})=>{this.graphic=c;const u=mh(...h),p=Qc(...h,-u);this._parent.addGraphic({type:"polyline",positions:[h[0],p],style:N({width:2,material:{type:"PolylineDash",color:"red"}},t)}),this._parent.addGraphic({type:"label",position:c.center.addHeight(5),style:N({text:n(u),fontSize:18,outlineColor:"#000",verticalOrigin:"BOTTOM",color:"#ffffff",outlineWidth:3,visibleDepth:!1},r)}),s({angle:u,target:c,group
<span>\u7ECF\u5EA6: ${+o.toFixed(6)}\xB0</span>
<span>\u7EAC\u5EA6: ${+l.toFixed(6)}\xB0</span>
<span>\u6D77\u62D4: ${+c.toFixed(0)}\u7C73</span>
<span>\u65B9\u5411: ${+n.toFixed(0)}\xB0</span>
<span>\u503E\u659C\u89D2: ${+s.toFixed(0)}\xB0</span>
<span>\u89C6\u8DDD: ${+r.toFixed(0)}\u7C73</span>
`};this._eventEffect=this._map.on([Y.CameraChanged,Y.CameraMoveEnd].join(" "),e),e()}setOptions(e){this._dom&&(this._dom.remove(),this._dom=null),this._eventEffect&&(this._eventEffect(),this._eventEffect=null),this.options=fe(this.options,e),this._init()}destroy(){this._dom&&(this._dom.remove(),this._dom=null),this._eventEffect&&(this._eventEffect(),this._eventEffect=null),super.destroy()}}var _g="";class Pa extends bt{constructor(e){super(ie({mapOptions:{scene:{screenSpaceCameraController:{enableRotate:!1,enableTranslate:!1,enableZoom:!1,enableTilt:!1,enableLook:!1}}},rectangleStyle:{color:"rgb(243, 131, 33)"},scale:1.2},e))}_addedHook(){const e=this._map;this._div=document.createElement("div"),this._div.setAttribute("class","cesium-view-control-overview"),e.container.append(this._div),this.overviewMap=new za(this._div,N({baseMaps:e.options.baseMaps,imageryProvider:e.options.imageryProvider},this.options.mapOptions)),this.overviewMap.changeMode("2d"),this.overviewMap.viewer.entities.add({rectangle:{coordinates:new a.CallbackProperty(()=>{const r=e.viewer.camera.computeViewRectangle();if(!r)return;const n=a.BoundingSphere.fromRectangle3D(r);return n.radius*=this.options.scale,this.overviewMap.camera.viewBoundingSphere(n),r},!1),outline:!0,outlineColor:a.Color.fromCssColorString(this.options.rectangleStyle.color),extrudedHeight:1,height:1,material:a.Color.fromCssColorString(this.options.rectangleStyle.color).withAlpha(.1)}})}destroy(){this._div&&(this._map.container.removeChild(this._div),this._div=null),this.overviewMap&&(this.overviewMap.destroy(),this.overviewMap=null),super.destroy()}}const Sa={[Dt.Floor]:va,[Dt.Navigation]:xa,[Dt.LocationBar]:Aa,[Dt.Overview]:Pa};var Gf=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",ControlMap:Sa,FloorControl:va,NavigationControl:xa,LocationBarControl:Aa,OverviewControl:Pa}),Hf={_extendInit(){this.controls=[]},setControlOptions(i){Object.entries(i).forEach(([e,t])=>{if(t===!1||t.show===!1){this.removeControl(e);return}this.getControl(e)?this.updateControl(N({id:e},t)):this.addControl(N({id:e,type:e},t))})},updateControl(t){var r=t,{id:i}=r,e=te(r,["id"]);const n=this.getControl(i);!n||n.setOptions(e)},addControl(i){let e;if(i instanceof bt)e=i;else{const t=i,{type:r}=t,n=te(t,["type"]),s=Sa[r];if(!s)return;e=new s(ue(N({},n),{map:this}))}return e._onAddToMap(this),this.controls.push(e),e},getControl(i){return i instanceof bt?i:this.controls.find(e=>e.id===i)},removeControl(i){const e=this.getControl(i),t=this.controls.findIndex(r=>r===e);t!==-1&&(this.controls.splice(t,1),e.state!==de.DESTROYED&&e.destroy())}};class De{constructor(e){this.id=e.id||et(),this.state=de.INITIALIZED,this.setOptions(N({show:!0},e))}setOptions(e){pe(e)&&Object.entries(e).forEach(([t,r])=>{t==="show"?this.enable=r:this[t]=r})}destroy(){this.enable=!1,this._delegate&&(this._delegate=null),this.state=de.DESTROYED,this._map.removeEffect(this),this._map=null,this._viewer=null}show(){this.enable=!0}hide(){this.enable=!1}addTo(e){return e?(this._map=e,this._viewer=e.viewer,this.state=de.ADDED,this.enable&&this.show(),this):this}}const Ff=new URL("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAgCgAwAEAAAAAQAAAQAAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAQACAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDABQQEBkSGScXFycyJh8mMi4mJiYmLj41NTU1N
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform vec4 fogByDistance;
uniform vec4 fogColor;
varying vec2 v_textureCoordinates;
float getDistance(sampler2D depthTexture, vec2 texCoords){
float depth = czm_unpackDepth(texture2D(depthTexture, texCoords));
if (depth == 0.0) {
return czm_infinity;
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);
return -eyeCoordinate.z / eyeCoordinate.w;
}
float interpolateByDistance(vec4 nearFarScalar, float distance){
float startDistance = nearFarScalar.x;
float startValue = nearFarScalar.y;
float endDistance = nearFarScalar.z;
float endValue = nearFarScalar.w;
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
return mix(startValue, endValue, t);
}
vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor){
return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
}
void main(void){
float distance = getDistance(depthTexture, v_textureCoordinates);
vec4 sceneColor = texture2D(colorTexture, v_textureCoordinates);
float blendAmount = interpolateByDistance(fogByDistance, distance);
vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);
gl_FragColor = alphaBlend(finalFogColor, sceneColor);
}
`;const Vf=[Z("color"),J("fogByDistance",a.NearFarScalar)],jf={fogByDistance:{near:100,nearValue:0,far:9e3,farValue:1},color:"#000"};class qf extends De{constructor(e={}){super(fe(jf,e));this.type=oe.Fog}setOptions(e){const t=re(Vf,e);super.setOptions(t)}set enable(e){this._enable=e,e&&this._map&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set fogByDistance(e){var t,r,n,s;this._fogByDistance=e,this._delegate&&(this._delegate.uniforms.fogByDistance=new a.Cartesian4(((t=this._fogByDistance)==null?void 0:t.near)||10,((r=this._fogByDistance)==null?void 0:r.nearValue)||0,((n=this._fogByDistance)==null?void 0:n.far)||2e3,((s=this._fogByDistance)==null?void 0:s.farValue)||1))}get fogByDistance(){return this._fogByDistance}set color(e){this._color=e,this._delegate&&(this._delegate.uniforms.fogColor=e)}get color(){return this._color}_createPostProcessStage(){var e,t,r,n;this._delegate=new a.PostProcessStage({name:this.id,fragmentShader:Wf,uniforms:{fogByDistance:new a.Cartesian4(((e=this._fogByDistance)==null?void 0:e.near)||10,((t=this._fogByDistance)==null?void 0:t.nearValue)||0,((r=this._fogByDistance)==null?void 0:r.far)||200,((n=this._fogByDistance)==null?void 0:n.farValue)||1),fogColor:this._color}}),this._map.viewer.scene.postProcessStages.add(this._delegate)}destroy(){this._delegate&&this._map.viewer.scene.postProcessStages.remove(this._delegate),super.destroy()}}var Qf=`
uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
uniform float speed;
float hash(float x){
return fract(sin(x*23.3)*13.13);
}
void main(){
float time = czm_frameNumber * speed / 1000.0;
vec2 resolution = czm_viewport.zw;
vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
vec3 c=vec3(.1,.2,.3);
float a=-.3;
float si=sin(a),co=cos(a);
uv*=mat2(co,-si,si,co);
uv*=length(uv+vec2(0,4.9))*.3+1.;
float v=1.-sin(hash(floor(uv.x*100.))*2.);
float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*10.;
c*=v*b;
gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c,1), 0.5);
}
`;const Yf={speed:10};class Kf extends De{constructor(e={}){super(fe(Yf,e));this.type=oe.Rain}set enable(e){this._enable=e,e&&this._map&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set speed(e){this._speed=e,this._delegate&&(this._delegate.uniforms.speed=e)}get speed(){return this._speed}_createPostProcessStage(){this._delegate=new a.PostProcessStage({name:this.id,fragmentShader:Qf,uniforms:{speed:this._speed}}),this._map.viewer.scene.postProcessStages.add(this._delegate)}destroy(){this._delegate&&this._map.viewer.scene.postProcessStages.remove(this._delegate),super.destroy()}}var Jf=`
uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
uniform float speed;
float snow(vec2 uv,float scale){
float time = czm_frameNumber * speed / 1000.0 ;
float w=smoothstep(1.,0.,-uv.y*(scale/10.));
if(w<.1)return 0.;
uv+=time/scale;
uv.y+=time*2./scale;
uv.x+=sin(uv.y+time*.5)/scale;
uv*=scale;
vec2 s=floor(uv),f=fract(uv),p;
float k=3.,d;
p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;
d=length(p);
k=min(d,k);
k=smoothstep(0.,k,sin(f.x+f.y)*0.01);
return k*w;
}
void main(){
vec2 resolution = czm_viewport.zw;
vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
vec3 finalColor=vec3(0);
float c = 0.0;
c+=snow(uv,10.);
c+=snow(uv,8.);
c+=snow(uv,6.);
c+=snow(uv,5.);
finalColor=(vec3(c));
gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);
}
`;const Xf={speed:10};class Zf extends De{constructor(e={}){super(fe(Xf,e));this.type=oe.Snow}set enable(e){this._enable=e,e&&this._map&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set speed(e){this._speed=e,this._delegate&&(this._delegate.uniforms.speed=e)}get speed(){return this._speed}_createPostProcessStage(){this._delegate=new a.PostProcessStage({name:this.id,fragmentShader:Jf,uniforms:{speed:this._speed}}),this._map.viewer.scene.postProcessStages.add(this._delegate)}destroy(){this._delegate&&this._map.viewer.scene.postProcessStages.remove(this._delegate),super.destroy()}}var $f=`
uniform sampler2D colorTexture;
uniform float brightness;
uniform float alpha;
varying vec2 v_textureCoordinates;
void main(void)
{
vec4 rgba = texture2D(colorTexture, v_textureCoordinates);
vec3 target = vec3(0.0);
float a = rgba.a;
if( alpha != 0.0 ) {
a = alpha;
}
gl_FragColor = vec4(mix(target, rgba.rgb, brightness), a);
}
`;const em={intensity:1.5,alpha:0,selected:[]};class tm extends De{constructor(e={}){super(fe(em,e));this.type=oe.Brightness}set enable(e){this._enable=e,e&&this._map&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set intensity(e){this._intensity=e,this._delegate&&(this._delegate.uniforms.brightness=e)}get intensity(){return this._intensity}set alpha(e){this._alpha=e,this._delegate&&(this._delegate.uniforms.alpha=e)}get alpha(){return this._alpha}set selected(e){this._selected=e,this._delegate&&(this._delegate.selected=e)}get selected(){return this._selected}_createPostProcessStage(){this._delegate=new a.PostProcessStage({name:"czm_brightness2",fragmentShader:$f,uniforms:{brightness:.5}}),this._delegate&&(this._delegate.uniforms.brightness=this._intensity,this._delegate.uniforms.alpha=this._alpha,this._map.viewer.scene.postProcessStages.add(this._delegate))}}const im={contrast:128,brightness:-.3,glowOnly:!1,delta:1,sigma:3.8,stepSize:5,selected:[]};class rm extends De{constructor(e){super(fe(im,e));this.type=oe.Bloom}set enable(e){this._enable=e,e&&this._viewer&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set contrast(e){this._contrast=e,this._delegate&&(this._delegate.uniforms.contrast=e)}get contrast(){return this._contrast}set brightness(e){this._brightness=e,this._delegate&&(this._delegate.uniforms.brightness=e)}get brightness(){return this._brightness}set glowOnly(e){this._glowOnly=e,this._delegate&&(this._delegate.uniforms.glowOnly=e)}get glowOnly(){return this._glowOnly}set delta(e){this._delta=e,this._delegate&&(this._delegate.uniforms.delta=e)}get delta(){return this._delta}set sigma(e){this._sigma=e,this._delegate&&(this._delegate.uniforms.sigma=e)}get sigma(){return this._sigma}set stepSize(e){this._stepSize=e,this._delegate&&(this._delegate.uniforms.stepSize=e)}get stepSize(){return this._stepSize}set selected(e){this._selected=e,this._delegate&&(this._delegate.selected=e)}get selected(){return this._selected}_createPostProcessStage(){this._delegate=this._viewer.scene.postProcessStages.bloom,this._delegate.uniforms.contrast=this._contrast,this._delegate.uniforms.brightness=this._brightness,this._delegate.uniforms.glowOnly=this._glowOnly,this._delegate.uniforms.delta=this._delta,this._delegate.uniforms.sigma=this._sigma,this._delegate.uniforms.stepSize=this._stepSize}}const nm={focalDistance:87,delta:1,sigma:3.8,stepSize:2.5,selected:[]};class sm extends De{constructor(e){super(fe(nm,e));this.type=oe.DepthOfField}set enable(e){this._enable=e,e&&this._viewer&&a.PostProcessStageLibrary.isDepthOfFieldSupported(this._viewer.scene)&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set focalDistance(e){this._focalDistance=e,this._delegate&&(this._delegate.uniforms.focalDistance=e)}get focalDistance(){return this._focalDistance}set delta(e){this._delta=e,this._delegate&&(this._delegate.uniforms.delta=e)}get delta(){return this._delta}set sigma(e){this._sigma=e,this._delegate&&(this._delegate.uniforms.sigma=e)}get sigma(){return this._sigma}set stepSize(e){this._stepSize=e,this._delegate&&(this._delegate.uniforms.stepSize=e)}get stepSize(){return this._stepSize}set selected(e){this._selected=e,this._delegate&&(this._delegate.selected=e)}get selected(){return this._selected}_createPostProcessStage(){this._delegate=a.PostProcessStageLibrary.createDepthOfFieldStage(),this._delegate&&(this._delegate.uniforms.focalDistance=this._focalDistance,this._delegate.uniforms.delta=this._delta,this._delegate.uniforms.sigma=this._sigma,this._delegate.uniforms.stepSize=this._stepSize,this._viewer.scene.postProcessStages.add(this._delegate))}}const om={color:"#00ff00",length:.5,selected:[]},am=[Z("color")];class lm extends De{constructor(e){super(fe(om,e));this.type=oe.Silhouette}setOptions(e){const t=re(am,e);super.setOptions(t)}set enable(e){this._enable=e,!!this._map&&(e&&this._viewer&&a.PostProcessStag
uniform sampler2D colorTexture;
uniform float brightness;
uniform float saturation;
uniform float contrast;
varying vec2 v_textureCoordinates;
void main(void)
{
vec4 rgba = texture2D(colorTexture, v_textureCoordinates);
vec3 finalColor = rgba.rgb;
float a = rgba.a;
//\u8C03\u6574\u4EAE\u5EA6
finalColor = finalColor * brightness;
//\u8C03\u6574\u9971\u548C\u5EA6
float luminance = 0.2125 * rgba.r + 0.7154 * rgba.g + 0.0721 * rgba.b;
vec3 saturationTarget = vec3(luminance,luminance,luminance);
finalColor = mix(saturationTarget, finalColor, saturation);
//\u8C03\u6574\u5BF9\u6BD4\u5EA6
vec3 contrastTarget = vec3(0.5,0.5,0.5);
finalColor = mix(contrastTarget, finalColor, contrast);
gl_FragColor = vec4(finalColor, a);
}
`;const pm={brightness:1,saturation:1,contrast:1,selected:[]};class fm extends De{constructor(e={}){super(fe(pm,e));this.type=oe.Brightness}set enable(e){this._enable=e,e&&this._map&&!this._delegate&&this._createPostProcessStage(),this._delegate&&(this._delegate.enabled=e)}get enable(){return this._enable}set brightness(e){this._brightness=e,this._delegate&&(this._delegate.uniforms.brightness=e)}get brightness(){return this._brightness}set saturation(e){this._saturation=e,this._delegate&&(this._delegate.uniforms.saturation=e)}get saturation(){return this._saturation}set contrast(e){this._contrast=e,this._delegate&&(this._delegate.uniforms.contrast=e)}get contrast(){return this._contrast}set selected(e){this._selected=e,this._delegate&&(this._delegate.selected=e)}get selected(){return this._selected}_createPostProcessStage(){this._delegate=new a.PostProcessStage({name:"visualImpact",fragmentShader:dm,uniforms:{brightness:1,saturation:1,contrast:1}}),this._delegate&&(this._delegate.uniforms.brightness=this._brightness,this._delegate.uniforms.saturation=this._saturation,this._delegate.uniforms.contrast=this._contrast,this._delegate.selected=this._selected,this._map.viewer.scene.postProcessStages.add(this._delegate))}}const mm={[oe.Cloud]:Uf,[oe.Fog]:qf,[oe.Rain]:Kf,[oe.Snow]:Zf,[oe.Bloom]:rm,[oe.DepthOfField]:sm,[oe.Brightness]:tm,[oe.Silhouette]:lm,[oe.Night]:cm,[oe.BlackAndWhite]:um,[oe.VisualImpact]:fm};var gm={_extendInit(){this.effects=[]},addEffect(t={}){var r=t,{type:i}=r,e=te(r,["type"]);const n=mm[i];if(!n){console.warn(`\u4E0D\u5B58\u5728type\u4E3A${i}\u7684effect`);return}const s=new n(N({},e));return s.addTo(this),this.effects.push(s),s},updateEffect(r={}){var n=r,{id:i,show:e}=n,t=te(n,["id","show"]);if(!i)return;const s=this.getEffect(i);!s||(H(t)&&s.setOptions(t),H(e)&&(s.enable=e))},effectOptions:{},setEffectOptions(i){this.effectOptions=ie(this.effectOptions,i),Object.keys(i).forEach(e=>{const t=this.effectOptions[e],r=e;t.show?this.getEffect(r)?this.updateEffect(N({id:r},t)):this.addEffect(N({id:r,type:r},t)):this.removeEffect(r)})},getEffect(i){if(!!i)return i instanceof De?i:this.effects.find(e=>e.id===i)},removeEffect(i){const e=this.getEffect(i);if(!e)return;const t=this.effects.findIndex(r=>r===e);t!==-1&&(this.effects.splice(t,1),e.state!==de.DESTROYED&&e.destroy())},removeAllEffect(){this.effects.forEach(i=>i.destroy())}};const{BoxGeometry:Ta,Cartesian3:vm,defined:Ue,DeveloperError:Ma,GeometryPipeline:ym,Matrix3:Ea,Matrix4:Xr,Transforms:_m,VertexFormat:Cm,BufferUsage:wm,CubeMap:bm,loadCubeMap:xm,RenderState:Am,VertexArray:Pm,BlendingState:Sm,SceneMode:Da,ShaderProgram:Tm,ShaderSource:Mm}=a,Em=`
uniform samplerCube u_cubeMap;
varying vec3 v_texCoord;
void main()
{
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
}
`,Dm=`
attribute vec3 position;
varying vec3 v_texCoord;
uniform mat3 u_rotateMatrix;
void main()
{
vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
gl_Position = czm_projection * vec4(p, 1.0);
v_texCoord = position.xyz;
}
`;class km extends a.SkyBox{constructor(e={}){super(e);this.offsetAngle=(e==null?void 0:e.offsetAngle)||0}update(e,t){const r=this;if(!this.show||e.mode!==Da.SCENE3D&&e.mode!==Da.MORPHING||!e.passes.render)return;const n=e.context;if(this._sources!==this.sources){this._sources=this.sources;const o=this.sources;if(!Ue(o.positiveX)||!Ue(o.negativeX)||!Ue(o.positiveY)||!Ue(o.negativeY)||!Ue(o.positiveZ)||!Ue(o.negativeZ))throw new Ma("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof o.positiveX!=typeof o.negativeX||typeof o.positiveX!=typeof o.positiveY||typeof o.positiveX!=typeof o.negativeY||typeof o.positiveX!=typeof o.positiveZ||typeof o.positiveX!=typeof o.negativeZ)throw new Ma("this.sources properties must all be the same type.");typeof o.positiveX=="string"?xm(n,this._sources).then(l=>{r._cubeMap=r._cubeMap&&r._cubeMap.destroy(),r._cubeMap=l}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new bm({context:n,source:o}))}const s=this._command;if(s.modelMatrix=_m.eastNorthUpToFixedFrame(e.camera.positionWC),this.offsetAngle!==0&&Xr.multiply(s.modelMatrix,Xr.fromRotationTranslation(Ea.fromRotationZ(this.offsetAngle/180*Math.PI)),s.modelMatrix),!Ue(s.vertexArray)){s.uniformMap={u_cubeMap(){return r._cubeMap},u_rotateMatrix(){return Xr.getMatrix3(s.modelMatrix,new Ea)}};const o=Ta.createGeometry(Ta.fromDimensions({dimensions:new vm(2,2,2),vertexFormat:Cm.POSITION_ONLY})),l=this._attributeLocations=ym.createAttributeLocations(o);s.vertexArray=Pm.fromGeometry({context:n,geometry:o,attributeLocations:l,bufferUsage:wm._DRAW}),s.renderState=Am.fromCache({blending:Sm.ALPHA_BLEND})}if(!Ue(s.shaderProgram)||this._useHdr!==t){const o=new Mm({defines:[t?"HDR":""],sources:[Em]});s.shaderProgram=Tm.fromCache({context:n,vertexShaderSource:Dm,fragmentShaderSource:o,attributeLocations:this._attributeLocations}),this._useHdr=t}if(!!Ue(this._cubeMap))return s}}const We=a.buildModuleUrl,Im=a.defaultValue,Om=a.defined,Rm=a.destroyObject,Bm=a.DeveloperError,ka=a.FeatureDetection,Ia=a.knockout,Lm=a.NavigationHelpButtonViewModel;function lt(i){if(!Om(i))throw new Bm("options.container is required.");const e=document.querySelector(".cesium-viewer-toolbar"),t=new Lm,r=Im(i.instructionsInitiallyVisible,!1);t.showInstructions=r,t._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";const n=document.createElement("span");n.className="cesium-navigationHelpButton-wrapper",e.appendChild(n);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",s.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),n.appendChild(s);const o=document.createElement("div");o.className="cesium-navigation-help",o.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),n.appendChild(o);const l=document.createElement("button");l.type="button",l.className="cesium-navigation-button cesium-navigation-button-left",l.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const c=document.createElement("img");c.src=We("Widgets/Images/NavigationHelp/Mouse.svg"),c.className="cesium-navigation-button-icon",c.style.width="25px",c.style.height="25px",l.appendChild(c),l.appendChild(document.createTextNode("\u9F20\u6807\u64CD\u4F5C"));const h=document.createElement("button");h.type="button",h.className="cesium-navigation-button cesium-navigation-button-right",h.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-b