ino-cesium 0.0.19-beta.1 → 0.0.20
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/assets/css/ino-cesium.css +13 -0
- package/dist/ino-cesium-full.js +1 -1
- package/dist/ino-cesium.d.ts +26 -1
- package/dist/ino-cesium.js +1 -1
- package/package.json +8 -8
package/dist/ino-cesium.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"cesium";export{e as Cesium};var t=Object.freeze({__proto__:null});let i=1;const o=(t,i)=>{i||(i={token:""}),i.token&&(e.Ion.defaultAccessToken=i.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const o={...l,...i},n=new e.Viewer(t,o);return n.imageryLayers.remove(n.imageryLayers.get(0)),n._cesiumWidget._creditContainer.style.display="none",n.scene.postProcessStages.fxaa.enabled=!0,n.scene.msaaSamples=8,n.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),n.scene.globe.depthTestAgainstTerrain=!0,n.scene.globe.showGroundAtmosphere=!0,n.scene.globe.enableLighting=!1,n.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),n},n=(t,i)=>{const o=i?1:0;t.scene.skyBox.show=i,t.scene.skyAtmosphere.show=i,t.scene.globe.dynamicAtmosphereLighting=i,t.scene.globe.dynamicAtmosphereLightingFromSun=i,t.scene.globe.translucency.backFaceAlpha=o,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${o})`),t.scene.globe.showGroundAtmosphere=i,i?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${o})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${o})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${o})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${o})`)}}}))},r=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},a=e=>{i=e},s=()=>i,l={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},c=t=>{let i=0;for(let o=0;o<t.length;o++){const n=t[o],r=t[(o+1)%t.length];i+=e.Cartesian3.cross(n,r,new e.Cartesian3).z}return i>0?t.reverse():t},d=t=>{let i=0;for(let o=0;o<t.length;o++){const n=t[o],r=t[(o+1)%t.length];i+=e.Cartesian3.cross(n,r,new e.Cartesian3).z}return i<0?t.reverse():t},p=e=>e.map(e=>h(e)),h=t=>{const i=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(i.longitude),latitude:e.Math.toDegrees(i.latitude),height:i.height}},u=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),m=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),g=e=>{const t=e[0],i=e[e.length-1];return t.x===i.x&&t.y===i.y&&t.z===i.z?e:[...e,e[0]]},f=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},v=e=>{const t=[];return e.forEach((i,o)=>{0!==o&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[o-1].longitude,e[o-1].latitude],[i.longitude,i.latitude]]},properties:{height:i.height}})}),{type:"FeatureCollection",features:t}},y=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},C=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),w=t=>{const{lng:i,lat:o,height:n,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(i,o,n||1e4)})},b=t=>{const{lng:i,lat:o,height:n,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(i,o,n||1e4)})},P=e=>{const{position:t,viewer:i}=e;i.scene.camera.flyTo({destination:t})};function _(t){const i=t.camera.heading,o=t.camera.pitch,n=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:i,pitch:o,roll:n}}}function x(e,t){e&&t.scene.camera.flyTo({...e})}function M(e,t){const i=t.dataSources.getByName(e);i.length>0&&t.flyTo(i[0])}function D(e,t){e&&t.flyTo(e)}function E(e,t){t.flyTo(e)}function A(t,i){const o=new e.Cartesian3(t[0],t[1],t[2]),n=new e.BoundingSphere(o,t[3]);i.camera.flyToBoundingSphere(n,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const S=(t,i,o,n,r)=>{if(o<=t||n<=i)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const a={destination:e.Rectangle.fromDegrees(t,i,o,n),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};r.camera.flyTo(a)},I=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function T(t){const i=t.scene.canvas,o=i.clientWidth/2,n=i.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(o,n))}const z=t=>{let i=!1;let o;const n=t.camera;let r=n.pitch,a=0,s=!1;function l(){if(!i||!o)return;let e=n.heading;s?e+=.005:e-=.005,t.camera.setView({destination:o,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(a),requestAnimationFrame(l)}return{start:(c,d)=>{o=c||T(t),r=n.pitch,s=!!d,a=e.Cartesian3.distance(n.position,o),i=!0,l(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{i=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},F=e=>{let t=!1;let i=!1;function o(){if(!t)return;let n=e.camera.heading;i?n+=.001:n-=.001,e.camera.setView({orientation:{heading:n,pitch:e.camera.pitch}}),requestAnimationFrame(o)}t=!0;return{start:e=>{t=!0,i=!!e,o()},end:()=>{t=!1}}};function R(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const O=(t,i)=>{console.log("sdfjdsklf"),i||(i=1e5);let o=!1;t.camera.moveEnd.addEventListener(function(){if(o)return;const n=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const a=n.heading,s=n.roll;if(r>i){o=!0;const i=t.camera.computeViewRectangle();if(!i)return void(o=!0);const n={longitude:0,latitude:0},l=e.Rectangle.center(i);n.longitude=e.Math.toDegrees(l.longitude),n.latitude=e.Math.toDegrees(l.latitude),t.camera.flyTo({destination:m(new e.Cartographic(n.longitude,n.latitude,r)),orientation:{heading:a,pitch:-1.5,roll:s},duration:1,complete:()=>{}})}else o=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},L=(t,i)=>{const o=t.scene,n=new e.ScreenSpaceEventHandler(o.canvas);n.setInputAction(e=>{if(i.LEFT_POSITION){const n=o.pickPosition(e.position);k(e.position,n,i.LEFT_POSITION,t)}i.PICK_FEATURE&&B(t,e.position,i.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),n.setInputAction(e=>{if(i.MOVE_POSITION){const n=o.pickPosition(e.endPosition);k(e.endPosition,n,i.MOVE_POSITION,t)}i.MOVE_PICK_FEATURE&&B(t,e.endPosition,i.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},B=(t,i,o)=>{const n=t.scene.pickPosition(i),r=t.scene.pick(i),a={};if(r){if(t._element.style.cursor="pointer",r instanceof e.Cesium3DTileFeature){r.getPropertyIds().forEach(e=>{a[e]=r.getProperty(e)})}else r.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(a,{name:"sdfjldks"})):r.id instanceof e.Entity?t._element.style.cursor="pointer":r.primitive&&Object.assign(a,r.primitive.properties);o({position:n,...r},a)}else o(void 0,{})},k=(t,i,o,n)=>{i||(i=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(i);o({windowPosition:t,position:i,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:_(n)})},N=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,G=()=>window.INO_CESIUM_BASE_URL;class U{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const i=document.createElement("DIV");i.className="twipsy-inner",t.appendChild(i),this._div=t,this._title=i,this._message="";const o=e._element.getElementsByClassName("cesium-widget")[0];if(!o)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");o.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return U.tooltip||(U.tooltip=new U(e)),U.tooltip}destroy(){U.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),U.tooltip=null)}}class V{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,i){this.viewer=e,i&&(this.offset=i),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const o=e._element.getElementsByClassName("cesium-widget")[0];if(!o)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");o.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPupup(e,t,i){return V.popup||(V.popup=new V(e,t,i)),V.popup}destroy(){V.popup&&(this._div&&this._div.parentNode.removeChild(this._div),V.popup=null)}}const $=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=H(t),n=H(i);o.push({type:"Feature",geometry:{type:"Point",coordinates:[e,n]},properties:{}})}return{type:"FeatureCollection",features:o}};function H(e){const[t,i]=e;return Math.random()*(i-t)+t}function W(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const q=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=Math.floor(H([3,10])),n=[];for(let o=0;o<e;o++){const e=H(t),o=H(i);n.push([e,o])}o.push({type:"Feature",geometry:{type:"LineString",coordinates:n},properties:{}})}return{type:"FeatureCollection",features:o}},j=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=Z(t,i);o.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:o}};function Z(e,t){const i=Math.floor(H([3,10])),o=H(e),n=H(t),r=H([1,5]),a=[];for(let e=0;e<i;e++){const t=e/i*2*Math.PI,s=H([.8*r,r]),l=o+s*Math.cos(t),c=n+s*Math.sin(t);a.push([l,c])}return a.push(a[0]),a}const Y=(t,i)=>{let o=!1;const n=new e.Viewer(t,{...l,scene3DOnly:!1});n.scene.mode=2;const r=n.scene.screenSpaceCameraController;r.enableRotate=!1,r.enableTranslate=!1,r.enableZoom=!1,r.enableTilt=!1,r.enableLook=!1,i.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(a(),""),!0)}});const a=function(){o||n.camera.flyTo({destination:i.camera.position,orientation:{heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},duration:0})};return{viewer:n,open:()=>{o=!1},close:()=>{o=!0}}};var J=6371008.8,K={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*J,kilometers:6371.0088,kilometres:6371.0088,meters:J,metres:J,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:J/1852,radians:1,yards:6967335.223679999};function X(e,t,i={}){const o={type:"Feature"};return(0===i.id||i.id)&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.properties=t||{},o.geometry=e,o}function Q(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!re(e[0])||!re(e[1]))throw new Error("coordinates must contain numbers");return X({type:"Point",coordinates:e},t,i)}function ee(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return X({type:"Polygon",coordinates:e},t,i)}function te(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return X({type:"LineString",coordinates:e},t,i)}function ie(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function oe(e){return 180*(e%(2*Math.PI))/Math.PI}function ne(e){return e%360*Math.PI/180}function re(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function ae(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function se(e){return"Feature"===e.type?e.geometry:e}function le(e,t,i={}){if(!0===i.final)return function(e,t){let i=le(t,e);return i=(i+180)%360,i}(e,t);const o=ae(e),n=ae(t),r=ne(o[0]),a=ne(n[0]),s=ne(o[1]),l=ne(n[1]),c=Math.sin(a-r)*Math.cos(l),d=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-r);return oe(Math.atan2(c,d))}function ce(e,t,i,o={}){const n=ae(e),r=ne(n[0]),a=ne(n[1]),s=ne(i),l=function(e,t="kilometers"){const i=K[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,o.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return Q([oe(r+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),oe(c)],o.properties)}function de(e,t,i={}){var o=ae(e),n=ae(t),r=ne(n[1]-o[1]),a=ne(n[0]-o[0]),s=ne(o[1]),l=ne(n[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return function(e,t="kilometers"){const i=K[t];if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function pe(e,t,i){if(null!==e)for(var o,n,r,a,s,l,c,d,p=0,h=0,u=e.type,m="FeatureCollection"===u,g="Feature"===u,f=m?e.features.length:1,v=0;v<f;v++){s=(d=!!(c=m?e.features[v].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var C=0,w=0;if(null!==(a=d?c.geometries[y]:c)){l=a.coordinates;var b=a.type;switch(p=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===t(l,h,v,C,w))return!1;h++,C++;break;case"LineString":case"MultiPoint":for(o=0;o<l.length;o++){if(!1===t(l[o],h,v,C,w))return!1;h++,"MultiPoint"===b&&C++}"LineString"===b&&C++;break;case"Polygon":case"MultiLineString":for(o=0;o<l.length;o++){for(n=0;n<l[o].length-p;n++){if(!1===t(l[o][n],h,v,C,w))return!1;h++}"MultiLineString"===b&&C++,"Polygon"===b&&w++}"Polygon"===b&&C++;break;case"MultiPolygon":for(o=0;o<l.length;o++){for(w=0,n=0;n<l[o].length;n++){for(r=0;r<l[o][n].length-p;r++){if(!1===t(l[o][n][r],h,v,C,w))return!1;h++}w++}C++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(!1===pe(a.geometries[o],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function he(e,t){var i,o,n,r,a,s,l,c,d,p,h=0,u="FeatureCollection"===e.type,m="Feature"===e.type,g=u?e.features.length:1;for(i=0;i<g;i++){for(s=u?e.features[i].geometry:m?e.geometry:e,c=u?e.features[i].properties:m?e.properties:{},d=u?e.features[i].bbox:m?e.bbox:void 0,p=u?e.features[i].id:m?e.id:void 0,a=(l=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,n=0;n<a;n++)if(null!==(r=l?s.geometries[n]:s))switch(r.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(r,h,c,d,p))return!1;break;case"GeometryCollection":for(o=0;o<r.geometries.length;o++)if(!1===t(r.geometries[o],h,c,d,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,h,c,d,p))return!1;h++}}function ue(e){return function(e,t,i){var o=i;return he(e,function(e,n,r,a,s){o=0===n&&void 0===i?e:t(o,e,n,r,a,s)}),o}(e,(e,t)=>e+function(e){let t,i=0;switch(e.type){case"Polygon":return me(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)i+=me(e.coordinates[t]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}function me(e){let t=0;if(e&&e.length>0){t+=Math.abs(ve(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(ve(e[i]))}return t}var ge=20294876564838.72,fe=Math.PI/180;function ve(e){const t=e.length-1;if(t<=2)return 0;let i=0,o=0;for(;o<t;){const n=e[o],r=e[o+1===t?0:o+1],a=e[o+2>=t?(o+2)%t:o+2],s=n[0]*fe,l=r[1]*fe;i+=(a[0]*fe-s)*Math.sin(l),o++}return i*ge}function ye(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return pe(e,e=>{i[0]>e[0]&&(i[0]=e[0]),i[1]>e[1]&&(i[1]=e[1]),i[2]<e[0]&&(i[2]=e[0]),i[3]<e[1]&&(i[3]=e[1])}),i}const Ce=11102230246251565e-32,we=134217729,be=(3+8*Ce)*Ce;function Pe(e,t,i,o,n){let r,a,s,l,c=t[0],d=o[0],p=0,h=0;d>c==d>-c?(r=c,c=t[++p]):(r=d,d=o[++h]);let u=0;if(p<e&&h<i)for(d>c==d>-c?(a=c+r,s=r-(a-c),c=t[++p]):(a=d+r,s=r-(a-d),d=o[++h]),r=a,0!==s&&(n[u++]=s);p<e&&h<i;)d>c==d>-c?(a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p]):(a=r+d,l=a-r,s=r-(a-l)+(d-l),d=o[++h]),r=a,0!==s&&(n[u++]=s);for(;p<e;)a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p],r=a,0!==s&&(n[u++]=s);for(;h<i;)a=r+d,l=a-r,s=r-(a-l)+(d-l),d=o[++h],r=a,0!==s&&(n[u++]=s);return 0===r&&0!==u||(n[u++]=r),u}function _e(e){return new Float64Array(e)}const xe=_e(4),Me=_e(8),De=_e(12),Ee=_e(16),Ae=_e(4);function Se(e,t,i,o,n,r){const a=(t-r)*(i-n),s=(e-n)*(o-r),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,o,n,r,a){let s,l,c,d,p,h,u,m,g,f,v,y,C,w,b,P,_,x;const M=e-n,D=i-n,E=t-r,A=o-r;w=M*A,h=we*M,u=h-(h-M),m=M-u,h=we*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=E*D,h=we*E,u=h-(h-E),m=E-u,h=we*D,g=h-(h-D),f=D-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,xe[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,xe[1]=C-(v+p)+(p-P),x=y+v,p=x-y,xe[2]=y-(x-p)+(v-p),xe[3]=x;let S=function(e,t){let i=t[0];for(let o=1;o<e;o++)i+=t[o];return i}(4,xe),I=22204460492503146e-32*a;if(S>=I||-S>=I)return S;if(p=e-M,s=e-(M+p)+(p-n),p=i-D,c=i-(D+p)+(p-n),p=t-E,l=t-(E+p)+(p-r),p=o-A,d=o-(A+p)+(p-r),0===s&&0===l&&0===c&&0===d)return S;if(I=11093356479670487e-47*a+be*Math.abs(S),S+=M*d+A*s-(E*c+D*l),S>=I||-S>=I)return S;w=s*A,h=we*s,u=h-(h-s),m=s-u,h=we*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=l*D,h=we*l,u=h-(h-l),m=l-u,h=we*D,g=h-(h-D),f=D-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ae[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ae[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ae[2]=y-(x-p)+(v-p),Ae[3]=x;const T=Pe(4,xe,4,Ae,Me);w=M*d,h=we*M,u=h-(h-M),m=M-u,h=we*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=E*c,h=we*E,u=h-(h-E),m=E-u,h=we*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ae[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ae[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ae[2]=y-(x-p)+(v-p),Ae[3]=x;const z=Pe(T,Me,4,Ae,De);w=s*d,h=we*s,u=h-(h-s),m=s-u,h=we*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=l*c,h=we*l,u=h-(h-l),m=l-u,h=we*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ae[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ae[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ae[2]=y-(x-p)+(v-p),Ae[3]=x;const F=Pe(z,De,4,Ae,Ee);return Ee[F-1]}(e,t,i,o,n,r,c)}function Ie(e,t){var i,o,n,r,a,s,l,c,d,p=0,h=e[0],u=e[1],m=t.length;for(i=0;i<m;i++){o=0;var g=t[i],f=g.length-1;if((c=g[0])[0]!==g[f][0]&&c[1]!==g[f][1])throw new Error("First and last coordinates in a ring must be the same");for(r=c[0]-h,a=c[1]-u;o<f;o++){if(s=(d=g[o+1])[0]-h,l=d[1]-u,0===a&&0===l){if(s<=0&&r>=0||r<=0&&s>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(n=Se(r,s,a,l,0,0)))return 0;(n>0&&l>0&&a<=0||n<0&&l<=0&&a>0)&&p++}c=d,a=l,r=s}}return p%2!=0}function Te(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const o=ae(e),n=se(t),r=n.type,a=t.bbox;let s=n.coordinates;if(a&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(o,a))return!1;"Polygon"===r&&(s=[s]);let l=!1;for(var c=0;c<s.length;++c){const e=Ie(o,s[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}function ze(e,t,i={}){const o=ae(e),n=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(t);for(let e=0;e<n.length-1;e++){let t=!1;if(i.ignoreEndVertices&&(0===e&&(t="start"),e===n.length-2&&(t="end"),0===e&&e+1===n.length-1&&(t="both")),Fe(n[e],n[e+1],o,t,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function Fe(e,t,i,o,n){const r=i[0],a=i[1],s=e[0],l=e[1],c=t[0],d=t[1],p=c-s,h=d-l,u=(i[0]-s)*h-(i[1]-l)*p;if(null!==n){if(Math.abs(u)>n)return!1}else if(0!==u)return!1;return Math.abs(p)===Math.abs(h)&&0===Math.abs(p)?!o&&(i[0]===e[0]&&i[1]===e[1]):o?"start"===o?Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<=c:c<=r&&r<s:h>0?l<a&&a<=d:d<=a&&a<l:"end"===o?Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<c:c<r&&r<=s:h>0?l<=a&&a<d:d<a&&a<=l:"both"===o&&(Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<c:c<r&&r<s:h>0?l<a&&a<d:d<a&&a<l):Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<=c:c<=r&&r<=s:h>0?l<=a&&a<=d:d<=a&&a<=l}function Re(e,t){var i=se(e),o=se(t),n=i.type,r=o.type;switch(n){case"Point":switch(r){case"MultiPoint":return function(e,t){var i,o=!1;for(i=0;i<t.coordinates.length;i++)if(Le(t.coordinates[i],e.coordinates)){o=!0;break}return o}(i,o);case"LineString":return ze(i,o,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Te(i,o,{ignoreBoundary:!0});default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"MultiPoint":return function(e,t){for(var i=0;i<e.coordinates.length;i++){for(var o=!1,n=0;n<t.coordinates.length;n++)Le(e.coordinates[i],t.coordinates[n])&&(o=!0);if(!o)return!1}return!0}(i,o);case"LineString":return function(e,t){for(var i=!1,o=0;o<e.coordinates.length;o++){if(!ze(e.coordinates[o],t))return!1;i||(i=ze(e.coordinates[o],t,{ignoreEndVertices:!0}))}return i}(i,o);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,o=!1,n=0;n<e.coordinates.length;n++){if(!(o=Te(e.coordinates[n],t))){i=!1;break}o=Te(e.coordinates[n],t,{ignoreBoundary:!0})}return i&&o}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"LineString":return function(e,t){for(var i=0;i<e.coordinates.length;i++)if(!ze(e.coordinates[i],t))return!1;return!0}(i,o);case"Polygon":case"MultiPolygon":return function(e,t){var i=ye(t),o=ye(e);if(!Oe(i,o))return!1;for(var n=!1,r=0;r<e.coordinates.length;r++){if(!Te(e.coordinates[r],t))return!1;if(n||(n=Te(e.coordinates[r],t,{ignoreBoundary:!0})),!n&&r<e.coordinates.length-1)n=Te(Be(e.coordinates[r],e.coordinates[r+1]),t,{ignoreBoundary:!0})}return n}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Polygon":case"MultiPolygon":return function(e,t){var i=ye(e);if(!Oe(ye(t),i))return!1;for(var o=0;o<e.coordinates[0].length;o++)if(!Te(e.coordinates[0][o],t))return!1;return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}}function Oe(e,t){return!(e[0]>t[0])&&(!(e[2]<t[2])&&(!(e[1]>t[1])&&!(e[3]<t[3])))}function Le(e,t){return e[0]===t[0]&&e[1]===t[1]}function Be(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function ke(e,t={}){let i=0,o=0,n=0;return pe(e,function(e){i+=e[0],o+=e[1],n++},!0),Q([i/n,o/n],t.properties)}function Ne(e){return function(e,t={}){const i=Number(e[0]),o=Number(e[1]),n=Number(e[2]),r=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const a=[i,o];return ee([[a,[n,o],[n,r],[i,r],a]],t.properties,{bbox:e,id:t.id})}(ye(e))}function Ge(e,t,i,o,n={}){const r=n.steps||64,a=Ue(i),s=Ue(o),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(a===s)return te(function(e,t,i={}){const o=i.steps||64,n=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},r=[];for(let n=0;n<o;n++)r.push(ce(e,t,-360*n/o,i).geometry.coordinates);return r.push(r[0]),ee([r],n)}(e,t,n).geometry.coordinates[0],l);const c=a,d=a<s?s:s+360;let p=c;const h=[];let u=0;const m=(d-c)/r;for(;p<=d;)h.push(ce(e,t,p,n).geometry.coordinates),u++,p=c+u*m;return te(h,l)}function Ue(e){let t=e%360;return t<0&&(t+=360),t}function Ve(e,t){const i=[];return function(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}(e,function(e){let o=!1;if("Point"===e.geometry.type)he(t,function(t){Te(e,t)&&(o=!0)}),o&&i.push(e);else{if("MultiPoint"!==e.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var n=[];he(t,function(t){pe(e,function(e){Te(e,t)&&(o=!0,n.push(e))})}),o&&i.push(function(e,t,i={}){return X({type:"MultiPoint",coordinates:e},t,i)}(n,e.properties))}}),ie(i)}const $e=(t,i)=>{const o=e.Cartographic.fromCartesian(t),n=e.Cartographic.fromCartesian(i),r=new e.EllipsoidGeodesic;r.setEndPoints(o,n);let a=r.surfaceDistance;return a=Math.sqrt(a**2+(n.height-o.height)**2),a};function He(e){let t=0;return e.forEach((i,o)=>{if(o===e.length-1)return;const n=$e(i,e[o+1]);t+=n}),t}function We(t,i,o){const{EllipsoidGeodesic:n,Ellipsoid:r}=e;return new n((o=o||r.WGS84).cartesianToCartographic(t),o.cartesianToCartographic(i)).surfaceDistance}function qe(e){let t=0;return e.forEach((i,o)=>{if(o===e.length-1)return;const n=We(i,e[o+1]);t+=n}),t}const je=t=>{if(t.length<4)return e.BoundingSphere.fromPoints(t).center;const i=ee([t.map(e=>[e.x,e.y])]),o=e.BoundingSphere.fromPoints(t).center,n=ke(i);return new e.Cartesian3(n.geometry.coordinates[0],n.geometry.coordinates[1],o.z)};function Ze(t){let i=0;const{CoplanarPolygonGeometry:o,VertexFormat:n,defined:r,Cartesian3:a}=e,s=o.createGeometry(o.fromPositions({positions:t,vertexFormat:n.POSITION_ONLY}));if(r(s)){const e=s.indices,t=s.attributes.position.values;for(let o=0;o<e.length;o+=3){const n=e[o],r=e[o+1],s=e[o+2];i+=Ye(a.unpack(t,3*n,{}),a.unpack(t,3*r,{}),a.unpack(t,3*s,{}))}}return i}const Ye=(t,i,o)=>{const{Cartesian3:n}=e,r=n.subtract(t,i,{}),a=n.subtract(o,i,{}),s=n.cross(r,a,r);return.5*n.magnitude(s)},Je=async(t,i)=>{const o=i.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,o)},Ke=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),Xe=(t,i,o,n)=>{const r=[],a=e.Cartographic.fromCartesian(t),s=e.Cartographic.fromCartesian(i),l=180*a.longitude/Math.PI,c=180*a.latitude/Math.PI,d=180*s.longitude/Math.PI,p=180*s.latitude/Math.PI,h=Math.sqrt((l-d)*(l-d)+(c-p)*(c-p))*o,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(i),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),f=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(u,u),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(u,m))return r;const v=e.Cartesian3.angleBetween(u,m);r.push(t);for(let t=1;t<n-1;t++){const i=1*t/(n-1),o=1-i,a=Math.sin(o*v)/Math.sin(v),s=Math.sin(i*v)/Math.sin(v),l=e.Cartesian3.multiplyByScalar(u,a,new e.Cartesian3),c=e.Cartesian3.multiplyByScalar(m,s,new e.Cartesian3);let d=e.Cartesian3.add(l,c,new e.Cartesian3);const p=i*Math.PI,y=g*o+f*i+Math.sin(p)*h;d=e.Cartesian3.multiplyByScalar(d,y,d),r.push(d)}return r.push(i),r},Qe=e=>{const t=e.positionCartographic.height,i=-40467.74;return Math.round(i+80955.31/(1+(t/91610.74)**7096758e-11))},et=e=>e,tt=(t,i)=>{const o=[];let n=0,r=0,a=0;const s=[];for(let i=0;i<t.length-1;++i)n+=e.Cartesian3.distance(t[i],t[i+1]);for(let i=0;i<t.length;i++)0===i?r=0:(a+=e.Cartesian3.distance(t[i-1],t[i]),r=a/n),o.push(r);const l=new e.LinearSpline({times:o,points:t});for(let e=0;e<=i;e++){const t=l.evaluate(e/i);s.push(t)}return s},it=t=>{const i=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,i),i};class ot{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class nt{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const rt=e.BoxGeometry,at=e.Cartesian3,st=e.defaultValue,lt=e.defined,ct=e.destroyObject,dt=e.DeveloperError,pt=e.GeometryPipeline,ht=e.Matrix3,ut=e.Matrix4,mt=e.Transforms,gt=e.VertexFormat,ft=e.BufferUsage,vt=e.CubeMap,yt=e.DrawCommand,Ct=e.loadCubeMap,wt=e.RenderState,bt=e.VertexArray,Pt=e.BlendingState,_t=e.SceneMode,xt=e.ShaderProgram,Mt=e.ShaderSource,Dt=new ht;class Et{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=st(t.show,!0),this._command=new yt({modelMatrix:ut.clone(ut.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const i=this;if(!this.show)return;if(e.mode!==_t.SCENE3D&&e.mode!==_t.MORPHING)return;if(!e.passes.render)return;const o=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(lt(e.positiveX)&<(e.negativeX)&<(e.positiveY)&<(e.negativeY)&<(e.positiveZ)&<(e.negativeZ)))throw new dt("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new dt("this.sources properties must all be the same type.");"string"==typeof e.positiveX?Ct(o,this._sources).then(e=>{i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new vt({context:o,source:e}))}const n=this._command;if(n.modelMatrix=mt.eastNorthUpToFixedFrame(e.camera._positionWC),!lt(n.vertexArray)){n.uniformMap={u_cubeMap:()=>i._cubeMap,u_rotateMatrix:()=>ut.getRotation(n.modelMatrix,Dt)};const e=rt.createGeometry(rt.fromDimensions({dimensions:new at(2,2,2),vertexFormat:gt.POSITION_ONLY})),t=this._attributeLocations=pt.createAttributeLocations(e);n.vertexArray=bt.fromGeometry({context:o,geometry:e,attributeLocations:t,bufferUsage:ft._DRAW}),n.renderState=wt.fromCache({blending:Pt.ALPHA_BLEND})}if(!lt(n.shaderProgram)||this._useHdr!==t){const e=new Mt({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});n.shaderProgram=xt.fromCache({context:o,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return lt(this._cubeMap)?n:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),ct(this)}}const At=t=>{const{viewer:i,sources:o}=t;return i.scene.skyBox=new e.SkyBox({sources:o}),i.scene.skyBox},St=t=>{let{viewer:i,sources:o}=t;const n=t.height?t.height:225705,r=i.scene.skyBox,a=i.scene.skyAtmosphere.show;o||(o={positiveX:`${G()}/assets/ground-skybox/px.jpg`,negativeX:`${G()}/assets/ground-skybox/nx.jpg`,positiveY:`${G()}/assets/ground-skybox/py.jpg`,negativeY:`${G()}/assets/ground-skybox/ny.jpg`,positiveZ:`${G()}/assets/ground-skybox/pz.jpg`,negativeZ:`${G()}/assets/ground-skybox/nz.jpg`});const s=new Et({sources:o});i.scene.postRender.addEventListener(()=>{const t=i.camera.position;e.Cartographic.fromCartesian(t).height<n?(i.scene.skyBox=s,i.scene.skyAtmosphere.show=!1):(i.scene.skyBox=r,i.scene.skyAtmosphere.show=a)})},It=t=>{const i=[];let o,n;t.clock.shouldAnimate=!0;const r={},a=(e,i)=>{if(s(),e.entity.cylinder){const i=e.entity.cylinder;i.roamId=e.id,e.entity.cylinder=void 0,n=t.entities.add({position:e.property,cylinder:i})}t.trackedEntity=e.entity,i&&(o=e)},s=()=>{if(n){t.entities.remove(n);const e=i.find(e=>e.id===n.cylinder.roamId);e&&(e.entity.cylinder=n.cylinder),n=void 0}},l=()=>{t.trackedEntity=void 0,o=void 0,s()},c=e=>{t.trackedEntity?.id===e.entity.id&&l(),t.entities.remove(e.entity);const o=i.findIndex(t=>t.id===e.id);o>-1&&i.splice(o,1)},d=(e,t)=>{const i=e.property.getValue(t);if(i&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:i})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?p(e):l()),e.flyParams.hpr){const o=r[e.id].find(e=>e.time>t.secondsOfDay);o&&u(e,o,i)}},p=i=>{const{property:o,startTime:n,stopTime:r}=h(i);i.stopTime=r,i.startTime=n,i.property=o,i.flyParams.hpr||(i.entity.orientation=new e.VelocityOrientationProperty(o)),i.entity.position=o,i.status="START",t.clock.currentTime=n,t.clock.multiplier=1,m.reStart&&m.reStart(i)},h=t=>{const i=[],{positions:o,flyParams:n}=t,a=new e.SampledPositionProperty;let s=0;const l=e.JulianDate.now();let c=l.clone();return o.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let i=0;if(n.speed){i=e.Cartesian3.distance(t,o[r-1])/(1e3*n.speed/3600)}n.times&&(i=(n.times[r]-n.times[r-1])/1e3),s+=i,d=e.JulianDate.addSeconds(l,s,new e.JulianDate)}else d=l;c=d,a.addSample(d,t),n.hpr&&i.push({time:d.secondsOfDay,heading:n.hpr[r].heading,pitch:n.hpr[r].pitch,roll:n.hpr[r].roll})}),r[t.id]=i,{property:a,startTime:l,stopTime:c}},u=(t,i,o)=>{if(!o)return;const{heading:n,pitch:r,roll:a}=i,s=new e.HeadingPitchRoll(n,r,a);t.entity.orientation=Transforms.headingPitchRollQuaternion(o,s)};t.scene.preRender.addEventListener((n,r)=>{if(i.forEach(e=>{d(e,r)}),!o)return;const a=o.entity.computeModelMatrix(t.clock.currentTime);a&&t.camera.lookAtTransform(a,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:o=>{const{entity:n}=o;o.id=N(),t.entities.add(n);const{property:r,startTime:a,stopTime:s}=h(o);o.flyParams.hpr||(n.orientation=new e.VelocityOrientationProperty(r)),n.position=r;const l={...o,startTime:a,stopTime:s,property:r,status:"START"};return t.clock.currentTime=a,t.clock.multiplier=1,i.push(l),l.status="START",m.start&&m.start(l),l},tracked:a,stopTracked:l,remove:c,frameRoam:d,trackedByEntityId:(e,t)=>{const o=i.find(t=>t.entity.id===e);o&&a(o,t)},removeAll:()=>{i.forEach(e=>{c(e)}),i.length=0},Event:m,lockCameraView:e=>{o=e},updateRoamAttitude:(t,i)=>{"UP"!==i&&"DOWN"!==i||(t.entity.orientation=void 0),"front"!==i&&"back"!==i||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Tt=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Tt||{}),zt=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(zt||{});let Ft=100,Rt="",Ot="0";const Lt=t=>{const{viewer:i}=t,o=document.createElement("div");o.className="bottom-status-bar";const n=document.createElement("div");n.className="scale-bar",n.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",n.appendChild(r),o.appendChild(n);const a=document.createElement("div");a.id="bottom-status-bar-camera",t.clickCopy&&(a.style.pointerEvents="auto",a.style.cursor="pointer"),o.appendChild(a),a.style.display="flex";const s=document.createElement("div"),l=document.createElement("div"),c=i._element.getElementsByClassName("cesium-widget")[0];if(!c)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");c.appendChild(o),L(i,{MOVE_POSITION(e){a.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&_(i),a.appendChild(l),a.appendChild(s)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),p=0;const h=()=>{requestAnimationFrame(()=>{if(p+=1,p>=30){const e=Date.now(),t=e-d,i=Math.round(1e3/(t/p));d=e,p=0,s.innerHTML=`${i} FPS`}t.hpr?l.innerHTML=`\n 方位角:${e.Math.toDegrees(i.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(i.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(i.camera.roll).toFixed(1)}° \n `:l.innerHTML="",l.innerHTML+=`\n 视高:${i.camera.positionCartographic.height.toFixed(0)}m \n `;const o=Bt(i);r.innerHTML=`${o.distanceLabel}`,h()})};h()},Bt=t=>{const i=t.camera.positionCartographic.height.toFixed(0);if(i===Ot)return{barWidth:Ft,distanceLabel:Rt};Ot=i;const o=new e.EllipsoidGeodesic,n=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],r=t.scene,a=r.canvas.clientWidth,s=r.canvas.clientHeight,l=r.camera.getPickRay(new e.Cartesian2(a/2|0,s-1)),c=r.camera.getPickRay(new e.Cartesian2(1+a/2|0,s-1)),d=r.globe,p=d.pick(l,r),h=d.pick(c,r);if(!e.defined(p)||!e.defined(h))return{barWidth:Ft,distanceLabel:Rt};const u=d.ellipsoid.cartesianToCartographic(p),m=d.ellipsoid.cartesianToCartographic(h);o.setEndPoints(u,m);const g=o.surfaceDistance;let f;for(let t=n.length-1;!e.defined(f)&&t>=0;--t)n[t]/g<100&&(f=n[t]);if(e.defined(f)){const e=f>=1e3?`${(f/1e3).toString()} km`:`${f.toString()} m`;Ft=f/g|0,Rt=e}else Ft=0,Rt="1 m";return{barWidth:Ft,distanceLabel:Rt}},kt=t=>new Promise(i=>{const{viewer:o,center:n}=t;let r=n.lng,a=1,s=null;const l=t=>{null===s&&(s=t);r-=(t-s)/2e4*2,r<-180&&(r=180,a+=1),2===a&&r>n.lng?o.camera.flyTo({destination:e.Cartesian3.fromDegrees(n.lng,n.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{o.camera.flyTo({destination:e.Cartesian3.fromDegrees(n.lng,n.lat,n.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{i(!0)}})}}):(o.camera.setView({destination:e.Cartesian3.fromDegrees(r,n.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(l))};requestAnimationFrame(l)}),Nt=(t,i,o)=>{const n=new Float64Array(24);for(let e=0;e<8;e++)n[3*e]=t[e].x,n[3*e+1]=t[e].y,n[3*e+2]=t[e].z;const r=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),a={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:n})},s=new e.Geometry({indices:r,attributes:a,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(n)});return new e.GeometryInstance({geometry:s,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${o}`})},Gt=(t,i,o)=>{const[n,r,a,s,l,c,d,p]=t,h=[n,r,r,a,a,s,s,n,l,c,c,d,d,p,p,l,n,l,l,c,c,r,r,n,s,p,p,d,d,a,a,s,n,s,s,p,p,l,l,n,r,c,c,d,d,a,a,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${o}`})},Ut=(t,i)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,t.height)],Vt=(t,i,o,n,r,a)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(t,t,a),e.Cartesian3.fromDegrees(i,i,a),e.Cartesian3.fromDegrees(o,o,a),e.Cartesian3.fromDegrees(n,n,a)],$t=3e3*Math.PI/180,Ht=Math.PI,Wt=6378245,qt=.006693421622965943,jt=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),Zt=(e,t)=>{let i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*Ht)+20*Math.sin(2*e*Ht))/3,i+=2*(20*Math.sin(t*Ht)+40*Math.sin(t/3*Ht))/3,i+=2*(160*Math.sin(t/12*Ht)+320*Math.sin(t*Ht/30))/3,i},Yt=(e,t)=>{let i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*Ht)+20*Math.sin(2*e*Ht))/3,i+=2*(20*Math.sin(e*Ht)+40*Math.sin(e/3*Ht))/3,i+=2*(150*Math.sin(e/12*Ht)+300*Math.sin(e/30*Ht))/3,i},Jt=(e,t)=>{if(jt(e,t))return[e,t];let i=Zt(e-105,t-35),o=Yt(e-105,t-35);const n=t/180*Ht;let r=Math.sin(n);r=1-qt*r*r;const a=Math.sqrt(r);i=180*i/(Wt*(1-qt)/(r*a)*Ht),o=180*o/(Wt/a*Math.cos(n)*Ht);return[e+o,t+i]},Kt=(e,t)=>{if(jt(e,t))return[e,t];let i=Zt(e-105,t-35),o=Yt(e-105,t-35);const n=t/180*Ht;let r=Math.sin(n);r=1-qt*r*r;const a=Math.sqrt(r);i=180*i/(Wt*(1-qt)/(r*a)*Ht),o=180*o/(Wt/a*Math.cos(n)*Ht);return[2*e-(e+o),2*t-(t+i)]},Xt=(e,t)=>{const i=e,o=t,n=Math.sqrt(i*i+o*o)+2e-5*Math.sin(o*$t),r=Math.atan2(o,i)+3e-6*Math.cos(i*$t);return[n*Math.cos(r)+.0065,n*Math.sin(r)+.006]},Qt=(e,t)=>{const i=e-.0065,o=t-.006,n=Math.sqrt(i*i+o*o)-2e-5*Math.sin(o*$t),r=Math.atan2(o,i)-3e-6*Math.cos(i*$t);return[n*Math.cos(r),n*Math.sin(r)]};class ei{static wgs84ToGcj02(e){const[t,i]=Jt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToWgs84(e){const[t,i]=Kt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToBd09(e){const[t,i]=Xt(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToGcj02(e){const[t,i]=Qt(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToWgs84(e){const[t,i]=((e,t)=>{const[i,o]=Qt(e,t);return Kt(i,o)})(e.lng,e.lat);return{lng:t,lat:i}}static wgs84ToBd09(e){const[t,i]=((e,t)=>{const[i,o]=Jt(e,t);return Xt(i,o)})(e.lng,e.lat);return{lng:t,lat:i}}}const ti=t=>{const{viewer:i,token:o}=t,n=t.vec?"vec":"img",r=[],a=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/${n}_w/wmts?tk=${o}`,layer:n,style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));if(r.push(a),console.log(a),t.label){const t=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/cia_w/wmts?tk=${o}`,layer:"cia",style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));r.push(t)}return{layers:r,remove:()=>{r.forEach(e=>{i.imageryLayers.remove(e)})},setOpacity:e=>{r.forEach(t=>{t.alpha=e})}}};function ii(t,i){i||(i={}),console.log(i.filterColor);const o=t.imageryLayers.get(0);if(!o)return;o.brightness=i.brightness??.6,o.contrast=i.contrast??1.8,o.gamma=i.gamma??.3,o.hue=i.hue??1,o.saturation=i.saturation||0;const n=t.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<n.length;t++){const o="color = czm_saturation(color, textureSaturation);\n#endif\n";let r="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor||(r+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n "),i.filterColor||(i.filterColor=e.Color.fromCssColorString("rgba(100,138,230,0.5)")),r+=`\n color.r = color.r * ${i.filterColor.red.toFixed(2)};\n color.g = color.g * ${i.filterColor.green.toFixed(2)};\n color.b = color.b * ${i.filterColor.blue.toFixed(2)};\n // color.a = color.a * ${i.filterColor.alpha.toFixed(2)};\n `,n[t]=n[t].replace(o,r)}t.scene.requestRender()}const oi={cacheBytes:4294967296,maximumCacheOverflowBytes:5368709120},ni=async t=>{const{viewer:i,url:o,options:n}=t,r=await e.Cesium3DTileset.fromUrl(o,{...oi,...n});i.scene.primitives.add(r);return{tileset:r,setHeightOffset:e=>{ri(r,e)},remove:()=>{i.scene.primitives.remove(r)},flyTo:()=>{i.flyTo(r)}}},ri=(t,i)=>{li(t,e.Cartesian3.fromElements(0,0,i,new e.Cartesian3))},ai=async e=>{const t=[];function i(e){if(console.log(e),!e.content||!e.content.featuresLength)return;const o=e.content;for(let e=0;e<o.featuresLength;e++)t.push(o.getFeature(e));e.children?.forEach(i)}return new Promise(o=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),o(t)})})},si=e=>{const t=[];function i(e){t.push(e),e.children?.forEach(i)}return new Promise(o=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),o(t)})})},li=(t,i)=>{if(i.equals(e.Cartesian3.ZERO))return;const o=t.boundingSphere.center,n=e.Transforms.eastNorthUpToFixedFrame(o),r=e.Matrix4.multiplyByPoint(n,i,new e.Cartesian3),a=e.Cartesian3.subtract(r,o,new e.Cartesian3),s=e.Matrix4.fromTranslation(a);t.modelMatrix=e.Matrix4.multiply(s,t.modelMatrix,new e.Matrix4)},ci={translate:li,scale:(t,i)=>{if(i.equals(e.Cartesian3.ZERO)||i.equals(e.Cartesian3.ONE))return;const o=t.boundingSphere.center,n=e.Transforms.eastNorthUpToFixedFrame(o),r=e.Matrix4.inverse(n,new e.Matrix4),a=e.Matrix4.fromScale(i),s=e.Matrix4.multiply(a,r,new e.Matrix4),l=e.Matrix4.multiply(n,s,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(l,t.modelMatrix,new e.Matrix4)},rotate:(t,i)=>{const{x:o,y:n,z:r}=i,a=t.boundingSphere.center,s=e.Transforms.eastNorthUpToFixedFrame(a),l=e.Matrix4.inverse(s,new e.Matrix4),c=e.Matrix4.clone(e.Matrix4.IDENTITY);if(0!==o){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationX(e.Math.toRadians(o)));e.Matrix4.multiply(t,c,c)}if(0!==n){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationY(e.Math.toRadians(n)));e.Matrix4.multiply(t,c,c)}if(0!==r){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationZ(e.Math.toRadians(r)));e.Matrix4.multiply(t,c,c)}const d=e.Matrix4.multiply(c,l,new e.Matrix4),p=e.Matrix4.multiply(s,d,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(p,t.modelMatrix,new e.Matrix4)}},di=async t=>{const{viewer:i,url:o}=t,n=await e.CesiumTerrainProvider.fromUrl(o,{requestWaterMask:!0,requestVertexNormals:!0});i.scene.terrainProvider=n;return{terrainProvider:n,remove:()=>{i.scene.terrainProvider=new e.EllipsoidTerrainProvider}}},pi=t=>{t.scene.terrainProvider=new e.EllipsoidTerrainProvider},hi=async()=>await e.CesiumTerrainProvider.fromIonAssetId(1,{requestWaterMask:!0,requestVertexNormals:!0}),ui=()=>{},mi=()=>{},gi=async t=>{const{viewer:i,url:o,options:n}=t,r=await e.I3SDataProvider.fromUrl(o,n);i.scene.primitives.add(r);return{i3sProvider:r,setHeightOffset:e=>{r.layers.forEach(t=>{const i=t.tileset;i&&ri(i,e)})},remove:()=>{i.scene.primitives.remove(r)},flyTo:t=>{const o=e.Rectangle.center(r.extent);o.height=t;let n=r.data;e.defined(n.layers)&&n.layers.length>0&&(n=n.layers[0]),e.defined(n.fullExtent)&&e.defined(n.fullExtent.zmax)&&(o.height+=n.fullExtent.zmax);const a=e.Ellipsoid.WGS84.cartographicToCartesian(o);i.camera.flyTo({destination:a,orientation:{}})}}},fi=(t,i=e.Color.YELLOW)=>{const o=t.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 highlight;\n void main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (czm_selected()) {\n vec3 highlighted = highlight.a * highlight.rgb + (1.0 - highlight.a) * color.rgb;\n out_FragColor = mix(color, vec4(highlighted,0.5), 0.3);\n } else {\n out_FragColor = color;\n }\n }\n ",uniforms:{highlight:()=>i}}));o.selected=[];return{stage:o,remove:()=>{t.scene.postProcessStages.remove(o)}}},vi=t=>{const i=e.PostProcessStageLibrary.createEdgeDetectionStage(),o=new e.PostProcessStage({name:"skyline",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n void main() { float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (depth < 1.0 - 0.000001) {\n out_FragColor = color;\n } else {\n out_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n }\n }"}),n=new e.PostProcessStage({name:"mix",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D redTexture;\n uniform sampler2D silhouetteTexture;\n in vec2 v_textureCoordinates;\n\n void main() {\n vec4 redColor = texture(redTexture, v_textureCoordinates);\n vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (redColor.r == 1.0) {\n out_FragColor = mix(color, vec4(5.0, 0.0, 0.0, 1.0), silhouetteColor.a);\n } else {\n out_FragColor = color;\n }\n }",uniforms:{redTexture:o.name,silhouetteTexture:i.name}}),r=new e.PostProcessStageComposite({stages:[i,o,n],inputPreviousStageTexture:!1,uniforms:i.uniforms});t.scene.postProcessStages.add(r);return{stage:r,remove:()=>{t.scene.postProcessStages.remove(r)}}},yi=(t,i=e.Color.YELLOW)=>{const o=t.scene.postProcessStages,n=e.PostProcessStageLibrary.createEdgeDetectionStage();n.uniforms.color=i,n.uniforms.length=1,n.selected=[];const r=e.PostProcessStageLibrary.createEdgeDetectionStage();r.uniforms.color=i,r.selected=[];const a=o.add(e.PostProcessStageLibrary.createSilhouetteStage([n,r]));a.selected=[];return{stage:a,remove:()=>{t.scene.postProcessStages.remove(a)}}},Ci=t=>{const i=t.viewer,o=new e.PostProcessStage({name:"SnowEffectCover",fragmentShader:"\n vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth)\n {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n }\n vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset, sampler2D depthMap) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n float upOrRightLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n }\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float intensity;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n\n float logDepthOrDepth = czm_unpackDepth(texture(depthTexture, v_textureCoordinates));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0), depthTexture);\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0), depthTexture);\n vec3 normalEC = normalize(cross(leftRight, downUp));\n vec3 normalMC = normalize((czm_inverseView * vec4(normalEC, 0.0)).xyz);\n vec3 ellipsoidNormal = normalize(worldCoordinate);\n float dotProd = dot(ellipsoidNormal, normalMC);\n if(dotProd < 0.3){\n out_FragColor = sceneColor;\n } else {\n out_FragColor = mix(sceneColor, vec4(1.0), dotProd * intensity);\n }\n if (czm_selected()) {\n out_FragColor = sceneColor;\n }\n }\n ",forcePowerOfTwo:!1,textureScale:1,uniforms:{intensity:()=>t.intensity||.8}});i.scene.postProcessStages.add(o);return o.selected=[],{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},wi=t=>{const i=t.viewer,o=i.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture; //输入的场景渲染照片\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float scale;\n\n float snow(vec2 uv, float thisScale) {\n float time = czm_frameNumber * speed / 1000.0;\n float wMars3D = smoothstep(1.0, 0.0, -uv.y * (thisScale / 10.0));\n if(wMars3D < 0.1)\n return 0.0;\n uv += time / thisScale;\n uv.y += time * 2.0 / thisScale;\n uv.x += sin(uv.y + time * 0.5) / thisScale;\n uv *= thisScale;\n\n vec2 s = floor(uv), f = fract(uv), p;\n float k = 3.0, d;\n p = 0.5 + 0.35 * sin(11.0 * fract(sin((s + p + thisScale) * mat2(7, 3, 6, 5)) * 5.0)) - f;\n d = length(p);\n k = min(d, k);\n k = smoothstep(0.0, k, sin(f.x + f.y) * 0.01);\n return k * wMars3D;\n }\n void main(void) {\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n\n float c = 0.0;\n float step = 1.0/(scale*0.1);\n for(float i = 1.0; i < 12.0; i += 1.0) {\n c += snow(uv, i*step);\n }\n vec3 finalColor = vec3(c); //屏幕上雪的颜色\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雪和三维场景融合\n }",uniforms:{scale:()=>t.scale||5,speed:()=>t.speed||16}}));o.selected=[];return{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},bi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float alpha;\n uniform float height;\n uniform vec3 oneOverRadii;\n uniform vec3 oneOverRadiiSquared;\n uniform float centerToleranceSquared;\n uniform float EPSILON12;\n uniform float earthRadius;\n\n in vec2 v_textureCoordinates;\n out vec4 glColor;\n\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n\n\n vec3 getWorldCoordinateFromDepth(in vec4 currD){\n float depth = czm_unpackDepth(currD);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n return worldCoordinate;\n }\n\n float magnitude(in vec3 v){\n return sqrt(v.x * v.x + v.y * v.y + v.z * v.z);\n }\n\n // 沿大地表面法线缩放提供的笛卡尔位置,使其位于该椭球体的表面上\n vec3 scaleToGeodeticSurface(in vec3 cartesian){\n float positionX = cartesian.x;\n float positionY = cartesian.y;\n float positionZ = cartesian.z;\n float x2 = cartesian.x * cartesian.x * oneOverRadii.x * oneOverRadii.x;\n float y2 = cartesian.y * cartesian.y * oneOverRadii.y * oneOverRadii.y;\n float z2 = cartesian.z * cartesian.z * oneOverRadii.z * oneOverRadii.z;\n\n float squaredNorm = x2 + y2 + z2;\n float ratio = sqrt(1.0 / squaredNorm);\n vec3 intersection = cartesian * ratio;\n\n float oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n float oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n float oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n vec3 gradient = vec3(intersection.x * oneOverRadiiSquaredX * 2.0,intersection.y * oneOverRadiiSquaredY * 2.0,intersection.z * oneOverRadiiSquaredZ * 2.0);\n\n float lambda = ((1.0 - ratio) * magnitude(cartesian) ) / (0.5 * magnitude(gradient));\n float correction = 0.0;\n float func = 0.0;\n float denominator = 0.0;\n float xMultiplier = 0.0;\n float yMultiplier = 0.0;\n float zMultiplier = 0.0;\n float xMultiplier2 = 0.0;\n float yMultiplier2 = 0.0;\n float zMultiplier2 = 0.0;\n float xMultiplier3 = 0.0;\n float yMultiplier3 = 0.0;\n float zMultiplier3 = 0.0;\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n xMultiplier2 = xMultiplier * xMultiplier;\n yMultiplier2 = yMultiplier * yMultiplier;\n zMultiplier2 = zMultiplier * zMultiplier;\n\n xMultiplier3 = xMultiplier2 * xMultiplier;\n yMultiplier3 = yMultiplier2 * yMultiplier;\n zMultiplier3 = zMultiplier2 * zMultiplier;\n\n float func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n float denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n float derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (abs(func) > EPSILON12);\n return vec3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);\n }\n\n vec3 multiplyComponents(in vec3 left,in vec3 right){\n return vec3(left.x * right.x, left.y * right.y, left.z * right.z);\n }\n\n\n // 将世界坐标转为经纬度高度\n vec3 getCartographicFromCartesian3(in vec3 cartesian){\n vec3 p = scaleToGeodeticSurface(cartesian);\n vec3 n = multiplyComponents(p,oneOverRadiiSquared);\n n = normalize(n);\n vec3 h = cartesian - p;\n\n float longitude = atan(n.y, n.x);\n float latitude = asin(n.z);\n float height = sign(dot(h, cartesian)) * magnitude(h);\n\n return vec3(longitude,latitude,height);\n }\n\n // 计算每个像素点的高度 通过计算相机所在位置的地球半径作为每个点的地球半径,然后用每个点的length减去半径得到近似的高度\n float getHeight(in vec4 currD){\n // 传入每个点的世界坐标\n float altitude = 0.0;\n float depth = czm_unpackDepth(currD);\n if (depth == 0.0) {\n altitude = czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n float distance = -eyeCoordinate.z / eyeCoordinate.w;\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n altitude = length(worldCoordinate.xyz) - earthRadius;\n return altitude;\n }\n\n void main(){\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n glColor = color;\n return;\n }\n // 此方法有问题 会闪烁\n float depth = getDepth(currD);\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec4 positionWC = czm_inverseView * positionEC;\n // 获取当前点的高度\n // vec3 positionWC = getWorldCoordinateFromDepth(currD);\n vec3 cartographic = getCartographicFromCartesian3(vec3(positionWC.x,positionWC.y,positionWC.z));\n // 高度加了10之后 就不闪烁了\n float pointHeight = cartographic.z + 10.;\n // 当前点高度越高,雾浓度越小,高度达到设定高度,雾浓度为0,同时乘以深度,距离越远,浓度越大\n float fog = (height/pointHeight - 1.);\n fog = clamp(fog, 0.0, 1.0);\n glColor = mix(color,vec4(1.0,1.,1.,1),fog*alpha);\n }",uniforms:{EPSILON12:()=>t.EPSILON12||1e-12,alpha:()=>t.alpha||.88,centerToleranceSquared:()=>t.centerToleranceSquared||.1,height:()=>t.height||100,oneOverRadii:()=>t.oneOverRadii||{x:1.567855942887398e-7,y:1.567855942887398e-7,z:1.573130351105623e-7},oneOverRadiiSquared:()=>t.oneOverRadiiSquared||{x:2458172257647332e-29,y:2458172257647332e-29,z:24747391015697002e-30}}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Pi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\nfloat getDistance(sampler2D depthTexture, vec2 texCoords) {\n float depth = czm_unpackDepth(texture(depthTexture, texCoords));\n if(depth == 0.0) {\n return czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n return -eyeCoordinate.z / eyeCoordinate.w;\n}\nfloat interpolateByDistanceMars3D(vec4 nearFarScalar, float distance) {\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) {\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform vec4 fogByDistance;\nuniform vec4 fogColor;\nin vec2 v_textureCoordinates;\nvoid main(void) {\n float distance = getDistance(depthTexture, v_textureCoordinates);\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n float blendAmount = interpolateByDistanceMars3D(fogByDistance, distance);\n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);\n out_FragColor = alphaBlend(finalFogColor, sceneColor);\n}\n ",uniforms:{fogColor:()=>t.fogColor||e.Color.WHITE,fogByDistance:()=>t.fogByDistance||new e.Cartesian4(100,0,9e3,.9)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},_i=t=>{const i=new e.PostProcessStageComposite({name:"undefinedcontrast_bias_blur",stages:[new e.PostProcessStage({name:"undefinedcontrast_bias",fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float contrast;\n uniform float brightness;\n void main(void)\n {\n vec4 texture1 = texture(colorTexture, v_textureCoordinates);\n vec3 sceneColor = texture1.rgb;\n\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n out_FragColor = vec4(sceneColor, texture1.a);\n }\n ",uniforms:{contrast:()=>128,brightness:()=>-.3}}),new e.PostProcessStageComposite({name:"undefined_blur_comp",stages:[new e.PostProcessStage({name:"undefinedhigh",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform float threshold;\n uniform float smoothWidth;\n\n in vec2 v_textureCoordinates;\n void main() {\n vec4 marstexel = texture( colorTexture, v_textureCoordinates );\n\n #ifdef CZM_SELECTED_FEATURE\n if (!czm_selected()) {\n marstexel = vec4(0.);\n }\n #endif\n\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float marsv = dot( marstexel.xyz, luma );\n float alpha = smoothstep(threshold, threshold + smoothWidth, marsv);\n\n vec4 outputColor = vec4(0.0,0.0,0.0,0.0);\n out_FragColor = mix( outputColor, marstexel, alpha );\n }\n ",uniforms:{threshold:()=>0,smoothWidth:()=>.01}})]})]}),o=t.scene.postProcessStages.add(new e.PostProcessStageComposite({name:"bloom_target",inputPreviousStageTexture:!1,stages:[i,new e.PostProcessStage({name:"undefinedgenerate_composite",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D bloomTexture;\n uniform float ratio;\n uniform vec4 color;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 color1 = texture(colorTexture, v_textureCoordinates);\n vec4 bloom = texture(bloomTexture, v_textureCoordinates);\n bloom *= color;\n if (czm_selected()) {\n bloom *= ratio;\n out_FragColor = bloom + color1;\n } else {\n out_FragColor = color1;\n }\n }\n ",uniforms:{bloomTexture:()=>"undefinedcontrast_bias_blur",color:()=>e.Color.GREEN,ratio:()=>2}})]}));o.enabled=!1;return o.selected=[],{stage:o,remove:()=>{t.scene.postProcessStages.remove(o)}}},xi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float size;\n uniform float direction;\n\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n\n void main(void) {\n\n float time = czm_frameNumber * speed / 1000.0;\n vec2 resolution = czm_viewport.zw;\n\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 finalColor = vec3(.6, .7, .8);//粒子的颜色\n\n float siMars3D = sin(direction), co = cos(direction);\n uv *= mat2(co, -siMars3D, siMars3D, co);\n uv *= length(uv + vec2(0, 4.9))*(20.0/size) + 1.0;\n\n float v = 1. - sin(hash(floor(uv.x * 100.0)) * 2.0);\n float b = clamp(abs(sin(20.0 * time * v + uv.y * (5. / (2.0 + v)))) - .95, 0.0, 1.0) * 20.0;\n finalColor *= v * b; //屏幕上雨的颜色\n\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雨和三维场景融合\n }\n ",uniforms:{speed:()=>t.speed||16,size:()=>t.size||20,direction:()=>360+(t.direction||30)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Mi=t=>{const i=t.viewer,o=new e.PostProcessStage({fragmentShader:"\n#extension GL_OES_standard_derivatives:enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nin vec2 v_textureCoordinates;\nvec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n}\nfloat getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n}\nvec3 guussColor(vec2 uv){\n vec2 pixelSize = 1.0 / czm_viewport.zw;\n float dx0 = -pixelSize.x;\n float dy0 = -pixelSize.y;\n float dx1 = pixelSize.x;\n float dy1 = pixelSize.y;\n vec4 gc = (\n texture(colorTexture, uv)+\n texture(colorTexture, uv + vec2(dx0, dy0)) +\n texture(colorTexture, uv + vec2(0.0, dy0)) +\n texture(colorTexture, uv + vec2(dx1, dy0)) +\n texture(colorTexture, uv + vec2(dx0, 0.0)) +\n texture(colorTexture, uv + vec2(dx1, 0.0)) +\n texture(colorTexture, uv + vec2(dx0, dy1)) +\n texture(colorTexture, uv + vec2(0.0, dy1)) +\n texture(colorTexture, uv + vec2(dx1, dy1))\n ) * (1.0 / 9.0);\n return gc.rgb;\n}\nvoid main(){\n float offset = 0.0;\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n out_FragColor = color;\n return;\n }\n float depth = getDepth(currD);\n\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec3 dx = dFdx(positionEC.xyz);\n vec3 dy = dFdy(positionEC.xyz);\n vec3 normal = normalize(cross(dx,dy));\n\n vec4 positionWC = normalize(czm_inverseView * positionEC);\n vec3 normalWC = normalize(czm_inverseViewRotation * normal);\n float fotNumWC = dot(positionWC.xyz,normalWC);\n if(fotNumWC<=0.5){\n out_FragColor = color;\n return;\n }\n\n vec3 viewDir = normalize(positionEC.xyz);\n vec3 reflectDir = reflect(viewDir, normal);\n vec3 viewReflectDir = reflectDir;\n\n float step = 0.05;\n int stepNum = int(20.0 / step);\n vec3 pos;\n vec3 albedo;\n bool jd = false;\n for(int i = 1;i <= 400;i++)\n {\n float delta = step * float(i) + offset;\n pos = positionEC.xyz + viewReflectDir * delta;\n float d = -pos.z;\n\n vec4 tmp = czm_projection * vec4(pos,1.0);\n vec3 screenPos = tmp.xyz / tmp.w;\n vec2 uv = vec2(screenPos.x, screenPos.y) * 0.5 + vec2(0.5, 0.5);\n\n if(uv.x > 0.0 && uv.x < 1.0 && uv.y > 0.0 && uv.y < 1.0){\n float dd = getDepth(texture(depthTexture, uv));\n vec4 jzc = toEye(uv, dd);\n dd = -jzc.z;\n if(d>dd){\n if(abs(abs(d) - abs(dd)) <=step){\n jd = true;\n // albedo = texture(colorTexture, uv).rgb;\n albedo = guussColor(uv);\n }\n break;\n }\n }\n }\n if(jd){\n out_FragColor = vec4(mix(color.xyz,albedo,0.5),1.0);\n }else{\n out_FragColor = color;\n }\n}\n",uniforms:{}});i.scene.postProcessStages.add(o);return{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},Di=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n float hash(float x)\n {\n return fract(21654.6512 * sin(385.51 * x));\n }\n float hash(vec2 p)\n {\n return fract(1654.65157 * sin(15.5134763 * p.x + 45.5173247 * p.y + 5.21789));\n }\n vec2 hash2(vec2 p)\n {\n return vec2(hash(p * .754), hash(1.5743 * p + 4.5476351));\n }\n vec2 add = vec2(1.0, 0.0);\n vec2 noise2(vec2 x)\n {\n vec2 p = floor(x);\n vec2 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n vec2 res = mix(mix(hash2(p),\n hash2(p + add.xy), f.x),\n mix(hash2(p + add.yx), hash2(p + add.xx), f.x), f.y);\n return res;\n }\n vec2 fbm2(vec2 x)\n {\n vec2 r = vec2(0.0);\n float a = 1.0;\n for (int i = 0; i < 8; i++)\n {\n r += noise2(x) * a;\n x *= 2.;\n a *= .5;\n }\n return r;\n }\n float dseg(vec2 ba, vec2 pa)\n {\n float h = clamp(dot(pa, ba) / dot(ba, ba), -0.2, 1.);\n return length(pa - ba * h);\n }\n uniform sampler2D colorTexture;\n uniform float fallInterval;\n uniform float mixFactor;\n in vec2 v_textureCoordinates;\n void main(void){\n vec2 uv = gl_FragCoord.xy;\n float iTime = czm_frameNumber * fallInterval * clamp(fallInterval * 0.1, 0.01, 0.1);\n vec2 p = uv / czm_viewport.zw;\n vec2 d;\n vec2 tgt = vec2(1., -1.);\n float c = 0.;\n if (p.y >= 0.)\n c = (1. - (fbm2((p + .2) * p.y + .1 * iTime)).x) * p.y;\n else\n c = (1. - (fbm2(p + .2 + .1 * iTime)).x) * p.y * p.y;\n vec3 col = vec3(0.);\n vec3 col1 = c * vec3(.3, .5, 1.);\n float mdist = 100000.;\n float t = hash(floor(5. * iTime));\n tgt += 4. * hash2(tgt + t) - 1.5;\n if (hash(t + 2.3) > .6)\n for (int i = 0; i < 100; i++) {\n vec2 dtgt = tgt - p;\n d = .05 * (vec2(-.5, -1.) + hash2(vec2(float(i), t)));\n float dist = dseg(d, dtgt);\n mdist = min(mdist, dist);\n tgt -= d;\n c = exp(-1.2 * dist) + exp(-55. * mdist);\n col = c * vec3(.7, .8, 1.);\n }\n col += col1;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(col, 0.0), mixFactor);\n}\n ",uniforms:{mixFactor:()=>t.mixFactor||.1,fallInterval:()=>t.fallInterval||.8}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Ei=t=>new e.CustomShader({vertexShaderText:Ai,fragmentShaderText:Si,translucencyMode:0,lightingModel:e.LightingModel.UNLIT,uniforms:{colorEnable:{type:e.UniformType.BOOL,value:t.colorEnable||!0},glowEnable:{type:e.UniformType.BOOL,value:t.glowEnable||!0},baseHeight:{type:e.UniformType.FLOAT,value:t.baseHeight||100},glowRange:{type:e.UniformType.FLOAT,value:t.glowRange||100},uColor:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE},glowTime:{type:e.UniformType.FLOAT,value:t.glowTime||1}}}),Ai="\n void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {\n vsOutput.positionMC += 0.1 * vsInput.attributes.normalMC;\n }\n",Si="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n {\n vec4 position = czm_inverseModelView * vec4(fsInput.attributes.positionEC,1); // 位置 \n vec4 color = uColor;\n color *= vec4(vec3(position.z / baseHeight), 0.5); // 渐变\n bool glEnable = glowEnable;\n // if(position.z > baseHeight) {\n // material.diffuse = vec3(1.0,0.0,0.0);\n // return;\n // }\n if(position.z < 40.0) {\n glEnable = false;\n }\n if(!glEnable){\n material.diffuse = color.rgb;\n return; \n }\n \n // 动态光环\n float time = fract(czm_frameNumber / (360.0 * glowTime));\n time = abs(time - 0.5) * 2.0;\n float diff = step(0.005, abs(clamp(position.z / glowRange, 0.0, 1.0) - time));\n color.rgb += color.rgb * (1.0 - diff);\n material.diffuse = color.rgb;\n } \n",Ii=t=>new e.CustomShader({fragmentShaderText:Ti,uniforms:{color:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE}}}),Ti="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n vec4 originColor = vec4(material.diffuse,1.0);\n material.diffuse = vec3(mix(originColor,color,0.3));\n material.alpha = 0.8;\n }\n",zi=t=>{const i=t.scene.postProcessStages.add(e.PostProcessStageLibrary.createSilhouetteStage());i.uniforms.color=e.Color.YELLOW,i.selected=[];return{stage:i,remove:()=>{}}};var Fi=(e=>(e.DRAW_ADD="drawAdd",e.DRAW_MOVE="drawMove",e.DRAW_PICK="drawPick",e.DRAW_DB_CLICK="drawDbClick",e.DRAW_RIGHT_CLICK="drawRightClick",e))(Fi||{}),Ri=Object.freeze({__proto__:null,DrawEventType:Fi});const Oi={drawStart:{circle:"单击左键绘制圆的中心点,单机右键取消绘制。",rectangle:"单击左键绘制矩形左上角。",point:"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。",default:"单击左键绘制第一个节点,单机右键取消绘制。"},drawMove:{circle:"单击左键确定圆的半径并结束绘制,单机右键取消绘制。",rectangle:"单击左键结束绘制,单机右键取消绘制。","vertical-line":"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。","default-dbclick":"单机左键绘制下一个节点,双击左键结束绘制,单机右键撤销上次绘制。",default:"单机左键绘制下一个节点,单机右键撤销上次绘制。"},drawEnd:"单击左键结束绘制,单机右键取消上次绘制",pointEnter:"双击左键编辑节点。",drawEditMove:{default:"移动鼠标修改节点,单击左键确定修改,单机右键取消修改。"}},Li={point:{color:"rgba(255,255,0,0.8)",pixelSize:8,outlineColor:"rgba(255,255,255,0.8)",outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},polyline:{width:2,color:"rgba(81,255,0,0.8)",depthFailColor:"rgba(255,0,0,0.5)"},polygon:{color:"rgba(255,255,54,0.3)",depthFailColor:"rgba(255,0,0,0.3)"}};class Bi extends ot{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=p(t).map(e=>Q([e.longitude,e.latitude])),o=h(t[0]).height,n=$e(t[0],t[1]),[r,a,s]=[i[0],i[1],i[2]],l=Ge(r,n/1e3,le(r,a),le(r,s)).geometry.coordinates.map(e=>[e[0],e[1],o]);l.push([...r.geometry.coordinates,o]),l.unshift([...r.geometry.coordinates,o]),this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(l.flat()),this.setShapePositions(this.drawData.shapePositions)}}const ki=(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),Ni=e=>{let t=0;return e&&Array.isArray(e)&&e.length>0&&e.forEach((i,o)=>{o<e.length-1&&(t+=ki(i,e[o+1]))}),t},Gi=e=>Ni(e)**.99,Ui=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Vi=(e,t)=>{let i;const o=Math.asin(Math.abs(t[1]-e[1])/ki(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=o+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=2*Math.PI-o:t[1]<e[1]&&t[0]<e[0]?i=o:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-o),i},$i=(e,t,i)=>{const o=Vi(t,e)-Vi(t,i);return o<0?o+2*Math.PI:o},Hi=(e,t,i,o,n)=>{const r=Vi(e,t),a=n?r+i:r-i,s=o*Math.cos(a),l=o*Math.sin(a);return[t[0]+s,t[1]+l]},Wi=function(e){if(e.length<=2)return e;const t=[],i=e.length-1;for(let o=0;o<=1;o+=.01){let[n,r]=[0,0];for(let t=0;t<=i;t++){const a=ji(i,t),s=o**t,l=(1-o)**(i-t);n+=a*s*l*e[t][0],r+=a*s*l*e[t][1]}t.push([n,r])}return t.push(e[i]),t},qi=e=>{let t=1;switch(e){case e<=1:t=1;break;case 2===e:t=2;break;case 3===e:t=6;break;case 24===e:t=24;break;case 5===e:t=120;break;default:for(let i=1;i<=e;i++)t*=i}return t},ji=(e,t)=>qi(e)/(qi(t)*qi(e-t));class Zi extends ot{positions;drawData;depthFailAppearance;connPoint;tempPoint4;llBodyPnts=[];rrBodyPnts=[];isClockWise;neckWidthFactor;headWidthFactor;headHeightFactor;neckHeightFactor;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance(),this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.connPoint=[0,0],this.tempPoint4=[0,0],this.isClockWise=!1}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=[],o=p(t).map(e=>(i.push(e.height),[e.longitude,e.latitude])),n=Math.max(...i),[r,a,s]=[o[0],o[1],o[2]],l=o.length;let c,d;3===l?(this.tempPoint4=this.getTempPoint4(r,a,s),this.connPoint=Ui(r,a)):4===l?(this.tempPoint4=o[3],this.connPoint=Ui(r,a)):(this.tempPoint4=o[3],this.connPoint=o[4]),this.isClockWise=((e,t,i)=>(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0]))(r,a,s),this.isClockWise?(c=this.getArrowPoints(r,this.connPoint,this.tempPoint4,!1),d=this.getArrowPoints(this.connPoint,a,s,!0)):(c=this.getArrowPoints(a,this.connPoint,s,!1),d=this.getArrowPoints(this.connPoint,r,this.tempPoint4,!0));const h=c.length,m=(h-5)/2,g=c.slice(0,m),f=c.slice(m,m+5);let v=c.slice(m+5,h);this.llBodyPnts=g;let y=d.slice(0,m);const C=d.slice(m,m+5),w=d.slice(m+5,h);this.rrBodyPnts=w,y=Wi(y);const b=Wi(w.concat(g.slice(1)));v=Wi(v);const P=y.concat(C,b,f,v).filter(e=>e[0]&&e[1]).map(t=>new e.Cartographic(t[0],t[1],n)),_=u(P);this.drawData.shapePositions=_,this.drawData.shapePositions.push(_[0]),this.setShapePositions(this.drawData.shapePositions)}getTempPoint4(e,t,i){const o=Ui(e,t),n=ki(o,i),r=$i(e,o,i);let a,s,l,c=[0,0];return r<Math.PI/2?(a=n*Math.sin(r),s=n*Math.cos(r),l=Hi(e,o,Math.PI/2,a,!1),c=Hi(o,l,Math.PI/2,s,!0)):r>=Math.PI/2&&r<Math.PI?(a=n*Math.sin(Math.PI-r),s=n*Math.cos(Math.PI-r),l=Hi(e,o,Math.PI/2,a,!1),c=Hi(o,l,Math.PI/2,s,!1)):r>=Math.PI&&r<1.5*Math.PI?(a=n*Math.sin(r-Math.PI),s=n*Math.cos(r-Math.PI),l=Hi(e,o,Math.PI/2,a,!0),c=Hi(o,l,Math.PI/2,s,!0)):(a=n*Math.sin(2*Math.PI-r),s=n*Math.cos(2*Math.PI-r),l=Hi(e,o,Math.PI/2,a,!0),c=Hi(o,l,Math.PI/2,s,!1)),c}getArrowPoints(e,t,i,o){const n=Ui(e,t),r=ki(n,i);let a=Hi(i,n,0,.3*r,!0),s=Hi(i,n,0,.5*r,!0);a=Hi(n,a,Math.PI/2,r/5,o),s=Hi(n,s,Math.PI/2,r/4,o);const l=[n,a,s,i],c=this.getArrowHeadPoints(l);if(!(c&&Array.isArray(c)&&c.length>0))throw new Error("Interpolation Error");{const i=c[0],o=c[4],n=ki(e,t)/Gi(l)/2,r=this.getArrowBodyPoints(l,i,o,n);if(r){const n=r.length;let a=r.slice(0,n/2),s=r.slice(n/2,n);return a.push(i),s.push(o),a=a.reverse(),a.push(t),s=s.reverse(),s.push(e),a.reverse().concat(c,s)}}}getArrowBodyPoints(e,t,i,o){const n=Ni(e),r=Gi(e)*o,a=(r-ki(t,i))/2;let s=0;const l=[],c=[];for(let t=1;t<e.length-1;t++){const i=$i(e[t-1],e[t],e[t+1])/2;s+=ki(e[t-1],e[t]);const o=(r/2-s/n*a)/Math.sin(i),d=Hi(e[t-1],e[t],Math.PI-i,o,!0),p=Hi(e[t-1],e[t],i,o,!1);l.push(d),c.push(p)}return l.concat(c)}getArrowHeadPoints(e){const t=Gi(e)*this.headHeightFactor,i=e[e.length-1],o=t*this.headWidthFactor,n=t*this.neckWidthFactor,r=t*this.neckHeightFactor,a=Hi(e[e.length-2],i,0,t,!0),s=Hi(e[e.length-2],i,0,r,!0),l=Hi(i,a,Math.PI/2,o,!1),c=Hi(i,a,Math.PI/2,o,!0);return[Hi(i,s,Math.PI/2,n,!1),l,i,c,Hi(i,s,Math.PI/2,n,!0)]}}class Yi extends ot{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<2)return;const i=p(t).map(e=>Q([e.longitude,e.latitude])),o=h(t[0]).height,n=He(t)/1e3,[r,a]=[i[0],i[1]],s=le(r,a),l=ce(r,.1*n,s-90,{units:"kilometers"}),c=ce(r,.1*n,s+90,{units:"kilometers"}),d=ce(r,.8*n,s-5,{units:"kilometers"}),u=ce(r,.8*n,s+5,{units:"kilometers"}),m=ce(r,.75*n,s-13,{units:"kilometers"}),g=ce(r,.75*n,s+13,{units:"kilometers"}),f=[...l.geometry.coordinates,o,...d.geometry.coordinates,o,...m.geometry.coordinates,o,...a.geometry.coordinates,o,...g.geometry.coordinates,o,...u.geometry.coordinates,o,...c.geometry.coordinates,o,...l.geometry.coordinates,o];this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(f.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Ji=e=>{const t=new Bi(e);e.primitives.add(t)},Ki=e=>{const t=new Zi(e);e.primitives.add(t)},Xi=e=>{const t=new Yi(e);e.primitives.add(t)},Qi="cm",eo="厘米",to="m",io="米",oo="km",no="千米",ro="公里",ao="㎡",so="平方厘米",lo="㎡",co="平方米",po="km²",ho="平方千米",uo="平方公里",mo="亩",go="公顷",fo={cm:"cm²",m:"㎡",km:"km²","米":"平方米","千米":"平方千米","公里":"平方公里"},vo=(e,t,i)=>t===i?e:e*wo(i),yo=(e,t,i)=>t===i?e:e*function(e){switch(e){case ao:return 1e4;case lo:return 1;case po:return 1e-6;case so:return 1e4;case co:return 1;case ho:case uo:return 1e-6;case mo:return.0015;case go:return 1e-4;default:return 1}}(i),Co=e=>fo[e],wo=e=>{switch(e){case to:return 1;case Qi:case eo:return 100;case oo:return.001;case io:return 1;case no:case ro:return.001;default:return 1}};const bo=(t,i)=>{let o=t;if("vertical-surface-line"===i&&t.length>=1){const i=t[0],n=e.Cartographic.fromCartesian(i),r=e.Math.toDegrees(n.longitude),a=e.Math.toDegrees(n.latitude),s=0;o=[e.Cartesian3.fromDegrees(r,a,n.height),e.Cartesian3.fromDegrees(r,a,s)]}if("vertical-line"===i&&t.length>=2){const i=t[0],n=t[1],r=h(i),a=h(n);let s=r,l=a;r.height>a.height&&(s=a,l=r),console.log(s.longitude,s.latitude,l.height);const c=m(new e.Cartographic(s.longitude,s.latitude,l.height));o=[m(s),c,m(l),m(s)]}return i.startsWith("curve")&&t.length>2&&(o=xo(t)),o},Po=(e,t,i,o,n)=>{i.push(...e.map((i,n)=>{const r=e[n+1];if(r){let e=t?We(i,r):$e(i,r);return e=vo(e,"m",o),{value:Number(e.toFixed(2)),unit:o,position:je([i,r]),positions:[i,r]}}return null}).filter(e=>e&&e.value>0))},_o=e=>{if(2===e.length)return e;let[t,i]=e;return i||(i=Co(t)),[t,i]},xo=t=>{const i=t.length,o=qe(t),n=Math.floor(o/5),r=[];for(let e=0;e<i;e++)r.push(1.5*e);const a=new e.CatmullRomSpline({points:t,times:r}),s=[],l=r[0],c=r[r.length-1];for(let t=0;t<n;t++){const i=t/(n-1),o=e.Math.lerp(l,c,i),r=a.evaluate(o);s.push(r)}return s},Mo=(t,i=1e3)=>{if(t.length<2)return console.warn("至少需要2个点才能生成箭头"),[];const o=t[t.length-1],n=t[t.length-2],r=h(o),a=h(n),s=r.height,l=r.longitude-a.longitude,c=r.latitude-a.latitude,d=Math.sqrt(l**2+c**2);if(d<1e-12)return console.warn("最后两点经纬度重合,无法生成箭头"),[];const p=l/d,u=c/d,g=(t=>{const i=e.Math.toRadians(.5),o=m(t),n=m(new e.Cartographic(t.longitude+i,t.latitude,t.height)),r=2*e.Cartesian3.distance(o,n),a=m(new e.Cartographic(t.longitude,t.latitude+i,t.height));return{lon:r,lat:2*e.Cartesian3.distance(o,a)}})(r),f=i/g.lon*e.Math.RADIANS_PER_DEGREE,v=i/g.lat*e.Math.RADIANS_PER_DEGREE,y=Math.PI/6,C=i*Math.tan(y),w=C/g.lon*e.Math.RADIANS_PER_DEGREE,b=C/g.lat*e.Math.RADIANS_PER_DEGREE,P=r.longitude-p*f-u*w,_=r.latitude-u*v+p*b,x=r.longitude-p*f+u*w,M=r.latitude-u*v-p*b,D=m(new e.Cartographic(P,_,s)),E=m(new e.Cartographic(x,M,s));return[D,m(new e.Cartographic(r.longitude,r.latitude,s)),E]};class Do extends ot{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=bo(this.positions,this.drawData.shape);if(this.drawData.shapePositions=t,"vertical-surface-line"===this.drawData.shape){const e=this.drawData.pointPrimitives.get(1);e&&(e.position=this.drawData.shapePositions[1])}if(this.setShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:Li.polyline.width}):new e.PolylineGeometry({positions:t,width:Li.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(Li.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(Li.polyline.depthFailColor)})}))}}class Eo extends ot{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=JSON.parse(JSON.stringify(this.positions));if(this.calcShapePositions(t),this.positions.length<3)return;const i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(e){const t=[...e,e[0]];this.drawData.shapePositions=t,this.setShapePositions(this.drawData.shapePositions)}}class Ao extends ot{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return;this.primitiveCollection.removeAll(),this.calcShapePositions(this.positions);const t=JSON.parse(JSON.stringify(this.positions)),i=this.drawData.clampToGround?We(t[0],t[1]):$e(t[0],t[1]);if(!i)return;const o=e.Cartographic.fromCartesian(t[0]).height,n=[new e.GeometryInstance({geometry:new e.CircleGeometry({center:t[0],height:o,radius:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:n,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:n,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const o=$e(t[0],t[1]),n=e.Cartographic.fromCartesian(t[0]).height,r=new e.CircleOutlineGeometry({center:t[0],height:n,radius:o}),a=e.CircleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class So extends ot{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return this.primitiveCollection;this.primitiveCollection.removeAll();const t=JSON.parse(JSON.stringify(this.positions));t.length=2,this.calcShapePositions(t);const i=e.Cartographic.fromCartesian(t[0]).height,o=e.Rectangle.fromCartesianArray(t),n=[new e.GeometryInstance({geometry:new e.RectangleGeometry({rectangle:o,height:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:n,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:n,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(Li.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const o=e.Cartographic.fromCartesian(t[0]).height,n=e.Rectangle.fromCartesianArray(t),r=new e.RectangleOutlineGeometry({rectangle:n,height:o}),a=e.RectangleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class Io extends ot{drawData;labelCollection;measureDivs;cesiumWidget;viewer;constructor(t,i){super(),this.viewer=i,this.cesiumWidget=i._element.getElementsByClassName("cesium-widget")[0],this.drawData=t,this.labelCollection=new e.LabelCollection({scene:i.scene}),this.drawData.measureLabel&&this.setAppearance(),this.measureDivs=[],this.renderDivPosition()}getPrimitive(){return this.drawData.isEditing&&this.drawData.measureLabel?"point"===this.drawData.shape?(this.updatePointDivLabel(),this.labelCollection):this.drawData.shapePositions&&this.drawData.shapePositions.length>=2?(this.updateUnit(this.drawData.measureUnit),this.labelCollection):void 0:this.labelCollection}updateUnit(e){if("point"===this.drawData.shape)return;this.drawData.measureUnit=e,this.clearAllDiv();const t=(e=>{let{shapePositions:t,positions:i,shape:o,clampToGround:n,measureUnit:r}=e;t||(t=i),n||(n=!1);const[a,s]=_o(r),l=Co(a);e.measureUnit=[a,s];const c=[];if("polyline"===o&&(Po(i,n,c,a),c.push({value:0,unit:a,position:i[0],positions:i,prefixText:"起点"}),c.push({value:Number(c.reduce((e,t)=>e+t.value,0).toFixed(2)),unit:a,position:i[i.length-1],positions:i})),"vertical-surface-line"===o&&Po(t,n,c,a),"vertical-line"===o&&(Po(t,n,c,a),c.forEach((e,t)=>{0===t&&(e.prefixText="高度"),1===t&&(e.prefixText="水平距离"),2===t&&(e.prefixText="空间距离")})),"polygon"===o){Po(t,n,c,a);const e=yo(Ze(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:je(t),positions:t})}if("rectangle"===o){Po(t,n,c,a);const e=yo(Ze(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:je(t),positions:t})}if("circle"===o){const e=n?We(i[0],i[1]):$e(i[0],i[1]);c.push({value:Number(vo(e,"m",a).toFixed(2)),unit:a,position:i[1],positions:i,prefixText:"半径"});const t=yo(e*e*Math.PI,a,s);e>0&&c.push({value:Number(t.toFixed(2)),unit:s,position:i[0],positions:i})}return c})(this.drawData);this.drawData.measureResult=t,t.forEach((e,t)=>{let i="";e.prefixText?(i=`${e.prefixText}`,e.value&&(i+=`:${e.value}${e.unit}`)):i+=`${e.value}${e.unit}`;const o=this.createDiv(`measure-label-${this.drawData.id}-${t}`,i);this.measureDivs.push({position:e.position,divEle:o})})}updatePointDivLabel(){this.clearAllDiv(),this.drawData.positions.forEach(e=>{const t=h(e),i=this.createDiv(`measure-label-${this.drawData.id}-0`,`经度:${t.longitude.toFixed(6)}\n纬度:${t.latitude.toFixed(6)}\n高度:${t.height.toFixed(6)}`);this.measureDivs.push({position:e,divEle:i})})}renderDivPosition(){this.viewer.scene.postRender.addEventListener(()=>{this.measureDivs.forEach(e=>{const t=this.viewer.scene.cartesianToCanvasCoordinates(e.position);if(t){e.divEle.style.display="block";const i=e.divEle.getBoundingClientRect();e.divEle.style.left=t.x-i.width/2+"px",e.divEle.style.top=t.y-i.height+"px"}else e.divEle.style.display="none"})})}destroy(){super.destroy(),this.clearAllDiv()}setAppearance(){}clearAllDiv(){this.measureDivs.forEach(e=>{e.divEle.remove()}),this.measureDivs=[]}createDiv(e,t,i=48){const o=`\n <div style="\n background: rgba(0, 0, 0, 0.6);\n color: white;\n border-radius: 5px;\n padding: 0 10px 0 10px;\n font-size: 14px;\n white-space: nowrap;\n pointer-events: none;\n ">\n ${t.split("\n").map(e=>`\n <div style="height: 24px; line-height: 24px">\n ${e}\n </div>\n `).join(" ")}\n </div>\n <div style="\n height: ${i}px;\n width: 2px;\n background: rgba(0, 0, 0, 0.6);\n margin: auto;\n ">\n </div>\n `,n=document.createElement("div");return n.id=e,n.innerHTML=o,n.style.position="absolute",n.style.pointerEvents="none",n.className=`measure-label measure-label-${this.drawData.id}`,this.cesiumWidget.appendChild(n),n}calcShapePositions(e){this.setShapePositions(e)}}class To extends ot{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;viewer;arrowLengthScale;constructor(t,i){super(),this.arrowLengthScale=5,this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.viewer=i,this.setAppearance()}getGeometry(){if(this.positions.length<2)return;let t=this.positions;t=bo(t,this.drawData.shape);let i=qe(t)/this.arrowLengthScale;return i>3e6&&(i=3e6),t=Mo(t,i/2),this.calcShapePositions(t),t.length<2?void 0:(this.setShapePositions(t),this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:Li.polyline.width}):new e.PolylineGeometry({positions:t,width:Li.polyline.width}))}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:this.drawData.id});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(Li.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(Li.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}class zo extends ot{drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=this.drawData.shapePositions||[];if(this.calcShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:Li.polyline.width}):new e.PolylineGeometry({positions:t,width:Li.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(Li.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(Li.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}const Fo={point:1,circle:2,rectangle:2,sector:3,"vertical-surface-line":1,"vertical-line":2},Ro={},Oo=e=>{const{type:t,action:i,outline:o,pointCount:n}=e;Ro[t]=(e,t)=>{i(e,t),o&&ko(e)},n&&(Fo[t]=n)},Lo=(e,t,i)=>{Ro[t]&&Ro[t](i,e)},Bo=e=>{const t=new Do(e);e.primitives.add(t)},ko=e=>{const t=new zo(e);e.primitives.add(t)},No=(e,t)=>{const i=new To(e,t);e.primitives.add(i)},Go=e=>{const t=new Eo(e);e.primitives.add(t)},Uo=e=>{const t=new Ao(e);e.primitives.add(t)},Vo=e=>{const t=new So(e);e.primitives.add(t)},$o=(e,t)=>{const i=new Io(e,t);e.primitives.add(i),e.measurePrimitive=i,e.primitives.raiseToTop(i)},Ho="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAQBJREFUWEft2MsNgkAQBuAZtABCBctBErvATryiRRibkKudGKvgwMFtQGIBumOAYAxCArsTs4fZ8w758032wSJ4PtDzfCABXTvEKhjmhXpka+0a6rueNWB0KgmAdLVLYq6QbAHDvEwDgksdzOAz5pKUgK6tFkERnCogq3iq1Ng8ERRBS4HBjTrKywMAqjnfJCKFAGlTg3ieU9vOJV1lq2O/bjhgcyv59yBt8LXpXzLYBFsE2toKojHX+z75kWc8iwsV0PLm8XVLArotivp/RFrsYiiCLnp1rQiKoKWAHHWWcJ8yZsFF8zbj5eNRt9VwPRp1hGyCrq0cq5eArrLeC74BlkT4KR3TrCoAAAAASUVORK5CYII=",Wo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAY9JREFUWEftmNFRwzAMhiVYAMoC5Y50jjAJ9LFliMIQNI/NJtA1CA9hAHIsgMWZYC5xHVtNajcHzqtl+ctvSZaNMPIPR84HEXDoDv1tBc/XxRMCpFaVEPNqcTXvq6RTwbOsSE8FTfUFBOKNE05NQsxRiK3u4/MEy49F8myDdwJOstcNEN32VWCouhHQu4JetnYPp84tVr4uHl8OGofvd7Ocw8kGnKwL4jjk2lTLhLU2y0guGgE7pI8KdsVkuBhEzDtPGstYEEAkmstyMcmKFRDcN9WyjUk774AKQEE1IW1jyt47IACV1XJ22VRNQqKgN70Im9qyAIASbRdST4qunjEQoB3S1tAGBATQY05iy7ObEDdHLzMmOFPi6KBBFLTBuSC9A5rg6pijqSm79TrpHRC021o7IdrZfbwy8wNpztYacgRlhtuitu38b3E/rt9Z/w+Q9czBVtV9RCpX7I7adTKw2QBAIFy7njz2Bvy+OGXFighS9pvMDjWVdXlKHrg/xFaQ6/DQdhFwqKJRwaEKfgEJRgs46ima/wAAAABJRU5ErkJggg==",qo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAMdJREFUWEdjZBjkgHGQu49h1IGUxtBoCI6GIKUhQKn+0TQ4GoKUhgCl+kfT4GgIUhoClOofTYM0DUGh6bfrGRgYFSi1BJ9+xn//Dr7NVluASw3eKBaadvs/LR0HM/sfI4Pjh0zVA9jswulAgenXFZj+s9ynjwP/KH7I1HxAkgNBioWn3kr4z8RkT1tH/n/wLlO1kawopq3DiDN9tJghLpxwqxoNwdEQpDQEKNU/mgZHQ5DSEKBU/2gaHA1BSkOAUv2jaXDYhyAAbjwcKU1UyjYAAAAASUVORK5CYII=",jo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAkJJREFUWEftl19SwkAMxpPCARAvgDPijKewnER4BA8hHEJ5FE8CnsIZccZ6AJEDMF1Ny5Zu/6bNMvQBXmk3vyZfvmQRGv7DhvPBGVBaIasZ7M4/XwhoM74eScH0+9YAAzilhuHByttMbq5sQFoBNOE0lh1IMeDF83qJAG52tuSQIsBiODuZrA14+fQxVIhBUwSqA1hFmURcHPQIAIiLuo1TG5CguvP14z/Z1EcYtHzVi4ARpj7sXh3V/iLw30l/ULdhRIAUtDN/723Ht56RUYTpZtyf6f/qwtF7YkAdPAtQAmbdB08KSMF/Hm4WRRmpCkjeyWmc0hJHVlLSiaQ3gHYv/IidR7rM+6CDPZX7ZCFg0ueoW7fj/kqiLfoQ6u7DGcWQuYDHgNNQVSAzAZNwgQkjpDJHXldUSm1DDrTv01nHnmHmOQtGCpA3vsJwnJJ35mvXUbBkySJD5ylAPR04B54EMD7C4kJGBbMkdJn16BK3/FZq21GOc8eZ17lNYmZSeeHA76cgOZlOPpMse9G8zgUMOo3ErWC631c8H3Fk22bKlolCHzQgLRq1rk4ZHGtZIEjSUJneqo46zvhkAXI1VhWQe27pLOYe1FhAXapGLqzhddN3yYLQV9/myg9vwQQR3EdEGkz6pAL09KXJuECFUYIrAFcu8edqazDtk9nhOVZSBF4b0NhUIjM3Q0nhRCU2djtj4uznjvC6qc8XZTCer7gmbWTOOqDegpQCV3JRT+rRWgbrdCjnnTMgJ0tHsxlpcM77f6iGZThXF5iUAAAAAElFTkSuQmCC";class Zo{static editUI;_editUi;viewer;_editUiPosition=null;_editPointPrimitive=null;_drawEditEvent;elementId="draw-edit-ui";constructor(e,t){this._editUi=null,this.viewer=e,this.create(),this.setVisible(!1),this.renderPosition(),this._drawEditEvent=t}create(){if(this._editUi=document.getElementById(this.elementId),this._editUi)return this._editUi;const e=document.createElement("DIV");e.id=this.elementId,e.className="draw-edit-ui";const t=document.createElement("DIV");t.title="点击移动节点";const i=document.createElement("img");i.src=jo,i.className="draw-edit-icon",t.appendChild(i),t.addEventListener("click",()=>{this._drawEditEvent.drawEditMove&&this._drawEditEvent.drawEditMove(this._editPointPrimitive)});const o=document.createElement("DIV");o.id="addPoint";const n=document.createElement("img");n.src=Ho,n.title="点击添加节点",n.className="draw-edit-icon",o.appendChild(n),o.addEventListener("click",()=>{this._drawEditEvent.drawEditAdd&&this._drawEditEvent.drawEditAdd(this._editPointPrimitive)});const r=document.createElement("DIV"),a=document.createElement("img");r.id="removePoint",a.src=qo,a.title="点击删除节点",a.className="draw-edit-icon",r.appendChild(a),r.addEventListener("click",()=>{this._drawEditEvent.drawEditRemove&&this._drawEditEvent.drawEditRemove(this._editPointPrimitive)});const s=document.createElement("DIV"),l=document.createElement("img");l.src=Wo,l.title="点击删除绘制",l.className="draw-edit-icon",s.appendChild(l),s.addEventListener("click",()=>{this._drawEditEvent.drawDelete&&this._drawEditEvent.drawDelete(this._editPointPrimitive)}),e.appendChild(t),e.appendChild(o),e.appendChild(r),e.appendChild(s),document.body.appendChild(e),this._editUi=e}setAddElementStatus(e){const t=document.getElementById("addPoint"),i=document.getElementById("removePoint");t&&(t.style.display=e?"block":"none"),i&&(i.style.display=e?"block":"none")}static createEditUi(e,t){return Zo.editUI||(Zo.editUI=new Zo(e,t)),Zo.editUI}showAt(e,t,i){this.setVisible(!0),this._editUiPosition=e,this._editPointPrimitive=t,this.setAddElementStatus(!Fo[i])}setVisible(e){this._editUi&&(this._editUi.style.display=e?"flex":"none")}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(this._editUiPosition&&this._editUi&&"flex"===this._editUi.style.display){const e=this.viewer.scene.cartesianToCanvasCoordinates(this._editUiPosition);this._editUi.style.position="fixed",this._editUi.style.top=e.y-28+"px",this._editUi.style.left=`${e.x+15}px`}})}destroy(){Zo.editUI&&(this._editUi&&this._editUi.parentNode.removeChild(this._editUi),this._editUi=null)}}Ro.polyline=e=>{Bo(e)},Ro["polyline-arrow"]=(e,t)=>{Bo(e),No(e,t)},Ro.curve=e=>{Bo(e)},Ro["curve-arrow"]=(e,t)=>{Bo(e),No(e,t)},Ro["vertical-line"]=e=>{e.clampToGround=!1,Bo(e)},Ro["vertical-surface-line"]=e=>{e.clampToGround=!1,Bo(e)},Ro.polygon=e=>{Go(e),ko(e)},Ro.circle=e=>{Uo(e),ko(e)},Ro.rectangle=e=>{Vo(e),ko(e)},Oo({type:"sector",action:Ji,outline:!0,pointCount:3}),Oo({type:"db-arrow",action:Ki,outline:!0,pointCount:4}),Oo({type:"fine-arrow",action:Xi,outline:!0,pointCount:2});const Yo=t=>{let i;const o=[];let n=new e.Cartesian3(0,0,0);const r=[];let a,s,l;const c=U.createToolTip(t),d=Li.point;let p=!1;((t,i)=>{const o=t.scene,n=new e.ScreenSpaceEventHandler(o.canvas);let r;t.cesiumWidget.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),n.setInputAction(e=>{const n=o.pickPosition(e.position),a=(new Date).getTime();if(r&&a-r<270){const o=t.scene.pick(e.position);return void i(Fi.DRAW_DB_CLICK,{position:n,pickPrimitive:o?.primitive,windowPosition:e.position})}i(Fi.DRAW_ADD,{position:n}),r=(new Date).getTime()},e.ScreenSpaceEventType.LEFT_CLICK),n.setInputAction(e=>{const n=t.scene.pick(e.endPosition),r=o.pickPosition(e.endPosition);i(Fi.DRAW_MOVE,{position:r,pickPrimitive:n?.primitive,windowPosition:e.endPosition}),n&&i(Fi.DRAW_PICK,{position:r,pickPrimitive:n?.primitive,windowPosition:e.endPosition})},e.ScreenSpaceEventType.MOUSE_MOVE),n.setInputAction(()=>{i(Fi.DRAW_RIGHT_CLICK,{})},e.ScreenSpaceEventType.RIGHT_CLICK)})(t,(e,t)=>{a&&(["drawDbClick","drawPick","drawMove","drawRightClick"].includes(e)||a.isEditing)&&v[e]?.(t)});const h=new e.PrimitiveCollection;h.destroyPrimitives=!1,t.scene.primitives.add(h);const u=()=>{a&&(a.isEditing=!1,a.isDisAdd=!0,w(),P.id===a.id?g():(m(a.id),a={}))},m=e=>{const t=r.findIndex(t=>t.id===e);if(-1===t)return;const i=r[t];i.positions.length=0,r.splice(t,1),A.drawRemove&&A.drawRemove(i),setTimeout(()=>{i.measurePrimitive?.clearAllDiv(),h.remove(i?.primitives)},300)},g=()=>{if(P.id)return P.id="",a.isDisAdd=!0,a.isEditing=!0,P.originPosition?(a.positions.splice(P.index,1,P.originPosition),P.pointPrimitive.position=P.originPosition):a?.positions.splice(P.index,1),A.drawEditEnd&&A.drawEditEnd(a),setTimeout(()=>{a.isEditing=!1,a.isDisAdd=!1},300),n=new e.Cartesian3(0,0,0),s=void 0,void w();if((!Fo[a.shape]||Fo[a.shape]>2)&&a.positions&&a.positions.length>2){const e=p?2:1,t=a.pointPrimitives.get(a.positions.length-e);return a.pointPrimitives.remove(t),void a?.positions.splice(a.positions.length-e,1)}n=new e.Cartesian3(0,0,0),s=void 0,m(a.id),a={},w()},f=i=>{i||(i=a),t._element.style.cursor="default",n=new e.Cartesian3(0,0,0),i.positions.pop(),i.isDisAdd=!0,setTimeout(()=>{i.isEditing=!1,i.isDisAdd=!1,A.drawEnd&&A.drawEnd(i),a={}},300),s=void 0,l&&(i.pointPrimitives.remove(l),l=void 0),w()},v={drawAdd:({position:e})=>{if(a.positions.push(e),p=!1,P.id)return A.drawEditEnd&&A.drawEditEnd(a),P.id="",void f();D(e,a),A.drawAdd&&A.drawAdd(e,a),a.positions.length>Fo[a.shape]&&f()},drawMove:({position:e,windowPosition:t})=>{if(p=!0,b(),e&&!a.isDisAdd&&a.isEditing){if(w(t),P.id)a.positions.splice(P.index,1,e),P.pointPrimitive.position=e;else{const t=a.positions.findIndex(e=>e.x===n.x&&e.y===n.y&&e.z===n.z);a.positions.push(e),-1!==t&&a.positions.splice(t,1),l&&a.pointPrimitives.remove(l),l=D(e,a)}n=e,A.drawMove&&A.drawMove(e,a)}},drawPick:({pickPrimitive:t,windowPosition:i})=>{a.isEditing||t instanceof e.PointPrimitive&&y(t,i)},drawDbClick:({position:e,windowPosition:t,pickPrimitive:i})=>{if(a.isEditing){if(Fo[a.shape])return;f()}else!a.isEditing&&i&&C(e,t,i)},drawRightClick:()=>{a.isEditing?g():i.setVisible(!1)}},y=(e,i)=>{const n=e.id.split("-")[1],a=r.find(e=>e.id===n);o.includes(e.id)||a&&a.edit&&(t._element.style.cursor="pointer",e.pixelSize=1.5*d.pixelSize,e.outlineWidth=1.5*d.outlineWidth,s=e,c.showAt(i,Oi.pointEnter),c.setVisible(!0))},C=(t,n,a)=>{if(a instanceof e.PointPrimitive){if(o.includes(a.id))return;const e=a.id.split("-")[1],n=r.find(t=>t.id===e);if(!n)return;if(!n.edit)return;console.log(a),i.showAt(t,a,n.shape),A.drawEditStart&&A.drawEditStart(n)}},w=e=>{if(!c)return void(t._element.style.cursor="default");if(!e||!a.positions)return t._element.style.cursor="default",void c.setVisible(!1);const i=Fo[a.shape]?"default":"default-dbclick";P.id?c.showAt(e,Oi.drawEditMove[a.shape]||Oi.drawEditMove.default):Fo[a.shape]!==a.positions.length?a.positions.length>1?c.showAt(e,Oi.drawMove[i]||Oi.drawMove[i]):c.showAt(e,Oi.drawStart[i]||Oi.drawStart.default):c.showAt(e,Oi.drawEnd)},b=()=>{s&&(s.pixelSize=d.pixelSize,s.outlineWidth=d.outlineWidth,w())},P={},_={drawEditAdd:o=>{i.setVisible(!1);const{id:n,index:r,drawData:s}=x(o),l=new e.Cartesian3(o.position.x,o.position.y,o.position.z);s?.positions.splice(r,0,l),a=s;const c=D(l,a);t._element.style.cursor="move",Object.assign(P,{id:n,index:r+1,pointPrimitive:c,originPosition:l}),a.isEditing=!0},drawEditMove:o=>{i.setVisible(!1),t._element.style.cursor="move";const{id:n,index:r,drawData:s}=x(o);a=s,Object.assign(P,{id:n,index:r,pointPrimitive:o,originPosition:new e.Cartesian3(o.position.x,o.position.y,o.position.z)}),a.isEditing=!0},drawEditRemove:e=>{i.setVisible(!1);const{index:t,drawData:o}=x(e);o.isEditing=!0,o.isDisAdd=!0,o?.positions.splice(t,1),o?.pointPrimitives.remove(e),A.drawEditEnd&&A.drawEditEnd(o),setTimeout(()=>{o.isEditing=!1,o.isDisAdd=!1},300)},drawDelete:e=>{i.setVisible(!1);const{id:t}=x(e);m(t)}};i=Zo.createEditUi(t,_);const x=e=>{const t=e.id.split("-")[1],i=r.find(e=>e.id===t),o=i.positions.findIndex(t=>t.x===e.position.x&&t.y===e.position.y&&t.z===e.position.z);return{id:t,drawData:i,index:o}},M=(t,i)=>{const o=new e.PrimitiveCollection,n=new e.PointPrimitiveCollection;o.add(n);const r={id:t.id,edit:t.edit||!1,measure:t.measure||!1,measureLabel:t.measureLabel||!1,disDepthFail:t.disDepthFail||!1,measureUnit:t.measureUnit||["m"],isEditing:!0,shape:t.shape,positions:i,clampToGround:t.clampToGround,pointPrimitives:n,primitives:o};return h.add(o),i.forEach(e=>{D(e,r)}),r},D=(t,i)=>i.pointPrimitives.add({id:`draw-${i.id}-${N()}`,position:t,...d,color:e.Color.fromCssColorString(d.color),outlineColor:e.Color.fromCssColorString(d.outlineColor)}),E=e=>{const i=M({...e},e.positions);i.positions.push(i.positions[i.positions.length-1]),a=i,r.push(i),Lo(t,e.shape,i),e.measure&&$o(i,t),i.primitives.raiseToTop(i.pointPrimitives),f(i)},A={};return{draw:e=>{t._element.style.cursor="crosshair",s=void 0,e.id=N();const i=M(e,[]);a=i,A.drawStart&&A.drawStart(i),r.push(i),Lo(t,e.shape,i),e.measure&&$o(i,t),i.primitives.raiseToTop(i.pointPrimitives)},removeEditing:u,remove:e=>{m(e.id),w()},removeAll:()=>{r.forEach(e=>{e.measurePrimitive?.clearAllDiv()}),h.removeAll(),r.length=0,u()},setDrawStyle:e=>{Object.assign(Li.point,e.point),Object.assign(Li.polyline,e.polyline),Object.assign(Li.polygon,e.polygon)},Event:A,updateMeasureUnit:(e,t)=>{if(-1===r.findIndex(t=>t.id===e.id))throw new Error("绘制对象不存在");const i=e.primitives._primitives.find(e=>e instanceof Io);i&&i.updateUnit(t)},reShowDrawData:E,reShowDrawDatas:e=>{e.forEach(e=>{E(e)})}}};var Jo=Object.freeze({__proto__:null});const Ko={PolylineFlow:"PolylineFlow",PolylineTrail:"PolylineTrail",CircleWave:"CircleWave",CircleRaderWave:"CircleRaderWave",CircleRaderFan:"CircleRaderFan",LightWall:"LightWall",CircleAperture:"CircleAperture",RadarScanCircle:"RadarScanCircle",EllipsoidElectric:"EllipsoidElectric",EllipsoidVScan:"EllipsoidVScan",EllipsoidHScan:"EllipsoidHScan",Corridor:"Corridor",Zaps:"Zaps"};(()=>{for(const t in Ko)e.Material[t]=Ko[t]})();const Xo={color:"rgba(255,255,255,1)",speed:6*Math.random()};class Qo extends nt{speed;color;name="";image="";constructor(t){super(),this.createPropertyDescriptors();const i={...Xo,...t};this.image=i.image,this.name=`${Ko.PolylineTrail}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.speed=this.speed,i.image=this.image,i}equals(t){return this===t||t instanceof Qo&&this.speed===t.speed&&e.Property.equals(this.color,t.color)&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{image:this.image,color:e.Color.fromCssColorString("#ff0000"),speed:this.speed},source:tn},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const en=t=>{const i={...Xo,...t};return new e.Material({fabric:{type:`${Ko.PolylineTrail}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed},source:tn},translucent:!0})},tn="\n uniform sampler2D image;\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec4 colorImage = texture(image,st);\n vec3 fragColor = color.rgb;\n if(st.t > 0.45 && st.t < 0.55 ) {\n fragColor = vec3(1.0);\n }\n if(color.a == 0.0){\n material.alpha = colorImage.a * 1.5 * fract(st.s - time);\n material.diffuse = colorImage.rgb;\n }else{\n material.alpha = colorImage.a * color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));\n material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);\n }\n return material;\n }\n\n",on={color:"rgba(255,255,255,1)",speed:6,repeatCount:4,blendColor:!0};class nn extends nt{repeatCount;image;speed;color;blend;name="";constructor(t){super(),this.createPropertyDescriptors();const i={...on,...t};this.name=`${Ko.PolylineFlow}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.image=i.image,this.repeatCount=i.repeatCount,this.blend=i.blendColor?1:0,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.image=this.image,i.blend=this.blend,i.speed=this.speed,i.repeatCount=this.repeatCount,i}equals(e){return this===e||e instanceof nn&&this.speed===e.speed&&this.repeatCount===e.repeatCount&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:e.Color.fromCssColorString("#ffffff"),image:"",speed:this.speed,count:this.repeatCount,blend:this.blend},source:an},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const rn=t=>{const i={...on,...t};return new e.Material({fabric:{type:Ko.PolylineFlow+N(),uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed,count:i.repeatCount,blend:i.blendColor?1:0},source:an},translucent:!0})},an="\n uniform vec4 color;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract( count * st.s - time),fract(st.t)));\n material.alpha = colorImage.a * color.a;\n if(blend > 0.5) {\n material.diffuse = (colorImage.rgb + color.rgb) * 2.0;\n } else {\n material.diffuse = color.rgb * 2.0 ;\n }\n return material;\n }\n",sn={color:"rgba(255,255,0,0.3)",speed:8,count:5,gradient:.3};class ln extends nt{count;speed;gradient;color;name="";constructor(t){super(),t||(t={});const i={...sn,...t};this.name=`${Ko.CircleWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.count=i.count,this.gradient=i.gradient,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i.repeatCount=this.count||sn.count,i}equals(t){return this===t||t instanceof ln&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.count===t.count&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed,count:this.count,gradient:this.gradient},source:dn},translucent:()=>!0})}}const cn=t=>{const i={...sn,...t};return{material:new e.Material({fabric:{type:`${Ko.CircleWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed,count:i.count,gradient:i.gradient},source:dn},translucent:!0})}},dn="\n uniform vec4 color;\n uniform float speed;\n uniform float count;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber * speed / 1000.0);\n if(count == 1.0){\n if(dis > per * 0.5){\n discard;\n }else {\n material.alpha = color.a * dis / per / 2.0;\n }\n } else {\n vec3 str = materialInput.str;\n if(abs(str.z) > 0.001){\n discard;\n }\n if(dis > 0.5){\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n for(int i = 0; i <= 999; i++){\n if(float(i) <= count){\n disNum = perDis * float(i) - dis + per / count;\n if(disNum > 0.0){\n if(disNum < perDis){\n bl = 1.0 - disNum / perDis;\n }\n else if(disNum - perDis < perDis){\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\n }\n }\n }\n }\n }\n return material;\n }\n",pn={color:"rgba(255,255,255,1)",speed:8};class hn extends nt{speed;color;name="";constructor(t){super();const i={...pn,...t};this.name=`${Ko.CircleRaderWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof hn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:mn},translucent:()=>!0})}}const un=t=>{const i={...pn,...t};return{material:new e.Material({fabric:{type:`${Ko.CircleRaderWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:mn},translucent:!0})}},mn="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n float rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 pos = st - vec2(0.5);\n float time = czm_frameNumber * speed / 1000.0 ;\n float r = length(pos);\n float t = atan(pos.y, pos.x) - time * 2.5;\n float a = (atan(sin(t), cos(t)) + PI)/(2.0*PI);\n float ta = 0.5;\n float v = smoothstep(ta-0.05,ta+0.05,a) * smoothstep(ta+0.05,ta-0.05,a);\n vec3 flagColor = color.rgb * v;\n float blink = pow(sin(time*1.5)*0.5+0.5, 0.8);\n flagColor = color.rgb * pow(a, 4.0*(.2+blink))*(sin(r*500.0)*.5+.5) ;\n flagColor = flagColor * pow(r, 0.4);\n material.alpha = length(flagColor) * 1.3;\n material.diffuse = flagColor * 3.0;\n return material;\n }\n",gn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class fn extends nt{speed;color;name="";constructor(t){super();const i={...gn,...t};this.name=`${Ko.CircleRaderFan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof fn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:yn},translucent:()=>!0})}}const vn=t=>{const i={...gn,...t};return{material:new e.Material({fabric:{type:`${Ko.CircleRaderFan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:yn},translucent:!0})}},yn="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // 绘制边线\n float dis = distance(materialInput.st, vec2(0.5));\n float alpha = step((0.5- 0.01), dis);\n\n material.alpha = alpha;\n material.diffuse = color.rgb;\n\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n float per = czm_frameNumber * speed / PI * 3.0 / 200.0;\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + per;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = (alpha + color.a) * dis;\n material.diffuse = color.rgb;\n }\n return material;\n }\n",Cn={color:"rgba(255,255,0,0.3)",speed:8};class wn extends nt{speed;color;name="";constructor(t){super(),t||(t={});const i={...Cn,...t};this.name=`${Ko.CircleAperture}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i}equals(t){return this===t||t instanceof wn&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed},source:Pn},translucent:()=>!0})}}const bn=t=>{const i={...Cn,...t};return new e.Material({fabric:{type:`${Ko.CircleAperture}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Pn},translucent:!0})},Pn="\n uniform vec4 color;\n uniform float speed;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float d = distance(st, vec2(0.5, 0.5));\n float alpha = step(.15, d) * step(d, .17) + step(.49, d) * step(d, 0.5) + d * d * step(d, 0.5);\n float movingCircleD = fract(czm_frameNumber * speed / 1000.0);\n alpha += step(movingCircleD, d) * step(d, movingCircleD + .015);\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n",_n=t=>{t||(t={});return new e.Material({fabric:{type:`${Ko.RadarScanCircle}-${N()}`,uniforms:{radians:3*Math.PI/8,bgColor:e.Color.fromCssColorString(t.bgColor||"rgba(0,255,0,0.2)"),sectorColor:e.Color.fromCssColorString(t.sectorColor||"rgba(152,18,8,.1)"),width:t.width||.003,offset:t.offset||0,count:t.count||3},source:xn},translucent:!0})},xn="\n uniform vec4 bgColor;\n uniform vec4 sectorColor;\n uniform float count;\n uniform float radians;\n uniform float width;\n uniform float offset;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n\n float alpha;\n vec3 diffuse;\n // 绘制圆圈\n float sp = 1.0 / count / 2.0;\n float m = mod(dis, sp);\n alpha = step(sp * (1.0 - width * 10.0), m);\n // alpha = clamp(alpha, 0.2, 1.0);\n if (alpha < bgColor.a){\n alpha = bgColor.a;\n diffuse = bgColor.rgb;\n } else {\n diffuse = bgColor.rgb;\n }\n material.alpha = alpha;\n material.diffuse = diffuse;\n // 绘制十字线\n if ((st.s > 0.5 - width / 2.0 && st.s < 0.5 + width / 2.0) || (st.t > 0.5 - width / 2.0 && st.t < 0.5 + width / 2.0)) {\n material.alpha = 0.8;\n material.diffuse = bgColor.rgb;\n return material;\n }\n // 绘制光晕\n float ma = mod(dis + offset, 0.5);\n if (ma < 0.25){\n alpha = ma * 3.0 + alpha;\n } else{\n alpha = 3.0 * (0.5 - ma) + alpha;\n }\n material.alpha = alpha;\n material.diffuse = bgColor.rgb;\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + radians;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = alpha + sectorColor.a;\n material.diffuse = sectorColor.rgb;\n }\n return material;\n }\n",Mn={color:"rgba(255,255,255,1)",count:3,duration:1500};class Dn extends nt{duration;count;vertical;direction;color;_time;image;name="";constructor(t){super();const i={...Mn,...t};Object.prototype.hasOwnProperty.call(i,"vertical")||(i.vertical=1),this.name=`LightWall-${N()}`,this._time=(new Date).getTime(),this.color=e.Color.fromCssColorString(i.color),this.duration=i.duration,this.count=i.count,this.vertical=i.vertical,this.image=i.image,this.direction=i.direction,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.image=this.image,i.vertical=this.vertical,i.direction=this.direction,i.count=this.count,i.duration=this.duration,this.duration&&(i.time=((new Date).getTime()-this._time)%this.duration/this.duration),i}equals(t){return this===t||t instanceof Dn&&e.Property.equals(this.color,t.color)&&this.name===t.name&&this.image===t.image&&this.vertical===t.vertical&&this.direction===t.direction&&this.count===t.count&&this.duration===t.duration}init(){const t=An({count:this.count,vertical:this.vertical,direction:this.direction});e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,duration:this.duration,vertical:this.vertical,image:this.image,count:this.count,time:-20},source:t},translucent:()=>!0})}}const En=t=>{const i={...Mn,...t};return{material:new e.Material({fabric:{type:`LightWall${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),duration:i.duration,vertical:i.vertical,image:i.image,count:i.count,time:-20},source:An({count:i.count,vertical:i.vertical,direction:i.direction})}})}},An=e=>{const t=e.vertical?"vertical":"standard",i=e.direction?"+":"-";let o="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";return o+="vertical"===t?`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.t ${i} time)),fract(st.s));\n `:`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.s ${i} time), fract(st.t)));\n `,o+="vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a * color.a;\n material.emission = fragColor.rgb;\n return material;\n }",o},Sn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class In extends nt{speed;color;name="";constructor(t){super();const i={...Sn,...t};this.name=`${Ko.EllipsoidElectric}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof In&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:zn},translucent:()=>!0})}}const Tn=t=>{const i={...Sn,...t};return{material:new e.Material({fabric:{type:`${Ko.EllipsoidElectric}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:zn},translucent:!0})}},zn="\n uniform vec4 color;\n uniform float speed;\n #define pi 3.1415926535\n #define PI2RAD 0.01745329252\n #define TWO_PI (2. * PI)\n\n float rands(float p){\n return fract(sin(p) * 10000.0);\n }\n\n float noise(vec2 p){\n float time = fract( czm_frameNumber * speed / 1000.0);\n float t = time / 20000.0;\n\n if(t > 1.0) t -= floor(t);\n return rands(p.x * 14. + p.y * sin(t) * 0.5);\n }\n\n vec2 sw(vec2 p){\n return vec2(floor(p.x), floor(p.y));\n }\n\n vec2 se(vec2 p){\n return vec2(ceil(p.x), floor(p.y));\n }\n\n vec2 nw(vec2 p){\n return vec2(floor(p.x), ceil(p.y));\n }\n\n vec2 ne(vec2 p){\n return vec2(ceil(p.x), ceil(p.y));\n }\n\n float smoothNoise(vec2 p){\n vec2 inter = smoothstep(0.0, 1.0, fract(p));\n float s = mix(noise(sw(p)), noise(se(p)), inter.x);\n float n = mix(noise(nw(p)), noise(ne(p)), inter.x);\n return mix(s, n, inter.y);\n }\n\n float fbm(vec2 p){\n float z = 2.0;\n float rz = 0.0;\n vec2 bp = p;\n for(float i = 1.0; i < 6.0; i++){\n rz += abs((smoothNoise(p) - 0.5)* 2.0) / z;\n z *= 2.0;\n p *= 2.0;\n }\n return rz;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 st2 = materialInput.st;\n float time = fract( czm_frameNumber * speed / 1000.0);\n if (st.t < 0.5) {\n discard;\n }\n st *= 4.;\n float rz = fbm(st);\n st /= exp(mod( time * 2.0, pi));\n rz *= pow(15., 0.9);\n vec4 temp = vec4(0);\n temp = mix( color / rz, vec4(color.rgb, 0.1), 0.2);\n if (st2.s < 0.05) {\n temp = mix(vec4(color.rgb, 0.1), temp, st2.s / 0.05);\n }\n if (st2.s > 0.95){\n temp = mix(temp, vec4(color.rgb, 0.1), (st2.s - 0.95) / 0.05);\n }\n material.diffuse = temp.rgb;\n material.alpha = temp.a * 2.0;\n return material;\n }\n",Fn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Rn extends nt{speed;color;name="";constructor(t){super();const i={...Fn,...t};this.name=`${Ko.EllipsoidVScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Rn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Ln},translucent:()=>!0})}}const On=t=>{const i={...Fn,...t};return{material:new e.Material({fabric:{type:`${Ko.EllipsoidVScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Ln},translucent:!0})}},Ln="\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\n alpha += .1;\n material.alpha = alpha;\n material.diffuse = color.rgb;\n return material;\n }\n",Bn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class kn extends nt{speed;color;name="";constructor(t){super();const i={...Bn,...t};this.name=`${Ko.EllipsoidHScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof kn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Gn},translucent:()=>!0})}}const Nn=t=>{const i={...Bn,...t};return{material:new e.Material({fabric:{type:`${Ko.EllipsoidHScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Gn},translucent:!0})}},Gn="\nuniform vec4 color; \nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st; \n float t = fract( czm_frameNumber * speed / 1000.0);; \n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s); \n alpha += 0.1;\n alpha *= step(-0.5, -abs(0.5-st.t)); \n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n}\n",Un={color:"rgba(255,255,255,1)",speed:1};class Vn extends nt{color;speed;name="";constructor(t){super();const i={...Un,...t};this.name=Ko.Zaps,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i}equals(t){return this===t||t instanceof Vn&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(Ko.Zaps,{fabric:{type:Ko.Zaps,uniforms:{uColor:this.color,speed:this.speed,uResolution:new e.Cartesian2(1024,1024)},source:Hn},translucent:()=>!0})}}const $n=t=>{const i={...Un,...t};return{material:new e.Material({fabric:{type:Ko.Zaps,uniforms:{uColor:e.Color.fromCssColorString(i.color),uSpeed:i.speed,uResolution:new e.Cartesian2(1024,1024)},source:Hn}})}},Hn="\n uniform float uSpeed;\n uniform vec4 uColor;\n uniform vec2 uResolution;\n\n void mainImage(out vec4 o, vec2 u, float time)\n {\n vec2 v = uResolution.xy;\n u = .2*(u+u-v)/v.y;\n\n vec4 z = o = vec4(1,2,3,0);\n for (float a = .5, t = time, i;\n ++i < 19.;\n o += (1. + cos(z+t))\n / length((1.+i*dot(v,v))\n * sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))\n )\n v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,\n // use stanh here if shader has black artifacts\n // vvvv\n u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))\n ,u)\n * cos(1e2*u.yx + t)) / 2e2\n + .2 * a * u\n + cos(4./exp(dot(o,o)/1e2) + t) / 3e2;\n\n o = 25.6 / (min(o, 13.) + 164. / o)\n - dot(u, u) / 250.;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n float time = fract(czm_frameNumber * speed / 1000.0);\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec4 color = vec4(0.0,0.0,0.0,1.0);\n mainImage(color,materialInput.st * uResolution,time);\n\n material.diffuse = color.rgb * uColor.rgb;\n material.alpha = 0.33 + (sin(time * 0.3) + 1.0) / 3.0;\n return material;\n }\n ";class Wn extends ot{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){t?this.appearance=t:(this.appearance=new e.MaterialAppearance({material:_n(this.options.materialOptions||{}),flat:!1,faceForward:!1,translucent:!0,closed:!1,...this.options.appearanceOptions||{}}),this.options.viewer.scene.preRender.addEventListener(()=>{this.appearance.material.uniforms.radians+=3*Math.PI/300}))}}const qn=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let jn=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const n=o>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=qn[15&o];if(!r)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,r,t)}constructor(e,t=64,i=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=qn.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+r+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Zn(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,d=s.pop()||0,p=s.pop()||0;if(d-p<=a){for(let a=p;a<=d;a++){const s=r[2*a],c=r[2*a+1];s>=e&&s<=i&&c>=t&&c<=o&&l.push(n[a])}continue}const h=p+d>>1,u=r[2*h],m=r[2*h+1];u>=e&&u<=i&&m>=t&&m<=o&&l.push(n[h]),(0===c?e<=u:t<=m)&&(s.push(p),s.push(h-1),s.push(1-c)),(0===c?i>=u:o>=m)&&(s.push(h+1),s.push(d),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:n,nodeSize:r}=this,a=[0,o.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,d=a.pop()||0,p=a.pop()||0;if(d-p<=r){for(let i=p;i<=d;i++)Xn(n[2*i],n[2*i+1],e,t)<=l&&s.push(o[i]);continue}const h=p+d>>1,u=n[2*h],m=n[2*h+1];Xn(u,m,e,t)<=l&&s.push(o[h]),(0===c?e-i<=u:t-i<=m)&&(a.push(p),a.push(h-1),a.push(1-c)),(0===c?e+i>=u:t+i>=m)&&(a.push(h+1),a.push(d),a.push(1-c))}return s}};function Zn(e,t,i,o,n,r){if(n-o<=i)return;const a=o+n>>1;Yn(e,t,a,o,n,r),Zn(e,t,i,o,a-1,1-r),Zn(e,t,i,a+1,n,1-r)}function Yn(e,t,i,o,n,r){for(;n>o;){if(n-o>600){const a=n-o+1,s=i-o+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Yn(e,t,i,Math.max(o,Math.floor(i-s*c/a+d)),Math.min(n,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=o,l=n;for(Jn(e,t,o,i),t[2*n+r]>a&&Jn(e,t,o,n);s<l;){for(Jn(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*o+r]===a?Jn(e,t,o,l):(l++,Jn(e,t,l,n)),l<=i&&(o=l+1),i<=l&&(n=l-1)}}function Jn(e,t,i,o){Kn(e,i,o),Kn(t,2*i,2*o),Kn(t,2*i+1,2*o+1)}function Kn(e,t,i){const o=e[t];e[t]=e[i],e[i]=o}function Xn(e,t,i,o){const n=e-i,r=t-o;return n*n+r*r}const Qn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},er=Math.fround||(tr=new Float32Array(1),e=>(tr[0]=+e,tr[0]));var tr;class ir{constructor(e){this.options=Object.assign(Object.create(Qn),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:o}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[o,n]=i.geometry.coordinates,a=er(rr(o)),s=er(ar(n));r.push(a,s,1/0,t,-1,1),this.options.reduce&&r.push(0)}let a=this.trees[o+1]=this._createTree(r);t&&console.timeEnd(n);for(let e=o;e>=i;e--){const i=+Date.now();a=this.trees[e]=this._createTree(this._cluster(a,e)),t&&console.log("z%d: %d clusters in %dms",e,a.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,o,180,r],t),a=this.getClusters([-180,o,n,r],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(rr(i),ar(r),rr(n),ar(o)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+5]>1?or(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),o="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(o);const r=n.data;if(t*this.stride>=r.length)throw new Error(o);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r[t*this.stride],l=r[t*this.stride+1],c=n.within(s,l,a),d=[];for(const t of c){const i=t*this.stride;r[i+4]===e&&d.push(r[i+5]>1?or(r,i,this.clusterProps):this.points[r[i+3]])}if(0===d.length)throw new Error(o);return d}getLeaves(e,t,i){t=t||10,i=i||0;const o=[];return this._appendLeaves(o,e,t,i,0),o}getTile(e,t,i){const o=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:r,radius:a}=this.options,s=a/r,l=(i-s)/n,c=(i+1+s)/n,d={features:[]};return this._addTileFeatures(o.range((t-s)/n,l,(t+1+s)/n,c),o.data,t,i,n,d),0===t&&this._addTileFeatures(o.range(1-s/n,l,1,c),o.data,n,i,n,d),t===n-1&&this._addTileFeatures(o.range(0,l,s/n,c),o.data,-1,i,n,d),d.features.length?d:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,o,n){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?n+r.point_count<=o?n+=r.point_count:n=this._appendLeaves(e,r.cluster_id,i,o,n):n<o?n++:e.push(t),e.length===i)break}return n}_createTree(e){const t=new jn(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,o,n,r){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,d;if(s)l=nr(t,e,this.clusterProps),c=t[e],d=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[o,n]=i.geometry.coordinates;c=rr(o),d=ar(n)}const p={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(d*n-o))]],tags:l};let h;h=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==h&&(p.id=h),r.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:o,reduce:n,minPoints:r}=this.options,a=i/(o*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=t)continue;s[i+2]=t;const o=s[i],d=s[i+1],p=e.within(s[i],s[i+1],a),h=s[i+5];let u=h;for(const e of p){const i=e*c;s[i+2]>t&&(u+=s[i+5])}if(u>h&&u>=r){let e,r=o*h,a=d*h,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const o of p){const l=o*c;if(s[l+2]<=t)continue;s[l+2]=t;const d=s[l+5];r+=s[l]*d,a+=s[l+1]*d,s[l+4]=g,n&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(s,l)))}s[i+4]=g,l.push(r/u,a/u,1/0,g,-1,u),n&&l.push(m)}else{for(let e=0;e<c;e++)l.push(s[i+e]);if(u>1)for(const e of p){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const o=this.clusterProps[e[t+6]];return i?Object.assign({},o):o}const o=this.points[e[t+3]].properties,n=this.options.map(o);return i&&n===o?Object.assign({},n):n}}function or(e,t,i){return{type:"Feature",id:e[t+3],properties:nr(e,t,i),geometry:{type:"Point",coordinates:[(o=e[t],360*(o-.5)),sr(e[t+1])]}};var o}function nr(e,t,i){const o=e[t+5],n=o>=1e4?`${Math.round(o/1e3)}k`:o>=1e3?Math.round(o/100)/10+"k":o,r=e[t+6],a=-1===r?{}:Object.assign({},i[r]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:o,point_count_abbreviated:n})}function rr(e){return e/360+.5}function ar(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function sr(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}class lr extends ot{options;pointPrimitives=new e.PrimitiveCollection;boundingSphere=new e.BoundingSphere(e.Cartesian3.ZERO,0);pointCollection;labelCollection;billboardCollection;clusterImageCache={};supercluster;constructor(t){super(),this.options=t,this.clacBoundingSphere(this.options.geoJson),this.options.point&&(this.pointCollection=new e.PointPrimitiveCollection,this.pointPrimitives.add(this.pointCollection)),this.options.billboard&&(this.billboardCollection=new e.BillboardCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.billboardCollection)),this.options.label&&(this.labelCollection=new e.LabelCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.labelCollection)),t.cluster?(this.supercluster=new ir({radius:this.options.cluster?.radius||hr.radius,maxZoom:this.options.cluster?.maxZoom||hr.maxZoom}),this.initCluster(this.options.viewer,this.options.geoJson)):this.initCollection(this.options.geoJson)}initCollection=async t=>{await this.calcPointHeight(this.options.viewer,t);const i=[];t.features.forEach(t=>{if(i.push(e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),this.options.point){this.pointCollection.add(this.createPoint(t)).properties=t.properties||{}}if(this.options.billboard){this.billboardCollection.add(this.createBillboard(t)).properties=t.properties||{}}if(this.options.label){this.labelCollection.add(this.createLabel(t)).properties=t.properties||{}}})};clacBoundingSphere(t){const i=t.features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0));e.BoundingSphere.fromPoints(i,this.boundingSphere)}createPoint(t){const i={...cr,...this.options.point,...t.properties?.style?.point};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]),color:e.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,outlineColor:e.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createBillboard(t){const i={...pr,...this.options.billboard,...t.properties?.style?.billboard};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),image:i.image,scale:i.scale,width:t.properties?.cluster?void 0:i.width,height:t.properties?.cluster?void 0:i.height,color:t.properties?.cluster?void 0:e.Color.fromCssColorString(i.color),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i.heightReference,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createLabel(t){const i={...dr,...this.options.label,...t.properties?.style?.label};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),text:t.properties?.[i?.field]||i?.field,font:i?.font,fillColor:e.Color.fromCssColorString(i?.fillColor),outlineColor:e.Color.fromCssColorString(i?.outlineColor),outlineWidth:i?.outlineWidth,style:i?.style,scale:i?.scale,showBackground:i?.showBackground,backgroundColor:e.Color.fromCssColorString(i?.backgroundColor),backgroundPadding:e.Cartesian2.fromArray(i?.backgroundPadding),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i?.heightReference,scaleByDistance:i?.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i?.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}initCluster=async(t,i)=>{this.supercluster.load(i.features);let o=e.getTimestamp();this.loadCluster(t),t.camera.changed.addEventListener(()=>{e.getTimestamp()-o<=500||(o=e.getTimestamp(),this.loadCluster(t))})};flyToChildByClusterId(t){const i=this.supercluster?.getChildren(t),o=i?.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),n=e.BoundingSphere.fromPoints(o);return this.options.viewer.camera.flyToBoundingSphere(n),i}loadCluster=t=>{const i=Qe(t.camera),o=t.camera.computeViewRectangle(),n=this.supercluster.getClusters([e.Math.toDegrees(o.west),e.Math.toDegrees(o.south),e.Math.toDegrees(o.east),e.Math.toDegrees(o.north)],i);this.clearCollection();const r=this.options.cluster.colorsByRate||hr.colorsByRate,a={type:"FeatureCollection",features:n.map(e=>{const t=e.properties.point_count/this.options.geoJson.features.length,o=Object.keys(r).find(e=>t>Number(e))||"#ff0000";if(e.properties.cluster){const t=this.getClusterImageByCount(r[o],e.properties.point_count,i),n=16*(String(e.properties.point_count).length+1);e.properties.style={...e.properties.style,billboard:{...e.properties.style?.billboard,image:t,pixelOffset:[0,-n/12]}}}return e})};this.initCollection(a)};getClusterImageByCount(t,i,o){if(!this.clusterImageCache[i+t]){const n=16*(String(i).length+1);let r=-Math.PI/12;const a=Math.PI/2,s=Math.PI/6,l=document.createElement("canvas");l.width=n,l.height=n;const c=l.getContext("2d");c.save(),c.scale(n/24,n/24),c.beginPath(),c.arc(12,12,6,0,2*Math.PI),c.fillStyle=t,c.fill(),c.closePath(),c.lineWidth=2,c.fillStyle="rgba(255,255,255,1)",c.font=`${this.calcfontSize(o)}px Microsoft YaHei`,c.textAlign="center",c.textBaseline="middle",c.fillText(`${i}`,11.5,12.5);for(let i=0;i<3;i++)c.beginPath(),c.arc(12,12,8,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.4).toCssColorString(),c.stroke(),c.arc(12,12,11,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.2).toCssColorString(),c.stroke(),c.closePath(),r=r+a+s;c.restore(),this.clusterImageCache[i+t]=l.toDataURL()}return this.clusterImageCache[i+t]}calcfontSize(e){return e<4?4:e-1}async calcPointHeight(t,i){if(this.options.calcHeight)if(t.scene.terrainProvider instanceof e.EllipsoidTerrainProvider)i.features.forEach(e=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=0:e.geometry.coordinates.push(0)});else{const o=t.scene.terrainProvider,n=i.features.map(t=>e.Cartographic.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),r=await e.sampleTerrainMostDetailed(o,n);i.features.forEach((e,t)=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=r[t].height:e.geometry.coordinates.push(r[t].height)})}}clearCollection(){this.pointCollection?.removeAll(),this.billboardCollection?.removeAll(),this.labelCollection?.removeAll()}remove(){}removeAll(){this.clearCollection(),this.pointPrimitives.removeAll()}getPrimitive(){return this.pointPrimitives}}const cr={color:"rgba(81,255,0,0.8)",pixelSize:10,outlineColor:"rgba(255,0,0,0.8)",outlineWidth:1},dr={font:"20px sans-serif",fillColor:"rgba(255,255,255,0.8)",outlineColor:"rgba(0,0,0,0.8)",backgroundColor:"rgba(0,0,0,1)",outlineWidth:2,pixelOffset:[0,0],backgroundPadding:[0,0],scale:1,disableDepthTestDistance:0,horizontalOrigin:0,verticalOrigin:0,heightReference:e.HeightReference.CLAMP_TO_GROUND},pr={image:"/icons/cesium-marker.png",scale:1,color:"rgba(255,0,0,1)",rotation:0,width:32,height:32,horizontalOrigin:0,verticalOrigin:0,pixelOffset:[0,-16],heightReference:e.HeightReference.CLAMP_TO_GROUND},hr={radius:60,maxZoom:25,colorsByRate:{.1:"#ff0000",.01:"#ff00ff",.001:"blue",1e-4:"#00ff00"}},ur={width:2,color:"rgba(0,255,0,0.8)"};class mr extends ot{options;polylinePrimitives;constructor(e){super(),this.options=e,this.polylinePrimitives=void 0,this.options.material&&this.setMaterialAppearance(),this.initCollection()}initCollection(){const t=[],i=[];let o;this.options.geoJson.features.forEach(e=>{"MultiLineString"===e.geometry.type?e.geometry.coordinates.forEach(t=>{i.push({coordinates:t,properties:e.properties})}):i.push({coordinates:e.geometry.coordinates,properties:e.properties})}),i.forEach(i=>{const o=i.coordinates.map(t=>e.Cartesian3.fromDegrees(t[0],t[1],t[2])),n={...ur,...this.options?.line,...i.properties?.style?.line};t.push(new e.GeometryInstance({id:N(),geometry:new e.GroundPolylineGeometry({positions:o,width:n?.width}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(n.color))}}))}),o=this.appearance?this.appearance:new e.PolylineColorAppearance,this.polylinePrimitives=new e.GroundPolylinePrimitive({geometryInstances:t,appearance:o})}getPrimitive(){return this.polylinePrimitives}setMaterialAppearance(){this.appearance=new e.MaterialAppearance({material:this.options.material})}}const gr={width:2,color:"rgba(0,255,0,0.8)"};class fr extends ot{options;primitives;constructor(e){super(),this.options=e,this.primitives=void 0,this.initCollection()}initCollection(){const t=[];this.options.geoJson.features.forEach(i=>{let o;o="Polygon"===i.geometry.type?new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(i.geometry.coordinates[0].flat())):vr(i.geometry);const n={...gr,...this.options?.line,...i.properties?.style?.line},r=N();i.properties&&(i.properties.id=r);const a=new e.GeometryInstance({id:r,geometry:new e.PolygonGeometry({polygonHierarchy:o}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(n.color))}});t.push(a),a.properties=i.properties}),this.primitives=new e.GroundPrimitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({})})}getPrimitive(){return this.primitives}getAppearance(t){this.appearance=t||new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("rgba(81,255,0,0.8)")})})}}const vr=t=>new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(t.coordinates[0][0].flat()));function yr(e,t,i,o,n,r){if(n-o<=i)return;const a=o+n>>1;Cr(e,t,a,o,n,r%2),yr(e,t,i,o,a-1,r+1),yr(e,t,i,a+1,n,r+1)}function Cr(e,t,i,o,n,r){for(;n>o;){if(n-o>600){const a=n-o+1,s=i-o+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Cr(e,t,i,Math.max(o,Math.floor(i-s*c/a+d)),Math.min(n,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=o,l=n;for(wr(e,t,o,i),t[2*n+r]>a&&wr(e,t,o,n);s<l;){for(wr(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*o+r]===a?wr(e,t,o,l):(l++,wr(e,t,l,n)),l<=i&&(o=l+1),i<=l&&(n=l-1)}}function wr(e,t,i,o){br(e,i,o),br(t,2*i,2*o),br(t,2*i+1,2*o+1)}function br(e,t,i){const o=e[t];e[t]=e[i],e[i]=o}function Pr(e,t,i,o){const n=e-i,r=t-o;return n*n+r*r}const _r=e=>e[0],xr=e=>e[1];class Mr{constructor(e,t=_r,i=xr,o=64,n=Float64Array){this.nodeSize=o,this.points=e;const r=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new r(e.length),s=this.coords=new n(2*e.length);for(let o=0;o<e.length;o++)a[o]=o,s[2*o]=t(e[o]),s[2*o+1]=i(e[o]);yr(a,s,o,0,a.length-1,0)}range(e,t,i,o){return function(e,t,i,o,n,r,a){const s=[0,e.length-1,0],l=[];let c,d;for(;s.length;){const p=s.pop(),h=s.pop(),u=s.pop();if(h-u<=a){for(let a=u;a<=h;a++)c=t[2*a],d=t[2*a+1],c>=i&&c<=n&&d>=o&&d<=r&&l.push(e[a]);continue}const m=Math.floor((u+h)/2);c=t[2*m],d=t[2*m+1],c>=i&&c<=n&&d>=o&&d<=r&&l.push(e[m]);const g=(p+1)%2;(0===p?i<=c:o<=d)&&(s.push(u),s.push(m-1),s.push(g)),(0===p?n>=c:r>=d)&&(s.push(m+1),s.push(h),s.push(g))}return l}(this.ids,this.coords,e,t,i,o,this.nodeSize)}within(e,t,i){return function(e,t,i,o,n,r){const a=[0,e.length-1,0],s=[],l=n*n;for(;a.length;){const c=a.pop(),d=a.pop(),p=a.pop();if(d-p<=r){for(let n=p;n<=d;n++)Pr(t[2*n],t[2*n+1],i,o)<=l&&s.push(e[n]);continue}const h=Math.floor((p+d)/2),u=t[2*h],m=t[2*h+1];Pr(u,m,i,o)<=l&&s.push(e[h]);const g=(c+1)%2;(0===c?i-n<=u:o-n<=m)&&(a.push(p),a.push(h-1),a.push(g)),(0===c?i+n>=u:o+n>=m)&&(a.push(h+1),a.push(d),a.push(g))}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}function Dr(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT),this._enabled=e.defaultValue(t.enabled,!1),this._pixelRange=e.defaultValue(t.pixelRange,80),this._minimumClusterSize=e.defaultValue(t.minimumClusterSize,2),this._clusterBillboards=e.defaultValue(t.clusterBillboards,!0),this._clusterLabels=e.defaultValue(t.clusterLabels,!0),this._clusterPoints=e.defaultValue(t.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=e.defaultValue(t.show,!0)}function Er(e){return e.coord.x}function Ar(e){return e.coord.y}function Sr(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const Ir=new e.BoundingRectangle;function Tr(t,i,o,n,r){if(e.defined(t._labelCollection)&&n._clusterLabels?r=e.Label.getScreenSpaceBoundingBox(t,i,r):e.defined(t._billboardCollection)&&n._clusterBillboards?r=e.Billboard.getScreenSpaceBoundingBox(t,i,r):e.defined(t._pointPrimitiveCollection)&&n._clusterPoints&&(r=e.PointPrimitive.getScreenSpaceBoundingBox(t,i,r)),Sr(r,o),n._clusterLabels&&!e.defined(t._labelCollection)&&e.defined(t.id)&&Rr(n,t.id.id)&&e.defined(t.id._label)){const a=n._collectionIndicesByEntity[t.id.id].labelIndex,s=n._labelCollection.get(a),l=e.Label.getScreenSpaceBoundingBox(s,i,Ir);Sr(l,o),r=e.BoundingRectangle.union(r,l,r)}return r}function zr(t,i){if(t.clusterShow=!0,!e.defined(t._labelCollection)&&e.defined(t.id)&&Rr(i,t.id.id)&&e.defined(t.id._label)){const e=i._collectionIndicesByEntity[t.id.id].labelIndex;i._labelCollection.get(e).clusterShow=!0}}function Fr(e,t,i,o){const n={billboard:o._clusterBillboardCollection.add(),label:o._clusterLabelCollection.add(),point:o._clusterPointCollection.add()};n.billboard.show=!1,n.point.show=!1,n.label.show=!0,n.label.text=t.toLocaleString(),n.label.id=i,n.billboard.position=n.label.position=n.point.position=e,o._clusterEvent.raiseEvent(i,n)}function Rr(t,i){return e.defined(t)&&e.defined(t._collectionIndicesByEntity[i])&&e.defined(t._collectionIndicesByEntity[i].labelIndex)}function Or(t,i,o,n,r){if(!e.defined(t))return;const a=t.length;for(let s=0;s<a;++s){const a=t.get(s);if(a.clusterShow=!1,!a.show||r._scene.mode===e.SceneMode.SCENE3D&&!n.isPointVisible(a.position))continue;const l=a.computeScreenSpacePosition(o);e.defined(l)&&i.push({index:s,collection:t,clustered:!1,coord:l})}}const Lr=new e.BoundingRectangle,Br=new e.BoundingRectangle,kr=new e.BoundingRectangle;function Nr(t,i,o,n){return function(r){let a=this[t];e.defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s,l,c=this._collectionIndicesByEntity[r.id];if(e.defined(c)||(c=this._collectionIndicesByEntity[r.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),e.defined(a)&&e.defined(c[n]))return a.get(c[n]);e.defined(a)||(a=this[t]=new i({scene:this._scene}));const d=this[o];return d.length>0?(s=d.pop(),l=a.get(s)):(l=a.add(),s=a.length-1),c[n]=s,Promise.resolve().then(()=>{this._clusterDirty=!0}),l}}function Gr(t,i){const o=t._collectionIndicesByEntity[i];e.defined(o.billboardIndex)||e.defined(o.labelIndex)||e.defined(o.pointIndex)||delete t._collectionIndicesByEntity[i]}function Ur(t){if(!e.defined(t))return;const i=t.length;for(let e=0;e<i;++e)t.get(e).clusterShow=!0}Dr.prototype._initialize=function(t){this._scene=t;const i=(o=this,function(t){if(e.defined(t)&&t<.05||!o.enabled)return;const i=o._scene,n=o._labelCollection,r=o._billboardCollection,a=o._pointCollection;if(!e.defined(n)&&!e.defined(r)&&!e.defined(a)||!o._clusterBillboards&&!o._clusterLabels&&!o._clusterPoints)return;let s=o._clusterLabelCollection,l=o._clusterBillboardCollection,c=o._clusterPointCollection;e.defined(s)?s.removeAll():s=o._clusterLabelCollection=new e.LabelCollection({scene:i}),e.defined(l)?l.removeAll():l=o._clusterBillboardCollection=new e.BillboardCollection({scene:i}),e.defined(c)?c.removeAll():c=o._clusterPointCollection=new e.PointPrimitiveCollection;const d=o._pixelRange,p=o._minimumClusterSize,h=o._previousClusters,u=[],m=o._previousHeight,g=i.camera.positionCartographic.height,f=i.mapProjection.ellipsoid,v=i.camera.positionWC,y=new e.EllipsoidalOccluder(f,v),C=[];let w,b,P,_,x,M,D,E,A,S,I,T;o._clusterLabels&&Or(n,C,i,y,o),o._clusterBillboards&&Or(r,C,i,y,o),o._clusterPoints&&Or(a,C,i,y,o);const z=new Mr(C,Er,Ar,64,Int32Array);if(g<m)for(P=h.length,w=0;w<P;++w){const t=h[w];if(!y.isPointVisible(t.position))continue;const n=e.Billboard._computeScreenSpacePosition(e.Matrix4.IDENTITY,t.position,e.Cartesian3.ZERO,e.Cartesian2.ZERO,i);if(!e.defined(n))continue;const r=1-g/m;let a=t.width=t.width*r,s=t.height=t.height*r;a=Math.max(a,t.minimumWidth),s=Math.max(s,t.minimumHeight);const l=n.x-.5*a,c=n.y-.5*s,d=n.x+a,f=n.y+s;for(x=z.range(l,c,d,f),M=x.length,S=0,A=[],b=0;b<M;++b)D=x[b],E=C[D],E.clustered||(++S,I=E.collection,T=E.index,A.push(I.get(T).id));if(S>=p)for(Fr(t.position,S,A,o),u.push(t),b=0;b<M;++b)C[x[b]].clustered=!0}for(P=C.length,w=0;w<P;++w){const t=C[w];if(t.clustered)continue;t.clustered=!0,I=t.collection,T=t.index;const i=I.get(T);_=Tr(i,t.coord,d,o,Lr);const n=e.BoundingRectangle.clone(_,Br);x=z.range(_.x,_.y,_.x+_.width,_.y+_.height),M=x.length;const r=e.Cartesian3.clone(i.position);for(S=1,A=[i.id],b=0;b<M;++b)if(D=x[b],E=C[D],!E.clustered){const t=E.collection.get(E.index),i=Tr(t,E.coord,d,o,kr);e.Cartesian3.add(t.position,r,r),e.BoundingRectangle.union(n,i,n),++S,A.push(t.id)}if(S>=p){const t=e.Cartesian3.multiplyByScalar(r,1/S,r);for(Fr(t,S,A,o),u.push({position:t,width:n.width,height:n.height,minimumWidth:_.width,minimumHeight:_.height}),b=0;b<M;++b)C[x[b]].clustered=!0}else zr(i,o)}0===s.length&&(s.destroy(),o._clusterLabelCollection=void 0),0===l.length&&(l.destroy(),o._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),o._clusterPointCollection=void 0),o._previousClusters=u,o._previousHeight=g});var o;this._cluster=i,this._removeEventListener=t.camera.changed.addEventListener(i)},Object.defineProperties(Dr.prototype,{enabled:{get(){return this._enabled},set(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get(){return this._pixelRange},set(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get(){return this._minimumClusterSize},set(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get(){return this._clusterEvent}},clusterBillboards:{get(){return this._clusterBillboards},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get(){return this._clusterLabels},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get(){return this._clusterPoints},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),Dr.prototype.getLabel=Nr("_labelCollection",e.LabelCollection,"_unusedLabelIndices","labelIndex"),Dr.prototype.removeLabel=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._labelCollection)||!e.defined(i)||!e.defined(i.labelIndex))return;const o=i.labelIndex;i.labelIndex=void 0,Gr(this,t.id);const n=this._labelCollection.get(o);n.show=!1,n.text="",n.id=void 0,this._unusedLabelIndices.push(o),this._clusterDirty=!0},Dr.prototype.getBillboard=Nr("_billboardCollection",e.BillboardCollection,"_unusedBillboardIndices","billboardIndex"),Dr.prototype.removeBillboard=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._billboardCollection)||!e.defined(i)||!e.defined(i.billboardIndex))return;const o=i.billboardIndex;i.billboardIndex=void 0,Gr(this,t.id);const n=this._billboardCollection.get(o);n.id=void 0,n.show=!1,n.image=void 0,this._unusedBillboardIndices.push(o),this._clusterDirty=!0},Dr.prototype.getPoint=Nr("_pointCollection",e.PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),Dr.prototype.removePoint=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._pointCollection)||!e.defined(i)||!e.defined(i.pointIndex))return;const o=i.pointIndex;i.pointIndex=void 0,Gr(this,t.id);const n=this._pointCollection.get(o);n.show=!1,n.id=void 0,this._unusedPointIndices.push(o),this._clusterDirty=!0},Dr.prototype.update=function(t){if(!this.show)return;let i;var o;e.defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(i=t.commandList,t.commandList=[],this._labelCollection.update(t),t.commandList=i),e.defined(this._billboardCollection)&&this._billboardCollection.length>0&&!e.defined(this._billboardCollection.get(0).width)&&(i=t.commandList,t.commandList=[],this._billboardCollection.update(t),t.commandList=i),this._enabledDirty&&(this._enabledDirty=!1,(o=this).enabled||(e.defined(o._clusterLabelCollection)&&o._clusterLabelCollection.destroy(),e.defined(o._clusterBillboardCollection)&&o._clusterBillboardCollection.destroy(),e.defined(o._clusterPointCollection)&&o._clusterPointCollection.destroy(),o._clusterLabelCollection=void 0,o._clusterBillboardCollection=void 0,o._clusterPointCollection=void 0,Ur(o._labelCollection),Ur(o._billboardCollection),Ur(o._pointCollection)),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),e.defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(t),e.defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(t),e.defined(this._clusterPointCollection)&&this._clusterPointCollection.update(t),e.defined(this._labelCollection)&&this._labelCollection.update(t),e.defined(this._billboardCollection)&&this._billboardCollection.update(t),e.defined(this._pointCollection)&&this._pointCollection.update(t)},Dr.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),e.defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};class Vr extends ot{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;this.needUpdate=!1;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){this.appearance=t||new e.MaterialAppearance({material:bn(this.options.materialOptions),flat:!1,faceForward:!1,translucent:!0,closed:!1})}}class $r extends ot{gridPrimitiveCollection=new e.PrimitiveCollection;polygonPrimitive;outlinePrimitive;options;constructor(t){super(),this.options=t,this.gridPrimitiveCollection=new e.PrimitiveCollection,this.polygonPrimitive=this.createGridPolygonPrimitive(),this.outlinePrimitive=this.createGridOutlinePrimitive()}createGridPolygonPrimitive(){if(!this.options.fill)return;const t=[];this.options.vertices.forEach(i=>{const o=e.Color.fromCssColorString(this.options.fillColor),n=Nt(i.positions,o,`grid-${i.id}`);t.push(n)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({flat:!0,translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}createGridOutlinePrimitive(){if(!this.options.outline)return;const t=[];this.options.vertices.forEach(i=>{const o=e.Color.fromCssColorString(this.options.outlineColor),n=Gt(i.positions,o,`grid-${i.id}`);t.push(n)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PolylineColorAppearance({translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}getPrimitive(){return this.gridPrimitiveCollection}selectGrids(t){const i=e.Color.fromCssColorString(this.options.fillSelectColor),o=e.Color.fromCssColorString(this.options.outlineSelectColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(o)}})}unSelectGrids(t){const i=e.Color.fromCssColorString(this.options.fillColor),o=e.Color.fromCssColorString(this.options.outlineColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(o)}})}}const Hr=t=>{const i=[],o={LEFT_CLICK:[]};return t.scene.postRender.addEventListener(()=>{i.forEach(i=>{if(i.distanceDisplayCondition){const o=e.Cartesian3.distance(i.position,t.camera.position);if(o>=i.distanceDisplayCondition.far||o<=i.distanceDisplayCondition.near)return void(i.divEle.style.display="none")}const o=t.scene.cartesianToCanvasCoordinates(i.position);if(o){i.divEle.style.display="block";const e=i.divEle.getBoundingClientRect();let t=2;"left"===i.align&&(t=e.width+i.offset.x),"right"===i.align&&(t=1),i.divEle.style.left=o.x/i.autoFit.x-(e.width+i.offset.x)/i.autoFit.x/t+"px",i.divEle.style.top=o.y/i.autoFit.y-(e.height+i.offset.y)/i.autoFit.y+"px"}else i.divEle.style.display="none"})}),{divLabels:i,set:n=>{const r={id:n.divEle.id||N(),...n};return r.autoFit||(r.autoFit=e.Cartesian2.fromElements(1,1)),r.offset||(r.offset=e.Cartesian2.fromElements(0,0)),r.align||(r.align="center"),r.divEle.id=r.id,r.divEle.style.position="absolute",r.userSelect||(r.divEle.style.userSelect="none"),r.parentEle?(r.parentEle.style.position="relative",r.parentEle.appendChild(r.divEle)):(t._element.style.position="relative",t._element.appendChild(r.divEle)),i.push(r),r.divEle.addEventListener("click",()=>{o.LEFT_CLICK.forEach(e=>{e(r)})}),r},setPosition:(e,t)=>{const o=i.findIndex(t=>t.id===e);if(-1!==o){i[o].position=t}},remove:e=>{const t=i.findIndex(t=>t.id===e.id);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},removeAll:()=>{i.forEach(e=>{e.divEle.remove()}),i.length=0},removeById:e=>{const t=i.findIndex(t=>t.id===e);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},addEventListener:(e,t)=>{o[e]&&o[e].push(t)}}},Wr=t=>{const i=new e.ClippingPlaneCollection({edgeColor:e.Color.YELLOW,enabled:!0,modelMatrix:e.Matrix4.IDENTITY,edgeWidth:2});t.scene.globe.clippingPlanes=i,t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{Object.assign(t,{unionClippingRegions:!1,...t}),i.unionClippingRegions=t.unionClippingRegions||!1,i.removeAll();let o=t?.positions;o=t.unionClippingRegions?c(o):d(o),o.forEach((t,n)=>{const r=(n+1)%o.length,a=o[r];let s=e.Cartesian3.add(t,a,new e.Cartesian3);s=e.Cartesian3.multiplyByScalar(s,.5,s);const l=e.Cartesian3.normalize(s,new e.Cartesian3);let c=e.Cartesian3.subtract(a,s,new e.Cartesian3);c=e.Cartesian3.normalize(c,c);let d=e.Cartesian3.cross(c,l,new e.Cartesian3);d=e.Cartesian3.normalize(d,d);const p=new e.Plane(d,0),h=e.Plane.getPointDistance(p,s);i.add(new e.ClippingPlane(d,h))})},remove:()=>{i.removeAll()},removeAll:()=>{i.removeAll()},destroy:()=>{}}},qr=t=>{const i=new e.ClippingPolygonCollection;t.scene.globe.clippingPolygons=i;const o=new e.CustomDataSource("clipPolygon");t.dataSources.add(o),t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{t={inverse:!1,...t};const n=t?.positions,r=new e.ClippingPolygon({positions:n});i.add(r);const a=u(p(n).map(e=>(e.height=-t.depth,e))),s=o.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});o.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,extrudedHeight:t.depth,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});return{id:N(),polygon:r,bottomEntity:s}},remove:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,o.entities.removeAll()},removeAll:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,o.entities.removeAll()},destroy:()=>{}}},jr=t=>{const i=new e.CustomDataSource("flood-analysis");t.dataSources.add(i);return{set:e=>{const{positions:t,type:i,speed:o}=e;return console.log(t,e,i,o),{id:N()}},remove:()=>{},removeAll:()=>{i.entities.removeAll()},destroy:()=>{t.dataSources.remove(i)}}},Zr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1}),o=new e.PrimitiveCollection({destroyPrimitives:!1}),n=new e.PointPrimitiveCollection,r=new e.LabelCollection;o.add(n),i.add(r),i.add(o),t.scene.primitives.add(i);const a=(t,i)=>{t.forEach(t=>{i.add({position:t,color:e.Color.TRANSPARENT})})},s=(t,i)=>{const o=new e.GroundPolylineGeometry({positions:t,width:3}),n=new e.GeometryInstance({geometry:o});i.add(new e.GroundPolylinePrimitive({geometryInstances:n,asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#ff00ff").withAlpha(.5)})})}))},l=(t,i)=>{const o=new e.WallGeometry({positions:t}),n=e.WallGeometry.createGeometry(o),r=new e.GeometryInstance({geometry:n});i.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#00ff00").withAlpha(.5)})})}))},c=(t,i,o)=>{const n=new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),height:i}),r=new e.GeometryInstance({geometry:n});o.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#0088ff").withAlpha(.5)})})}))},d=(t,i,o,n,r)=>{const a=t.map(t=>e.Cartographic.fromCartesian(t).height),s=Math.min(...a),l=Math.max(...a);let c=0;for(let e=0;e<a.length;e++)c+=(a[e]-s)*i*i;const d=e.Cartesian3.fromDegrees(o.geometry.coordinates[0],o.geometry.coordinates[1],l),p={},u=r*l;c?p["挖方体积"]=`${h(c)}方\n`:c=0,u&&(p["填方体积"]=`${h(u-c)}方\n`),r&&(p["横切面积"]=`${h(r)}平方米\n`),s&&(p["最小高程"]=`${h(s)}米\n`),l&&(p["最大高程"]=`${h(l)}米\n`),s&&(p["基准面高程"]=`${h(s)}米`);let m="";Object.keys(p).forEach(e=>{m+=`${e}:${p[e]}`}),n.add({position:d,text:m,font:"16px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})},p=(t,i,o)=>{t.forEach((t,n)=>{o.add({position:t,text:`高程:${h(i[n].height)}米`,font:"14px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})})},h=e=>{const t=["","万","百万","千万","亿"];let i=0;for(;e>=1e4&&i<t.length-1;)e/=1e4,i++;return`${e.toFixed(2).replace(/\.?0+$/,"")}${t[i]}`};return{set:h=>{const u=g(h.positions),m=u.map(t=>{const i=e.Cartographic.fromCartesian(t);return{lng:e.Math.toDegrees(i.longitude),lat:e.Math.toDegrees(i.latitude),height:i.height}}),f=Math.min(...m.map(e=>e.height)),v=ee([m.map(e=>[e.lng,e.lat])]),y=ue(v),C=Math.sqrt(ue(v)/200),w=Ne(v),b=ke(v),P=function(e,t,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var o=[],n=e[0],r=e[1],a=e[2],s=e[3],l=t/de([n,r],[a,r],i)*(a-n),c=t/de([n,r],[n,s],i)*(s-r),d=a-n,p=s-r,h=Math.floor(d/l),u=(p-Math.floor(p/c)*c)/2,m=n+(d-h*l)/2;m<=a;){for(var g=r+u;g<=s;){var f=Q([m,g],i.properties);i.mask?Re(f,i.mask)&&o.push(f):o.push(f),g+=c}m+=l}return ie(o)}(ye(w),C,{units:"meters"}),_=Ve(P,v).features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1]));return t.scene.clampToHeightMostDetailed(_).then(e=>{a(e,n),c(u,f,i),s(u,o),l(u,i),d(e,C,b,r,y),p(u,m,r)}),{id:N()}},remove:()=>{},removeAll:()=>{r.removeAll(),n.removeAll(),o.removeAll(),i.removeAll(),o.add(n),i.add(o),i.add(r)},destroy:()=>{}}},Yr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1});let o,n="/icons/markers/mark-icon.png";const r=[];t.scene.primitives.add(i);const a=i=>{if(!i)return o&&t.entities.remove(o),void(o=void 0);o||(o=t.entities.add({position:m(new e.Cartographic(i.longitude,i.latitude,i.height)),billboard:{image:n,scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),o.position=m(new e.Cartographic(i.longitude,i.latitude,i.height))};return{set:async e=>{e.tipMarkerUrl&&(n=e.tipMarkerUrl);const{positions:i}=e;let o=qe(i);const a=Math.floor(o/e.pointDistance);let s=tt(i,a);s=await t.scene.clampToHeightMostDetailed(s),o=0;const l=s.map((e,t)=>{let i=0;t>0&&(i=We(s[t-1],e),o+=i);return{...h(e),distance:i,allDistance:o}}),c={id:N(),datas:l};return r.push(c),c},remove:e=>{const t=r.findIndex(t=>t.id===e.id);-1!==t&&r.splice(t,1),a()},removeAll:()=>{i.removeAll(),a()},destroy:()=>{t.scene.primitives.remove(i)},changeTipPoint:a}},Jr=e=>{const t=new PrimitiveCollection({destroyPrimitives:!1});let i=null,o="";const n=[];e.scene.primitives.add(t);const r=async(t,i,o)=>{const n=JSON.parse(JSON.stringify(t));await e.scene.clampToHeightMostDetailed(n)},a=t=>{if(!t)return i&&e.entities.remove(i),void(i=void 0);i||(i=e.entities.add({position:m(new Cartographic(t.longitude,t.latitude,t.height)),billboard:{image:o,scale:.5,verticalOrigin:VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),i.position=m(new Cartographic(t.longitude,t.latitude,t.height))};return{set:async t=>{t.tipMarkerUrl&&(o=t.tipMarkerUrl);const i=t.layers;return e.terrainProvider instanceof EllipsoidTerrainProvider||(e.terrainProvider,e.terrainProvider=new EllipsoidTerrainProvider),i.forEach(e=>{e.visible=!1}),new Promise(e=>{setTimeout(()=>{const{positions:i}=t,o=qe(i),n=Math.floor(o/t.pointDistance),a=tt(i,n).filter(e=>e&&e.x&&e.y&&e.z),s={id:N(),datas:[]};r(a),e(s)},500)})},remove:e=>{const t=n.findIndex(t=>t.id===e.id);-1!==t&&n.splice(t,1),a(void 0)},removeAll:()=>{t.removeAll(),a(void 0)},destroy:()=>{e.scene.primitives.remove(t)},changeTipPoint:a}};export{nt as BaseMaterialProperty,ot as BasePrimitive,wn as CircleApertureMaterialProperty,Vr as CircleAperturePrimitive,fn as CircleRaderFanMaterialProperty,hn as CircleRaderWaveMaterialProperty,ln as CircleWaveMaterialProperty,t as Common,ei as CoordinateTransformer,l as DefaultViewerOptions,Ri as Draw,Fi as DrawEventType,Li as DrawStyle,In as EllipsoidElectricMaterialProperty,kn as EllipsoidHScanMaterialProperty,Rn as EllipsoidVScanMaterialProperty,Tt as FlyAttitude,$r as GridPrimitives,fr as GroundPolygonPrimitives,mr as GroundPolylinePrimitives,Dn as LightWallMaterialProperty,Jo as Material,Dr as PointClusterPrimitives,lr as PointPrimitives,nn as PolylineFlowMaterialProperty,Qo as PolylineTrailMaterialProperty,V as Popup,Wn as RadereScanPrimitive,zt as RoamStatus,U as Tooltip,ci as TransformsFor3dtiles,Vn as ZapsMaterialProperty,Oo as addDrawActions,Ze as calcArea,it as calcBoundingSphereFromPositions,et as calcCameraHeightFromZoom,We as calcGeodesicDistance,qe as calcGeodesicDistances,tt as calcLerpPosition,je as calcPoistionCenter,Ke as calcSceneHeightFromPositions,$e as calcSpaceDistance,He as calcSpaceDistances,Je as calcTerrainHeightFromPositions,Ye as calcTriangleArea,Qe as calcZoomFromCameraHeight,Xe as clacPositionsForParabola,_i as createBloomTargetStage,Lt as createBottomStatusBar,bn as createCircleApertureMaterial,vn as createCircleRaderFanMaterial,cn as createCircleWaveMaterial,Wr as createClipPlaneAnalysis,qr as createClipPolygonAnalysis,Hr as createDivLabelHandler,Yo as createDrawHandler,Ii as createDroneAnimCustomShader,Y as createEagleEye,Tn as createEllipsoidElectricMaterial,Nn as createEllipsoidHScanMaterial,On as createEllipsoidVScanMaterial,Zr as createFillAndDigAnalysis,jr as createFloodAnalysis,Pi as createFogStage,bi as createHeightFogStage,fi as createHighLightStage,Ei as createLightBandCustomShader,En as createLightWallMaterial,Di as createLightningStage,Jr as createModelProfileAnalysis,kt as createOpenAnim,zi as createOutLineEffect,yi as createOutlineStage,rn as createPoylineFlowMaterial,Yr as createProfileAnalysis,un as createRaderWaveMaterial,Mi as createRainCoverStage,xi as createRainStage,It as createRoamHandler,_n as createScanRadarMaterial,At as createSkyBox,St as createSkyBoxOnGround,vi as createSkylineStage,Ci as createSnowCoverStage,wi as createSnowStage,en as createTrailMaterial,$n as createZapsMaterial,F as flyByRotateOut,z as flyByRotatePoint,x as flyToCameraView,E as flyToCesium3DTile,M as flyToDataSource,A as flyToFromSphere,D as flyToImagery,b as flyToLnglat,I as flyToNorth,P as flyToPosition,S as flyToRectangleBounds,ai as getAllFeaturesFrom3dTiles,si as getAllTilesFrom3dTiles,_ as getCameraView,s as getCesiumForAutoFitScale,G as getInoCesiumBaseUrl,T as getScreenCenterPoint,o as initCesium,L as initCesiumEvent,ni as load3dTiles,gi as loadI3s,ui as loadModel,di as loadTerrain,hi as loadTerrainFromCesium,ti as loadTianDiTu,mi as loads3m,Ut as makeGridFromElevationExtrema,Nt as makeGridToInstanceForBox,Gt as makeGridToInstanceForLine,m as makeLnglatToPosition,v as makeLnglatsToLineGeojson,f as makeLnglatsToPointGeojson,y as makeLnglatsToPolygonGeojson,u as makeLnglatsToPositions,g as makePositionsClose,d as makePositionsForAntiClockwise,c as makePositionsForClockwise,p as makePositionsToLnglats,h as makePositiontoLnglat,C as makeYawPitchRollToHeadingPitchRoll,Vt as mekeGridPolygonAndHeight,N as numberId,W as randomColor,$ as randomPointToGeoJson,j as randomPolygonToGeoJson,q as randomPolylineToGeoJson,pi as removeTerrain,O as setCameraAutoBackTiltToZero,a as setCesiumForAutoFitScale,n as setGlobeEnabled,r as setGlobeOpatity,ri as setHeightOffsetFor3dTiles,ii as setImageLayerTheme,w as setViewToLnglat,R as twinkleModel};
|
|
1
|
+
import*as e from"cesium";export{e as Cesium};var t=Object.freeze({__proto__:null});let i=1;const o=(t,i)=>{i||(i={token:""}),i.token&&(e.Ion.defaultAccessToken=i.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const o={...l,...i},n=new e.Viewer(t,o);return n.imageryLayers.remove(n.imageryLayers.get(0)),n._cesiumWidget._creditContainer.style.display="none",n.scene.postProcessStages.fxaa.enabled=!0,n.scene.msaaSamples=8,n.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),n.scene.globe.depthTestAgainstTerrain=!0,n.scene.globe.showGroundAtmosphere=!0,n.scene.globe.enableLighting=!1,n.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),n},n=(t,i)=>{const o=i?1:0;t.scene.skyBox.show=i,t.scene.skyAtmosphere.show=i,t.scene.globe.dynamicAtmosphereLighting=i,t.scene.globe.dynamicAtmosphereLightingFromSun=i,t.scene.globe.translucency.backFaceAlpha=o,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${o})`),t.scene.globe.showGroundAtmosphere=i,i?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${o})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${o})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${o})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${o})`)}}}))},r=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},a=e=>{i=e},s=()=>i,l={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},c=t=>{let i=0;for(let o=0;o<t.length;o++){const n=t[o],r=t[(o+1)%t.length];i+=e.Cartesian3.cross(n,r,new e.Cartesian3).z}return i>0?t.reverse():t},d=t=>{let i=0;for(let o=0;o<t.length;o++){const n=t[o],r=t[(o+1)%t.length];i+=e.Cartesian3.cross(n,r,new e.Cartesian3).z}return i<0?t.reverse():t},p=e=>e.map(e=>h(e)),h=t=>{const i=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(i.longitude),latitude:e.Math.toDegrees(i.latitude),height:i.height}},u=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),m=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),g=e=>{const t=e[0],i=e[e.length-1];return t.x===i.x&&t.y===i.y&&t.z===i.z?e:[...e,e[0]]},f=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},v=e=>{const t=[];return e.forEach((i,o)=>{0!==o&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[o-1].longitude,e[o-1].latitude],[i.longitude,i.latitude]]},properties:{height:i.height}})}),{type:"FeatureCollection",features:t}},y=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},C=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),w=t=>{const{lng:i,lat:o,height:n,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(i,o,n||1e4)})},b=t=>{const{lng:i,lat:o,height:n,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(i,o,n||1e4)})},P=e=>{const{position:t,viewer:i}=e;i.scene.camera.flyTo({destination:t})};function _(t){const i=t.camera.heading,o=t.camera.pitch,n=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:i,pitch:o,roll:n}}}function x(e,t){e&&t.scene.camera.flyTo({...e})}function M(e,t){const i=t.dataSources.getByName(e);i.length>0&&t.flyTo(i[0])}function E(e,t){e&&t.flyTo(e)}function D(e,t){t.flyTo(e)}function A(t,i){const o=new e.Cartesian3(t[0],t[1],t[2]),n=new e.BoundingSphere(o,t[3]);i.camera.flyToBoundingSphere(n,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const S=(t,i,o,n,r)=>{if(o<=t||n<=i)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const a={destination:e.Rectangle.fromDegrees(t,i,o,n),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};r.camera.flyTo(a)},I=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function T(t){const i=t.scene.canvas,o=i.clientWidth/2,n=i.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(o,n))}const z=t=>{let i=!1;let o;const n=t.camera;let r=n.pitch,a=0,s=!1;function l(){if(!i||!o)return;let e=n.heading;s?e+=.005:e-=.005,t.camera.setView({destination:o,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(a),requestAnimationFrame(l)}return{start:(c,d)=>{o=c||T(t),r=n.pitch,s=!!d,a=e.Cartesian3.distance(n.position,o),i=!0,l(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{i=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},F=e=>{let t=!1;let i=!1;function o(){if(!t)return;let n=e.camera.heading;i?n+=.001:n-=.001,e.camera.setView({orientation:{heading:n,pitch:e.camera.pitch}}),requestAnimationFrame(o)}t=!0;return{start:e=>{t=!0,i=!!e,o()},end:()=>{t=!1}}};function R(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const O=(t,i)=>{console.log("sdfjdsklf"),i||(i=1e5);let o=!1;t.camera.moveEnd.addEventListener(function(){if(o)return;const n=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const a=n.heading,s=n.roll;if(r>i){o=!0;const i=t.camera.computeViewRectangle();if(!i)return void(o=!0);const n={longitude:0,latitude:0},l=e.Rectangle.center(i);n.longitude=e.Math.toDegrees(l.longitude),n.latitude=e.Math.toDegrees(l.latitude),t.camera.flyTo({destination:m(new e.Cartographic(n.longitude,n.latitude,r)),orientation:{heading:a,pitch:-1.5,roll:s},duration:1,complete:()=>{}})}else o=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},L=(t,i)=>{const o=t.scene,n=new e.ScreenSpaceEventHandler(o.canvas);n.setInputAction(e=>{if(i.LEFT_POSITION){const n=o.pickPosition(e.position);k(e.position,n,i.LEFT_POSITION,t)}i.PICK_FEATURE&&B(t,e.position,i.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),n.setInputAction(e=>{if(i.MOVE_POSITION){const n=o.pickPosition(e.endPosition);k(e.endPosition,n,i.MOVE_POSITION,t)}i.MOVE_PICK_FEATURE&&B(t,e.endPosition,i.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},B=(t,i,o)=>{const n=t.scene.pickPosition(i),r=t.scene.pick(i),a={};if(r){if(t._element.style.cursor="pointer",r instanceof e.Cesium3DTileFeature){r.getPropertyIds().forEach(e=>{a[e]=r.getProperty(e)})}else r.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(a,{name:"sdfjldks"})):r.id instanceof e.Entity?t._element.style.cursor="pointer":r.primitive&&Object.assign(a,r.primitive.properties);o({position:n,...r},a)}else o(void 0,{})},k=(t,i,o,n)=>{i||(i=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(i);o({windowPosition:t,position:i,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:_(n)})},N=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,G=()=>window.INO_CESIUM_BASE_URL;class U{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const i=document.createElement("DIV");i.className="twipsy-inner",t.appendChild(i),this._div=t,this._title=i,this._message="";const o=e._element.getElementsByClassName("cesium-widget")[0];if(!o)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");o.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return U.tooltip||(U.tooltip=new U(e)),U.tooltip}destroy(){U.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),U.tooltip=null)}}class V{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,i){this.viewer=e,i&&(this.offset=i),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const o=e._element.getElementsByClassName("cesium-widget")[0];if(!o)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");o.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPupup(e,t,i){return V.popup||(V.popup=new V(e,t,i)),V.popup}destroy(){V.popup&&(this._div&&this._div.parentNode.removeChild(this._div),V.popup=null)}}const $=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=H(t),n=H(i);o.push({type:"Feature",geometry:{type:"Point",coordinates:[e,n]},properties:{}})}return{type:"FeatureCollection",features:o}};function H(e){const[t,i]=e;return Math.random()*(i-t)+t}function W(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const q=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=Math.floor(H([3,10])),n=[];for(let o=0;o<e;o++){const e=H(t),o=H(i);n.push([e,o])}o.push({type:"Feature",geometry:{type:"LineString",coordinates:n},properties:{}})}return{type:"FeatureCollection",features:o}},j=(e,t=[-180,180],i=[-90,90])=>{const o=[];for(let n=0;n<e;n++){const e=Z(t,i);o.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:o}};function Z(e,t){const i=Math.floor(H([3,10])),o=H(e),n=H(t),r=H([1,5]),a=[];for(let e=0;e<i;e++){const t=e/i*2*Math.PI,s=H([.8*r,r]),l=o+s*Math.cos(t),c=n+s*Math.sin(t);a.push([l,c])}return a.push(a[0]),a}const Y=(t,i)=>{let o=!1;const n=new e.Viewer(t,{...l,scene3DOnly:!1});n.scene.mode=2;const r=n.scene.screenSpaceCameraController;r.enableRotate=!1,r.enableTranslate=!1,r.enableZoom=!1,r.enableTilt=!1,r.enableLook=!1,i.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(a(),""),!0)}});const a=function(){o||n.camera.flyTo({destination:i.camera.position,orientation:{heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},duration:0})};return{viewer:n,open:()=>{o=!1},close:()=>{o=!0}}},J=t=>{const i=[],o=e=>{t.scene.splitPosition=e},n=(e,t)=>{i.push(e),e.splitDirection=t};return{set:()=>{o(.5),function(){let e=document.getElementById("vertical-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="vertical-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),function(){const e=document.getElementById("vertical-slider");function i(){document.removeEventListener("mousemove",n,!1)}function o(){document.addEventListener("mousemove",n,!1)}function n(i){i.preventDefault?i.preventDefault():i.returnValue=!1,e.style.left=`${i.clientX}px`;const o=i.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=o}e.addEventListener("mousedown",o,!1),document.addEventListener("mouseup",i,!1)}()},remove:()=>{i.forEach(t=>{n(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:o,setSplitDirection:n}},K=t=>{const i=t;let n;const r={},a=()=>{const e=i.container;e.style.display="flex";e.getElementsByClassName("cesium-viewer")[0].style.width="50%";const t=document.createElement("div");t.style={width:"50%",height:"100%"},t.id="right-screen-viewer",e.appendChild(t),n=o(t.id),r[1]=n,l(),i.camera.changed.addEventListener(()=>s(i,n)),i.scene.preRender.addEventListener(()=>s(i,n)),i.camera.percentageChanged=.01,n.camera.changed.addEventListener(()=>s(n,i)),n.scene.preRender.addEventListener(()=>s(n,i)),n.camera.percentageChanged=.01,n._splitNumber=1};function s(t,i){const o=e.Cartographic.toCartesian(t.camera.positionCartographic);i.camera.setView({destination:new e.Cartesian3(o.x,o.y,o.z),orientation:{direction:t.scene.camera._direction,up:t.scene.camera.up,heading:t.scene.camera.heading,pitch:t.scene.camera.pitch,roll:t.scene.camera.roll}})}const l=()=>{i.imageryLayers._layers.forEach(e=>{e.splitScreenBaseLayer&&n.imageryLayers.addImageryProvider(e.imageryProvider)})};return{set:()=>{a(),function(){let e=document.getElementById("split-screen-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="split-screen-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),i._splitNumber=-1,r[-1]=i},viewerMap:r,getViewerFromKey:e=>r[e],remove:()=>{document.getElementById("split-screen-slider").style.display="none";i.container.getElementsByClassName("cesium-viewer")[0].style.width="100%",n.container.remove(),delete r[1]},setLayer:(e,t)=>{},updateBaseLayers:l}};var X=6371008.8,Q={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*X,kilometers:6371.0088,kilometres:6371.0088,meters:X,metres:X,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:X/1852,radians:1,yards:6967335.223679999};function ee(e,t,i={}){const o={type:"Feature"};return(0===i.id||i.id)&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.properties=t||{},o.geometry=e,o}function te(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!se(e[0])||!se(e[1]))throw new Error("coordinates must contain numbers");return ee({type:"Point",coordinates:e},t,i)}function ie(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return ee({type:"Polygon",coordinates:e},t,i)}function oe(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ee({type:"LineString",coordinates:e},t,i)}function ne(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function re(e){return 180*(e%(2*Math.PI))/Math.PI}function ae(e){return e%360*Math.PI/180}function se(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function le(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ce(e){return"Feature"===e.type?e.geometry:e}function de(e,t,i={}){if(!0===i.final)return function(e,t){let i=de(t,e);return i=(i+180)%360,i}(e,t);const o=le(e),n=le(t),r=ae(o[0]),a=ae(n[0]),s=ae(o[1]),l=ae(n[1]),c=Math.sin(a-r)*Math.cos(l),d=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-r);return re(Math.atan2(c,d))}function pe(e,t,i,o={}){const n=le(e),r=ae(n[0]),a=ae(n[1]),s=ae(i),l=function(e,t="kilometers"){const i=Q[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,o.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return te([re(r+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),re(c)],o.properties)}function he(e,t,i={}){var o=le(e),n=le(t),r=ae(n[1]-o[1]),a=ae(n[0]-o[0]),s=ae(o[1]),l=ae(n[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return function(e,t="kilometers"){const i=Q[t];if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function ue(e,t,i){if(null!==e)for(var o,n,r,a,s,l,c,d,p=0,h=0,u=e.type,m="FeatureCollection"===u,g="Feature"===u,f=m?e.features.length:1,v=0;v<f;v++){s=(d=!!(c=m?e.features[v].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var C=0,w=0;if(null!==(a=d?c.geometries[y]:c)){l=a.coordinates;var b=a.type;switch(p=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===t(l,h,v,C,w))return!1;h++,C++;break;case"LineString":case"MultiPoint":for(o=0;o<l.length;o++){if(!1===t(l[o],h,v,C,w))return!1;h++,"MultiPoint"===b&&C++}"LineString"===b&&C++;break;case"Polygon":case"MultiLineString":for(o=0;o<l.length;o++){for(n=0;n<l[o].length-p;n++){if(!1===t(l[o][n],h,v,C,w))return!1;h++}"MultiLineString"===b&&C++,"Polygon"===b&&w++}"Polygon"===b&&C++;break;case"MultiPolygon":for(o=0;o<l.length;o++){for(w=0,n=0;n<l[o].length;n++){for(r=0;r<l[o][n].length-p;r++){if(!1===t(l[o][n][r],h,v,C,w))return!1;h++}w++}C++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(!1===ue(a.geometries[o],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function me(e,t){var i,o,n,r,a,s,l,c,d,p,h=0,u="FeatureCollection"===e.type,m="Feature"===e.type,g=u?e.features.length:1;for(i=0;i<g;i++){for(s=u?e.features[i].geometry:m?e.geometry:e,c=u?e.features[i].properties:m?e.properties:{},d=u?e.features[i].bbox:m?e.bbox:void 0,p=u?e.features[i].id:m?e.id:void 0,a=(l=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,n=0;n<a;n++)if(null!==(r=l?s.geometries[n]:s))switch(r.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(r,h,c,d,p))return!1;break;case"GeometryCollection":for(o=0;o<r.geometries.length;o++)if(!1===t(r.geometries[o],h,c,d,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,h,c,d,p))return!1;h++}}function ge(e){return function(e,t,i){var o=i;return me(e,function(e,n,r,a,s){o=0===n&&void 0===i?e:t(o,e,n,r,a,s)}),o}(e,(e,t)=>e+function(e){let t,i=0;switch(e.type){case"Polygon":return fe(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)i+=fe(e.coordinates[t]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}function fe(e){let t=0;if(e&&e.length>0){t+=Math.abs(Ce(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(Ce(e[i]))}return t}var ve=20294876564838.72,ye=Math.PI/180;function Ce(e){const t=e.length-1;if(t<=2)return 0;let i=0,o=0;for(;o<t;){const n=e[o],r=e[o+1===t?0:o+1],a=e[o+2>=t?(o+2)%t:o+2],s=n[0]*ye,l=r[1]*ye;i+=(a[0]*ye-s)*Math.sin(l),o++}return i*ve}function we(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return ue(e,e=>{i[0]>e[0]&&(i[0]=e[0]),i[1]>e[1]&&(i[1]=e[1]),i[2]<e[0]&&(i[2]=e[0]),i[3]<e[1]&&(i[3]=e[1])}),i}const be=11102230246251565e-32,Pe=134217729,_e=(3+8*be)*be;function xe(e,t,i,o,n){let r,a,s,l,c=t[0],d=o[0],p=0,h=0;d>c==d>-c?(r=c,c=t[++p]):(r=d,d=o[++h]);let u=0;if(p<e&&h<i)for(d>c==d>-c?(a=c+r,s=r-(a-c),c=t[++p]):(a=d+r,s=r-(a-d),d=o[++h]),r=a,0!==s&&(n[u++]=s);p<e&&h<i;)d>c==d>-c?(a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p]):(a=r+d,l=a-r,s=r-(a-l)+(d-l),d=o[++h]),r=a,0!==s&&(n[u++]=s);for(;p<e;)a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p],r=a,0!==s&&(n[u++]=s);for(;h<i;)a=r+d,l=a-r,s=r-(a-l)+(d-l),d=o[++h],r=a,0!==s&&(n[u++]=s);return 0===r&&0!==u||(n[u++]=r),u}function Me(e){return new Float64Array(e)}const Ee=Me(4),De=Me(8),Ae=Me(12),Se=Me(16),Ie=Me(4);function Te(e,t,i,o,n,r){const a=(t-r)*(i-n),s=(e-n)*(o-r),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,o,n,r,a){let s,l,c,d,p,h,u,m,g,f,v,y,C,w,b,P,_,x;const M=e-n,E=i-n,D=t-r,A=o-r;w=M*A,h=Pe*M,u=h-(h-M),m=M-u,h=Pe*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=D*E,h=Pe*D,u=h-(h-D),m=D-u,h=Pe*E,g=h-(h-E),f=E-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ee[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ee[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ee[2]=y-(x-p)+(v-p),Ee[3]=x;let S=function(e,t){let i=t[0];for(let o=1;o<e;o++)i+=t[o];return i}(4,Ee),I=22204460492503146e-32*a;if(S>=I||-S>=I)return S;if(p=e-M,s=e-(M+p)+(p-n),p=i-E,c=i-(E+p)+(p-n),p=t-D,l=t-(D+p)+(p-r),p=o-A,d=o-(A+p)+(p-r),0===s&&0===l&&0===c&&0===d)return S;if(I=11093356479670487e-47*a+_e*Math.abs(S),S+=M*d+A*s-(D*c+E*l),S>=I||-S>=I)return S;w=s*A,h=Pe*s,u=h-(h-s),m=s-u,h=Pe*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=l*E,h=Pe*l,u=h-(h-l),m=l-u,h=Pe*E,g=h-(h-E),f=E-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const T=xe(4,Ee,4,Ie,De);w=M*d,h=Pe*M,u=h-(h-M),m=M-u,h=Pe*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=D*c,h=Pe*D,u=h-(h-D),m=D-u,h=Pe*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const z=xe(T,De,4,Ie,Ae);w=s*d,h=Pe*s,u=h-(h-s),m=s-u,h=Pe*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=l*c,h=Pe*l,u=h-(h-l),m=l-u,h=Pe*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const F=xe(z,Ae,4,Ie,Se);return Se[F-1]}(e,t,i,o,n,r,c)}function ze(e,t){var i,o,n,r,a,s,l,c,d,p=0,h=e[0],u=e[1],m=t.length;for(i=0;i<m;i++){o=0;var g=t[i],f=g.length-1;if((c=g[0])[0]!==g[f][0]&&c[1]!==g[f][1])throw new Error("First and last coordinates in a ring must be the same");for(r=c[0]-h,a=c[1]-u;o<f;o++){if(s=(d=g[o+1])[0]-h,l=d[1]-u,0===a&&0===l){if(s<=0&&r>=0||r<=0&&s>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(n=Te(r,s,a,l,0,0)))return 0;(n>0&&l>0&&a<=0||n<0&&l<=0&&a>0)&&p++}c=d,a=l,r=s}}return p%2!=0}function Fe(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const o=le(e),n=ce(t),r=n.type,a=t.bbox;let s=n.coordinates;if(a&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(o,a))return!1;"Polygon"===r&&(s=[s]);let l=!1;for(var c=0;c<s.length;++c){const e=ze(o,s[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}function Re(e,t,i={}){const o=le(e),n=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(t);for(let e=0;e<n.length-1;e++){let t=!1;if(i.ignoreEndVertices&&(0===e&&(t="start"),e===n.length-2&&(t="end"),0===e&&e+1===n.length-1&&(t="both")),Oe(n[e],n[e+1],o,t,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function Oe(e,t,i,o,n){const r=i[0],a=i[1],s=e[0],l=e[1],c=t[0],d=t[1],p=c-s,h=d-l,u=(i[0]-s)*h-(i[1]-l)*p;if(null!==n){if(Math.abs(u)>n)return!1}else if(0!==u)return!1;return Math.abs(p)===Math.abs(h)&&0===Math.abs(p)?!o&&(i[0]===e[0]&&i[1]===e[1]):o?"start"===o?Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<=c:c<=r&&r<s:h>0?l<a&&a<=d:d<=a&&a<l:"end"===o?Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<c:c<r&&r<=s:h>0?l<=a&&a<d:d<a&&a<=l:"both"===o&&(Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<c:c<r&&r<s:h>0?l<a&&a<d:d<a&&a<l):Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<=c:c<=r&&r<=s:h>0?l<=a&&a<=d:d<=a&&a<=l}function Le(e,t){var i=ce(e),o=ce(t),n=i.type,r=o.type;switch(n){case"Point":switch(r){case"MultiPoint":return function(e,t){var i,o=!1;for(i=0;i<t.coordinates.length;i++)if(ke(t.coordinates[i],e.coordinates)){o=!0;break}return o}(i,o);case"LineString":return Re(i,o,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Fe(i,o,{ignoreBoundary:!0});default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"MultiPoint":return function(e,t){for(var i=0;i<e.coordinates.length;i++){for(var o=!1,n=0;n<t.coordinates.length;n++)ke(e.coordinates[i],t.coordinates[n])&&(o=!0);if(!o)return!1}return!0}(i,o);case"LineString":return function(e,t){for(var i=!1,o=0;o<e.coordinates.length;o++){if(!Re(e.coordinates[o],t))return!1;i||(i=Re(e.coordinates[o],t,{ignoreEndVertices:!0}))}return i}(i,o);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,o=!1,n=0;n<e.coordinates.length;n++){if(!(o=Fe(e.coordinates[n],t))){i=!1;break}o=Fe(e.coordinates[n],t,{ignoreBoundary:!0})}return i&&o}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"LineString":return function(e,t){for(var i=0;i<e.coordinates.length;i++)if(!Re(e.coordinates[i],t))return!1;return!0}(i,o);case"Polygon":case"MultiPolygon":return function(e,t){var i=we(t),o=we(e);if(!Be(i,o))return!1;for(var n=!1,r=0;r<e.coordinates.length;r++){if(!Fe(e.coordinates[r],t))return!1;if(n||(n=Fe(e.coordinates[r],t,{ignoreBoundary:!0})),!n&&r<e.coordinates.length-1)n=Fe(Ne(e.coordinates[r],e.coordinates[r+1]),t,{ignoreBoundary:!0})}return n}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Polygon":case"MultiPolygon":return function(e,t){var i=we(e);if(!Be(we(t),i))return!1;for(var o=0;o<e.coordinates[0].length;o++)if(!Fe(e.coordinates[0][o],t))return!1;return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}}function Be(e,t){return!(e[0]>t[0])&&(!(e[2]<t[2])&&(!(e[1]>t[1])&&!(e[3]<t[3])))}function ke(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ne(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Ge(e,t={}){let i=0,o=0,n=0;return ue(e,function(e){i+=e[0],o+=e[1],n++},!0),te([i/n,o/n],t.properties)}function Ue(e){return function(e,t={}){const i=Number(e[0]),o=Number(e[1]),n=Number(e[2]),r=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const a=[i,o];return ie([[a,[n,o],[n,r],[i,r],a]],t.properties,{bbox:e,id:t.id})}(we(e))}function Ve(e,t,i,o,n={}){const r=n.steps||64,a=$e(i),s=$e(o),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(a===s)return oe(function(e,t,i={}){const o=i.steps||64,n=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},r=[];for(let n=0;n<o;n++)r.push(pe(e,t,-360*n/o,i).geometry.coordinates);return r.push(r[0]),ie([r],n)}(e,t,n).geometry.coordinates[0],l);const c=a,d=a<s?s:s+360;let p=c;const h=[];let u=0;const m=(d-c)/r;for(;p<=d;)h.push(pe(e,t,p,n).geometry.coordinates),u++,p=c+u*m;return oe(h,l)}function $e(e){let t=e%360;return t<0&&(t+=360),t}function He(e,t){const i=[];return function(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}(e,function(e){let o=!1;if("Point"===e.geometry.type)me(t,function(t){Fe(e,t)&&(o=!0)}),o&&i.push(e);else{if("MultiPoint"!==e.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var n=[];me(t,function(t){ue(e,function(e){Fe(e,t)&&(o=!0,n.push(e))})}),o&&i.push(function(e,t,i={}){return ee({type:"MultiPoint",coordinates:e},t,i)}(n,e.properties))}}),ne(i)}const We=(t,i)=>{const o=e.Cartographic.fromCartesian(t),n=e.Cartographic.fromCartesian(i),r=new e.EllipsoidGeodesic;r.setEndPoints(o,n);let a=r.surfaceDistance;return a=Math.sqrt(a**2+(n.height-o.height)**2),a};function qe(e){let t=0;return e.forEach((i,o)=>{if(o===e.length-1)return;const n=We(i,e[o+1]);t+=n}),t}function je(t,i,o){const{EllipsoidGeodesic:n,Ellipsoid:r}=e;return new n((o=o||r.WGS84).cartesianToCartographic(t),o.cartesianToCartographic(i)).surfaceDistance}function Ze(e){let t=0;return e.forEach((i,o)=>{if(o===e.length-1)return;const n=je(i,e[o+1]);t+=n}),t}const Ye=t=>{if(t.length<4)return e.BoundingSphere.fromPoints(t).center;const i=ie([t.map(e=>[e.x,e.y])]),o=e.BoundingSphere.fromPoints(t).center,n=Ge(i);return new e.Cartesian3(n.geometry.coordinates[0],n.geometry.coordinates[1],o.z)};function Je(t){let i=0;const{CoplanarPolygonGeometry:o,VertexFormat:n,defined:r,Cartesian3:a}=e,s=o.createGeometry(o.fromPositions({positions:t,vertexFormat:n.POSITION_ONLY}));if(r(s)){const e=s.indices,t=s.attributes.position.values;for(let o=0;o<e.length;o+=3){const n=e[o],r=e[o+1],s=e[o+2];i+=Ke(a.unpack(t,3*n,{}),a.unpack(t,3*r,{}),a.unpack(t,3*s,{}))}}return i}const Ke=(t,i,o)=>{const{Cartesian3:n}=e,r=n.subtract(t,i,{}),a=n.subtract(o,i,{}),s=n.cross(r,a,r);return.5*n.magnitude(s)},Xe=async(t,i)=>{const o=i.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,o)},Qe=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),et=(t,i,o,n)=>{const r=[],a=e.Cartographic.fromCartesian(t),s=e.Cartographic.fromCartesian(i),l=180*a.longitude/Math.PI,c=180*a.latitude/Math.PI,d=180*s.longitude/Math.PI,p=180*s.latitude/Math.PI,h=Math.sqrt((l-d)*(l-d)+(c-p)*(c-p))*o,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(i),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),f=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(u,u),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(u,m))return r;const v=e.Cartesian3.angleBetween(u,m);r.push(t);for(let t=1;t<n-1;t++){const i=1*t/(n-1),o=1-i,a=Math.sin(o*v)/Math.sin(v),s=Math.sin(i*v)/Math.sin(v),l=e.Cartesian3.multiplyByScalar(u,a,new e.Cartesian3),c=e.Cartesian3.multiplyByScalar(m,s,new e.Cartesian3);let d=e.Cartesian3.add(l,c,new e.Cartesian3);const p=i*Math.PI,y=g*o+f*i+Math.sin(p)*h;d=e.Cartesian3.multiplyByScalar(d,y,d),r.push(d)}return r.push(i),r},tt=e=>{const t=e.positionCartographic.height,i=-40467.74;return Math.round(i+80955.31/(1+(t/91610.74)**7096758e-11))},it=e=>e,ot=(t,i)=>{const o=[];let n=0,r=0,a=0;const s=[];for(let i=0;i<t.length-1;++i)n+=e.Cartesian3.distance(t[i],t[i+1]);for(let i=0;i<t.length;i++)0===i?r=0:(a+=e.Cartesian3.distance(t[i-1],t[i]),r=a/n),o.push(r);const l=new e.LinearSpline({times:o,points:t});for(let e=0;e<=i;e++){const t=l.evaluate(e/i);s.push(t)}return s},nt=t=>{const i=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,i),i};class rt{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class at{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const st=e.BoxGeometry,lt=e.Cartesian3,ct=e.defaultValue,dt=e.defined,pt=e.destroyObject,ht=e.DeveloperError,ut=e.GeometryPipeline,mt=e.Matrix3,gt=e.Matrix4,ft=e.Transforms,vt=e.VertexFormat,yt=e.BufferUsage,Ct=e.CubeMap,wt=e.DrawCommand,bt=e.loadCubeMap,Pt=e.RenderState,_t=e.VertexArray,xt=e.BlendingState,Mt=e.SceneMode,Et=e.ShaderProgram,Dt=e.ShaderSource,At=new mt;class St{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=ct(t.show,!0),this._command=new wt({modelMatrix:gt.clone(gt.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const i=this;if(!this.show)return;if(e.mode!==Mt.SCENE3D&&e.mode!==Mt.MORPHING)return;if(!e.passes.render)return;const o=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(dt(e.positiveX)&&dt(e.negativeX)&&dt(e.positiveY)&&dt(e.negativeY)&&dt(e.positiveZ)&&dt(e.negativeZ)))throw new ht("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new ht("this.sources properties must all be the same type.");"string"==typeof e.positiveX?bt(o,this._sources).then(e=>{i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Ct({context:o,source:e}))}const n=this._command;if(n.modelMatrix=ft.eastNorthUpToFixedFrame(e.camera._positionWC),!dt(n.vertexArray)){n.uniformMap={u_cubeMap:()=>i._cubeMap,u_rotateMatrix:()=>gt.getRotation(n.modelMatrix,At)};const e=st.createGeometry(st.fromDimensions({dimensions:new lt(2,2,2),vertexFormat:vt.POSITION_ONLY})),t=this._attributeLocations=ut.createAttributeLocations(e);n.vertexArray=_t.fromGeometry({context:o,geometry:e,attributeLocations:t,bufferUsage:yt._DRAW}),n.renderState=Pt.fromCache({blending:xt.ALPHA_BLEND})}if(!dt(n.shaderProgram)||this._useHdr!==t){const e=new Dt({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});n.shaderProgram=Et.fromCache({context:o,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return dt(this._cubeMap)?n:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),pt(this)}}const It=t=>{const{viewer:i,sources:o}=t;return i.scene.skyBox=new e.SkyBox({sources:o}),i.scene.skyBox},Tt=t=>{let{viewer:i,sources:o}=t;const n=t.height?t.height:225705,r=i.scene.skyBox,a=i.scene.skyAtmosphere.show;o||(o={positiveX:`${G()}/assets/ground-skybox/px.jpg`,negativeX:`${G()}/assets/ground-skybox/nx.jpg`,positiveY:`${G()}/assets/ground-skybox/py.jpg`,negativeY:`${G()}/assets/ground-skybox/ny.jpg`,positiveZ:`${G()}/assets/ground-skybox/pz.jpg`,negativeZ:`${G()}/assets/ground-skybox/nz.jpg`});const s=new St({sources:o});i.scene.postRender.addEventListener(()=>{const t=i.camera.position;e.Cartographic.fromCartesian(t).height<n?(i.scene.skyBox=s,i.scene.skyAtmosphere.show=!1):(i.scene.skyBox=r,i.scene.skyAtmosphere.show=a)})},zt=t=>{const i=[];let o,n;t.clock.shouldAnimate=!0;const r={},a=(e,i)=>{if(s(),e.entity.cylinder){const i=e.entity.cylinder;i.roamId=e.id,e.entity.cylinder=void 0,n=t.entities.add({position:e.property,cylinder:i})}t.trackedEntity=e.entity,i&&(o=e)},s=()=>{if(n){t.entities.remove(n);const e=i.find(e=>e.id===n.cylinder.roamId);e&&(e.entity.cylinder=n.cylinder),n=void 0}},l=()=>{t.trackedEntity=void 0,o=void 0,s()},c=e=>{t.trackedEntity?.id===e.entity.id&&l(),t.entities.remove(e.entity);const o=i.findIndex(t=>t.id===e.id);o>-1&&i.splice(o,1)},d=(e,t)=>{const i=e.property.getValue(t);if(i&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:i})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?p(e):l()),e.flyParams.hpr){const o=r[e.id].find(e=>e.time>t.secondsOfDay);o&&u(e,o,i)}},p=i=>{const{property:o,startTime:n,stopTime:r}=h(i);i.stopTime=r,i.startTime=n,i.property=o,i.flyParams.hpr||(i.entity.orientation=new e.VelocityOrientationProperty(o)),i.entity.position=o,i.status="START",t.clock.currentTime=n,t.clock.multiplier=1,m.reStart&&m.reStart(i)},h=t=>{const i=[],{positions:o,flyParams:n}=t,a=new e.SampledPositionProperty;let s=0;const l=e.JulianDate.now();let c=l.clone();return o.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let i=0;if(n.speed){i=e.Cartesian3.distance(t,o[r-1])/(1e3*n.speed/3600)}n.times&&(i=(n.times[r]-n.times[r-1])/1e3),s+=i,d=e.JulianDate.addSeconds(l,s,new e.JulianDate)}else d=l;c=d,a.addSample(d,t),n.hpr&&i.push({time:d.secondsOfDay,heading:n.hpr[r].heading,pitch:n.hpr[r].pitch,roll:n.hpr[r].roll})}),r[t.id]=i,{property:a,startTime:l,stopTime:c}},u=(t,i,o)=>{if(!o)return;const{heading:n,pitch:r,roll:a}=i,s=new e.HeadingPitchRoll(n,r,a);t.entity.orientation=Transforms.headingPitchRollQuaternion(o,s)};t.scene.preRender.addEventListener((n,r)=>{if(i.forEach(e=>{d(e,r)}),!o)return;const a=o.entity.computeModelMatrix(t.clock.currentTime);a&&t.camera.lookAtTransform(a,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:o=>{const{entity:n}=o;o.id=N(),t.entities.add(n);const{property:r,startTime:a,stopTime:s}=h(o);o.flyParams.hpr||(n.orientation=new e.VelocityOrientationProperty(r)),n.position=r;const l={...o,startTime:a,stopTime:s,property:r,status:"START"};return t.clock.currentTime=a,t.clock.multiplier=1,i.push(l),l.status="START",m.start&&m.start(l),l},tracked:a,stopTracked:l,remove:c,frameRoam:d,trackedByEntityId:(e,t)=>{const o=i.find(t=>t.entity.id===e);o&&a(o,t)},removeAll:()=>{i.forEach(e=>{c(e)}),i.length=0},Event:m,lockCameraView:e=>{o=e},updateRoamAttitude:(t,i)=>{"UP"!==i&&"DOWN"!==i||(t.entity.orientation=void 0),"front"!==i&&"back"!==i||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Ft=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Ft||{}),Rt=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(Rt||{});let Ot=100,Lt="",Bt="0";const kt=t=>{const{viewer:i}=t,o=document.createElement("div");o.className="bottom-status-bar";const n=document.createElement("div");n.className="scale-bar",n.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",n.appendChild(r),o.appendChild(n);const a=document.createElement("div");a.id="bottom-status-bar-camera",t.clickCopy&&(a.style.pointerEvents="auto",a.style.cursor="pointer"),o.appendChild(a),a.style.display="flex";const s=document.createElement("div"),l=document.createElement("div"),c=i._element.getElementsByClassName("cesium-widget")[0];if(!c)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");c.appendChild(o),L(i,{MOVE_POSITION(e){a.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&_(i),a.appendChild(l),a.appendChild(s)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),p=0;const h=()=>{requestAnimationFrame(()=>{if(p+=1,p>=30){const e=Date.now(),t=e-d,i=Math.round(1e3/(t/p));d=e,p=0,s.innerHTML=`${i} FPS`}t.hpr?l.innerHTML=`\n 方位角:${e.Math.toDegrees(i.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(i.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(i.camera.roll).toFixed(1)}° \n `:l.innerHTML="",l.innerHTML+=`\n 视高:${i.camera.positionCartographic.height.toFixed(0)}m \n `;const o=Nt(i);r.innerHTML=`${o.distanceLabel}`,h()})};h()},Nt=t=>{const i=t.camera.positionCartographic.height.toFixed(0);if(i===Bt)return{barWidth:Ot,distanceLabel:Lt};Bt=i;const o=new e.EllipsoidGeodesic,n=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],r=t.scene,a=r.canvas.clientWidth,s=r.canvas.clientHeight,l=r.camera.getPickRay(new e.Cartesian2(a/2|0,s-1)),c=r.camera.getPickRay(new e.Cartesian2(1+a/2|0,s-1)),d=r.globe,p=d.pick(l,r),h=d.pick(c,r);if(!e.defined(p)||!e.defined(h))return{barWidth:Ot,distanceLabel:Lt};const u=d.ellipsoid.cartesianToCartographic(p),m=d.ellipsoid.cartesianToCartographic(h);o.setEndPoints(u,m);const g=o.surfaceDistance;let f;for(let t=n.length-1;!e.defined(f)&&t>=0;--t)n[t]/g<100&&(f=n[t]);if(e.defined(f)){const e=f>=1e3?`${(f/1e3).toString()} km`:`${f.toString()} m`;Ot=f/g|0,Lt=e}else Ot=0,Lt="1 m";return{barWidth:Ot,distanceLabel:Lt}},Gt=t=>new Promise(i=>{const{viewer:o,center:n}=t;let r=n.lng,a=1,s=null;const l=t=>{null===s&&(s=t);r-=(t-s)/2e4*2,r<-180&&(r=180,a+=1),2===a&&r>n.lng?o.camera.flyTo({destination:e.Cartesian3.fromDegrees(n.lng,n.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{o.camera.flyTo({destination:e.Cartesian3.fromDegrees(n.lng,n.lat,n.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{i(!0)}})}}):(o.camera.setView({destination:e.Cartesian3.fromDegrees(r,n.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(l))};requestAnimationFrame(l)}),Ut=(t,i,o)=>{const n=new Float64Array(24);for(let e=0;e<8;e++)n[3*e]=t[e].x,n[3*e+1]=t[e].y,n[3*e+2]=t[e].z;const r=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),a={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:n})},s=new e.Geometry({indices:r,attributes:a,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(n)});return new e.GeometryInstance({geometry:s,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${o}`})},Vt=(t,i,o)=>{const[n,r,a,s,l,c,d,p]=t,h=[n,r,r,a,a,s,s,n,l,c,c,d,d,p,p,l,n,l,l,c,c,r,r,n,s,p,p,d,d,a,a,s,n,s,s,p,p,l,l,n,r,c,c,d,d,a,a,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${o}`})},$t=(t,i)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,t.height)],Ht=(t,i,o,n,r,a)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(t,t,a),e.Cartesian3.fromDegrees(i,i,a),e.Cartesian3.fromDegrees(o,o,a),e.Cartesian3.fromDegrees(n,n,a)],Wt=3e3*Math.PI/180,qt=Math.PI,jt=6378245,Zt=.006693421622965943,Yt=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),Jt=(e,t)=>{let i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*qt)+20*Math.sin(2*e*qt))/3,i+=2*(20*Math.sin(t*qt)+40*Math.sin(t/3*qt))/3,i+=2*(160*Math.sin(t/12*qt)+320*Math.sin(t*qt/30))/3,i},Kt=(e,t)=>{let i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*qt)+20*Math.sin(2*e*qt))/3,i+=2*(20*Math.sin(e*qt)+40*Math.sin(e/3*qt))/3,i+=2*(150*Math.sin(e/12*qt)+300*Math.sin(e/30*qt))/3,i},Xt=(e,t)=>{if(Yt(e,t))return[e,t];let i=Jt(e-105,t-35),o=Kt(e-105,t-35);const n=t/180*qt;let r=Math.sin(n);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),o=180*o/(jt/a*Math.cos(n)*qt);return[e+o,t+i]},Qt=(e,t)=>{if(Yt(e,t))return[e,t];let i=Jt(e-105,t-35),o=Kt(e-105,t-35);const n=t/180*qt;let r=Math.sin(n);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),o=180*o/(jt/a*Math.cos(n)*qt);return[2*e-(e+o),2*t-(t+i)]},ei=(e,t)=>{const i=e,o=t,n=Math.sqrt(i*i+o*o)+2e-5*Math.sin(o*Wt),r=Math.atan2(o,i)+3e-6*Math.cos(i*Wt);return[n*Math.cos(r)+.0065,n*Math.sin(r)+.006]},ti=(e,t)=>{const i=e-.0065,o=t-.006,n=Math.sqrt(i*i+o*o)-2e-5*Math.sin(o*Wt),r=Math.atan2(o,i)-3e-6*Math.cos(i*Wt);return[n*Math.cos(r),n*Math.sin(r)]};class ii{static wgs84ToGcj02(e){const[t,i]=Xt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToWgs84(e){const[t,i]=Qt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToBd09(e){const[t,i]=ei(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToGcj02(e){const[t,i]=ti(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToWgs84(e){const[t,i]=((e,t)=>{const[i,o]=ti(e,t);return Qt(i,o)})(e.lng,e.lat);return{lng:t,lat:i}}static wgs84ToBd09(e){const[t,i]=((e,t)=>{const[i,o]=Xt(e,t);return ei(i,o)})(e.lng,e.lat);return{lng:t,lat:i}}}const oi=t=>{const{viewer:i,token:o}=t,n=t.vec?"vec":"img",r=[],a=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/${n}_w/wmts?tk=${o}`,layer:n,style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));if(r.push(a),console.log(a),t.label){const t=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/cia_w/wmts?tk=${o}`,layer:"cia",style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));r.push(t)}return{layers:r,remove:()=>{r.forEach(e=>{i.imageryLayers.remove(e)})},setOpacity:e=>{r.forEach(t=>{t.alpha=e})}}};function ni(t,i){i||(i={}),console.log(i.filterColor);const o=t.imageryLayers.get(0);if(!o)return;o.brightness=i.brightness??.6,o.contrast=i.contrast??1.8,o.gamma=i.gamma??.3,o.hue=i.hue??1,o.saturation=i.saturation||0;const n=t.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<n.length;t++){const o="color = czm_saturation(color, textureSaturation);\n#endif\n";let r="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor||(r+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n "),i.filterColor||(i.filterColor=e.Color.fromCssColorString("rgba(100,138,230,0.5)")),r+=`\n color.r = color.r * ${i.filterColor.red.toFixed(2)};\n color.g = color.g * ${i.filterColor.green.toFixed(2)};\n color.b = color.b * ${i.filterColor.blue.toFixed(2)};\n // color.a = color.a * ${i.filterColor.alpha.toFixed(2)};\n `,n[t]=n[t].replace(o,r)}t.scene.requestRender()}const ri={cacheBytes:4294967296,maximumCacheOverflowBytes:5368709120},ai=async t=>{const{viewer:i,url:o,options:n}=t,r=await e.Cesium3DTileset.fromUrl(o,{...ri,...n});i.scene.primitives.add(r);return{tileset:r,setHeightOffset:e=>{si(r,e)},remove:()=>{i.scene.primitives.remove(r)},flyTo:()=>{i.flyTo(r)}}},si=(t,i)=>{di(t,e.Cartesian3.fromElements(0,0,i,new e.Cartesian3))},li=async e=>{const t=[];function i(e){if(console.log(e),!e.content||!e.content.featuresLength)return;const o=e.content;for(let e=0;e<o.featuresLength;e++)t.push(o.getFeature(e));e.children?.forEach(i)}return new Promise(o=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),o(t)})})},ci=e=>{const t=[];function i(e){t.push(e),e.children?.forEach(i)}return new Promise(o=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),o(t)})})},di=(t,i)=>{if(i.equals(e.Cartesian3.ZERO))return;const o=t.boundingSphere.center,n=e.Transforms.eastNorthUpToFixedFrame(o),r=e.Matrix4.multiplyByPoint(n,i,new e.Cartesian3),a=e.Cartesian3.subtract(r,o,new e.Cartesian3),s=e.Matrix4.fromTranslation(a);t.modelMatrix=e.Matrix4.multiply(s,t.modelMatrix,new e.Matrix4)},pi={translate:di,scale:(t,i)=>{if(i.equals(e.Cartesian3.ZERO)||i.equals(e.Cartesian3.ONE))return;const o=t.boundingSphere.center,n=e.Transforms.eastNorthUpToFixedFrame(o),r=e.Matrix4.inverse(n,new e.Matrix4),a=e.Matrix4.fromScale(i),s=e.Matrix4.multiply(a,r,new e.Matrix4),l=e.Matrix4.multiply(n,s,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(l,t.modelMatrix,new e.Matrix4)},rotate:(t,i)=>{const{x:o,y:n,z:r}=i,a=t.boundingSphere.center,s=e.Transforms.eastNorthUpToFixedFrame(a),l=e.Matrix4.inverse(s,new e.Matrix4),c=e.Matrix4.clone(e.Matrix4.IDENTITY);if(0!==o){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationX(e.Math.toRadians(o)));e.Matrix4.multiply(t,c,c)}if(0!==n){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationY(e.Math.toRadians(n)));e.Matrix4.multiply(t,c,c)}if(0!==r){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationZ(e.Math.toRadians(r)));e.Matrix4.multiply(t,c,c)}const d=e.Matrix4.multiply(c,l,new e.Matrix4),p=e.Matrix4.multiply(s,d,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(p,t.modelMatrix,new e.Matrix4)}},hi=async t=>{const{viewer:i,url:o}=t,n=await e.CesiumTerrainProvider.fromUrl(o,{requestWaterMask:!0,requestVertexNormals:!0});i.scene.terrainProvider=n;return{terrainProvider:n,remove:()=>{i.scene.terrainProvider=new e.EllipsoidTerrainProvider}}},ui=t=>{t.scene.terrainProvider=new e.EllipsoidTerrainProvider},mi=async()=>await e.CesiumTerrainProvider.fromIonAssetId(1,{requestWaterMask:!0,requestVertexNormals:!0}),gi=()=>{},fi=()=>{},vi=async t=>{const{viewer:i,url:o,options:n}=t,r=await e.I3SDataProvider.fromUrl(o,n);i.scene.primitives.add(r);return{i3sProvider:r,setHeightOffset:e=>{r.layers.forEach(t=>{const i=t.tileset;i&&si(i,e)})},remove:()=>{i.scene.primitives.remove(r)},flyTo:t=>{const o=e.Rectangle.center(r.extent);o.height=t;let n=r.data;e.defined(n.layers)&&n.layers.length>0&&(n=n.layers[0]),e.defined(n.fullExtent)&&e.defined(n.fullExtent.zmax)&&(o.height+=n.fullExtent.zmax);const a=e.Ellipsoid.WGS84.cartographicToCartesian(o);i.camera.flyTo({destination:a,orientation:{}})}}},yi=(t,i=e.Color.YELLOW)=>{const o=t.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 highlight;\n void main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (czm_selected()) {\n vec3 highlighted = highlight.a * highlight.rgb + (1.0 - highlight.a) * color.rgb;\n out_FragColor = mix(color, vec4(highlighted,0.5), 0.3);\n } else {\n out_FragColor = color;\n }\n }\n ",uniforms:{highlight:()=>i}}));o.selected=[];return{stage:o,remove:()=>{t.scene.postProcessStages.remove(o)}}},Ci=t=>{const i=e.PostProcessStageLibrary.createEdgeDetectionStage(),o=new e.PostProcessStage({name:"skyline",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n void main() { float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (depth < 1.0 - 0.000001) {\n out_FragColor = color;\n } else {\n out_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n }\n }"}),n=new e.PostProcessStage({name:"mix",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D redTexture;\n uniform sampler2D silhouetteTexture;\n in vec2 v_textureCoordinates;\n\n void main() {\n vec4 redColor = texture(redTexture, v_textureCoordinates);\n vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (redColor.r == 1.0) {\n out_FragColor = mix(color, vec4(5.0, 0.0, 0.0, 1.0), silhouetteColor.a);\n } else {\n out_FragColor = color;\n }\n }",uniforms:{redTexture:o.name,silhouetteTexture:i.name}}),r=new e.PostProcessStageComposite({stages:[i,o,n],inputPreviousStageTexture:!1,uniforms:i.uniforms});t.scene.postProcessStages.add(r);return{stage:r,remove:()=>{t.scene.postProcessStages.remove(r)}}},wi=(t,i=e.Color.YELLOW)=>{const o=t.scene.postProcessStages,n=e.PostProcessStageLibrary.createEdgeDetectionStage();n.uniforms.color=i,n.uniforms.length=1,n.selected=[];const r=e.PostProcessStageLibrary.createEdgeDetectionStage();r.uniforms.color=i,r.selected=[];const a=o.add(e.PostProcessStageLibrary.createSilhouetteStage([n,r]));a.selected=[];return{stage:a,remove:()=>{t.scene.postProcessStages.remove(a)}}},bi=t=>{const i=t.viewer,o=new e.PostProcessStage({name:"SnowEffectCover",fragmentShader:"\n vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth)\n {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n }\n vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset, sampler2D depthMap) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n float upOrRightLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n }\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float intensity;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n\n float logDepthOrDepth = czm_unpackDepth(texture(depthTexture, v_textureCoordinates));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0), depthTexture);\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0), depthTexture);\n vec3 normalEC = normalize(cross(leftRight, downUp));\n vec3 normalMC = normalize((czm_inverseView * vec4(normalEC, 0.0)).xyz);\n vec3 ellipsoidNormal = normalize(worldCoordinate);\n float dotProd = dot(ellipsoidNormal, normalMC);\n if(dotProd < 0.3){\n out_FragColor = sceneColor;\n } else {\n out_FragColor = mix(sceneColor, vec4(1.0), dotProd * intensity);\n }\n if (czm_selected()) {\n out_FragColor = sceneColor;\n }\n }\n ",forcePowerOfTwo:!1,textureScale:1,uniforms:{intensity:()=>t.intensity||.8}});i.scene.postProcessStages.add(o);return o.selected=[],{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},Pi=t=>{const i=t.viewer,o=i.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture; //输入的场景渲染照片\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float scale;\n\n float snow(vec2 uv, float thisScale) {\n float time = czm_frameNumber * speed / 1000.0;\n float wMars3D = smoothstep(1.0, 0.0, -uv.y * (thisScale / 10.0));\n if(wMars3D < 0.1)\n return 0.0;\n uv += time / thisScale;\n uv.y += time * 2.0 / thisScale;\n uv.x += sin(uv.y + time * 0.5) / thisScale;\n uv *= thisScale;\n\n vec2 s = floor(uv), f = fract(uv), p;\n float k = 3.0, d;\n p = 0.5 + 0.35 * sin(11.0 * fract(sin((s + p + thisScale) * mat2(7, 3, 6, 5)) * 5.0)) - f;\n d = length(p);\n k = min(d, k);\n k = smoothstep(0.0, k, sin(f.x + f.y) * 0.01);\n return k * wMars3D;\n }\n void main(void) {\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n\n float c = 0.0;\n float step = 1.0/(scale*0.1);\n for(float i = 1.0; i < 12.0; i += 1.0) {\n c += snow(uv, i*step);\n }\n vec3 finalColor = vec3(c); //屏幕上雪的颜色\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雪和三维场景融合\n }",uniforms:{scale:()=>t.scale||5,speed:()=>t.speed||16}}));o.selected=[];return{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},_i=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float alpha;\n uniform float height;\n uniform vec3 oneOverRadii;\n uniform vec3 oneOverRadiiSquared;\n uniform float centerToleranceSquared;\n uniform float EPSILON12;\n uniform float earthRadius;\n\n in vec2 v_textureCoordinates;\n out vec4 glColor;\n\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n\n\n vec3 getWorldCoordinateFromDepth(in vec4 currD){\n float depth = czm_unpackDepth(currD);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n return worldCoordinate;\n }\n\n float magnitude(in vec3 v){\n return sqrt(v.x * v.x + v.y * v.y + v.z * v.z);\n }\n\n // 沿大地表面法线缩放提供的笛卡尔位置,使其位于该椭球体的表面上\n vec3 scaleToGeodeticSurface(in vec3 cartesian){\n float positionX = cartesian.x;\n float positionY = cartesian.y;\n float positionZ = cartesian.z;\n float x2 = cartesian.x * cartesian.x * oneOverRadii.x * oneOverRadii.x;\n float y2 = cartesian.y * cartesian.y * oneOverRadii.y * oneOverRadii.y;\n float z2 = cartesian.z * cartesian.z * oneOverRadii.z * oneOverRadii.z;\n\n float squaredNorm = x2 + y2 + z2;\n float ratio = sqrt(1.0 / squaredNorm);\n vec3 intersection = cartesian * ratio;\n\n float oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n float oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n float oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n vec3 gradient = vec3(intersection.x * oneOverRadiiSquaredX * 2.0,intersection.y * oneOverRadiiSquaredY * 2.0,intersection.z * oneOverRadiiSquaredZ * 2.0);\n\n float lambda = ((1.0 - ratio) * magnitude(cartesian) ) / (0.5 * magnitude(gradient));\n float correction = 0.0;\n float func = 0.0;\n float denominator = 0.0;\n float xMultiplier = 0.0;\n float yMultiplier = 0.0;\n float zMultiplier = 0.0;\n float xMultiplier2 = 0.0;\n float yMultiplier2 = 0.0;\n float zMultiplier2 = 0.0;\n float xMultiplier3 = 0.0;\n float yMultiplier3 = 0.0;\n float zMultiplier3 = 0.0;\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n xMultiplier2 = xMultiplier * xMultiplier;\n yMultiplier2 = yMultiplier * yMultiplier;\n zMultiplier2 = zMultiplier * zMultiplier;\n\n xMultiplier3 = xMultiplier2 * xMultiplier;\n yMultiplier3 = yMultiplier2 * yMultiplier;\n zMultiplier3 = zMultiplier2 * zMultiplier;\n\n float func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n float denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n float derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (abs(func) > EPSILON12);\n return vec3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);\n }\n\n vec3 multiplyComponents(in vec3 left,in vec3 right){\n return vec3(left.x * right.x, left.y * right.y, left.z * right.z);\n }\n\n\n // 将世界坐标转为经纬度高度\n vec3 getCartographicFromCartesian3(in vec3 cartesian){\n vec3 p = scaleToGeodeticSurface(cartesian);\n vec3 n = multiplyComponents(p,oneOverRadiiSquared);\n n = normalize(n);\n vec3 h = cartesian - p;\n\n float longitude = atan(n.y, n.x);\n float latitude = asin(n.z);\n float height = sign(dot(h, cartesian)) * magnitude(h);\n\n return vec3(longitude,latitude,height);\n }\n\n // 计算每个像素点的高度 通过计算相机所在位置的地球半径作为每个点的地球半径,然后用每个点的length减去半径得到近似的高度\n float getHeight(in vec4 currD){\n // 传入每个点的世界坐标\n float altitude = 0.0;\n float depth = czm_unpackDepth(currD);\n if (depth == 0.0) {\n altitude = czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n float distance = -eyeCoordinate.z / eyeCoordinate.w;\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n altitude = length(worldCoordinate.xyz) - earthRadius;\n return altitude;\n }\n\n void main(){\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n glColor = color;\n return;\n }\n // 此方法有问题 会闪烁\n float depth = getDepth(currD);\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec4 positionWC = czm_inverseView * positionEC;\n // 获取当前点的高度\n // vec3 positionWC = getWorldCoordinateFromDepth(currD);\n vec3 cartographic = getCartographicFromCartesian3(vec3(positionWC.x,positionWC.y,positionWC.z));\n // 高度加了10之后 就不闪烁了\n float pointHeight = cartographic.z + 10.;\n // 当前点高度越高,雾浓度越小,高度达到设定高度,雾浓度为0,同时乘以深度,距离越远,浓度越大\n float fog = (height/pointHeight - 1.);\n fog = clamp(fog, 0.0, 1.0);\n glColor = mix(color,vec4(1.0,1.,1.,1),fog*alpha);\n }",uniforms:{EPSILON12:()=>t.EPSILON12||1e-12,alpha:()=>t.alpha||.88,centerToleranceSquared:()=>t.centerToleranceSquared||.1,height:()=>t.height||100,oneOverRadii:()=>t.oneOverRadii||{x:1.567855942887398e-7,y:1.567855942887398e-7,z:1.573130351105623e-7},oneOverRadiiSquared:()=>t.oneOverRadiiSquared||{x:2458172257647332e-29,y:2458172257647332e-29,z:24747391015697002e-30}}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},xi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\nfloat getDistance(sampler2D depthTexture, vec2 texCoords) {\n float depth = czm_unpackDepth(texture(depthTexture, texCoords));\n if(depth == 0.0) {\n return czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n return -eyeCoordinate.z / eyeCoordinate.w;\n}\nfloat interpolateByDistanceMars3D(vec4 nearFarScalar, float distance) {\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) {\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform vec4 fogByDistance;\nuniform vec4 fogColor;\nin vec2 v_textureCoordinates;\nvoid main(void) {\n float distance = getDistance(depthTexture, v_textureCoordinates);\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n float blendAmount = interpolateByDistanceMars3D(fogByDistance, distance);\n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);\n out_FragColor = alphaBlend(finalFogColor, sceneColor);\n}\n ",uniforms:{fogColor:()=>t.fogColor||e.Color.WHITE,fogByDistance:()=>t.fogByDistance||new e.Cartesian4(100,0,9e3,.9)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Mi=t=>{const i=new e.PostProcessStageComposite({name:"undefinedcontrast_bias_blur",stages:[new e.PostProcessStage({name:"undefinedcontrast_bias",fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float contrast;\n uniform float brightness;\n void main(void)\n {\n vec4 texture1 = texture(colorTexture, v_textureCoordinates);\n vec3 sceneColor = texture1.rgb;\n\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n out_FragColor = vec4(sceneColor, texture1.a);\n }\n ",uniforms:{contrast:()=>128,brightness:()=>-.3}}),new e.PostProcessStageComposite({name:"undefined_blur_comp",stages:[new e.PostProcessStage({name:"undefinedhigh",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform float threshold;\n uniform float smoothWidth;\n\n in vec2 v_textureCoordinates;\n void main() {\n vec4 marstexel = texture( colorTexture, v_textureCoordinates );\n\n #ifdef CZM_SELECTED_FEATURE\n if (!czm_selected()) {\n marstexel = vec4(0.);\n }\n #endif\n\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float marsv = dot( marstexel.xyz, luma );\n float alpha = smoothstep(threshold, threshold + smoothWidth, marsv);\n\n vec4 outputColor = vec4(0.0,0.0,0.0,0.0);\n out_FragColor = mix( outputColor, marstexel, alpha );\n }\n ",uniforms:{threshold:()=>0,smoothWidth:()=>.01}})]})]}),o=t.scene.postProcessStages.add(new e.PostProcessStageComposite({name:"bloom_target",inputPreviousStageTexture:!1,stages:[i,new e.PostProcessStage({name:"undefinedgenerate_composite",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D bloomTexture;\n uniform float ratio;\n uniform vec4 color;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 color1 = texture(colorTexture, v_textureCoordinates);\n vec4 bloom = texture(bloomTexture, v_textureCoordinates);\n bloom *= color;\n if (czm_selected()) {\n bloom *= ratio;\n out_FragColor = bloom + color1;\n } else {\n out_FragColor = color1;\n }\n }\n ",uniforms:{bloomTexture:()=>"undefinedcontrast_bias_blur",color:()=>e.Color.GREEN,ratio:()=>2}})]}));o.enabled=!1;return o.selected=[],{stage:o,remove:()=>{t.scene.postProcessStages.remove(o)}}},Ei=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float size;\n uniform float direction;\n\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n\n void main(void) {\n\n float time = czm_frameNumber * speed / 1000.0;\n vec2 resolution = czm_viewport.zw;\n\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 finalColor = vec3(.6, .7, .8);//粒子的颜色\n\n float siMars3D = sin(direction), co = cos(direction);\n uv *= mat2(co, -siMars3D, siMars3D, co);\n uv *= length(uv + vec2(0, 4.9))*(20.0/size) + 1.0;\n\n float v = 1. - sin(hash(floor(uv.x * 100.0)) * 2.0);\n float b = clamp(abs(sin(20.0 * time * v + uv.y * (5. / (2.0 + v)))) - .95, 0.0, 1.0) * 20.0;\n finalColor *= v * b; //屏幕上雨的颜色\n\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雨和三维场景融合\n }\n ",uniforms:{speed:()=>t.speed||16,size:()=>t.size||20,direction:()=>360+(t.direction||30)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Di=t=>{const i=t.viewer,o=new e.PostProcessStage({fragmentShader:"\n#extension GL_OES_standard_derivatives:enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nin vec2 v_textureCoordinates;\nvec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n}\nfloat getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n}\nvec3 guussColor(vec2 uv){\n vec2 pixelSize = 1.0 / czm_viewport.zw;\n float dx0 = -pixelSize.x;\n float dy0 = -pixelSize.y;\n float dx1 = pixelSize.x;\n float dy1 = pixelSize.y;\n vec4 gc = (\n texture(colorTexture, uv)+\n texture(colorTexture, uv + vec2(dx0, dy0)) +\n texture(colorTexture, uv + vec2(0.0, dy0)) +\n texture(colorTexture, uv + vec2(dx1, dy0)) +\n texture(colorTexture, uv + vec2(dx0, 0.0)) +\n texture(colorTexture, uv + vec2(dx1, 0.0)) +\n texture(colorTexture, uv + vec2(dx0, dy1)) +\n texture(colorTexture, uv + vec2(0.0, dy1)) +\n texture(colorTexture, uv + vec2(dx1, dy1))\n ) * (1.0 / 9.0);\n return gc.rgb;\n}\nvoid main(){\n float offset = 0.0;\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n out_FragColor = color;\n return;\n }\n float depth = getDepth(currD);\n\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec3 dx = dFdx(positionEC.xyz);\n vec3 dy = dFdy(positionEC.xyz);\n vec3 normal = normalize(cross(dx,dy));\n\n vec4 positionWC = normalize(czm_inverseView * positionEC);\n vec3 normalWC = normalize(czm_inverseViewRotation * normal);\n float fotNumWC = dot(positionWC.xyz,normalWC);\n if(fotNumWC<=0.5){\n out_FragColor = color;\n return;\n }\n\n vec3 viewDir = normalize(positionEC.xyz);\n vec3 reflectDir = reflect(viewDir, normal);\n vec3 viewReflectDir = reflectDir;\n\n float step = 0.05;\n int stepNum = int(20.0 / step);\n vec3 pos;\n vec3 albedo;\n bool jd = false;\n for(int i = 1;i <= 400;i++)\n {\n float delta = step * float(i) + offset;\n pos = positionEC.xyz + viewReflectDir * delta;\n float d = -pos.z;\n\n vec4 tmp = czm_projection * vec4(pos,1.0);\n vec3 screenPos = tmp.xyz / tmp.w;\n vec2 uv = vec2(screenPos.x, screenPos.y) * 0.5 + vec2(0.5, 0.5);\n\n if(uv.x > 0.0 && uv.x < 1.0 && uv.y > 0.0 && uv.y < 1.0){\n float dd = getDepth(texture(depthTexture, uv));\n vec4 jzc = toEye(uv, dd);\n dd = -jzc.z;\n if(d>dd){\n if(abs(abs(d) - abs(dd)) <=step){\n jd = true;\n // albedo = texture(colorTexture, uv).rgb;\n albedo = guussColor(uv);\n }\n break;\n }\n }\n }\n if(jd){\n out_FragColor = vec4(mix(color.xyz,albedo,0.5),1.0);\n }else{\n out_FragColor = color;\n }\n}\n",uniforms:{}});i.scene.postProcessStages.add(o);return{stage:o,remove:()=>{i.scene.postProcessStages.remove(o)}}},Ai=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n float hash(float x)\n {\n return fract(21654.6512 * sin(385.51 * x));\n }\n float hash(vec2 p)\n {\n return fract(1654.65157 * sin(15.5134763 * p.x + 45.5173247 * p.y + 5.21789));\n }\n vec2 hash2(vec2 p)\n {\n return vec2(hash(p * .754), hash(1.5743 * p + 4.5476351));\n }\n vec2 add = vec2(1.0, 0.0);\n vec2 noise2(vec2 x)\n {\n vec2 p = floor(x);\n vec2 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n vec2 res = mix(mix(hash2(p),\n hash2(p + add.xy), f.x),\n mix(hash2(p + add.yx), hash2(p + add.xx), f.x), f.y);\n return res;\n }\n vec2 fbm2(vec2 x)\n {\n vec2 r = vec2(0.0);\n float a = 1.0;\n for (int i = 0; i < 8; i++)\n {\n r += noise2(x) * a;\n x *= 2.;\n a *= .5;\n }\n return r;\n }\n float dseg(vec2 ba, vec2 pa)\n {\n float h = clamp(dot(pa, ba) / dot(ba, ba), -0.2, 1.);\n return length(pa - ba * h);\n }\n uniform sampler2D colorTexture;\n uniform float fallInterval;\n uniform float mixFactor;\n in vec2 v_textureCoordinates;\n void main(void){\n vec2 uv = gl_FragCoord.xy;\n float iTime = czm_frameNumber * fallInterval * clamp(fallInterval * 0.1, 0.01, 0.1);\n vec2 p = uv / czm_viewport.zw;\n vec2 d;\n vec2 tgt = vec2(1., -1.);\n float c = 0.;\n if (p.y >= 0.)\n c = (1. - (fbm2((p + .2) * p.y + .1 * iTime)).x) * p.y;\n else\n c = (1. - (fbm2(p + .2 + .1 * iTime)).x) * p.y * p.y;\n vec3 col = vec3(0.);\n vec3 col1 = c * vec3(.3, .5, 1.);\n float mdist = 100000.;\n float t = hash(floor(5. * iTime));\n tgt += 4. * hash2(tgt + t) - 1.5;\n if (hash(t + 2.3) > .6)\n for (int i = 0; i < 100; i++) {\n vec2 dtgt = tgt - p;\n d = .05 * (vec2(-.5, -1.) + hash2(vec2(float(i), t)));\n float dist = dseg(d, dtgt);\n mdist = min(mdist, dist);\n tgt -= d;\n c = exp(-1.2 * dist) + exp(-55. * mdist);\n col = c * vec3(.7, .8, 1.);\n }\n col += col1;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(col, 0.0), mixFactor);\n}\n ",uniforms:{mixFactor:()=>t.mixFactor||.1,fallInterval:()=>t.fallInterval||.8}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Si=t=>new e.CustomShader({vertexShaderText:Ii,fragmentShaderText:Ti,translucencyMode:0,lightingModel:e.LightingModel.UNLIT,uniforms:{colorEnable:{type:e.UniformType.BOOL,value:t.colorEnable||!0},glowEnable:{type:e.UniformType.BOOL,value:t.glowEnable||!0},baseHeight:{type:e.UniformType.FLOAT,value:t.baseHeight||100},glowRange:{type:e.UniformType.FLOAT,value:t.glowRange||100},uColor:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE},glowTime:{type:e.UniformType.FLOAT,value:t.glowTime||1}}}),Ii="\n void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {\n vsOutput.positionMC += 0.1 * vsInput.attributes.normalMC;\n }\n",Ti="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n {\n vec4 position = czm_inverseModelView * vec4(fsInput.attributes.positionEC,1); // 位置 \n vec4 color = uColor;\n color *= vec4(vec3(position.z / baseHeight), 0.5); // 渐变\n bool glEnable = glowEnable;\n // if(position.z > baseHeight) {\n // material.diffuse = vec3(1.0,0.0,0.0);\n // return;\n // }\n if(position.z < 40.0) {\n glEnable = false;\n }\n if(!glEnable){\n material.diffuse = color.rgb;\n return; \n }\n \n // 动态光环\n float time = fract(czm_frameNumber / (360.0 * glowTime));\n time = abs(time - 0.5) * 2.0;\n float diff = step(0.005, abs(clamp(position.z / glowRange, 0.0, 1.0) - time));\n color.rgb += color.rgb * (1.0 - diff);\n material.diffuse = color.rgb;\n } \n",zi=t=>new e.CustomShader({fragmentShaderText:Fi,uniforms:{color:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE}}}),Fi="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n vec4 originColor = vec4(material.diffuse,1.0);\n material.diffuse = vec3(mix(originColor,color,0.3));\n material.alpha = 0.8;\n }\n",Ri=t=>{const i=t.scene.postProcessStages.add(e.PostProcessStageLibrary.createSilhouetteStage());i.uniforms.color=e.Color.YELLOW,i.selected=[];return{stage:i,remove:()=>{}}};var Oi=(e=>(e.DRAW_ADD="drawAdd",e.DRAW_MOVE="drawMove",e.DRAW_PICK="drawPick",e.DRAW_DB_CLICK="drawDbClick",e.DRAW_RIGHT_CLICK="drawRightClick",e))(Oi||{}),Li=Object.freeze({__proto__:null,DrawEventType:Oi});const Bi={drawStart:{circle:"单击左键绘制圆的中心点,单机右键取消绘制。",rectangle:"单击左键绘制矩形左上角。",point:"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。",default:"单击左键绘制第一个节点,单机右键取消绘制。"},drawMove:{circle:"单击左键确定圆的半径并结束绘制,单机右键取消绘制。",rectangle:"单击左键结束绘制,单机右键取消绘制。","vertical-line":"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。","default-dbclick":"单机左键绘制下一个节点,双击左键结束绘制,单机右键撤销上次绘制。",default:"单机左键绘制下一个节点,单机右键撤销上次绘制。"},drawEnd:"单击左键结束绘制,单机右键取消上次绘制",pointEnter:"双击左键编辑节点。",drawEditMove:{default:"移动鼠标修改节点,单击左键确定修改,单机右键取消修改。"}},ki={point:{color:"rgba(255,255,0,0.8)",pixelSize:8,outlineColor:"rgba(255,255,255,0.8)",outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},polyline:{width:2,color:"rgba(81,255,0,0.8)",depthFailColor:"rgba(255,0,0,0.5)"},polygon:{color:"rgba(255,255,54,0.3)",depthFailColor:"rgba(255,0,0,0.3)"}};class Ni extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=p(t).map(e=>te([e.longitude,e.latitude])),o=h(t[0]).height,n=We(t[0],t[1]),[r,a,s]=[i[0],i[1],i[2]],l=Ve(r,n/1e3,de(r,a),de(r,s)).geometry.coordinates.map(e=>[e[0],e[1],o]);l.push([...r.geometry.coordinates,o]),l.unshift([...r.geometry.coordinates,o]),this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(l.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Gi=(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),Ui=e=>{let t=0;return e&&Array.isArray(e)&&e.length>0&&e.forEach((i,o)=>{o<e.length-1&&(t+=Gi(i,e[o+1]))}),t},Vi=e=>Ui(e)**.99,$i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Hi=(e,t)=>{let i;const o=Math.asin(Math.abs(t[1]-e[1])/Gi(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=o+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=2*Math.PI-o:t[1]<e[1]&&t[0]<e[0]?i=o:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-o),i},Wi=(e,t,i)=>{const o=Hi(t,e)-Hi(t,i);return o<0?o+2*Math.PI:o},qi=(e,t,i,o,n)=>{const r=Hi(e,t),a=n?r+i:r-i,s=o*Math.cos(a),l=o*Math.sin(a);return[t[0]+s,t[1]+l]},ji=function(e){if(e.length<=2)return e;const t=[],i=e.length-1;for(let o=0;o<=1;o+=.01){let[n,r]=[0,0];for(let t=0;t<=i;t++){const a=Yi(i,t),s=o**t,l=(1-o)**(i-t);n+=a*s*l*e[t][0],r+=a*s*l*e[t][1]}t.push([n,r])}return t.push(e[i]),t},Zi=e=>{let t=1;switch(e){case e<=1:t=1;break;case 2===e:t=2;break;case 3===e:t=6;break;case 24===e:t=24;break;case 5===e:t=120;break;default:for(let i=1;i<=e;i++)t*=i}return t},Yi=(e,t)=>Zi(e)/(Zi(t)*Zi(e-t));class Ji extends rt{positions;drawData;depthFailAppearance;connPoint;tempPoint4;llBodyPnts=[];rrBodyPnts=[];isClockWise;neckWidthFactor;headWidthFactor;headHeightFactor;neckHeightFactor;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance(),this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.connPoint=[0,0],this.tempPoint4=[0,0],this.isClockWise=!1}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=[],o=p(t).map(e=>(i.push(e.height),[e.longitude,e.latitude])),n=Math.max(...i),[r,a,s]=[o[0],o[1],o[2]],l=o.length;let c,d;3===l?(this.tempPoint4=this.getTempPoint4(r,a,s),this.connPoint=$i(r,a)):4===l?(this.tempPoint4=o[3],this.connPoint=$i(r,a)):(this.tempPoint4=o[3],this.connPoint=o[4]),this.isClockWise=((e,t,i)=>(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0]))(r,a,s),this.isClockWise?(c=this.getArrowPoints(r,this.connPoint,this.tempPoint4,!1),d=this.getArrowPoints(this.connPoint,a,s,!0)):(c=this.getArrowPoints(a,this.connPoint,s,!1),d=this.getArrowPoints(this.connPoint,r,this.tempPoint4,!0));const h=c.length,m=(h-5)/2,g=c.slice(0,m),f=c.slice(m,m+5);let v=c.slice(m+5,h);this.llBodyPnts=g;let y=d.slice(0,m);const C=d.slice(m,m+5),w=d.slice(m+5,h);this.rrBodyPnts=w,y=ji(y);const b=ji(w.concat(g.slice(1)));v=ji(v);const P=y.concat(C,b,f,v).filter(e=>e[0]&&e[1]).map(t=>new e.Cartographic(t[0],t[1],n)),_=u(P);this.drawData.shapePositions=_,this.drawData.shapePositions.push(_[0]),this.setShapePositions(this.drawData.shapePositions)}getTempPoint4(e,t,i){const o=$i(e,t),n=Gi(o,i),r=Wi(e,o,i);let a,s,l,c=[0,0];return r<Math.PI/2?(a=n*Math.sin(r),s=n*Math.cos(r),l=qi(e,o,Math.PI/2,a,!1),c=qi(o,l,Math.PI/2,s,!0)):r>=Math.PI/2&&r<Math.PI?(a=n*Math.sin(Math.PI-r),s=n*Math.cos(Math.PI-r),l=qi(e,o,Math.PI/2,a,!1),c=qi(o,l,Math.PI/2,s,!1)):r>=Math.PI&&r<1.5*Math.PI?(a=n*Math.sin(r-Math.PI),s=n*Math.cos(r-Math.PI),l=qi(e,o,Math.PI/2,a,!0),c=qi(o,l,Math.PI/2,s,!0)):(a=n*Math.sin(2*Math.PI-r),s=n*Math.cos(2*Math.PI-r),l=qi(e,o,Math.PI/2,a,!0),c=qi(o,l,Math.PI/2,s,!1)),c}getArrowPoints(e,t,i,o){const n=$i(e,t),r=Gi(n,i);let a=qi(i,n,0,.3*r,!0),s=qi(i,n,0,.5*r,!0);a=qi(n,a,Math.PI/2,r/5,o),s=qi(n,s,Math.PI/2,r/4,o);const l=[n,a,s,i],c=this.getArrowHeadPoints(l);if(!(c&&Array.isArray(c)&&c.length>0))throw new Error("Interpolation Error");{const i=c[0],o=c[4],n=Gi(e,t)/Vi(l)/2,r=this.getArrowBodyPoints(l,i,o,n);if(r){const n=r.length;let a=r.slice(0,n/2),s=r.slice(n/2,n);return a.push(i),s.push(o),a=a.reverse(),a.push(t),s=s.reverse(),s.push(e),a.reverse().concat(c,s)}}}getArrowBodyPoints(e,t,i,o){const n=Ui(e),r=Vi(e)*o,a=(r-Gi(t,i))/2;let s=0;const l=[],c=[];for(let t=1;t<e.length-1;t++){const i=Wi(e[t-1],e[t],e[t+1])/2;s+=Gi(e[t-1],e[t]);const o=(r/2-s/n*a)/Math.sin(i),d=qi(e[t-1],e[t],Math.PI-i,o,!0),p=qi(e[t-1],e[t],i,o,!1);l.push(d),c.push(p)}return l.concat(c)}getArrowHeadPoints(e){const t=Vi(e)*this.headHeightFactor,i=e[e.length-1],o=t*this.headWidthFactor,n=t*this.neckWidthFactor,r=t*this.neckHeightFactor,a=qi(e[e.length-2],i,0,t,!0),s=qi(e[e.length-2],i,0,r,!0),l=qi(i,a,Math.PI/2,o,!1),c=qi(i,a,Math.PI/2,o,!0);return[qi(i,s,Math.PI/2,n,!1),l,i,c,qi(i,s,Math.PI/2,n,!0)]}}class Ki extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<2)return;const i=p(t).map(e=>te([e.longitude,e.latitude])),o=h(t[0]).height,n=qe(t)/1e3,[r,a]=[i[0],i[1]],s=de(r,a),l=pe(r,.1*n,s-90,{units:"kilometers"}),c=pe(r,.1*n,s+90,{units:"kilometers"}),d=pe(r,.8*n,s-5,{units:"kilometers"}),u=pe(r,.8*n,s+5,{units:"kilometers"}),m=pe(r,.75*n,s-13,{units:"kilometers"}),g=pe(r,.75*n,s+13,{units:"kilometers"}),f=[...l.geometry.coordinates,o,...d.geometry.coordinates,o,...m.geometry.coordinates,o,...a.geometry.coordinates,o,...g.geometry.coordinates,o,...u.geometry.coordinates,o,...c.geometry.coordinates,o,...l.geometry.coordinates,o];this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(f.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Xi=e=>{const t=new Ni(e);e.primitives.add(t)},Qi=e=>{const t=new Ji(e);e.primitives.add(t)},eo=e=>{const t=new Ki(e);e.primitives.add(t)},to="cm",io="厘米",oo="m",no="米",ro="km",ao="千米",so="公里",lo="㎡",co="平方厘米",po="㎡",ho="平方米",uo="km²",mo="平方千米",go="平方公里",fo="亩",vo="公顷",yo={cm:"cm²",m:"㎡",km:"km²","米":"平方米","千米":"平方千米","公里":"平方公里"},Co=(e,t,i)=>t===i?e:e*Po(i),wo=(e,t,i)=>t===i?e:e*function(e){switch(e){case lo:return 1e4;case po:return 1;case uo:return 1e-6;case co:return 1e4;case ho:return 1;case mo:case go:return 1e-6;case fo:return.0015;case vo:return 1e-4;default:return 1}}(i),bo=e=>yo[e],Po=e=>{switch(e){case oo:return 1;case to:case io:return 100;case ro:return.001;case no:return 1;case ao:case so:return.001;default:return 1}};const _o=(t,i)=>{let o=t;if("vertical-surface-line"===i&&t.length>=1){const i=t[0],n=e.Cartographic.fromCartesian(i),r=e.Math.toDegrees(n.longitude),a=e.Math.toDegrees(n.latitude),s=0;o=[e.Cartesian3.fromDegrees(r,a,n.height),e.Cartesian3.fromDegrees(r,a,s)]}if("vertical-line"===i&&t.length>=2){const i=t[0],n=t[1],r=h(i),a=h(n);let s=r,l=a;r.height>a.height&&(s=a,l=r),console.log(s.longitude,s.latitude,l.height);const c=m(new e.Cartographic(s.longitude,s.latitude,l.height));o=[m(s),c,m(l),m(s)]}return i.startsWith("curve")&&t.length>2&&(o=Eo(t)),o},xo=(e,t,i,o,n)=>{i.push(...e.map((i,n)=>{const r=e[n+1];if(r){let e=t?je(i,r):We(i,r);return e=Co(e,"m",o),{value:Number(e.toFixed(2)),unit:o,position:Ye([i,r]),positions:[i,r]}}return null}).filter(e=>e&&e.value>0))},Mo=e=>{if(2===e.length)return e;let[t,i]=e;return i||(i=bo(t)),[t,i]},Eo=t=>{const i=t.length,o=Ze(t),n=Math.floor(o/5),r=[];for(let e=0;e<i;e++)r.push(1.5*e);const a=new e.CatmullRomSpline({points:t,times:r}),s=[],l=r[0],c=r[r.length-1];for(let t=0;t<n;t++){const i=t/(n-1),o=e.Math.lerp(l,c,i),r=a.evaluate(o);s.push(r)}return s},Do=(t,i=1e3)=>{if(t.length<2)return console.warn("至少需要2个点才能生成箭头"),[];const o=t[t.length-1],n=t[t.length-2],r=h(o),a=h(n),s=r.height,l=r.longitude-a.longitude,c=r.latitude-a.latitude,d=Math.sqrt(l**2+c**2);if(d<1e-12)return console.warn("最后两点经纬度重合,无法生成箭头"),[];const p=l/d,u=c/d,g=(t=>{const i=e.Math.toRadians(.5),o=m(t),n=m(new e.Cartographic(t.longitude+i,t.latitude,t.height)),r=2*e.Cartesian3.distance(o,n),a=m(new e.Cartographic(t.longitude,t.latitude+i,t.height));return{lon:r,lat:2*e.Cartesian3.distance(o,a)}})(r),f=i/g.lon*e.Math.RADIANS_PER_DEGREE,v=i/g.lat*e.Math.RADIANS_PER_DEGREE,y=Math.PI/6,C=i*Math.tan(y),w=C/g.lon*e.Math.RADIANS_PER_DEGREE,b=C/g.lat*e.Math.RADIANS_PER_DEGREE,P=r.longitude-p*f-u*w,_=r.latitude-u*v+p*b,x=r.longitude-p*f+u*w,M=r.latitude-u*v-p*b,E=m(new e.Cartographic(P,_,s)),D=m(new e.Cartographic(x,M,s));return[E,m(new e.Cartographic(r.longitude,r.latitude,s)),D]};class Ao extends rt{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=_o(this.positions,this.drawData.shape);if(this.drawData.shapePositions=t,"vertical-surface-line"===this.drawData.shape){const e=this.drawData.pointPrimitives.get(1);e&&(e.position=this.drawData.shapePositions[1])}if(this.setShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}}class So extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=JSON.parse(JSON.stringify(this.positions));if(this.calcShapePositions(t),this.positions.length<3)return;const i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(e){const t=[...e,e[0]];this.drawData.shapePositions=t,this.setShapePositions(this.drawData.shapePositions)}}class Io extends rt{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return;this.primitiveCollection.removeAll(),this.calcShapePositions(this.positions);const t=JSON.parse(JSON.stringify(this.positions)),i=this.drawData.clampToGround?je(t[0],t[1]):We(t[0],t[1]);if(!i)return;const o=e.Cartographic.fromCartesian(t[0]).height,n=[new e.GeometryInstance({geometry:new e.CircleGeometry({center:t[0],height:o,radius:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:n,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:n,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const o=We(t[0],t[1]),n=e.Cartographic.fromCartesian(t[0]).height,r=new e.CircleOutlineGeometry({center:t[0],height:n,radius:o}),a=e.CircleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class To extends rt{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return this.primitiveCollection;this.primitiveCollection.removeAll();const t=JSON.parse(JSON.stringify(this.positions));t.length=2,this.calcShapePositions(t);const i=e.Cartographic.fromCartesian(t[0]).height,o=e.Rectangle.fromCartesianArray(t),n=[new e.GeometryInstance({geometry:new e.RectangleGeometry({rectangle:o,height:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:n,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:n,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const o=e.Cartographic.fromCartesian(t[0]).height,n=e.Rectangle.fromCartesianArray(t),r=new e.RectangleOutlineGeometry({rectangle:n,height:o}),a=e.RectangleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class zo extends rt{drawData;labelCollection;measureDivs;cesiumWidget;viewer;constructor(t,i){super(),this.viewer=i,this.cesiumWidget=i._element.getElementsByClassName("cesium-widget")[0],this.drawData=t,this.labelCollection=new e.LabelCollection({scene:i.scene}),this.drawData.measureLabel&&this.setAppearance(),this.measureDivs=[],this.renderDivPosition()}getPrimitive(){return this.drawData.isEditing&&this.drawData.measureLabel?"point"===this.drawData.shape?(this.updatePointDivLabel(),this.labelCollection):this.drawData.shapePositions&&this.drawData.shapePositions.length>=2?(this.updateUnit(this.drawData.measureUnit),this.labelCollection):void 0:this.labelCollection}updateUnit(e){if("point"===this.drawData.shape)return;this.drawData.measureUnit=e,this.clearAllDiv();const t=(e=>{let{shapePositions:t,positions:i,shape:o,clampToGround:n,measureUnit:r}=e;t||(t=i),n||(n=!1);const[a,s]=Mo(r),l=bo(a);e.measureUnit=[a,s];const c=[];if("polyline"===o&&(xo(i,n,c,a),c.push({value:0,unit:a,position:i[0],positions:i,prefixText:"起点"}),c.push({value:Number(c.reduce((e,t)=>e+t.value,0).toFixed(2)),unit:a,position:i[i.length-1],positions:i})),"vertical-surface-line"===o&&xo(t,n,c,a),"vertical-line"===o&&(xo(t,n,c,a),c.forEach((e,t)=>{0===t&&(e.prefixText="高度"),1===t&&(e.prefixText="水平距离"),2===t&&(e.prefixText="空间距离")})),"polygon"===o){xo(t,n,c,a);const e=wo(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("rectangle"===o){xo(t,n,c,a);const e=wo(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("circle"===o){const e=n?je(i[0],i[1]):We(i[0],i[1]);c.push({value:Number(Co(e,"m",a).toFixed(2)),unit:a,position:i[1],positions:i,prefixText:"半径"});const t=wo(e*e*Math.PI,a,s);e>0&&c.push({value:Number(t.toFixed(2)),unit:s,position:i[0],positions:i})}return c})(this.drawData);this.drawData.measureResult=t,t.forEach((e,t)=>{let i="";e.prefixText?(i=`${e.prefixText}`,e.value&&(i+=`:${e.value}${e.unit}`)):i+=`${e.value}${e.unit}`;const o=this.createDiv(`measure-label-${this.drawData.id}-${t}`,i);this.measureDivs.push({position:e.position,divEle:o})})}updatePointDivLabel(){this.clearAllDiv(),this.drawData.positions.forEach(e=>{const t=h(e),i=this.createDiv(`measure-label-${this.drawData.id}-0`,`经度:${t.longitude.toFixed(6)}\n纬度:${t.latitude.toFixed(6)}\n高度:${t.height.toFixed(6)}`);this.measureDivs.push({position:e,divEle:i})})}renderDivPosition(){this.viewer.scene.postRender.addEventListener(()=>{this.measureDivs.forEach(e=>{const t=this.viewer.scene.cartesianToCanvasCoordinates(e.position);if(t){e.divEle.style.display="block";const i=e.divEle.getBoundingClientRect();e.divEle.style.left=t.x-i.width/2+"px",e.divEle.style.top=t.y-i.height+"px"}else e.divEle.style.display="none"})})}destroy(){super.destroy(),this.clearAllDiv()}setAppearance(){}clearAllDiv(){this.measureDivs.forEach(e=>{e.divEle.remove()}),this.measureDivs=[]}createDiv(e,t,i=48){const o=`\n <div style="\n background: rgba(0, 0, 0, 0.6);\n color: white;\n border-radius: 5px;\n padding: 0 10px 0 10px;\n font-size: 14px;\n white-space: nowrap;\n pointer-events: none;\n ">\n ${t.split("\n").map(e=>`\n <div style="height: 24px; line-height: 24px">\n ${e}\n </div>\n `).join(" ")}\n </div>\n <div style="\n height: ${i}px;\n width: 2px;\n background: rgba(0, 0, 0, 0.6);\n margin: auto;\n ">\n </div>\n `,n=document.createElement("div");return n.id=e,n.innerHTML=o,n.style.position="absolute",n.style.pointerEvents="none",n.className=`measure-label measure-label-${this.drawData.id}`,this.cesiumWidget.appendChild(n),n}calcShapePositions(e){this.setShapePositions(e)}}class Fo extends rt{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;viewer;arrowLengthScale;constructor(t,i){super(),this.arrowLengthScale=5,this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.viewer=i,this.setAppearance()}getGeometry(){if(this.positions.length<2)return;let t=this.positions;t=_o(t,this.drawData.shape);let i=Ze(t)/this.arrowLengthScale;return i>3e6&&(i=3e6),t=Do(t,i/2),this.calcShapePositions(t),t.length<2?void 0:(this.setShapePositions(t),this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width}))}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:this.drawData.id});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}class Ro extends rt{drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=this.drawData.shapePositions||[];if(this.calcShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}const Oo={point:1,circle:2,rectangle:2,sector:3,"vertical-surface-line":1,"vertical-line":2},Lo={},Bo=e=>{const{type:t,action:i,outline:o,pointCount:n}=e;Lo[t]=(e,t)=>{i(e,t),o&&Go(e)},n&&(Oo[t]=n)},ko=(e,t,i)=>{Lo[t]&&Lo[t](i,e)},No=e=>{const t=new Ao(e);e.primitives.add(t)},Go=e=>{const t=new Ro(e);e.primitives.add(t)},Uo=(e,t)=>{const i=new Fo(e,t);e.primitives.add(i)},Vo=e=>{const t=new So(e);e.primitives.add(t)},$o=e=>{const t=new Io(e);e.primitives.add(t)},Ho=e=>{const t=new To(e);e.primitives.add(t)},Wo=(e,t)=>{const i=new zo(e,t);e.primitives.add(i),e.measurePrimitive=i,e.primitives.raiseToTop(i)},qo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAQBJREFUWEft2MsNgkAQBuAZtABCBctBErvATryiRRibkKudGKvgwMFtQGIBumOAYAxCArsTs4fZ8w758032wSJ4PtDzfCABXTvEKhjmhXpka+0a6rueNWB0KgmAdLVLYq6QbAHDvEwDgksdzOAz5pKUgK6tFkERnCogq3iq1Ng8ERRBS4HBjTrKywMAqjnfJCKFAGlTg3ieU9vOJV1lq2O/bjhgcyv59yBt8LXpXzLYBFsE2toKojHX+z75kWc8iwsV0PLm8XVLArotivp/RFrsYiiCLnp1rQiKoKWAHHWWcJ8yZsFF8zbj5eNRt9VwPRp1hGyCrq0cq5eArrLeC74BlkT4KR3TrCoAAAAASUVORK5CYII=",jo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAY9JREFUWEftmNFRwzAMhiVYAMoC5Y50jjAJ9LFliMIQNI/NJtA1CA9hAHIsgMWZYC5xHVtNajcHzqtl+ctvSZaNMPIPR84HEXDoDv1tBc/XxRMCpFaVEPNqcTXvq6RTwbOsSE8FTfUFBOKNE05NQsxRiK3u4/MEy49F8myDdwJOstcNEN32VWCouhHQu4JetnYPp84tVr4uHl8OGofvd7Ocw8kGnKwL4jjk2lTLhLU2y0guGgE7pI8KdsVkuBhEzDtPGstYEEAkmstyMcmKFRDcN9WyjUk774AKQEE1IW1jyt47IACV1XJ22VRNQqKgN70Im9qyAIASbRdST4qunjEQoB3S1tAGBATQY05iy7ObEDdHLzMmOFPi6KBBFLTBuSC9A5rg6pijqSm79TrpHRC021o7IdrZfbwy8wNpztYacgRlhtuitu38b3E/rt9Z/w+Q9czBVtV9RCpX7I7adTKw2QBAIFy7njz2Bvy+OGXFighS9pvMDjWVdXlKHrg/xFaQ6/DQdhFwqKJRwaEKfgEJRgs46ima/wAAAABJRU5ErkJggg==",Zo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAMdJREFUWEdjZBjkgHGQu49h1IGUxtBoCI6GIKUhQKn+0TQ4GoKUhgCl+kfT4GgIUhoClOofTYM0DUGh6bfrGRgYFSi1BJ9+xn//Dr7NVluASw3eKBaadvs/LR0HM/sfI4Pjh0zVA9jswulAgenXFZj+s9ynjwP/KH7I1HxAkgNBioWn3kr4z8RkT1tH/n/wLlO1kawopq3DiDN9tJghLpxwqxoNwdEQpDQEKNU/mgZHQ5DSEKBU/2gaHA1BSkOAUv2jaXDYhyAAbjwcKU1UyjYAAAAASUVORK5CYII=",Yo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAkJJREFUWEftl19SwkAMxpPCARAvgDPijKewnER4BA8hHEJ5FE8CnsIZccZ6AJEDMF1Ny5Zu/6bNMvQBXmk3vyZfvmQRGv7DhvPBGVBaIasZ7M4/XwhoM74eScH0+9YAAzilhuHByttMbq5sQFoBNOE0lh1IMeDF83qJAG52tuSQIsBiODuZrA14+fQxVIhBUwSqA1hFmURcHPQIAIiLuo1TG5CguvP14z/Z1EcYtHzVi4ARpj7sXh3V/iLw30l/ULdhRIAUtDN/723Ht56RUYTpZtyf6f/qwtF7YkAdPAtQAmbdB08KSMF/Hm4WRRmpCkjeyWmc0hJHVlLSiaQ3gHYv/IidR7rM+6CDPZX7ZCFg0ueoW7fj/kqiLfoQ6u7DGcWQuYDHgNNQVSAzAZNwgQkjpDJHXldUSm1DDrTv01nHnmHmOQtGCpA3vsJwnJJ35mvXUbBkySJD5ylAPR04B54EMD7C4kJGBbMkdJn16BK3/FZq21GOc8eZ17lNYmZSeeHA76cgOZlOPpMse9G8zgUMOo3ErWC631c8H3Fk22bKlolCHzQgLRq1rk4ZHGtZIEjSUJneqo46zvhkAXI1VhWQe27pLOYe1FhAXapGLqzhddN3yYLQV9/myg9vwQQR3EdEGkz6pAL09KXJuECFUYIrAFcu8edqazDtk9nhOVZSBF4b0NhUIjM3Q0nhRCU2djtj4uznjvC6qc8XZTCer7gmbWTOOqDegpQCV3JRT+rRWgbrdCjnnTMgJ0tHsxlpcM77f6iGZThXF5iUAAAAAElFTkSuQmCC";class Jo{static editUI;_editUi;viewer;_editUiPosition=null;_editPointPrimitive=null;_drawEditEvent;elementId="draw-edit-ui";constructor(e,t){this._editUi=null,this.viewer=e,this.create(),this.setVisible(!1),this.renderPosition(),this._drawEditEvent=t}create(){if(this._editUi=document.getElementById(this.elementId),this._editUi)return this._editUi;const e=document.createElement("DIV");e.id=this.elementId,e.className="draw-edit-ui";const t=document.createElement("DIV");t.title="点击移动节点";const i=document.createElement("img");i.src=Yo,i.className="draw-edit-icon",t.appendChild(i),t.addEventListener("click",()=>{this._drawEditEvent.drawEditMove&&this._drawEditEvent.drawEditMove(this._editPointPrimitive)});const o=document.createElement("DIV");o.id="addPoint";const n=document.createElement("img");n.src=qo,n.title="点击添加节点",n.className="draw-edit-icon",o.appendChild(n),o.addEventListener("click",()=>{this._drawEditEvent.drawEditAdd&&this._drawEditEvent.drawEditAdd(this._editPointPrimitive)});const r=document.createElement("DIV"),a=document.createElement("img");r.id="removePoint",a.src=Zo,a.title="点击删除节点",a.className="draw-edit-icon",r.appendChild(a),r.addEventListener("click",()=>{this._drawEditEvent.drawEditRemove&&this._drawEditEvent.drawEditRemove(this._editPointPrimitive)});const s=document.createElement("DIV"),l=document.createElement("img");l.src=jo,l.title="点击删除绘制",l.className="draw-edit-icon",s.appendChild(l),s.addEventListener("click",()=>{this._drawEditEvent.drawDelete&&this._drawEditEvent.drawDelete(this._editPointPrimitive)}),e.appendChild(t),e.appendChild(o),e.appendChild(r),e.appendChild(s),document.body.appendChild(e),this._editUi=e}setAddElementStatus(e){const t=document.getElementById("addPoint"),i=document.getElementById("removePoint");t&&(t.style.display=e?"block":"none"),i&&(i.style.display=e?"block":"none")}static createEditUi(e,t){return Jo.editUI||(Jo.editUI=new Jo(e,t)),Jo.editUI}showAt(e,t,i){this.setVisible(!0),this._editUiPosition=e,this._editPointPrimitive=t,this.setAddElementStatus(!Oo[i])}setVisible(e){this._editUi&&(this._editUi.style.display=e?"flex":"none")}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(this._editUiPosition&&this._editUi&&"flex"===this._editUi.style.display){const e=this.viewer.scene.cartesianToCanvasCoordinates(this._editUiPosition);this._editUi.style.position="fixed",this._editUi.style.top=e.y-28+"px",this._editUi.style.left=`${e.x+15}px`}})}destroy(){Jo.editUI&&(this._editUi&&this._editUi.parentNode.removeChild(this._editUi),this._editUi=null)}}Lo.polyline=e=>{No(e)},Lo["polyline-arrow"]=(e,t)=>{No(e),Uo(e,t)},Lo.curve=e=>{No(e)},Lo["curve-arrow"]=(e,t)=>{No(e),Uo(e,t)},Lo["vertical-line"]=e=>{e.clampToGround=!1,No(e)},Lo["vertical-surface-line"]=e=>{e.clampToGround=!1,No(e)},Lo.polygon=e=>{Vo(e),Go(e)},Lo.circle=e=>{$o(e),Go(e)},Lo.rectangle=e=>{Ho(e),Go(e)},Bo({type:"sector",action:Xi,outline:!0,pointCount:3}),Bo({type:"db-arrow",action:Qi,outline:!0,pointCount:4}),Bo({type:"fine-arrow",action:eo,outline:!0,pointCount:2});const Ko=t=>{let i;const o=[];let n=new e.Cartesian3(0,0,0);const r=[];let a,s,l;const c=U.createToolTip(t),d=ki.point;let p=!1;((t,i)=>{const o=t.scene,n=new e.ScreenSpaceEventHandler(o.canvas);let r;t.cesiumWidget.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),n.setInputAction(e=>{const n=o.pickPosition(e.position),a=(new Date).getTime();if(r&&a-r<270){const o=t.scene.pick(e.position);return void i(Oi.DRAW_DB_CLICK,{position:n,pickPrimitive:o?.primitive,windowPosition:e.position})}i(Oi.DRAW_ADD,{position:n}),r=(new Date).getTime()},e.ScreenSpaceEventType.LEFT_CLICK),n.setInputAction(e=>{const n=t.scene.pick(e.endPosition),r=o.pickPosition(e.endPosition);i(Oi.DRAW_MOVE,{position:r,pickPrimitive:n?.primitive,windowPosition:e.endPosition}),n&&i(Oi.DRAW_PICK,{position:r,pickPrimitive:n?.primitive,windowPosition:e.endPosition})},e.ScreenSpaceEventType.MOUSE_MOVE),n.setInputAction(()=>{i(Oi.DRAW_RIGHT_CLICK,{})},e.ScreenSpaceEventType.RIGHT_CLICK)})(t,(e,t)=>{a&&(["drawDbClick","drawPick","drawMove","drawRightClick"].includes(e)||a.isEditing)&&v[e]?.(t)});const h=new e.PrimitiveCollection;h.destroyPrimitives=!1,t.scene.primitives.add(h);const u=()=>{a&&(a.isEditing=!1,a.isDisAdd=!0,w(),P.id===a.id?g():(m(a.id),a={}))},m=e=>{const t=r.findIndex(t=>t.id===e);if(-1===t)return;const i=r[t];i.positions.length=0,r.splice(t,1),A.drawRemove&&A.drawRemove(i),setTimeout(()=>{i.measurePrimitive?.clearAllDiv(),h.remove(i?.primitives)},300)},g=()=>{if(P.id)return P.id="",a.isDisAdd=!0,a.isEditing=!0,P.originPosition?(a.positions.splice(P.index,1,P.originPosition),P.pointPrimitive.position=P.originPosition):a?.positions.splice(P.index,1),A.drawEditEnd&&A.drawEditEnd(a),setTimeout(()=>{a.isEditing=!1,a.isDisAdd=!1},300),n=new e.Cartesian3(0,0,0),s=void 0,void w();if((!Oo[a.shape]||Oo[a.shape]>2)&&a.positions&&a.positions.length>2){const e=p?2:1,t=a.pointPrimitives.get(a.positions.length-e);return a.pointPrimitives.remove(t),void a?.positions.splice(a.positions.length-e,1)}n=new e.Cartesian3(0,0,0),s=void 0,m(a.id),a={},w()},f=i=>{i||(i=a),t._element.style.cursor="default",n=new e.Cartesian3(0,0,0),i.positions.pop(),i.isDisAdd=!0,setTimeout(()=>{i.isEditing=!1,i.isDisAdd=!1,A.drawEnd&&A.drawEnd(i),a={}},300),s=void 0,l&&(i.pointPrimitives.remove(l),l=void 0),w()},v={drawAdd:({position:e})=>{if(a.positions.push(e),p=!1,P.id)return A.drawEditEnd&&A.drawEditEnd(a),P.id="",void f();E(e,a),A.drawAdd&&A.drawAdd(e,a),a.positions.length>Oo[a.shape]&&f()},drawMove:({position:e,windowPosition:t})=>{if(p=!0,b(),e&&!a.isDisAdd&&a.isEditing){if(w(t),P.id)a.positions.splice(P.index,1,e),P.pointPrimitive.position=e;else{const t=a.positions.findIndex(e=>e.x===n.x&&e.y===n.y&&e.z===n.z);a.positions.push(e),-1!==t&&a.positions.splice(t,1),l&&a.pointPrimitives.remove(l),l=E(e,a)}n=e,A.drawMove&&A.drawMove(e,a)}},drawPick:({pickPrimitive:t,windowPosition:i})=>{a.isEditing||t instanceof e.PointPrimitive&&y(t,i)},drawDbClick:({position:e,windowPosition:t,pickPrimitive:i})=>{if(a.isEditing){if(Oo[a.shape])return;f()}else!a.isEditing&&i&&C(e,t,i)},drawRightClick:()=>{a.isEditing?g():i.setVisible(!1)}},y=(e,i)=>{const n=e.id.split("-")[1],a=r.find(e=>e.id===n);o.includes(e.id)||a&&a.edit&&(t._element.style.cursor="pointer",e.pixelSize=1.5*d.pixelSize,e.outlineWidth=1.5*d.outlineWidth,s=e,c.showAt(i,Bi.pointEnter),c.setVisible(!0))},C=(t,n,a)=>{if(a instanceof e.PointPrimitive){if(o.includes(a.id))return;const e=a.id.split("-")[1],n=r.find(t=>t.id===e);if(!n)return;if(!n.edit)return;console.log(a),i.showAt(t,a,n.shape),A.drawEditStart&&A.drawEditStart(n)}},w=e=>{if(!c)return void(t._element.style.cursor="default");if(!e||!a.positions)return t._element.style.cursor="default",void c.setVisible(!1);const i=Oo[a.shape]?"default":"default-dbclick";P.id?c.showAt(e,Bi.drawEditMove[a.shape]||Bi.drawEditMove.default):Oo[a.shape]!==a.positions.length?a.positions.length>1?c.showAt(e,Bi.drawMove[i]||Bi.drawMove[i]):c.showAt(e,Bi.drawStart[i]||Bi.drawStart.default):c.showAt(e,Bi.drawEnd)},b=()=>{s&&(s.pixelSize=d.pixelSize,s.outlineWidth=d.outlineWidth,w())},P={},_={drawEditAdd:o=>{i.setVisible(!1);const{id:n,index:r,drawData:s}=x(o),l=new e.Cartesian3(o.position.x,o.position.y,o.position.z);s?.positions.splice(r,0,l),a=s;const c=E(l,a);t._element.style.cursor="move",Object.assign(P,{id:n,index:r+1,pointPrimitive:c,originPosition:l}),a.isEditing=!0},drawEditMove:o=>{i.setVisible(!1),t._element.style.cursor="move";const{id:n,index:r,drawData:s}=x(o);a=s,Object.assign(P,{id:n,index:r,pointPrimitive:o,originPosition:new e.Cartesian3(o.position.x,o.position.y,o.position.z)}),a.isEditing=!0},drawEditRemove:e=>{i.setVisible(!1);const{index:t,drawData:o}=x(e);o.isEditing=!0,o.isDisAdd=!0,o?.positions.splice(t,1),o?.pointPrimitives.remove(e),A.drawEditEnd&&A.drawEditEnd(o),setTimeout(()=>{o.isEditing=!1,o.isDisAdd=!1},300)},drawDelete:e=>{i.setVisible(!1);const{id:t}=x(e);m(t)}};i=Jo.createEditUi(t,_);const x=e=>{const t=e.id.split("-")[1],i=r.find(e=>e.id===t),o=i.positions.findIndex(t=>t.x===e.position.x&&t.y===e.position.y&&t.z===e.position.z);return{id:t,drawData:i,index:o}},M=(t,i)=>{const o=new e.PrimitiveCollection,n=new e.PointPrimitiveCollection;o.add(n);const r={id:t.id,edit:t.edit||!1,measure:t.measure||!1,measureLabel:t.measureLabel||!1,disDepthFail:t.disDepthFail||!1,measureUnit:t.measureUnit||["m"],isEditing:!0,shape:t.shape,positions:i,clampToGround:t.clampToGround,pointPrimitives:n,primitives:o};return h.add(o),i.forEach(e=>{E(e,r)}),r},E=(t,i)=>i.pointPrimitives.add({id:`draw-${i.id}-${N()}`,position:t,...d,color:e.Color.fromCssColorString(d.color),outlineColor:e.Color.fromCssColorString(d.outlineColor)}),D=e=>{const i=M({...e},e.positions);i.positions.push(i.positions[i.positions.length-1]),a=i,r.push(i),ko(t,e.shape,i),e.measure&&Wo(i,t),i.primitives.raiseToTop(i.pointPrimitives),f(i)},A={};return{draw:e=>{t._element.style.cursor="crosshair",s=void 0,e.id=N();const i=M(e,[]);a=i,A.drawStart&&A.drawStart(i),r.push(i),ko(t,e.shape,i),e.measure&&Wo(i,t),i.primitives.raiseToTop(i.pointPrimitives)},removeEditing:u,remove:e=>{m(e.id),w()},removeAll:()=>{r.forEach(e=>{e.measurePrimitive?.clearAllDiv()}),h.removeAll(),r.length=0,u()},setDrawStyle:e=>{Object.assign(ki.point,e.point),Object.assign(ki.polyline,e.polyline),Object.assign(ki.polygon,e.polygon)},Event:A,updateMeasureUnit:(e,t)=>{if(-1===r.findIndex(t=>t.id===e.id))throw new Error("绘制对象不存在");const i=e.primitives._primitives.find(e=>e instanceof zo);i&&i.updateUnit(t)},reShowDrawData:D,reShowDrawDatas:e=>{e.forEach(e=>{D(e)})}}};var Xo=Object.freeze({__proto__:null});const Qo={PolylineFlow:"PolylineFlow",PolylineTrail:"PolylineTrail",CircleWave:"CircleWave",CircleRaderWave:"CircleRaderWave",CircleRaderFan:"CircleRaderFan",LightWall:"LightWall",CircleAperture:"CircleAperture",RadarScanCircle:"RadarScanCircle",EllipsoidElectric:"EllipsoidElectric",EllipsoidVScan:"EllipsoidVScan",EllipsoidHScan:"EllipsoidHScan",Corridor:"Corridor",Zaps:"Zaps"};(()=>{for(const t in Qo)e.Material[t]=Qo[t]})();const en={color:"rgba(255,255,255,1)",speed:6*Math.random()};class tn extends at{speed;color;name="";image="";constructor(t){super(),this.createPropertyDescriptors();const i={...en,...t};this.image=i.image,this.name=`${Qo.PolylineTrail}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.speed=this.speed,i.image=this.image,i}equals(t){return this===t||t instanceof tn&&this.speed===t.speed&&e.Property.equals(this.color,t.color)&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{image:this.image,color:e.Color.fromCssColorString("#ff0000"),speed:this.speed},source:nn},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const on=t=>{const i={...en,...t};return new e.Material({fabric:{type:`${Qo.PolylineTrail}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed},source:nn},translucent:!0})},nn="\n uniform sampler2D image;\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec4 colorImage = texture(image,st);\n vec3 fragColor = color.rgb;\n if(st.t > 0.45 && st.t < 0.55 ) {\n fragColor = vec3(1.0);\n }\n if(color.a == 0.0){\n material.alpha = colorImage.a * 1.5 * fract(st.s - time);\n material.diffuse = colorImage.rgb;\n }else{\n material.alpha = colorImage.a * color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));\n material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);\n }\n return material;\n }\n\n",rn={color:"rgba(255,255,255,1)",speed:6,repeatCount:4,blendColor:!0};class an extends at{repeatCount;image;speed;color;blend;name="";constructor(t){super(),this.createPropertyDescriptors();const i={...rn,...t};this.name=`${Qo.PolylineFlow}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.image=i.image,this.repeatCount=i.repeatCount,this.blend=i.blendColor?1:0,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.image=this.image,i.blend=this.blend,i.speed=this.speed,i.repeatCount=this.repeatCount,i}equals(e){return this===e||e instanceof an&&this.speed===e.speed&&this.repeatCount===e.repeatCount&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:e.Color.fromCssColorString("#ffffff"),image:"",speed:this.speed,count:this.repeatCount,blend:this.blend},source:ln},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const sn=t=>{const i={...rn,...t};return new e.Material({fabric:{type:Qo.PolylineFlow+N(),uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed,count:i.repeatCount,blend:i.blendColor?1:0},source:ln},translucent:!0})},ln="\n uniform vec4 color;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract( count * st.s - time),fract(st.t)));\n material.alpha = colorImage.a * color.a;\n if(blend > 0.5) {\n material.diffuse = (colorImage.rgb + color.rgb) * 2.0;\n } else {\n material.diffuse = color.rgb * 2.0 ;\n }\n return material;\n }\n",cn={color:"rgba(255,255,0,0.3)",speed:8,count:5,gradient:.3};class dn extends at{count;speed;gradient;color;name="";constructor(t){super(),t||(t={});const i={...cn,...t};this.name=`${Qo.CircleWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.count=i.count,this.gradient=i.gradient,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i.repeatCount=this.count||cn.count,i}equals(t){return this===t||t instanceof dn&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.count===t.count&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed,count:this.count,gradient:this.gradient},source:hn},translucent:()=>!0})}}const pn=t=>{const i={...cn,...t};return{material:new e.Material({fabric:{type:`${Qo.CircleWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed,count:i.count,gradient:i.gradient},source:hn},translucent:!0})}},hn="\n uniform vec4 color;\n uniform float speed;\n uniform float count;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber * speed / 1000.0);\n if(count == 1.0){\n if(dis > per * 0.5){\n discard;\n }else {\n material.alpha = color.a * dis / per / 2.0;\n }\n } else {\n vec3 str = materialInput.str;\n if(abs(str.z) > 0.001){\n discard;\n }\n if(dis > 0.5){\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n for(int i = 0; i <= 999; i++){\n if(float(i) <= count){\n disNum = perDis * float(i) - dis + per / count;\n if(disNum > 0.0){\n if(disNum < perDis){\n bl = 1.0 - disNum / perDis;\n }\n else if(disNum - perDis < perDis){\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\n }\n }\n }\n }\n }\n return material;\n }\n",un={color:"rgba(255,255,255,1)",speed:8};class mn extends at{speed;color;name="";constructor(t){super();const i={...un,...t};this.name=`${Qo.CircleRaderWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof mn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:fn},translucent:()=>!0})}}const gn=t=>{const i={...un,...t};return{material:new e.Material({fabric:{type:`${Qo.CircleRaderWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:fn},translucent:!0})}},fn="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n float rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 pos = st - vec2(0.5);\n float time = czm_frameNumber * speed / 1000.0 ;\n float r = length(pos);\n float t = atan(pos.y, pos.x) - time * 2.5;\n float a = (atan(sin(t), cos(t)) + PI)/(2.0*PI);\n float ta = 0.5;\n float v = smoothstep(ta-0.05,ta+0.05,a) * smoothstep(ta+0.05,ta-0.05,a);\n vec3 flagColor = color.rgb * v;\n float blink = pow(sin(time*1.5)*0.5+0.5, 0.8);\n flagColor = color.rgb * pow(a, 4.0*(.2+blink))*(sin(r*500.0)*.5+.5) ;\n flagColor = flagColor * pow(r, 0.4);\n material.alpha = length(flagColor) * 1.3;\n material.diffuse = flagColor * 3.0;\n return material;\n }\n",vn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class yn extends at{speed;color;name="";constructor(t){super();const i={...vn,...t};this.name=`${Qo.CircleRaderFan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof yn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:wn},translucent:()=>!0})}}const Cn=t=>{const i={...vn,...t};return{material:new e.Material({fabric:{type:`${Qo.CircleRaderFan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:wn},translucent:!0})}},wn="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // 绘制边线\n float dis = distance(materialInput.st, vec2(0.5));\n float alpha = step((0.5- 0.01), dis);\n\n material.alpha = alpha;\n material.diffuse = color.rgb;\n\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n float per = czm_frameNumber * speed / PI * 3.0 / 200.0;\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + per;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = (alpha + color.a) * dis;\n material.diffuse = color.rgb;\n }\n return material;\n }\n",bn={color:"rgba(255,255,0,0.3)",speed:8};class Pn extends at{speed;color;name="";constructor(t){super(),t||(t={});const i={...bn,...t};this.name=`${Qo.CircleAperture}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i}equals(t){return this===t||t instanceof Pn&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed},source:xn},translucent:()=>!0})}}const _n=t=>{const i={...bn,...t};return new e.Material({fabric:{type:`${Qo.CircleAperture}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:xn},translucent:!0})},xn="\n uniform vec4 color;\n uniform float speed;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float d = distance(st, vec2(0.5, 0.5));\n float alpha = step(.15, d) * step(d, .17) + step(.49, d) * step(d, 0.5) + d * d * step(d, 0.5);\n float movingCircleD = fract(czm_frameNumber * speed / 1000.0);\n alpha += step(movingCircleD, d) * step(d, movingCircleD + .015);\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n",Mn=t=>{t||(t={});return new e.Material({fabric:{type:`${Qo.RadarScanCircle}-${N()}`,uniforms:{radians:3*Math.PI/8,bgColor:e.Color.fromCssColorString(t.bgColor||"rgba(0,255,0,0.2)"),sectorColor:e.Color.fromCssColorString(t.sectorColor||"rgba(152,18,8,.1)"),width:t.width||.003,offset:t.offset||0,count:t.count||3},source:En},translucent:!0})},En="\n uniform vec4 bgColor;\n uniform vec4 sectorColor;\n uniform float count;\n uniform float radians;\n uniform float width;\n uniform float offset;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n\n float alpha;\n vec3 diffuse;\n // 绘制圆圈\n float sp = 1.0 / count / 2.0;\n float m = mod(dis, sp);\n alpha = step(sp * (1.0 - width * 10.0), m);\n // alpha = clamp(alpha, 0.2, 1.0);\n if (alpha < bgColor.a){\n alpha = bgColor.a;\n diffuse = bgColor.rgb;\n } else {\n diffuse = bgColor.rgb;\n }\n material.alpha = alpha;\n material.diffuse = diffuse;\n // 绘制十字线\n if ((st.s > 0.5 - width / 2.0 && st.s < 0.5 + width / 2.0) || (st.t > 0.5 - width / 2.0 && st.t < 0.5 + width / 2.0)) {\n material.alpha = 0.8;\n material.diffuse = bgColor.rgb;\n return material;\n }\n // 绘制光晕\n float ma = mod(dis + offset, 0.5);\n if (ma < 0.25){\n alpha = ma * 3.0 + alpha;\n } else{\n alpha = 3.0 * (0.5 - ma) + alpha;\n }\n material.alpha = alpha;\n material.diffuse = bgColor.rgb;\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + radians;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = alpha + sectorColor.a;\n material.diffuse = sectorColor.rgb;\n }\n return material;\n }\n",Dn={color:"rgba(255,255,255,1)",count:3,duration:1500};class An extends at{duration;count;vertical;direction;color;_time;image;name="";constructor(t){super();const i={...Dn,...t};Object.prototype.hasOwnProperty.call(i,"vertical")||(i.vertical=1),this.name=`LightWall-${N()}`,this._time=(new Date).getTime(),this.color=e.Color.fromCssColorString(i.color),this.duration=i.duration,this.count=i.count,this.vertical=i.vertical,this.image=i.image,this.direction=i.direction,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.image=this.image,i.vertical=this.vertical,i.direction=this.direction,i.count=this.count,i.duration=this.duration,this.duration&&(i.time=((new Date).getTime()-this._time)%this.duration/this.duration),i}equals(t){return this===t||t instanceof An&&e.Property.equals(this.color,t.color)&&this.name===t.name&&this.image===t.image&&this.vertical===t.vertical&&this.direction===t.direction&&this.count===t.count&&this.duration===t.duration}init(){const t=In({count:this.count,vertical:this.vertical,direction:this.direction});e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,duration:this.duration,vertical:this.vertical,image:this.image,count:this.count,time:-20},source:t},translucent:()=>!0})}}const Sn=t=>{const i={...Dn,...t};return{material:new e.Material({fabric:{type:`LightWall${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),duration:i.duration,vertical:i.vertical,image:i.image,count:i.count,time:-20},source:In({count:i.count,vertical:i.vertical,direction:i.direction})}})}},In=e=>{const t=e.vertical?"vertical":"standard",i=e.direction?"+":"-";let o="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";return o+="vertical"===t?`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.t ${i} time)),fract(st.s));\n `:`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.s ${i} time), fract(st.t)));\n `,o+="vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a * color.a;\n material.emission = fragColor.rgb;\n return material;\n }",o},Tn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class zn extends at{speed;color;name="";constructor(t){super();const i={...Tn,...t};this.name=`${Qo.EllipsoidElectric}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof zn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Rn},translucent:()=>!0})}}const Fn=t=>{const i={...Tn,...t};return{material:new e.Material({fabric:{type:`${Qo.EllipsoidElectric}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Rn},translucent:!0})}},Rn="\n uniform vec4 color;\n uniform float speed;\n #define pi 3.1415926535\n #define PI2RAD 0.01745329252\n #define TWO_PI (2. * PI)\n\n float rands(float p){\n return fract(sin(p) * 10000.0);\n }\n\n float noise(vec2 p){\n float time = fract( czm_frameNumber * speed / 1000.0);\n float t = time / 20000.0;\n\n if(t > 1.0) t -= floor(t);\n return rands(p.x * 14. + p.y * sin(t) * 0.5);\n }\n\n vec2 sw(vec2 p){\n return vec2(floor(p.x), floor(p.y));\n }\n\n vec2 se(vec2 p){\n return vec2(ceil(p.x), floor(p.y));\n }\n\n vec2 nw(vec2 p){\n return vec2(floor(p.x), ceil(p.y));\n }\n\n vec2 ne(vec2 p){\n return vec2(ceil(p.x), ceil(p.y));\n }\n\n float smoothNoise(vec2 p){\n vec2 inter = smoothstep(0.0, 1.0, fract(p));\n float s = mix(noise(sw(p)), noise(se(p)), inter.x);\n float n = mix(noise(nw(p)), noise(ne(p)), inter.x);\n return mix(s, n, inter.y);\n }\n\n float fbm(vec2 p){\n float z = 2.0;\n float rz = 0.0;\n vec2 bp = p;\n for(float i = 1.0; i < 6.0; i++){\n rz += abs((smoothNoise(p) - 0.5)* 2.0) / z;\n z *= 2.0;\n p *= 2.0;\n }\n return rz;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 st2 = materialInput.st;\n float time = fract( czm_frameNumber * speed / 1000.0);\n if (st.t < 0.5) {\n discard;\n }\n st *= 4.;\n float rz = fbm(st);\n st /= exp(mod( time * 2.0, pi));\n rz *= pow(15., 0.9);\n vec4 temp = vec4(0);\n temp = mix( color / rz, vec4(color.rgb, 0.1), 0.2);\n if (st2.s < 0.05) {\n temp = mix(vec4(color.rgb, 0.1), temp, st2.s / 0.05);\n }\n if (st2.s > 0.95){\n temp = mix(temp, vec4(color.rgb, 0.1), (st2.s - 0.95) / 0.05);\n }\n material.diffuse = temp.rgb;\n material.alpha = temp.a * 2.0;\n return material;\n }\n",On={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Ln extends at{speed;color;name="";constructor(t){super();const i={...On,...t};this.name=`${Qo.EllipsoidVScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Ln&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:kn},translucent:()=>!0})}}const Bn=t=>{const i={...On,...t};return{material:new e.Material({fabric:{type:`${Qo.EllipsoidVScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:kn},translucent:!0})}},kn="\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\n alpha += .1;\n material.alpha = alpha;\n material.diffuse = color.rgb;\n return material;\n }\n",Nn={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Gn extends at{speed;color;name="";constructor(t){super();const i={...Nn,...t};this.name=`${Qo.EllipsoidHScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Gn&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Vn},translucent:()=>!0})}}const Un=t=>{const i={...Nn,...t};return{material:new e.Material({fabric:{type:`${Qo.EllipsoidHScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Vn},translucent:!0})}},Vn="\nuniform vec4 color; \nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st; \n float t = fract( czm_frameNumber * speed / 1000.0);; \n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s); \n alpha += 0.1;\n alpha *= step(-0.5, -abs(0.5-st.t)); \n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n}\n",$n={color:"rgba(255,255,255,1)",speed:1};class Hn extends at{color;speed;name="";constructor(t){super();const i={...$n,...t};this.name=Qo.Zaps,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i}equals(t){return this===t||t instanceof Hn&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(Qo.Zaps,{fabric:{type:Qo.Zaps,uniforms:{uColor:this.color,speed:this.speed,uResolution:new e.Cartesian2(1024,1024)},source:qn},translucent:()=>!0})}}const Wn=t=>{const i={...$n,...t};return{material:new e.Material({fabric:{type:Qo.Zaps,uniforms:{uColor:e.Color.fromCssColorString(i.color),uSpeed:i.speed,uResolution:new e.Cartesian2(1024,1024)},source:qn}})}},qn="\n uniform float uSpeed;\n uniform vec4 uColor;\n uniform vec2 uResolution;\n\n void mainImage(out vec4 o, vec2 u, float time)\n {\n vec2 v = uResolution.xy;\n u = .2*(u+u-v)/v.y;\n\n vec4 z = o = vec4(1,2,3,0);\n for (float a = .5, t = time, i;\n ++i < 19.;\n o += (1. + cos(z+t))\n / length((1.+i*dot(v,v))\n * sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))\n )\n v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,\n // use stanh here if shader has black artifacts\n // vvvv\n u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))\n ,u)\n * cos(1e2*u.yx + t)) / 2e2\n + .2 * a * u\n + cos(4./exp(dot(o,o)/1e2) + t) / 3e2;\n\n o = 25.6 / (min(o, 13.) + 164. / o)\n - dot(u, u) / 250.;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n float time = fract(czm_frameNumber * speed / 1000.0);\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec4 color = vec4(0.0,0.0,0.0,1.0);\n mainImage(color,materialInput.st * uResolution,time);\n\n material.diffuse = color.rgb * uColor.rgb;\n material.alpha = 0.33 + (sin(time * 0.3) + 1.0) / 3.0;\n return material;\n }\n ";class jn extends rt{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){t?this.appearance=t:(this.appearance=new e.MaterialAppearance({material:Mn(this.options.materialOptions||{}),flat:!1,faceForward:!1,translucent:!0,closed:!1,...this.options.appearanceOptions||{}}),this.options.viewer.scene.preRender.addEventListener(()=>{this.appearance.material.uniforms.radians+=3*Math.PI/300}))}}const Zn=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let Yn=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const n=o>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=Zn[15&o];if(!r)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,r,t)}constructor(e,t=64,i=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=Zn.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+r+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Jn(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,d=s.pop()||0,p=s.pop()||0;if(d-p<=a){for(let a=p;a<=d;a++){const s=r[2*a],c=r[2*a+1];s>=e&&s<=i&&c>=t&&c<=o&&l.push(n[a])}continue}const h=p+d>>1,u=r[2*h],m=r[2*h+1];u>=e&&u<=i&&m>=t&&m<=o&&l.push(n[h]),(0===c?e<=u:t<=m)&&(s.push(p),s.push(h-1),s.push(1-c)),(0===c?i>=u:o>=m)&&(s.push(h+1),s.push(d),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:n,nodeSize:r}=this,a=[0,o.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,d=a.pop()||0,p=a.pop()||0;if(d-p<=r){for(let i=p;i<=d;i++)er(n[2*i],n[2*i+1],e,t)<=l&&s.push(o[i]);continue}const h=p+d>>1,u=n[2*h],m=n[2*h+1];er(u,m,e,t)<=l&&s.push(o[h]),(0===c?e-i<=u:t-i<=m)&&(a.push(p),a.push(h-1),a.push(1-c)),(0===c?e+i>=u:t+i>=m)&&(a.push(h+1),a.push(d),a.push(1-c))}return s}};function Jn(e,t,i,o,n,r){if(n-o<=i)return;const a=o+n>>1;Kn(e,t,a,o,n,r),Jn(e,t,i,o,a-1,1-r),Jn(e,t,i,a+1,n,1-r)}function Kn(e,t,i,o,n,r){for(;n>o;){if(n-o>600){const a=n-o+1,s=i-o+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Kn(e,t,i,Math.max(o,Math.floor(i-s*c/a+d)),Math.min(n,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=o,l=n;for(Xn(e,t,o,i),t[2*n+r]>a&&Xn(e,t,o,n);s<l;){for(Xn(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*o+r]===a?Xn(e,t,o,l):(l++,Xn(e,t,l,n)),l<=i&&(o=l+1),i<=l&&(n=l-1)}}function Xn(e,t,i,o){Qn(e,i,o),Qn(t,2*i,2*o),Qn(t,2*i+1,2*o+1)}function Qn(e,t,i){const o=e[t];e[t]=e[i],e[i]=o}function er(e,t,i,o){const n=e-i,r=t-o;return n*n+r*r}const tr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},ir=Math.fround||(or=new Float32Array(1),e=>(or[0]=+e,or[0]));var or;class nr{constructor(e){this.options=Object.assign(Object.create(tr),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:o}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[o,n]=i.geometry.coordinates,a=ir(sr(o)),s=ir(lr(n));r.push(a,s,1/0,t,-1,1),this.options.reduce&&r.push(0)}let a=this.trees[o+1]=this._createTree(r);t&&console.timeEnd(n);for(let e=o;e>=i;e--){const i=+Date.now();a=this.trees[e]=this._createTree(this._cluster(a,e)),t&&console.log("z%d: %d clusters in %dms",e,a.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,o,180,r],t),a=this.getClusters([-180,o,n,r],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(sr(i),lr(r),sr(n),lr(o)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+5]>1?rr(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),o="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(o);const r=n.data;if(t*this.stride>=r.length)throw new Error(o);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r[t*this.stride],l=r[t*this.stride+1],c=n.within(s,l,a),d=[];for(const t of c){const i=t*this.stride;r[i+4]===e&&d.push(r[i+5]>1?rr(r,i,this.clusterProps):this.points[r[i+3]])}if(0===d.length)throw new Error(o);return d}getLeaves(e,t,i){t=t||10,i=i||0;const o=[];return this._appendLeaves(o,e,t,i,0),o}getTile(e,t,i){const o=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:r,radius:a}=this.options,s=a/r,l=(i-s)/n,c=(i+1+s)/n,d={features:[]};return this._addTileFeatures(o.range((t-s)/n,l,(t+1+s)/n,c),o.data,t,i,n,d),0===t&&this._addTileFeatures(o.range(1-s/n,l,1,c),o.data,n,i,n,d),t===n-1&&this._addTileFeatures(o.range(0,l,s/n,c),o.data,-1,i,n,d),d.features.length?d:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,o,n){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?n+r.point_count<=o?n+=r.point_count:n=this._appendLeaves(e,r.cluster_id,i,o,n):n<o?n++:e.push(t),e.length===i)break}return n}_createTree(e){const t=new Yn(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,o,n,r){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,d;if(s)l=ar(t,e,this.clusterProps),c=t[e],d=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[o,n]=i.geometry.coordinates;c=sr(o),d=lr(n)}const p={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(d*n-o))]],tags:l};let h;h=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==h&&(p.id=h),r.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:o,reduce:n,minPoints:r}=this.options,a=i/(o*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=t)continue;s[i+2]=t;const o=s[i],d=s[i+1],p=e.within(s[i],s[i+1],a),h=s[i+5];let u=h;for(const e of p){const i=e*c;s[i+2]>t&&(u+=s[i+5])}if(u>h&&u>=r){let e,r=o*h,a=d*h,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const o of p){const l=o*c;if(s[l+2]<=t)continue;s[l+2]=t;const d=s[l+5];r+=s[l]*d,a+=s[l+1]*d,s[l+4]=g,n&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(s,l)))}s[i+4]=g,l.push(r/u,a/u,1/0,g,-1,u),n&&l.push(m)}else{for(let e=0;e<c;e++)l.push(s[i+e]);if(u>1)for(const e of p){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const o=this.clusterProps[e[t+6]];return i?Object.assign({},o):o}const o=this.points[e[t+3]].properties,n=this.options.map(o);return i&&n===o?Object.assign({},n):n}}function rr(e,t,i){return{type:"Feature",id:e[t+3],properties:ar(e,t,i),geometry:{type:"Point",coordinates:[(o=e[t],360*(o-.5)),cr(e[t+1])]}};var o}function ar(e,t,i){const o=e[t+5],n=o>=1e4?`${Math.round(o/1e3)}k`:o>=1e3?Math.round(o/100)/10+"k":o,r=e[t+6],a=-1===r?{}:Object.assign({},i[r]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:o,point_count_abbreviated:n})}function sr(e){return e/360+.5}function lr(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function cr(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}class dr extends rt{options;pointPrimitives=new e.PrimitiveCollection;boundingSphere=new e.BoundingSphere(e.Cartesian3.ZERO,0);pointCollection;labelCollection;billboardCollection;clusterImageCache={};supercluster;constructor(t){super(),this.options=t,this.clacBoundingSphere(this.options.geoJson),this.options.point&&(this.pointCollection=new e.PointPrimitiveCollection,this.pointPrimitives.add(this.pointCollection)),this.options.billboard&&(this.billboardCollection=new e.BillboardCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.billboardCollection)),this.options.label&&(this.labelCollection=new e.LabelCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.labelCollection)),t.cluster?(this.supercluster=new nr({radius:this.options.cluster?.radius||mr.radius,maxZoom:this.options.cluster?.maxZoom||mr.maxZoom}),this.initCluster(this.options.viewer,this.options.geoJson)):this.initCollection(this.options.geoJson)}initCollection=async t=>{await this.calcPointHeight(this.options.viewer,t);const i=[];t.features.forEach(t=>{if(i.push(e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),this.options.point){this.pointCollection.add(this.createPoint(t)).properties=t.properties||{}}if(this.options.billboard){this.billboardCollection.add(this.createBillboard(t)).properties=t.properties||{}}if(this.options.label){this.labelCollection.add(this.createLabel(t)).properties=t.properties||{}}})};clacBoundingSphere(t){const i=t.features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0));e.BoundingSphere.fromPoints(i,this.boundingSphere)}createPoint(t){const i={...pr,...this.options.point,...t.properties?.style?.point};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]),color:e.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,outlineColor:e.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createBillboard(t){const i={...ur,...this.options.billboard,...t.properties?.style?.billboard};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),image:i.image,scale:i.scale,width:t.properties?.cluster?void 0:i.width,height:t.properties?.cluster?void 0:i.height,color:t.properties?.cluster?void 0:e.Color.fromCssColorString(i.color),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i.heightReference,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createLabel(t){const i={...hr,...this.options.label,...t.properties?.style?.label};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),text:t.properties?.[i?.field]||i?.field,font:i?.font,fillColor:e.Color.fromCssColorString(i?.fillColor),outlineColor:e.Color.fromCssColorString(i?.outlineColor),outlineWidth:i?.outlineWidth,style:i?.style,scale:i?.scale,showBackground:i?.showBackground,backgroundColor:e.Color.fromCssColorString(i?.backgroundColor),backgroundPadding:e.Cartesian2.fromArray(i?.backgroundPadding),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i?.heightReference,scaleByDistance:i?.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i?.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}initCluster=async(t,i)=>{this.supercluster.load(i.features);let o=e.getTimestamp();this.loadCluster(t),t.camera.changed.addEventListener(()=>{e.getTimestamp()-o<=500||(o=e.getTimestamp(),this.loadCluster(t))})};flyToChildByClusterId(t){const i=this.supercluster?.getChildren(t),o=i?.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),n=e.BoundingSphere.fromPoints(o);return this.options.viewer.camera.flyToBoundingSphere(n),i}loadCluster=t=>{const i=tt(t.camera),o=t.camera.computeViewRectangle(),n=this.supercluster.getClusters([e.Math.toDegrees(o.west),e.Math.toDegrees(o.south),e.Math.toDegrees(o.east),e.Math.toDegrees(o.north)],i);this.clearCollection();const r=this.options.cluster.colorsByRate||mr.colorsByRate,a={type:"FeatureCollection",features:n.map(e=>{const t=e.properties.point_count/this.options.geoJson.features.length,o=Object.keys(r).find(e=>t>Number(e))||"#ff0000";if(e.properties.cluster){const t=this.getClusterImageByCount(r[o],e.properties.point_count,i),n=16*(String(e.properties.point_count).length+1);e.properties.style={...e.properties.style,billboard:{...e.properties.style?.billboard,image:t,pixelOffset:[0,-n/12]}}}return e})};this.initCollection(a)};getClusterImageByCount(t,i,o){if(!this.clusterImageCache[i+t]){const n=16*(String(i).length+1);let r=-Math.PI/12;const a=Math.PI/2,s=Math.PI/6,l=document.createElement("canvas");l.width=n,l.height=n;const c=l.getContext("2d");c.save(),c.scale(n/24,n/24),c.beginPath(),c.arc(12,12,6,0,2*Math.PI),c.fillStyle=t,c.fill(),c.closePath(),c.lineWidth=2,c.fillStyle="rgba(255,255,255,1)",c.font=`${this.calcfontSize(o)}px Microsoft YaHei`,c.textAlign="center",c.textBaseline="middle",c.fillText(`${i}`,11.5,12.5);for(let i=0;i<3;i++)c.beginPath(),c.arc(12,12,8,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.4).toCssColorString(),c.stroke(),c.arc(12,12,11,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.2).toCssColorString(),c.stroke(),c.closePath(),r=r+a+s;c.restore(),this.clusterImageCache[i+t]=l.toDataURL()}return this.clusterImageCache[i+t]}calcfontSize(e){return e<4?4:e-1}async calcPointHeight(t,i){if(this.options.calcHeight)if(t.scene.terrainProvider instanceof e.EllipsoidTerrainProvider)i.features.forEach(e=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=0:e.geometry.coordinates.push(0)});else{const o=t.scene.terrainProvider,n=i.features.map(t=>e.Cartographic.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),r=await e.sampleTerrainMostDetailed(o,n);i.features.forEach((e,t)=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=r[t].height:e.geometry.coordinates.push(r[t].height)})}}clearCollection(){this.pointCollection?.removeAll(),this.billboardCollection?.removeAll(),this.labelCollection?.removeAll()}remove(){}removeAll(){this.clearCollection(),this.pointPrimitives.removeAll()}getPrimitive(){return this.pointPrimitives}}const pr={color:"rgba(81,255,0,0.8)",pixelSize:10,outlineColor:"rgba(255,0,0,0.8)",outlineWidth:1},hr={font:"20px sans-serif",fillColor:"rgba(255,255,255,0.8)",outlineColor:"rgba(0,0,0,0.8)",backgroundColor:"rgba(0,0,0,1)",outlineWidth:2,pixelOffset:[0,0],backgroundPadding:[0,0],scale:1,disableDepthTestDistance:0,horizontalOrigin:0,verticalOrigin:0,heightReference:e.HeightReference.CLAMP_TO_GROUND},ur={image:"/icons/cesium-marker.png",scale:1,color:"rgba(255,0,0,1)",rotation:0,width:32,height:32,horizontalOrigin:0,verticalOrigin:0,pixelOffset:[0,-16],heightReference:e.HeightReference.CLAMP_TO_GROUND},mr={radius:60,maxZoom:25,colorsByRate:{.1:"#ff0000",.01:"#ff00ff",.001:"blue",1e-4:"#00ff00"}},gr={width:2,color:"rgba(0,255,0,0.8)"};class fr extends rt{options;polylinePrimitives;constructor(e){super(),this.options=e,this.polylinePrimitives=void 0,this.options.material&&this.setMaterialAppearance(),this.initCollection()}initCollection(){const t=[],i=[];let o;this.options.geoJson.features.forEach(e=>{"MultiLineString"===e.geometry.type?e.geometry.coordinates.forEach(t=>{i.push({coordinates:t,properties:e.properties})}):i.push({coordinates:e.geometry.coordinates,properties:e.properties})}),i.forEach(i=>{const o=i.coordinates.map(t=>e.Cartesian3.fromDegrees(t[0],t[1],t[2])),n={...gr,...this.options?.line,...i.properties?.style?.line};t.push(new e.GeometryInstance({id:N(),geometry:new e.GroundPolylineGeometry({positions:o,width:n?.width}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(n.color))}}))}),o=this.appearance?this.appearance:new e.PolylineColorAppearance,this.polylinePrimitives=new e.GroundPolylinePrimitive({geometryInstances:t,appearance:o})}getPrimitive(){return this.polylinePrimitives}setMaterialAppearance(){this.appearance=new e.MaterialAppearance({material:this.options.material})}}const vr={width:2,color:"rgba(0,255,0,0.8)"};class yr extends rt{options;primitives;constructor(e){super(),this.options=e,this.primitives=void 0,this.initCollection()}initCollection(){const t=[];this.options.geoJson.features.forEach(i=>{let o;o="Polygon"===i.geometry.type?new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(i.geometry.coordinates[0].flat())):Cr(i.geometry);const n={...vr,...this.options?.line,...i.properties?.style?.line},r=N();i.properties&&(i.properties.id=r);const a=new e.GeometryInstance({id:r,geometry:new e.PolygonGeometry({polygonHierarchy:o}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(n.color))}});t.push(a),a.properties=i.properties}),this.primitives=new e.GroundPrimitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({})})}getPrimitive(){return this.primitives}getAppearance(t){this.appearance=t||new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("rgba(81,255,0,0.8)")})})}}const Cr=t=>new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(t.coordinates[0][0].flat()));function wr(e,t,i,o,n,r){if(n-o<=i)return;const a=o+n>>1;br(e,t,a,o,n,r%2),wr(e,t,i,o,a-1,r+1),wr(e,t,i,a+1,n,r+1)}function br(e,t,i,o,n,r){for(;n>o;){if(n-o>600){const a=n-o+1,s=i-o+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);br(e,t,i,Math.max(o,Math.floor(i-s*c/a+d)),Math.min(n,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=o,l=n;for(Pr(e,t,o,i),t[2*n+r]>a&&Pr(e,t,o,n);s<l;){for(Pr(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*o+r]===a?Pr(e,t,o,l):(l++,Pr(e,t,l,n)),l<=i&&(o=l+1),i<=l&&(n=l-1)}}function Pr(e,t,i,o){_r(e,i,o),_r(t,2*i,2*o),_r(t,2*i+1,2*o+1)}function _r(e,t,i){const o=e[t];e[t]=e[i],e[i]=o}function xr(e,t,i,o){const n=e-i,r=t-o;return n*n+r*r}const Mr=e=>e[0],Er=e=>e[1];class Dr{constructor(e,t=Mr,i=Er,o=64,n=Float64Array){this.nodeSize=o,this.points=e;const r=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new r(e.length),s=this.coords=new n(2*e.length);for(let o=0;o<e.length;o++)a[o]=o,s[2*o]=t(e[o]),s[2*o+1]=i(e[o]);wr(a,s,o,0,a.length-1,0)}range(e,t,i,o){return function(e,t,i,o,n,r,a){const s=[0,e.length-1,0],l=[];let c,d;for(;s.length;){const p=s.pop(),h=s.pop(),u=s.pop();if(h-u<=a){for(let a=u;a<=h;a++)c=t[2*a],d=t[2*a+1],c>=i&&c<=n&&d>=o&&d<=r&&l.push(e[a]);continue}const m=Math.floor((u+h)/2);c=t[2*m],d=t[2*m+1],c>=i&&c<=n&&d>=o&&d<=r&&l.push(e[m]);const g=(p+1)%2;(0===p?i<=c:o<=d)&&(s.push(u),s.push(m-1),s.push(g)),(0===p?n>=c:r>=d)&&(s.push(m+1),s.push(h),s.push(g))}return l}(this.ids,this.coords,e,t,i,o,this.nodeSize)}within(e,t,i){return function(e,t,i,o,n,r){const a=[0,e.length-1,0],s=[],l=n*n;for(;a.length;){const c=a.pop(),d=a.pop(),p=a.pop();if(d-p<=r){for(let n=p;n<=d;n++)xr(t[2*n],t[2*n+1],i,o)<=l&&s.push(e[n]);continue}const h=Math.floor((p+d)/2),u=t[2*h],m=t[2*h+1];xr(u,m,i,o)<=l&&s.push(e[h]);const g=(c+1)%2;(0===c?i-n<=u:o-n<=m)&&(a.push(p),a.push(h-1),a.push(g)),(0===c?i+n>=u:o+n>=m)&&(a.push(h+1),a.push(d),a.push(g))}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}function Ar(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT),this._enabled=e.defaultValue(t.enabled,!1),this._pixelRange=e.defaultValue(t.pixelRange,80),this._minimumClusterSize=e.defaultValue(t.minimumClusterSize,2),this._clusterBillboards=e.defaultValue(t.clusterBillboards,!0),this._clusterLabels=e.defaultValue(t.clusterLabels,!0),this._clusterPoints=e.defaultValue(t.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=e.defaultValue(t.show,!0)}function Sr(e){return e.coord.x}function Ir(e){return e.coord.y}function Tr(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const zr=new e.BoundingRectangle;function Fr(t,i,o,n,r){if(e.defined(t._labelCollection)&&n._clusterLabels?r=e.Label.getScreenSpaceBoundingBox(t,i,r):e.defined(t._billboardCollection)&&n._clusterBillboards?r=e.Billboard.getScreenSpaceBoundingBox(t,i,r):e.defined(t._pointPrimitiveCollection)&&n._clusterPoints&&(r=e.PointPrimitive.getScreenSpaceBoundingBox(t,i,r)),Tr(r,o),n._clusterLabels&&!e.defined(t._labelCollection)&&e.defined(t.id)&&Lr(n,t.id.id)&&e.defined(t.id._label)){const a=n._collectionIndicesByEntity[t.id.id].labelIndex,s=n._labelCollection.get(a),l=e.Label.getScreenSpaceBoundingBox(s,i,zr);Tr(l,o),r=e.BoundingRectangle.union(r,l,r)}return r}function Rr(t,i){if(t.clusterShow=!0,!e.defined(t._labelCollection)&&e.defined(t.id)&&Lr(i,t.id.id)&&e.defined(t.id._label)){const e=i._collectionIndicesByEntity[t.id.id].labelIndex;i._labelCollection.get(e).clusterShow=!0}}function Or(e,t,i,o){const n={billboard:o._clusterBillboardCollection.add(),label:o._clusterLabelCollection.add(),point:o._clusterPointCollection.add()};n.billboard.show=!1,n.point.show=!1,n.label.show=!0,n.label.text=t.toLocaleString(),n.label.id=i,n.billboard.position=n.label.position=n.point.position=e,o._clusterEvent.raiseEvent(i,n)}function Lr(t,i){return e.defined(t)&&e.defined(t._collectionIndicesByEntity[i])&&e.defined(t._collectionIndicesByEntity[i].labelIndex)}function Br(t,i,o,n,r){if(!e.defined(t))return;const a=t.length;for(let s=0;s<a;++s){const a=t.get(s);if(a.clusterShow=!1,!a.show||r._scene.mode===e.SceneMode.SCENE3D&&!n.isPointVisible(a.position))continue;const l=a.computeScreenSpacePosition(o);e.defined(l)&&i.push({index:s,collection:t,clustered:!1,coord:l})}}const kr=new e.BoundingRectangle,Nr=new e.BoundingRectangle,Gr=new e.BoundingRectangle;function Ur(t,i,o,n){return function(r){let a=this[t];e.defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s,l,c=this._collectionIndicesByEntity[r.id];if(e.defined(c)||(c=this._collectionIndicesByEntity[r.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),e.defined(a)&&e.defined(c[n]))return a.get(c[n]);e.defined(a)||(a=this[t]=new i({scene:this._scene}));const d=this[o];return d.length>0?(s=d.pop(),l=a.get(s)):(l=a.add(),s=a.length-1),c[n]=s,Promise.resolve().then(()=>{this._clusterDirty=!0}),l}}function Vr(t,i){const o=t._collectionIndicesByEntity[i];e.defined(o.billboardIndex)||e.defined(o.labelIndex)||e.defined(o.pointIndex)||delete t._collectionIndicesByEntity[i]}function $r(t){if(!e.defined(t))return;const i=t.length;for(let e=0;e<i;++e)t.get(e).clusterShow=!0}Ar.prototype._initialize=function(t){this._scene=t;const i=(o=this,function(t){if(e.defined(t)&&t<.05||!o.enabled)return;const i=o._scene,n=o._labelCollection,r=o._billboardCollection,a=o._pointCollection;if(!e.defined(n)&&!e.defined(r)&&!e.defined(a)||!o._clusterBillboards&&!o._clusterLabels&&!o._clusterPoints)return;let s=o._clusterLabelCollection,l=o._clusterBillboardCollection,c=o._clusterPointCollection;e.defined(s)?s.removeAll():s=o._clusterLabelCollection=new e.LabelCollection({scene:i}),e.defined(l)?l.removeAll():l=o._clusterBillboardCollection=new e.BillboardCollection({scene:i}),e.defined(c)?c.removeAll():c=o._clusterPointCollection=new e.PointPrimitiveCollection;const d=o._pixelRange,p=o._minimumClusterSize,h=o._previousClusters,u=[],m=o._previousHeight,g=i.camera.positionCartographic.height,f=i.mapProjection.ellipsoid,v=i.camera.positionWC,y=new e.EllipsoidalOccluder(f,v),C=[];let w,b,P,_,x,M,E,D,A,S,I,T;o._clusterLabels&&Br(n,C,i,y,o),o._clusterBillboards&&Br(r,C,i,y,o),o._clusterPoints&&Br(a,C,i,y,o);const z=new Dr(C,Sr,Ir,64,Int32Array);if(g<m)for(P=h.length,w=0;w<P;++w){const t=h[w];if(!y.isPointVisible(t.position))continue;const n=e.Billboard._computeScreenSpacePosition(e.Matrix4.IDENTITY,t.position,e.Cartesian3.ZERO,e.Cartesian2.ZERO,i);if(!e.defined(n))continue;const r=1-g/m;let a=t.width=t.width*r,s=t.height=t.height*r;a=Math.max(a,t.minimumWidth),s=Math.max(s,t.minimumHeight);const l=n.x-.5*a,c=n.y-.5*s,d=n.x+a,f=n.y+s;for(x=z.range(l,c,d,f),M=x.length,S=0,A=[],b=0;b<M;++b)E=x[b],D=C[E],D.clustered||(++S,I=D.collection,T=D.index,A.push(I.get(T).id));if(S>=p)for(Or(t.position,S,A,o),u.push(t),b=0;b<M;++b)C[x[b]].clustered=!0}for(P=C.length,w=0;w<P;++w){const t=C[w];if(t.clustered)continue;t.clustered=!0,I=t.collection,T=t.index;const i=I.get(T);_=Fr(i,t.coord,d,o,kr);const n=e.BoundingRectangle.clone(_,Nr);x=z.range(_.x,_.y,_.x+_.width,_.y+_.height),M=x.length;const r=e.Cartesian3.clone(i.position);for(S=1,A=[i.id],b=0;b<M;++b)if(E=x[b],D=C[E],!D.clustered){const t=D.collection.get(D.index),i=Fr(t,D.coord,d,o,Gr);e.Cartesian3.add(t.position,r,r),e.BoundingRectangle.union(n,i,n),++S,A.push(t.id)}if(S>=p){const t=e.Cartesian3.multiplyByScalar(r,1/S,r);for(Or(t,S,A,o),u.push({position:t,width:n.width,height:n.height,minimumWidth:_.width,minimumHeight:_.height}),b=0;b<M;++b)C[x[b]].clustered=!0}else Rr(i,o)}0===s.length&&(s.destroy(),o._clusterLabelCollection=void 0),0===l.length&&(l.destroy(),o._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),o._clusterPointCollection=void 0),o._previousClusters=u,o._previousHeight=g});var o;this._cluster=i,this._removeEventListener=t.camera.changed.addEventListener(i)},Object.defineProperties(Ar.prototype,{enabled:{get(){return this._enabled},set(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get(){return this._pixelRange},set(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get(){return this._minimumClusterSize},set(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get(){return this._clusterEvent}},clusterBillboards:{get(){return this._clusterBillboards},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get(){return this._clusterLabels},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get(){return this._clusterPoints},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),Ar.prototype.getLabel=Ur("_labelCollection",e.LabelCollection,"_unusedLabelIndices","labelIndex"),Ar.prototype.removeLabel=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._labelCollection)||!e.defined(i)||!e.defined(i.labelIndex))return;const o=i.labelIndex;i.labelIndex=void 0,Vr(this,t.id);const n=this._labelCollection.get(o);n.show=!1,n.text="",n.id=void 0,this._unusedLabelIndices.push(o),this._clusterDirty=!0},Ar.prototype.getBillboard=Ur("_billboardCollection",e.BillboardCollection,"_unusedBillboardIndices","billboardIndex"),Ar.prototype.removeBillboard=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._billboardCollection)||!e.defined(i)||!e.defined(i.billboardIndex))return;const o=i.billboardIndex;i.billboardIndex=void 0,Vr(this,t.id);const n=this._billboardCollection.get(o);n.id=void 0,n.show=!1,n.image=void 0,this._unusedBillboardIndices.push(o),this._clusterDirty=!0},Ar.prototype.getPoint=Ur("_pointCollection",e.PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),Ar.prototype.removePoint=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._pointCollection)||!e.defined(i)||!e.defined(i.pointIndex))return;const o=i.pointIndex;i.pointIndex=void 0,Vr(this,t.id);const n=this._pointCollection.get(o);n.show=!1,n.id=void 0,this._unusedPointIndices.push(o),this._clusterDirty=!0},Ar.prototype.update=function(t){if(!this.show)return;let i;var o;e.defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(i=t.commandList,t.commandList=[],this._labelCollection.update(t),t.commandList=i),e.defined(this._billboardCollection)&&this._billboardCollection.length>0&&!e.defined(this._billboardCollection.get(0).width)&&(i=t.commandList,t.commandList=[],this._billboardCollection.update(t),t.commandList=i),this._enabledDirty&&(this._enabledDirty=!1,(o=this).enabled||(e.defined(o._clusterLabelCollection)&&o._clusterLabelCollection.destroy(),e.defined(o._clusterBillboardCollection)&&o._clusterBillboardCollection.destroy(),e.defined(o._clusterPointCollection)&&o._clusterPointCollection.destroy(),o._clusterLabelCollection=void 0,o._clusterBillboardCollection=void 0,o._clusterPointCollection=void 0,$r(o._labelCollection),$r(o._billboardCollection),$r(o._pointCollection)),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),e.defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(t),e.defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(t),e.defined(this._clusterPointCollection)&&this._clusterPointCollection.update(t),e.defined(this._labelCollection)&&this._labelCollection.update(t),e.defined(this._billboardCollection)&&this._billboardCollection.update(t),e.defined(this._pointCollection)&&this._pointCollection.update(t)},Ar.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),e.defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};class Hr extends rt{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;this.needUpdate=!1;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){this.appearance=t||new e.MaterialAppearance({material:_n(this.options.materialOptions),flat:!1,faceForward:!1,translucent:!0,closed:!1})}}class Wr extends rt{gridPrimitiveCollection=new e.PrimitiveCollection;polygonPrimitive;outlinePrimitive;options;constructor(t){super(),this.options=t,this.gridPrimitiveCollection=new e.PrimitiveCollection,this.polygonPrimitive=this.createGridPolygonPrimitive(),this.outlinePrimitive=this.createGridOutlinePrimitive()}createGridPolygonPrimitive(){if(!this.options.fill)return;const t=[];this.options.vertices.forEach(i=>{const o=e.Color.fromCssColorString(this.options.fillColor),n=Ut(i.positions,o,`grid-${i.id}`);t.push(n)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({flat:!0,translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}createGridOutlinePrimitive(){if(!this.options.outline)return;const t=[];this.options.vertices.forEach(i=>{const o=e.Color.fromCssColorString(this.options.outlineColor),n=Vt(i.positions,o,`grid-${i.id}`);t.push(n)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PolylineColorAppearance({translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}getPrimitive(){return this.gridPrimitiveCollection}selectGrids(t){const i=e.Color.fromCssColorString(this.options.fillSelectColor),o=e.Color.fromCssColorString(this.options.outlineSelectColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(o)}})}unSelectGrids(t){const i=e.Color.fromCssColorString(this.options.fillColor),o=e.Color.fromCssColorString(this.options.outlineColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(o)}})}}const qr=t=>{const i=[],o={LEFT_CLICK:[]};return t.scene.postRender.addEventListener(()=>{i.forEach(i=>{if(i.distanceDisplayCondition){const o=e.Cartesian3.distance(i.position,t.camera.position);if(o>=i.distanceDisplayCondition.far||o<=i.distanceDisplayCondition.near)return void(i.divEle.style.display="none")}const o=t.scene.cartesianToCanvasCoordinates(i.position);if(o){i.divEle.style.display="block";const e=i.divEle.getBoundingClientRect();let t=2;"left"===i.align&&(t=e.width+i.offset.x),"right"===i.align&&(t=1),i.divEle.style.left=o.x/i.autoFit.x-(e.width+i.offset.x)/i.autoFit.x/t+"px",i.divEle.style.top=o.y/i.autoFit.y-(e.height+i.offset.y)/i.autoFit.y+"px"}else i.divEle.style.display="none"})}),{divLabels:i,set:n=>{const r={id:n.divEle.id||N(),...n};return r.autoFit||(r.autoFit=e.Cartesian2.fromElements(1,1)),r.offset||(r.offset=e.Cartesian2.fromElements(0,0)),r.align||(r.align="center"),r.divEle.id=r.id,r.divEle.style.position="absolute",r.userSelect||(r.divEle.style.userSelect="none"),r.parentEle?(r.parentEle.style.position="relative",r.parentEle.appendChild(r.divEle)):(t._element.style.position="relative",t._element.appendChild(r.divEle)),i.push(r),r.divEle.addEventListener("click",()=>{o.LEFT_CLICK.forEach(e=>{e(r)})}),r},setPosition:(e,t)=>{const o=i.findIndex(t=>t.id===e);if(-1!==o){i[o].position=t}},remove:e=>{const t=i.findIndex(t=>t.id===e.id);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},removeAll:()=>{i.forEach(e=>{e.divEle.remove()}),i.length=0},removeById:e=>{const t=i.findIndex(t=>t.id===e);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},addEventListener:(e,t)=>{o[e]&&o[e].push(t)}}},jr=t=>{const i=new e.ClippingPlaneCollection({edgeColor:e.Color.YELLOW,enabled:!0,modelMatrix:e.Matrix4.IDENTITY,edgeWidth:2});t.scene.globe.clippingPlanes=i,t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{Object.assign(t,{unionClippingRegions:!1,...t}),i.unionClippingRegions=t.unionClippingRegions||!1,i.removeAll();let o=t?.positions;o=t.unionClippingRegions?c(o):d(o),o.forEach((t,n)=>{const r=(n+1)%o.length,a=o[r];let s=e.Cartesian3.add(t,a,new e.Cartesian3);s=e.Cartesian3.multiplyByScalar(s,.5,s);const l=e.Cartesian3.normalize(s,new e.Cartesian3);let c=e.Cartesian3.subtract(a,s,new e.Cartesian3);c=e.Cartesian3.normalize(c,c);let d=e.Cartesian3.cross(c,l,new e.Cartesian3);d=e.Cartesian3.normalize(d,d);const p=new e.Plane(d,0),h=e.Plane.getPointDistance(p,s);i.add(new e.ClippingPlane(d,h))})},remove:()=>{i.removeAll()},removeAll:()=>{i.removeAll()},destroy:()=>{}}},Zr=t=>{const i=new e.ClippingPolygonCollection;t.scene.globe.clippingPolygons=i;const o=new e.CustomDataSource("clipPolygon");t.dataSources.add(o),t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{t={inverse:!1,...t};const n=t?.positions,r=new e.ClippingPolygon({positions:n});i.add(r);const a=u(p(n).map(e=>(e.height=-t.depth,e))),s=o.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});o.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,extrudedHeight:t.depth,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});return{id:N(),polygon:r,bottomEntity:s}},remove:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,o.entities.removeAll()},removeAll:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,o.entities.removeAll()},destroy:()=>{}}},Yr=t=>{const i=new e.CustomDataSource("flood-analysis");t.dataSources.add(i);return{set:e=>{const{positions:t,type:i,speed:o}=e;return console.log(t,e,i,o),{id:N()}},remove:()=>{},removeAll:()=>{i.entities.removeAll()},destroy:()=>{t.dataSources.remove(i)}}},Jr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1}),o=new e.PrimitiveCollection({destroyPrimitives:!1}),n=new e.PointPrimitiveCollection,r=new e.LabelCollection;o.add(n),i.add(r),i.add(o),t.scene.primitives.add(i);const a=(t,i)=>{t.forEach(t=>{i.add({position:t,color:e.Color.TRANSPARENT})})},s=(t,i)=>{const o=new e.GroundPolylineGeometry({positions:t,width:3}),n=new e.GeometryInstance({geometry:o});i.add(new e.GroundPolylinePrimitive({geometryInstances:n,asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#ff00ff").withAlpha(.5)})})}))},l=(t,i)=>{const o=new e.WallGeometry({positions:t}),n=e.WallGeometry.createGeometry(o),r=new e.GeometryInstance({geometry:n});i.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#00ff00").withAlpha(.5)})})}))},c=(t,i,o)=>{const n=new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),height:i}),r=new e.GeometryInstance({geometry:n});o.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#0088ff").withAlpha(.5)})})}))},d=(t,i,o,n,r)=>{const a=t.map(t=>e.Cartographic.fromCartesian(t).height),s=Math.min(...a),l=Math.max(...a);let c=0;for(let e=0;e<a.length;e++)c+=(a[e]-s)*i*i;const d=e.Cartesian3.fromDegrees(o.geometry.coordinates[0],o.geometry.coordinates[1],l),p={},u=r*l;c?p["挖方体积"]=`${h(c)}方\n`:c=0,u&&(p["填方体积"]=`${h(u-c)}方\n`),r&&(p["横切面积"]=`${h(r)}平方米\n`),s&&(p["最小高程"]=`${h(s)}米\n`),l&&(p["最大高程"]=`${h(l)}米\n`),s&&(p["基准面高程"]=`${h(s)}米`);let m="";Object.keys(p).forEach(e=>{m+=`${e}:${p[e]}`}),n.add({position:d,text:m,font:"16px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})},p=(t,i,o)=>{t.forEach((t,n)=>{o.add({position:t,text:`高程:${h(i[n].height)}米`,font:"14px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})})},h=e=>{const t=["","万","百万","千万","亿"];let i=0;for(;e>=1e4&&i<t.length-1;)e/=1e4,i++;return`${e.toFixed(2).replace(/\.?0+$/,"")}${t[i]}`};return{set:h=>{const u=g(h.positions),m=u.map(t=>{const i=e.Cartographic.fromCartesian(t);return{lng:e.Math.toDegrees(i.longitude),lat:e.Math.toDegrees(i.latitude),height:i.height}}),f=Math.min(...m.map(e=>e.height)),v=ie([m.map(e=>[e.lng,e.lat])]),y=ge(v),C=Math.sqrt(ge(v)/200),w=Ue(v),b=Ge(v),P=function(e,t,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var o=[],n=e[0],r=e[1],a=e[2],s=e[3],l=t/he([n,r],[a,r],i)*(a-n),c=t/he([n,r],[n,s],i)*(s-r),d=a-n,p=s-r,h=Math.floor(d/l),u=(p-Math.floor(p/c)*c)/2,m=n+(d-h*l)/2;m<=a;){for(var g=r+u;g<=s;){var f=te([m,g],i.properties);i.mask?Le(f,i.mask)&&o.push(f):o.push(f),g+=c}m+=l}return ne(o)}(we(w),C,{units:"meters"}),_=He(P,v).features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1]));return t.scene.clampToHeightMostDetailed(_).then(e=>{a(e,n),c(u,f,i),s(u,o),l(u,i),d(e,C,b,r,y),p(u,m,r)}),{id:N()}},remove:()=>{},removeAll:()=>{r.removeAll(),n.removeAll(),o.removeAll(),i.removeAll(),o.add(n),i.add(o),i.add(r)},destroy:()=>{}}},Kr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1});let o,n="/icons/markers/mark-icon.png";const r=[];t.scene.primitives.add(i);const a=i=>{if(!i)return o&&t.entities.remove(o),void(o=void 0);o||(o=t.entities.add({position:m(new e.Cartographic(i.longitude,i.latitude,i.height)),billboard:{image:n,scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),o.position=m(new e.Cartographic(i.longitude,i.latitude,i.height))};return{set:async e=>{e.tipMarkerUrl&&(n=e.tipMarkerUrl);const{positions:i}=e;let o=Ze(i);const a=Math.floor(o/e.pointDistance);let s=ot(i,a);s=await t.scene.clampToHeightMostDetailed(s),o=0;const l=s.map((e,t)=>{let i=0;t>0&&(i=je(s[t-1],e),o+=i);return{...h(e),distance:i,allDistance:o}}),c={id:N(),datas:l};return r.push(c),c},remove:e=>{const t=r.findIndex(t=>t.id===e.id);-1!==t&&r.splice(t,1),a()},removeAll:()=>{i.removeAll(),a()},destroy:()=>{t.scene.primitives.remove(i)},changeTipPoint:a}},Xr=e=>{const t=new PrimitiveCollection({destroyPrimitives:!1});let i=null,o="";const n=[];e.scene.primitives.add(t);const r=async(t,i,o)=>{const n=JSON.parse(JSON.stringify(t));await e.scene.clampToHeightMostDetailed(n)},a=t=>{if(!t)return i&&e.entities.remove(i),void(i=void 0);i||(i=e.entities.add({position:m(new Cartographic(t.longitude,t.latitude,t.height)),billboard:{image:o,scale:.5,verticalOrigin:VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),i.position=m(new Cartographic(t.longitude,t.latitude,t.height))};return{set:async t=>{t.tipMarkerUrl&&(o=t.tipMarkerUrl);const i=t.layers;return e.terrainProvider instanceof EllipsoidTerrainProvider||(e.terrainProvider,e.terrainProvider=new EllipsoidTerrainProvider),i.forEach(e=>{e.visible=!1}),new Promise(e=>{setTimeout(()=>{const{positions:i}=t,o=Ze(i),n=Math.floor(o/t.pointDistance),a=ot(i,n).filter(e=>e&&e.x&&e.y&&e.z),s={id:N(),datas:[]};r(a),e(s)},500)})},remove:e=>{const t=n.findIndex(t=>t.id===e.id);-1!==t&&n.splice(t,1),a(void 0)},removeAll:()=>{t.removeAll(),a(void 0)},destroy:()=>{e.scene.primitives.remove(t)},changeTipPoint:a}};export{at as BaseMaterialProperty,rt as BasePrimitive,Pn as CircleApertureMaterialProperty,Hr as CircleAperturePrimitive,yn as CircleRaderFanMaterialProperty,mn as CircleRaderWaveMaterialProperty,dn as CircleWaveMaterialProperty,t as Common,ii as CoordinateTransformer,l as DefaultViewerOptions,Li as Draw,Oi as DrawEventType,ki as DrawStyle,zn as EllipsoidElectricMaterialProperty,Gn as EllipsoidHScanMaterialProperty,Ln as EllipsoidVScanMaterialProperty,Ft as FlyAttitude,Wr as GridPrimitives,yr as GroundPolygonPrimitives,fr as GroundPolylinePrimitives,An as LightWallMaterialProperty,Xo as Material,Ar as PointClusterPrimitives,dr as PointPrimitives,an as PolylineFlowMaterialProperty,tn as PolylineTrailMaterialProperty,V as Popup,jn as RadereScanPrimitive,Rt as RoamStatus,U as Tooltip,pi as TransformsFor3dtiles,Hn as ZapsMaterialProperty,Bo as addDrawActions,Je as calcArea,nt as calcBoundingSphereFromPositions,it as calcCameraHeightFromZoom,je as calcGeodesicDistance,Ze as calcGeodesicDistances,ot as calcLerpPosition,Ye as calcPoistionCenter,Qe as calcSceneHeightFromPositions,We as calcSpaceDistance,qe as calcSpaceDistances,Xe as calcTerrainHeightFromPositions,Ke as calcTriangleArea,tt as calcZoomFromCameraHeight,et as clacPositionsForParabola,Mi as createBloomTargetStage,kt as createBottomStatusBar,_n as createCircleApertureMaterial,Cn as createCircleRaderFanMaterial,pn as createCircleWaveMaterial,jr as createClipPlaneAnalysis,Zr as createClipPolygonAnalysis,qr as createDivLabelHandler,Ko as createDrawHandler,zi as createDroneAnimCustomShader,Y as createEagleEye,Fn as createEllipsoidElectricMaterial,Un as createEllipsoidHScanMaterial,Bn as createEllipsoidVScanMaterial,Jr as createFillAndDigAnalysis,Yr as createFloodAnalysis,xi as createFogStage,_i as createHeightFogStage,yi as createHighLightStage,Si as createLightBandCustomShader,Sn as createLightWallMaterial,Ai as createLightningStage,Xr as createModelProfileAnalysis,Gt as createOpenAnim,Ri as createOutLineEffect,wi as createOutlineStage,sn as createPoylineFlowMaterial,Kr as createProfileAnalysis,gn as createRaderWaveMaterial,Di as createRainCoverStage,Ei as createRainStage,zt as createRoamHandler,J as createRollerShutterHandler,Mn as createScanRadarMaterial,It as createSkyBox,Tt as createSkyBoxOnGround,Ci as createSkylineStage,bi as createSnowCoverStage,Pi as createSnowStage,K as createSplitScreenHandler,on as createTrailMaterial,Wn as createZapsMaterial,F as flyByRotateOut,z as flyByRotatePoint,x as flyToCameraView,D as flyToCesium3DTile,M as flyToDataSource,A as flyToFromSphere,E as flyToImagery,b as flyToLnglat,I as flyToNorth,P as flyToPosition,S as flyToRectangleBounds,li as getAllFeaturesFrom3dTiles,ci as getAllTilesFrom3dTiles,_ as getCameraView,s as getCesiumForAutoFitScale,G as getInoCesiumBaseUrl,T as getScreenCenterPoint,o as initCesium,L as initCesiumEvent,ai as load3dTiles,vi as loadI3s,gi as loadModel,hi as loadTerrain,mi as loadTerrainFromCesium,oi as loadTianDiTu,fi as loads3m,$t as makeGridFromElevationExtrema,Ut as makeGridToInstanceForBox,Vt as makeGridToInstanceForLine,m as makeLnglatToPosition,v as makeLnglatsToLineGeojson,f as makeLnglatsToPointGeojson,y as makeLnglatsToPolygonGeojson,u as makeLnglatsToPositions,g as makePositionsClose,d as makePositionsForAntiClockwise,c as makePositionsForClockwise,p as makePositionsToLnglats,h as makePositiontoLnglat,C as makeYawPitchRollToHeadingPitchRoll,Ht as mekeGridPolygonAndHeight,N as numberId,W as randomColor,$ as randomPointToGeoJson,j as randomPolygonToGeoJson,q as randomPolylineToGeoJson,ui as removeTerrain,O as setCameraAutoBackTiltToZero,a as setCesiumForAutoFitScale,n as setGlobeEnabled,r as setGlobeOpatity,si as setHeightOffsetFor3dTiles,ni as setImageLayerTheme,w as setViewToLnglat,R as twinkleModel};
|