ino-cesium 0.0.21-beta.1 → 0.0.21-beta.3
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/ino-cesium-full.js +1 -1
- package/dist/ino-cesium.d.ts +2 -2
- 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 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};
|
|
1
|
+
import*as e from"cesium";export{e as Cesium};var t=Object.freeze({__proto__:null});let i=1;const n=(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 n={...l,...i},o=new e.Viewer(t,n);return o.imageryLayers.remove(o.imageryLayers.get(0)),o._cesiumWidget._creditContainer.style.display="none",o.scene.postProcessStages.fxaa.enabled=!0,o.scene.msaaSamples=8,o.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),o.scene.globe.depthTestAgainstTerrain=!0,o.scene.globe.showGroundAtmosphere=!0,o.scene.globe.enableLighting=!1,o.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),o},o=(t,i)=>{const n=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=n,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${n})`),t.scene.globe.showGroundAtmosphere=i,i?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${n})`),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,${n})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${n})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${n})`)}}}))},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 n=0;n<t.length;n++){const o=t[n],r=t[(n+1)%t.length];i+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return i>0?t.reverse():t},d=t=>{let i=0;for(let n=0;n<t.length;n++){const o=t[n],r=t[(n+1)%t.length];i+=e.Cartesian3.cross(o,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,n)=>{0!==n&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[n-1].longitude,e[n-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:n,height:o,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(i,n,o||1e4)})},b=t=>{const{lng:i,lat:n,height:o,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(i,n,o||1e4)})},P=e=>{const{position:t,viewer:i}=e;i.scene.camera.flyTo({destination:t})};function _(t){const i=t.camera.heading,n=t.camera.pitch,o=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:i,pitch:n,roll:o}}}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 n=new e.Cartesian3(t[0],t[1],t[2]),o=new e.BoundingSphere(n,t[3]);i.camera.flyToBoundingSphere(o,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const S=(t,i,n,o,r)=>{if(n<=t||o<=i)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const a={destination:e.Rectangle.fromDegrees(t,i,n,o),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,n=i.clientWidth/2,o=i.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(n,o))}const z=t=>{let i=!1;let n;const o=t.camera;let r=o.pitch,a=0,s=!1;function l(){if(!i||!n)return;let e=o.heading;s?e+=.005:e-=.005,t.camera.setView({destination:n,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(a),requestAnimationFrame(l)}return{start:(c,d)=>{n=c||T(t),r=o.pitch,s=!!d,a=e.Cartesian3.distance(o.position,n),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 n(){if(!t)return;let o=e.camera.heading;i?o+=.001:o-=.001,e.camera.setView({orientation:{heading:o,pitch:e.camera.pitch}}),requestAnimationFrame(n)}t=!0;return{start:e=>{t=!0,i=!!e,n()},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 n=!1;t.camera.moveEnd.addEventListener(function(){if(n)return;const o=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const a=o.heading,s=o.roll;if(r>i){n=!0;const i=t.camera.computeViewRectangle();if(!i)return void(n=!0);const o={longitude:0,latitude:0},l=e.Rectangle.center(i);o.longitude=e.Math.toDegrees(l.longitude),o.latitude=e.Math.toDegrees(l.latitude),t.camera.flyTo({destination:m(new e.Cartographic(o.longitude,o.latitude,r)),orientation:{heading:a,pitch:-1.5,roll:s},duration:1,complete:()=>{}})}else n=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},L=(t,i)=>{const n=t.scene,o=new e.ScreenSpaceEventHandler(n.canvas);o.setInputAction(e=>{if(i.LEFT_POSITION){const o=n.pickPosition(e.position);k(e.position,o,i.LEFT_POSITION,t)}i.PICK_FEATURE&&B(t,e.position,i.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{if(i.MOVE_POSITION){const o=n.pickPosition(e.endPosition);k(e.endPosition,o,i.MOVE_POSITION,t)}i.MOVE_PICK_FEATURE&&B(t,e.endPosition,i.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},B=(t,i,n)=>{const o=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);n({position:o,...r},a)}else n(void 0,{})},k=(t,i,n,o)=>{i||(i=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(i);n({windowPosition:t,position:i,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:_(o)})},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 n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.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 n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.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 n=[];for(let o=0;o<e;o++){const e=H(t),o=H(i);n.push({type:"Feature",geometry:{type:"Point",coordinates:[e,o]},properties:{}})}return{type:"FeatureCollection",features:n}};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 n=[];for(let o=0;o<e;o++){const e=Math.floor(H([3,10])),o=[];for(let n=0;n<e;n++){const e=H(t),n=H(i);o.push([e,n])}n.push({type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{}})}return{type:"FeatureCollection",features:n}},j=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let o=0;o<e;o++){const e=Z(t,i);n.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:n}};function Z(e,t){const i=Math.floor(H([3,10])),n=H(e),o=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=n+s*Math.cos(t),c=o+s*Math.sin(t);a.push([l,c])}return a.push(a[0]),a}const Y=(t,i)=>{let n=!1;const o=new e.Viewer(t,{...l,scene3DOnly:!1});o.scene.mode=2;const r=o.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(){n||o.camera.flyTo({destination:i.camera.position,orientation:{heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},duration:0})};return{viewer:o,open:()=>{n=!1},close:()=>{n=!0}}},J=t=>{const i=[],n=e=>{t.scene.splitPosition=e},o=(e,t)=>{i.push(e),e.splitDirection=t};return{set:()=>{n(.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",o,!1)}function n(){document.addEventListener("mousemove",o,!1)}function o(i){i.preventDefault?i.preventDefault():i.returnValue=!1,e.style.left=`${i.clientX}px`;const n=i.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=n}e.addEventListener("mousedown",n,!1),document.addEventListener("mouseup",i,!1)}()},remove:()=>{i.forEach(t=>{o(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:n,setSplitDirection:o}},K=t=>{const i=t;let o;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),o=n(t.id),r[1]=o,l(),i.camera.changed.addEventListener(()=>s(i,o)),i.scene.preRender.addEventListener(()=>s(i,o)),i.camera.percentageChanged=.01,o.camera.changed.addEventListener(()=>s(o,i)),o.scene.preRender.addEventListener(()=>s(o,i)),o.camera.percentageChanged=.01,o._splitNumber=1};function s(t,i){const n=e.Cartographic.toCartesian(t.camera.positionCartographic);i.camera.setView({destination:new e.Cartesian3(n.x,n.y,n.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&&o.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%",o.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 n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}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 ne(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 oe(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 n=le(e),o=le(t),r=ae(n[0]),a=ae(o[0]),s=ae(n[1]),l=ae(o[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,n={}){const o=le(e),r=ae(o[0]),a=ae(o[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,n.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)],n.properties)}function he(e,t,i={}){var n=le(e),o=le(t),r=ae(o[1]-n[1]),a=ae(o[0]-n[0]),s=ae(n[1]),l=ae(o[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 n,o,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(n=0;n<l.length;n++){if(!1===t(l[n],h,v,C,w))return!1;h++,"MultiPoint"===b&&C++}"LineString"===b&&C++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-p;o++){if(!1===t(l[n][o],h,v,C,w))return!1;h++}"MultiLineString"===b&&C++,"Polygon"===b&&w++}"Polygon"===b&&C++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(w=0,o=0;o<l[n].length;o++){for(r=0;r<l[n][o].length-p;r++){if(!1===t(l[n][o][r],h,v,C,w))return!1;h++}w++}C++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===ue(a.geometries[n],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function me(e,t){var i,n,o,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,o=0;o<a;o++)if(null!==(r=l?s.geometries[o]: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(n=0;n<r.geometries.length;n++)if(!1===t(r.geometries[n],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 n=i;return me(e,function(e,o,r,a,s){n=0===o&&void 0===i?e:t(n,e,o,r,a,s)}),n}(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,n=0;for(;n<t;){const o=e[n],r=e[n+1===t?0:n+1],a=e[n+2>=t?(n+2)%t:n+2],s=o[0]*ye,l=r[1]*ye;i+=(a[0]*ye-s)*Math.sin(l),n++}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,n,o){let r,a,s,l,c=t[0],d=n[0],p=0,h=0;d>c==d>-c?(r=c,c=t[++p]):(r=d,d=n[++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=n[++h]),r=a,0!==s&&(o[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=n[++h]),r=a,0!==s&&(o[u++]=s);for(;p<e;)a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p],r=a,0!==s&&(o[u++]=s);for(;h<i;)a=r+d,l=a-r,s=r-(a-l)+(d-l),d=n[++h],r=a,0!==s&&(o[u++]=s);return 0===r&&0!==u||(o[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,n,o,r){const a=(t-r)*(i-o),s=(e-o)*(n-r),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,n,o,r,a){let s,l,c,d,p,h,u,m,g,f,v,y,C,w,b,P,_,x;const M=e-o,E=i-o,D=t-r,A=n-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 n=1;n<e;n++)i+=t[n];return i}(4,Ee),I=22204460492503146e-32*a;if(S>=I||-S>=I)return S;if(p=e-M,s=e-(M+p)+(p-o),p=i-E,c=i-(E+p)+(p-o),p=t-D,l=t-(D+p)+(p-r),p=n-A,d=n-(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,n,o,r,c)}function ze(e,t){var i,n,o,r,a,s,l,c,d,p=0,h=e[0],u=e[1],m=t.length;for(i=0;i<m;i++){n=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;n<f;n++){if(s=(d=g[n+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===(o=Te(r,s,a,l,0,0)))return 0;(o>0&&l>0&&a<=0||o<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 n=le(e),o=ce(t),r=o.type,a=t.bbox;let s=o.coordinates;if(a&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(n,a))return!1;"Polygon"===r&&(s=[s]);let l=!1;for(var c=0;c<s.length;++c){const e=ze(n,s[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}function Re(e,t,i={}){const n=le(e),o=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<o.length-1;e++){let t=!1;if(i.ignoreEndVertices&&(0===e&&(t="start"),e===o.length-2&&(t="end"),0===e&&e+1===o.length-1&&(t="both")),Oe(o[e],o[e+1],n,t,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function Oe(e,t,i,n,o){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!==o){if(Math.abs(u)>o)return!1}else if(0!==u)return!1;return Math.abs(p)===Math.abs(h)&&0===Math.abs(p)?!n&&(i[0]===e[0]&&i[1]===e[1]):n?"start"===n?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"===n?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"===n&&(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),n=ce(t),o=i.type,r=n.type;switch(o){case"Point":switch(r){case"MultiPoint":return function(e,t){var i,n=!1;for(i=0;i<t.coordinates.length;i++)if(ke(t.coordinates[i],e.coordinates)){n=!0;break}return n}(i,n);case"LineString":return Re(i,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Fe(i,n,{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 n=!1,o=0;o<t.coordinates.length;o++)ke(e.coordinates[i],t.coordinates[o])&&(n=!0);if(!n)return!1}return!0}(i,n);case"LineString":return function(e,t){for(var i=!1,n=0;n<e.coordinates.length;n++){if(!Re(e.coordinates[n],t))return!1;i||(i=Re(e.coordinates[n],t,{ignoreEndVertices:!0}))}return i}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,n=!1,o=0;o<e.coordinates.length;o++){if(!(n=Fe(e.coordinates[o],t))){i=!1;break}n=Fe(e.coordinates[o],t,{ignoreBoundary:!0})}return i&&n}(i,n);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,n);case"Polygon":case"MultiPolygon":return function(e,t){var i=we(t),n=we(e);if(!Be(i,n))return!1;for(var o=!1,r=0;r<e.coordinates.length;r++){if(!Fe(e.coordinates[r],t))return!1;if(o||(o=Fe(e.coordinates[r],t,{ignoreBoundary:!0})),!o&&r<e.coordinates.length-1)o=Fe(Ne(e.coordinates[r],e.coordinates[r+1]),t,{ignoreBoundary:!0})}return o}(i,n);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 n=0;n<e.coordinates[0].length;n++)if(!Fe(e.coordinates[0][n],t))return!1;return!0}(i,n);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+o+" 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,n=0,o=0;return ue(e,function(e){i+=e[0],n+=e[1],o++},!0),te([i/o,n/o],t.properties)}function Ue(e){return function(e,t={}){const i=Number(e[0]),n=Number(e[1]),o=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,n];return ie([[a,[o,n],[o,r],[i,r],a]],t.properties,{bbox:e,id:t.id})}(we(e))}function Ve(e,t,i,n,o={}){const r=o.steps||64,a=$e(i),s=$e(n),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(a===s)return ne(function(e,t,i={}){const n=i.steps||64,o=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},r=[];for(let o=0;o<n;o++)r.push(pe(e,t,-360*o/n,i).geometry.coordinates);return r.push(r[0]),ie([r],o)}(e,t,o).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,o).geometry.coordinates),u++,p=c+u*m;return ne(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 n=!1;if("Point"===e.geometry.type)me(t,function(t){Fe(e,t)&&(n=!0)}),n&&i.push(e);else{if("MultiPoint"!==e.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var o=[];me(t,function(t){ue(e,function(e){Fe(e,t)&&(n=!0,o.push(e))})}),n&&i.push(function(e,t,i={}){return ee({type:"MultiPoint",coordinates:e},t,i)}(o,e.properties))}}),oe(i)}const We=(t,i)=>{const n=e.Cartographic.fromCartesian(t),o=e.Cartographic.fromCartesian(i),r=new e.EllipsoidGeodesic;r.setEndPoints(n,o);let a=r.surfaceDistance;return a=Math.sqrt(a**2+(o.height-n.height)**2),a};function qe(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const o=We(i,e[n+1]);t+=o}),t}function je(t,i,n){const{EllipsoidGeodesic:o,Ellipsoid:r}=e;return new o((n=n||r.WGS84).cartesianToCartographic(t),n.cartesianToCartographic(i)).surfaceDistance}function Ze(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const o=je(i,e[n+1]);t+=o}),t}const Ye=t=>{if(t.length<4)return e.BoundingSphere.fromPoints(t).center;const i=ie([t.map(e=>[e.x,e.y])]),n=e.BoundingSphere.fromPoints(t).center,o=Ge(i);return new e.Cartesian3(o.geometry.coordinates[0],o.geometry.coordinates[1],n.z)};function Je(t){let i=0;const{CoplanarPolygonGeometry:n,VertexFormat:o,defined:r,Cartesian3:a}=e,s=n.createGeometry(n.fromPositions({positions:t,vertexFormat:o.POSITION_ONLY}));if(r(s)){const e=s.indices,t=s.attributes.position.values;for(let n=0;n<e.length;n+=3){const o=e[n],r=e[n+1],s=e[n+2];i+=Ke(a.unpack(t,3*o,{}),a.unpack(t,3*r,{}),a.unpack(t,3*s,{}))}}return i}const Ke=(t,i,n)=>{const{Cartesian3:o}=e,r=o.subtract(t,i,{}),a=o.subtract(n,i,{}),s=o.cross(r,a,r);return.5*o.magnitude(s)},Xe=async(t,i)=>{const n=i.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,n)},Qe=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),et=(t,i,n,o)=>{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))*n,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<o-1;t++){const i=1*t/(o-1),n=1-i,a=Math.sin(n*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*n+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,nt=(t,i)=>{const n=[];let o=0,r=0,a=0;const s=[];for(let i=0;i<t.length-1;++i)o+=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/o),n.push(r);const l=new e.LinearSpline({times:n,points:t});for(let e=0;e<=i;e++){const t=l.evaluate(e/i);s.push(t)}return s},ot=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 n=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(n,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:n,source:e}))}const o=this._command;if(o.modelMatrix=ft.eastNorthUpToFixedFrame(e.camera._positionWC),!dt(o.vertexArray)){o.uniformMap={u_cubeMap:()=>i._cubeMap,u_rotateMatrix:()=>gt.getRotation(o.modelMatrix,At)};const e=st.createGeometry(st.fromDimensions({dimensions:new lt(2,2,2),vertexFormat:vt.POSITION_ONLY})),t=this._attributeLocations=ut.createAttributeLocations(e);o.vertexArray=_t.fromGeometry({context:n,geometry:e,attributeLocations:t,bufferUsage:yt._DRAW}),o.renderState=Pt.fromCache({blending:xt.ALPHA_BLEND})}if(!dt(o.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}"]});o.shaderProgram=Et.fromCache({context:n,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)?o: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:n}=t;return i.scene.skyBox=new e.SkyBox({sources:n}),i.scene.skyBox},Tt=t=>{let{viewer:i,sources:n}=t;const o=t.height?t.height:225705,r=i.scene.skyBox,a=i.scene.skyAtmosphere.show;n||(n={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:n});i.scene.postRender.addEventListener(()=>{const t=i.camera.position;e.Cartographic.fromCartesian(t).height<o?(i.scene.skyBox=s,i.scene.skyAtmosphere.show=!1):(i.scene.skyBox=r,i.scene.skyAtmosphere.show=a)})},zt=t=>{const i=[];let n,o;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,o=t.entities.add({position:e.property,cylinder:i})}t.trackedEntity=e.entity,i&&(n=e)},s=()=>{if(o){t.entities.remove(o);const e=i.find(e=>e.id===o.cylinder.roamId);e&&(e.entity.cylinder=o.cylinder),o=void 0}},l=()=>{t.trackedEntity=void 0,n=void 0,s()},c=e=>{t.trackedEntity?.id===e.entity.id&&l(),t.entities.remove(e.entity);const n=i.findIndex(t=>t.id===e.id);n>-1&&i.splice(n,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 n=r[e.id].find(e=>e.time>t.secondsOfDay);n&&u(e,n,i)}},p=i=>{const{property:n,startTime:o,stopTime:r}=h(i);i.stopTime=r,i.startTime=o,i.property=n,i.flyParams.hpr||(i.entity.orientation=new e.VelocityOrientationProperty(n)),i.entity.position=n,i.status="START",t.clock.currentTime=o,t.clock.multiplier=1,m.reStart&&m.reStart(i)},h=t=>{const i=[],{positions:n,flyParams:o}=t,a=new e.SampledPositionProperty;let s=0;const l=e.JulianDate.now();let c=l.clone();return n.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let i=0;if(o.speed){i=e.Cartesian3.distance(t,n[r-1])/(1e3*o.speed/3600)}o.times&&(i=(o.times[r]-o.times[r-1])/1e3),s+=i,d=e.JulianDate.addSeconds(l,s,new e.JulianDate)}else d=l;c=d,a.addSample(d,t),o.hpr&&i.push({time:d.secondsOfDay,heading:o.hpr[r].heading,pitch:o.hpr[r].pitch,roll:o.hpr[r].roll})}),r[t.id]=i,{property:a,startTime:l,stopTime:c}},u=(t,i,n)=>{if(!n)return;const{heading:o,pitch:r,roll:a}=i,s=new e.HeadingPitchRoll(o,r,a);t.entity.orientation=Transforms.headingPitchRollQuaternion(n,s)};t.scene.preRender.addEventListener((o,r)=>{if(i.forEach(e=>{d(e,r)}),!n)return;const a=n.entity.computeModelMatrix(t.clock.currentTime);a&&t.camera.lookAtTransform(a,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:n=>{const{entity:o}=n;n.id=N(),t.entities.add(o);const{property:r,startTime:a,stopTime:s}=h(n);n.flyParams.hpr||(o.orientation=new e.VelocityOrientationProperty(r)),o.position=r;const l={...n,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 n=i.find(t=>t.entity.id===e);n&&a(n,t)},removeAll:()=>{i.forEach(e=>{c(e)}),i.length=0},Event:m,lockCameraView:e=>{n=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,n=document.createElement("div");n.className="bottom-status-bar";const o=document.createElement("div");o.className="scale-bar",o.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",o.appendChild(r),n.appendChild(o);const a=document.createElement("div");a.id="bottom-status-bar-camera",t.clickCopy&&(a.style.pointerEvents="auto",a.style.cursor="pointer"),n.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(n),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 n=Nt(i);r.innerHTML=`${n.distanceLabel}`,h()})};h()},Nt=t=>{const i=t.camera.positionCartographic.height.toFixed(0);if(i===Bt)return{barWidth:Ot,distanceLabel:Lt};Bt=i;const n=new e.EllipsoidGeodesic,o=[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);n.setEndPoints(u,m);const g=n.surfaceDistance;let f;for(let t=o.length-1;!e.defined(f)&&t>=0;--t)o[t]/g<100&&(f=o[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:n,center:o}=t;let r=o.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>o.lng?n.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{n.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,o.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{i(!0)}})}}):(n.camera.setView({destination:e.Cartesian3.fromDegrees(r,o.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(l))};requestAnimationFrame(l)}),Ut=(t,i,n)=>{const o=new Float64Array(24);for(let e=0;e<8;e++)o[3*e]=t[e].x,o[3*e+1]=t[e].y,o[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:o})},s=new e.Geometry({indices:r,attributes:a,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(o)});return new e.GeometryInstance({geometry:s,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${n}`})},Vt=(t,i,n)=>{const[o,r,a,s,l,c,d,p]=t,h=[o,r,r,a,a,s,s,o,l,c,c,d,d,p,p,l,o,l,l,c,c,r,r,o,s,p,p,d,d,a,a,s,o,s,s,p,p,l,l,o,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:`${n}`})},$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,n,o,r,a)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(t,t,a),e.Cartesian3.fromDegrees(i,i,a),e.Cartesian3.fromDegrees(n,n,a),e.Cartesian3.fromDegrees(o,o,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),n=Kt(e-105,t-35);const o=t/180*qt;let r=Math.sin(o);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),n=180*n/(jt/a*Math.cos(o)*qt);return[e+n,t+i]},Qt=(e,t)=>{if(Yt(e,t))return[e,t];let i=Jt(e-105,t-35),n=Kt(e-105,t-35);const o=t/180*qt;let r=Math.sin(o);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),n=180*n/(jt/a*Math.cos(o)*qt);return[2*e-(e+n),2*t-(t+i)]},ei=(e,t)=>{const i=e,n=t,o=Math.sqrt(i*i+n*n)+2e-5*Math.sin(n*Wt),r=Math.atan2(n,i)+3e-6*Math.cos(i*Wt);return[o*Math.cos(r)+.0065,o*Math.sin(r)+.006]},ti=(e,t)=>{const i=e-.0065,n=t-.006,o=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*Wt),r=Math.atan2(n,i)-3e-6*Math.cos(i*Wt);return[o*Math.cos(r),o*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,n]=ti(e,t);return Qt(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}static wgs84ToBd09(e){const[t,i]=((e,t)=>{const[i,n]=Xt(e,t);return ei(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}}const ni=t=>{const{viewer:i,token:n}=t,o=t.vec?"vec":"img",r=[],a=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/${o}_w/wmts?tk=${n}`,layer:o,style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));if(r.push(a),t.label){const t=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/cia_w/wmts?tk=${n}`,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 oi(t,i){i||(i={}),console.log(i.filterColor);const n=t.imageryLayers.get(0);if(!n)return;n.brightness=i.brightness??.6,n.contrast=i.contrast??1.8,n.gamma=i.gamma??.3,n.hue=i.hue??1,n.saturation=i.saturation||0;const o=t.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<o.length;t++){const n="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 `,o[t]=o[t].replace(n,r)}t.scene.requestRender()}const ri={cacheBytes:4294967296,maximumCacheOverflowBytes:5368709120},ai=async t=>{const{viewer:i,url:n,options:o}=t,r=await e.Cesium3DTileset.fromUrl(n,{...ri,...o});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 n=e.content;for(let e=0;e<n.featuresLength;e++)t.push(n.getFeature(e));e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},ci=e=>{const t=[];function i(e){t.push(e),e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},di=(t,i)=>{if(i.equals(e.Cartesian3.ZERO))return;const n=t.boundingSphere.center,o=e.Transforms.eastNorthUpToFixedFrame(n),r=e.Matrix4.multiplyByPoint(o,i,new e.Cartesian3),a=e.Cartesian3.subtract(r,n,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 n=t.boundingSphere.center,o=e.Transforms.eastNorthUpToFixedFrame(n),r=e.Matrix4.inverse(o,new e.Matrix4),a=e.Matrix4.fromScale(i),s=e.Matrix4.multiply(a,r,new e.Matrix4),l=e.Matrix4.multiply(o,s,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(l,t.modelMatrix,new e.Matrix4)},rotate:(t,i)=>{const{x:n,y:o,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!==n){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationX(e.Math.toRadians(n)));e.Matrix4.multiply(t,c,c)}if(0!==o){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationY(e.Math.toRadians(o)));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:n}=t,o=await e.CesiumTerrainProvider.fromUrl(n,{requestWaterMask:!0,requestVertexNormals:!0});i.scene.terrainProvider=o;return{terrainProvider:o,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:n,options:o}=t,r=await e.I3SDataProvider.fromUrl(n,o);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 n=e.Rectangle.center(r.extent);n.height=t;let o=r.data;e.defined(o.layers)&&o.layers.length>0&&(o=o.layers[0]),e.defined(o.fullExtent)&&e.defined(o.fullExtent.zmax)&&(n.height+=o.fullExtent.zmax);const a=e.Ellipsoid.WGS84.cartographicToCartesian(n);i.camera.flyTo({destination:a,orientation:{}})}}},yi=(t,i=e.Color.YELLOW)=>{const n=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}}));n.selected=[];return{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},Ci=t=>{const i=e.PostProcessStageLibrary.createEdgeDetectionStage(),n=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 }"}),o=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:n.name,silhouetteTexture:i.name}}),r=new e.PostProcessStageComposite({stages:[i,n,o],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 n=t.scene.postProcessStages,o=e.PostProcessStageLibrary.createEdgeDetectionStage();o.uniforms.color=i,o.uniforms.length=1,o.selected=[];const r=e.PostProcessStageLibrary.createEdgeDetectionStage();r.uniforms.color=i,r.selected=[];const a=n.add(e.PostProcessStageLibrary.createSilhouetteStage([o,r]));a.selected=[];return{stage:a,remove:()=>{t.scene.postProcessStages.remove(a)}}},bi=t=>{const i=t.viewer,n=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(n);return n.selected=[],{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},Pi=t=>{const i=t.viewer,n=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}}));n.selected=[];return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},_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}})]})]}),n=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}})]}));n.enabled=!1;return n.selected=[],{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},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,n=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(n);return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},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])),n=h(t[0]).height,o=We(t[0],t[1]),[r,a,s]=[i[0],i[1],i[2]],l=Ve(r,o/1e3,de(r,a),de(r,s)).geometry.coordinates.map(e=>[e[0],e[1],n]);l.push([...r.geometry.coordinates,n]),l.unshift([...r.geometry.coordinates,n]),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,n)=>{n<e.length-1&&(t+=Gi(i,e[n+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 n=Math.asin(Math.abs(t[1]-e[1])/Gi(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=2*Math.PI-n:t[1]<e[1]&&t[0]<e[0]?i=n:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-n),i},Wi=(e,t,i)=>{const n=Hi(t,e)-Hi(t,i);return n<0?n+2*Math.PI:n},qi=(e,t,i,n,o)=>{const r=Hi(e,t),a=o?r+i:r-i,s=n*Math.cos(a),l=n*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 n=0;n<=1;n+=.01){let[o,r]=[0,0];for(let t=0;t<=i;t++){const a=Yi(i,t),s=n**t,l=(1-n)**(i-t);o+=a*s*l*e[t][0],r+=a*s*l*e[t][1]}t.push([o,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=[],n=p(t).map(e=>(i.push(e.height),[e.longitude,e.latitude])),o=Math.max(...i),[r,a,s]=[n[0],n[1],n[2]],l=n.length;let c,d;3===l?(this.tempPoint4=this.getTempPoint4(r,a,s),this.connPoint=$i(r,a)):4===l?(this.tempPoint4=n[3],this.connPoint=$i(r,a)):(this.tempPoint4=n[3],this.connPoint=n[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],o)),_=u(P);this.drawData.shapePositions=_,this.drawData.shapePositions.push(_[0]),this.setShapePositions(this.drawData.shapePositions)}getTempPoint4(e,t,i){const n=$i(e,t),o=Gi(n,i),r=Wi(e,n,i);let a,s,l,c=[0,0];return r<Math.PI/2?(a=o*Math.sin(r),s=o*Math.cos(r),l=qi(e,n,Math.PI/2,a,!1),c=qi(n,l,Math.PI/2,s,!0)):r>=Math.PI/2&&r<Math.PI?(a=o*Math.sin(Math.PI-r),s=o*Math.cos(Math.PI-r),l=qi(e,n,Math.PI/2,a,!1),c=qi(n,l,Math.PI/2,s,!1)):r>=Math.PI&&r<1.5*Math.PI?(a=o*Math.sin(r-Math.PI),s=o*Math.cos(r-Math.PI),l=qi(e,n,Math.PI/2,a,!0),c=qi(n,l,Math.PI/2,s,!0)):(a=o*Math.sin(2*Math.PI-r),s=o*Math.cos(2*Math.PI-r),l=qi(e,n,Math.PI/2,a,!0),c=qi(n,l,Math.PI/2,s,!1)),c}getArrowPoints(e,t,i,n){const o=$i(e,t),r=Gi(o,i);let a=qi(i,o,0,.3*r,!0),s=qi(i,o,0,.5*r,!0);a=qi(o,a,Math.PI/2,r/5,n),s=qi(o,s,Math.PI/2,r/4,n);const l=[o,a,s,i],c=this.getArrowHeadPoints(l);if(!(c&&Array.isArray(c)&&c.length>0))throw new Error("Interpolation Error");{const i=c[0],n=c[4],o=Gi(e,t)/Vi(l)/2,r=this.getArrowBodyPoints(l,i,n,o);if(r){const o=r.length;let a=r.slice(0,o/2),s=r.slice(o/2,o);return a.push(i),s.push(n),a=a.reverse(),a.push(t),s=s.reverse(),s.push(e),a.reverse().concat(c,s)}}}getArrowBodyPoints(e,t,i,n){const o=Ui(e),r=Vi(e)*n,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 n=(r/2-s/o*a)/Math.sin(i),d=qi(e[t-1],e[t],Math.PI-i,n,!0),p=qi(e[t-1],e[t],i,n,!1);l.push(d),c.push(p)}return l.concat(c)}getArrowHeadPoints(e){const t=Vi(e)*this.headHeightFactor,i=e[e.length-1],n=t*this.headWidthFactor,o=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,n,!1),c=qi(i,a,Math.PI/2,n,!0);return[qi(i,s,Math.PI/2,o,!1),l,i,c,qi(i,s,Math.PI/2,o,!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])),n=h(t[0]).height,o=qe(t)/1e3,[r,a]=[i[0],i[1]],s=de(r,a),l=pe(r,.1*o,s-90,{units:"kilometers"}),c=pe(r,.1*o,s+90,{units:"kilometers"}),d=pe(r,.8*o,s-5,{units:"kilometers"}),u=pe(r,.8*o,s+5,{units:"kilometers"}),m=pe(r,.75*o,s-13,{units:"kilometers"}),g=pe(r,.75*o,s+13,{units:"kilometers"}),f=[...l.geometry.coordinates,n,...d.geometry.coordinates,n,...m.geometry.coordinates,n,...a.geometry.coordinates,n,...g.geometry.coordinates,n,...u.geometry.coordinates,n,...c.geometry.coordinates,n,...l.geometry.coordinates,n];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)},en=e=>{const t=new Ki(e);e.primitives.add(t)},tn="cm",nn="厘米",on="m",rn="米",an="km",sn="千米",ln="公里",cn="㎡",dn="平方厘米",pn="㎡",hn="平方米",un="km²",mn="平方千米",gn="平方公里",fn="亩",vn="公顷",yn={cm:"cm²",m:"㎡",km:"km²","米":"平方米","千米":"平方千米","公里":"平方公里"},Cn=(e,t,i)=>t===i?e:e*Pn(i),wn=(e,t,i)=>t===i?e:e*function(e){switch(e){case cn:return 1e4;case pn:return 1;case un:return 1e-6;case dn:return 1e4;case hn:return 1;case mn:case gn:return 1e-6;case fn:return.0015;case vn:return 1e-4;default:return 1}}(i),bn=e=>yn[e],Pn=e=>{switch(e){case on:return 1;case tn:case nn:return 100;case an:return.001;case rn:return 1;case sn:case ln:return.001;default:return 1}};const _n=(t,i)=>{let n=t;if("vertical-surface-line"===i&&t.length>=1){const i=t[0],o=e.Cartographic.fromCartesian(i),r=e.Math.toDegrees(o.longitude),a=e.Math.toDegrees(o.latitude),s=0;n=[e.Cartesian3.fromDegrees(r,a,o.height),e.Cartesian3.fromDegrees(r,a,s)]}if("vertical-line"===i&&t.length>=2){const i=t[0],o=t[1],r=h(i),a=h(o);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));n=[m(s),c,m(l),m(s)]}return i.startsWith("curve")&&t.length>2&&(n=En(t)),n},xn=(e,t,i,n,o)=>{i.push(...e.map((i,o)=>{const r=e[o+1];if(r){let e=t?je(i,r):We(i,r);return e=Cn(e,"m",n),{value:Number(e.toFixed(2)),unit:n,position:Ye([i,r]),positions:[i,r]}}return null}).filter(e=>e&&e.value>0))},Mn=e=>{if(2===e.length)return e;let[t,i]=e;return i||(i=bn(t)),[t,i]},En=t=>{const i=t.length,n=Ze(t),o=Math.floor(n/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<o;t++){const i=t/(o-1),n=e.Math.lerp(l,c,i),r=a.evaluate(n);s.push(r)}return s},Dn=(t,i=1e3)=>{if(t.length<2)return console.warn("至少需要2个点才能生成箭头"),[];const n=t[t.length-1],o=t[t.length-2],r=h(n),a=h(o),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),n=m(t),o=m(new e.Cartographic(t.longitude+i,t.latitude,t.height)),r=2*e.Cartesian3.distance(n,o),a=m(new e.Cartographic(t.longitude,t.latitude+i,t.height));return{lon:r,lat:2*e.Cartesian3.distance(n,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 An 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=_n(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 Sn 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 In 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 n=e.Cartographic.fromCartesian(t[0]).height,o=[new e.GeometryInstance({geometry:new e.CircleGeometry({center:t[0],height:n,radius:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:o,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:o,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 n=We(t[0],t[1]),o=e.Cartographic.fromCartesian(t[0]).height,r=new e.CircleOutlineGeometry({center:t[0],height:o,radius:n}),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 Tn 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,n=e.Rectangle.fromCartesianArray(t),o=[new e.GeometryInstance({geometry:new e.RectangleGeometry({rectangle:n,height:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:o,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:o,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 n=e.Cartographic.fromCartesian(t[0]).height,o=e.Rectangle.fromCartesianArray(t),r=new e.RectangleOutlineGeometry({rectangle:o,height:n}),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 zn 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:n,clampToGround:o,measureUnit:r}=e;t||(t=i),o||(o=!1);const[a,s]=Mn(r),l=bn("m");e.measureUnit=[a,s];const c=[];if("polyline"===n&&(xn(i,o,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"===n&&xn(t,o,c,a),"vertical-line"===n&&(xn(t,o,c,a),c.forEach((e,t)=>{0===t&&(e.prefixText="高度"),1===t&&(e.prefixText="水平距离"),2===t&&(e.prefixText="空间距离")})),"polygon"===n){xn(t,o,c,a);const e=wn(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("rectangle"===n){xn(t,o,c,a);const e=wn(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("circle"===n){const e=o?je(i[0],i[1]):We(i[0],i[1]);c.push({value:Number(Cn(e,"m",a).toFixed(2)),unit:a,position:i[1],positions:i,prefixText:"半径"});const t=wn(e*e*Math.PI,l,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 n=this.createDiv(`measure-label-${this.drawData.id}-${t}`,i);this.measureDivs.push({position:e.position,divEle:n})})}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 n=`\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 `,o=document.createElement("div");return o.id=e,o.innerHTML=n,o.style.position="absolute",o.style.pointerEvents="none",o.className=`measure-label measure-label-${this.drawData.id}`,this.cesiumWidget.appendChild(o),o}calcShapePositions(e){this.setShapePositions(e)}}class Fn 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=_n(t,this.drawData.shape);let i=Ze(t)/this.arrowLengthScale;return i>3e6&&(i=3e6),t=Dn(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 Rn 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 On={point:1,circle:2,rectangle:2,sector:3,"vertical-surface-line":1,"vertical-line":2},Ln={},Bn=e=>{const{type:t,action:i,outline:n,pointCount:o}=e;Ln[t]=(e,t)=>{i(e,t),n&&Gn(e)},o&&(On[t]=o)},kn=(e,t,i)=>{Ln[t]&&Ln[t](i,e)},Nn=e=>{const t=new An(e);e.primitives.add(t)},Gn=e=>{const t=new Rn(e);e.primitives.add(t)},Un=(e,t)=>{const i=new Fn(e,t);e.primitives.add(i)},Vn=e=>{const t=new Sn(e);e.primitives.add(t)},$n=e=>{const t=new In(e);e.primitives.add(t)},Hn=e=>{const t=new Tn(e);e.primitives.add(t)},Wn=(e,t)=>{const i=new zn(e,t);e.primitives.add(i),e.measurePrimitive=i,e.primitives.raiseToTop(i)},qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAQBJREFUWEft2MsNgkAQBuAZtABCBctBErvATryiRRibkKudGKvgwMFtQGIBumOAYAxCArsTs4fZ8w758032wSJ4PtDzfCABXTvEKhjmhXpka+0a6rueNWB0KgmAdLVLYq6QbAHDvEwDgksdzOAz5pKUgK6tFkERnCogq3iq1Ng8ERRBS4HBjTrKywMAqjnfJCKFAGlTg3ieU9vOJV1lq2O/bjhgcyv59yBt8LXpXzLYBFsE2toKojHX+z75kWc8iwsV0PLm8XVLArotivp/RFrsYiiCLnp1rQiKoKWAHHWWcJ8yZsFF8zbj5eNRt9VwPRp1hGyCrq0cq5eArrLeC74BlkT4KR3TrCoAAAAASUVORK5CYII=",jn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAY9JREFUWEftmNFRwzAMhiVYAMoC5Y50jjAJ9LFliMIQNI/NJtA1CA9hAHIsgMWZYC5xHVtNajcHzqtl+ctvSZaNMPIPR84HEXDoDv1tBc/XxRMCpFaVEPNqcTXvq6RTwbOsSE8FTfUFBOKNE05NQsxRiK3u4/MEy49F8myDdwJOstcNEN32VWCouhHQu4JetnYPp84tVr4uHl8OGofvd7Ocw8kGnKwL4jjk2lTLhLU2y0guGgE7pI8KdsVkuBhEzDtPGstYEEAkmstyMcmKFRDcN9WyjUk774AKQEE1IW1jyt47IACV1XJ22VRNQqKgN70Im9qyAIASbRdST4qunjEQoB3S1tAGBATQY05iy7ObEDdHLzMmOFPi6KBBFLTBuSC9A5rg6pijqSm79TrpHRC021o7IdrZfbwy8wNpztYacgRlhtuitu38b3E/rt9Z/w+Q9czBVtV9RCpX7I7adTKw2QBAIFy7njz2Bvy+OGXFighS9pvMDjWVdXlKHrg/xFaQ6/DQdhFwqKJRwaEKfgEJRgs46ima/wAAAABJRU5ErkJggg==",Zn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAMdJREFUWEdjZBjkgHGQu49h1IGUxtBoCI6GIKUhQKn+0TQ4GoKUhgCl+kfT4GgIUhoClOofTYM0DUGh6bfrGRgYFSi1BJ9+xn//Dr7NVluASw3eKBaadvs/LR0HM/sfI4Pjh0zVA9jswulAgenXFZj+s9ynjwP/KH7I1HxAkgNBioWn3kr4z8RkT1tH/n/wLlO1kawopq3DiDN9tJghLpxwqxoNwdEQpDQEKNU/mgZHQ5DSEKBU/2gaHA1BSkOAUv2jaXDYhyAAbjwcKU1UyjYAAAAASUVORK5CYII=",Yn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAkJJREFUWEftl19SwkAMxpPCARAvgDPijKewnER4BA8hHEJ5FE8CnsIZccZ6AJEDMF1Ny5Zu/6bNMvQBXmk3vyZfvmQRGv7DhvPBGVBaIasZ7M4/XwhoM74eScH0+9YAAzilhuHByttMbq5sQFoBNOE0lh1IMeDF83qJAG52tuSQIsBiODuZrA14+fQxVIhBUwSqA1hFmURcHPQIAIiLuo1TG5CguvP14z/Z1EcYtHzVi4ARpj7sXh3V/iLw30l/ULdhRIAUtDN/723Ht56RUYTpZtyf6f/qwtF7YkAdPAtQAmbdB08KSMF/Hm4WRRmpCkjeyWmc0hJHVlLSiaQ3gHYv/IidR7rM+6CDPZX7ZCFg0ueoW7fj/kqiLfoQ6u7DGcWQuYDHgNNQVSAzAZNwgQkjpDJHXldUSm1DDrTv01nHnmHmOQtGCpA3vsJwnJJ35mvXUbBkySJD5ylAPR04B54EMD7C4kJGBbMkdJn16BK3/FZq21GOc8eZ17lNYmZSeeHA76cgOZlOPpMse9G8zgUMOo3ErWC631c8H3Fk22bKlolCHzQgLRq1rk4ZHGtZIEjSUJneqo46zvhkAXI1VhWQe27pLOYe1FhAXapGLqzhddN3yYLQV9/myg9vwQQR3EdEGkz6pAL09KXJuECFUYIrAFcu8edqazDtk9nhOVZSBF4b0NhUIjM3Q0nhRCU2djtj4uznjvC6qc8XZTCer7gmbWTOOqDegpQCV3JRT+rRWgbrdCjnnTMgJ0tHsxlpcM77f6iGZThXF5iUAAAAAElFTkSuQmCC";class Jn{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=Yn,i.className="draw-edit-icon",t.appendChild(i),t.addEventListener("click",()=>{this._drawEditEvent.drawEditMove&&this._drawEditEvent.drawEditMove(this._editPointPrimitive)});const n=document.createElement("DIV");n.id="addPoint";const o=document.createElement("img");o.src=qn,o.title="点击添加节点",o.className="draw-edit-icon",n.appendChild(o),n.addEventListener("click",()=>{this._drawEditEvent.drawEditAdd&&this._drawEditEvent.drawEditAdd(this._editPointPrimitive)});const r=document.createElement("DIV"),a=document.createElement("img");r.id="removePoint",a.src=Zn,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=jn,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(n),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 Jn.editUI||(Jn.editUI=new Jn(e,t)),Jn.editUI}showAt(e,t,i){this.setVisible(!0),this._editUiPosition=e,this._editPointPrimitive=t,this.setAddElementStatus(!On[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(){Jn.editUI&&(this._editUi&&this._editUi.parentNode.removeChild(this._editUi),this._editUi=null)}}Ln.polyline=e=>{Nn(e)},Ln["polyline-arrow"]=(e,t)=>{Nn(e),Un(e,t)},Ln.curve=e=>{Nn(e)},Ln["curve-arrow"]=(e,t)=>{Nn(e),Un(e,t)},Ln["vertical-line"]=e=>{e.clampToGround=!1,Nn(e)},Ln["vertical-surface-line"]=e=>{e.clampToGround=!1,Nn(e)},Ln.polygon=e=>{Vn(e),Gn(e)},Ln.circle=e=>{$n(e),Gn(e)},Ln.rectangle=e=>{Hn(e),Gn(e)},Bn({type:"sector",action:Xi,outline:!0,pointCount:3}),Bn({type:"db-arrow",action:Qi,outline:!0,pointCount:4}),Bn({type:"fine-arrow",action:en,outline:!0,pointCount:2});const Kn=t=>{let i;const n=[];let o=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 n=t.scene,o=new e.ScreenSpaceEventHandler(n.canvas);let r;t.cesiumWidget.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),o.setInputAction(e=>{const o=n.pickPosition(e.position),a=(new Date).getTime();if(r&&a-r<270){const n=t.scene.pick(e.position);return void i(Oi.DRAW_DB_CLICK,{position:o,pickPrimitive:n?.primitive,windowPosition:e.position})}i(Oi.DRAW_ADD,{position:o}),r=(new Date).getTime()},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{const o=t.scene.pick(e.endPosition),r=n.pickPosition(e.endPosition);i(Oi.DRAW_MOVE,{position:r,pickPrimitive:o?.primitive,windowPosition:e.endPosition}),o&&i(Oi.DRAW_PICK,{position:r,pickPrimitive:o?.primitive,windowPosition:e.endPosition})},e.ScreenSpaceEventType.MOUSE_MOVE),o.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),o=new e.Cartesian3(0,0,0),s=void 0,void w();if((!On[a.shape]||On[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)}o=new e.Cartesian3(0,0,0),s=void 0,m(a.id),a={},w()},f=i=>{i||(i=a),t._element.style.cursor="default",o=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>On[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===o.x&&e.y===o.y&&e.z===o.z);a.positions.push(e),-1!==t&&a.positions.splice(t,1),l&&a.pointPrimitives.remove(l),l=E(e,a)}o=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(On[a.shape])return;f()}else!a.isEditing&&i&&C(e,t,i)},drawRightClick:()=>{a.isEditing?g():i.setVisible(!1)}},y=(e,i)=>{const o=e.id.split("-")[1],a=r.find(e=>e.id===o);n.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,o,a)=>{if(a instanceof e.PointPrimitive){if(n.includes(a.id))return;const e=a.id.split("-")[1],o=r.find(t=>t.id===e);if(!o)return;if(!o.edit)return;console.log(a),i.showAt(t,a,o.shape),A.drawEditStart&&A.drawEditStart(o)}},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=On[a.shape]?"default":"default-dbclick";P.id?c.showAt(e,Bi.drawEditMove[a.shape]||Bi.drawEditMove.default):On[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:n=>{i.setVisible(!1);const{id:o,index:r,drawData:s}=x(n),l=new e.Cartesian3(n.position.x,n.position.y,n.position.z);s?.positions.splice(r,0,l),a=s;const c=E(l,a);t._element.style.cursor="move",Object.assign(P,{id:o,index:r+1,pointPrimitive:c,originPosition:l}),a.isEditing=!0},drawEditMove:n=>{i.setVisible(!1),t._element.style.cursor="move";const{id:o,index:r,drawData:s}=x(n);a=s,Object.assign(P,{id:o,index:r,pointPrimitive:n,originPosition:new e.Cartesian3(n.position.x,n.position.y,n.position.z)}),a.isEditing=!0},drawEditRemove:e=>{i.setVisible(!1);const{index:t,drawData:n}=x(e);n.isEditing=!0,n.isDisAdd=!0,n?.positions.splice(t,1),n?.pointPrimitives.remove(e),A.drawEditEnd&&A.drawEditEnd(n),setTimeout(()=>{n.isEditing=!1,n.isDisAdd=!1},300)},drawDelete:e=>{i.setVisible(!1);const{id:t}=x(e);m(t)}};i=Jn.createEditUi(t,_);const x=e=>{const t=e.id.split("-")[1],i=r.find(e=>e.id===t),n=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:n}},M=(t,i)=>{const n=new e.PrimitiveCollection,o=new e.PointPrimitiveCollection;n.add(o);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:o,primitives:n};return h.add(n),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),kn(t,e.shape,i),e.measure&&Wn(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),kn(t,e.shape,i),e.measure&&Wn(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 zn);i&&i.updateUnit(t)},reShowDrawData:D,reShowDrawDatas:e=>{e.forEach(e=>{D(e)})}}};var Xn=Object.freeze({__proto__:null});const Qn={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 Qn)e.Material[t]=Qn[t]})();const eo={color:"rgba(255,255,255,1)",speed:6*Math.random()};class to extends at{speed;color;name="";image="";constructor(t){super(),this.createPropertyDescriptors();const i={...eo,...t};this.image=i.image,this.name=`${Qn.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 to&&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:no},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const io=t=>{const i={...eo,...t};return new e.Material({fabric:{type:`${Qn.PolylineTrail}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed},source:no},translucent:!0})},no="\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",oo={color:"rgba(255,255,255,1)",speed:6,repeatCount:4,blendColor:!0};class ro extends at{repeatCount;image;speed;color;blend;name="";constructor(t){super(),this.createPropertyDescriptors();const i={...oo,...t};this.name=`${Qn.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 ro&&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:so},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const ao=t=>{const i={...oo,...t};return new e.Material({fabric:{type:Qn.PolylineFlow+N(),uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed,count:i.repeatCount,blend:i.blendColor?1:0},source:so},translucent:!0})},so="\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",lo={color:"rgba(255,255,0,0.3)",speed:8,count:5,gradient:.3};class co extends at{count;speed;gradient;color;name="";constructor(t){super(),t||(t={});const i={...lo,...t};this.name=`${Qn.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||lo.count,i}equals(t){return this===t||t instanceof co&&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:ho},translucent:()=>!0})}}const po=t=>{const i={...lo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed,count:i.count,gradient:i.gradient},source:ho},translucent:!0})}},ho="\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",uo={color:"rgba(255,255,255,1)",speed:8};class mo extends at{speed;color;name="";constructor(t){super();const i={...uo,...t};this.name=`${Qn.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 mo&&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:fo},translucent:()=>!0})}}const go=t=>{const i={...uo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleRaderWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:fo},translucent:!0})}},fo="\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",vo={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class yo extends at{speed;color;name="";constructor(t){super();const i={...vo,...t};this.name=`${Qn.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 yo&&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:wo},translucent:()=>!0})}}const Co=t=>{const i={...vo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleRaderFan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:wo},translucent:!0})}},wo="\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",bo={color:"rgba(255,255,0,0.3)",speed:8};class Po extends at{speed;color;name="";constructor(t){super(),t||(t={});const i={...bo,...t};this.name=`${Qn.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 Po&&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:xo},translucent:()=>!0})}}const _o=t=>{const i={...bo,...t};return new e.Material({fabric:{type:`${Qn.CircleAperture}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:xo},translucent:!0})},xo="\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",Mo=t=>{t||(t={});return new e.Material({fabric:{type:`${Qn.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:Eo},translucent:!0})},Eo="\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",Do={color:"rgba(255,255,255,1)",count:3,duration:1500};class Ao extends at{duration;count;vertical;direction;color;_time;image;name="";constructor(t){super();const i={...Do,...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 Ao&&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=Io({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 So=t=>{const i={...Do,...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:Io({count:i.count,vertical:i.vertical,direction:i.direction})}})}},Io=e=>{const t=e.vertical?"vertical":"standard",i=e.direction?"+":"-";let n="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";return n+="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 `,n+="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 }",n},To={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class zo extends at{speed;color;name="";constructor(t){super();const i={...To,...t};this.name=`${Qn.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 zo&&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:Ro},translucent:()=>!0})}}const Fo=t=>{const i={...To,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidElectric}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Ro},translucent:!0})}},Ro="\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",Oo={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Lo extends at{speed;color;name="";constructor(t){super();const i={...Oo,...t};this.name=`${Qn.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 Lo&&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:ko},translucent:()=>!0})}}const Bo=t=>{const i={...Oo,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidVScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:ko},translucent:!0})}},ko="\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",No={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Go extends at{speed;color;name="";constructor(t){super();const i={...No,...t};this.name=`${Qn.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 Go&&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:Vo},translucent:()=>!0})}}const Uo=t=>{const i={...No,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidHScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Vo},translucent:!0})}},Vo="\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",$o={color:"rgba(255,255,255,1)",speed:1};class Ho extends at{color;speed;name="";constructor(t){super();const i={...$o,...t};this.name=Qn.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 Ho&&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(Qn.Zaps,{fabric:{type:Qn.Zaps,uniforms:{uColor:this.color,speed:this.speed,uResolution:new e.Cartesian2(1024,1024)},source:qo},translucent:()=>!0})}}const Wo=t=>{const i={...$o,...t};return{material:new e.Material({fabric:{type:Qn.Zaps,uniforms:{uColor:e.Color.fromCssColorString(i.color),uSpeed:i.speed,uResolution:new e.Cartesian2(1024,1024)},source:qo}})}},qo="\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 jo 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:Mo(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 Zo=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let Yo=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const o=n>>4;if(1!==o)throw new Error(`Got v${o} data when expected v1.`);const r=Zo[15&n];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,n){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 o=Zo.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,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+o]),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 Jo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:a}=this,s=[0,o.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<=n&&l.push(o[a])}continue}const h=p+d>>1,u=r[2*h],m=r[2*h+1];u>=e&&u<=i&&m>=t&&m<=n&&l.push(o[h]),(0===c?e<=u:t<=m)&&(s.push(p),s.push(h-1),s.push(1-c)),(0===c?i>=u:n>=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:n,coords:o,nodeSize:r}=this,a=[0,n.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(o[2*i],o[2*i+1],e,t)<=l&&s.push(n[i]);continue}const h=p+d>>1,u=o[2*h],m=o[2*h+1];er(u,m,e,t)<=l&&s.push(n[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 Jo(e,t,i,n,o,r){if(o-n<=i)return;const a=n+o>>1;Ko(e,t,a,n,o,r),Jo(e,t,i,n,a-1,1-r),Jo(e,t,i,a+1,o,1-r)}function Ko(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const a=o-n+1,s=i-n+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);Ko(e,t,i,Math.max(n,Math.floor(i-s*c/a+d)),Math.min(o,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=n,l=o;for(Xo(e,t,n,i),t[2*o+r]>a&&Xo(e,t,n,o);s<l;){for(Xo(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*n+r]===a?Xo(e,t,n,l):(l++,Xo(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function Xo(e,t,i,n){Qo(e,i,n),Qo(t,2*i,2*n),Qo(t,2*i+1,2*n+1)}function Qo(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function er(e,t,i,n){const o=e-i,r=t-n;return o*o+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||(nr=new Float32Array(1),e=>(nr[0]=+e,nr[0]));var nr;class or{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:n}=this.options;t&&console.time("total time");const o=`prepare ${e.length} points`;t&&console.time(o),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[n,o]=i.geometry.coordinates,a=ir(sr(n)),s=ir(lr(o));r.push(a,s,1/0,t,-1,1),this.options.reduce&&r.push(0)}let a=this.trees[n+1]=this._createTree(r);t&&console.timeEnd(o);for(let e=n;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 n=Math.max(-90,Math.min(90,e[1]));let o=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,o=180;else if(i>o){const e=this.getClusters([i,n,180,r],t),a=this.getClusters([-180,n,o,r],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(sr(i),lr(r),sr(o),lr(n)),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),n="No cluster with the specified id.",o=this.trees[i];if(!o)throw new Error(n);const r=o.data;if(t*this.stride>=r.length)throw new Error(n);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=o.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(n);return d}getLeaves(e,t,i){t=t||10,i=i||0;const n=[];return this._appendLeaves(n,e,t,i,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:r,radius:a}=this.options,s=a/r,l=(i-s)/o,c=(i+1+s)/o,d={features:[]};return this._addTileFeatures(n.range((t-s)/o,l,(t+1+s)/o,c),n.data,t,i,o,d),0===t&&this._addTileFeatures(n.range(1-s/o,l,1,c),n.data,o,i,o,d),t===o-1&&this._addTileFeatures(n.range(0,l,s/o,c),n.data,-1,i,o,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,n,o){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(e,r.cluster_id,i,n,o):o<n?o++:e.push(t),e.length===i)break}return o}_createTree(e){const t=new Yo(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,n,o,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[n,o]=i.geometry.coordinates;c=sr(n),d=lr(o)}const p={type:1,geometry:[[Math.round(this.options.extent*(c*o-i)),Math.round(this.options.extent*(d*o-n))]],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:n,reduce:o,minPoints:r}=this.options,a=i/(n*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 n=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=n*h,a=d*h,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const n of p){const l=n*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,o&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),o(e,this._map(s,l)))}s[i+4]=g,l.push(r/u,a/u,1/0,g,-1,u),o&&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 n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].properties,o=this.options.map(n);return i&&o===n?Object.assign({},o):o}}function rr(e,t,i){return{type:"Feature",id:e[t+3],properties:ar(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),cr(e[t+1])]}};var n}function ar(e,t,i){const n=e[t+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=e[t+6],a=-1===r?{}:Object.assign({},i[r]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:o})}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 or({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 n=e.getTimestamp();this.loadCluster(t),t.camera.changed.addEventListener(()=>{e.getTimestamp()-n<=500||(n=e.getTimestamp(),this.loadCluster(t))})};flyToChildByClusterId(t){const i=this.supercluster?.getChildren(t),n=i?.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),o=e.BoundingSphere.fromPoints(n);return this.options.viewer.camera.flyToBoundingSphere(o),i}loadCluster=t=>{const i=tt(t.camera),n=t.camera.computeViewRectangle(),o=this.supercluster.getClusters([e.Math.toDegrees(n.west),e.Math.toDegrees(n.south),e.Math.toDegrees(n.east),e.Math.toDegrees(n.north)],i);this.clearCollection();const r=this.options.cluster.colorsByRate||mr.colorsByRate,a={type:"FeatureCollection",features:o.map(e=>{const t=e.properties.point_count/this.options.geoJson.features.length,n=Object.keys(r).find(e=>t>Number(e))||"#ff0000";if(e.properties.cluster){const t=this.getClusterImageByCount(r[n],e.properties.point_count,i),o=16*(String(e.properties.point_count).length+1);e.properties.style={...e.properties.style,billboard:{...e.properties.style?.billboard,image:t,pixelOffset:[0,-o/12]}}}return e})};this.initCollection(a)};getClusterImageByCount(t,i,n){if(!this.clusterImageCache[i+t]){const o=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=o,l.height=o;const c=l.getContext("2d");c.save(),c.scale(o/24,o/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(n)}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 n=t.scene.terrainProvider,o=i.features.map(t=>e.Cartographic.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),r=await e.sampleTerrainMostDetailed(n,o);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 n;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 n=i.coordinates.map(t=>e.Cartesian3.fromDegrees(t[0],t[1],t[2])),o={...gr,...this.options?.line,...i.properties?.style?.line};t.push(new e.GeometryInstance({id:N(),geometry:new e.GroundPolylineGeometry({positions:n,width:o?.width}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(o.color))}}))}),n=this.appearance?this.appearance:new e.PolylineColorAppearance,this.polylinePrimitives=new e.GroundPolylinePrimitive({geometryInstances:t,appearance:n})}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 n;n="Polygon"===i.geometry.type?new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(i.geometry.coordinates[0].flat())):Cr(i.geometry);const o={...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:n}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(o.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,n,o,r){if(o-n<=i)return;const a=n+o>>1;br(e,t,a,n,o,r%2),wr(e,t,i,n,a-1,r+1),wr(e,t,i,a+1,o,r+1)}function br(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const a=o-n+1,s=i-n+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(n,Math.floor(i-s*c/a+d)),Math.min(o,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=n,l=o;for(Pr(e,t,n,i),t[2*o+r]>a&&Pr(e,t,n,o);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*n+r]===a?Pr(e,t,n,l):(l++,Pr(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function Pr(e,t,i,n){_r(e,i,n),_r(t,2*i,2*n),_r(t,2*i+1,2*n+1)}function _r(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function xr(e,t,i,n){const o=e-i,r=t-n;return o*o+r*r}const Mr=e=>e[0],Er=e=>e[1];class Dr{constructor(e,t=Mr,i=Er,n=64,o=Float64Array){this.nodeSize=n,this.points=e;const r=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new r(e.length),s=this.coords=new o(2*e.length);for(let n=0;n<e.length;n++)a[n]=n,s[2*n]=t(e[n]),s[2*n+1]=i(e[n]);wr(a,s,n,0,a.length-1,0)}range(e,t,i,n){return function(e,t,i,n,o,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<=o&&d>=n&&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<=o&&d>=n&&d<=r&&l.push(e[m]);const g=(p+1)%2;(0===p?i<=c:n<=d)&&(s.push(u),s.push(m-1),s.push(g)),(0===p?o>=c:r>=d)&&(s.push(m+1),s.push(h),s.push(g))}return l}(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return function(e,t,i,n,o,r){const a=[0,e.length-1,0],s=[],l=o*o;for(;a.length;){const c=a.pop(),d=a.pop(),p=a.pop();if(d-p<=r){for(let o=p;o<=d;o++)xr(t[2*o],t[2*o+1],i,n)<=l&&s.push(e[o]);continue}const h=Math.floor((p+d)/2),u=t[2*h],m=t[2*h+1];xr(u,m,i,n)<=l&&s.push(e[h]);const g=(c+1)%2;(0===c?i-o<=u:n-o<=m)&&(a.push(p),a.push(h-1),a.push(g)),(0===c?i+o>=u:n+o>=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,n,o,r){if(e.defined(t._labelCollection)&&o._clusterLabels?r=e.Label.getScreenSpaceBoundingBox(t,i,r):e.defined(t._billboardCollection)&&o._clusterBillboards?r=e.Billboard.getScreenSpaceBoundingBox(t,i,r):e.defined(t._pointPrimitiveCollection)&&o._clusterPoints&&(r=e.PointPrimitive.getScreenSpaceBoundingBox(t,i,r)),Tr(r,n),o._clusterLabels&&!e.defined(t._labelCollection)&&e.defined(t.id)&&Lr(o,t.id.id)&&e.defined(t.id._label)){const a=o._collectionIndicesByEntity[t.id.id].labelIndex,s=o._labelCollection.get(a),l=e.Label.getScreenSpaceBoundingBox(s,i,zr);Tr(l,n),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,n){const o={billboard:n._clusterBillboardCollection.add(),label:n._clusterLabelCollection.add(),point:n._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=i,o.billboard.position=o.label.position=o.point.position=e,n._clusterEvent.raiseEvent(i,o)}function Lr(t,i){return e.defined(t)&&e.defined(t._collectionIndicesByEntity[i])&&e.defined(t._collectionIndicesByEntity[i].labelIndex)}function Br(t,i,n,o,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&&!o.isPointVisible(a.position))continue;const l=a.computeScreenSpacePosition(n);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,n,o){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[o]))return a.get(c[o]);e.defined(a)||(a=this[t]=new i({scene:this._scene}));const d=this[n];return d.length>0?(s=d.pop(),l=a.get(s)):(l=a.add(),s=a.length-1),c[o]=s,Promise.resolve().then(()=>{this._clusterDirty=!0}),l}}function Vr(t,i){const n=t._collectionIndicesByEntity[i];e.defined(n.billboardIndex)||e.defined(n.labelIndex)||e.defined(n.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=(n=this,function(t){if(e.defined(t)&&t<.05||!n.enabled)return;const i=n._scene,o=n._labelCollection,r=n._billboardCollection,a=n._pointCollection;if(!e.defined(o)&&!e.defined(r)&&!e.defined(a)||!n._clusterBillboards&&!n._clusterLabels&&!n._clusterPoints)return;let s=n._clusterLabelCollection,l=n._clusterBillboardCollection,c=n._clusterPointCollection;e.defined(s)?s.removeAll():s=n._clusterLabelCollection=new e.LabelCollection({scene:i}),e.defined(l)?l.removeAll():l=n._clusterBillboardCollection=new e.BillboardCollection({scene:i}),e.defined(c)?c.removeAll():c=n._clusterPointCollection=new e.PointPrimitiveCollection;const d=n._pixelRange,p=n._minimumClusterSize,h=n._previousClusters,u=[],m=n._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;n._clusterLabels&&Br(o,C,i,y,n),n._clusterBillboards&&Br(r,C,i,y,n),n._clusterPoints&&Br(a,C,i,y,n);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 o=e.Billboard._computeScreenSpacePosition(e.Matrix4.IDENTITY,t.position,e.Cartesian3.ZERO,e.Cartesian2.ZERO,i);if(!e.defined(o))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=o.x-.5*a,c=o.y-.5*s,d=o.x+a,f=o.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,n),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,n,kr);const o=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,n,Gr);e.Cartesian3.add(t.position,r,r),e.BoundingRectangle.union(o,i,o),++S,A.push(t.id)}if(S>=p){const t=e.Cartesian3.multiplyByScalar(r,1/S,r);for(Or(t,S,A,n),u.push({position:t,width:o.width,height:o.height,minimumWidth:_.width,minimumHeight:_.height}),b=0;b<M;++b)C[x[b]].clustered=!0}else Rr(i,n)}0===s.length&&(s.destroy(),n._clusterLabelCollection=void 0),0===l.length&&(l.destroy(),n._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),n._clusterPointCollection=void 0),n._previousClusters=u,n._previousHeight=g});var n;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 n=i.labelIndex;i.labelIndex=void 0,Vr(this,t.id);const o=this._labelCollection.get(n);o.show=!1,o.text="",o.id=void 0,this._unusedLabelIndices.push(n),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 n=i.billboardIndex;i.billboardIndex=void 0,Vr(this,t.id);const o=this._billboardCollection.get(n);o.id=void 0,o.show=!1,o.image=void 0,this._unusedBillboardIndices.push(n),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 n=i.pointIndex;i.pointIndex=void 0,Vr(this,t.id);const o=this._pointCollection.get(n);o.show=!1,o.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0},Ar.prototype.update=function(t){if(!this.show)return;let i;var n;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,(n=this).enabled||(e.defined(n._clusterLabelCollection)&&n._clusterLabelCollection.destroy(),e.defined(n._clusterBillboardCollection)&&n._clusterBillboardCollection.destroy(),e.defined(n._clusterPointCollection)&&n._clusterPointCollection.destroy(),n._clusterLabelCollection=void 0,n._clusterBillboardCollection=void 0,n._clusterPointCollection=void 0,$r(n._labelCollection),$r(n._billboardCollection),$r(n._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:_o(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 n=e.Color.fromCssColorString(this.options.fillColor),o=Ut(i.positions,n,`grid-${i.id}`);t.push(o)});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 n=e.Color.fromCssColorString(this.options.outlineColor),o=Vt(i.positions,n,`grid-${i.id}`);t.push(o)});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),n=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(n)}})}unSelectGrids(t){const i=e.Color.fromCssColorString(this.options.fillColor),n=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(n)}})}}const qr=t=>{const i=[],n={LEFT_CLICK:[]};return t.scene.postRender.addEventListener(()=>{i.forEach(i=>{if(i.distanceDisplayCondition){const n=e.Cartesian3.distance(i.position,t.camera.position);if(n>=i.distanceDisplayCondition.far||n<=i.distanceDisplayCondition.near)return void(i.divEle.style.display="none")}const n=t.scene.cartesianToCanvasCoordinates(i.position);if(n){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=n.x/i.autoFit.x-(e.width+i.offset.x)/i.autoFit.x/t+"px",i.divEle.style.top=n.y/i.autoFit.y-(e.height+i.offset.y)/i.autoFit.y+"px"}else i.divEle.style.display="none"})}),{divLabels:i,set:o=>{const r={id:o.divEle.id||N(),...o};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",()=>{n.LEFT_CLICK.forEach(e=>{e(r)})}),r},setPosition:(e,t)=>{const n=i.findIndex(t=>t.id===e);if(-1!==n){i[n].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)=>{n[e]&&n[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 n=t?.positions;n=t.unionClippingRegions?c(n):d(n),n.forEach((t,o)=>{const r=(o+1)%n.length,a=n[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 n=new e.CustomDataSource("clipPolygon");t.dataSources.add(n),t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{t={inverse:!1,...t};const o=t?.positions,r=new e.ClippingPolygon({positions:o});i.add(r);const a=u(p(o).map(e=>(e.height=-t.depth,e))),s=n.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});n.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,n.entities.removeAll()},removeAll:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,n.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:n}=e;return console.log(t,e,i,n),{id:N()}},remove:()=>{},removeAll:()=>{i.entities.removeAll()},destroy:()=>{t.dataSources.remove(i)}}},Jr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1}),n=new e.PrimitiveCollection({destroyPrimitives:!1}),o=new e.PointPrimitiveCollection,r=new e.LabelCollection;n.add(o),i.add(r),i.add(n),t.scene.primitives.add(i);const a=(t,i)=>{t.forEach(t=>{i.add({position:t,color:e.Color.TRANSPARENT})})},s=(t,i)=>{const n=new e.GroundPolylineGeometry({positions:t,width:3}),o=new e.GeometryInstance({geometry:n});i.add(new e.GroundPolylinePrimitive({geometryInstances:o,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 n=new e.WallGeometry({positions:t}),o=e.WallGeometry.createGeometry(n),r=new e.GeometryInstance({geometry:o});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,n)=>{const o=new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),height:i}),r=new e.GeometryInstance({geometry:o});n.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,n,o,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(n.geometry.coordinates[0],n.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]}`}),o.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,n)=>{t.forEach((t,o)=>{n.add({position:t,text:`高程:${h(i[o].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 n=[],o=e[0],r=e[1],a=e[2],s=e[3],l=t/he([o,r],[a,r],i)*(a-o),c=t/he([o,r],[o,s],i)*(s-r),d=a-o,p=s-r,h=Math.floor(d/l),u=(p-Math.floor(p/c)*c)/2,m=o+(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)&&n.push(f):n.push(f),g+=c}m+=l}return oe(n)}(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,o),c(u,f,i),s(u,n),l(u,i),d(e,C,b,r,y),p(u,m,r)}),{id:N()}},remove:()=>{},removeAll:()=>{r.removeAll(),o.removeAll(),n.removeAll(),i.removeAll(),n.add(o),i.add(n),i.add(r)},destroy:()=>{}}},Kr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1});let n,o="/icons/markers/mark-icon.png";const r=[];t.scene.primitives.add(i);const a=i=>{if(!i)return n&&t.entities.remove(n),void(n=void 0);n||(n=t.entities.add({position:m(new e.Cartographic(i.longitude,i.latitude,i.height)),billboard:{image:o,scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),n.position=m(new e.Cartographic(i.longitude,i.latitude,i.height))};return{set:async e=>{e.tipMarkerUrl&&(o=e.tipMarkerUrl);const{positions:i}=e;let n=Ze(i);const a=Math.floor(n/e.pointDistance);let s=nt(i,a);s=await t.scene.clampToHeightMostDetailed(s),n=0;const l=s.map((e,t)=>{let i=0;t>0&&(i=je(s[t-1],e),n+=i);return{...h(e),distance:i,allDistance:n}}),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,n="";const o=[];e.scene.primitives.add(t);const r=async(t,i,n)=>{const o=JSON.parse(JSON.stringify(t));await e.scene.clampToHeightMostDetailed(o)},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:n,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&&(n=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,n=Ze(i),o=Math.floor(n/t.pointDistance),a=nt(i,o).filter(e=>e&&e.x&&e.y&&e.z),s={id:N(),datas:[]};r(a),e(s)},500)})},remove:e=>{const t=o.findIndex(t=>t.id===e.id);-1!==t&&o.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,Po as CircleApertureMaterialProperty,Hr as CircleAperturePrimitive,yo as CircleRaderFanMaterialProperty,mo as CircleRaderWaveMaterialProperty,co as CircleWaveMaterialProperty,t as Common,ii as CoordinateTransformer,l as DefaultViewerOptions,Li as Draw,Oi as DrawEventType,ki as DrawStyle,zo as EllipsoidElectricMaterialProperty,Go as EllipsoidHScanMaterialProperty,Lo as EllipsoidVScanMaterialProperty,Ft as FlyAttitude,Wr as GridPrimitives,yr as GroundPolygonPrimitives,fr as GroundPolylinePrimitives,Ao as LightWallMaterialProperty,Xn as Material,Ar as PointClusterPrimitives,dr as PointPrimitives,ro as PolylineFlowMaterialProperty,to as PolylineTrailMaterialProperty,V as Popup,jo as RadereScanPrimitive,Rt as RoamStatus,U as Tooltip,pi as TransformsFor3dtiles,Ho as ZapsMaterialProperty,Bn as addDrawActions,Je as calcArea,ot as calcBoundingSphereFromPositions,it as calcCameraHeightFromZoom,je as calcGeodesicDistance,Ze as calcGeodesicDistances,nt 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,_o as createCircleApertureMaterial,Co as createCircleRaderFanMaterial,po as createCircleWaveMaterial,jr as createClipPlaneAnalysis,Zr as createClipPolygonAnalysis,qr as createDivLabelHandler,Kn as createDrawHandler,zi as createDroneAnimCustomShader,Y as createEagleEye,Fo as createEllipsoidElectricMaterial,Uo as createEllipsoidHScanMaterial,Bo as createEllipsoidVScanMaterial,Jr as createFillAndDigAnalysis,Yr as createFloodAnalysis,xi as createFogStage,_i as createHeightFogStage,yi as createHighLightStage,Si as createLightBandCustomShader,So as createLightWallMaterial,Ai as createLightningStage,Xr as createModelProfileAnalysis,Gt as createOpenAnim,Ri as createOutLineEffect,wi as createOutlineStage,ao as createPoylineFlowMaterial,Kr as createProfileAnalysis,go as createRaderWaveMaterial,Di as createRainCoverStage,Ei as createRainStage,zt as createRoamHandler,J as createRollerShutterHandler,Mo as createScanRadarMaterial,It as createSkyBox,Tt as createSkyBoxOnGround,Ci as createSkylineStage,bi as createSnowCoverStage,Pi as createSnowStage,K as createSplitScreenHandler,io as createTrailMaterial,Wo 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,n as initCesium,L as initCesiumEvent,ai as load3dTiles,vi as loadI3s,gi as loadModel,hi as loadTerrain,mi as loadTerrainFromCesium,ni 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,o as setGlobeEnabled,r as setGlobeOpatity,si as setHeightOffsetFor3dTiles,oi as setImageLayerTheme,w as setViewToLnglat,R as twinkleModel};
|