cesium_dev_kit 1.0.96 → 1.0.98
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/README.md +42 -3
- package/dist/index.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"libgif";import{GUI as i}from"dat.gui";import n from"echarts";let r=null;class o{constructor(e){r=e,this.init_data()}init_data(){this.viewer=null}init({containerId:e,viewerConfig:t,extraConfig:i,MapImageryList:n,imageryProvider:o,viewer:a}){var s={contextOptions:{webgl:{alpha:!1}},animation:!1,timeline:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,selectionIndicator:!1,shadow:!0,sceneMode:r.SceneMode.SCENE3D,infoBox:!1,sceneModePicker:!1,navigationHelpButton:!1,projectionPicker:!1,baseLayerPicker:!1,shouldAnimate:!0,navigation:!1,showRenderLoopErrors:!0},o=this.findCesiumProvider(o),l=(r.Ion.defaultAccessToken=i.AccessToken||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmYzkwZWEwYy1mMmIwLTQwYjctOWJlOC00OWU4ZWU1YTZhOTkiLCJpZCI6MTIxODIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NjA0OTUyNDN9.wagvw7GxUjxvHXO6m2jjX5Jh9lN0UyTJhNGEcSm2pgE",s=Object.assign(s,t),a||new r.Viewer(e,{...s,...o}));if(i.logo||(l.cesiumWidget.creditContainer.style.display="none"),i.depthTest&&(l.scene.globe.depthTestAgainstTerrain=!0),n&&0<n.length)for(let e=0;e<n.length;e++)this.addImageryProvider(l,n[e].type,n[e].option||n[e].classConfig);return this.viewer=l}addImageryProvider(e,t,i){e.imageryLayers.addImageryProvider(this.createCesiumProvider({type:t,option:i}))}findCesiumProvider(e){var t={};for(const i in e)e[i]&&e[i].type?t[i]=this.createCesiumProvider(e[i]):t[i]=e[i];return t}createCesiumProvider(e){switch(e.type){case"WebMapTileServiceImageryProvider":case"UrlTemplateImageryProvider":case"TileMapServiceImageryProvider":return new r[e.type](e.option)}}}let a=null;function s(e,t,i){e&&(a=t,this._graphicsLayer=new a.CustomDataSource("graphicsLayer"),e)&&e.dataSources.add(this._graphicsLayer)}s.prototype={getPointGraphics:function(e){if(e=e||{})return new a.PointGraphics({color:e.color||a.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||a.Color.WHITE,outlineWidth:e.outlineWidth||1})},getLineGraphics:function(e){if((e=e||{})&&e.positions)return new a.PolylineGraphics({show:!0,positions:e.positions,material:e.material||a.Color.YELLOW,width:e.width||1,arcType:a.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)})},getPolygonGraphics:function(e){if((e=e||{})&&e.positions)return new a.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||a.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||!1})},getLabelGraphics:function(e){if((e=e||{})&&e.l_text)return new a.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||a.Color.GOLD,style:e.l_style||a.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||a.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||!1,backgroundColor:e.l_backgroundColor||new a.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||a.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new a.Cartesian2(0,-30)})},getBillboardGraphics:function(e){if((e=e||{})&&e.b_img)return new a.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||!0,scale:e.b_scale||1,pixelOffset:e.b_pixelOffset||new a.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0})},getPathGraphics:function(e){if(e=e||{})return new a.PathGraphics({resolution:e.resolution||1,material:new a.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||a.Color.YELLOW}),width:e.width||30})},getModelGraphics:function(e){if(e=e||{})return new a.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:!0})},getEllipseGraphics:function(e){if(e=e||{})return new a.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||a.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",!0)})},getEllipsoidGraphics:function(e){var t;if(e=e||{})return t=e.radii||1e6,new a.EllipsoidGraphics({radii:new a.Cartesian3(t,t,t),innerRadii:this._objHasOwnProperty(e,"innerRadii",new a.Cartesian3(t/1.5,t/1.5,t/1.5)),maximumCone:e.maximumCone||a.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||a.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",!0),fill:this._objHasOwnProperty(e,"fill",!0),material:e.material||a.Color.RED.withAlpha(.1)})},getBoxGraphics:function(e){if(e=e||{})return new a.BoxGraphics({show:this._objHasOwnProperty(e,"show",!0),fill:this._objHasOwnProperty(e,"fill",!0),dimensions:e.dimensions||new a.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",!0),outlineColor:e.outlineColor||a.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})},getPlaneGraphics:function(e){if(e=e||{})return new a.PlaneGraphics({plane:e.plane||new a.Plane(a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(170,130),material:e.material||a.Color.BLUE})},getCylinderGraphics:function(e){if(e=e||{})return new a.CylinderGraphics({HeightReference:a.HeightReference.RELATIVE_TO_GROUND,length:e.length||250,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new a.Color(0,1,1,.4),slices:e.slices||128})},createPointsGraphics:function(e){if(e&&e.positions){var t,i=[];for(t in e.positions){var n=e.positions[t],o=this.createGraphics();o.name=e.name||"",o.oid=e.oid||"point",o.position=n,e.point&&(o.point=this.getPointGraphics()),e.billboard&&(o.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(o.label=this.getLabelGraphics(e.label)),i.push(this._graphicsLayer.entities.add(o))}return i}},createLineGraphics:function(e){var t;if(e&&e.positions)return(t=this.createGraphics()).name=e.name||"",t.oid=e.oid||"line",t.position=e.positions,t.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(t)},createPolygonGraphics:function(e){var t;if(e=e||{})return(t=this.createGraphics()).polygon=this.getPolygonGraphics(e),t.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",!1),this._graphicsLayer.entities.add(t)},createBoxGraphics:function(e){var t;if(e=e||{})return(t=this.createGraphics()).position=e.position,t.name=e.name||"box_graphic",t.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(t)},createModelGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).model=this.getModelGraphics(e),t.position=e.position,this._graphicsLayer.entities.add(t)},craeteCorridorGraphics:function(r){if(r&&r.positions){let{positions:e,height:t,width:i,material:n,...o}=r;r=this.createGraphics();return r.corridor={positions:e,height:void 0===t?6:t,width:void 0===i?15:i,...o,material:n||new a.Scene.WarnLinkMaterialProperty({freely:"cross",color:a.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}},craeteDynamicPolyLineGraphics:function(e){var t;if(e&&e.positions)return(t=this.createGraphics()).polyline={show:!0,positions:[],material:e.material||a.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)},t.polyline.positions=new a.CallbackProperty(function(){return e.positions},!1),this._graphicsLayer.entities.add(t)},craeteDynamicCylinderGraphics:function(e){var i,n,t={};if(e&&e.cylinder)return i=e.entity,e=e.cylinder,t.cylinder=(n=this).getCylinderGraphics(e),t.position=new a.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime),e=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=a.Math.toDegrees(e.latitude),e=a.Math.toDegrees(e.longitude);return a.Cartesian3.fromDegrees(e,t,0)},!1),t.cylinder.length=new a.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime);return 2*n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e).height},!1),t},createFadeCylinderGraphics:function(e){var t;if((e=e||{})&&e.position)return(t=this.createGraphics()).position=e.position,e.material=new a.Scene.CircleFadeMaterialProperty({color:e.color||a.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),t.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(t)},craeteRotateCylinderGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).cylinder={HeightReference:a.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new a.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:!0,repeat:{x:1,y:-1}}),slices:e.slices||128},t.position=e.position,this.setGraphicsRotate({entity:t,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(t)},craeteDynamicBlinkCircleGraphics:function(e){var t,i,n;if(e&&e.position)return t=this.createGraphics(),i=e.alp||1,n=this._objHasOwnProperty(e,"flog",!0),t.position=e.position,t.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new a.ColorMaterialProperty(new a.CallbackProperty(function(){return n?(i-=.05)<=0&&(n=!1):1<=(i+=.05)&&(n=!0),a.Color.RED.withAlpha(i)},!1))},this._graphicsLayer.entities.add(t)},craeteDynamicCricleGraphics:function(i){if(i&&i.center){var n=this.createGraphics(),o=this,r=i.center,s=i.radius||800,l=i.rotateAmount||.05,c=0,h=i.height||1,u=i.scale||null,d=i.scale2||null,i=i.material||new a.ImageMaterialProperty({image:i.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:!0});n.position=new a.CallbackProperty(function(){return o.transformWGS84ToCartesian(r)},!1),n.orientation=new a.CallbackProperty(function(){return a.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(r),new a.HeadingPitchRoll(a.Math.toRadians(0),a.Math.toRadians(0),a.Math.toRadians(0)))},!1);let e=s,t=!1;return n.ellipse={material:i,height:h,semiMajorAxis:new a.CallbackProperty(function(){return s},!1),semiMinorAxis:new a.CallbackProperty(function(){return s},!1),stRotation:new a.CallbackProperty(function(){return 0<l&&360<=(c+=l)&&(c=0),u&&((t=u<=s||s<=e?!t:t)?s+=2:s-=2),d&&(s<=d?s+=2:s=e),c},!1)},this._graphicsLayer.entities.add(n)}},craeteDynamicShadeWallGraphics:function(e){var t,i,n,o,r;if(e&&e.positions)return t=e.alp||1,i=e.num||20,n=e.color||a.Color.RED,o=e.speed||.003,(r=this.createGraphics()).wall={positions:e.positions,material:new a.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:!0,color:new a.CallbackProperty(function(){return i%2==0?t-=o:t+=o,(t<=.1||1<=t)&&i++,n.withAlpha(t)},!1)})},this._graphicsLayer.entities.add(r)},createCustomDefBillboardGraphics:function(t){if(t&&t.position){var i=this,n=document.createElement("img");n.src=t.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";n.onload=function(){t.image=n;var e=i._graphicsLayer.entities.add({position:t.position,billboard:{image:function(e){var t,i;if(e.image)return(t=document.createElement("canvas")).width=e.width||150,t.height=e.height||80,(i=t.getContext("2d")).drawImage(e.image,0,0),e=e.text,i.font="15px bold 宋体",i.fillStyle="#f4fff0",i.fillText(e,55,36),t}(t),scaleByDistance:new a.NearFarScalar(150,.7,15e6,.5),verticalOrigin:a.VerticalOrigin.BOTTOM,pixelOffset:t.b_pixelOffset||new a.Cartesian2(80,-35),width:140,height:100,scale:t.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});"function"==typeof t.callback&&t.callback(e)}}},craeteRotatePlaneGraphics:function(e){var t,i,n,o;if(e&&e.center&&e.positions)return t=this.createGraphics(),i=0,n=e.positions,o=n[0],t.position=new a.CallbackProperty(function(){return 0==i?(o=n[0],i+=1):i<n.length-1?(o=n[i],i+=1):i==n.length-1&&(o=n[i],i=0),o},!1),t.plane={plane:new a.Plane(a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(200,150),material:new a.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(t)},createVideoPlaneGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).position=e.position,t.plane={plane:new a.Plane(e.normal||a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(200,150),material:new a.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(t)},createGifBillboardGraphics:function(t){var i,n,o,r,s,l,c;if(e&&t&&t.position)return n=t.url,o=0,r=n,s=i=[],(l=document.createElement("img")).src=r,l.setAttribute("rel:animated_src",r),l.setAttribute("rel:auto_play","0"),document.body.appendChild(l),c=new e({gif:l}),new Promise(e=>{c.load(()=>{for(let e=1;e<=c.get_length();e++)c.move_to(e),s.push(c.get_canvas().toDataURL());e(s)})}),this._graphicsLayer.entities.add({position:t.position,billboard:{verticalOrigin:a.VerticalOrigin.BASELINE,image:new a.CallbackProperty(function(){return i.length?(o<6*(i.length-1)?o++:o=0,i[Math.floor(o/6)]):n},!1),scale:.2}})},setGraphicsRotate:function(e){var t,i,n,o;e&&e.entity&&e.rotateAmount&&(t=e.entity,i=e.rotateAmount,n=e.position,o=this,n.heading=0,n.pitch=0,n.roll=0,t.position=new a.CallbackProperty(function(){return o.transformWGS84ToCartesian(n)},!1),t.orientation=new a.CallbackProperty(function(){return 0<i&&(n.heading+=i,360===n.heading)&&(n.heading=0),a.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(n),new a.HeadingPitchRoll(a.Math.toRadians(n.heading),a.Math.toRadians(n.pitch),a.Math.toRadians(n.roll)))},!1))},setGraphicsFloat:function(e){if(e&&e.entity&&e.maxHeiht)try{var t=e.entity,n=e.minHeiht||5,o=e.maxHeiht||100,r=e.cartesians,s=e.speed||.06,l=this,c=n,h=!1;r.length?t.positions=new a.CallbackProperty(function(){var e,t=l.transformCartesianArrayToWGS84Array(r);for(e in t){var i=t[e];(h=o<=n||n<=c?!h:h)?n+=s:n-=s,i.alt=n}return l.transformWGS84ArrayToCartesianArray(t)},!1):t.position=new a.CallbackProperty(function(){var e=l.transformCartesianToWGS84(r);return(h=o<=n||n<=c?!h:h)?n+=s:n-=s,e.alt=n,l.transformWGS84ToCartesian(e)},!1)}catch(e){console.log(e)}},createCanvasGraphics:function(o){o&&o.positions&&(this._graphicsLayer.entities.add({rectangle:{coordinates:o.positions,material:new a.ImageMaterialProperty({image:new a.CallbackProperty(function(){var e=0,t=document.createElement("canvas"),i=t.getContext("2d"),n=new Image;if(n.src=o.img||"../../images/ysCesium/logo.png",i.clearRect(0,0,o.cwidth,o.cheight),!(e<=o.cwidth))return e=0,e+=3,t;i.drawImage(n,e,0)},!1),transparent:!0})}}),"function"==typeof o.callback)&&o.callback()},createFanShape:function({viewer:e,longitude:t,latitude:i,alt:n,custMaterial:o,speed:r=0,direction:s="+"}){var l,c,h;if(e)return l=this.createGraphics(),c=0,h=this._calcPoints(t,i,n,c),l.wall={positions:new a.CallbackProperty(()=>a.Cartesian3.fromDegreesArrayHeights(h),!1),material:o||a.Color.AQUAMARINE.withAlpha(.5)},e.clock.onTick.addEventListener(()=>{0<r&&(c+=r,h=this._calcPoints(t,i,n,s+c))}),this._graphicsLayer.entities.add(l)},_computeCirclularFlight(t,i,n,o,r,s){var l=[],c=(l.push(t),l.push(i),l.push(0),a.Cartesian3.distance(a.Cartesian3.fromDegrees(t,i),a.Cartesian3.fromDegrees(n,o)));for(let e=r;e<=r+s;e++){var h=c*Math.sin(e*Math.PI/180),u=Math.cos(e*Math.PI/180),d=(o-i)*u+i;l.push((n-t)*u+t),l.push(d),l.push(h)}return l},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,_calcPoints(e,t,i,n){var o=a.Transforms.eastNorthUpToFixedFrame(a.Cartesian3.fromDegrees(e,t)),r=i*Math.cos(n*Math.PI/180),i=i*Math.sin(n*Math.PI/180),n=a.Cartesian3.fromElements(r,i,0),r=a.Matrix4.multiplyByPoint(o,n,new a.Cartesian3),i=a.Cartographic.fromCartesian(r),o=a.Math.toDegrees(i.longitude),n=a.Math.toDegrees(i.latitude);return this._computeCirclularFlight(e,t,o,n,0,90)}};let l=null;function c(e,t,i){e&&(l=t,this._installMaterial())}function h(){}c.prototype={_installMaterial:function(){this._installWaveCircleMaterial(),this._installCircleFadeMaterial(),this._installCityLineMaterial(),this._installWarnMaterial(),this._installFlowMaterial(),this._installPolylineTrailLinkMaterial()},addMaterialLineGraphics:function(e){var t;if(this._viewer&&e&&e.image)return(t=this.createGraphics()).polyline={positions:e.positions,material:new l.PolylineCustomMaterialProperty({color:e.color||l.Color.RED,duration:e.duration||500}),width:e.width},this._viewer.entities.add(t)},getCustomMaterialLine:function(e){if(this._viewer&&e&&e.image)return this._initPolylineCustomMaterialProperty(e)},_initPolylineCustomMaterialProperty(i){if(i){var e=l.Color,t=l.defaultValue,n=l.defined,o=Object.defineProperties,r=l.Event,a=l.createPropertyDescriptor,s=l.Property,c=l.Material,h=e.WHITE,u=i.MaterialType||"wallType"+parseInt(1e3*Math.random());const d=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||l.Color.BLUE,this.duration=e.duration||1e3,this._time=void 0};return o(d.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),d.prototype.getType=function(){return u},d.prototype.getValue=function(e,t){return(t=n(t)?t:{}).color=s.getValueOrClonedDefault(this._color,e,h,t.color),t.image=i.image,void 0===this._time&&(this._time=e.secondsOfDay),t.time=1e3*(e.secondsOfDay-this._time)/this.duration,t},d.prototype.equals=function(e){return this===e||e instanceof d&&s.equals(this._color,e._color)},c._materialCache.addMaterial(u,{fabric:{type:u,uniforms:{color:i.color||new l.Color(1,0,0,.5),image:i.image,time:i.time||0},source:this._getDynamicLineShader({get:!0})},translucent:function(){return!0}}),new d(i)}},addMaterialWallGraphics:function(e){var t;if(this._viewer&&e&&e.image)return(t=this.createGraphics()).wall={positions:e.positions,material:this.getCustomMaterialWall(e),width:e.width},this._viewer.entities.add(t)},getCustomMaterialWall:function(e){if(this._viewer&&e&&e.image)return this._initWallCustomMaterialProperty(e)},_initWallCustomMaterialProperty(i){var n=l.Color,t=l.defaultValue,o=l.defined,e=Object.defineProperties,r=l.Event,a=l.createPropertyDescriptor,s=l.Property,c=l.Material,h=i.MaterialType||"wallType"+parseInt(1e3*Math.random());function u(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||n.BLUE,this.duration=e.duration||3e3,this._time=(new Date).getTime()}return e(u.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),u.prototype.getType=function(){return h},u.prototype.getValue=function(e,t){return(t=o(t)?t:{}).color=s.getValueOrClonedDefault(this._color,e,n.WHITE,t.color),t.image=i.image,t.time=((new Date).getTime()-this._time)%this.duration/this.duration,t},u.prototype.equals=function(e){return this===e||e instanceof u&&s.equals(this._color,e._color)},c._materialCache.addMaterial(h,{fabric:{type:h,uniforms:{color:new n(1,0,0,.5),image:i.image,time:0},source:this._getDirectionWallShader({get:!0,count:i.count,freely:i.freely,direction:i.direction})},translucent:function(){return!0}}),new u(i)},_installWaveCircleMaterial:function(){var t=l.Color,i=l.defaultValue,e=Object.defineProperties,n=l.Event,o=l.Property,r=l.Material;function a(e){e=e||{},this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this._duration=void 0,this._durationSubscription=void 0,this.color=i(e.color,t.fromBytes(0,255,255,255)),this.duration=i(e.duration,45),this.count=Math.max(i(e.count,2),1),this.gradient=i(e.gradient,.1),this.gradient<0?this.gradient=0:1<this.gradient&&(this.gradient=1)}e(a.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),a.prototype.getType=function(){return r.CircleWaveType},a.prototype.getValue=function(e,t){return(t=t||{}).color=o.getValueOrUndefined(this._color,e),t.duration=this._duration,t.count=this.count,t.gradient=this.gradient,t},a.prototype.equals=function(e){return this===e||e instanceof a&&l.Property.equals(this._color,e._color)},e(a.prototype,{color:l.createPropertyDescriptor("color"),duration:l.createPropertyDescriptor("duration")}),l.Scene.CircleWaveMaterialProperty=a,r.CircleWaveType="CircleWave",r._materialCache.addMaterial(r.CircleWaveType,{fabric:{type:r.CircleWaveType,uniforms:{color:new t(1,0,0,.7),duration:45,count:1,gradient:.1},source:this._getDynamicCircleShader({get:!0})},translucent:function(){return!0}})},_installCircleFadeMaterial:function(){var e=l.Color,t=l.defaultValue,i=Object.defineProperties,n=l.Event,o=l.Property,r=l.Material,a=new e(0,0,0,0);function s(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=t(e.color,a),this._duration=e.duration||1e3,this._time=void 0}i(s.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),s.prototype.getType=function(){return r.CircleFadeMaterialType},s.prototype.getValue=function(e,t){return(t=t||{}).color=o.getValueOrClonedDefault(this._color,e,a,t.color),void 0===this._time&&(this._time=(new Date).getTime()),t.time=((new Date).getTime()-this._time)/this._duration,t},s.prototype.equals=function(e){return this===e||e instanceof s&&l.Property.equals(this._color,e._color)},i(s.prototype,{color:l.createPropertyDescriptor("color")}),l.Scene.CircleFadeMaterialProperty=s,r.CircleFadeMaterialType="CircleFadeMaterial",r._materialCache.addMaterial(r.CircleFadeMaterialType,{fabric:{type:r.CircleFadeMaterialType,uniforms:{color:new e(1,0,0,1),time:1},source:this._getCircleFadeShader({get:!0})},translucent:function(){return!0}})},_installCityLineMaterial:function(){var e=l.Color,t=l.defaultValue,i=l.defined,n=Object.defineProperties,o=l.Event,r=l.createPropertyDescriptor,a=l.Property,s=l.Material,c=e.WHITE;function h(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||l.Color.BLUE,this.duration=e.duration||1e3,this._time=void 0,this._img=e.imgUrl||s.PolylineCityLinkImage}n(h.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:r("color")}),h.prototype.getType=function(){return s.PolylineCityLinkType},h.prototype.getValue=function(e,t){return(t=i(t)?t:{}).color=a.getValueOrClonedDefault(this._color,e,c,t.color),t.image=this._img,void 0===this._time&&(this._time=e.secondsOfDay),t.time=1e3*(e.secondsOfDay-this._time)/this.duration,t},h.prototype.equals=function(e){return this===e||e instanceof h&&a.equals(this._color,e._color)},l.Scene.PolylineCityLinkMaterialProperty=h,s.PolylineCityLinkType="PolylineCityLink",s.PolylineCityLinkImage=this.getDfSt(["material","PolylineCityLinkMaterialProperty"])||"static/data/images/Textures/meteor_01.png",s._materialCache.addMaterial(s.PolylineCityLinkType,{fabric:{type:s.PolylineCityLinkType,uniforms:{color:new e(1,0,0,1),image:s.PolylineCityLinkImage,time:0},source:this._getDynamicLightLineShader({get:!0})},translucent:function(){return!0}})},_installWarnMaterial:function(){var i=l.Color,t=l.defaultValue,n=l.defined,e=Object.defineProperties,o=l.Event,r=l.createPropertyDescriptor,a=l.Property,s=l.Material;function c(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||i.BLUE,this.duration=e.duration||3e3,this._time=(new Date).getTime()}e(c.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),c.prototype.getType=function(){return s.WarnLinkType},c.prototype.getValue=function(e,t){return(t=n(t)?t:{}).color=a.getValueOrClonedDefault(this._color,e,i.WHITE,t.color),t.image=s.WarnLinkImage,t.time=((new Date).getTime()-this._time)%this.duration/this.duration,t},c.prototype.equals=function(e){return this===e||e instanceof c&&a.equals(this._color,e._color)},e(c.prototype,{color:r("color")}),l.Scene.WarnLinkMaterialProperty=c,s.WarnLinkType="WarnWallLinkType",s.WarnLinkImage=this.getDfSt(["material","WarnLinkMaterialProperty"])||"static/data/images/Textures/jsx2.png",s._materialCache.addMaterial(s.WarnLinkType,{fabric:{type:s.WarnLinkType,uniforms:{color:new i(1,0,0,.5),image:s.WarnLinkImage,time:0},source:this._getDirectionWallShader({get:!0,count:10,freely:"cross",direction:"-"})},translucent:function(){return!0}})},_installFlowMaterial:function(){var t=l.Color,i=l.defaultValue,e=Object.defineProperties,n=l.Event,o=l.createPropertyDescriptor,r=l.Property,a=l.Material;function s(e){e=i(e,i.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||t.fromBytes(0,255,255,255),this._duration=void 0,this._durationSubscription=void 0,this.duration=i(e.duration,45)}e(s.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),s.prototype.getType=function(){return a.PolylineFlowType},s.prototype.getValue=function(e,t){return(t=t||{}).color=r.getValueOrClonedDefault(this._color,e,l.Color.WHITE,t.color),t.duration=this._duration,t},s.prototype.equals=function(e){return this===e||e instanceof s&&r.equals(this._color,e._color)},e(s.prototype,{color:o("color"),duration:o("duration")}),l.Scene.PolylineFlowMaterialProperty=s,a.PolylineFlowType="PolylineFlow",a._materialCache.addMaterial(a.PolylineFlowType,{fabric:{type:a.PolylineFlowType,uniforms:{color:new t(1,1,2,.7),duration:45},source:this._getFlowLineShader({get:!0})},translucent:function(){return!0}})},_installPolylineTrailLinkMaterial:function(){var e=l.Color,t=l.defaultValue,i=Object.defineProperties,n=l.createPropertyDescriptor,o=l.Event,r=l.Property,a=l.Material,s=this.getDfSt(["primitive","WaterPrimitive"]);function c(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this.color=e.color||l.Color.WHITE,this.image=e.image||s,this._colorSubscription=void 0,this.duration=e.duration||3e3,this._time=(new Date).getTime(),this.speed=e.speed,this.isTranslucent=function(){return!0}}i(c.prototype,{isConstant:{get:function(){return!1},configurable:!0},definitionChanged:{get:function(){return this._definitionChanged},configurable:!0},color:n("color"),duration:n("duration")}),c.prototype.getType=function(){return a.PolylineTrailLinkType},c.prototype.getValue=function(e,t){return(t=l.defined(t)?t:{}).color=r.getValueOrClonedDefault(this._color,e,this.color,t.color),t.image=a.PolylineTrailLinkImage,t.time=((new Date).getTime()-this._time)%this.duration/this.duration*this.speed,t},c.prototype.equals=function(e){return this===e||e instanceof c&&r.equals(this._color,e._color)},a.PolylineTrailLinkSource="\n uniform vec4 color;\n uniform float time;\n uniform sampler2D image;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n return material;\n }",l.Scene.PolylineTrailLinkMaterial=c,a.PolylineTrailLinkType="PolylineTrailLinkMaterial",a.PolylineTrailLinkImage=this.image||s||"static/data/images/Textures/river.png",a._materialCache.addMaterial(a.PolylineTrailLinkType,{fabric:{type:a.PolylineTrailLinkType,uniforms:{color:new e(1,1,1,1),image:a.PolylineTrailLinkImage,time:-20},source:a.PolylineTrailLinkSource},translucent:function(){return!0}})}},h.prototype={_getFlowLineShader:function(){return"uniform vec4 color;\n uniform float duration;\n \n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t =fract(czm_frameNumber / duration);\n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s);\n alpha += 0.1;\n vec4 fragColor;\n fragColor.rgb = (color.rgb) / 0.5;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = fragColor.rgb;\n material.alpha = alpha;\n material.emission = fragColor.rgb;\n return material;\n }\n "},_getDynamicLineShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n if(texture(image, vec2(0.0, 0.0)).a == 1.0){\n discard;\n }else{\n material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;\n }\n \n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n \n return material;\n }\n "},_getDynamicLightLineShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n vec4 colorImage = texture(image, vec2(fract(1.0 *st.s - 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;\n material.emission = fragColor.rgb;\n \n return material;\n }\n "},_getDirectionWallShader:function(e){var t;if(e&&e.get)return t="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n ","vertical"==e.freely?t+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.t "+e.direction+" time), fract(st.s)));\n ":t+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.s "+e.direction+" time), fract(st.t)));\n ",t+"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;\n material.emission = fragColor.rgb;\n \n return material;\n }\n "},_getCircleFadeShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n \n {\n \n czm_material material = czm_getDefaultMaterial(materialInput);\n \n material.diffuse = 1.5 * color.rgb;\n \n vec2 st = materialInput.st;\n \n float dis = distance(st, vec2(0.5, 0.5));\n \n float per = fract(time);\n \n if(dis > per * 0.5){\n \n //material.alpha = 0.0;\n \n discard;\n \n }else {\n \n material.alpha = color.a * dis / per / 2.0;\n \n }\n \n return material;\n \n }"},_getDynamicCircleShader:function(e){if(e&&e.get)return"uniform vec4 color;\n uniform float duration;\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 vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber / duration);\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;\n for (int i = 0; i <= 10; 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 } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl, gradient);\n }\n }\n }\n }\n return material;\n }\n "},_getRadarScanShader:function(e){if(e&&e.get)return"uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform vec3 u_scanLineNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\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 \n bool isPointOnLineRight(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){\n vec3 v01 = testPt - ptOnLine;\n normalize(v01);\n vec3 temp = cross(v01, lineNormal);\n float d = dot(temp, u_scanPlaneNormalEC);\n return d > 0.5;\n }\n \n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point -planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\n \n float distancePointToLine(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){\n vec3 tempPt = pointProjectOnPlane(lineNormal, ptOnLine, testPt);\n return length(tempPt - ptOnLine);\n }\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 void main(){\n out_FragColor = texture(colorTexture, v_textureCoordinates);\n float depth = getDepth( texture(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n float twou_radius = u_radius * 2.0;\n if(dis < u_radius){\n float f0 = 1.0 -abs(u_radius - dis) / u_radius;\n f0 = pow(f0, 64.0);\n vec3 lineEndPt = vec3(u_scanCenterEC.xyz) + u_scanLineNormalEC * u_radius;\n float f = 0.0;\n if(isPointOnLineRight(u_scanCenterEC.xyz, u_scanLineNormalEC.xyz, prjOnPlane.xyz)){\n float dis1= length(prjOnPlane.xyz - lineEndPt);\n f = abs(twou_radius -dis1) / twou_radius;\n f = pow(f, float("+e.width+"));\n }\n if(float("+e.border+") > 0.0){\n out_FragColor = mix(out_FragColor, u_scanColor, f + f0);\n } else {\n out_FragColor = mix(out_FragColor, u_scanColor, f);\n }\n }\n }\n "},_getCircleScanShader:function(e){if(e&&e.get)return"uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\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 \n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point - planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\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 void main(){\n out_FragColor = texture(colorTexture, v_textureCoordinates);\n float depth = getDepth(texture(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n if(dis < u_radius){\n float f = 1.0 - abs(u_radius - dis) / u_radius;\n f = pow(f, float("+e.border+"));\n out_FragColor = mix(out_FragColor, u_scanColor, f);\n }\n }\n "}};let u={},d=void 0;function p(e,t,i){e&&(this._viewer=e,u=t,d=i,this._drawLayer=new u.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer),this.myname="BASE",this._installBaiduImageryProvider(),this._installGooGleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox())}p.prototype={createGraphics:function(){return new u.Entity},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,getDfSt(e){if(d)return e=e.reduce((e,t)=>(e||d)[t],void 0),d.baseService+e},setOneSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})},setTwoSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})},setThreeSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})},setOneGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})},setTwoGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})},setThreeGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})},setDarkEffect:function(e){return e=e||{},this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"darkEffect",fragmentShader:"uniform sampler2D colorTexture;\nin vec2 v_textureCoordinates;\nuniform float scale;\nuniform vec3 offset;\nvoid main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n out_FragColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);\n}\n",uniforms:{scale:1,offset:function(){return e.offset||new u.Cartesian3(.1,.2,.3)}}}))},setBlurBloom:function(e){if(this._viewer&&e)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"blur_x_direction",fragmentShader:"uniform float height;\nuniform float width;\nuniform sampler2D colorTexture1;\n\nin vec2 v_textureCoordinates;\n\nconst int SAMPLES = 9;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nfloat wr = float(1.0 / width);\nfloat hr = float(1.0 / height);\nvec4 result = vec4(0.0);\nint count = 0;\nfor(int i = -SAMPLES; i <= SAMPLES; ++i){\nfor(int j = -SAMPLES; j <= SAMPLES; ++j){\nvec2 offset = vec2(float(i) * wr, float(j) * hr);\nresult += texture(colorTexture1, st + offset);\n}\n}\nresult = result / float(count);\nout_FragColor = result;\n}\n",uniforms:{width:e.width,height:e.height,colorTexture1:"Bright"}}))},setRainEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"rainEffect",fragmentShader:"uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n \n float hash(float x){\n return fract(sin(x*23.3)*13.13);\n }\n \n void main(){\n float time = czm_frameNumber / 60.0;\n vec2 resolution = czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 c=vec3(.6,.7,.8);\n float a=-.4;\n float si=sin(a),co=cos(a);\n uv*=mat2(co,-si,si,co);\n uv*=length(uv+vec2(0,4.9))*.3+1.;\n float v=1.-sin(hash(floor(uv.x*100.))*2.);\n float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n c*=v*b;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);\n }\n "}))},setSnowEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"snowEffect",fragmentShader:"uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n float snow(vec2 uv,float scale){\n float time = czm_frameNumber / 60.0;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));\n if(w<.1)return 0.;\n uv+=time/scale;\n uv.y+=time*2./scale;\n uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;\n vec2 s=floor(uv),f=fract(uv),p;\n float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;\n d=length(p);\n k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*0.01);\n return k*w;\n }\n \n void main(){\n vec2 resolution = czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n float c = 0.0;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);\n \n }\n "}))},setFogEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({fragmentShader:"float getDistance(sampler2D depthTexture, vec2 texCoords) \n{ \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 interpolateByDistance(vec4 nearFarScalar, float distance) \n{ \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{ \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{ \n float distance = getDistance(depthTexture, v_textureCoordinates); \n vec4 sceneColor = texture(colorTexture, v_textureCoordinates); \n float blendAmount = interpolateByDistance(fogByDistance, distance); \n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount); \n out_FragColor = alphaBlend(finalFogColor, sceneColor); \n} \n",uniforms:{fogByDistance:new u.Cartesian4(10,0,200,.3),fogColor:u.Color.AZURE}}))},setDefSceneConfig:function(){this._viewer&&(this._viewer.scene.sun.show=!1,this._viewer.scene.moon.show=!1,this._viewer.scene.fxaa=!0,this._viewer.scene.globe.depthTestAgainstTerrain=!0,this._viewer.scene.undergroundMode=!1,this._viewer.scene.terrainProvider.isCreateSkirt=!1,this._viewer.scene.skyAtmosphere.show=!1,this._viewer.scene.globe.showGroundAtmosphere=!1,this._viewer.scene.globe.enableLighting=!0,this._viewer.scene.fog.enabled=!1,this._viewer.cesiumWidget.creditContainer.style.display="none")},setBloomLightScene:function(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=!0,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=!1,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=!1)},removePostProcessStage:function(e){e&&(Array.isArray(e)?e.forEach(e=>{this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e)}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e))},setView:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new u.Cartesian3(0,e.distance,window.opt.distance),e.position=u.Cartesian3.add(e.position,t,new u.Cartesian3)),this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:u.Math.toRadians(90),pitch:u.Math.toRadians(90),roll:u.Math.toRadians(0)}}))},flyTo:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new u.Cartesian3(0,e.distance,0),e.position=u.Cartesian3.add(e.position,t,new u.Cartesian3)),this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:u.Math.toRadians(90),pitch:u.Math.toRadians(90),roll:u.Math.toRadians(0)},easingFunction:e.easingFunction||u.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback}))},transformCartesianToWGS84:function(e){if(this._viewer&&e)return e=u.Ellipsoid.WGS84.cartesianToCartographic(e),{lng:u.Math.toDegrees(e.longitude),lat:u.Math.toDegrees(e.latitude),alt:e.height}},transformWGS84ArrayToCartesianArray:function(e,t){var i;if(this._viewer&&e)return i=this,e?e.map(function(e){return i.transformWGS84ToCartesian(e,t)}):[]},transformWGS84ToCartesian:function(e,t){if(this._viewer)return e?u.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=t||e.alt,u.Ellipsoid.WGS84):u.Cartesian3.ZERO},transformCartesianArrayToWGS84Array:function(e){var t;if(this._viewer)return t=this,e?e.map(function(e){return t.transformCartesianToWGS84(e)}):[]},transformWGS84ToCartographic:function(e){return e?u.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):u.Cartographic.ZERO},lnglatArrayToCartesians:function(t){if(!t||t.length<1)return[];var i=[];for(let e=0;e<t.length;e++){var n=u.Cartesian3.fromDegrees(Number(t[e][0]),Number(t[e][1]),Number(t[e][2]||0));i.push(n)}return i},setCameraEotateHeading(l){if(l){let t=this._viewer,i=u.Cartesian3.fromDegrees(l.lng,l.lat,l.height),n=u.Math.toRadians(-30),o=12,r=5e3,e=u.JulianDate.fromDate(new Date),a=(t.clock.startTime=e.clone(),t.clock.currentTime=e.clone(),t.clock.clockRange=u.ClockRange.CLAMPED,t.clock.clockStep=u.ClockStep.SYSTEM_CLOCK,t.camera.heading),s=function(){var e=u.JulianDate.secondsDifference(t.clock.currentTime,t.clock.startTime),e=u.Math.toRadians(e*o)+a;t.scene.camera.setView({destination:i,orientation:{heading:e,pitch:n}}),t.scene.camera.moveBackward(r),0<=u.JulianDate.compare(t.clock.currentTime,t.clock.stopTime)&&t.clock.onTick.removeEventListener(s)};t.clock.onTick.addEventListener(s)}},getCatesian3FromPX:function(e){if(this._viewer&&e){var t,i,n=this._viewer.scene.pick(e),o=null,r=!1,a=!1;if((r=n instanceof u.Cesium3DTileFeature?!0:r)&&(o=this._viewer.scene.pickPosition(e))&&((t=u.Cartographic.fromCartesian(o)).height<0&&(t.height=0),s=u.Math.toDegrees(t.longitude),i=u.Math.toDegrees(t.latitude),t=t.height,o=this.transformWGS84ToCartesian({lng:s,lat:i,alt:t})),!n){var s=this._viewer.scene.camera.getPickRay(e);if(!s)return null;o=this._viewer.scene.globe.pick(s,this._viewer.scene),a=!0}return(o=r||a?o:this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid))?(i=this.transformCartesianToWGS84(o)).alt<0?this.transformWGS84ToCartesian(i,.1):o:!1}},getCameraPosition:function(){if(this._viewer){var e,t,i,n,o,r,a,s,l,c,h,d=this._viewer.scene.camera.pickEllipsoid(new u.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(d)return e=180*(d=u.Ellipsoid.WGS84.cartesianToCartographic(d)).longitude/Math.PI,d=180*d.latitude/Math.PI,n=this._viewer.camera._direction,t=u.Math.toDegrees(n.x),i=u.Math.toDegrees(n.y),n=u.Math.toDegrees(n.z),o=this._viewer.camera.positionCartographic.height,r=u.Math.toDegrees(this._viewer.camera.heading),a=u.Math.toDegrees(this._viewer.camera.pitch),s=u.Math.toDegrees(this._viewer.camera.roll),c=(l=this._viewer.camera.computeViewRectangle()).west/Math.PI*180,h=l.north/Math.PI*180,c=(c+l.east/Math.PI*180)/2,h=(h+l.south/Math.PI*180)/2,{lon:e,lat:d,height:o,heading:r,pitch:a,roll:s,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:c,y:h},direction:new u.Cartesian3(t,i,n)}}},getHandlerClickPosition(e){var t,i,n;if(this._viewer)return n=this._viewer.scene,t=this._viewer,i=n.camera.pickEllipsoid(e.position,n.globe.elliposid),t={heading:u.Math.toDegrees(t.camera.heading),pitch:u.Math.toDegrees(t.camera.pitch),roll:u.Math.toDegrees(t.camera.roll),position:t.camera.position},(i=u.Cartographic.fromCartesian(i)).height<0&&(i.height=0),i={alt:i.height,lat:u.Math.toDegrees(i.latitude),lon:u.Math.toDegrees(i.longitude)},n=n.pickPosition(e.position),{wgs84Coor:i,graphicCoor:{height:(e=u.Cartographic.fromCartesian(n)).height,latitude:u.Math.toDegrees(e.latitude),longitude:u.Math.toDegrees(e.longitude)},cameraPosition:t}},updateCameraState:function(e){this._viewer.scene._screenSpaceCameraController.enableRotate=e,this._viewer.scene._screenSpaceCameraController.enableTranslate=e,this._viewer.scene._screenSpaceCameraController.enableZoom=e,this._viewer.scene._screenSpaceCameraController.enableTilt=e,this._viewer.scene._screenSpaceCameraController.enableLook=e},bindHandelEvent:function({leftClick:t,mouseMove:i,doubleClick:n,leftDown:o,mouseWheel:r,leftUp:a}){var s;this._viewer&&(s=new u.ScreenSpaceEventHandler(this._viewer.canvas),t&&s.setInputAction(function(e){t(e,s)},u.ScreenSpaceEventType.LEFT_CLICK),i&&s.setInputAction(function(e){i(e,s)},u.ScreenSpaceEventType.MOUSE_MOVE),n&&s.setInputAction(function(e){n(e,s)},u.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),o&&s.setInputAction(function(e){o(e,s)},u.ScreenSpaceEventType.LEFT_DOWN),r&&s.setInputAction(function(e){r(e,s)},u.ScreenSpaceEventType.WHEEL),a)&&s.setInputAction(function(e){a(e,s)},u.ScreenSpaceEventType.LEFT_UP)},getHandelPosition:function(t){var i,n;this._viewer&&(i=new u.ScreenSpaceEventHandler(this._viewer.scene.canvas),n=this,i.setInputAction(function(e){e=n._viewer.scene.camera.pickEllipsoid(e.endPosition,n._viewer.scene.globe.ellipsoid);"function"==typeof t&&t(n.transformCartesianToWGS84(e),i)},u.ScreenSpaceEventType.MOUSE_MOVE))},saveSceneImages:function(){var e,t;this._viewer&&(t=this._viewer.scene.canvas.toDataURL("image/png").replace("image/png","image/octet-stream"),e=document.createElement("a"),t=function(e){for(var e=e.split(","),t=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,o=new Uint8Array(n);n--;)o[n]=i.charCodeAt(n);return new Blob([o],{type:t})}(t),t=URL.createObjectURL(t),e.download="scene.png",e.href=t,e.click())},_installAmapImageryProvider:function(){u.Scene.AmapImageryProvider=function(e){return e.url="img"===e.style?"https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}":"http://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}",e.subdomains||(e.subdomains=["01","02","03","04"]),new u.UrlTemplateImageryProvider(e)}},_installTdtImageryProvider:function(){u.Scene.TdtImageryProvider=function(e){return new u.WebMapTileServiceImageryProvider({url:"https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}".replace(/\{layer\}/g,e.style||"vec").replace(/\{key\}/g,e.key||""),layer:e.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}},_installTencentImageryProvider:function(){u.Scene.TencentImageryProvider=function(e){return"img"===e.layer?(e.url||(e.url="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229"),e.subdomains||(e.subdomains=["0","1","2"]),e.customTags={sx:function(e,t,i,n){return t>>4},sy:function(e,t,i,n){return(1<<n)-i>>4}}):e.url||(e.url="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1"),new u.UrlTemplateImageryProvider(e)}},_installGooGleImageryProvider:function(){u.Scene.GoogleImageryProvider=function(e){return e.url="img"===e.style?"http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali":"ter"===e.style?"http://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile":"http://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",e.subdomains||(e.subdomains=["1","2","3","4","5"]),new u.UrlTemplateImageryProvider(e)}},_installBaiduImageryProvider:function(){var t="http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function e(e){t=e.url||t,this._url=t,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new u.WebMercatorTilingScheme({rectangleSouthwestInMeters:new u.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new u.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=e.style||"normal",this._ready=!0}Object.defineProperties(e.prototype,{url:{get:function(){return this._url}},token:{get:function(){return this._token}},tileWidth:{get:function(){if(this.ready)return this._tileWidth;throw new u.DeveloperError("tileWidth must not be called before the imagery provider is ready.")}},tileHeight:{get:function(){if(this.ready)return this._tileHeight;throw new u.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},maximumLevel:{get:function(){if(this.ready)return this._tileHeight;throw new u.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},minimumLevel:{get:function(){if(this.ready)return 0;throw new u.DeveloperError("minimumLevel must not be called before the imagery provider is ready.")}},tilingScheme:{get:function(){if(this.ready)return this._tilingScheme;throw new u.DeveloperError("tilingScheme must not be called before the imagery provider is ready.")}},rectangle:{get:function(){if(this.ready)return this._rectangle;throw new u.DeveloperError("rectangle must not be called before the imagery provider is ready.")}},ready:{get:function(){return!!this._url}},credit:{get:function(){return this._credit}},readyPromise:{get:function(){return this._readyPromise.promise}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),e.prototype.getTileCredits=function(e,t,i){},e.prototype.requestImage=function(e,t,i){var n,o,r,a;if(this.ready)return e=e,t=t,i=i,o=(n=this)._style,r=n._url+"&x={x}&y={y}&z={z}&customid={style}",a=n._tilingScheme.getNumberOfXTilesAtLevel(i),n=n._tilingScheme.getNumberOfYTilesAtLevel(i),r=r.replace("{x}",e-a/2).replace("{y}",n/2-t-1).replace("{z}",i).replace("{style}",o),u.ImageryProvider.loadImage(this,r);throw new u.DeveloperError("requestImage must not be called before the imagery provider is ready.")},u.Scene.BaiduImageryProvider=e},_installGroundSkyBox:function(){var a=u.BoxGeometry,s=u.Cartesian3,t=u.defaultValue,l=u.defined,i=u.destroyObject,c=u.DeveloperError,h=u.GeometryPipeline,e=u.Matrix3,d=u.Matrix4,p=u.Transforms,m=u.VertexFormat,g=u.BufferUsage,f=u.CubeMap,n=u.DrawCommand,y=u.loadCubeMap,v=u.RenderState,w=u.VertexArray,_=u.BlendingState,C=u.SceneMode,P=u.ShaderProgram,x=u.ShaderSource;function o(e){this.sources=e.sources,this._sources=void 0,this.show=t(e.show,!0),this._command=new n({modelMatrix:d.clone(d.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}l(d.getRotation)||(d.getRotation=d.getMatrix3);var b=new e;o.prototype.update=function(e,t){var i=this;if(this.show&&(e.mode===C.SCENE3D||e.mode===C.MORPHING)&&e.passes.render){var n=e.context;if(this._sources!==this.sources){this._sources=this.sources;var o=this.sources;if(!(l(o.positiveX)&&l(o.negativeX)&&l(o.positiveY)&&l(o.negativeY)&&l(o.positiveZ)&&l(o.negativeZ)))throw new c("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof o.positiveX!=typeof o.negativeX||typeof o.positiveX!=typeof o.positiveY||typeof o.positiveX!=typeof o.negativeY||typeof o.positiveX!=typeof o.positiveZ||typeof o.positiveX!=typeof o.negativeZ)throw new c("this.sources properties must all be the same type.");"string"==typeof o.positiveX?y(n,this._sources).then(function(e){i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:n,source:o}))}var r=this._command;if(r.modelMatrix=p.eastNorthUpToFixedFrame(e.camera._positionWC),l(r.vertexArray)||(r.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return d.getRotation(r.modelMatrix,b)}},o=a.createGeometry(a.fromDimensions({dimensions:new s(2,2,2),vertexFormat:m.POSITION_ONLY})),e=this._attributeLocations=h.createAttributeLocations(o),r.vertexArray=w.fromGeometry({context:n,geometry:o,attributeLocations:e,bufferUsage:g._DRAW}),r.renderState=v.fromCache({blending:_.ALPHA_BLEND})),l(r.shaderProgram)&&this._useHdr===t||(o=new x({defines:[t?"HDR":""],sources:["uniform samplerCube u_cubeMap;\n in vec3 v_texCoord;\n void main()\n {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n "]}),r.shaderProgram=P.fromCache({context:n,vertexShaderSource:"in vec3 position;\n out vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\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.xyz;\n }\n ",fragmentShaderSource:o,attributeLocations:this._attributeLocations}),this._useHdr=t),l(this._cubeMap))return r}},o.prototype.isDestroyed=function(){return!1},o.prototype.destroy=function(){var 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(),i(this)},u.Scene.GroundSkyBox=o},removeHandlerByName(e=[]){e.forEach(e=>{this._viewer.screenSpaceEventHandler.removeInputAction(u.ScreenSpaceEventType[e])})}};let m={};function f(e,t){e&&(this._viewer=e,m=t)}f.prototype={splitCartesians3:function(e){for(var t=[],i=0;i<e.length;i+=3){var n=new m.Cartesian3(e[i],e[i+1],e[i+2]);t.push(n)}return t.push(t[0]),t},getLinkedPointList:function(e,t,i,n){if(this._viewer){var o=[],r=m.Cartographic.fromCartesian(e),a=m.Cartographic.fromCartesian(t),s=180*r.longitude/Math.PI,r=180*r.latitude/Math.PI,l=180*a.longitude/Math.PI,a=180*a.latitude/Math.PI,c=Math.sqrt((s-l)*(s-l)+(r-a)*(r-a))*i,h=m.Cartesian3.clone(e),u=m.Cartesian3.clone(t),d=m.Cartesian3.distance(h,m.Cartesian3.ZERO),p=m.Cartesian3.distance(u,m.Cartesian3.ZERO);if(m.Cartesian3.normalize(h,h),m.Cartesian3.normalize(u,u),0!=m.Cartesian3.distance(h,u)){var g=m.Cartesian3.angleBetween(h,u);o.push(e);for(var f=1;f<n-1;f++){var y=+f/(n-1),v=1-y,w=Math.sin(v*g)/Math.sin(g),_=Math.sin(y*g)/Math.sin(g),w=m.Cartesian3.multiplyByScalar(h,w,new m.Cartesian3),_=m.Cartesian3.multiplyByScalar(u,_,new m.Cartesian3),w=m.Cartesian3.add(w,_,new m.Cartesian3),_=y*Math.PI,v=d*v+p*y+Math.sin(_)*c,w=m.Cartesian3.multiplyByScalar(w,v,w);o.push(w)}o.push(t)}return o}},getPositionsAngle:function(e){var t,i,n,o;if(e)return i=e.position1,o=e.position2,n=m.Transforms.eastNorthUpToFixedFrame(i),n=m.Matrix4.inverse(n,new m.Matrix4),i=m.Matrix4.multiplyByPoint(n,i,new m.Cartesian3),n=m.Matrix4.multiplyByPoint(n,o,new m.Cartesian3),"pitch"===e.type?t=Math.atan2(n.z-i.z,n.x-i.x):"heading "===e.type&&(t=Math.atan2(n.y-i.y,n.x-i.x)),(o=t*(180/Math.PI))<0&&(o+=360),o},getPositionsArea:function(n){let e=0;if(n){let t=0,i=m.Ellipsoid.WGS84;n.push(n[0]);for(let e=1;e<n.length;e++){var o=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e-1])),r=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e]));t+=o.x*r.y-r.x*o.y}e=Math.abs(t).toFixed(2)}return e},getPolygonArea:function(i){if(this._viewer){let r=Math.PI/180,a=180/Math.PI;const l=function(e,t){var i=e.lat*r,e=e.lon*r,n=t.lat*r,t=t.lon*r;let o=-Math.atan2(Math.sin(e-t)*Math.cos(n),Math.cos(i)*Math.sin(n)-Math.sin(i)*Math.cos(n)*Math.cos(e-t));return o<0&&(o+=2*Math.PI),o*=a};let t=0;for(let e=0;e<i.length-2;e++){var n=(e+1)%i.length,o=(e+2)%i.length,s=function(e,t,i){let n=l(t,e)-l(t,i);return n<0&&(n+=360),n}(i[e],i[n],i[o]);t+=this.getPointDistance(this.transformWGS84ToCartesian(i[e]),this.transformWGS84ToCartesian(i[n]))*this.getPointDistance(this.transformWGS84ToCartesian(i[n]),this.transformWGS84ToCartesian(i[o]))*Math.abs(Math.sin(s))}return t.toFixed(2)}},getPointDistance:function(e,t){var i;if(this._viewer)return e=m.Cartographic.fromCartesian(e),t=m.Cartographic.fromCartesian(t),(i=new m.EllipsoidGeodesic).setEndPoints(e,t),i=i.surfaceDistance,Math.sqrt(Math.pow(i,2)+Math.pow(t.height-e.height,2))},getPositionDistance:function(t){let i=0;for(let e=0;e<t.length-1;e++){var n=this.transformWGS84ToCartographic(t[e]),o=this.transformWGS84ToCartographic(t[e+1]),r=new m.EllipsoidGeodesic,r=(r.setEndPoints(n,o),r.surfaceDistance),r=Math.sqrt(Math.pow(r,2)+Math.pow(o.height-n.height,2));i+=r}return i.toFixed(3)},getIntersectObj:function(e,t,i=[],n=!1){if(this._viewer)return t=m.Cartesian3.normalize(m.Cartesian3.subtract(t,e,new m.Cartesian3),new m.Cartesian3),e=new m.Ray(e,t),t=[],n?t=this._viewer.scene.drillPickFromRay(e,10,i):(n=this._viewer.scene.pickFromRay(e,i),m.defined(n)&&(t=[n])),t},getPointOnEllipsoid:function(e,t,i,n,o,r,a,s,l,c){var h,u,d,p;if(this._viewer)return h=new m.Cartesian3,u=new m.Cartesian3,d=new m.Quaternion,p=new m.Matrix3,t=e+t,m.Cartesian3.multiplyByScalar(n,Math.cos(t),h),m.Cartesian3.multiplyByScalar(i,Math.sin(t),u),m.Cartesian3.add(h,u,h),n=Math.cos(e),n*=n,i=Math.sin(e),i*=i,t=r/Math.sqrt(a*n+o*i)/s,m.Quaternion.fromAxisAngle(h,t,d),m.Matrix3.fromQuaternion(d,p),m.Matrix3.multiplyByVector(p,l,c),m.Cartesian3.normalize(c,c),m.Cartesian3.multiplyByScalar(c,s,c),c},raisePositionsToHeight:function(e,t,i){if(this._viewer){for(var n=new m.Cartesian3,o=new m.Cartesian3,r=new m.Cartesian3,a=new m.Cartesian3,s=t.ellipsoid,l=t.height,c=t.extrudedHeight,t=i?e.length/3*2:e.length/3,h=new Float64Array(3*t),u=e.length,d=i?u:0,p=0;p<u;p+=3){var g=p+1,f=p+2,y=m.Cartesian3.fromArray(e,p,n),v=(s.scaleToGeodeticSurface(y,y),m.Cartesian3.clone(y,o)),w=s.geodeticSurfaceNormal(y,a),_=m.Cartesian3.multiplyByScalar(w,l,r);m.Cartesian3.add(y,_,y),i&&(m.Cartesian3.multiplyByScalar(w,c,_),m.Cartesian3.add(v,_,v),h[p+d]=v.x,h[g+d]=v.y,h[f+d]=v.z),h[p]=y.x,h[g]=y.y,h[f]=y.z}return h}},computeEllipseEdgePositions:function(e){if(this._viewer){for(var t=new m.Cartesian3,i=new m.Cartesian3,n=new m.Cartesian3,o=new m.Cartesian3,r=e.semiMinorAxis,a=e.semiMajorAxis,s=e.rotation,l=e.center,e=e.granularity&&"number"==typeof e.granularity?e.granularity:Math.PI/180,c=((e=e>Math.PI/12?Math.PI/12:e)<Math.PI/180&&(e=Math.PI/180),r*r),h=a*a,u=a*r,d=m.Cartesian3.magnitude(l),p=m.Cartesian3.normalize(l,t),g=m.Cartesian3.cross(m.Cartesian3.UNIT_Z,l,i),g=m.Cartesian3.normalize(g,g),f=m.Cartesian3.cross(p,g,n),y=Math.ceil(2*m.Math.PI/e),v=e,w=o,_=0,C=[],P=0;P<y;P++)w=this.getPointOnEllipsoid(P*v,s,f,g,c,u,h,d,p,w),C[_++]=w.x,C[_++]=w.y,C[_++]=w.z;a={};return a.numPts=y,a.outerPositions=C,a}},computeSectorEdgePositions:function(e){if(this._viewer){for(var t=new m.Cartesian3,i=new m.Cartesian3,n=new m.Cartesian3,o=new m.Cartesian3,r=e.semiMinorAxis,a=e.semiMajorAxis,s=e.rotation,l=e.angle||2*Math.PI,c=e.center,e=e.granularity&&"number"==typeof e.granularity?e.granularity:Math.PI/180,h=((e=e>Math.PI/12?Math.PI/12:e)<Math.PI/180&&(e=Math.PI/180),r*r),u=a*a,d=a*r,p=m.Cartesian3.magnitude(c),g=m.Cartesian3.normalize(c,t),f=m.Cartesian3.cross(m.Cartesian3.UNIT_Z,c,i),f=m.Cartesian3.normalize(f,f),y=m.Cartesian3.cross(g,f,n),v=Math.ceil(l/e),w=e,_=o,C=0,P=[],x=0;x<v;x++)_=this.getPointOnEllipsoid(x*w,s,y,f,h,d,u,p,g,_),P[C++]=_.x,P[C++]=_.y,P[C++]=_.z;a={};return a.numPts=v,a.outerPositions=P,a}},computeLonlatPointsTerrainData:function(e,t){if(this._viewer){for(var i=[],n=0;n<e.length;n++)i.push(m.Cartographic.fromDegrees(e[n].lon,e[n].lat));this._viewer.scene.clampToHeightMostDetailed(i).then(function(e){t(e)})}},computeCartographicPointsTerrainData:function(e,o){if(this._viewer&&!(e.length<=0)){for(var t=[],i=0;i<e.length;i++)t.push(m.Cartesian3.fromRadians(e[i].longitude,e[i].latitude,e[i].height));var n=this._viewer.scene.clampToHeightMostDetailed(t),r=this;n.then(function(e){for(var t=[],i=r._viewer.scene.globe.ellipsoid,n=0;n<e.length;n++)t.push(i.cartesianToCartographic(e[n]));o(t)}).catch(function(e){console.log(e)})}},_checkLonDegree:function(e){return!(180<e||e<-180)},_checkLatDegree:function(e){return!(90<e||e<-90)},computeInterpolateLineLonlat:function(e,t){if(!e||!t)return null;if(e.lon||!e.lat||!t.lon||!t.lat)return null;if(!(this._checkLonDegree(e.lon)&&this._checkLonDegree(t.lon)&&this._checkLatDegree(e.lat)&&this._checkLatDegree(t.lat)))return null;var i=[],n=(i.push([e.lon,e.lat]),Math.sqrt(Math.pow(t.lon-e.lon,2)+Math.pow(t.lat-e.lat,2)));if(n<=1e-5)i.push([t.lon,t.lat]);else for(var o=n/1e-5,r=(t.lon-e.lon)/o,a=(t.lat-e.lat)/o,s=0;s<o;s++){var l=e.lon+(s+1)*r,c=e.lat+(s+1)*a;i.push([l,c])}return i},computeInterpolateLineCartographic:function(e,t,i){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var n=[],o=(n.push(new m.Cartographic(e.longitude,e.latitude)),Math.sqrt(Math.pow(t.longitude-e.longitude,2)+Math.pow(t.latitude-e.latitude,2))),i=i&&"number"==typeof i?i:1e-5*Math.PI/180;if(o<=i)n.push(new m.Cartographic(t.longitude,t.latitude));else{for(var r=o/i,a=(t.longitude-e.longitude)/r,s=(t.latitude-e.latitude)/r,l=0;l<r;l++){var c=e.longitude+(l+1)*a,h=e.latitude+(l+1)*s;n.push(new m.Cartographic(c,h))}n.push(new m.Cartographic(t.longitude,t.latitude,t.height))}return n},computeInterpolateLineHeightCartographic:function(e,t){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var i=[],n=(i.push(new m.Cartographic(e.longitude,e.latitude,e.height)),Math.sqrt(Math.pow(t.longitude-e.longitude,2)+Math.pow(t.latitude-e.latitude,2)));if(!(n<=1e-5*Math.PI/180))for(var o=n/1e-5*Math.PI/180,r=(t.longitude-e.longitude)/o,a=(t.latitude-e.latitude)/o,s=(t.height-e.height)/o,l=0;l<o;l++){var c=e.longitude+(l+1)*r,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;i.push(new m.Cartographic(c,h,u))}return i.push(new m.Cartographic(t.longitude,t.latitude,t.height)),i},computeInterpolate2IndexLineHeightCartographic:function(e,t,i,n){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var o=[];o.push(new m.Cartographic(e.longitude,e.latitude,e.height));for(var r=(t.longitude-e.longitude)/i,a=(t.latitude-e.latitude)/i,s=(t.height-e.height)/i,l=0;l<n;l++){var c=e.longitude+(l+1)*r,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;o.push(new m.Cartographic(c,h,u))}return o},computeInterpolateIndexLineHeightCartographic:function(e,t,i,n){var o,r;return e&&t&&e.longitude&&e.latitude&&t.longitude&&t.latitude?(o=(t.longitude-e.longitude)/i,r=(t.latitude-e.latitude)/i,t=(t.height-e.height)/i,i=e.longitude+n*o,o=e.latitude+n*r,r=e.height+n*t,new m.Cartographic(i,o,r)):null}};let g=null;function v(e,t,i){e&&(this._viewer=e,g=t,this._installPrimitives())}v.prototype={_installPrimitives:function(){this._installProbingPrimitive(),this._installTexturePrimitive(),this._installWaterPrimitive(),this._installPointsPrimitive(),this._installShadowPrimitive(),this._installArrowPolylinePrimitive(),this._installXyzAxisPrimitive(),this._installTetrahedronPrimitive()},_installTetrahedronPrimitive:function(){try{function e(e){this.show=!0,this._command=void 0,this._enuMatrix=void 0,this._scaleMatrix=void 0,this._localPosition=e.position,this._createCommand=T,this._angle=0,this._distance=b(e.distance,1),this._setInterval=void 0,this._viewer=S,this._speed=b(e.speed,1),this._color=b(e.color,new t(1,1,0,.8)),this._scale=b(e.scale,new i(10,10,15)),this._texture=void 0,this._imageUrl=M,this._modelMatrix=R(this),this._height=k(this),D(this)}var i=g.Cartesian3,n=g.ComponentDatatype,a=g.PrimitiveType,o=g.BoundingSphere,r=g.GeometryAttribute,s=g.GeometryPipeline,l=g.Geometry,c=g.defined,h=g.RenderState,u=g.ShaderSource,d=g.ShaderProgram,p=g.DrawCommand,m=g.Pass,f=g.Appearance,y=g.BufferUsage,t=g.Color,v=g.VertexArray,w=(g.buildModuleUrl,g.Matrix4),_=g.Matrix3,C=g.Texture,P=g.Resource,x=g.Transforms,b=g.defaultValue,S=this._viewer,M=this.getDfSt(["primitive","TetrahedronPrimitive"])||"static/data/images/Textures/fence.png";e.prototype.update=function(e){this.show&&(c(this._command)||(this._command=this._createCommand(e.context,this)),c(this._command))&&e.commandList.push(this._command)},e.prototype.isDestroyed=function(){return!1},e.prototype.destroy=function(){return c(this._command)&&(this._command.shaderProgram=this._command.shaderProgram&&this._command.shaderProgram.destroy()),destroyObject(this)},e.prototype.startAnimate=function(){let t=this;this._setInterval=setInterval(function(){t._angle=t._angle+.01,0<Math.sin(t._angle)?t._height=.01:t._height=-.01;var e=new g.Cartesian3(0,0,t._height),e=(w.multiplyByTranslation(t._modelMatrix,e,t._modelMatrix),w.fromRotationTranslation(_.fromRotationZ(g.Math.toRadians(t._speed))));w.multiply(t._modelMatrix,e,t._modelMatrix)},5)},e.prototype.closeAnimate=function(){clearInterval(this._setInterval)};const T=function(e,t){var i=I(),n=L(),o=f.getDefaultRenderState(!1,!0,void 0),o=h.fromCache(o),i=new u({sources:[i]}),n=new u({sources:[n]}),r={color:function(){return t._color},myImage:function(){return c(t._texture)?t._texture:t._viewer.scene.context.defaultTexture}},i=d.fromCache({context:e,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:{position:0,textureCoordinates:1}});return new p({vertexArray:A(e),primitiveType:a.TRIANGLES,renderState:o,shaderProgram:i,uniformMap:r,owner:this,pass:m.TRANSLUCENT,modelMatrix:t._modelMatrix})},A=function(e){var t=E(),t=new l({attributes:{position:new r({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.positions}),textureCoordinates:new r({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:t.sts})},indices:t.indices,primitiveType:a.TRIANGLES,boundingSphere:o.fromVertices(t.positions)}),t=s.computeNormal(t);return v.fromGeometry({context:e,geometry:t,attributeLocations:{position:0,textureCoordinates:1},bufferUsage:y.STATIC_DRAW})},E=function(){var e=new Float64Array(15),t=(e[0]=0,e[1]=1,e[2]=0,e[3]=-1,e[4]=0,e[5]=0,e[6]=0,e[7]=-1,e[8]=0,e[9]=1,e[10]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=-1,new Uint16Array(18));return t[0]=4,t[1]=2,t[2]=3,t[3]=4,t[4]=3,t[5]=0,t[6]=4,t[7]=0,t[8]=1,t[9]=4,t[10]=1,t[11]=2,t[12]=1,t[13]=2,t[14]=3,t[15]=1,t[16]=3,t[17]=0,{indices:t,positions:e,sts:new Float32Array([0,0,1,0,1,1,0,1,.5,.5])}},I=function(){return"#version 300 es\n in vec3 position;\n in vec3 normal;\n in vec2 st;\n in float batchId;\n out vec3 v_positionEC;\n out vec3 v_normalEC;\n out vec2 v_st;\n out vec4 v_pickColor;\n void main()\n {\n v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz;\n v_normalEC = czm_normal * normal;\n v_st = st;\n // v_pickColor = czm_batchTable_pickColor(batchId);\n gl_Position = czm_modelViewProjection * vec4(position, 1.0);\n }\n "},L=function(){return"#version 300 es\n precision mediump float;\n in vec3 v_positionEC;\n in vec3 v_normalEC;\n in vec2 v_st;\n uniform vec4 color;\n in vec4 v_pickColor;\n uniform sampler2D myImage;\n void main()\n {\n vec3 positionToEyeEC = -v_positionEC;\n vec3 normalEC = normalize(v_normalEC);\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n vec2 st = materialInput.st;\n czm_material material = czm_getDefaultMaterial(materialInput);\n float dt_a11 = fract(czm_frameNumber / 100.0) * 3.14159265 * 2.0;\n float dt_a12 = sin(dt_a11);\n float vst=smoothstep(0.7, 1.0, dt_a12)+0.4;\n vec4 colorImage = texture(myImage, vec2(fract(st.s- czm_frameNumber*0.003), st.t));\n material.alpha =mix(0.1,1.0,clamp((1.0-st.t) * color.a,0.0,1.0)) +(1.0-sign(st.t-czm_frameNumber*0.001))*0.2*(1.0-colorImage.r)+0.4;\n material.diffuse =(1.0-colorImage.a)*vec3(1.0,2.0,1.0)+colorImage.rgb*vec3(1.0,2.0,1.0);\n #ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n #endif\n }\n "},D=function(i){P.createIfNeeded(i._imageUrl).fetchImage().then(function(e){var t=i._viewer.scene.context,t=c(e.internalFormat)?new C({context:t,pixelFormat:e.internalFormat,width:e.naturalWidth,height:e.naturalHeight,source:{arrayBufferView:e.bufferView}}):new C({context:t,source:e});i._texture=t})},R=function(e){var t=x.eastNorthUpToFixedFrame(e._localPosition),i=w.fromScale(e._scale),n=w.multiply(t,i,new w);return e._scaleMatrix=i,e._enuMatrix=t,n},k=function(e){var t=i.fromElements(0,0,e._distance,new g.Cartesian3),t=g.Matrix4.multiplyByPoint(e._enuMatrix,t,new i),t=w.multiplyByPoint(e._viewer.scene.camera._viewMatrix,t,new i),e=w.multiplyByPoint(e._viewer.scene.camera.frustum.projectionMatrix,t,new i);return i.normalize(e,new i).z};g.Scene.TetrahedronPrimitive=e}catch(i){console.log(i)}},_installXyzAxisPrimitive:function(){function e(e){this._viewer=e.viewer,this._model=e.model,this._matrix=e.matrix,this._radius=void 0,this._layer=new g.CustomDataSource("xyz-axis"),this._viewer.dataSources.add(this._layer),this._handler=new g.ScreenSpaceEventHandler(this._viewer.scene.canvas),this._xyzState=!1,this._xyzPid=void 0,this._builds()}e.prototype={_builds(){this._createAxisXYZ(),this._bindHandler()},remove(){this._layer._primitives.removeAll(),this._handler.distory()},_createAxisXYZ:function(){this._model.readyPromise.then(e=>{var t=g.Matrix4.getTranslation(e.modelMatrix,new g.Cartesian3),e=e.boundingSphere,i=e.radius,n=new g.ArrowPolylinePrimitive({id:"axisZ",color:g.Color.RED,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),o=new g.ArrowPolylinePrimitive({id:"axisX",color:g.Color.GREEN,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),t=new g.ArrowPolylinePrimitive({id:"axisY",color:g.Color.BLUE,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),i=g.Matrix3.fromRotationY(g.Math.toRadians(90)),i=(this._rotationX=g.Matrix4.fromRotationTranslation(i),g.Matrix4.multiply(o.geometryInstances[0].modelMatrix,this._rotationX,o.geometryInstances[0].modelMatrix),g.Matrix4.multiply(o.geometryInstances[1].modelMatrix,this._rotationX,o.geometryInstances[1].modelMatrix),g.Matrix3.fromRotationX(g.Math.toRadians(90)));this._rotationY=g.Matrix4.fromRotationTranslation(i),g.Matrix4.multiply(t.geometryInstances[0].modelMatrix,this._rotationY,t.geometryInstances[0].modelMatrix),g.Matrix4.multiply(t.geometryInstances[1].modelMatrix,this._rotationY,t.geometryInstances[1].modelMatrix),this._layer._primitives.add(n),this._layer._primitives.add(o),this._layer._primitives.add(t),this._radius=e.radius,this._createAxisSphere()})},_createAxisSphere:function(){var t=[];for(let e=0;e<=360;e+=3){const i=Math.sin(g.Math.toRadians(e)),n=Math.cos(g.Math.toRadians(e)),o=this._radius*n,r=this._radius*i;t.push(new g.Cartesian3(o,r,0))}var e=this._createAxisSpheres("axisSphereZ",t,this._matrix,g.Color.RED);this._layer._primitives.add(e);const i=this._createAxisSpheres("axisSphereY",t,this._matrix,g.Color.GREEN),n=(this._layer._primitives.add(i),g.Matrix4.multiply(i.geometryInstances.modelMatrix,this._rotationY,i.geometryInstances.modelMatrix),this._createAxisSpheres("axisSphereX",t,this._matrix,g.Color.BLUE));this._layer._primitives.add(n),g.Matrix4.multiply(n.geometryInstances.modelMatrix,this._rotationX,n.geometryInstances.modelMatrix)},_createAxisSpheres:function(e,t,i,n){t=new g.PolylineGeometry({positions:t,width:10}),t=new g.GeometryInstance({geometry:t,id:e,attributes:{color:g.ColorGeometryInstanceAttribute.fromColor(n)}});return new g.Primitive({geometryInstances:t,appearance:new g.PolylineColorAppearance({translucent:!1}),modelMatrix:i})},_updateAxis(i){if(this._layer){var n=this._layer._primitives._primitives;for(let e=1,t=n.length;e<t;e++){var o=n[e],r=g.Matrix4.fromTranslation(new g.Cartesian3(i.x,i.y,i.z));g.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=g.Matrix4.fromTranslation(new g.Cartesian3(i.x,i.y,i.z));g.Matrix4.multiply(this._model.modelMatrix,e,this._model.modelMatrix)},_updateAxisSphere(i){if(this._layer){var n=this._layer._primitives._primitives;for(let e=1,t=n.length;e<t;e++){var o=n[e],r=g.Matrix4.fromRotationTranslation(i);g.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=g.Matrix4.fromRotationTranslation(i);g.Matrix4.multiply(this._model.modelMatrix,e,this._model.modelMatrix)},_bindHandler(){this._handler.setInputAction(e=>{if(this._xyzState&&this._xyzPid)switch(this._xyzPid){case"axisX-line":this._updateAxis({x:-1,y:0,z:0});break;case"axisY-line":this._updateAxis({x:0,y:-1,z:0});break;case"axisZ-line":this._updateAxis({x:0,y:0,z:-1});break;case"axisX-arrow":this._updateAxis({x:1,y:0,z:0});break;case"axisY-arrow":this._updateAxis({x:0,y:1,z:0});break;case"axisZ-arrow":this._updateAxis({x:0,y:0,z:1});break;case"axisSphereX":this._updateAxisSphere(g.Matrix3.fromRotationX(g.Math.toRadians(1)));break;case"axisSphereY":this._updateAxisSphere(g.Matrix3.fromRotationY(g.Math.toRadians(1)));break;case"axisSphereZ":this._updateAxisSphere(g.Matrix3.fromRotationZ(g.Math.toRadians(1)))}},g.ScreenSpaceEventType.MOUSE_MOVE),this._handler.setInputAction(e=>{e=viewer.scene.pick(e.position);e&&e.id&&(this._xyzPid=e.id,this._xyzState=!0)},g.ScreenSpaceEventType.LEFT_DOWN),this._handler.setInputAction(()=>{this._xyzState=!1,this._xyzPid=void 0},g.ScreenSpaceEventType.LEFT_UP)}},g.Scene.XyzAxisPrimitive=e},_installArrowPolylinePrimitive:function(){g.Scene.ArrowPolylinePrimitive=function(e={}){this._color=e.color||g.Color.RED,this._width=e.width||3,this._headWidth=e.headWidth||2*this._width,this._length=e.length||300,this._headLength=e.headLength||10,this._inverse=e.inverse||!1,this.position=e.position;var e=e.id,t=g.CylinderGeometry.createGeometry(new g.CylinderGeometry({length:this._length,topRadius:this._width,bottomRadius:this._width})),i=g.CylinderGeometry.createGeometry(new g.CylinderGeometry({length:this._headLength,topRadius:0,bottomRadius:this._headWidth}));let n=(this._length+this._headLength)/2;this._inverse&&(n=-n);var o=i,r=[0,0,n],a=new g.Cartesian3;r.length?(a.x=r[0],a.y=r[1],a.z=r[2]):g.Cartesian3.clone(r,a);for(let e=0;e<o.attributes.position.values.length;e+=3)o.attributes.position.values[e]+=a.x,o.attributes.position.values[e+1]+=a.y,o.attributes.position.values[e+2]+=a.z;return new g.Primitive({modelMatrix:g.Transforms.eastNorthUpToFixedFrame(this.position),geometryInstances:[new g.GeometryInstance({id:e+"-line",geometry:t}),new g.GeometryInstance({id:e+"-arrow",geometry:i})],appearance:new g.MaterialAppearance({material:g.Material.fromType("Color",{color:this._color})})})}},_installShadowPrimitive:function(){function e(e){var t=(e=g.defaultValue(e,g.defaultValue.EMPTY_OBJECT)).scene;if(!g.defined(t))throw new g.DeveloperError("scene is required.");var i=(this._scene=t)._context;if(!g.defined(i))throw new g.DeveloperError("context is required.");if(!g.defined(e.viewerPosition))throw new g.DeveloperError("this view position is required.");this._viewerPosition=e.viewerPosition,this._positions=void 0,this._indices=void 0,this._drawLineCommand=void 0,this._depthCamera=new g.Camera(t),this._depthCamera.position=this._viewerPosition,this._direction=0,this._pitch=0,this._horizontalFov=g.defaultValue(e.horizontalFov,60),this._verticalFov=g.defaultValue(e.verticalFov,45),this._cameraUpdated=!1,this._targetPoint=this._viewerPosition.clone();t=new g.Cartesian3(0,0,100),e=g.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);g.Matrix4.multiplyByPoint(e,t,this._targetPoint),this._distance=100,this._cameraUpdated=!1,this._modelMatrix=new g.Matrix4,this._shadowMap=new g.ShadowMap({context:i,enabled:!0,lightCamera:this._depthCamera,cascadesEnabled:!1}),this.show=!0,this._invisiblyColor=g.Color.RED,this._visiblyColor=g.Color.GREEN,this._shadowMap.useCustomColor=!0,this.shadowMap._customColor={invisibly:g.Color.RED,visibly:g.Color.GREEN},this._initialize=function(){this._positions=new Float32Array(633),this._indices=new Uint16Array(408);var e=this._indices,t=0;e[t++]=0,e[t++]=1,e[t++]=0,e[t++]=21,e[t++]=0,e[t++]=85,e[t++]=0,e[t++]=105;for(var i=0,n=0;n<5;++n){i++;for(var o=0;o<20;++o)e[t++]=i++,e[t++]=i}i++;for(var r=0;r<20;++r)for(var a=0;a<5;++a)e[t++]=i,e[t++]=5+i++;this._initialized=!0},this._debugLightFrustum=void 0,this._debugShow=!0}Object.defineProperties(e.prototype,{shadowMap:{get:function(){return this._shadowMap}},debugLightFrustum:{get:function(){return this._debugLightFrustum}},debugShow:{get:function(){return this._debugShow},set:function(e){this.shadowMap.debugShow=e,this._debugShow=e}},invisiblyColor:{get:function(){return this._invisiblyColor},set:function(e){this._invisiblyColor=e,this.shadowMap._customColor.invisibly=e}},visiblyColor:{get:function(){return this._visiblyColor},set:function(e){this._visiblyColor=e,this.shadowMap._customColor.visibly=e}},viewerPosition:{get:function(){return this._viewerPosition},set:function(e){this._viewerPosition=e,this._cameraUpdated=!1}},direction:{get:function(){return this._direction},set:function(e){this._direction=e,this._cameraUpdated=!1}},pitch:{get:function(){return this._pitch},set:function(e){this._pitch=e,this._cameraUpdated=!1}},horizontalFov:{get:function(){return this._horizontalFov},set:function(e){this._horizontalFov=e,this._cameraUpdated=!1,this._hintLineUpdated=!1}},verticalFov:{get:function(){return this._verticalFov},set:function(e){this._verticalFov=e,this._cameraUpdated=!1,this._hintLineUpdated=!1}},distance:{get:function(){return this._distance},set:function(e){this._distance=e,this._cameraUpdated=!1}}}),e.prototype.setDebugFrustumEffect=function(t,i){var e,n;this.debugShow&&(e=this.debugLightFrustum._planesPrimitives,n=this.debugLightFrustum._outlinePrimitives,e.forEach(function(e){e.show=t}),n.forEach(function(e){e.show=i}))},e.prototype.update=function(e){var t;this.show&&(this._cameraUpdated||(this._updateCamera(),this.debugShow&&!g.defined(this.debugLightFrustum)&&(this._debugLightFrustum=new g.DebugCameraPrimitive({camera:this._depthCamera,color:g.Color.YELLOW,updateOnChange:!0}),this.setDebugFrustumEffect(!1,!0))),t=e.frustumSplits[1],e.frustumSplits[1]=this._distance,this._debugLightFrustum.update(e),e.frustumSplits[1]=t,e.shadowMaps.push(this.shadowMap))},e.prototype._updateCamera=function(){this._depthCamera.frustum.near=.001*this._distance,this._depthCamera.frustum.far=this._distance,this._depthCamera.frustum.fov=g.Math.toRadians(Math.max(this._horizontalFov,this._verticalFov)),this._depthCamera.frustum.aspectRatio=this._horizontalFov/this._verticalFov,this._depthCamera.setView({destination:this._viewerPosition,orientation:{heading:g.Math.toRadians(this._direction),pitch:g.Math.toRadians(this._pitch)}}),this._modelMatrix=this._depthCamera.inverseViewMatrix,this._cameraUpdated=!0},e.prototype.setPoseByTargetPoint=function(e){this.distance=g.Cartesian3.distance(this._viewerPosition,e);var t=new g.Cartesian3,i=g.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);g.Matrix4.inverse(i,i),g.Matrix4.multiplyByPoint(i,e,t),g.Cartesian3.normalize(t,t),this.direction=g.Math.toDegrees(Math.atan2(t.x,t.y)),this.pitch=g.Math.toDegrees(Math.asin(t.z))},e.prototype._updateHintLine=function(e){var t,i=this._positions,n=g.Math.toRadians(this._horizontalFov),o=g.Math.toRadians(this._verticalFov),r=Math.tan(.5*n),o=Math.tan(.5*o),a=-(r=this._distance*r),o=-(t=this._distance*o),a=new g.Cartesian3(a,o,-this._distance),o=new g.Cartesian3(r,t,0),r=(g.Matrix4.multiplyByPoint(this._modelMatrix,a,a),g.Matrix4.multiplyByPoint(this._modelMatrix,o,o),g.BoundingSphere.fromCornerPoints(a,o));if(e.cullingVolume.computeVisibility(r)!==Intersect.OUTSIDE){this._valid=!0;var s=0;i[s++]=0,i[s++]=0,i[s++]=0;for(var l,c=Math.PI-.5*n,h=n/4,u=0;u<5;++u)for(var d=c+u*h,p=t/(this._distance/Math.cos(d)),m=-(w=Math.atan(p)),f=w/10,y=0;y<21;++y)l=m+y*f,i[s++]=this._distance*Math.cos(l)*Math.sin(d),i[s++]=this._distance*Math.sin(l),i[s++]=this._distance*Math.cos(l)*Math.cos(d);for(var h=n/20,v=0;v<21;++v){d=c+v*h;for(var w,p=t/(this._distance/Math.cos(d)),m=-(w=Math.atan(p)),f=w/2,_=0;_<5;++_)l=m+_*f,i[s++]=this._distance*Math.cos(l)*Math.sin(d),i[s++]=this._distance*Math.sin(l),i[s++]=this._distance*Math.cos(l)*Math.cos(d)}var C,P=e.context,a=g.Buffer.createIndexBuffer({context:P,typedArray:new Uint32Array(this._indices),usage:g.BufferUsage.STATIC_DRAW,indexDatatype:IndexDatatype.UNSIGNED_INT}),o=g.Buffer.createVertexBuffer({context:P,typedArray:g.ComponentDatatype.createTypedArray(g.ComponentDatatype.FLOAT,this._positions),usage:g.BufferUsage.STATIC_DRAW}),n=[],e=(n.push({index:0,vertexBuffer:o,componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1}),new g.VertexArray({context:P,attributes:n,indexBuffer:a}));g.defined(this._drawLineCommand)?(this._drawLineCommand.vertexArray.destroy(),this._drawLineCommand.vertexArray=e,this._drawLineCommand.modelMatrix=this._modelMatrix,this._drawLineCommand.boundingVolume=r):(o=g.ShaderProgram.fromCache({context:P,vertexShaderSource:"in vec3 position;\n uniform mat4 u_modelViewMatrix;\n void main()\n {\n gl_Position = czm_projection* u_modelViewMatrix* vec4(position.xyz,1.0);\n }\n ",fragmentShaderSource:"uniform vec4 u_bgColor;\n void main()\n {\n out_FragColor = u_bgColor;\n }\n "}),n=g.RenderState.fromCache({depthTest:{enabled:!0}}),a={u_bgColor:function(){return C._lineColor},u_modelViewMatrix:function(){return P.uniformState.modelView}},(C=this)._drawLineCommand=new g.DrawCommand({boundingVolume:r,modelMatrix:C._modelMatrix,primitiveType:g.PrimitiveType.LINES,vertexArray:e,shaderProgram:o,castShadows:!1,receiveShadows:!1,uniformMap:a,renderState:n,pass:g.Pass.OPAQUE})),this._hintLineUpdated=!0}else this._valid=!1},g.Scene.ShadowPrimitive=e},_installPointsPrimitive:function(){function e(e){e&&e.viewer&&e.Cartesians&&(this._vertexShader=this.getVSPolylie(),this._fragmentShader=this.getFSPolyline(),this._geometry=null,this._appearance=null,this._viewer=e.viewer,this.build(e))}e.prototype={build:function(e){if(e.Cartesians&&2<=e.Cartesians.length){var t=[],i=[],n=[];if(e.Colors&&e.Colors.length===4*e.Cartesians.length){for(var o=0;o<e.Cartesians.length;o++)t.push(e.Cartesians[o].x),t.push(e.Cartesians[o].y),t.push(e.Cartesians[o].z);i=e.Colors}else for(var r=0;r<e.Cartesians.length;r++)t.push(e.Cartesians[r].x),t.push(e.Cartesians[r].y),t.push(e.Cartesians[r].z),i.push(0),i.push(0),i.push(1),i.push(1);for(var a=0;a<e.Cartesians.length;a++)n.push(a);this.positionArr=new Float64Array(t),this.colorArr=new Float32Array(i),this.indiceArr=new Uint16Array(n)}else{var s=g.Cartesian3.fromDegrees(0,0,-10),l=g.Cartesian3.fromDegrees(0,.001,-10);this.positionArr=new Float64Array([s.x,s.y,s.z,l.x,l.y,l.z]),this.colorArr=new Float32Array([0,0,1,1,0,0,1,1]),this.indiceArr=new Uint16Array([0,1])}this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),this._appearance=this.createAppearence(this._fragmentShader,this._vertexShader),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},getVSPolylie:function(){return"in vec3 position3DHigh; in vec3 position3DLow; in vec4 color; out vec4 v_color; in float batchId; void main() { vec4 p = czm_computePosition(); v_color =color; p = czm_modelViewProjectionRelativeToEye * p; gl_Position = p; gl_PointSize=4.0; } "},getFSPolyline:function(){return"in vec4 v_color; void main() { float d = distance(gl_PointCoord, vec2(0.5,0.5)); if(d < 0.5){ out_FragColor = v_color; }else{ discard; } } "},createAppearence:function(e,t){return new g.Appearance({renderState:{blending:g.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:e,vertexShaderSource:t})},createGeometry:function(e,t,i){return new g.Geometry({attributes:{position:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),color:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:4,values:t})},indices:i,primitiveType:g.PrimitiveType.POINTS,boundingSphere:g.BoundingSphere.fromVertices(e)})},remove:function(){null!=this.primitive&&(this._viewer.scene.primitives.remove(this.primitive),this.primitive=null)},updateCartesianPosition:function(e){if(null!=this.primitive&&(this._viewer.scene.primitives.remove(this.primitive),!(e&&e.length<2))){if(e.length===this.positionArr.length/3){var t=e[0],i=e[1];this.positionArr=new Float64Array([t.x,t.y,t.z,i.x,i.y,i.z]),this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr)}else{for(var n=[],o=[],r=[],a=0;a<e.length;a++)n.push(e[a].x),n.push(e[a].y),n.push(e[a].z),o.push(0),o.push(0),o.push(1),o.push(1);for(var s=0;s<e.length;s++)r.push(s);this.positionArr=new Float64Array(n),this.colorArr=new Float32Array(o),this.indiceArr=new Uint16Array(r),geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),appearance=this.createAppearence(this._fragmentShader,this._vertexShader)}this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}},updateCartesianPositionColor:function(e,t){if(t.length===4*e.length&&null!=this.primitive&&(viewer.scene.primitives.remove(this.primitive),!(e&&e.length<2))){if(e.length===this.positionArr.length/3){var i=e[0],n=e[1];this.positionArr=new Float64Array([i.x,i.y,i.z,n.x,n.y,n.z]),this.colorArr=new Float32Array(t),geometry=CreateGeometry(this.positionArr,this.colorArr,this.indiceArr)}else{for(var o=[],r=[],a=0;a<e.length;a++)o.push(e[a].x),o.push(e[a].y),o.push(e[a].z);for(a=0;a<e.length;a++)r.push(a);this.positionArr=new Float64Array(o),this.colorArr=new Float32Array(t),this.indiceArr=new Uint16Array(r),this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),this._appearance=this.createAppearence(this._fragmentShader,this._vertexShader)}this.primitive=viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}}},g.Scene.PointsPrimitive=e},_installWaterPrimitive:function(){let t=this;function e(e){this._positions=e.positions,this._url=e.img||this.getDfSt(["primitive","WaterPrimitive"])||"static/data/images/Textures/waterNormals.jpg",this._frequency=e.frequency||1e3,this._animationSpeed=e.animationSpeed||.01,this._amplitude=e.amplitude||10,this._extrudedHeight=e.extrudedHeight||0,this._viewer=t._viewer,this._fs=this.getFS()}e.prototype.build=function(){this._geometry=this._createGeometry(),this._appearance=this._createAppearence(),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({allowPicking:!1,geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createAppearence=function(){return new g.EllipsoidSurfaceAppearance({material:new g.Material({fabric:{type:"Water",uniforms:{normalMap:this._url,frequency:this._frequency,animationSpeed:this._animationSpeed,amplitude:this._amplitude}}}),fragmentShaderSource:this._fs})},e.prototype._createGeometry=function(){return new g.PolygonGeometry({polygonHierarchy:new g.PolygonHierarchy(g.Cartesian3.fromDegreesArray(this._positions)),extrudedHeight:this._extrudedHeight,perPositionHeight:!0})},e.prototype.getFS=function(){return"\n precision highp float;\n struct Light {\n vec3 position;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n };\n in vec3 position;\n in vec2 textureCoord;\n\n uniform vec3 viewPos;\n uniform Light light;\n\n uniform sampler2D normalSampler;\n uniform samplerCube skybox;\n uniform float detalX;\n\n void main() {\n\n float z = gl_FragCoord.z / gl_FragCoord.w;\n const float LOG2 = 1.442695;\n float density = 0.005;\n float normalFactor = exp( -density * density * z * z * LOG2 );\n normalFactor = clamp(normalFactor, 0.0, 1.0);\n\n vec4 normalTex1 = texture(normalSampler, vec2(textureCoord.s + detalX/1024.0, textureCoord.t - detalX/1024.0));\n vec3 normalTex2 = texture(normalSampler, vec2(textureCoord.t, textureCoord.s)).rgb;\n vec3 normal1 = normalize(vec3(normalTex1.r * 2.0 - 1.0, normalTex1.b,normalTex1.g*2.0-1.0));\n vec3 normal2 = normalize(vec3(normalTex2.r * 2.0 - 1.0, normalTex2.b,normalTex2.g*2.0-1.0));\n\n vec3 normal = mix(normal1,normal2,0.2);\n\n normal = mix(vec3(0.0,1.0,0.0),normal,0.2);\n\n normal = mix(vec3(0.0,1.0,0.0),normal,normalFactor);\n\n vec3 viewDir = normalize(viewPos - position);\n\n vec3 I = normalize(position - viewPos);\n vec3 R = reflect(I, normal);\n vec3 reflection = texture(skybox, R).rgb;\n\n float ratio = 1.00 / 1.33;\n vec3 Rr = refract(I, normal , ratio);\n vec3 refraction = texture(skybox, Rr).rgb;\n\n float reflectivity = 0.02;\n float theta = max( dot( viewDir, normal ), 0.0 );\n float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 2.0 );\n\n vec3 reflectanceColor = mix( refraction, reflection, reflectance );\n\n out_FragColor = vec4(reflectanceColor,1.0);\n\n }\n "},e.prototype.getVS=function(){return" in vec3 normal;in vec2 st;in float batchId; out vec3 v_normalEC;uniform mat4 u_modelViewMatrix;uniform mat4 u_invWorldViewMatrix;uniform int u_clampToGroud;uniform vec3 u_camPos;uniform vec3 u_scale;out vec3 vToEye;out vec2 vUv;out vec4 vCoord;void main(void){v_normalEC = czm_normal * normal;if (u_clampToGroud == 1){} else {vCoord = gl_Position;}vUv = st;}"},e.prototype.getFS2=function(){return"in vec3 v_positionMC;\n in vec3 v_positionEC;\n in vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n #ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n out_FragColor.a = 0.5;\n #endif\n }\n "},v.prototype.updateDegreesPosition=function(e,t){null==this.primitive||(this._viewer.scene.primitives.remove(this.primitive),e&&e.length<3)||(e=this._createGeometry(e,t||0),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({allowPicking:!1,geometryInstances:new g.GeometryInstance({geometry:e}),appearance:this._appearance,asynchronous:!1})))},g.Scene.WaterPrimitive=e},_installTexturePrimitive:function(){function e(e){this._vertexShader=this.getVS(),this._fragmentShader=this.getFS(),this._materialShader=this.getMS(),this._url=e.url,this._cartesians=e.cartesians,this._id=e.id||""}e.prototype.build=function(){for(var e=[],t=0;t<this._cartesians.length;t++)e.push(this._cartesians[t].x),e.push(this._cartesians[t].y),e.push(this._cartesians[t].z);this._positionArr=new Float32Array(e),this._sts=new Uint8Array([0,0,1,0,1,1,0,1]),this._indiceArr=new Uint16Array([0,1,2,0,2,3]),this._geometry=this._createGeometry(),this._appearance=this._createAppearence(),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry,id:this._id}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createGeometry=function(){var e=new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:this._sts});return new g.Geometry({attributes:{position:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:this._positions}),st:e},indices:this._indices,primitiveType:g.PrimitiveType.TRIANGLES,boundingSphere:g.BoundingSphere.fromVertices(positions)})},e.prototype._createAppearence=function(){return new g.Appearance({material:new g.Material({fabric:{uniforms:{image:this._url},source:this._materialShader}}),aboveGround:!0,faceForward:!0,flat:!0,translucent:!1,renderState:{blending:g.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:this._fragmentShader,vertexShaderSource:this._vertexShader})},e.prototype.getVS=function(){return"in vec3 position3DHigh; in vec3 position3DLow; in vec2 st; in float batchId; out vec2 v_st; void main() { vec4 p = czm_computePosition(); v_st=st; p = czm_modelViewProjectionRelativeToEye * p; gl_Position = p; } "},e.prototype.getFS=function(){return"in vec2 v_st; void main() { czm_materialInput materialInput; czm_material material=czm_getMaterial(materialInput,v_st); vec4 color=vec4(material.diffuse + material.emission,material.alpha); if(color.x==1.0&&color.y==1.0&&color.z==1.0&&color.w==1.0) color=vec4(vec3(0.0,0.0,0.0),0.0); out_FragColor =color; } "},e.prototype.getMS=function(){return"czm_material czm_getMaterial(czm_materialInput materialInput,vec2 v_st) { vec4 color = texture(image, v_st); czm_material material = czm_getDefaultMaterial(materialInput); material.diffuse= color.rgb; material.alpha=color.a; return material; } "},g.Scene.TexturePrimitive=e},_installProbingPrimitive:function(){var t={color:new g.Color(1,0,1,.8),repeat:30,offset:0,thickness:.3,center:g.Cartesian3.fromDegrees(116.39,39.9),length:4e5,bottom:1e3,top:0},i=this._viewer;function e(e){this._viewer=i,this._length=e.length||t.length,this._center=e.center||t.center,this._color=e.color||t.color,this._repeat=e.repeat||t.repeat,this._offset=e.offset||t.offset,this._thickness=e.thickness||t.thickness,this._bottom=e.bottom||t.bottom,this._top=e.top||t.top,this._radar=void 0,this.build()}e.prototype.build=function(){var e=new g.CylinderGeometry({length:this._length,topRadius:this._top,bottomRadius:this._bottom,vertexFormat:g.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat}),e=new g.GeometryInstance({geometry:e,modelMatrix:this.getModelMatrix()}),t=new g.MaterialAppearance({material:this.getMaterial(),faceForward:!1,closed:!0}),i=this;this._radar=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:[e],appearance:t})),this._viewer.scene.preUpdate.addEventListener(function(){var e=i._radar.appearance.material.uniforms.offset;1<(e-=.001)&&(e=0),i._radar.appearance.material.uniforms.offset=e})},e.prototype.getModelMatrix=function(){return g.Matrix4.multiplyByTranslation(g.Transforms.eastNorthUpToFixedFrame(this._center),new g.Cartesian3(0,0,.5*this._length),new g.Matrix4)},e.prototype.updateModelMatrix=function(){},e.prototype.getMaterial=function(){return new g.Material({fabric:{type:"radarPrimitive",uniforms:{color:this._color,repeat:this._repeat,offset:this._offset,thickness:this._thickness},source:"uniform vec4 color; \n uniform float repeat; \n uniform float offset; \n uniform float thickness;\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float sp = 1.0/repeat;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n float m = mod(dis + offset, sp);\n float a = step(sp*(1.0-thickness), m); \n\n material.diffuse = color.rgb;\n material.alpha = a * color.a;\n return material;\n }"},translucent:!1})},e.prototype.remove=function(){this._radar&&this._viewer.scene.primitives.remove(this._radar)},g.Scene.ProbingPrimitive=e}};let y=null;class _{constructor(e,t){y=t,this._viewer=e,this._labelEntity=null,this.$graphics=new s(e,t),this.isInit=!1}initTool(){this.isInit||(this._labelEntity=this._viewer.entities.add({position:y.Cartesian3.fromDegrees(0,0),label:this.$graphics.getLabelGraphics({l_text:"操作提示",l_fillColor:y.Color.CYAN,l_outlineColor:y.Color.BLACK})}),this._labelEntity.show=!1,this.isInit=!0)}setVisible(e){this.isInit&&(this._labelEntity.show=!!e)}showAt(e,t){this.isInit&&e&&t&&(this._labelEntity.show=!0,(e=this._viewer.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid))?(this._labelEntity.position=e,this._labelEntity.show=!0,this._labelEntity.label.text=t):this._labelEntity.show=!1)}showAtCartesian(e,t){this.isInit&&e&&t&&(this._labelEntity.show=!0,this._labelEntity.position=e,this._labelEntity.show=!0,this._labelEntity.label.text=t)}}let w=null,C=null;function P(e,t,i){e&&(w=t,this._drawLayer=new w.CustomDataSource("drawLayer"),s.prototype={...s.prototype,...p.prototype},this.$graphics=new s(e,t),e&&e.dataSources.add(this._drawLayer),this.tooltip=new _(e,t),this.tooltip.initTool())}P.prototype={drawPointGraphics:function(t){var i,n,e,o,r,a;(t=t||{}).style=t.style||{image:this.getDfSt(["drawPointGraphics"])||"static/data/images/file/location4.png",width:35,height:40,clampToGround:!0,scale:1,pixelOffset:new w.Cartesian2(0,-20)},this._viewer&&t&&(e=new w.Entity,o=[],r=this,a=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas),(C=a).setInputAction(function(e){e=r.getCatesian3FromPX(e.position);r.tooltip.showAtCartesian(e,"右键单击结束!"),e&&e.x&&(i=e,o.push(e))},w.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);e&&e.x&&(i=e,(o=[]).push(e)),a.destroy(),a=null,r.tooltip.setVisible(!1),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(o),n)},w.ScreenSpaceEventType.RIGHT_CLICK),e.billboard=t.style,e.position=new w.CallbackProperty(function(){return i},!1),n=this._drawLayer.entities.add(e))},drawLineGraphics:function(t){if(t=t||{},this._viewer&&t){var i,n=[],e=new w.Entity,o=this,r=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);(C=r).setInputAction(function(e){e=o.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&n.push(e.clone()),t.measure&&a(e),2==n.length&&"straightLine"===t.type&&(r.destroy(),r=null,"function"==typeof t.callback)&&t.callback(o.transformCartesianArrayToWGS84Array(n),i),n.push(e))},w.ScreenSpaceEventType.LEFT_CLICK),r.setInputAction(function(e){e=o.getCatesian3FromPX(e.endPosition);o.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.length&&e&&e.x&&(n.pop(),n.push(e))},w.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(function(e){o.tooltip.setVisible(!1),r.destroy(),r=null;e=o.getCatesian3FromPX(e.position);t.measure&&a(e),"function"==typeof t.callback&&t.callback(o.transformCartesianArrayToWGS84Array(n),i)},w.ScreenSpaceEventType.RIGHT_CLICK),e.polyline={width:t.width||5,material:t.material||w.Color.BLUE.withAlpha(.8),clampToGround:t.clampToGround||!1,clampToS3M:t.clampToS3M||!1},e.polyline.positions=new w.CallbackProperty(function(){return n},!1),i=this._drawLayer.entities.add(e);const a=function(e){var t=new w.Entity;t.position=e,t.point={pixelSize:10,outlineColor:w.Color.BLUE,outlineWidth:5},t.label={text:(o.getPositionDistance(o.transformCartesianArrayToWGS84Array(n))/1e3).toFixed(4)+"公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,-80)},o._drawLayer.entities.add(t)}}},drawPolygonGraphics:function(i){i=i||{};const t={width:3,material:w.Color.BLUE.withAlpha(.8),clampToGround:!0};if(i.style?i.style=Object.assign({},t,i.style):i.style=t,this._viewer&&i){var n=[],o=new w.PolygonHierarchy,r=new w.Entity,a=this,s=null,l=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=l;const t=function(){r.polyline=i.style,r.polyline.positions=new w.CallbackProperty(function(){return n},!1),r.polygon={hierarchy:new w.CallbackProperty(function(){return o},!1),material:w.Color.WHITE.withAlpha(.1),clampToGround:a._objHasOwnProperty(i,"clampToGround",!1)},r.clampToS3M=!0,s=a._drawLayer.entities.add(r)};l.setInputAction(function(e){e=a.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&(o.positions.push(e.clone()),n.push(e.clone())),n.push(e.clone()),o.positions.push(e.clone()),s||t())},w.ScreenSpaceEventType.LEFT_CLICK),l.setInputAction(function(e){e=a.getCatesian3FromPX(e.endPosition);a.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.length&&e&&e.x&&(n.pop(),n.push(e),o.positions.pop(),o.positions.push(e))},w.ScreenSpaceEventType.MOUSE_MOVE),l.setInputAction(function(){var e,t;l.destroy(),a.tooltip.setVisible(!1),n.push(n[0]),i.height&&(r.polygon.extrudedHeight=i.height,r.polygon.material=w.Color.BLUE.withAlpha(.5)),i.measure&&(e=n[0],(t=new w.Entity).position=e,t.point={pixelSize:10,outlineColor:w.Color.BLUE,outlineWidth:5},t.label={text:(a.getPositionsArea(a.transformCartesianArrayToWGS84Array(n))/1e6).toFixed(4)+"平方公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,-50)},a._drawLayer.entities.add(t)),"function"==typeof i.callback&&i.callback(a.transformCartesianArrayToWGS84Array(n),s)},w.ScreenSpaceEventType.RIGHT_CLICK)}},drawRectangleGraphics:function(t){var i,n,e,o,r,a;(t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t&&(n=[],e=new w.Entity,o=new w.Rectangle,r=this,a=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas),(C=a).setInputAction(function(e){e=r.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length?n.push(e.clone()):(a.destroy(),n.push(e.clone()),o=w.Rectangle.fromCartesianArray([...n,e],w.Ellipsoid.WGS84),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(n),i)))},w.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);e&&(o=w.Rectangle.fromCartesianArray([...n,e],w.Ellipsoid.WGS84))},w.ScreenSpaceEventType.MOUSE_MOVE),e.rectangle=t.style,t.height&&(e.rectangle.extrudedHeight=t.height),e.rectangle.coordinates=new w.CallbackProperty(function(){return o},!1),i=this._drawLayer.entities.add(e))},drawCircleGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t){var i,n=void 0,o=new w.Entity,r=this,a=1,s=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=s;const l=function(e,t){var e=w.Cartographic.fromCartesian(e),t=w.Cartographic.fromCartesian(t),i=new w.EllipsoidGeodesic,i=(i.setEndPoints(e,t),i.surfaceDistance);a=Math.sqrt(Math.pow(i,2)+Math.pow(t.height-e.height,2))};s.setInputAction(function(e){e=r.getCatesian3FromPX(e.position);r.tooltip.showAtCartesian(e,"左键单击结束!"),e&&e.x&&(n?(l(n,e),r.tooltip.setVisible(!1),s.destroy(),"function"==typeof t.callback&&t.callback({center:n,radius:a},i)):(n=e,o.ellipse=t.style,o.ellipse.semiMajorAxis=new w.CallbackProperty(function(){return a},!1),o.ellipse.semiMinorAxis=new w.CallbackProperty(function(){return a},!1),o.position=new w.CallbackProperty(function(){return n},!1),o.point={pixelSize:5,outlineColor:w.Color.RED,outlineWidth:3},t.height&&(o.ellipse.extrudedHeight=t.height),i=r._drawLayer.entities.add(o)))},w.ScreenSpaceEventType.LEFT_CLICK),s.setInputAction(function(e){e=r._viewer.scene.camera.pickEllipsoid(e.endPosition,r._viewer.scene.globe.ellipsoid);n&&e&&e.x&&l(n,e)},w.ScreenSpaceEventType.MOUSE_MOVE)}},drawTrianglesGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5)},this._viewer&&t){var i=new w.Entity,n=new w.Entity,o=new w.Entity,r=[],a=[],s=[],l=this,c=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=c;c.setInputAction(function(e){e=l.getCatesian3FromPX(e.position);if(!e)return!1;0==r.length?(r.push(e.clone()),r.push(e.clone()),a.push(e.clone()),a.push(e.clone())):(c.destroy(),"function"==typeof t.callback&&t.callback({e:i,e2:n,e3:o}))},w.ScreenSpaceEventType.LEFT_CLICK),c.setInputAction(function(e){var t,i,e=l.getCatesian3FromPX(e.endPosition);e&&0<r.length&&(r.pop(),r.push(e.clone()),t=r,i=w.Cartographic.fromCartesian(t[0]),t=w.Cartographic.fromCartesian(t[1]),i=w.Cartesian3.fromDegrees(w.Math.toDegrees(i.longitude),w.Math.toDegrees(i.latitude),t.height),a.pop(),a.push(i.clone()),s.pop(),s.pop(),s.push(e.clone()),s.push(i.clone()))},w.ScreenSpaceEventType.MOUSE_MOVE),i.polyline={positions:new w.CallbackProperty(function(){return r},!1),...t.style},i.position=new w.CallbackProperty(function(){return r[0]},!1),i.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},i.label={text:new w.CallbackProperty(function(){return"直线:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(r))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(50,-100)},n.polyline={positions:new w.CallbackProperty(function(){return a},!1),...t.style},n.position=new w.CallbackProperty(function(){return s[1]},!1),n.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},n.label={text:new w.CallbackProperty(function(){return"高度:"+(t=a[1],!(e=a[0])&&!t||w.Cartesian3.equals(e,t)?0:(e=w.Cartographic.fromCartesian(e),(w.Cartographic.fromCartesian(t).height-e.height).toFixed(2)))+"米";var e,t},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,100)},o.polyline={positions:new w.CallbackProperty(function(){return s},!1),...t.style},o.position=new w.CallbackProperty(function(){return r[1]},!1),o.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},o.label={text:new w.CallbackProperty(function(){return"水平距离:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(s))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-150,-20)},this._drawLayer.entities.add(o),this._drawLayer.entities.add(n),this._drawLayer.entities.add(i)}},drawWallGraphics:function(a){a=a||{};var s,e={material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE};a.style?a.style=Object.assign({},e,a.style):a.style=e,this._viewer&&a&&(s=this).drawPolygonGraphics({clampToGround:s._objHasOwnProperty(a.style,"clampToGround",!0),style:{material:a.style.material},callback:function(e,t){var i=s.transformWGS84ArrayToCartesianArray(e),n=[],o=[];if(a.style.maximumHeights){let e=0;for(;e<i.length;)n.push(a.style.maximumHeights[e%2]),e++;a.style.maximumHeights=n}if(a.style.minimumHeights){let e=0;for(;e<i.length;)o.push(a.style.minimumHeights[e%2]),e++;a.style.minimumHeights=o}var r=s._drawLayer.entities.add({wall:{positions:i,...a.style}});"function"==typeof a.callback&&a.callback(e,r)}})},drawEllipsoidGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawCircleGraphics({callback:function(e,t){var i=o.createGraphics(),t=(i.ellipsoid=o.$graphics.getEllipsoidGraphics({radii:e.radius}),i.position=e.center,o._drawLayer.entities.remove(t),o._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},t)}})},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,drawCylinderGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawCircleGraphics({callback:function(e,t){var i=o._drawLayer.entities.add({position:e.center,cylinder:{length:2*e.radius||n.length,topRadius:n.topRadius||e.radius,bottomRadius:n.bottomRadius||e.radius,material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE}});o._drawLayer.entities.remove(t),"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},i)}})},drawCorridorGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawLineGraphics({callback:function(e,t){var i=o.createGraphics(),t=(i.corridor={positions:o.transformWGS84ArrayToCartesianArray(e),height:n.height||1,width:n.width||100,cornerType:w.CornerType.BEVELED,extrudedHeight:n.extrudedHeight||1,material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE},o._drawLayer.entities.remove(t),o._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback(e,t)}})},drawPolylineVolumeGraphics:function(o){(o=o||{}).style=o.style||{};const r=o.circleRadius||20,a=o.arms||7,s=o.rOuter||150,l=o.rInner||75;var c;this._viewer&&o&&(c=this).drawLineGraphics({callback:function(e,t){var i=c.createGraphics(),n="fivePoint"===o.shape?c.computeStar2d(a,s,l):c.computeCircleShap(r),n=(i.polylineVolume={positions:c.transformWGS84ArrayToCartesianArray(e),shape:n,cornerType:w.CornerType.MITERED,material:o.color||w.Color.RED},c._drawLayer.entities.remove(t),c._drawLayer.entities.add(i));"function"==typeof o.callback&&o.callback(e,n)}})},removeAll(){this._drawLayer.entities.removeAll()},removeEventHandler(){C&&!C.isDestroyed()&&(C.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),C.removeInputAction(w.ScreenSpaceEventType.RIGHT_CLICK),C.removeInputAction(w.ScreenSpaceEventType.LEFT_CLICK))}};let x={};function S(e,t){e&&(this._viewer=e,x=t)}S.prototype={mathDistance2d:function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},getCirclePoints2d:function(e,t,i,n){for(var o=[],r=Math.PI/180*Math.round(360/n),a=0;a<n;a++){var s=t+e*Math.sin(r*a),l=i+e*Math.cos(r*a);o.unshift({x:s,y:l})}return o},wholeDistance2d:function(i){let n=0;return i&&Array.isArray(i)&&0<i.length&&i.forEach((e,t)=>{t<i.length-1&&(n+=this.mathDistance2d(e,i[t+1]))}),n},getBaseLength2d:function(e){return Math.pow(this.wholeDistance2d(e),.99)},computeStar2d(e,t,i){for(var n=Math.PI/e,o=2*e,r=new Array(o),a=0;a<o;a++){var s=a%2==0?t:i;r[a]=new x.Cartesian2(Math.cos(a*n)*s,Math.sin(a*n)*s)}return r},computeCircleShap(t){var i=[];for(let e=0;e<360;e++){var n=x.Math.toRadians(e);i.push(new x.Cartesian2(t*Math.cos(n),t*Math.sin(n)))}return i},mid2d:function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},getCircleCenterOfThreePoints2d:function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],t=[n[0]-e[1]+t[1],n[1]+e[0]-t[0]],o=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[o[0]-e[1]+i[1],o[1]+e[0]-i[0]];return this.getIntersectPoint2d(n,t,o,e)},getIntersectPoint2d:function(e,t,i,n){return e[1]===t[1]?[(n[0]-i[0])/(n[1]-i[1])*(e[1]-i[1])+i[0],e[1]]:i[1]===n[1]?[(t[0]-e[0])/(t[1]-e[1])*(i[1]-e[1])+e[0],i[1]]:(t=(t[0]-e[0])/(t[1]-e[1]),n=(n[0]-i[0])/(n[1]-i[1]),[t*(i=(t*e[1]-e[0]-n*i[1]+i[0])/(t-n))-t*e[1]+e[0],i])},getAzimuth2d:function(e,t){let i,n=Math.asin(Math.abs(t[1]-e[1])/this.mathDistance2d(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},getAngleOfThreePoints2d:function(e,t,i){e=this.getAzimuth2d(t,e)-this.getAzimuth2d(t,i);return e<0?e+2*Math.PI:e},isClockWise2d:function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},getPointOnLine2d:function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},getCubicValue2d:function(e,t,i,n,o){var[r,a]=[1-(e=Math.max(Math.min(e,1),0)),e*e],s=a*e,l=r*r,c=l*r;return[c*t[0]+3*l*e*i[0]+3*r*a*n[0]+s*o[0],c*t[1]+3*l*e*i[1]+3*r*a*n[1]+s*o[1]]},getThirdPoint2d:function(e,t,i,n,o){e=this.getAzimuth2d(e,t),o=o?e+i:e-i,e=n*Math.cos(o),i=n*Math.sin(o);return[t[0]+e,t[1]+i]},inherits2d:function(e,o){function t(){}t.prototype=o.prototype,e.superClass_=o.prototype,e.prototype=new t,(e.prototype.constructor=e).base=function(e,t,i){var n=Array.prototype.slice.call(arguments,2);return o.prototype[t].apply(e,n)}},getArcPoints2d:function(t,i,n,e){var[o,r,a,s]=[null,null,[],e-n],s=s<0?s+2*Math.PI:s;for(let e=0;e<=100;e++){var l=n+s*e/100,o=t[0]+i*Math.cos(l),r=t[1]+i*Math.sin(l);a.push([o,r])}return a},getBisectorNormals2d:function(e,t,i,n){let o=this.getNormal2d(t,i,n),[r,a,s,l,c]=[null,null,null,null,null],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),u=o[0]/h,d=o[1]/h,p=this.mathDistance2d(t,i),m=this.mathDistance2d(i,n);return a=(c=1e-4<h?this.isClockWise(t,i,n)?(s=e*p,l=i[0]-s*d,c=i[1]+s*u,r=[l,c],s=e*m,l=i[0]+s*d,i[1]-s*u):(s=e*p,l=i[0]+s*d,c=i[1]-s*u,r=[l,c],s=e*m,l=i[0]-s*d,i[1]+s*u):(l=i[0]+e*(t[0]-i[0]),c=i[1]+e*(t[1]-i[1]),r=[l,c],l=i[0]+e*(n[0]-i[0]),i[1]+e*(n[1]-i[1])),[l,c]),[r,a]},getNormal2d:function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],o=Math.sqrt(n*n+e*e),o=(n/=o,e/=o,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(o*o+i*i);return[n+(o/=t),e+(i/=t)]},getLeftMostControlPoint2d:function(e,t){let[i,n,o,r,a]=[e[0],e[1],e[2],null,null],s=this.getBisectorNormals2d(0,i,n,o)[0],l=this.getNormal2d(i,n,o);var c,h,u,d,p;return a=1e-4<Math.sqrt(l[0]*l[0]+l[1]*l[1])?(e=this.mid2d(i,n),u=i[0]-e[0],c=i[1]-e[1],u=2*(c=-(h=2/this.mathDistance2d(i,n))*c)*(h=h*u),d=s[0]-e[0],p=s[1]-e[1],r=e[0]+(c*c-h*h)*d+u*p,e[1]+u*d+(h*h-c*c)*p):(r=i[0]+t*(n[0]-i[0]),i[1]+t*(n[1]-i[1])),[r,a]},getRightMostControlPoint2d:function(e,t){let i=e.length,n=e[i-3],o=e[i-2],r=e[i-1],a=this.getBisectorNormals2d(0,n,o,r)[1],s=this.getNormal2d(n,o,r),l=Math.sqrt(s[0]*s[0]+s[1]*s[1]),[c,h]=[null,null];var u,d,p,m,g;return h=1e-4<l?(e=this.mid2d(o,r),p=r[0]-e[0],u=r[1]-e[1],p=2*(u=-(d=2/this.mathDistance2d(o,r))*u)*(d=d*p),m=a[0]-e[0],g=a[1]-e[1],c=e[0]+(u*u-d*d)*m+p*g,e[1]+p*m+(d*d-u*u)*g):(c=r[0]+t*(o[0]-r[0]),r[1]+t*(o[1]-r[1])),[c,h]},getCurvePoints2d:function(t,i){let e=this.getLeftMostControlPoint2d(i,t),[n,o,r,a,s]=[null,null,null,[e],[]];for(let e=0;e<i.length-2;e++){[n,o,r]=[i[e],i[e+1],i[e+2]];var l=this.getBisectorNormals2d(t,n,o,r);a=a.concat(l)}var c=this.getRightMostControlPoint2d(i,t);c&&a.push(c);for(let t=0;t<i.length-1;t++){n=i[t],o=i[t+1],s.push(n);for(let e=0;e<100;e++){var h=this.getCubicValue2d(e/100,n,a[2*t],a[2*t+1],o);s.push(h)}s.push(o)}return s},getBezierPoints2d:function(o){if(o.length<=2)return o;var e=[],r=o.length-1;for(let n=0;n<=1;n+=.01){let[t,i]=[0,0];for(let e=0;e<=r;e++){var a=this.getBinomialFactor2d(r,e),s=Math.pow(n,e),l=Math.pow(1-n,r-e);t+=a*s*l*o[e][0],i+=a*s*l*o[e][1]}e.push([t,i])}return e.push(o[r]),e},getFactorial2d:function(t){let i=1;switch(t){case t<=1:i=1;break;case 2===t:i=2;break;case 3===t:i=6;break;case 24===t:i=24;break;case 5===t:i=120;break;default:for(let e=1;e<=t;e++)i*=e}return i},getBinomialFactor2d:function(e,t){return this.getFactorial2d(e)/(this.getFactorial2d(t)*this.getFactorial2d(e-t))},getQBSplinePoints2d:function(r){if(r.length<=2)return r;var[a,e]=[2,[]],t=r.length-a-1;e.push(r[0]);for(let o=0;o<=t;o++)for(let n=0;n<=1;n+=.05){let[t,i]=[0,0];for(let e=0;e<=a;e++){var s=this.getQuadricBSplineFactor2d(e,n);t+=s*r[o+e][0],i+=s*r[o+e][1]}e.push([t,i])}return e.push(r[r.length-1]),e},getQuadricBSplineFactor2d:function(e,t){let i=0;return 0===e?i=Math.pow(t-1,2)/2:1===e?i=(-2*Math.pow(t,2)+2*t+1)/2:2===e&&(i=Math.pow(t,2)/2),i}};let b=null;function M(e,t){e&&(this._viewer=e,s.prototype={...s.prototype,...p.prototype},this.$graphics=new s(e,t),b=t)}M.prototype={setCircleScanEffect:function(e){var t,i,n,o,r,a,s,l,c,h,u;if(e&&e.position)return t=e.id||"CircleScan"+parseInt(1e3*Math.random()),l=e.position,i=e.radius,n=e.color||b.Color.RED,o=e.duration||1500,r=this,a=e.circleMode||"CircleScan",e=e.border||4,u=l,s=new b.Cartesian4(u.x,u.y,u.z,1),u=this.transformCartesianToWGS84(l),l=this.transformWGS84ToCartesian({lng:u.lng,lat:u.lat,alt:u.alt+500}),c=new b.Cartesian4(l.x,l.y,l.z,1),h=(new Date).getTime(),u=new b.PostProcessStage({name:t,fragmentShader:this._getCircleScanShader({get:!0,border:e}),uniforms:{u_scanCenterEC:function(){return b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new b.Cartesian4)},u_scanPlaneNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new b.Cartesian4),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,c,new b.Cartesian4),i=new b.Cartesian3;return i.x=t.x-e.x,i.y=t.y-e.y,i.z=t.z-e.z,b.Cartesian3.normalize(i,i),i},u_radius:function(){return"CircleScan"==a?i*(((new Date).getTime()-h)%o)/o:i},u_scanColor:n}}),this._viewer.scene.postProcessStages.add(u),u},setRadarScanEffect:function(e){var t,i,n,o,r,a,s,l,c,h,u,d,p,m,g,f,y,v,w;if(e&&e.position)return t=e.id||"radarScan"+parseInt(1e3*Math.random()),c=e.position,i=e.radius,n=e.color||b.Color.RED,o=e.duration||1500,r=this,a=e.border||1,e=e.width||3,w=c,s=new b.Cartesian4(w.x,w.y,w.z,1),w=this.transformCartesianToWGS84(c),c=this.transformWGS84ToCartesian({lng:w.lng,lat:w.lat,alt:w.alt+500}),l=new b.Cartesian4(c.x,c.y,c.z,1),c=this.transformWGS84ToCartesian({lng:w.lng+.001,lat:w.lat,alt:w.alt}),h=new b.Cartesian4(c.x,c.y,c.z,1),u=(new Date).getTime(),d=new b.Quaternion,p=new b.Matrix3,m=new b.Cartesian4,g=new b.Cartesian4,f=new b.Cartesian4,y=new b.Cartesian3,v=new b.Cartesian3,w=new b.PostProcessStage({name:t,fragmentShader:this._getRadarScanShader({border:a,width:e,get:!0}),uniforms:{u_scanCenterEC:function(){return b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m)},u_scanPlaneNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,g);return y.x=t.x-e.x,y.y=t.y-e.y,y.z=t.z-e.z,b.Cartesian3.normalize(y,y),y},u_scanLineNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,g),i=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,h,f),t=(y.x=t.x-e.x,y.y=t.y-e.y,y.z=t.z-e.z,b.Cartesian3.normalize(y,y),v.x=i.x-e.x,v.y=i.y-e.y,v.z=i.z-e.z,((new Date).getTime()-u)%o/o);return b.Quaternion.fromAxisAngle(y,t*b.Math.PI*2,d),b.Matrix3.fromQuaternion(d,p),b.Matrix3.multiplyByVector(p,v,v),b.Cartesian3.normalize(v,v),v},u_radius:i,u_scanColor:n}}),this._viewer.scene.postProcessStages.add(w),w},satelliteScan:function(e){var t,i,n,o,r,a,s,l,c,h,u,d;if(e&&e.position)return t=b.Cartesian3,i=b.GeometryInstance,n=b.Primitive,o=b.MaterialAppearance,r=b.Material,a=b.Color,s=b.Matrix4,h=b.Transforms,o=b.MaterialAppearance,l=b.CylinderGeometry,u=e.position||[116.39,39.9],c=e.length||4e4,u=t.fromDegrees(u[0],u[1]),h=s.multiplyByTranslation(h.eastNorthUpToFixedFrame(u),new t(0,0,.5*c),new s),u=new i({geometry:new l({length:c,topRadius:0,bottomRadius:.5*c,vertexFormat:o.MaterialSupport.TEXTURED.vertexFormat}),modelMatrix:h}),d=this._viewer.scene.primitives.add(new n({geometryInstances:u,appearance:new o({material:new r({fabric:{uniforms:{color:e.color||new a(.2,1,0,1),repeat:e.repeat||30,offset:0,thickness:e.thickness||.2},source:"\n uniform vec4 color;\n uniform float repeat;\n uniform float offset;\n uniform float thickness;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n float sp = 1.0/repeat;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n float m = mod(dis + offset, sp);\n float a = step(sp*(1.0-thickness), m);\n material.diffuse = color.rgb;\n material.alpha = a * color.a;\n vec3 normalMC = material.normal;\n if(normalMC.y < 0.0 && normalMC.z < 0.0)\n { \n discard;\n }\n return material;\n }"},translucent:!0}),faceForward:!1,closed:!0,vertexShaderSource:"\n in vec3 position3DHigh;\n in vec3 position3DLow;\n in vec3 normal;\n in vec2 st;\n in float batchId;\n out vec3 v_positionEC;\n out vec3 v_normalEC;\n out vec2 v_st;\n void main()\n {\n vec4 p = czm_computePosition();\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = normal; // normal in world coordinates\n v_st = st;\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n }"})})),this._viewer.scene.preUpdate.addEventListener(function(){var e=d.appearance.material.uniforms.offset;1<(e-=.001)&&(e=0),d.appearance.material.uniforms.offset=e}),d},lighitCentrumScanEffect:function(t){var i=this.createLightScan_getCirclePoints(t.circle[0],t.circle[1],t.circle[2],t.circle[3]),n=this.createLightScan_entityCList(this._viewer,i,t);for(let e=0;e<n.length;e++)e!==n.length-1?this.createLightScan_changeOnePosition(t,n[e],[i[e].x,i[e].y,i[e+1].x,i[e+1].y]):this.createLightScan_changeOnePosition(t,n[e],[i[e].x,i[e].y,i[0].x,i[0].y]);return n},createLightScan_getCirclePoints:function(e,t,i,n){let o=[],r=Math.PI/180*Math.round(360/n),a=0;for(;a<n;a++){var s=t+e*Math.sin(r*a),l=i+e*Math.cos(r*a);o.unshift({x:s,y:l})}return o},createLightScan_changeOnePosition:function(t,e,i){const n=t.positionList;let o,r,a,s,l,c,h=0,u=0;function d(e){o=n[e+1][0]-n[e][0],r=n[e+1][1]-n[e][1],a=o/t.number,s=r/t.number,u=0}d(h),e.polygon.hierarchy=new b.CallbackProperty(function(){return Math.abs(l)>=Math.abs(o)&&Math.abs(c)>=Math.abs(r)&&((h+=1)===n.length-1&&(h=0),i[0]=i[0]+l,i[1]=i[1]+c,i[2]=i[2]+l,i[3]=i[3]+c,d(h)),l=u*a,c=u*s,u++,new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([t.observer[0],t.observer[1],t.observer[2],i[0]+l,i[1]+c,0,i[2]+l,i[3]+c,0]))},!1)},createLightScan_entityCList:function(t,i,n){var o=n.observer[0],r=n.observer[1],a=n.observer[2],s=[];for(let e=0;e<i.length;e++){var l=e===i.length-1?new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([o,r,a,i[e].x,i[e].y,0,i[0].x,i[0].y,0])):new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([o,r,a,i[e].x,i[e].y,0,i[e+1].x,i[e+1].y,0])),l=t.entities.add({name:"三角形",polygon:{hierarchy:l,outline:!1,perPositionHeight:!0,material:n.material}});s.push(l)}return s},createFireParticleSystem(e){var t,i,n,o,r,a,s,l,c,h,u,d;if(e&&e.position)return{fireImage:e,startScale:t,endScale:i,minimumParticleLife:n,maximumParticleLife:o,minimumSpeed:r,maximumSpeed:a,particleSize:s,emissionRate:l,position:c,startColor:h,endColor:u,emitter:d}=Object.assign({},{fireImage:"static/data/images/file/fire.png",startScale:3,endScale:1.5,minimumParticleLife:1.5,maximumParticleLife:1.8,minimumSpeed:7,maximumSpeed:9,particleSize:2,emissionRate:200,startColor:new b.Color(1,1,1,1),endColor:new b.Color(.5,0,0,0),emitter:new b.ConeEmitter(b.Math.toRadians(45))},e),new b.ParticleSystem({image:e,startScale:t,endScale:i,minimumParticleLife:n,maximumParticleLife:o,minimumSpeed:r,maximumSpeed:a,emissionRate:l,startColor:h,endColor:u,emitter:d,imageSize:new b.Cartesian2(s,s),lifetime:16,loop:!0,sizeInMeters:!0,modelMatrix:b.Transforms.eastNorthUpToFixedFrame(c)})}};const T="uniform vec4 u_intersectionColor;\nuniform float u_intersectionWidth;\nuniform vec4 u_lineColor;\n\nbool inSensorShadow(vec3 coneVertexWC, vec3 inverseRadii, vec3 pointWC) {\n // Diagonal matrix from the unscaled ellipsoid space to the scaled space.\n vec3 D = inverseRadii;\n\n // Sensor vertex in the scaled ellipsoid space\n vec3 q = D * coneVertexWC;\n float qMagnitudeSquared = dot(q, q);\n float test = qMagnitudeSquared - 1.0;\n\n // Sensor vertex to fragment vector in the ellipsoid's scaled space\n vec3 temp = D * pointWC - q;\n float d = dot(temp, q);\n\n // Behind silhouette plane and inside silhouette cone\n return (d < -test) && (d / length(temp) < -sqrt(test));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n\nvec4 getLineColor() { return u_lineColor; }\n\nvec4 getIntersectionColor() { return u_intersectionColor; }\n\nfloat getIntersectionWidth() { return u_intersectionWidth; }\n\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC) {\n // (s, t) both in the range [0, 1]\n float t = pointMC.z / sensorRadius;\n float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\n s = s - floor(s);\n\n return vec2(s, t);\n}",E='#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n uniform bool u_showIntersection;\nuniform bool u_showThroughEllipsoid;\n\nuniform float u_radius;\nuniform float u_xHalfAngle;\nuniform float u_yHalfAngle;\nuniform float u_normalDirection;\nuniform float u_type;\n\nin vec3 v_position;\nin vec3 v_positionWC;\nin vec3 v_positionEC;\nin vec3 v_normalEC;\n\nvec4 getColor(float sensorRadius, vec3 pointEC) {\n czm_materialInput materialInput;\n\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n materialInput.str = pointMC / sensorRadius;\n\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n\n vec3 normalEC = normalize(v_normalEC);\n materialInput.normalEC = u_normalDirection * normalEC;\n\n czm_material material = czm_getMaterial(materialInput);\n\n return mix(\n czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),\n vec4(material.diffuse, material.alpha), 0.4);\n}\n\nbool isOnBoundary(float value, float epsilon) {\n float width = getIntersectionWidth();\n float tolerance = width * epsilon;\n\n#ifdef GL_OES_standard_derivatives\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\n float pixels = width * delta;\n float temp = abs(value);\n // There are a couple things going on here.\n // First we test the value at the current fragment to see if it is within the\n // tolerance. We also want to check if the value of an adjacent pixel is\n // within the tolerance, but we don\'t want to admit points that are obviously\n // not on the surface. For example, if we are looking for "value" to be close\n // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1\n // and "temp - delta" would be "1 - 1" which is zero even though neither of\n // the points is close to zero.\n return temp < tolerance && temp < pixels ||\n (delta < 10.0 * tolerance && temp - delta < tolerance &&\n temp < pixels);\n#else\n return abs(value) < tolerance;\n#endif\n}\n\nvec4 shade(bool isOnBoundary) {\n if (u_showIntersection && isOnBoundary) {\n return getIntersectionColor();\n }\n if (u_type == 1.0) {\n return getLineColor();\n }\n return getColor(u_radius, v_positionEC);\n}\n\nfloat ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {\n vec3 scaled = inverseRadii * point;\n return dot(scaled, scaled) - 1.0;\n}\n\nvoid main() {\n vec3 sensorVertexWC =\n czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n vec3 sensorVertexEC =\n czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n\n // vec3 pixDir = normalize(v_position);\n float positionX = v_position.x;\n float positionY = v_position.y;\n float positionZ = v_position.z;\n\n vec3 zDir = vec3(0.0, 0.0, 1.0);\n vec3 lineX = vec3(positionX, 0, positionZ);\n vec3 lineY = vec3(0, positionY, positionZ);\n float resX = dot(normalize(lineX), zDir);\n if (resX < cos(u_xHalfAngle) - 0.00001) {\n discard;\n }\n float resY = dot(normalize(lineY), zDir);\n if (resY < cos(u_yHalfAngle) - 0.00001) {\n discard;\n }\n\n // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n float ellipsoidValue =\n ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);\n\n // Occluded by the ellipsoid?\n if (!u_showThroughEllipsoid) {\n // Discard if in the ellipsoid\n // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done\n // on the CPU first.\n if (ellipsoidValue < 0.0) {\n discard;\n }\n\n // Discard if in the sensor\'s shadow\n if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,\n v_positionWC)) {\n discard;\n }\n }\n\n // Notes: Each surface functions should have an associated tolerance based on\n // the floating point error.\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n // isOnEllipsoid = false;\n // if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){\n /*if(false){\n out_FragColor = vec4(1.0,0.0,0.0,1.0);\n }else{\n out_FragColor = shade(isOnEllipsoid);\n }\n*/\nout_FragColor = shade(isOnEllipsoid);\n}';let A={};function I(t){var P=(A=t).BoundingSphere,x=A.Cartesian3,i=A.Color,d=A.combine,b=A.ComponentDatatype,n=A.defaultValue,o=A.defined,S=(A.destroyObject,A.DeveloperError),M=A.Matrix4,r=A.PrimitiveType,I=A.Buffer,L=A.BufferUsage,a=A.DrawCommand,D=A.Pass,R=A.RenderState,k=A.ShaderProgram,z=A.ShaderSource,G=A.VertexArray,O=A.BlendingState,F=A.CullFace,s=A.Material,K=A.SceneMode,B=A.VertexFormat,U=A.Math,H=A.Matrix3,W=(M=A.Matrix4,A.JulianDate),u=(A.BoxGeometry,A.EllipsoidGeometry,Math.sin),V=Math.cos,N=Math.tan,j=Math.atan,q={position:0,normal:1};function e(e){var t=this;e=n(e,n.EMPTY_OBJECT),this.show=n(e.show,!0),this.slice=n(e.slice,32),this.modelMatrix=M.clone(e.modelMatrix,new M),this._modelMatrix=new M,this._computedModelMatrix=new M,this._computedScanPlaneModelMatrix=new M,this.radius=n(e.radius,Number.POSITIVE_INFINITY),this._radius=void 0,this.xHalfAngle=n(e.xHalfAngle,0),this._xHalfAngle=void 0,this.yHalfAngle=n(e.yHalfAngle,0),this._yHalfAngle=void 0,this.lineColor=n(e.lineColor,i.WHITE),this.showSectorLines=n(e.showSectorLines,!0),this.showSectorSegmentLines=n(e.showSectorSegmentLines,!0),this.showLateralSurfaces=n(e.showLateralSurfaces,!0),this.material=o(e.material)?e.material:s.fromType(s.ColorType),this._material=void 0,this._translucent=void 0,this.lateralSurfaceMaterial=o(e.lateralSurfaceMaterial)?e.lateralSurfaceMaterial:s.fromType(s.ColorType),this._lateralSurfaceMaterial=void 0,this._lateralSurfaceTranslucent=void 0,this.showDomeSurfaces=n(e.showDomeSurfaces,!0),this.domeSurfaceMaterial=o(e.domeSurfaceMaterial)?e.domeSurfaceMaterial:s.fromType(s.ColorType),this._domeSurfaceMaterial=void 0,this.showDomeLines=n(e.showDomeLines,!0),this.showIntersection=n(e.showIntersection,!0),this.intersectionColor=n(e.intersectionColor,i.WHITE),this.intersectionWidth=n(e.intersectionWidth,5),this.showThroughEllipsoid=n(e.showThroughEllipsoid,!1),this._showThroughEllipsoid=void 0,this.showScanPlane=n(e.showScanPlane,!0),this.scanPlaneColor=n(e.scanPlaneColor,i.WHITE),this.scanPlaneMode=n(e.scanPlaneMode,"horizontal"),this.scanPlaneRate=n(e.scanPlaneRate,10),this._scanePlaneXHalfAngle=0,this._scanePlaneYHalfAngle=0,this._time=W.now(),this._boundingSphere=new P,this._boundingSphereWC=new P,this._sectorFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorVA=void 0,this._sectorLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._sectorLineVA=void 0,this._sectorSegmentLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._sectorSegmentLineVA=void 0,this._domeFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeVA=void 0,this._domeLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._domeLineVA=void 0,this._scanPlaneFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanPlaneBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanRadialCommand=void 0,this._colorCommands=[],this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._uniforms={u_type:function(){return 0},u_xHalfAngle:function(){return t.xHalfAngle},u_yHalfAngle:function(){return t.yHalfAngle},u_radius:function(){return t.radius},u_showThroughEllipsoid:function(){return t.showThroughEllipsoid},u_showIntersection:function(){return t.showIntersection},u_intersectionColor:function(){return t.intersectionColor},u_intersectionWidth:function(){return t.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return t.lineColor}},this._scanUniforms={u_xHalfAngle:function(){return t._scanePlaneXHalfAngle},u_yHalfAngle:function(){return t._scanePlaneYHalfAngle},u_radius:function(){return t.radius},u_color:function(){return t.scanPlaneColor},u_showThroughEllipsoid:function(){return t.showThroughEllipsoid},u_showIntersection:function(){return t.showIntersection},u_intersectionColor:function(){return t.intersectionColor},u_intersectionWidth:function(){return t.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return t.lineColor}}}e.prototype.update=function(e){var t,i,n,o,r=e.mode;if(this.show&&r===K.SCENE3D){var r=!1,a=!1,s=!1,l=this.xHalfAngle,c=this.yHalfAngle;if(l<0||c<0)throw new S("halfAngle must be greater than or equal to zero.");if(0!=l&&0!=c){this._xHalfAngle===l&&this._yHalfAngle===c||(this._xHalfAngle=l,this._yHalfAngle=c,r=!0);var h=this.radius;if(h<0)throw new S("this.radius must be greater than or equal to zero.");var u,d,p,m,g=!1,h=(this._radius!==h&&(g=!0,this._radius=h,this._boundingSphere=new P(x.ZERO,this.radius)),M.equals(this.modelMatrix,this._modelMatrix)&&!g||(M.clone(this.modelMatrix,this._modelMatrix),M.multiplyByUniformScale(this.modelMatrix,this.radius,this._computedModelMatrix),P.transform(this._boundingSphere,this.modelMatrix,this._boundingSphereWC)),this.showThroughEllipsoid),g=(this._showThroughEllipsoid!==this.showThroughEllipsoid&&(this._showThroughEllipsoid=h,a=!0),this.material),f=(this._material!==g&&(this._material=g,s=a=!0),g.isTranslucent()),y=(this._translucent!==f&&(this._translucent=f,a=!0),this.showScanPlane&&(m=e.time,(p=W.secondsDifference(m,this._time))<0&&(this._time=W.clone(m,this._time)),m=Math.max(p%this.scanPlaneRate/this.scanPlaneRate,0),"horizontal"==this.scanPlaneMode?(p=V(u=2*c*m-c),d=N(l),p=j(p*d),this._scanePlaneXHalfAngle=p,this._scanePlaneYHalfAngle=u,A.Matrix3.fromRotationX(this._scanePlaneYHalfAngle,Y)):(u=2*l*m-l,d=N(c),p=V(u),m=j(p*d),this._scanePlaneXHalfAngle=u,this._scanePlaneYHalfAngle=m,A.Matrix3.fromRotationY(this._scanePlaneXHalfAngle,Y)),A.Matrix4.multiplyByMatrix3(this.modelMatrix,Y,this._computedScanPlaneModelMatrix),M.multiplyByUniformScale(this._computedScanPlaneModelMatrix,this.radius,this._computedScanPlaneModelMatrix)),r&&(l=this,c=e.context,d=Z(p=l,l.xHalfAngle,l.yHalfAngle),u=p.xHalfAngle,p=p.yHalfAngle,m=d.zoy,d=d.zox,r=[],n=H.fromRotationY(u,Y),r.push(m.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)})),n=H.fromRotationX(-p,Y),r.push(d.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)}).reverse()),n=H.fromRotationY(-u,Y),r.push(m.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)}).reverse()),n=H.fromRotationX(p,Y),r.push(d.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)})),u=r,l.showLateralSurfaces&&(l._sectorVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(18*i),o=0,r=0,a=t.length;r<a;r++)for(var s=t[r],l=x.normalize(x.cross(s[0],s[s.length-1],X),X),c=0,i=s.length-1;c<i;c++)n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z,n[o++]=s[c].x,n[o++]=s[c].y,n[o++]=s[c].z,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z,n[o++]=s[c+1].x,n[o++]=s[c+1].y,n[o++]=s[c+1].z,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z;var h=I.createVertexBuffer({context:e,typedArray:n,usage:L.STATIC_DRAW}),u=6*Float32Array.BYTES_PER_ELEMENT,h=[{index:q.position,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:u},{index:q.normal,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:3*Float32Array.BYTES_PER_ELEMENT,strideInBytes:u}];return new G({context:e,attributes:h})}(c,u)),l.showSectorLines&&(l._sectorLineVA=function(e,t){for(var i=new Float32Array(9*t.length),n=0,o=0,r=t.length;o<r;o++){var a=t[o];i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=a[0].x,i[n++]=a[0].y,i[n++]=a[0].z}var s=I.createVertexBuffer({context:e,typedArray:i,usage:L.STATIC_DRAW}),l=3*Float32Array.BYTES_PER_ELEMENT,s=[{index:q.position,vertexBuffer:s,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:l}];return new G({context:e,attributes:s})}(c,u)),l.showSectorSegmentLines&&(l._sectorSegmentLineVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(9*i),o=0,r=0,a=t.length;r<a;r++)for(var s=t[r],l=0,i=s.length-1;l<i;l++)n[o++]=s[l].x,n[o++]=s[l].y,n[o++]=s[l].z,n[o++]=s[l+1].x,n[o++]=s[l+1].y,n[o++]=s[l+1].z;var c=I.createVertexBuffer({context:e,typedArray:n,usage:L.STATIC_DRAW}),h=3*Float32Array.BYTES_PER_ELEMENT,c=[{index:q.position,vertexBuffer:c,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:h}];return new G({context:e,attributes:c})}(c,u)),l.showDomeSurfaces&&(l._domeVA=(m=c,p=A.EllipsoidGeometry.createGeometry(new A.EllipsoidGeometry({vertexFormat:B.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),G.fromGeometry({context:m,geometry:p,attributeLocations:q,bufferUsage:L.STATIC_DRAW,interleave:!1}))),l.showDomeLines&&(l._domeLineVA=(d=c,r=A.EllipsoidOutlineGeometry.createGeometry(new A.EllipsoidOutlineGeometry({vertexFormat:B.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),G.fromGeometry({context:d,geometry:r,attributeLocations:q,bufferUsage:L.STATIC_DRAW,interleave:!1}))),l.showScanPlane)&&("horizontal"==l.scanPlaneMode?(o=Z(l,U.PI_OVER_TWO,0),l._scanPlaneVA=$(c,o.zox)):(o=Z(l,0,U.PI_OVER_TWO),l._scanPlaneVA=$(c,o.zoy))),a&&(r=this,l=h,f?(r._frontFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:F.BACK}}),r._backFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:F.FRONT}}),r._pickRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND})):(r._frontFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!0}),r._pickRS=R.fromCache({depthTest:{enabled:!0},depthMask:!0}))),s&&(o=c=this,l=h=g,g=(r=e).context,t="in vec4 position;\nin vec3 normal;\n\nout vec3 v_position;\nout vec3 v_positionWC;\nout vec3 v_positionEC;\nout vec3 v_normalEC;\n\nvoid main() {\n gl_Position = czm_modelViewProjection * position;\n v_position = vec3(position);\n v_positionWC = (czm_model * position).xyz;\n v_positionEC = (czm_modelView * position).xyz;\n v_normalEC = czm_normal * normal;\n}",i=new z({sources:[T,l.shaderSource,E]}),o._sp=k.replaceCache({context:g,shaderProgram:o._sp,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:q}),i=new z({sources:[T,l.shaderSource,E],pickColorQualifier:"uniform"}),o._pickSP=k.replaceCache({context:g,shaderProgram:o._pickSP,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:q}),c.showScanPlane)&&(l=c,g=h,o=r.context,g=new z({sources:[T,g.shaderSource,'#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n uniform bool u_showIntersection;\nuniform bool u_showThroughEllipsoid;\n\nuniform float u_radius;\nuniform float u_xHalfAngle;\nuniform float u_yHalfAngle;\nuniform float u_normalDirection;\nuniform vec4 u_color;\n\nin vec3 v_position;\nin vec3 v_positionWC;\nin vec3 v_positionEC;\nin vec3 v_normalEC;\n\nvec4 getColor(float sensorRadius, vec3 pointEC) {\n czm_materialInput materialInput;\n\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n materialInput.str = pointMC / sensorRadius;\n\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n\n vec3 normalEC = normalize(v_normalEC);\n materialInput.normalEC = u_normalDirection * normalEC;\n\n czm_material material = czm_getMaterial(materialInput);\n\n material.diffuse = u_color.rgb;\n material.alpha = u_color.a;\n\n return mix(\n czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),\n vec4(material.diffuse, material.alpha), 0.4);\n}\n\nbool isOnBoundary(float value, float epsilon) {\n float width = getIntersectionWidth();\n float tolerance = width * epsilon;\n\n#ifdef GL_OES_standard_derivatives\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\n float pixels = width * delta;\n float temp = abs(value);\n // There are a couple things going on here.\n // First we test the value at the current fragment to see if it is within the\n // tolerance. We also want to check if the value of an adjacent pixel is\n // within the tolerance, but we don\'t want to admit points that are obviously\n // not on the surface. For example, if we are looking for "value" to be close\n // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1\n // and "temp - delta" would be "1 - 1" which is zero even though neither of\n // the points is close to zero.\n return temp < tolerance && temp < pixels ||\n (delta < 10.0 * tolerance && temp - delta < tolerance &&\n temp < pixels);\n#else\n return abs(value) < tolerance;\n#endif\n}\n\nvec4 shade(bool isOnBoundary) {\n if (u_showIntersection && isOnBoundary) {\n return getIntersectionColor();\n }\n return getColor(u_radius, v_positionEC);\n}\n\nfloat ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {\n vec3 scaled = inverseRadii * point;\n return dot(scaled, scaled) - 1.0;\n}\n\nvoid main() {\n vec3 sensorVertexWC =\n czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n vec3 sensorVertexEC =\n czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n\n // vec3 pixDir = normalize(v_position);\n float positionX = v_position.x;\n float positionY = v_position.y;\n float positionZ = v_position.z;\n\n vec3 zDir = vec3(0.0, 0.0, 1.0);\n vec3 lineX = vec3(positionX, 0, positionZ);\n vec3 lineY = vec3(0, positionY, positionZ);\n float resX = dot(normalize(lineX), zDir);\n if (resX < cos(u_xHalfAngle) - 0.0001) {\n discard;\n }\n float resY = dot(normalize(lineY), zDir);\n if (resY < cos(u_yHalfAngle) - 0.0001) {\n discard;\n }\n\n // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n float ellipsoidValue =\n ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);\n\n // Occluded by the ellipsoid?\n if (!u_showThroughEllipsoid) {\n // Discard if in the ellipsoid\n // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done\n // on the CPU first.\n if (ellipsoidValue < 0.0) {\n discard;\n }\n\n // Discard if in the sensor\'s shadow\n if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,\n v_positionWC)) {\n discard;\n }\n }\n\n // Notes: Each surface functions should have an associated tolerance based on\n // the floating point error.\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n out_FragColor = shade(isOnEllipsoid);\n}']}),l._scanePlaneSP=k.replaceCache({context:o,shaderProgram:l._scanePlaneSP,vertexShaderSource:"in vec4 position;\nin vec3 normal;\n\nout vec3 v_position;\nout vec3 v_positionWC;\nout vec3 v_positionEC;\nout vec3 v_normalEC;\n\nvoid main() {\n gl_Position = czm_modelViewProjection * position;\n v_position = vec3(position);\n v_positionWC = (czm_model * position).xyz;\n v_positionEC = (czm_modelView * position).xyz;\n v_normalEC = czm_normal * normal;\n}",fragmentShaderSource:g,attributeLocations:q})),(a||s)&&(t=f,(i=this)._colorCommands.length=0,c=t?D.TRANSLUCENT:D.OPAQUE,i.showLateralSurfaces&&J(i,i._sectorFrontCommand,i._sectorBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorVA,i._uniforms,i._computedModelMatrix,t,c),i.showSectorLines&&J(i,i._sectorLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showSectorSegmentLines&&J(i,i._sectorSegmentLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorSegmentLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showDomeSurfaces&&J(i,i._domeFrontCommand,i._domeBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._domeVA,i._uniforms,i._computedModelMatrix,t,c),i.showDomeLines&&J(i,i._domeLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._domeLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showScanPlane)&&J(i,i._scanPlaneFrontCommand,i._scanPlaneBackCommand,i._frontFaceRS,i._backFaceRS,i._scanePlaneSP,i._scanPlaneVA,i._scanUniforms,i._computedScanPlaneModelMatrix,t,c),e.commandList),h=e.passes,v=this._colorCommands;if(h.render)for(var w=0,_=v.length;w<_;w++){var C=v[w];y.push(C)}}}};var Y=new H,X=new x;function Z(e,t,i){for(var n=e.slice,e=V(i),i=N(i),o=V(t),t=N(t),r=j(o*i),a=j(e*t),s=[],l=0;l<n;l++){var c=2*r*l/(n-1)-r;s.push(new x(0,u(c),V(c)))}for(var h=[],l=0;l<n;l++)h.push(new x(u(c=2*a*l/(n-1)-a),0,V(c)));return{zoy:s,zox:h}}function $(e,t){for(var i=t.length-1,n=new Float32Array(9*i),o=0,r=0;r<i;r++)n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=t[r].x,n[o++]=t[r].y,n[o++]=t[r].z,n[o++]=t[r+1].x,n[o++]=t[r+1].y,n[o++]=t[r+1].z;var a=I.createVertexBuffer({context:e,typedArray:n,usage:L.STATIC_DRAW}),s=3*Float32Array.BYTES_PER_ELEMENT,a=[{index:q.position,vertexBuffer:a,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:s}];return new G({context:e,attributes:a})}function J(e,t,i,n,o,r,a,s,l,c,h,u){c&&i&&(i.vertexArray=a,i.renderState=o,i.shaderProgram=r,i.uniformMap=d(s,e._material._uniforms),i.uniformMap.u_normalDirection=function(){return-1},i.pass=h,i.modelMatrix=l,e._colorCommands.push(i)),t.vertexArray=a,t.renderState=n,t.shaderProgram=r,t.uniformMap=d(s,e._material._uniforms),u&&(t.uniformMap.u_type=function(){return 1}),t.pass=h,t.modelMatrix=l,e._colorCommands.push(t)}return e}let L={};function D(e){var t=(L=e).defaultValue,i=L.defined,e=Object.defineProperties,n=L.DeveloperError,o=L.Event,r=L.createMaterialPropertyDescriptor,a=L.createPropertyDescriptor;function s(e){this._show=void 0,this._radius=void 0,this._xHalfAngle=void 0,this._yHalfAngle=void 0,this._lineColor=void 0,this._showSectorLines=void 0,this._showSectorSegmentLines=void 0,this._showLateralSurfaces=void 0,this._material=void 0,this._showDomeSurfaces=void 0,this._showDomeLines=void 0,this._showIntersection=void 0,this._intersectionColor=void 0,this._intersectionWidth=void 0,this._showThroughEllipsoid=void 0,this._gaze=void 0,this._showScanPlane=void 0,this._scanPlaneColor=void 0,this._scanPlaneMode=void 0,this._scanPlaneRate=void 0,this._definitionChanged=new o,this.merge(t(e,t.EMPTY_OBJECT))}return e(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),radius:a("radius"),xHalfAngle:a("xHalfAngle"),yHalfAngle:a("yHalfAngle"),lineColor:a("lineColor"),showSectorLines:a("showSectorLines"),showSectorSegmentLines:a("showSectorSegmentLines"),showLateralSurfaces:a("showLateralSurfaces"),material:r("material"),showDomeSurfaces:a("showDomeSurfaces"),showDomeLines:a("showDomeLines "),showIntersection:a("showIntersection"),intersectionColor:a("intersectionColor"),intersectionWidth:a("intersectionWidth"),showThroughEllipsoid:a("showThroughEllipsoid"),gaze:a("gaze"),showScanPlane:a("showScanPlane"),scanPlaneColor:a("scanPlaneColor"),scanPlaneMode:a("scanPlaneMode"),scanPlaneRate:a("scanPlaneRate")}),s.prototype.clone=function(e){return(e=i(e)?e:new s).show=this.show,e.radius=this.radius,e.xHalfAngle=this.xHalfAngle,e.yHalfAngle=this.yHalfAngle,e.lineColor=this.lineColor,e.showSectorLines=this.showSectorLines,e.showSectorSegmentLines=this.showSectorSegmentLines,e.showLateralSurfaces=this.showLateralSurfaces,e.material=this.material,e.showDomeSurfaces=this.showDomeSurfaces,e.showDomeLines=this.showDomeLines,e.showIntersection=this.showIntersection,e.intersectionColor=this.intersectionColor,e.intersectionWidth=this.intersectionWidth,e.showThroughEllipsoid=this.showThroughEllipsoid,e.gaze=this.gaze,e.showScanPlane=this.showScanPlane,e.scanPlaneColor=this.scanPlaneColor,e.scanPlaneMode=this.scanPlaneMode,e.scanPlaneRate=this.scanPlaneRate,e},s.prototype.merge=function(e){if(!i(e))throw new n("source is required.");this.show=t(this.show,e.show),this.radius=t(this.radius,e.radius),this.xHalfAngle=t(this.xHalfAngle,e.xHalfAngle),this.yHalfAngle=t(this.yHalfAngle,e.yHalfAngle),this.lineColor=t(this.lineColor,e.lineColor),this.showSectorLines=t(this.showSectorLines,e.showSectorLines),this.showSectorSegmentLines=t(this.showSectorSegmentLines,e.showSectorSegmentLines),this.showLateralSurfaces=t(this.showLateralSurfaces,e.showLateralSurfaces),this.material=t(this.material,e.material),this.showDomeSurfaces=t(this.showDomeSurfaces,e.showDomeSurfaces),this.showDomeLines=t(this.showDomeLines,e.showDomeLines),this.showIntersection=t(this.showIntersection,e.showIntersection),this.intersectionColor=t(this.intersectionColor,e.intersectionColor),this.intersectionWidth=t(this.intersectionWidth,e.intersectionWidth),this.showThroughEllipsoid=t(this.showThroughEllipsoid,e.showThroughEllipsoid),this.gaze=t(this.gaze,e.gaze),this.showScanPlane=t(this.showScanPlane,e.showScanPlane),this.scanPlaneColor=t(this.scanPlaneColor,e.scanPlaneColor),this.scanPlaneMode=t(this.scanPlaneMode,e.scanPlaneMode),this.scanPlaneRate=t(this.scanPlaneRate,e.scanPlaneRate)},s}let k={};function z(e,v){function c(e,t,i){var n=t[e.id];C(n)&&(n=n.primitive,i.remove(n),n&&!n.isDestroyed()&&n.destroy(),delete t[e.id])}var i,w,_,C,o,P,x,b,S,M,T,A,E,I,L,D,R,n;if(e)return i=(k=e).AssociativeArray,w=k.Cartesian3,_=k.Color,C=k.defined,o=k.destroyObject,P=k.DeveloperError,x=k.Matrix3,b=k.Matrix4,S=k.Quaternion,M=k.MaterialProperty,T=k.Property,A=new x,new b,E=new w,I=new w,L=new S,D=new w,R=new S,(n=function(e,t){if(!C(e))throw new P("scene is required.");if(!C(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(n.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._hash={},this._entitiesToVisualize=new i,this._onCollectionChanged(t,t.values,[],[])}).prototype.update=function(e){if(!C(e))throw new P("time is required.");for(var t=this._entitiesToVisualize.values,i=this._hash,n=this._primitives,o=0,r=t.length;o<r;o++){var a,s,l,c=t[o],h=c._rectangularSensor,u=i[c.id],d=c.isShowing&&c.isAvailable(e)&&T.getValueOrDefault(h._show,e,!0);if(d&&(a=T.getValueOrUndefined(c._position,e,E),f=T.getValueOrUndefined(c._orientation,e,L),y=T.getValueOrUndefined(h._radius,e),s=T.getValueOrUndefined(h._xHalfAngle,e),l=T.getValueOrUndefined(h._yHalfAngle,e),d=C(a)&&C(s)&&C(l)),d){d=C(u)?u.primitive:void 0,c=(C(d)||((d=new v).id=c,n.add(d),i[c.id]=u={primitive:d,position:void 0,orientation:void 0}),T.getValueOrUndefined(h._gaze,e));if(C(c)){var p=T.getValueOrUndefined(c._position,e,I);if(!C(a)||!C(p))continue;var m=w.subtract(a,p,D),g=w.angleBetween(k.Cartesian3.UNIT_Z,m),m=w.cross(k.Cartesian3.UNIT_Z,m,D),f=S.fromAxisAngle(m,g-Math.PI,R),y=w.distance(a,p);d.modelMatrix=b.fromRotationTranslation(x.fromQuaternion(f,A),a,d.modelMatrix)}else w.equals(a,u.position)&&S.equals(f,u.orientation)||(C(f)?(d.modelMatrix=b.fromRotationTranslation(x.fromQuaternion(f,A),a,d.modelMatrix),u.position=w.clone(a,u.position),u.orientation=S.clone(f,u.orientation)):(d.modelMatrix=k.Transforms.eastNorthUpToFixedFrame(a),u.position=w.clone(a,u.position)));d.show=!0,d.gaze=c,d.radius=y,d.xHalfAngle=s,d.yHalfAngle=l,d.lineColor=T.getValueOrDefault(h._lineColor,e,_.WHITE),d.showSectorLines=T.getValueOrDefault(h._showSectorLines,e,!0),d.showSectorSegmentLines=T.getValueOrDefault(h._showSectorSegmentLines,e,!0),d.showLateralSurfaces=T.getValueOrDefault(h._showLateralSurfaces,e,!0),d.material=M.getValue(e,h._material,d.material),d.showDomeSurfaces=T.getValueOrDefault(h._showDomeSurfaces,e,!0),d.showDomeLines=T.getValueOrDefault(h._showDomeLines,e,!0),d.showIntersection=T.getValueOrDefault(h._showIntersection,e,!0),d.intersectionColor=T.getValueOrDefault(h._intersectionColor,e,_.WHITE),d.intersectionWidth=T.getValueOrDefault(h._intersectionWidth,e,1),d.showThroughEllipsoid=T.getValueOrDefault(h._showThroughEllipsoid,e,!0),d.scanPlaneMode=T.getValueOrDefault(h._scanPlaneMode,e),d.scanPlaneColor=T.getValueOrDefault(h._scanPlaneColor,e,_.WHITE),d.showScanPlane=T.getValueOrDefault(h._showScanPlane,e,!0),d.scanPlaneRate=T.getValueOrDefault(h._scanPlaneRate,e,1)}else C(u)&&(u.primitive.show=!1)}return!0},n.prototype.isDestroyed=function(){return!1},n.prototype.destroy=function(){for(var e=this._entitiesToVisualize.values,t=this._hash,i=this._primitives,n=e.length-1;-1<n;n--)c(e[n],t,i);return o(this)},n.prototype._onCollectionChanged=function(e,t,i,n){for(var o,r=this._entitiesToVisualize,a=this._hash,s=this._primitives,l=t.length-1;-1<l;l--)o=t[l],C(o._rectangularSensor)&&C(o._position)&&r.set(o.id,o);for(l=n.length-1;-1<l;l--)o=n[l],C(o._rectangularSensor)&&C(o._position)?r.set(o.id,o):(c(o,a,s),r.remove(o.id));for(l=i.length-1;-1<l;l--)c(o=i[l],a,s),r.remove(o.id)},n}let R=null;function O(e,t){e&&(this.viewer=e,R=t,this._installPlugin())}O.prototype={_installPlugin:function(){this._installCounputeVertex(),this._installCylinderGeometry(),this._installRadarPrimitive()},_installCylinderGeometry:function(){function b(e){this.length=e.length,this.topRadius=e.topRadius,this.bottomRadius=e.bottomRadius,this.slices=e.slices||64,this.zReverse=e.zReverse}var M=new R.Cartesian2,S=new R.Cartesian3,T=new R.Ray;b._createGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,o=e.slices,r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=M;p.z=Math.sin(e);for(var m=Math.cos(e),g=0;g<u.length;g++){c[g]=[];for(var f=h[g],y=0;y<o;y++){c[g].push(d++);var v=r*y,w=f*Math.cos(v),_=f*Math.sin(v);a.push(w,_,u[g]),w=m*Math.cos(v),_=m*Math.sin(v),s.push(w,_,p.z),l.push(g/(u.length-1),0)}}for(var C=[],g=1;g<u.length;g++)for(y=1;y<o;y++){var P=c[g-1][y-1],x=c[g][y-1],b=c[g][y],S=c[g-1][y];C.push(b),C.push(S),C.push(P),C.push(b),C.push(P),C.push(x),y==c[g].length-1&&(P=c[g-1][y],x=c[g][y],b=c[g][0],S=c[g-1][0],C.push(b),C.push(S),C.push(P),C.push(b),C.push(P),C.push(x))}C=new Int16Array(C),a=new Float32Array(a),s=new Float32Array(s),l=new Float32Array(l),n={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),normal:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:s}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:l})},i=R.BoundingSphere.fromVertices(a),t=new R.Geometry({attributes:n,indices:C,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:i});return a=[],C=[],l=[],t},b.createGeometry=function(e,t){if(!t)return b._createGeometry(e);R.Matrix4.multiplyByPoint(t,R.Cartesian3.ZERO,S),S.clone(T.origin);var i=e.length,n=e.topRadius,o=(e.bottomRadius,e.slices),r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[0,e.zReverse?-i:i],u=0,u=0;a.push(0,0,0),s.push(1,1),u++;for(var d=new R.Cartesian3,p=n/15,m=0;m<16;m++){for(var g=p*m,f=[],y=0;y<o;y++){var v=r*y,w=g*Math.cos(v),v=g*Math.sin(v);d.x=w,d.y=v,d.z=h[1],(0,R.Scene.extend2Earth)(d,t,T)?(f.push(u),a.push(w,v,h[1]),s.push(m/15,1),u++):f.push(-1)}c.push(f)}for(var _,C,P=[0,c.length-1],x=0;x<P.length;x++)for(m=P[x],y=1;y<c[m].length;y++)_=c[m][y-1],C=c[m][y],0<=_&&0<=C&&l.push(0,_,C);a=new Float32Array(a),l=new Int32Array(l),s=new Float32Array(s),e={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:s})},i=R.BoundingSphere.fromVertices(a),n=new R.Geometry({attributes:e,indices:l,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:i});return(0,R.Scene.computeVertexNormals)(n),a=[],l=[],n},b.createOutlineGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,o=e.slices,r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=M;p.z=Math.sin(e);for(var m=Math.cos(e),g=0;g<u.length;g++){c[g]=[];for(var f=h[g],y=0;y<o;y++){c[g].push(d++);var v=r*y,w=f*Math.cos(v),_=f*Math.sin(v);a.push(w,_,u[g]),w=m*Math.cos(v),_=m*Math.sin(v),s.push(w,_,p.z),l.push(g/(u.length-1),0)}}for(var C=[],g=1;g<u.length;g++)for(y=1;y<o;y+=1){var P=c[g-1][y-1],x=c[g][y-1];c[g][y],c[g-1][y],y%8==1&&C.push(P,x)}C=new Int16Array(C),a=new Float32Array(a),s=new Float32Array(s),l=new Float32Array(l),n={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),normal:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:s}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:l})},i=R.BoundingSphere.fromVertices(a),t=new R.Geometry({attributes:n,indices:C,primitiveType:R.PrimitiveType.LINES,boundingSphere:i});return a=[],C=[],l=[],t},b.fromAngleAndLength=function(e,t,i){return e=R.Math.toRadians(e),new b({topRadius:Math.tan(e)*t/2,bottomRadius:0,length:t,zReverse:i})},R.Scene.CylinderGeometry=b},_installRadarPrimitive:function(){var i;function e(e,t){t=t||{},i=e.scene.globe.ellipsoid,this._geometry=null,this._angle=t.angle,this._radius=t.radius||5,this._position=t.position,this._rotation=t.rotation||{heading:0,pitch:0,roll:0},this._trackedEntity=t.trackedEntity,this.defaultColor=t.color||R.Color.YELLOW,this.defaultLineColor=t.lineColor||this.defaultColor,this._show=R.defaultValue(t.show,!0),this._outline=R.defaultValue(t.outline,!1),this._topShow=R.defaultValue(t.top,!0),this._topOutline=R.defaultValue(t.topOutline,!0),this._modelMatrix=R.Matrix4.clone(R.Matrix4.IDENTITY),this._quaternion=new R.Quaternion,this._translation=new R.Cartesian3,this._scale=new R.Cartesian3(1,1,1),this._matrix=new R.Matrix4,this._inverseMatrix=new R.Matrix4,this._positionCartographic=new R.Cartographic,this._positionCartesian=null,this._drawCommands=[],this._outlinePositions=[],this.viewer=e,this.viewer.scene.primitives.add(this),this.updateGeometry(),this._groundArea=R.defaultValue(t.groundArea,!1),this.addGroundAreaEntity(this._groundArea)}Object.defineProperties(e.prototype,{trackedEntity:{get:function(){return this._trackedEntity},set:function(e){this._trackedEntity=e}},color:{get:function(){return this.defaultColor},set:function(e){this.defaultColor=e}},lineColor:{get:function(){return this.defaultLineColor},set:function(e){this.defaultLineColor=e}},show:{get:function(){return this._show},set:function(e){this._show=e}},outline:{get:function(){return this._outline},set:function(e){this._outline=e,this.updateGeometry()}},top:{get:function(){return this._topShow},set:function(e){this._topShow=e,this.updateGeometry()}},topOutline:{get:function(){return this._topOutline},set:function(e){this._topOutline=e,this.updateGeometry()}},groundArea:{get:function(){return this._groundArea},set:function(e){this._groundArea=e,this.addGroundAreaEntity(this._groundArea)}},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this.updateGroundCircleRadius(),this.updateGeometry()}},radius:{get:function(){return this._radius},set:function(e){this._radius=e,this.updateGroundCircleRadius(),this.updateGeometry()}},heading:{get:function(){return this._rotation.heading},set:function(e){this._rotation.heading=e}},pitch:{get:function(){return this._rotation.pitch},set:function(e){this._rotation.pitch=e}},roll:{get:function(){return this._rotation.roll},set:function(e){this._rotation.roll=e}},position:{get:function(){return this._position},set:function(e){this._position=e}}}),e.prototype.updateGroundCircleRadius=function(){this._ground_radius=this._radius*Math.cos(R.Math.toRadians(this._angle))},e.prototype.addGroundAreaEntity=function(e){var t;e&&!this.groundAreaEntity&&((t=this).updateGroundCircleRadius(),this.groundAreaEntity=viewer.entities.add({position:this._position,ellipse:{show:0===this._rotation.pitch&&0===this._rotation.roll,semiMinorAxis:new R.CallbackProperty(function(e){return t._ground_radius},!1),semiMajorAxis:new R.CallbackProperty(function(e){return t._ground_radius},!1),material:this.defaultColor},polyline:{show:this._trackedEntityPosition&&(0!==this._rotation.pitch||0!==this._rotation.roll),positions:new R.CallbackProperty(function(e){return!t._trackedEntityPosition||R.Cartesian3.distance(t._position,t._trackedEntityPosition)>t._radius?[]:[t._position,t._trackedEntityPosition]},!1),followSurface:!1,material:new R.PolylineDashMaterialProperty({color:R.Color.CYAN}),width:1}}))};var n=new R.Cartesian3;e.prototype.computeMatrix=function(e,t){return this._positionCartesian||(this._positionCartesian=new R.Cartesian3),this.position instanceof R.Cartesian3?this._positionCartesian=this.position:"function"==typeof this.position.getValue?this._positionCartesian=this.position.getValue(e):this.position._value&&this.position._value instanceof R.Cartesian3&&(this._positionCartesian=this.position._value),this._trackedEntity&&this._trackedEntity.position&&(this._positionCartesian,e=R.Property.getValueOrUndefined(this._trackedEntity.position,e,n))&&(this._trackedEntityPosition=e,this._rotation.heading=0,this._rotation.pitch=40,this._rotation.roll=0),this._modelMatrix=R.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,i,this._modelMatrix),this._positionCartographic=R.Cartographic.fromCartesian(this._positionCartesian,i,this._positionCartographic),R.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,i,this._modelMatrix),R.Quaternion.fromHeadingPitchRoll(this._rotation,this._quaternion),this._matrix=R.Matrix4.fromTranslationQuaternionRotationScale(this._translation,this._quaternion,this._scale,this._matrix),R.Matrix4.multiplyTransformation(this._modelMatrix,this._matrix,this._matrix),R.Matrix4.inverseTransformation(this._matrix,this._inverseMatrix),this._matrix},e.prototype.getTopGeometry=function(){for(var e=this.radius,t=[],i=[],n=[],o=[],r=90-parseInt(this.angle),a=r<1?r/8:1,s=2*Math.PI/127,l=0,c=this.angle;c<91;c+=a){for(var h=R.Math.toRadians(c<90?c:90),h=Math.cos(h)*e,u=[],d=0;d<128;d++){var p=s*d,m=h*Math.cos(p),p=h*Math.sin(p),g=Math.sqrt(e*e-m*m-p*p);t.push(m,p,g),i.push(1,1),u.push(l++)}o.push(u)}for(c=1;c<o.length;c++)for(d=1;d<o[c].length;d++){var f=o[c-1][d-1],y=o[c][d-1],v=o[c][d],w=o[c-1][d];n.push(f,y,v),n.push(f,v,w)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),r={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:i})},_=R.BoundingSphere.fromVertices(t),r=new R.Geometry({attributes:r,indices:n,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:_});return(0,R.Scene.computeVertexNormals)(r),r},e.prototype.getTopOutlineGeometry=function(){for(var e=this.radius,t=[],i=[],n=[],o=[],r=90-parseInt(this.angle),a=r<1?r/8:1,s=2*Math.PI/127,l=0,c=this.angle;c<91;c+=a){for(var h=R.Math.toRadians(c<90?c:90),h=Math.cos(h)*e,u=[],d=0;d<128;d++){var p=s*d,m=h*Math.cos(p),p=h*Math.sin(p),g=Math.sqrt(e*e-m*m-p*p);t.push(m,p,g),i.push(1,1),u.push(l++)}o.push(u)}for(c=1;c<o.length;c++)for(d=1;d<o[c].length;d++){var f=o[c-1][d-1],y=o[c][d-1],v=o[c][d];o[c-1][d],d%8==1&&n.push(f,y),c%8==1&&n.push(y,v)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),r={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:i})},w=R.BoundingSphere.fromVertices(t),r=new R.Geometry({attributes:r,indices:n,primitiveType:R.PrimitiveType.LINES,boundingSphere:w});return(0,R.Scene.computeVertexNormals)(r),r},e.prototype.updateGeometry=function(){this._geometry=R.Scene.CylinderGeometry.createGeometry(new R.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(R.Math.toRadians(this.angle)),bottomRadius:0,length:this._radius*Math.sin(R.Math.toRadians(this.angle))})),this._topGeometry=this.getTopGeometry(),this._topOutlineGeometry=this.getTopOutlineGeometry(),this._outlineGeometry=R.Scene.CylinderGeometry.createOutlineGeometry(new R.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(R.Math.toRadians(this.angle)),bottomRadius:0,slices:128,length:this._radius*Math.sin(R.Math.toRadians(this.angle))})),this._positions=new Float32Array(this._geometry.attributes.position.values.length);for(var e=0;e<this._positions.length;e++)this._positions[e]=this._geometry.attributes.position.values[e];this._drawCommands&&this._drawCommands.length&&(this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy()}),this._drawCommands.splice(0,this._drawCommands.length))},e.prototype.update=function(t){this._show&&(this.computeMatrix(t.time),t.mode===R.SceneMode.SCENE3D?(this._geometry.boundingSphere=R.BoundingSphere.fromVertices(this._geometry.attributes.position.values),this._drawCommands&&this._drawCommands.length||(this._drawCommands.push(this.createDrawCommand(this._geometry,t)),this._outline&&this._drawCommands.push(this.createDrawCommand(this._outlineGeometry,t)),this._topShow&&(this._drawCommands.push(this.createDrawCommand(this._topGeometry,t)),this._topOutline)&&this._drawCommands.push(this.createDrawCommand(this._topOutlineGeometry,t))),this._drawCommands.forEach(function(e){t.commandList.push(e)}),this.groundAreaEntity&&(this.groundAreaEntity.ellipse.show=this._groundArea&&0===this._rotation.pitch&&0===this._rotation.roll,this.groundAreaEntity.polyline.show=!1)):(this.groundAreaEntity||this.addGroundAreaEntity(!0),this.groundAreaEntity.ellipse.show=0===this._rotation.pitch&&0===this._rotation.roll,this.groundAreaEntity.polyline.show=this._trackedEntityPosition&&(0!==this._rotation.pitch||0!==this._rotation.roll)))},e.prototype.getFragmentShaderSource=function(e){return"#version 300 es\n in vec3 v_position;\n in vec3 v_normal; \n uniform float picked; \n uniform vec4 pickedColor; \n uniform vec4 defaultColor; \n uniform float specular; \n uniform float shininess; \n uniform vec3 emission; \n in vec2 v_st; \n uniform bool isLine; \n uniform float glowPower; \n void main() { \n vec3 positionToEyeEC = -v_position; \n vec3 normalEC = normalize(v_normal); \n vec4 color = defaultColor; \n if (picked != 0.0) { \n color = pickedColor; \n } \n czm_material material; \n material.specular = specular; \n material.shininess = shininess; \n material.normal = normalEC; \n material.emission = emission;//vec3(0.2,0.2,0.2);\n material.diffuse = color.rgb ;\n if(isLine){\n material.alpha = 1.0; \n }\n else{ \n material.alpha = color.a; \n }\n if(v_st.x==0.0){ \n out_FragColor =color ;\n }else { \n out_FragColor = czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC) ; \n } \n }"},e.prototype.getVertexShaderSource=function(e){return"#version 300 es\n #ifdef GL_ES\n precision highp float;\n #endif\n\n in vec3 position;\n in vec2 st;\n in vec3 normal;\n uniform mat4 modelViewMatrix;\n uniform mat3 normalMatrix;\n uniform mat4 projectionMatrix;\n out vec3 v_position;\n out vec3 v_normal;\n out vec2 v_st;\n\n out vec3 v_light0Direction;\n\n void main(void) \n {\n vec4 pos = modelViewMatrix * vec4( position,1.0);\n v_normal = normalMatrix * normal;\n v_st = st;\n v_position = pos.xyz;\n v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);\n gl_Position = projectionMatrix * pos;\n }"},e.prototype.createDrawCommand=function(e,t,i){var n=t.context,o=new R.Cartesian3,o=(R.Matrix4.multiplyByPoint(this._matrix,e.boundingSphere.center,o),new R.BoundingSphere(o,e.boundingSphere.radius)),i=new R.DrawCommand({modelMatrix:i||this._matrix,owner:this,primitiveType:e.primitiveType,pass:R.Pass.TRANSLUCENT,boundingVolume:o}),r=this,o=R.GeometryPipeline.createAttributeLocations(e);return i.vertexArray=R.VertexArray.fromGeometry({context:n,geometry:e,attributeLocations:o,bufferUsage:R.BufferUsage.STATIC_DRAW}),i.vertexArray._attributeLocations=o,i.shaderProgram=R.ShaderProgram.replaceCache({context:n,vertexShaderSource:this.getVertexShaderSource(e),fragmentShaderSource:this.getFragmentShaderSource(e),attributeLocations:o}),i.renderState=R.RenderState.fromCache({blending:R.BlendingState.ALPHA_BLEND,depthTest:{enabled:!0,func:R.DepthFunction.LESS},cull:{enabled:!1,face:R.CullFace.BACK}}),i.uniformMap={},i.uniformMap.projectionMatrix=function(){return t.context.uniformState.projection},i.uniformMap.modelViewMatrix=function(){return t.context.uniformState.modelView},i.uniformMap.shininess=function(){return r.shininess||(r.shininess=0),r.shininess},i.uniformMap.emission=function(){return r.emission||(r.emission=new R.Cartesian3(.2,.2,.2)),r.emission},i.uniformMap.specular=function(){return r.specular||(r.specular=0),r.specular},i.uniformMap.isLine=function(){return e.primitiveType==R.PrimitiveType.LINES||e.primitiveType==R.PrimitiveType.LINE_STRIP},i.uniformMap.defaultColor=function(){return e.primitiveType==R.PrimitiveType.LINES||e.primitiveType==R.PrimitiveType.LINE_STRIP?(r.defaultLineColor||(r.defaultLineColor=new R.Color(1,1,0,1)),r.defaultLineColor):(r.defaultColor||(r.defaultColor=new R.Color(1,0,0,1)),r.defaultColor)},i.uniformMap.picked=function(){return r.picked||(r.picked=0),r.picked},i.uniformMap.pickedColor=function(){return r.pickedColor||(r.pickedColor=new R.Color(1,1,0,1)),r.pickedColor},i.uniformMap.normalMatrix=function(){return t.context.uniformState.normal},i.uniformMap.glowPower=function(){return.25},i},e.prototype.remove=function(){this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity)},e.prototype.addToScene=function(){this.viewer.scene.primitives.add(this),this.groundAreaEntity&&this.viewer.entities.add(this.groundAreaEntity)},e.prototype.destroy=function(e){e&&(this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity),this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy()}),this._drawCommands=[])},R.Scene.ConeSensorPrimitive=e},_installCounputeVertex:function(){var o=new R.Cartesian3,r=(new R.Ray,new R.Cartographic);R.Scene.computeVertexNormals=function(e){var t=e.indices,i=e.attributes,n=t.length;if(i.position){var o=i.position.values;if(void 0===i.normal)i.normal=new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(o.length)});else for(var r=i.normal.values,a=0;a<n;a++)r[a]=0;for(var s,l,c,h=i.normal.values,u=new R.Cartesian3,d=new R.Cartesian3,p=new R.Cartesian3,m=new R.Cartesian3,g=new R.Cartesian3,a=0;a<n;a+=3)s=3*t[a+0],l=3*t[a+1],c=3*t[a+2],R.Cartesian3.fromArray(o,s,u),R.Cartesian3.fromArray(o,l,d),R.Cartesian3.fromArray(o,c,p),R.Cartesian3.subtract(p,d,m),R.Cartesian3.subtract(u,d,g),R.Cartesian3.cross(m,g,m),h[s]+=m.x,h[1+s]+=m.y,h[2+s]+=m.z,h[l]+=m.x,h[1+l]+=m.y,h[2+l]+=m.z,h[c]+=m.x,h[1+c]+=m.y,h[2+c]+=m.z;for(var f,y,v,w,_=e.attributes.normal.values,C=0;C<_.length;C+=3)f=_[C],y=_[C+1],v=_[C+2],w=1/Math.sqrt(f*f+y*y+v*v),_[C]=f*w,_[C+1]=y*w,_[C+2]=v*w;i.normal.needsUpdate=!0}return e},R.Scene.extend2Earth=function(e,t,i,n){n=n||R.Ellipsoid.WGS84,R.Matrix4.multiplyByPoint(t,e,o),R.Cartesian3.subtract(o,i.origin,i.direction),R.Cartesian3.normalize(i.direction,i.direction);t=R.IntersectionTests.rayEllipsoid(i,n),n=null;if(n=t?R.Ray.getPoint(i,t.start):n)try{R.Cartographic.fromCartesian(n,null,r)}catch(e){return null}return n}}};let G={};function F(e,t){if(t){new O(e,G=t);const i=new I(t),n=new D(t),r=new z(t,i);G.Scene.RectangularSensorPrimitive=i,G.Scene.RectangularSensorGraphics=n,G.Scene.RectangularSensorVisualizer=r;var e=G.DataSourceDisplay,o=e.defaultVisualizersCallback;e.defaultVisualizersCallback=function(e,t,i){var n=i.entities;return o(e,t,i).concat([new r(e,n)])}}}let B=null;function H(e,t){e&&(this._viewer=e,B=t,this._customPluginLayer=new B.CustomDataSource("_customPluginLayer"),new F(e,t),e)&&e.dataSources.add(this._customPluginLayer)}H.prototype={createRectangularSensorGraphics:function(e){var t,i;if(this._customPluginLayer&&e)return t=new B.HeadingPitchRoll(B.Math.toRadians(e.heading||90),B.Math.toRadians(e.pitch||0),B.Math.toRadians(e.roll||0)),i=e.position,this._customPluginLayer.entities.add({position:i,orientation:B.Transforms.headingPitchRollQuaternion(i,t),rectangularSensor:new B.Scene.RectangularSensorGraphics({radius:e.radius||1e5,xHalfAngle:B.Math.toRadians(e.xHalfAngle||45),yHalfAngle:B.Math.toRadians(e.yHalfAngle||45),material:e.material||new B.Color(1,0,1,.4),lineColor:e.lineColor||new B.Color(1,0,1,1),showScanPlane:this._objHasOwnProperty(e,"showScanPlane",!0),showSectorLines:this._objHasOwnProperty(e,"showSectorLines",!0),showLateralSurfaces:this._objHasOwnProperty(e,"showLateralSurfaces",!0),modelMatrix:e.modelMatrix||new B.Matrix4,scanPlaneColor:e.scanPlaneColor||new B.Color(1,0,1,1),scanPlaneMode:e.scanPlaneMode||"vertical",scanPlaneRate:e.scanPlaneRate||3,showThroughEllipsoid:this._objHasOwnProperty(e,"showThroughEllipsoid",!1),show:this._objHasOwnProperty(e,"show",!0)})})},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e.field:i,createSatelliteCoverageSimulationGraphics:function(e){if(e)return new B.Scene.SatelliteCoverageSimulation(this._viewer,{position:e.position,angle1:e.angle1||30,angle2:e.angle2||45,areaType:e.areaType||2,rotation:{heading:B.Math.toRadians(e.heading||0),pitch:B.Math.toRadians(e.pitch||0),roll:B.Math.toRadians(e.roll||0)},color:e.color||{red:.43137254901960786,green:.9607843137254902,blue:0,alpha:.8}})},createRadarPrimitive:function(e){if(e)return new B.Scene.ConeSensorPrimitive(this._viewer,{position:e.position,angle:e.angle||80,radius:e.radius||7e5,rotation:{heading:B.Math.toRadians(e.heading||0),pitch:B.Math.toRadians(e.pitch||40),roll:B.Math.toRadians(e.roll||0)},color:e.color||{red:1,green:0,blue:0,alpha:.4},lineColor:e.lineColor||{red:1,green:1,blue:1,alpha:.9}})}};let W,V,U=null,N={},j="move",Y=null;function X(e,t){e&&(this._viewer=e,Y=e,U=t,this._installFileDragDropHandler())}X.prototype={_installFileDragDropHandler(){function i(e,t){var i=document.createElement("div");i.id="fileDragDrop",i.classList.add("filedragdrop"),i.innerHTML="请将Json文件拖拽到此区域",this._dragBox=i,this._viewer=t,(this._parentDiv=e).appendChild(i),this.fileDragDropCallBack=void 0,this.callBackParms=void 0}i.prototype.startuploadfile=function(){var i=this,e=i._dragBox,t=null;document.ondragover=function(){clearTimeout(t),t=setTimeout(function(){e.innerHTML="请将文件拖拽到此区域"},200)},e.ondragenter=function(){e.innerHTML="请释放鼠标"},e.ondragover=function(){return!1},e.ondragleave=function(){e.innerHTML="请将文件拖拽到此区域"},e.ondrop=function(e){e.preventDefault();var e=e.dataTransfer.files[0],t=new FileReader;return t.readAsText(e,"UTF-8"),t.onload=function(){var e=JSON.parse(this.result);i.fileDragDropCallBack&&i.fileDragDropCallBack(i.callBackParms,e,i._viewer)},t.onloadstart=function(){},t.onloadend=function(){},t.onabort=function(){alert("读取数据中断")},!(t.onerror=function(){alert("读取数据失败")})}},U.Scene.FileDragDropMixin=function(e){var t=new i(document.querySelector(".cesium-viewer"),e);Object.defineProperties(e,{fileDragDropMixin:{get:function(){return t}}})}},showLoadDataToScenePanel(e){if(e=e||{}){let e=new i,o=this._viewer,t=e.addFolder("加载数据文件"),n=e=>{let t=document.createElement("input");t.type="file",t.className="datgui_upload",t.onchange=function(){"function"==typeof e&&t.files.length&&e(URL.createObjectURL(t.files[0]))},document.getElementsByTagName("body")&&document.getElementsByTagName("body")[0].appendChild(t),t.click()},r={point:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.point={color:U.Color.BLUE}}o.flyTo(e)})})},polyline:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.polyline.width=5,n.polyline.material=new U.PolylineGlowMaterialProperty({glowPower:.1,color:U.Color.ORANGERED.withAlpha(.9)})}o.flyTo(e)})})},polygon:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.polygon.width=10,n.polygon.material=U.Color.BLUE.withAlpha(.9)}o.flyTo(e)})})},model:()=>{n(e=>{o.flyTo(d3kit.createModelGraphics({position:U.Cartesian3.fromDegrees(120.38105869,31.10115627),m_url:e}))})},czml:()=>{n(e=>{o.flyTo(o.dataSources.add(U.CzmlDataSource.load(e)))})},"3dtilset":()=>{n(e=>{o.flyTo(o.scene.primitives.add(new U.Cesium3DTileset({url:e})))})}};t.add(r,"point"),t.add(r,"polyline"),t.add(r,"polygon"),t.add(r,"model"),t.add(r,"czml"),t.add(r,"3dtilset"),t.open()}},showPostProcessStagesPanel(e){e=e||{};let t=null,n=new function(){this.blackAndWhiteShow=!1,this.blackAndWhiteGradations=5,this.brightnessShow=!1,this.brightnessValue=.5,this.nightVisionShow=!1,this.silhouette=!1},o=(e&&e.elementId?(t=new i({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new i,this._viewer.scene.postProcessStages),r=o.add(U.PostProcessStageLibrary.createSilhouetteStage()),a=o.add(U.PostProcessStageLibrary.createBlackAndWhiteStage()),s=o.add(U.PostProcessStageLibrary.createBrightnessStage()),l=o.add(U.PostProcessStageLibrary.createNightVisionStage());r.uniforms.color=e.silhouetteColor||U.Color.YELLOW,r.enabled=!1,a.enabled=!1,a.uniforms.gradations=5,s.enabled=!1,s.uniforms.brightness=.5,l.enabled=!1,t.add(n,"blackAndWhiteShow").name("blackAndWhiteShow").onChange(function(e){a.enabled=e}),t.add(n,"blackAndWhiteGradations",0,10,.1).name("blackAndWhiteGradations").onChange(function(e){a.uniforms.gradations=e}),t.add(n,"brightnessShow").name("brightnessShow").onChange(function(e){s.enabled=e}),t.add(n,"brightnessValue",0,10,.1).name("brightnessValue").onChange(function(e){s.uniforms.brightness=e}),t.add(n,"nightVisionShow").name("nightVisionShow").onChange(function(e){l.enabled=e}),t.add(n,"silhouette").name("silhouette").onChange(function(e){r.enabled=e})},showSceneBloomPanel(e){let t=null,n=new function(){this.contrast=128,this.brightness=-.3,this.delta=1,this.gamma=3.5,this.enabled=!1,this.highDynamicRange=!1,this.shadows=!1,this.glowOnly=!1,this.sigma=1,this.stepSize=5},o=(e&&e.elementId?(t=new i({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new i,this._viewer),r=(t.__closeButton.innerHTML="收缩面板",o.scene.postProcessStages.bloom);t.add(n,"enabled").name("bloom").onChange(function(e){r.enabled=e}),t.add(n,"glowOnly").name("发光").onChange(function(e){r.uniforms.glowOnly=e}),t.add(n,"enabled").name("启用模糊").onChange(function(e){r.enabled=e}),t.add(n,"contrast",-255,255,.01).name("对比度").onChange(function(e){r.uniforms.contrast=e}),t.add(n,"brightness",-1,1,.01).name("光泽亮度").onChange(function(e){r.uniforms.brightness=e}),t.add(n,"delta",1,5,.01).name("因子").onChange(function(e){r.uniforms.delta=e}),t.add(n,"sigma",1,10,.01).name("sigma").onChange(function(e){r.uniforms.sigma=e}),t.add(n,"stepSize",.1,10).name("stepSize").onChange(function(e){r.uniforms.stepSize=e}),t.add(n,"shadows").name("启用阴影").onChange(function(e){o.shadows=e}),t.add(n,"highDynamicRange").name("高动态范围").onChange(function(e){o.scene.highDynamicRange=e}),t.add(n,"gamma",1,10,.01).name("伽马亮度").onChange(function(e){o.scene.gamma=e})},showPrimitiveMatrixPanel(t){let n=t.primitives._delegate||t.primitives,o=t.primitives,e=(this._viewer,null);t&&t.elementId?(e=new i({autoPlace:!1}),document.getElementById(t.elementId).appendChild(e.domElement)):e=new i;var r=e.addFolder("离地高度"),r=(r.add({height:100},"height",0,1e3,1).onChange(function(e){var t=o.boundingSphere,t=U.Cartographic.fromCartesian(t.center),i=U.Cartesian3.fromRadians(t.longitude,t.latitude,0),t=U.Cartesian3.fromRadians(t.longitude,t.latitude,e),e=U.Cartesian3.subtract(t,i,new U.Cartesian3);o.modelMatrix=U.Matrix4.fromTranslation(e)}),r.open(),e.addFolder("缩放大小")),a={"m+Scale":()=>{n.readyPromise.then(e=>{var t=e.root.transform;U.Matrix4.multiplyByUniformScale(t,1.2,t),e.root.transform=t})},"m-Scale":()=>{n.readyPromise.then(e=>{var t=e.root.transform;U.Matrix4.multiplyByUniformScale(t,.8,t),e.root.transform=t})}},a=(r.add(a,"m+Scale"),r.add(a,"m-Scale"),r.open(),{"x+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(20,0,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"x-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(-20,0,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"y+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,20,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"y-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,-20,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"z+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,0,20));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"z-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,0,-20));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)}}),r=e.addFolder("矩阵平移");r.add(a,"x+Axis"),r.add(a,"x-Axis"),r.add(a,"y+Axis"),r.add(a,"y-Axis"),r.add(a,"z+Axis"),r.add(a,"z-Axis"),r.open();let s={x:0,y:0,z:0},l={"x+Axis":()=>{s.x+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationX(U.Math.toRadians(s.x)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"x-Axis":()=>{s.x-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationX(U.Math.toRadians(s.x)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"y+Axis":()=>{s.y+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationY(U.Math.toRadians(s.y)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"y-Axis":()=>{s.y-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationY(U.Math.toRadians(s.y)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"z+Axis":()=>{s.z+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationZ(U.Math.toRadians(s.z)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"z-Axis":()=>{s.z-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationZ(U.Math.toRadians(s.z)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})}},c=e.addFolder("旋转矩阵");c.add(l,"x+Axis"),c.add(l,"x-Axis"),c.add(l,"y+Axis"),c.add(l,"y-Axis"),c.add(l,"z+Axis"),c.add(l,"z-Axis"),c.open(),t.cb&&((a=e.addFolder("获取调整后的模型矩阵")).add({getModelMaterix:()=>{n.readyPromise.then(e=>{e=e.root.transform;t.cb({modelTransformMatrix:U.Matrix4.toArray(e),modelMatrix:U.Matrix4.toArray(o.modelMatrix)})})}},"getModelMaterix").name("获取模型矩阵"),a.open()),e.__closeButton.innerHTML="收缩面板"},showLayerParamPanel:function(t,n){if(t){let e=null;n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i;var n=new function(){this.alpha=t.alpha,this.brightness=t.brightness,this.contrast=t.contrast,this.gamma=t.gamma,this.hue=t.hue,this.dayAlpha=t.dayAlpha,this.nightAlpha=t.nightAlpha,this.saturation=t.saturation},o=e.addFolder("图层调整");o.add(n,"alpha",0,1,.05).name("透明度").onChange(function(e){t.alpha=e}),o.add(n,"brightness",0,5,.05).name("亮度").onChange(function(e){t.brightness=e}),o.add(n,"contrast",0,5,.05).name("对比").onChange(function(e){t.contrast=e}),o.add(n,"gamma",0,5,.05).name("伽马").onChange(function(e){t.gamma=e}),o.add(n,"hue",0,5,.05).name("色调").onChange(function(e){t.hue=e}),o.add(n,"dayAlpha",0,1,.05).name("白天透明").onChange(function(e){t.dayAlpha=e}),o.add(n,"nightAlpha",0,1,.05).name("夜晚透明").onChange(function(e){t.nightAlpha=e}),o.add(n,"saturation",0,5,.05).name("饱和").onChange(function(e){t.saturation=e}),o.open()}},showLayerSwitchPanel:function(t,n,o){if(t&&t.length){let e=null;n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i;var r=new function(){t.forEach(e=>{this[e.id]=e.show})},a=e.addFolder("图层切换"),s=(t.forEach(t=>{a.add(r,t.id).name(t.name).onChange(function(e){t.show=e,o&&o({key:t.id,val:e})})}),new function(){t.forEach(e=>{this[e.id]=e.alpha})}),l=e.addFolder("透明度");t.forEach(t=>{l.add(s,t.id,0,1,.05).name(t.name).onChange(function(e){t.alpha=e})}),a.open(),l.open()}},showSceneEffectEditPanel:function(e){var t,n,o;e=e||{},i&&this._viewer.scene.colorCorrection&&(o=new i,(t=this._viewer).scene.lightSource.ambientLightColor=e.ambientLightColor||new U.Color(.3,.3,.3,1),t.scene.colorCorrection.show=e.colorCorrection||!1,t.scene.colorCorrection.saturation=e.saturation||3.1,t.scene.colorCorrection.brightness=e.brightness||1.8,t.scene.colorCorrection.contrast=e.contrast||1.2,t.scene.colorCorrection.hue=e.hue||0,t.scene.bloomEffect.show=e.bloomEffect||!1,t.scene.hdrEnabled=e.hdrEnabled||!0,t.scene.bloomEffect.threshold=e.threshold||1,t.scene.bloomEffect.bloomIntensity=e.bloomIntensity||2,n=new function(){this.bloomEffectShow=e.bloomEffect||!1,this.bloomThreshold=e.threshold||1,this.bloomIntensity=e.bloomIntensity||2,this.ambientLightColor=e.ambientLightColor||.3,this.hdrEnabled=e.hdrEnabled||!0,this.colorCorrectionShow=!1,this.colorCorrectionSaturation=e.saturation||3.1,this.colorCorrectionBrightness=e.brightness||1.8,this.colorCorrectionContrast=e.contrast||1.2,this.colorCorrectionHue=e.hue||0},(o=o.addFolder("场景效果")).add(n,"bloomEffectShow").name("泛光开关").onChange(function(e){t.scene.bloomEffect.show=e,t.scene.bloomEffect.threshold=n.bloomThreshold,t.scene.bloomEffect.bloomIntensity=n.bloomIntensity}),o.add(n,"bloomThreshold",0,1,.1).name("泛光阈值").onChange(function(e){t.scene.bloomEffect.threshold=e}),o.add(n,"bloomIntensity",0,10,.1).name("泛光强度").onChange(function(e){t.scene.bloomEffect.bloomIntensity=e}),o.add(n,"hdrEnabled").name("HDR开关").onChange(function(e){t.scene.hdrEnabled=e}),o.add(n,"colorCorrectionShow").name("颜色校正").onChange(function(e){t.scene.colorCorrection.show=e}),o.add(n,"colorCorrectionSaturation",0,5,.1).name("饱和度").onChange(function(e){t.scene.colorCorrection.saturation=e}),o.add(n,"colorCorrectionBrightness",0,5,.1).name("亮度").onChange(function(e){t.scene.colorCorrection.brightness=e}),o.add(n,"colorCorrectionContrast",0,5,.1).name("对比度").onChange(function(e){t.scene.colorCorrection.contrast=e}),o.add(n,"colorCorrectionHue",0,5,.1).name("色调").onChange(function(e){t.scene.hdrEnabled=e}),o.add(n,"colorCorrectionHue",0,1,.1).name("环境光").onChange(function(e){t.scene.lightSource.ambientLightColor=new U.Color(e,e,e,1)}),o.open())},showEntityOrientationEditPanel:function(n={}){if(n.entity){let t=n.entity;var e=new i,o=(n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i,new function(){this.heading=360,this.pitch=1,this.roll=1}),e=e.addFolder("实体姿态调整"),r=this;e.add(o,"heading",0,360,1).name("角度").onChange(function(e){o.heading=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.add(o,"pitch",0,360,1).name("航向").onChange(function(e){o.pitch=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.add(o,"roll",0,360,1).name("翻转").onChange(function(e){o.roll=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.open()}},definedMouseEvent({targetEntity:e,ctrlFlag:t}){V=e,N=t,this.bindHandelEvent({leftDown:this.defLeftDown,mouseMove:this.defMouseMove,mouseWheel:this.defMouseWheel,leftUp:this.defLeftUp})},defMouseMove(t){if(N.leftDown&&W){let e=Y.camera.getPickRay(t.endPosition),o=Y.scene.globe.pick(e,Y.scene);if(document.body.style.cursor="pointer",W&&W.id&&"move"===j){let e=U.JulianDate.fromDate(new Date),t=V.position.getValue(e),i=U.Cartographic.fromCartesian(t),n=Number(i.height.toFixed(3));V.position=new U.CallbackProperty(()=>{var e=Y.scene.globe.ellipsoid.cartesianToCartographic(o),t=U.Math.toDegrees(e.longitude),e=U.Math.toDegrees(e.latitude);return U.Cartesian3.fromDegrees(t,e,n)},!1)}else{var i,n,r;W&&W.id&&"rotate"===j&&(n=U.JulianDate.fromDate(new Date),n=V.position.getValue(n),r=Y.scene.camera.pickEllipsoid(t.startPosition),t=Y.scene.camera.pickEllipsoid(t.endPosition),i=U.Cartesian3.subtract(n,t,new U.Cartesian3),i=U.Cartesian3.normalize(i,new U.Cartesian3),r=U.Cartesian3.subtract(r,n,new U.Cartesian3),t=U.Cartesian3.subtract(t,n,new U.Cartesian3),n=U.Cartesian3.angleBetween(r,t),r=U.Quaternion.fromAxisAngle(i,100*n),V.orientation=r)}}},defLeftDown(e){W=Y.scene.pick(e.position),U.defined(W)&&j?(N.selected=!0,N.leftDown=!0):N.selected=!1},defMouseWheel(n){if(W&&W.id&&"scale"===j){let e=U.JulianDate.fromDate(new Date),t=V.box.dimensions.getValue(e),i=0<n?2:.5;V.box.dimensions=new U.CallbackProperty(()=>U.Cartesian3.multiplyByScalar(t,i,new U.Cartesian3),!1)}},defLeftUp(e){N.leftDown=!1,document.body.style.cursor="default"},manualMoveModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableRotate=!1,this._viewer.scene.screenSpaceCameraController.enableZoom=!0},manualRotateModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableRotate=!1,this._viewer.scene.screenSpaceCameraController.enableZoom=!0},manualScaleModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableZoom=!1}};let q=null;var Z=3.141592653589793,J=6378245,Q=.006693421622965943;function K(e,t,i){e&&(this._viewer=e,q=t,this._queryRouteKey="8dc49b1fa65a79d306ef12dae4229842",this._pluginLayer=new q.CustomDataSource("pluginLayer"),e&&e.dataSources.add(this._pluginLayer),this._installPlugin())}K.routeQueryType={DRIVE:"drive",WALK:"walk",CYCLE:"cycle"},K.prototype={_installPlugin:function(){this._installCss3Renderer(),this._installTerrainClipPlan()},_installTerrainClipPlan:function(){function e(e,t){this.viewer=e,this.options=t||{},this._positions=t.positions,this._height=this.options.height||0,this.bottomImg=t.bottomImg,this.wallImg=t.wallImg,this.splitNum=q.defaultValue(t.splitNum,50),this._positions&&0<this._positions.length&&this.updateData(this._positions)}Object.defineProperties(e.prototype,{show:{get:function(){return this._show},set:function(e){this._show=e,this.viewer.scene.globe.clippingPlanes&&(this.viewer.scene.globe.clippingPlanes.enabled=e),this._switchExcavate(e)}},height:{get:function(){return this._height},set:function(e){this._height=e,this._updateExcavateDepth(e)}}}),e.prototype.updateData=function(e){var t=[],i=e.length-1,n=new q.Cartesian3,o=0<q.Cartesian3.subtract(e[0],e[1],n).x;this.excavateMinHeight=9999;for(var r=0;r<i;r++){var a=(r+1)%i,s=q.Cartesian3.midpoint(e[r],e[a],new q.Cartesian3),l=q.Cartographic.fromCartesian(e[r]),l=this.viewer.scene.globe.getHeight(l)||l.height;l<this.excavateMinHeight&&(this.excavateMinHeight=l);l=q.Cartesian3.normalize(s,new q.Cartesian3),a=o?q.Cartesian3.subtract(e[r],s,new q.Cartesian3):q.Cartesian3.subtract(e[a],s,new q.Cartesian3),a=(a=q.Cartesian3.normalize(a,a),q.Cartesian3.cross(a,l,new q.Cartesian3)),a=q.Cartesian3.normalize(a,a),l=new q.Plane(a,0),l=q.Plane.getPointDistance(l,s);t.push(new q.ClippingPlane(a,l))}this.viewer.scene.globe.clippingPlanes=new q.ClippingPlaneCollection({planes:t,edgeWidth:1,edgeColor:q.Color.WHITE,enabled:!0}),this._prepareWell(e),this._createWell(this.wellData)},e.prototype.clear=function(){this.viewer.scene.globe.clippingPlanes&&(this.viewer.scene.globe.clippingPlanes.enabled=!1,this.viewer.scene.globe.clippingPlanes.removeAll(),this.viewer.scene.globe.clippingPlanes.isDestroyed()||this.viewer.scene.globe.clippingPlanes.destroy()),this.viewer.scene.globe.clippingPlanes=void 0,this.bottomSurface&&this.viewer.scene.primitives.remove(this.bottomSurface),this.wellWall&&this.viewer.scene.primitives.remove(this.wellWall),delete this.bottomSurface,delete this.wellWall,this.viewer.scene.render()},e.prototype._prepareWell=function(e){var t=this.splitNum,i=e.length;if(0!=i){for(var n=this.excavateMinHeight-this.height,o=[],r=[],a=[],s=0;s<i;s++){var l=s==i-1?0:s+1,c=q.Cartographic.fromCartesian(e[s]),l=q.Cartographic.fromCartesian(e[l]),h=[c.longitude,c.latitude],u=[l.longitude,l.latitude];0==s&&(a.push(new q.Cartographic(h[0],h[1])),r.push(q.Cartesian3.fromRadians(h[0],h[1],n)),o.push(q.Cartesian3.fromRadians(h[0],h[1],0)));for(var d=1;d<=t;d++){var p=q.Math.lerp(h[0],u[0],d/t),m=q.Math.lerp(h[1],u[1],d/t);s==i-1&&d==t||(a.push(new q.Cartographic(p,m)),r.push(q.Cartesian3.fromRadians(p,m,n)),o.push(q.Cartesian3.fromRadians(p,m,0)))}}this.wellData={lerp_pos:a,bottom_pos:r,no_height_top:o}}},e.prototype._createWell=function(r){var a;this.viewer.terrainProvider._layers?((a=this)._createBottomSurface(r.bottom_pos),q.sampleTerrainMostDetailed(this.viewer.terrainProvider,r.lerp_pos).then(function(e){for(var t=e.length,i=[],n=0;n<t;n++){var o=q.Cartesian3.fromRadians(e[n].longitude,e[n].latitude,e[n].height);i.push(o)}a._createWellWall(r.bottom_pos,i)})):(this._createBottomSurface(r.bottom_pos),this._createWellWall(r.bottom_pos,r.no_height_top))},e.prototype._getMinHeight=function(t){let i=5e6,n=null;for(let e=0;e<t.length;e++){var o=t[e].z;o<i&&(i=o,n=this._ellipsoidToLonLat(t[e]))}return n.altitude},e.prototype._ellipsoidToLonLat=function(e){var t=this.viewer.scene.globe.ellipsoid,e=new q.Cartesian3(e.x,e.y,e.z),t=t.cartesianToCartographic(e),e=q.Math.toDegrees(t.latitude);return{longitude:q.Math.toDegrees(t.longitude),latitude:e,altitude:t.height}},e.prototype._createBottomSurface=function(t){if(t.length){var i=this._getMinHeight(t),n=[];for(let e=0;e<t.length;e++){var o=this._ellipsoidToLonLat(t[e]);n.push(o.longitude),n.push(o.latitude),n.push(i)}var e=new q.PolygonGeometry({polygonHierarchy:new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights(n)),perPositionHeight:!0}),e=q.PolygonGeometry.createGeometry(e),r=new q.Material({fabric:{type:"Image",uniforms:{image:this.bottomImg}}}),r=new q.MaterialAppearance({translucent:!1,flat:!0,material:r});this.bottomSurface=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e}),appearance:r,asynchronous:!1}),this.viewer.scene.primitives.add(this.bottomSurface)}},e.prototype._createWellWall=function(e,t){var i=this._getMinHeight(e),n=[],o=[];for(let e=0;e<t.length;e++)n.push(this._ellipsoidToLonLat(t[e]).altitude),o.push(i);var e=new q.WallGeometry({positions:t,maximumHeights:n,minimumHeights:o}),e=q.WallGeometry.createGeometry(e),r=new q.Material({fabric:{type:"Image",uniforms:{image:this.wallImg}}}),r=new q.MaterialAppearance({translucent:!1,flat:!0,material:r});this.wellWall=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e,attributes:{color:q.ColorGeometryInstanceAttribute.fromColor(q.Color.GREY)},id:"PitWall"}),appearance:r,asynchronous:!1}),this.viewer.scene.primitives.add(this.wellWall)},e.prototype._switchExcavate=function(e){e?(this.viewer.scene.globe.material=q.Material.fromType("WaJue"),this.wellWall.show=!0,this.bottomSurface.show=!0):(this.viewer.scene.globe.material=null,this.wellWall.show=!1,this.bottomSurface.show=!1)},e.prototype._updateExcavateDepth=function(e){this.bottomSurface&&this.viewer.scene.primitives.remove(this.bottomSurface),this.wellWall&&this.viewer.scene.primitives.remove(this.wellWall);for(var t=this.wellData.lerp_pos,i=[],n=t.length,o=0;o<n;o++)i.push(q.Cartesian3.fromRadians(t[o].longitude,t[o].latitude,this.excavateMinHeight-e));this.wellData.bottom_pos=i,this._createWell(this.wellData),this.viewer.scene.primitives.add(this.bottomSurface),this.viewer.scene.primitives.add(this.wellWall)},q.Scene.TerrainClipPlan=e},buildLightScanGraphics:function(e){if(this._viewer&&e){function t(t,e,i){var n,o,r,a,s,l,c=t.positionList,h=0,u=0;function d(e){n=c[e+1][0]-c[e][0],o=c[e+1][1]-c[e][1],r=n/t.number,a=o/t.number,u=0}d(h),e.polygon.hierarchy=new q.CallbackProperty(function(){return Math.abs(s)>=Math.abs(n)&&Math.abs(l)>=Math.abs(o)&&((h+=1)===c.length-1&&(h=0),i[0]=i[0]+s,i[1]=i[1]+l,i[2]=i[2]+s,i[3]=i[3]+l,d(h)),s=u*r,l=u*a,u++,new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([t.observer[0],t.observer[1],t.observer[2],i[0]+s,i[1]+l,0,i[2]+s,i[3]+l,0]))},!1)}for(var l=this,i=l._getCirclePoints(e.circle[0],e.circle[1],e.circle[2],e.circle[3]),n=function(e,t){for(var i=t.observer[0],n=t.observer[1],o=t.observer[2],r=[],a=0;a<e.length;a++){var s=a===e.length-1?new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,o,e[a].x,e[a].y,0,e[0].x,e[0].y,0])):new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,o,e[a].x,e[a].y,0,e[a+1].x,e[a+1].y,0])),s=l._pluginLayer.entities.add({name:"三角形",polygon:{hierarchy:s,outline:!1,perPositionHeight:!0,material:t.material}});r.push(s)}return r}(i,e),o=0;o<n.length;o++)o!==n.length-1?t(e,n[o],[i[o].x,i[o].y,i[o+1].x,i[o+1].y]):t(e,n[o],[i[o].x,i[o].y,i[0].x,i[0].y]);return n}},buildPathRoaming:function(e){if(this._viewer&&e&&e.paths){for(var t=e.paths,i=this.createGraphics(),n=[],o=0;o<t.length;o++){var r=q.Cartesian3.fromDegrees(Number(t[o].lng),Number(t[o].lat),Number(t[o].alt));n.push(r)}if(i.position=this._createSampledPosition(n),i.name=e.name||"路径漫游",i.availability=new q.TimeIntervalCollection([new q.TimeInterval({start:this.startTime,stop:this.stopTime})]),i.orientation=this._sampleOrientation(),e.polyline){const{width:t,material:o,clampToGround:r,...a}=e.polyline;i.polyline={positions:new q.CallbackProperty(function(){return n},!1),width:t||10,material:o||new q.PolylineGlowMaterialProperty({glowPower:1,color:q.Color.RED}),clampToGround:r||!0,resOpt:a}}return e.model&&(i.model=this.getModelGraphics(e.model)),e.label&&(i.label=this.getLabelGraphics(e)),e.billboard&&(i.billboard=this.getBillboardGraphics(e)),this.droneEntity=i,this._beginRoamTrace(e),this._viewer.entities.add(i)}},_beginRoamTrace(i){this._viewer.clock.onTick.addEventListener(()=>{var e,t;this._viewer.clock.shouldAnimate&&(t=this._viewer.clock.currentTime,e=this.droneEntity.position.getValue(t),t=this.droneEntity.orientation.getValue(t),e)&&t&&(t=q.Matrix4.fromRotationTranslation(q.Matrix3.fromQuaternion(t),e),this._viewer.camera.lookAtTransform(t,i.cameraOffset()))})},_createSampledPosition(t){this.startTime=q.JulianDate.now(),this.stopTime=q.JulianDate.addSeconds(this.startTime,60*t.length,new q.JulianDate),this._viewer.clock.startTime=this.startTime.clone(),this._viewer.clock.stopTime=this.stopTime.clone(),this._viewer.clock.currentTime=this.startTime.clone(),this._viewer.clock.clockRange=q.ClockRange.CLAMPED;var i=new q.SampledPositionProperty;for(let e=0;e<t.length;e++){var n=q.JulianDate.addSeconds(this.startTime,60*e,new q.JulianDate),o=t[e];i.addSample(n,o)}return i},_sampleOrientation(){let o,r,a;return new q.CallbackProperty(e=>{var t=this.droneEntity.position.getValue(e);if(r=this.droneEntity.position.getValue(q.JulianDate.addSeconds(e,1/60,new q.JulianDate)),t&&r){o=t;const e=q.Cartesian3.subtract(r,o,new q.Cartesian3),i=q.Cartesian3.normalize(e,new q.Cartesian3),n=q.Transforms.rotationMatrixFromPositionVelocity(o,i,q.Ellipsoid.WGS84);a=q.Quaternion.fromRotationMatrix(n)}return a},!1)},_installCss3Renderer:function(){function e(e,t){this._scratch=new q.Cartesian2,this._viewer=i,this._scene=i.scene,this._camera=i.camera,this._container=null,this._elements=e,this._isBackHide=t,this.init()}var i;this._viewer&&(i=this._viewer,e.prototype.init=function(){var o=document.createElement("div"),r=(o.className="ys-css3-container",document.getElementById("info-warp").appendChild(o),this._container=o,this._elements.forEach(function(e){o.insertAdjacentHTML("beforeend",e.element)}),this);this._scene.preRender.addEventListener(function(){for(var e=0;e<o.children.length;e++){var t,i=q.Cartesian3.fromDegrees(r._elements[e].position[0],r._elements[e].position[1],r._elements[e].position[2]||0),n=r._scene.cartesianToCanvasCoordinates(i,r._scratch);q.defined(n)&&(o.children[e].style.left=parseFloat(n.x)+parseFloat(r._elements[e].offset[0])+"px",o.children[e].style.top=parseFloat(n.y)+parseFloat(r._elements[e].offset[1])+"px",r._isBackHide)&&(n=r._camera.position,t=r._scene.globe.ellipsoid.cartesianToCartographic(n).height,t+=+r._scene.globe.ellipsoid.maximumRadius,q.Cartesian3.distance(n,i)>t?o.children[e].style.display="none":o.children[e].style.display="block")}})},e.prototype.remove=function(e){this._elements=this._elements.filter(function(e){e.id}),this._container.removeChild(document.getElementById(e))},e.prototype.append=function(e){this._elements.push(e),this._container.insertAdjacentHTML("beforeend",e.element)},e.prototype.removeEntityLayer=function(e){this._viewer.entities.removeById(e+"_1"),this._viewer.entities.removeById(e+"_2"),this._viewer.entities.removeById(e+"_3"),this.remove(e)},e.prototype.addEntityLayer=function(e){var t=e.position[0],i=e.position[1],n=this,o=(setTimeout(function(e){},300),q.Math.toRadians(30)),r=q.Math.toRadians(30),a=e.boxHeight||300,s=e.boxHeightMax||400,l=e.boxHeightDif||10,c=!0;e.boxShow?this._viewer.entities.add({id:e.id+"_1",name:"立方体盒子",position:new q.CallbackProperty(function(){return(a+=l)>=s&&(a=s),q.Cartesian3.fromDegrees(t,i,a/2)},!1),box:{dimensions:new q.CallbackProperty(function(){return(a+=l)>=s&&(a=s,c)&&(c=!1,n.append(e,!0)),new q.Cartesian3(e.boxSide||100,e.boxSide||100,a)},!1),material:e.boxMaterial||q.Color.DEEPSKYBLUE.withAlpha(.5)}}):setTimeout(function(){n.append(e,!0)},100),e.circleShow&&(e.circleSize=e.circleSize||120,this._viewer.entities.add({id:e.id+"_2",name:"椭圆",position:q.Cartesian3.fromDegrees(t,i),ellipse:{semiMinorAxis:new q.CallbackProperty(function(){return.001},!1),semiMajorAxis:new q.CallbackProperty(function(){return.001},!1),material:this.getDfSt(["plugin","Css3Renderer_one"])||"static/data/images/Textures/circle2.png",rotation:new q.CallbackProperty(function(){return o+=.05},!1),stRotation:new q.CallbackProperty(function(){return o+=.05},!1),zIndex:2}}),this._viewer.entities.add({id:e.id+"_3",name:"椭圆",position:q.Cartesian3.fromDegrees(t,i),ellipse:{semiMinorAxis:new q.CallbackProperty(function(){return.001},!1),semiMajorAxis:new q.CallbackProperty(function(){return.001},!1),material:this.getDfSt(["plugin","Css3Renderer_two"])||"static/data/images/Textures/circle1.png",rotation:new q.CallbackProperty(function(){return r-=.03},!1),stRotation:new q.CallbackProperty(function(){return r-=.03},!1),zIndex:3}}))},q.Scene.Css3Renderer=e)},transformJD(e,t){t=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return(t+=2*(20*Math.sin(6*e*Z)+20*Math.sin(2*e*Z))/3)+2*(20*Math.sin(e*Z)+40*Math.sin(e/3*Z))/3+2*(150*Math.sin(e/12*Z)+300*Math.sin(e/30*Z))/3},transformWD(e,t){var 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*Z)+20*Math.sin(2*e*Z))/3)+2*(20*Math.sin(t*Z)+40*Math.sin(t/3*Z))/3+2*(160*Math.sin(t/12*Z)+320*Math.sin(t*Z/30))/3},gcj2wgs(e){var t=Number(e[0]),e=Number(e[1]),i=this.transformWD(t-105,e-35),n=this.transformJD(t-105,e-35),o=e/180*Z,r=Math.sin(o),r=1-Q*r*r,a=Math.sqrt(r),i=180*i/(J*(1-Q)/(r*a)*Z),r=2*t-(t+180*n/(J/a*Math.cos(o)*Z)),t=2*e-(e+i);return[r=Number(r.toFixed(6)),t=Number(t.toFixed(6))]},wgs2gcj(e){var t=Number(e[0]),e=Number(e[1]),i=this.transformWD(t-105,e-35),n=this.transformJD(t-105,e-35),o=e/180*Z,r=Math.sin(o),r=1-Q*r*r,a=Math.sqrt(r),e=e+180*i/(J*(1-Q)/(r*a)*Z),i=t+180*n/(J/a*Math.cos(o)*Z);return[i=Number(i.toFixed(6)),e=Number(e.toFixed(6))]},transformData(s,l,e){for(var c=this,h=e.paths,u=[],t=0;t<h.length;t++)!function(e){for(var t=h[e],i=[],n=[],e=t.distance,o=0;o<t.steps.length;o++){var r=t.steps[o],a=t.steps[o].instruction;r.polyline.split(";").forEach(function(e){e=e.split(","),e=c.gcj2wgs(e),i.push([e[0],e[1]])}),n.push(a)}i.unshift(s),i.push(l),u.push({lnglats:i,instructions:n,distance:e})}(t);return u},_queryDrivingRoute(e,i,n,o){if((i=i||{}).origin)if(i.destination){var r=i.key||this._queryRouteKey,a=(delete i.key,i.origin),s=(s=this.wgs2gcj(a))[0]+","+s[1],l=(delete i.origin,i.destination),c=(c=this.wgs2gcj(l))[0]+","+c[1],h=(delete i.destination,"");if(i.avoidpolygons)for(var u=0;u<i.avoidpolygons.length;u++){for(var d=i.avoidpolygons[u],p="",m="",g=0;g<d.length;g++){var f=d[g];m+=(f=this.wgs2gcj(f))[0]+","+f[1]+",",0==g&&(p=f[0]+","+f[1])}m+=p,u==i.avoidpolygons.length-1?h+=m:h+=m+"|"}delete i.avoidpolygons;var y={key:r,origin:s,destination:c,strategy:0,avoidpolygons:h,show_fields:"polyline"},y=Object.assign(y,i||{}),v=this;let t="";Object.keys(y).map(e=>{t+=t?`&${e}=`+y[e]:`?${e}=`+y[e]}),fetch(e+t).then(function(e){return e.json()}).then(function(e){"1"!=e.status||"10000"!=e.infocode?(console.log("查询失败!"),o&&o(e)):(e=v.transformData(a,l,e.route),n&&n(e))})}else alert("缺少终点坐标!");else alert("缺少起点坐标!")},queryPathPlan(e,t,i,n){let o;e===K.routeQueryType.DRIVE?(o=t.url||"https://restapi.amap.com/v5/direction/driving",delete t.url,this._queryDrivingRoute(o,t,i,n)):e===K.routeQueryType.WALK?(o=t.url||"https://restapi.amap.com/v3/direction/walking",delete t.url,this._queryWalkCycleRoute(o,t,i,n)):e===K.routeQueryType.CYCLE?(o=t.url||"https://restapi.amap.com/v5/direction/bicycling",delete t.url,this._queryWalkCycleRoute(o,t,i,n)):alert("查询参数type 错误(walk:步行,cycle:骑行)!")},_queryWalkCycleRoute(e,i,n,o){if((i=i||{}).origin)if(i.destination){var r,a=i.key||this._queryRouteKey,s=(delete i.key,i.origin),l=(this.wgs2gcj(s),s[0]+","+s[1]),c=(delete i.origin,i.destination),h=(this.wgs2gcj(c),c[0]+","+c[1]),u=(delete i.destination,{key:a,origin:l,destination:h,show_fields:"polyline"}),u=Object.assign(u,i||{}),d=this;let t="";Object.keys(u).map(e=>{t+=t?`&${e}=`+u[e]:`?${e}=`+u[e]}),fetch(e+t).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("errcode")?0!=e.errcode||"OK"!=e.errmsg?(console.log("查询失败!",e.errdetail),o&&o(e)):(r=d.transformData(s,c,e.data),n&&n(r)):e.hasOwnProperty("status")?"1"!=e.status||"10000"!=e.infocode?(console.log("查询失败!",e.info),o&&o(e)):(r=d.transformData(s,c,e.route),n&&n(r)):(console.log("查询失败,未知错误!"),o&&o(e))})}else alert("缺少终点坐标!");else alert("缺少起点坐标!")}};let $=null;function ee(e,t,i){e&&($=t,this._analysisLayer=new $.CustomDataSource("analysisLayer"),f.prototype={...f.prototype,...p.prototype},s.prototype={...s.prototype,...p.prototype},this.$math3d=new f(e,t),this.$graphics=new s(e,t),e)&&e.dataSources.add(this._analysisLayer)}function te(e){if(e&&e.positions){var t=e.positions,i=e.that,n=[],e=[],o=[],r=i.transformWGS84ToCartesian(t[0]),t=i.transformWGS84ToCartesian(t[1]),n=i.$graphics.createPointsGraphics({point:!0,positions:[r,t]}),a=i.$math3d.getIntersectObj(r,t,n,!0);if(0===a.length)return alert("没有取到相交点 , 请检查是否开启深度检测。"),!1;for(let e=a.length-1;0<=e;e--){const l=a[e];$.defined(l.position)||a.splice(e,1)}if(!$.defined(a[0].position))throw new $.DeveloperError("position is undefined");var s=a[0].position,l=$.Cartesian3.distance(s,t)<5,s=[r,a[0].position],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:$.ArcType.NONE,material:new $.PolylineArrowMaterialProperty($.Color.GREEN)}});e.push(s),l||(s=[a[0].position,t],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:$.ArcType.NONE,material:new $.PolylineArrowMaterialProperty($.Color.RED)}}),e.push(s));for(let e=0;e<a.length;++e){var c,h=a[e].object;h&&(h instanceof $.Cesium3DTileFeature?(o.push(h),h.oldColor=h.color.clone(),h.color=$.Color.fromAlpha($.Color.YELLOW,h.color.alpha)):h.id instanceof $.Entity&&(c=(h=h.id).polygon||h.polyline,o.push(h),h=c.material.color.getValue(),c.oldColor=h.clone(),c.material=$.Color.fromAlpha($.Color.YELLOW,h.alpha))),n.push(i._analysisLayer.entities.add({position:a[e].position,ellipsoid:{radii:new $.Cartesian3(.8,.8,.8),material:$.Color.RED}}))}var s=$.Cartographic.fromCartesian(r),e=$.Cartographic.fromCartesian(t),s={longitude:s.longitude/Math.PI*180,latitude:s.latitude/Math.PI*180,height:s.height},e={longitude:e.longitude/Math.PI*180,latitude:e.latitude/Math.PI*180,height:e.height},r=Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2)+Math.pow(r.z-t.z,2)),t=Math.abs(e.height-s.height),u=Math.sqrt(Math.pow(r,2)+Math.pow(t,2)),l=l?"是":"否",s="起点坐标: ("+s.longitude.toFixed(6)+"°,"+s.latitude.toFixed(6)+"°,"+s.height.toFixed(2)+")\n终点坐标: ("+e.longitude.toFixed(6)+"°,"+e.latitude.toFixed(6)+"°,"+e.height.toFixed(2)+")\n垂直距离: "+t.toFixed(2)+"m\n水平距离: "+r.toFixed(2)+"m\n空间距离: "+u.toFixed(2)+"m\n是否可视: "+l;n&&n[0]&&(n[0].label={text:s,showBackground:!0,font:"14px monospace",fillColor:$.Color.YELLOW,pixelOffset:{x:0,y:-20},verticalOrigin:$.VerticalOrigin.BOTTOM,horizontalOrigin:$.HorizontalOrigin.LEFT})}te.prototype.remove=function(){}}function ie(e){if(!e&&!e.center&&!e.radius&&e.that)return alert("没有获取到分析参数"),!1;var l=e.that,t=this;if(!l._viewer.scene.globe.depthTestAgainstTerrain)return alert("请开启深度检测"),!1;var c=e.viewHeight||10,i=$.Cartographic.fromCartesian(e.center);try{var n=e.radius,o={},r=(o.semiMinorAxis=n,o.semiMajorAxis=n,o.rotation=0,o.center=e.center,o.granularity=Math.PI/30,l.computeEllipseEdgePositions(o));for(let e=0;e<r.outerPositions.length;e+=3){var a=new $.Cartesian3(r.outerPositions[e],r.outerPositions[e+1],r.outerPositions[e+2]),s=$.Cartographic.fromCartesian(a),h=5e-4*Math.PI/180,u=l.computeInterpolateLineCartographic(i,s,h);l.computeCartographicPointsTerrainData(u,function(r){if(0<r.length){let i=!0,n=[],o=[];for(let e=1;e<r.length;e++){let t=!0;if(1<e){var a=new $.Cartographic(r[0].longitude,r[0].latitude,r[0].height+c);if(i)t=l.computeInterpolateIndexLineHeightCartographic(a,r[e],e,e-1).height>=r[e-1].height?i=!0:i=!1;else{var s=l.computeInterpolateIndexLineHeightCartographic(a,r[e],e,e-1);for(let e=0;e<s.length;e++){if(!(s[e].height>=r[e].height)){i=!1,t=!1;break}i=!0,t=!0}}}a=$.Cartesian3.fromRadians(r[e].longitude,r[e].latitude,r[e].height+1);n.push(a),t?(o.push(0),o.push(0),o.push(1)):(o.push(1),o.push(0),o.push(0)),o.push(1)}t._pointsKSYResult=new $.Scene.PointsPrimitive({viewer:l._viewer,Cartesians:n,Colors:o})}else alert("高程异常!")})}}catch(e){console.log(e)}ie.prototype.remove=function(){}}function ne(e){if(e&&e.positions){for(var t=e.positions,i=e.that,o=i.transformWGS84ToCartesian(t[0]),r=i.transformWGS84ToCartesian(t[1]),a=[$.Cartographic.fromCartesian(o)],s=new $.Cartesian3,l=[0],c=[0],h=1;h<=10;h++){$.Cartesian3.lerp(o,r,h/10,s);var u=$.Cartographic.fromCartesian(s),d=i._viewer.scene.globe.getHeight(u),d=(u.height=d,a.push(u),a[h-1]),p=$.Cartesian3.distance($.Cartographic.toCartesian(d),$.Cartographic.toCartesian(u));c.push(c[h-1]+p),u=Math.asin((u.height-d.height)/p),l.push(100*Math.tan(u))}e=document.createElement("div"),t=(e.className="echart-viewer",i._viewer.container.appendChild(e,"dark",{renderer:"canvas",width:640,height:480}),e.style.position="absolute",e.style.left="20px",e.style.bottom="20px",e.style.height="300px",e.style.width="640px",e.style.overflow="hidden",e.style.zIndex="9999",{title:{text:"剖面示意图",left:"center",subtext:"",textStyle:{color:"white",fontSize:15}},tooltip:{trigger:"axis"},legend:{data:[""]},toolbox:{show:!(e.style.opacity=.9),feature:{mark:{show:!0},dataView:{show:!0,readOnly:!1},magicType:{show:!0,type:["line","bar"]},restore:{show:!0},saveAsImage:{show:!0}}},calculable:!0,xAxis:[{type:"category",name:"长度(米)",boundaryGap:!1,data:c,axisLabel:{textStyle:{color:"white"}},axisLine:{lineStyle:{color:"white"}}}],yAxis:[{type:"value",name:"坡度(%)",axisLabel:{formatter:function(e){return e.toFixed(2)+"%"},textStyle:{color:"white"}},axisLine:{lineStyle:{color:"white"}}}],series:[{name:"坡度",type:"line",areaStyle:{},smooth:!0,data:l,markPoint:{data:[{type:"max",name:"最大值"},{type:"min",name:"最小值"}]},markLine:{data:[{type:"average",name:"平均值"}]}}]});n.init(e).setOption(t)}}function re(e){if(e&&e.positions&&e.that){var t=e.that,e=e.positions,i=this;if(t._viewer.terrainProvider.availability){var n=Math.PI/Math.pow(2,11);n/=64;var o,r,a,s,l,c,h,u,n=new $.PolygonGeometry.fromPositions({positions:e,vertexFormat:$.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,granularity:n}),d=new $.PolygonGeometry.createGeometry(n),p=0,m=0,g=new $.Cartesian3;for(let e=0;e<d.indices.length;e+=3){h=d.indices[e],r=d.indices[e+1],l=d.indices[e+2],c=d.attributes.position.values,g.x=c[3*h],g.y=c[3*h+1],g.z=c[3*h+2],h=$.Cartographic.fromCartesian(g),o=t._viewer.scene.globe.getHeight(h),a=$.Cartesian3.fromRadians(h.longitude,h.latitude,o),u=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),m<o&&(m=o),g.x=c[3*r],g.y=c[3*r+1],g.z=c[3*r+2],h=$.Cartographic.fromCartesian(g),r=t._viewer.scene.globe.getHeight(h),s=$.Cartesian3.fromRadians(h.longitude,h.latitude,r),y=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),m<r&&(m=r),g.x=c[3*l],g.y=c[3*l+1],g.z=c[3*l+2],h=$.Cartographic.fromCartesian(g),c=t._viewer.scene.globe.getHeight(h),l=$.Cartesian3.fromRadians(h.longitude,h.latitude,c),m<c&&(m=c),u=u,y=y,h=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),u=((f=$.Cartesian3.distance(u,y))+(y=$.Cartesian3.distance(y,h))+(h=$.Cartesian3.distance(h,u)))/2,p+=Math.sqrt(u*(u-f)*(u-y)*(u-h))*(o-15e3+r-15e3+c-15e3)/3;var f=[],y=(f.push(a),f.push(s),f.push(l),{polygon:{hierarchy:{positions:f},extrudedHeight:0,perPositionHeight:!0,material:$.Color.fromRandom().withAlpha(.5),outline:!0,closeTop:!0,closeBottom:!0,outlineColor:$.Color.WHITE,outlineWidth:2}});t._analysisLayer.entities.add(y)}n=function(e){for(var t=[],i=[],n=0;n<e.length;n++){var o=$.Cartographic.fromCartesian(e[n]);t.push(o.longitude),i.push(o.latitude)}for(var r,a,s,l=0,c=0,h=0,u=0,d=0,n=0;n<e.length;n++)h+=s=(r=t[n])*(c=n==e.length-1?(l=t[0],i[0]):(l=t[n+1],i[n+1]))-l*(a=i[n]),u+=(r+l)*s,d+=(a+c)*s;return u/=6*(h*=.5),d/=6*h,new $.Cartographic(u,d)}(e),i._volumeLabel=t._analysisLayer.entities.add({position:$.Cartesian3.fromRadians(n.longitude,n.latitude,m+1e3),label:{text:"Cut Volume "+p.toString()+"m3"}})}else alert("未获取到地形")}}ee.prototype={createVisibilityAnalysis:function(i){i=i||{};var n=this;n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new te({positions:e,that:n});n._graphicsLayer&&n._graphicsLayer.entities.remove(t),"function"==typeof i.callback&&i.callback(e)}})},createLookAroundAnalysis:function(i){var n;i=i||{},this._viewer&&i&&(n=this).drawCircleGraphics({callback:function(e,t){n._drawLayer.entities.remove(t);t=new ie({that:n,radius:e.radius,center:e.center});"function"==typeof i.callback&&i.callback(t)}})},createVisualFieldAnalysis:function(e){var i,n;e=e||{},this._viewer&&e&&(n=null,(i=this).bindHandelEvent({leftClick:function(e,t){e=i._viewer.scene.pickPosition(e.position);if(!e)return!1;$.defined(n)?t.destroy():(n=new $.Scene.ShadowPrimitive({scene:i._viewer.scene,viewerPosition:e}),i._analysisLayer._primitives.add(n))},mouseMove:function(e){e=i._viewer.scene.pickPosition(e.endPosition);if(!e)return!1;n&&n.setPoseByTargetPoint(e)}}))},createClipPlanAnalysis:function(i){var n,o,r,a,s;i=i||{},this._viewer&&i&&(n=this,o=i.height||30,r=i.splitNum||50,a=i.wallImg||this.getDfSt(["amalysis","createClipPlanAnalysis_wallImg"])||"static/data/images/file/excavate_side_min.jpg",s=i.bottomImg||this.getDfSt(["amalysis","createClipPlanAnalysis_bottomImg"])||"static/data/images/file/excavate_bottom_min.jpg",n.drawPolygonGraphics({callback:function(e,t){n._drawLayer.entities.remove(t);t=new $.Scene.TerrainClipPlan(n._viewer,{height:o,splitNum:r,wallImg:a,bottomImg:s}),e=n.transformWGS84ArrayToCartesianArray(e);t.updateData(e),"function"==typeof i.callback&&i.callback(t)}}))},createSubmergedAnalysis:function(e){var t,n,o,r,a;e=e||{},this._viewer&&e&&(t=this,n=e.maxH||15,o=e.speed||1,r=e.interval||10,a=e.matrialUrl||this.getDfSt(["amalysis","createSubmergedAnalysis"])||"static/data/images/file/water.png",t.drawPolygonGraphics({height:1,callback:function(e,i){if(!t._viewer.scene.globe.depthTestAgainstTerrain)return alert("请开启深度检测"),!1;i&&setTimeout(()=>{i.polygon.heightReference="CLAMP_TO_GROUND",i.polygon.material=a;var e=0,t=(i.polygon.extrudedHeight=e,setInterval(function(){(e+=o)>=n&&(e=n,clearTimeout(t)),i.polygon.extrudedHeight=e},r))},2e3)}}))},createSlopeAnalysis:function(i){if(i=i||{},!n)return alert("需要引入echarts库"),!1;var o=this;this._viewer&&i&&o.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new ne({positions:e,that:o});o._graphicsLayer&&o._graphicsLayer.entities.remove(t),"function"==typeof i.callback&&i.callback(e)}})},createCutVolumeAnalysis:function(t){var i;t=t||{},this._viewer&&t&&(i=this).drawWallGraphics({callback:function(e){e=new re({positions:i.transformWGS84ArrayToCartesianArray(e,100),that:i});"function"==typeof t.callback&&t.callback(e)}})}};var oe={version:"1.0.0",PlotUtils:{}},ae=(oe.PlotUtils.distance=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},oe.PlotUtils.wholeDistance=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=oe.PlotUtils.distance(e[i],e[i+1]);return t},oe.PlotUtils.getBaseLength=function(e){return Math.pow(oe.PlotUtils.wholeDistance(e),.99)},oe.PlotUtils.mid=function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},oe.PlotUtils.getCircleCenterOfThreePoints=function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],t=[n[0]-e[1]+t[1],n[1]+e[0]-t[0]],o=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[o[0]-e[1]+i[1],o[1]+e[0]-i[0]];return oe.PlotUtils.getIntersectPoint(n,t,o,e)},oe.PlotUtils.getIntersectPoint=function(e,t,i,n){var o,r,a;return e[1]==t[1]?[(o=(n[0]-i[0])/(n[1]-i[1]))*(e[1]-i[1])+i[0],r=e[1]]:i[1]==n[1]?[(a=(t[0]-e[0])/(t[1]-e[1]))*(i[1]-e[1])+e[0],r=i[1]]:(a=(t[0]-e[0])/(t[1]-e[1]),o=(n[0]-i[0])/(n[1]-i[1]),[a*(r=(a*e[1]-e[0]-o*i[1]+i[0])/(a-o))-a*e[1]+e[0],r])},oe.PlotUtils.getAzimuth=function(e,t){var i,n=Math.asin(Math.abs(t[1]-e[1])/oe.PlotUtils.distance(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=oe.Constants.TWO_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},oe.PlotUtils.getAngleOfThreePoints=function(e,t,i){e=oe.PlotUtils.getAzimuth(t,e)-oe.PlotUtils.getAzimuth(t,i);return e<0?e+oe.Constants.TWO_PI:e},oe.PlotUtils.isClockWise=function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},oe.PlotUtils.getPointOnLine=function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},oe.PlotUtils.getCubicValue=function(e,t,i,n,o){var r=1-(e=Math.max(Math.min(e,1),0)),a=e*e,s=a*e,l=r*r,c=l*r;return[c*t[0]+3*l*e*i[0]+3*r*a*n[0]+s*o[0],c*t[1]+3*l*e*i[1]+3*r*a*n[1]+s*o[1]]},oe.PlotUtils.getThirdPoint=function(e,t,i,n,o){e=oe.PlotUtils.getAzimuth(e,t),o=o?e+i:e-i,e=n*Math.cos(o),i=n*Math.sin(o);return[t[0]+e,t[1]+i]},oe.PlotUtils.getArcPoints=function(e,t,i,n){for(var o=[],r=(r=n-i)<0?r+oe.Constants.TWO_PI:r,a=0;a<=oe.Constants.FITTING_COUNT;a++){var s=i+r*a/oe.Constants.FITTING_COUNT,l=e[0]+t*Math.cos(s),s=e[1]+t*Math.sin(s);o.push([l,s])}return o},oe.PlotUtils.getBisectorNormals=function(e,t,i,n){var o,r,a=oe.PlotUtils.getNormal(t,i,n),s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),l=a[0]/s,a=a[1]/s,c=oe.PlotUtils.distance(t,i),h=oe.PlotUtils.distance(i,n),s=s>oe.Constants.ZERO_TOLERANCE?oe.PlotUtils.isClockWise(t,i,n)?(o=[i[0]-(r=e*c)*a,i[1]+r*l],[i[0]+(r=e*h)*a,i[1]-r*l]):(o=[i[0]+(r=e*c)*a,i[1]-r*l],[i[0]-(r=e*h)*a,i[1]+r*l]):(o=[i[0]+e*(t[0]-i[0]),i[1]+e*(t[1]-i[1])],[i[0]+e*(n[0]-i[0]),i[1]+e*(n[1]-i[1])]);return[o,s]},oe.PlotUtils.getNormal=function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],o=Math.sqrt(n*n+e*e),o=(n/=o,e/=o,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(o*o+i*i);return[n+(o/=t),e+(i/=t)]},oe.PlotUtils.getCurvePoints=function(e,t){for(var i=[oe.PlotUtils.getLeftMostControlPoint(t)],n=0;n<t.length-2;n++)var o=t[n],r=t[n+1],a=t[n+2],a=oe.PlotUtils.getBisectorNormals(e,o,r,a),i=i.concat(a);for(var s=oe.PlotUtils.getRightMostControlPoint(t),l=(i.push(s),[]),n=0;n<t.length-1;n++){for(o=t[n],r=t[n+1],l.push(o),e=0;e<oe.Constants.FITTING_COUNT;e++){var c=oe.PlotUtils.getCubicValue(e/oe.Constants.FITTING_COUNT,o,i[2*n],i[2*n+1],r);l.push(c)}l.push(r)}return l},oe.PlotUtils.getLeftMostControlPoint=function(e){var i,n,o,r,a,s=e[0],l=e[1],e=e[2],c=oe.PlotUtils.getBisectorNormals(0,s,l,e)[0],e=oe.PlotUtils.getNormal(s,l,e),e=Math.sqrt(e[0]*e[0]+e[1]*e[1])>oe.Constants.ZERO_TOLERANCE?(e=oe.PlotUtils.mid(s,l),o=s[0]-e[0],i=s[1]-e[1],n=2/oe.PlotUtils.distance(s,l),r=c[0]-e[0],c=c[1]-e[1],a=e[0]+((i=-n*i)*i-(n=n*o)*n)*r+(o=2*i*n)*c,e[1]+o*r+(n*n-i*i)*c):(a=s[0]+t*(l[0]-s[0]),s[1]+t*(l[1]-s[1]));return[a,e]},oe.PlotUtils.getRightMostControlPoint=function(e){var i,n,o,r,a,s=e.length,l=e[s-3],c=e[s-2],e=e[s-1],s=oe.PlotUtils.getBisectorNormals(0,l,c,e)[1],l=oe.PlotUtils.getNormal(l,c,e),l=Math.sqrt(l[0]*l[0]+l[1]*l[1])>oe.Constants.ZERO_TOLERANCE?(l=oe.PlotUtils.mid(c,e),o=e[0]-l[0],i=e[1]-l[1],n=2/oe.PlotUtils.distance(c,e),r=s[0]-l[0],s=s[1]-l[1],a=l[0]+((i=-n*i)*i-(n=n*o)*n)*r+(o=2*i*n)*s,l[1]+o*r+(n*n-i*i)*s):(a=e[0]+t*(c[0]-e[0]),e[1]+t*(c[1]-e[1]));return[a,l]},oe.PlotUtils.getBezierPoints=function(e){if(e.length<=2)return e;for(var t=[],i=e.length-1,n=0;n<=1;n+=.01){for(var o=0,r=0,a=0;a<=i;a++){var s=oe.PlotUtils.getBinomialFactor(i,a),l=Math.pow(n,a),c=Math.pow(1-n,i-a);o+=s*l*c*e[a][0],r+=s*l*c*e[a][1]}t.push([o,r])}return t.push(e[i]),t},oe.PlotUtils.getBinomialFactor=function(e,t){return oe.PlotUtils.getFactorial(e)/(oe.PlotUtils.getFactorial(t)*oe.PlotUtils.getFactorial(e-t))},oe.PlotUtils.getFactorial=function(e){if(e<=1)return 1;if(2==e)return 2;if(3==e)return 6;if(4==e)return 24;if(5==e)return 120;for(var t=1,i=1;i<=e;i++)t*=i;return t},oe.PlotUtils.getQBSplinePoints=function(e){if(e.length<=2)return e;var t=[],i=e.length-2-1;t.push(e[0]);for(var n=0;n<=i;n++)for(var o=0;o<=1;o+=.05){for(var r=0,a=0,s=0;s<=2;s++){var l=oe.PlotUtils.getQuadricBSplineFactor(s,o);r+=l*e[n+s][0],a+=l*e[n+s][1]}t.push([r,a])}return t.push(e[e.length-1]),t},oe.PlotUtils.getQuadricBSplineFactor=function(e,t){return 0==e?Math.pow(t-1,2)/2:1==e?(-2*Math.pow(t,2)+2*t+1)/2:2==e?Math.pow(t,2)/2:0},oe.Constants={TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,FITTING_COUNT:100,ZERO_TOLERANCE:1e-4},{version:"1.0.0",createTime:"2018.6.19",author:"xupinhui"}),se="doublearrow",le={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1},ce={tailWidthFactor:.15,neckWidthFactor:.2,headWidthFactor:.25,headAngle:Math.PI/8.5,neckAngle:Math.PI/13};ae.algorithm={},ae.algorithm.doubleArrow=function(e,t){this.connPoint=null;var i={controlPoint:this.tempPoint4=null,polygonalPoint:null};if(!((a=(this.points=e).length)<2)){if(2==a)return e;var n=this.points[0],o=this.points[1],r=this.points[2],a=e.length,a=(this.tempPoint4=3==a?ae.algorithm.getTempPoint4(n,o,r):this.points[3],this.connPoint=3==a||4==a?oe.PlotUtils.mid(n,o):this.points[4],e=oe.PlotUtils.isClockWise(n,o,r)?(h=ae.algorithm.getArrowPoints(n,this.connPoint,this.tempPoint4,!1),ae.algorithm.getArrowPoints(this.connPoint,o,r,!0)):(h=ae.algorithm.getArrowPoints(o,this.connPoint,r,!1),ae.algorithm.getArrowPoints(this.connPoint,n,this.tempPoint4,!0)),h.length),s=(a-5)/2,l=h.slice(0,s),c=h.slice(s,5+s),h=h.slice(5+s,a),u=e.slice(0,s),d=e.slice(s,5+s),e=e.slice(5+s,a),u=oe.PlotUtils.getBezierPoints(u),s=oe.PlotUtils.getBezierPoints(e.concat(l.slice(1))),h=oe.PlotUtils.getBezierPoints(h),a=u.concat(d,s,c,h),e=ae.algorithm.array2Dto1D(a);i.controlPoint=[n,o,r,this.tempPoint4,this.connPoint],i.polygonalPoint=t.Cartesian3.fromDegreesArray(e)}return i},ae.algorithm.threeArrow=function(e){this.connPoint=null,this.tempPoint4=null;var t={controlPoint:this.tempPoint5=null,polygonalPoint:null};if(2<=(r=(this.points=e).length)){if(2==r)return e;var i=this.points[0],n=this.points[1],o=this.points[2],r=(3==(r=e.length)?(this.tempPoint4=ae.algorithm.getTempPoint4(i,n,o),this.tempPoint5=oe.PlotUtils.mid(o,this.tempPoint4)):(this.tempPoint4=this.points[3],this.tempPoint5=this.points[4]),this.connPoint=r<6?oe.PlotUtils.mid(i,n):this.points[5],e=oe.PlotUtils.isClockWise(i,n,o)?(c=ae.algorithm.getArrowPoints(i,this.connPoint,this.tempPoint4,!1),ae.algorithm.getArrowPoints(this.connPoint,n,o,!0)):(c=ae.algorithm.getArrowPoints(n,this.connPoint,o,!1),ae.algorithm.getArrowPoints(this.connPoint,i,this.tempPoint4,!0)),c.length),a=(r-5)/2,s=c.slice(0,a),l=c.slice(a,5+a),c=c.slice(5+a,r),h=e.slice(0,a),u=e.slice(a,5+a),e=e.slice(5+a,r),h=oe.PlotUtils.getBezierPoints(h),a=oe.PlotUtils.getBezierPoints(e.concat(s.slice(1))),c=oe.PlotUtils.getBezierPoints(c),r=h.concat(u,a,l,c),e=ae.algorithm.array2Dto1D(r);t.controlPoint=[i,n,o,this.tempPoint4,this.tempPoint5,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(e)}return t},ae.algorithm.array2Dto1D=function(e){var t=[];return e.forEach(function(e){t.push(e[0]),t.push(e[1])}),t},ae.algorithm.getArrowPoints=function(e,t,i,n){this.type=se,this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15;var o=oe.PlotUtils.mid(e,t),r=oe.PlotUtils.distance(o,i),a=oe.PlotUtils.getThirdPoint(i,o,0,.3*r,!0),s=oe.PlotUtils.getThirdPoint(i,o,0,.5*r,!0),a=[o,oe.PlotUtils.getThirdPoint(o,a,oe.Constants.HALF_PI,r/5,n),oe.PlotUtils.getThirdPoint(o,s,oe.Constants.HALF_PI,r/4,n),i],o=ae.algorithm.getArrowHeadPoints(a,this.headHeightFactor,this.headWidthFactor,this.neckHeightFactor,this.neckWidthFactor),s=o[0],r=o[4],n=oe.PlotUtils.distance(e,t)/oe.PlotUtils.getBaseLength(a)/2,i=ae.algorithm.getArrowBodyPoints(a,s,r,n),a=i.length,n=i.slice(0,a/2),i=i.slice(a/2,a);return n.push(s),i.push(r),(n=n.reverse()).push(t),(i=i.reverse()).push(e),n.reverse().concat(o,i)},ae.algorithm.getArrowHeadPoints=function(e,t,i){this.type=se,this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15;var n=oe.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],t=(oe.PlotUtils.distance(t,i),n*this.headWidthFactor),i=n*this.neckWidthFactor,r=n*this.neckHeightFactor,n=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,t,!1),n=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,t,!0);return[oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,i,!1),r,o,n,oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,i,!0)]},ae.algorithm.getArrowBodyPoints=function(e,t,i,n){for(var o=oe.PlotUtils.wholeDistance(e),r=oe.PlotUtils.getBaseLength(e)*n,a=(r-oe.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=oe.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=oe.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=oe.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=oe.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ae.algorithm.getTempPoint4=function(e,t,i){var n,o,r,t=oe.PlotUtils.mid(e,t),a=oe.PlotUtils.distance(t,i),i=oe.PlotUtils.getAngleOfThreePoints(e,t,i),a=i<oe.Constants.HALF_PI?(n=a*Math.sin(i),o=a*Math.cos(i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!1),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!0)):i>=oe.Constants.HALF_PI&&i<Math.PI?(n=a*Math.sin(Math.PI-i),o=a*Math.cos(Math.PI-i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!1),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!1)):i>=Math.PI&&i<1.5*Math.PI?(n=a*Math.sin(i-Math.PI),o=a*Math.cos(i-Math.PI),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!0),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!0)):(n=a*Math.sin(2*Math.PI-i),o=a*Math.cos(2*Math.PI-i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!0),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!1));return a},ae.algorithm.tailedAttackArrow=function(e,t){e=ae.algorithm.dereplication(e),this.tailWidthFactor=le.tailWidthFactor,this.swallowTailFactor=le.swallowTailFactor,this.swallowTailPnt=le.swallowTailPnt;var i={controlPoint:null,polygonalPoint:null};if(!((i.controlPoint=e).length<2)){if(2==e.length)return i.polygonalPoint=e,i;var n=e[0],o=e[1],e=(oe.PlotUtils.isClockWise(e[0],e[1],e[2])&&(n=e[1],o=e[0]),[oe.PlotUtils.mid(n,o)].concat(e.slice(2))),r=ae.algorithm.getAttackArrowHeadPoints(e,n,o,le),a=r[0],s=r[4],l=oe.PlotUtils.distance(n,o),c=oe.PlotUtils.getBaseLength(e),h=c*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=oe.PlotUtils.getThirdPoint(e[1],e[0],0,h,!0);h=ae.algorithm.getAttackArrowBodyPoints(e,a,s,l/c),e=h.length,l=[n].concat(h.slice(0,e/2));l.push(a);c=[o].concat(h.slice(e/2,e));c.push(s),l=oe.PlotUtils.getQBSplinePoints(l),c=oe.PlotUtils.getQBSplinePoints(c),n=ae.algorithm.array2Dto1D(l.concat(r,c.reverse(),[this.swallowTailPnt,l[0]])),i.polygonalPoint=t.Cartesian3.fromDegreesArray(n)}return i},ae.algorithm.getAttackArrowHeadPoints=function(e,t,i,n){this.headHeightFactor=n.headHeightFactor,this.headTailFactor=n.headTailFactor,this.headWidthFactor=n.headWidthFactor,this.neckWidthFactor=n.neckWidthFactor,this.neckHeightFactor=n.neckHeightFactor;var n=oe.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],r=oe.PlotUtils.distance(o,e[e.length-2]),t=oe.PlotUtils.distance(t,i),i=(n=n>t*this.headTailFactor?t*this.headTailFactor:n)*this.headWidthFactor,t=n*this.neckWidthFactor,r=(n=r<n?r:n)*this.neckHeightFactor,n=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,i,!1),n=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,i,!0);return[oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,t,!1),r,o,n,oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,t,!0)]},ae.algorithm.getAttackArrowBodyPoints=function(e,t,i,n){for(var o=oe.PlotUtils.wholeDistance(e),r=oe.PlotUtils.getBaseLength(e)*n,a=(r-oe.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=oe.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=oe.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=oe.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=oe.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ae.algorithm.dereplication=function(e){var t=e[e.length-1],i=!1,n=[],n=e.filter(function(e){if(e[0]!=t[0]&&e[1]!=t[1])return e;i=!0});return i&&n.push(t),n},ae.algorithm.fineArrow=function(e,t,i){var n,o,r,a,s,l,c;if(!(e.length<2||t.length<2))return n=ce.tailWidthFactor,c=ce.neckWidthFactor,s=ce.headWidthFactor,a=ce.headAngle,l=ce.neckAngle,(o=[])[0]=e,o[1]=t,e=o[0],t=o[1],c=(o=oe.PlotUtils.getBaseLength(o))*c,s=o*s,n=oe.PlotUtils.getThirdPoint(t,e,oe.Constants.HALF_PI,o=o*n,!0),o=oe.PlotUtils.getThirdPoint(t,e,oe.Constants.HALF_PI,o,!1),r=oe.PlotUtils.getThirdPoint(e,t,a,s,!1),a=oe.PlotUtils.getThirdPoint(e,t,a,s,!0),s=oe.PlotUtils.getThirdPoint(e,t,l,c,!1),l=oe.PlotUtils.getThirdPoint(e,t,l,c,!0),(c=[]).push(n[0],n[1],s[0],s[1],r[0],r[1],t[0],t[1],a[0],a[1],l[0],l[1],o[0],o[1],e[0],e[1]),c.some(e=>isNaN(e))?"":i.Cartesian3.fromDegreesArray(c)};let he=null;function ue(e,t){this.viewer=e,he=t,this.handler=new he.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.fillMaterial=he.Color.RED.withAlpha(.5),this.positions=[],this.state=-1,this.floatPoint=null,this.arrowEntity=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null,this.xp=ae,this.tooltip=new _(e,t),this.tooltip.initTool()}ue.prototype.clear=function(){this.state=0,this.firstPoint&&this.viewer.entities.remove(this.firstPoint),this.floatPoint&&this.viewer.entities.remove(this.floatPoint),this.arrowEntity&&this.viewer.entities.remove(this.arrowEntity),this.state=-1},ue.prototype.disableHandler=function(){this.handler&&(this.handler.destroy(),this.handler=new he.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)};let de=null;var pe=function(e,t){ue.call(this,e,t),de=t,this.type="AttackArrow",this.fillMaterial=de.Color.RED.withAlpha(.5)};function me(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}pe.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){var e=me(e.position,i.viewer);e&&(0==i.positions.length&&(i.floatPoint=i.creatPoint(e),i.floatPoint.wz=-1),i.positions.push(e),e=i.creatPoint(e),2<i.positions.length?e.wz=i.positions.length-1:e.wz=i.positions.length,i.pointArr.push(e))},de.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!i.floatPoint||i.positions.length<2||(e=me(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),i.tooltip.showAtCartesian(e,"右键结束!"),2<=i.positions.length)&&(de.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),i.arrowEntity.objId=i.objId,t&&t(i.objId)))},de.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){e=me(e.position,i.viewer);if(e){for(var t=0;t<i.pointArr.length;t++)i.pointArr[t].show=!1;i.floatPoint.show=!1,i.viewer.entities.remove(i.floatPoint),i.floatPoint=null;e=i.creatPoint(e);e.show=!1,e.wz=i.positions.length,i.pointArr.push(e),i.handler.destroy(),i.handler=null,i.tooltip.setVisible(!1),i.arrowEntity=null}},de.ScreenSpaceEventType.RIGHT_CLICK)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=de.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var o=this.creatPoint(this.positions[i]);o.show=!1,o.wz=i+1,this.pointArr.push(o)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;for(var n=this,e=0;e<n.pointArr.length;e++)n.pointArr[e].show=!0;this.modifyHandler||(this.modifyHandler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(de.defined(t)&&t.id)n.clickStep++,t.id.objId||(n.selectPoint=t.id);else{for(var i=0;i<n.pointArr.length;i++)n.pointArr[i].show=!1;n.floatPoint&&(n.floatPoint.show=!1),n.state=-1,n.modifyHandler.destroy(),n.modifyHandler=null,n.tooltip.setVisible(!1)}2==n.clickStep&&(n.clickStep=0,t=me(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},de.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=me(e.endPosition,n.viewer);e&&(n.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),n.selectPoint)&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},de.ScreenSpaceEventType.MOUSE_MOVE)},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){e=this.viewer.entities.add({position:e,point:{pixelSize:10,color:de.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new de.PolygonGraphics({hierarchy:new de.CallbackProperty(function(){if(r.length<3)return null;for(var e=[],t=0;t<r.length;t++){var i=a.cartesianToLatlng(r[t]);e.push(i)}var n=a.xp.algorithm.tailedAttackArrow(e,de),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new de.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=de.Math.toDegrees(e.latitude);return[de.Math.toDegrees(e.longitude),t]}},(pe.prototype=Object.create(Object.assign({},pe.prototype,ue.prototype))).constructor=pe;let fe=null;var ge=function(e,t){ue.call(this,e,t),fe=t,this.type="StraightArrow",this.fillMaterial=fe.Color.fromCssColorString("#0000FF").withAlpha(.8)};function ve(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}ge.prototype={disable:function(){this.positions=[],this.firstPoint&&(this.viewer.entities.remove(this.firstPoint),this.firstPoint=null),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){e=ve(e.position,i.viewer);e&&(0==i.positions.length&&(i.firstPoint=i.creatPoint(e),i.firstPoint.type="firstPoint",i.floatPoint=i.creatPoint(e),i.floatPoint.type="floatPoint",i.positions.push(e),i.firstPoint.position.setValue(e),i.firstPoint.show=!0),i.positions&&3==i.positions.length&&(i.firstPoint.show=!1,i.floatPoint.show=!1,i.handler.destroy(),i.handler=null,i.tooltip.setVisible(!1),i.arrowEntity=null),i.positions.push(e.clone()))},fe.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){i.positions.length<1||(e=ve(e.endPosition,i.viewer))&&(i.tooltip.showAtCartesian(e,"左键单击结束!"),i.floatPoint.position.setValue(e),2<=i.positions.length)&&(fe.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),t&&t(i.objId)))},fe.ScreenSpaceEventType.MOUSE_MOVE)},startModify:function(){this.state=2,this.firstPoint.show=!0,this.floatPoint.show=!0;var i=this;this.clickStep=0,this.modifyHandler||(this.modifyHandler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);fe.defined(t)&&t.id?(i.clickStep++,t.id.objId||(i.selectPoint=t.id)):(i.modifyHandler.destroy(),i.modifyHandler=null,i.firstPoint.show=!1,i.floatPoint.show=!1,i.state=-1,i.tooltip.setVisible(!1)),2==i.clickStep&&(i.clickStep=0,t=ve(e.position,i.viewer))&&i.selectPoint&&i.selectPoint.position&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},fe.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=ve(e.endPosition,i.viewer);e&&(i.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),i.selectPoint)&&i.selectPoint.position&&(i.selectPoint.position.setValue(e),"firstPoint"==i.selectPoint.type&&(i.positions[1]=e),"floatPoint"==i.selectPoint.type)&&(i.positions[2]=e)},fe.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.state=-1,this.positions=[];for(var t=[],i=0;i<e.length;i++){var n=fe.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}this.positions=t,this.firstPoint=this.creatPoint(this.positions[1]),this.firstPoint.type="firstPoint",this.floatPoint=this.creatPoint(this.positions[2]),this.floatPoint.type="floatPoint",this.arrowEntity=this.showArrowOnMap(this.positions),this.firstPoint.show=!1,this.floatPoint.show=!1,this.arrowEntity.objId=this.objId},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){e=this.viewer.entities.add({position:e,point:{pixelSize:10,color:fe.Color.RED}});return e.attr="editPoint",e},showArrowOnMap:function(a){var s=this;return this.viewer.entities.add({id:s.objId,polygon:new fe.PolygonGraphics({hierarchy:new fe.CallbackProperty(function(){if(a.length<2)return null;var e=a[1],t=a[2],e=s.cartesianToLatlng(e),t=s.cartesianToLatlng(t),i=[],n=s.xp.algorithm.fineArrow([e[0],e[1]],[t[0],t[1]],fe);if(-1!=JSON.stringify(n).indexOf("null"))return[];for(var o=0;o<n.length;o++){var r=new fe.Cartesian3(n[o].x,n[o].y,n[o].z);i.push(r)}return new fe.PolygonHierarchy(i)},!1),show:!0,fill:!0,material:s.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=fe.Math.toDegrees(e.latitude);return[fe.Math.toDegrees(e.longitude),t]}},(ge.prototype=Object.create(Object.assign({},ge.prototype,ue.prototype))).constructor=ge;let ye=null;var _e=function(e,t){ue.call(this,e,t),ye=t,this.type="PincerArrow",this.fillMaterial=ye.Color.YELLOW.withAlpha(.8)};function we(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}_e.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var n=this;this.state=1,this.handler||(this.handler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){e=we(e.position,n.viewer);if(e)if(0==n.positions.length&&(n.floatPoint=n.creatPoint(e)),4<n.positions.length){(i=n.creatPoint(e)).wz=n.positions.length,n.pointArr.push(i);for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;n.floatPoint&&(n.floatPoint.show=!1,n.viewer.entities.remove(n.floatPoint),n.floatPoint=null)}else{n.positions.push(e);var i=n.creatPoint(e);2<n.positions.length?i.wz=n.positions.length-1:i.wz=n.positions.length,n.pointArr.push(i)}},ye.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!n.floatPoint||n.positions.length<2||(e=we(e.endPosition,n.viewer))&&(n.floatPoint.position.setValue(e),n.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.positions.length)&&(ye.defined(n.arrowEntity)?(n.positions.pop(),n.positions.push(e)):(n.positions.push(e),n.arrowEntity=n.showArrowOnMap(n.positions),n.arrowEntity.objId=n.objId,t&&t(n.objId)))},ye.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(4<=n.positions.length){e=we(e.position,n.viewer);if(e){for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;n.floatPoint&&(n.floatPoint.show=!1),n.viewer.entities.remove(n.floatPoint),n.floatPoint=null;e=n.creatPoint(e);e.show=!1,e.wz=n.positions.length,n.pointArr.push(e),n.handler.destroy(),n.handler=null,n.tooltip.setVisible(!1),n.arrowEntity=null}}},ye.ScreenSpaceEventType.RIGHT_CLICK)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=ye.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var o=this.creatPoint(this.positions[i]);o.show=!1,o.wz=i+1,this.pointArr.push(o)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;var i=this;for(let e=0;e<i.pointArr.length;e++)i.pointArr[e].show=!0;this.modifyHandler||(this.modifyHandler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);if(ye.defined(t)&&t.id)i.clickStep++,t.id.objId||(i.selectPoint=t.id);else{for(let e=0;e<i.pointArr.length;e++)i.pointArr[e].show=!1;i.state=-1,i.modifyHandler.destroy(),i.modifyHandler=null,i.tooltip.setVisible(!1)}2==i.clickStep&&(i.clickStep=0,t=we(e.position,i.viewer))&&i.selectPoint&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},ye.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=we(e.endPosition,i.viewer);e&&(i.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),i.selectPoint)&&(i.selectPoint.position.setValue(e),i.positions[i.selectPoint.wz-1]=e)},ye.ScreenSpaceEventType.MOUSE_MOVE)},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){return this.viewer.entities.add({position:e,point:{pixelSize:10,color:ye.Color.RED},show:!0})},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new ye.PolygonGraphics({hierarchy:new ye.CallbackProperty(function(){if(r.length<3)return null;for(var e=[],t=0;t<r.length;t++){var i=a.cartesianToLatlng(r[t]);e.push(i)}var n=a.xp.algorithm.doubleArrow(e,ye),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new ye.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=ye.Math.toDegrees(e.latitude);return[ye.Math.toDegrees(e.longitude),t]}},(_e.prototype=Object.create(Object.assign({},_e.prototype,ue.prototype))).constructor=_e;let Ce=null,Pe=null;function xe(e,t,i,n){if(e&&n){const{threeGlobal:i,containerId:o,threeContainerId:r}=n;Ce=t,Pe=i,this._viewer=e,this._containerId=o,this._threeContainerId=r,this._Scene=function({THREE:a,Cesium:s,viewer:l}){class e extends a.Scene{constructor(t={}){if(super(),this.type="ThreeCesiumScene",!t.cesiumDom)throw new Error("THREE.ThreeCesiumScene not found cesiumDom.");if(!(t.camera&&t.camera instanceof a.PerspectiveCamera))throw new Error("THREE.ThreeCesiumScene (not found cesiumDom) OR ( not THREE.PerspectiveCamera ).");if(!t.renderer)throw new Error("THREE.ThreeCesiumScene not found THREE.WebGLRender.");this.options=t,this.cesiumViewer=l;var i=("string"==typeof t.cesiumDom?document.getElementById(t.cesiumDom):t.cesiumDom).children[0].children;for(let e=0;e<i.length;e++)0!==e&&(i[e].style.zIndex="100");this.ellipsoid=this.cesiumViewer.scene.globe.ellipsoid,t.threeHabit&&(this.cesiumViewer.scene.screenSpaceCameraController.tiltEventTypes=[s.CameraEventType.LEFT_DRAG],this.cesiumViewer.scene.screenSpaceCameraController.zoomEventTypes=[s.CameraEventType.MIDDLE_DRAG,s.CameraEventType.WHEEL,s.CameraEventType.PINCH],this.cesiumViewer.scene.screenSpaceCameraController.rotateEventTypes=[s.CameraEventType.RIGHT_DRAG]),this.camera=t.camera,this.cameraOffset=new a.Vector3,this.renderer=t.renderer,this.lngLat=t.lngLat&&1<t.lngLat.length?t.lngLat:[114.23,31.55],this.cameraCenter=new a.Vector3(0,0,0);var e=new s.EllipsoidGeometry({vertexFormat:s.VertexFormat.POSITION_ONLY,radii:new s.Cartesian3(this.ellipsoid.maximumRadius-1,this.ellipsoid.maximumRadius-1,this.ellipsoid.minimumRadius-1),slicePartitions:1024,stackPartitions:1024}),e=function(e,t){t=t||new a.BufferGeometry;const i=e.attributes;for(const e in i){var n,o;i.hasOwnProperty(e)&&i[e]&&((o=(n=i[e]).values)instanceof Float64Array&&(o=new Float32Array(o)),o=new a.BufferAttribute(o,n.componentsPerAttribute,n.normalize),t.setAttribute(e,o))}if(i.st&&(t.attributes.uv=t.attributes.st,t.deleteAttribute("st")),e.indices){const i=new a.BufferAttribute(e.indices,1,!1);t.setIndex(i)}if(e.boundingSphere){const i=e.boundingSphere;t.boundingSphere||(t.boundingSphere=new a.Sphere),t.boundingSphere.center.copy(i.center),t.boundingSphere.radius=i.radius}return t}(s.EllipsoidGeometry.createGeometry(e)),n=new a.MeshBasicMaterial({color:"#ff00ff",blending:a.MultiplyBlending}),e=new a.Mesh(e,n),n=(t.axesHelper&&e.add(new a.AxesHelper(8e6)),super.add(e),this.sphere=e,new a.Group),e=(super.add(n),this.syncGroup=n,new a.SphereGeometry(this.ellipsoid.minimumRadius,512,256,0,2*Math.PI,3.1,Math.PI-3.1)),o=new a.MeshBasicMaterial({color:"#fff00f",blending:a.MultiplyBlending}),e=new a.Mesh(e,o),o=(e.rotateX(90*Math.PI/180),e.position.z=this.ellipsoid.minimumRadius,new a.Group),r=(o.rotateX(-90*Math.PI/180),o.position.z=-1,this.syncGroup=n,this.childrenGroup=o,this.sunUp=new a.Group,this.sunLightColor=new a.Color,this.sunLightIntensity=1,this.cesiumViewer.scene.light);if(this.sunLightColor.r=r.color.red,this.sunLightColor.g=r.color.green,this.sunLightColor.b=r.color.blue,this.sunLightIntensity=r.intensity,this.sun=new a.DirectionalLight(this.sunLightColor,this.sunLightIntensity),this.sun.castShadow=!0,this.sun.shadow.camera.far=Math.pow(10,14),this.sun.position.set(0,0,2*this.ellipsoid.maximumRadius+1e3),this.sun.target=this.childrenGroup,this.sunUp.add(this.sun),n.add(e),n.add(o),n.add(this.sunUp),this._enableLighting=!1,Object.defineProperty(this,"enableLighting",{get(){return this._enableLighting},set(e){this.cesiumViewer.scene.globe.enableLighting=e,this._enableLighting=e,this.sun.visible=!!e}}),void 0!==t.enableLighting&&null!==t.enableLighting&&(this.enableLighting=t.enableLighting),t.cesiumLayers&&0<t.cesiumLayers.length)for(let e=0;e<t.cesiumLayers.length;e++)this.addImageryProvider(t.cesiumLayers[e].type,t.cesiumLayers[e].option)}renderCesium(){return this.cesiumViewer.render(),this}renderThree(){return this.renderer.render(this,this.camera),this}updateSunMatrix(){var e=this.cesiumViewer.scene.sun._boundingVolume.center,e=this.cartesian3ToVector(e);return this.sunUp.lookAt(e.x-this.cameraOffset.x,e.y-this.cameraOffset.y,-(e.z-this.cameraOffset.z)),this}updateCameraMatrix(){this.camera.fov=s.Math.toDegrees(this.cesiumViewer.camera.frustum.fovy),this.camera.updateProjectionMatrix(),this.camera.matrixAutoUpdate=!1;var e=this.cesiumViewer.camera.viewMatrix,t=this.cesiumViewer.camera.inverseViewMatrix,t=(this.camera.lookAt(this.cameraCenter),this.camera.matrixWorld.set(t[0],t[4],t[8],t[12]-this.cameraOffset.x,t[1],t[5],t[9],t[13]-this.cameraOffset.y,t[2],t[6],t[10],t[14]-this.cameraOffset.z,t[3],t[7],t[11],t[15]),this.camera.matrixWorldInverse.set(e[0],e[4],e[8],e[12]-this.cameraOffset.x,e[1],e[5],e[9],e[13]-this.cameraOffset.y,e[2],e[6],e[10],e[14]-this.cameraOffset.z,e[3],e[7],e[11],e[15]),this.cesiumViewer.scene.canvas.clientWidth),e=this.cesiumViewer.scene.canvas.clientHeight;return this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),this}updateGroupMatrixWorld(){var e=this.cartesian3ToVector(s.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],0)),t=this.cartesian3ToVector(s.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],2)),t=(new a.Vector3).subVectors(e,t).normalize();return this.syncGroup.lookAt(t),this.syncGroup.up.copy(t),this.syncGroup.updateMatrix(),this.cameraOffset.copy(e),this.syncGroup.up.set(0,0,-1),this.up.set(0,0,-1),this}update(){this.updateSunMatrix(),this.updateGroupMatrixWorld(),this.updateCameraMatrix(),this.renderThree(),this.renderCesium()}add(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.childrenGroup.add(arguments[e]);else e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this.childrenGroup,this.childrenGroup.children.push(e),e.dispatchEvent({type:"added"})):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.childrenGroup.remove(arguments[e]);else{var t=this.childrenGroup.children.indexOf(e);-1!==t&&(e.parent=null,this.childrenGroup.children.splice(t,1),e.dispatchEvent({type:"removed"}))}return this}clear(){for(let e=0;e<this.childrenGroup.children.length;e++){var t=this.childrenGroup.children[e];t.parent=null,t.dispatchEvent({type:"removed"})}return this.childrenGroup.children.length=0,this}traverse(i){i(this.childrenGroup);var n=this.childrenGroup.children;for(let e=0,t=n.length;e<t;e++)n[e].traverse(i)}traverseVisible(i){if(!1!==this.visible&&!1!==this.childrenGroup.visible){i(this.childrenGroup);var n=this.childrenGroup.children;for(let e=0,t=n.length;e<t;e++)n[e].traverseVisible(i)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={},n=(e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{},options:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),{});if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid),null!==this.fog&&(n.fog=this.fog.toJSON()),this.options){n.options={};for(const t in this.options)["camera","renderer"].includes(t)||(n.options[t]=this.options[t])}if(0<this.childrenGroup.children.length){n.children=[];for(let e=0;e<this.childrenGroup.children.length;e++)n.children.push(this.childrenGroup.children[e].toJSON(t).object)}if(e){const e=o(t.geometries),n=o(t.materials),r=o(t.textures),a=o(t.images),s=o(t.shapes),l=o(t.skeletons),c=o(t.animations),h=o(t.nodes);0<e.length&&(i.geometries=e),0<n.length&&(i.materials=n),0<r.length&&(i.textures=r),0<a.length&&(i.images=a),0<s.length&&(i.shapes=s),0<l.length&&(i.skeletons=l),0<c.length&&(i.animations=c),0<h.length&&(i.nodes=h)}return n.isGIS=!0,i.object=n,i;function o(e){var t=[];for(const n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}dispose(){this.update=()=>{},this.renderCesium=()=>{},this.renderThree=()=>{},this.updateSunMatrix=()=>{},this.updateCameraMatrix=()=>{},this.updateGroupMatrixWorld=()=>{},this.cesiumViewer.destroy()}cartesian3ToVector(e){return new a.Vector3(e.x,e.y,e.z)}}return e.prototype.isScene=!0,e.prototype.isGIS=!0,e}({THREE:Pe,Cesium:Ce,viewer:e}),this._initContainer()}}function Se({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:a={},imageryProvider:l={},MapImageryList:u=[],defaultStatic:d,viewer:m}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";var g,y,w;if(i||m)return r=new o(e).init({containerId:i,viewerConfig:r,extraConfig:a,MapImageryList:u,imageryProvider:l,viewer:m}),y=e,w=d,{viewer:g=r,material:(a=function(e,o){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)o.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new o(g,y,w),e.forEach(e=>{e.call(t,g,y,w)})):(i(e),t=new o(g,y,w),e.call(t,g,y,w)),t})([p,h],c),graphics:a(p,s),math3d:a(p,f),math2d:new S(r,e),primitive:a(p,v),draw:a([p,f,S],P),passEffect:a([p,h],M),customCesiumPlugin:a(p,H),control:a(p,X),plugin:a([p,s],K),base:new p(r,e),analysis:a([p,P,K],ee),attackArrowObj:new pe(r,e),straightArrowObj:new ge(r,e),pincerArrowObj:new _e(r,e),threeJs:new xe(r,e,d,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")};throw"Missing containerId parameter, please check the calling function initCesium."}xe.prototype={_initContainer:function(){if(this.cesiumContainer=void 0,this.threeContainer=void 0,this.cesiumContainer=document.getElementById(this._containerId),this.threeContainer=document.getElementById(this._threeContainerId),!this.cesiumContainer)return alert("未获取到 cesiumContainer 容器!"),!1;var e;"absolute"!==this.cesiumContainer.style.position&&(this.cesiumContainer.style.position="absolute",this.cesiumContainer.style.top=0,this.cesiumContainer.style.left=0,this.cesiumContainer.style.height="100%",this.cesiumContainer.style.width="100%",this.cesiumContainer.style.margin=0,this.cesiumContainer.style.overflow="hidden",this.cesiumContainer.style.padding=0,this.cesiumContainer.style.fontFamily="sans-serif"),this.threeContainer||(e=document.getElementsByTagName("body")[0])&&(this.threeContainer=document.createElement("div"),this.threeContainer.id=this._threeContainerId,this.threeContainer.style.position="absolute",this.threeContainer.style.top=0,this.threeContainer.style.left=0,this.threeContainer.style.height="100%",this.threeContainer.style.width="100%",this.threeContainer.style.margin=0,this.threeContainer.style.overflow="hidden",this.threeContainer.style.padding=0,this.threeContainer.style.fontFamily="sans-serif",this.threeContainer.style.pointerEvents="none",e.appendChild(this.threeContainer))},initThree:function(e){var t=e.fov||45,i=window.innerWidth,n=window.innerHeight,i=e.aspect||i/n,n=e.near||1,o=e.far||1e7;return this._three={renderer:null,camera:null,scene:null},this._three.camera=new Pe.PerspectiveCamera(t,i,n,o),this._three.renderer=new Pe.WebGLRenderer({alpha:!0,antialias:!0,logarithmicDepthBuffer:!0,stencil:!0,depth:!0}),this._three.renderer.outputEncoding=Pe.sRGBEncoding,this._three.renderer.shadowMap.enabled=!0,this._three.renderer.shadowMap.type=Pe.PCFSoftShadowMap,this._three.scene=new this._Scene({cesiumDom:this._containerId,threeHabit:this._objHasOwnProperty(e,"threeHabit",!0),enableLighting:this._objHasOwnProperty(e,"enableLighting",!0),axesHelper:this._objHasOwnProperty(e,"axesHelper",!1),camera:this._three.camera,renderer:this._three.renderer,lngLat:e.center||[104.081701757991,30.627042558105988]}),this.threeContainer&&this.threeContainer.appendChild(this._three.renderer.domElement),this._three},loop(t){function i(){var e=requestAnimationFrame(i);t&&t(e)}i()},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,destroyThreeJS(){this._three.scene.dispose()}};class be{constructor(e){return this.init(e)}init({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:a={},MapImageryList:s=[],defaultStatic:l,baseExtendsCom:c=[],extendsCom:h,extendsComName:u,viewer:d}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";if(i||d)return{viewer:r=new o(e).init({containerId:i,viewerConfig:r,extraConfig:a,MapImageryList:s,viewer:d}),[u]:this.prototypeExtends(r,e,l,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")(c,h)};throw"Missing containerId parameter, please check the calling function initCesium."}prototypeExtends(n,r,a,s){return function(e,o){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)o.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new o(n,r,a,s),e.forEach(e=>{e.call(t,n,r,a,s)})):(i(e),t=new o(n,r,a,s),e.call(t,n,r,a,s)),t}}}class Me extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:s,extendsComName:"graphics"})}}class Te extends be{constructor(e){return super({...e,baseExtendsCom:[p,h],extendsCom:c,extendsComName:"material"})}}class Ee extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:v,extendsComName:"primitive"})}}class Ae extends be{constructor(e){return super({...e,baseExtendsCom:[p,f,S],extendsCom:P,extendsComName:"draw"})}}class Ie{constructor(e){var t=new Ae(e);return this._initCurrMeasure(e,t)}_initCurrMeasure(e,t){var i=new pe(t.viewer,e.cesiumGlobal),n=new ge(t.viewer,e.cesiumGlobal),e=new _e(t.viewer,e.cesiumGlobal);return{...t,attackArrowObj:i,straightArrowObj:n,pincerArrowObj:e}}}class Le extends be{constructor(e){return super({...e,baseExtendsCom:[p,P,K],extendsCom:ee,extendsComName:"analysis"})}}class De extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:H,extendsComName:"customCesiumPlugin"})}}class ke{constructor(e){return new De(e)}}class ze extends be{constructor(e){return super({...e,baseExtendsCom:[p,h],extendsCom:M,extendsComName:"passEffect"})}}class Re extends be{constructor(e){return super({...e,baseExtendsCom:[p,s],extendsCom:K,extendsComName:"plugin"})}}class Oe extends be{constructor(e){return super({...e,baseExtendsCom:[],extendsCom:xe,extendsComName:"threeJs"})}}class Ge extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:X,extendsComName:"control"})}}export{Le as Analysis,pe as AttackArrow,Ge as Control,ke as CustomCesiumPlugin,Ie as Draw,Me as Graphics,Te as Material,S as Math2d,f as Math3d,ze as PassEffect,_e as PincerArrow,Re as Plugin,Ee as Primitive,ge as StraightArrow,Oe as ThreeJs,Se as initCesium};
|
|
1
|
+
import e from"libgif";import{GUI as i}from"dat.gui";import n from"echarts";let r=null;class o{constructor(e){r=e,this.init_data()}init_data(){this.viewer=null}init({containerId:e,viewerConfig:t,extraConfig:i,MapImageryList:n,imageryProvider:o,viewer:a}){var s={contextOptions:{webgl:{alpha:!1}},animation:!1,timeline:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,selectionIndicator:!1,shadow:!0,sceneMode:r.SceneMode.SCENE3D,infoBox:!1,sceneModePicker:!1,navigationHelpButton:!1,projectionPicker:!1,baseLayerPicker:!1,shouldAnimate:!0,navigation:!1,showRenderLoopErrors:!0},o=this.findCesiumProvider(o),l=(r.Ion.defaultAccessToken=i.AccessToken||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmYzkwZWEwYy1mMmIwLTQwYjctOWJlOC00OWU4ZWU1YTZhOTkiLCJpZCI6MTIxODIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NjA0OTUyNDN9.wagvw7GxUjxvHXO6m2jjX5Jh9lN0UyTJhNGEcSm2pgE",s=Object.assign(s,t),a||new r.Viewer(e,{...s,...o}));if(i.logo||(l.cesiumWidget.creditContainer.style.display="none"),i.depthTest&&(l.scene.globe.depthTestAgainstTerrain=!0),n&&0<n.length)for(let e=0;e<n.length;e++)this.addImageryProvider(l,n[e].type,n[e].option||n[e].classConfig);return this.viewer=l}addImageryProvider(e,t,i){e.imageryLayers.addImageryProvider(this.createCesiumProvider({type:t,option:i}))}findCesiumProvider(e){var t={};for(const i in e)e[i]&&e[i].type?t[i]=this.createCesiumProvider(e[i]):t[i]=e[i];return t}createCesiumProvider(e){switch(e.type){case"WebMapTileServiceImageryProvider":case"UrlTemplateImageryProvider":case"TileMapServiceImageryProvider":return new r[e.type](e.option)}}}let a=null;function s(e,t,i){e&&(a=t,this._graphicsLayer=new a.CustomDataSource("graphicsLayer"),e)&&e.dataSources.add(this._graphicsLayer)}s.prototype={getPointGraphics:function(e){if(e=e||{})return new a.PointGraphics({color:e.color||a.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||a.Color.WHITE,outlineWidth:e.outlineWidth||1})},getLineGraphics:function(e){if((e=e||{})&&e.positions)return new a.PolylineGraphics({show:!0,positions:e.positions,material:e.material||a.Color.YELLOW,width:e.width||1,arcType:a.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)})},getPolygonGraphics:function(e){if((e=e||{})&&e.positions)return new a.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||a.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||!1})},getLabelGraphics:function(e){if((e=e||{})&&e.l_text)return new a.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||a.Color.GOLD,style:e.l_style||a.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||a.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||!1,backgroundColor:e.l_backgroundColor||new a.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||a.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new a.Cartesian2(0,-30)})},getBillboardGraphics:function(e){if((e=e||{})&&e.b_img)return new a.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||!0,scale:e.b_scale||1,pixelOffset:e.b_pixelOffset||new a.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0})},getPathGraphics:function(e){if(e=e||{})return new a.PathGraphics({resolution:e.resolution||1,material:new a.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||a.Color.YELLOW}),width:e.width||30})},getModelGraphics:function(e){if(e=e||{})return new a.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:!0})},getEllipseGraphics:function(e){if(e=e||{})return new a.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||a.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",!0)})},getEllipsoidGraphics:function(e){var t;if(e=e||{})return t=e.radii||1e6,new a.EllipsoidGraphics({radii:new a.Cartesian3(t,t,t),innerRadii:this._objHasOwnProperty(e,"innerRadii",new a.Cartesian3(t/1.5,t/1.5,t/1.5)),maximumCone:e.maximumCone||a.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||a.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",!0),fill:this._objHasOwnProperty(e,"fill",!0),material:e.material||a.Color.RED.withAlpha(.1)})},getBoxGraphics:function(e){if(e=e||{})return new a.BoxGraphics({show:this._objHasOwnProperty(e,"show",!0),fill:this._objHasOwnProperty(e,"fill",!0),dimensions:e.dimensions||new a.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",!0),outlineColor:e.outlineColor||a.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})},getPlaneGraphics:function(e){if(e=e||{})return new a.PlaneGraphics({plane:e.plane||new a.Plane(a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(170,130),material:e.material||a.Color.BLUE})},getCylinderGraphics:function(e){if(e=e||{})return new a.CylinderGraphics({HeightReference:a.HeightReference.RELATIVE_TO_GROUND,length:e.length||250,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new a.Color(0,1,1,.4),slices:e.slices||128})},createPointsGraphics:function(e){if(e&&e.positions){var t,i=[];for(t in e.positions){var n=e.positions[t],o=this.createGraphics();o.name=e.name||"",o.oid=e.oid||"point",o.position=n,e.point&&(o.point=this.getPointGraphics()),e.billboard&&(o.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(o.label=this.getLabelGraphics(e.label)),i.push(this._graphicsLayer.entities.add(o))}return i}},createLineGraphics:function(e){var t;if(e&&e.positions)return(t=this.createGraphics()).name=e.name||"",t.oid=e.oid||"line",t.position=e.positions,t.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(t)},createPolygonGraphics:function(e){var t;if(e=e||{})return(t=this.createGraphics()).polygon=this.getPolygonGraphics(e),t.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",!1),this._graphicsLayer.entities.add(t)},createBoxGraphics:function(e){var t;if(e=e||{})return(t=this.createGraphics()).position=e.position,t.name=e.name||"box_graphic",t.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(t)},createModelGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).model=this.getModelGraphics(e),t.position=e.position,this._graphicsLayer.entities.add(t)},craeteCorridorGraphics:function(r){if(r&&r.positions){let{positions:e,height:t,width:i,material:n,...o}=r;r=this.createGraphics();return r.corridor={positions:e,height:void 0===t?6:t,width:void 0===i?15:i,...o,material:n||new a.Scene.WarnLinkMaterialProperty({freely:"cross",color:a.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}},craeteDynamicPolyLineGraphics:function(e){var t;if(e&&e.positions)return(t=this.createGraphics()).polyline={show:!0,positions:[],material:e.material||a.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)},t.polyline.positions=new a.CallbackProperty(function(){return e.positions},!1),this._graphicsLayer.entities.add(t)},craeteDynamicCylinderGraphics:function(e){var i,n,t={};if(e&&e.cylinder)return i=e.entity,e=e.cylinder,t.cylinder=(n=this).getCylinderGraphics(e),t.position=new a.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime),e=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=a.Math.toDegrees(e.latitude),e=a.Math.toDegrees(e.longitude);return a.Cartesian3.fromDegrees(e,t,0)},!1),t.cylinder.length=new a.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime);return 2*n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e).height},!1),t},createFadeCylinderGraphics:function(e){var t;if((e=e||{})&&e.position)return(t=this.createGraphics()).position=e.position,e.material=new a.Scene.CircleFadeMaterialProperty({color:e.color||a.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),t.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(t)},craeteRotateCylinderGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).cylinder={HeightReference:a.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new a.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:!0,repeat:{x:1,y:-1}}),slices:e.slices||128},t.position=e.position,this.setGraphicsRotate({entity:t,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(t)},craeteDynamicBlinkCircleGraphics:function(e){var t,i,n;if(e&&e.position)return t=this.createGraphics(),i=e.alp||1,n=this._objHasOwnProperty(e,"flog",!0),t.position=e.position,t.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new a.ColorMaterialProperty(new a.CallbackProperty(function(){return n?(i-=.05)<=0&&(n=!1):1<=(i+=.05)&&(n=!0),a.Color.RED.withAlpha(i)},!1))},this._graphicsLayer.entities.add(t)},craeteDynamicCricleGraphics:function(i){if(i&&i.center){var n=this.createGraphics(),o=this,r=i.center,s=i.radius||800,l=i.rotateAmount||.05,c=0,h=i.height||1,u=i.scale||null,d=i.scale2||null,i=i.material||new a.ImageMaterialProperty({image:i.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:!0});n.position=new a.CallbackProperty(function(){return o.transformWGS84ToCartesian(r)},!1),n.orientation=new a.CallbackProperty(function(){return a.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(r),new a.HeadingPitchRoll(a.Math.toRadians(0),a.Math.toRadians(0),a.Math.toRadians(0)))},!1);let e=s,t=!1;return n.ellipse={material:i,height:h,semiMajorAxis:new a.CallbackProperty(function(){return s},!1),semiMinorAxis:new a.CallbackProperty(function(){return s},!1),stRotation:new a.CallbackProperty(function(){return 0<l&&360<=(c+=l)&&(c=0),u&&((t=u<=s||s<=e?!t:t)?s+=2:s-=2),d&&(s<=d?s+=2:s=e),c},!1)},this._graphicsLayer.entities.add(n)}},craeteDynamicShadeWallGraphics:function(e){var t,i,n,o,r;if(e&&e.positions)return t=e.alp||1,i=e.num||20,n=e.color||a.Color.RED,o=e.speed||.003,(r=this.createGraphics()).wall={positions:e.positions,material:new a.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:!0,color:new a.CallbackProperty(function(){return i%2==0?t-=o:t+=o,(t<=.1||1<=t)&&i++,n.withAlpha(t)},!1)})},this._graphicsLayer.entities.add(r)},createCustomDefBillboardGraphics:function(t){if(t&&t.position){var i=this,n=document.createElement("img");n.src=t.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";n.onload=function(){t.image=n;var e=i._graphicsLayer.entities.add({position:t.position,billboard:{image:function(e){var t,i;if(e.image)return(t=document.createElement("canvas")).width=e.width||150,t.height=e.height||80,(i=t.getContext("2d")).drawImage(e.image,0,0),e=e.text,i.font="15px bold 宋体",i.fillStyle="#f4fff0",i.fillText(e,55,36),t}(t),scaleByDistance:new a.NearFarScalar(150,.7,15e6,.5),verticalOrigin:a.VerticalOrigin.BOTTOM,pixelOffset:t.b_pixelOffset||new a.Cartesian2(80,-35),width:140,height:100,scale:t.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});"function"==typeof t.callback&&t.callback(e)}}},craeteRotatePlaneGraphics:function(e){var t,i,n,o;if(e&&e.center&&e.positions)return t=this.createGraphics(),i=0,n=e.positions,o=n[0],t.position=new a.CallbackProperty(function(){return 0==i?(o=n[0],i+=1):i<n.length-1?(o=n[i],i+=1):i==n.length-1&&(o=n[i],i=0),o},!1),t.plane={plane:new a.Plane(a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(200,150),material:new a.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(t)},createVideoPlaneGraphics:function(e){var t;if(e&&e.position)return(t=this.createGraphics()).position=e.position,t.plane={plane:new a.Plane(e.normal||a.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new a.Cartesian2(200,150),material:new a.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(t)},createGifBillboardGraphics:function(t){var i,n,o,r,s,l,c;if(e&&t&&t.position)return n=t.url,o=0,r=n,s=i=[],(l=document.createElement("img")).src=r,l.setAttribute("rel:animated_src",r),l.setAttribute("rel:auto_play","0"),document.body.appendChild(l),c=new e({gif:l}),new Promise(e=>{c.load(()=>{for(let e=1;e<=c.get_length();e++)c.move_to(e),s.push(c.get_canvas().toDataURL());e(s)})}),this._graphicsLayer.entities.add({position:t.position,billboard:{verticalOrigin:a.VerticalOrigin.BASELINE,image:new a.CallbackProperty(function(){return i.length?(o<6*(i.length-1)?o++:o=0,i[Math.floor(o/6)]):n},!1),scale:.2}})},setGraphicsRotate:function(e){var t,i,n,o;e&&e.entity&&e.rotateAmount&&(t=e.entity,i=e.rotateAmount,n=e.position,o=this,n.heading=0,n.pitch=0,n.roll=0,t.position=new a.CallbackProperty(function(){return o.transformWGS84ToCartesian(n)},!1),t.orientation=new a.CallbackProperty(function(){return 0<i&&(n.heading+=i,360===n.heading)&&(n.heading=0),a.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(n),new a.HeadingPitchRoll(a.Math.toRadians(n.heading),a.Math.toRadians(n.pitch),a.Math.toRadians(n.roll)))},!1))},setGraphicsFloat:function(e){if(e&&e.entity&&e.maxHeiht)try{var t=e.entity,n=e.minHeiht||5,o=e.maxHeiht||100,r=e.cartesians,s=e.speed||.06,l=this,c=n,h=!1;r.length?t.positions=new a.CallbackProperty(function(){var e,t=l.transformCartesianArrayToWGS84Array(r);for(e in t){var i=t[e];(h=o<=n||n<=c?!h:h)?n+=s:n-=s,i.alt=n}return l.transformWGS84ArrayToCartesianArray(t)},!1):t.position=new a.CallbackProperty(function(){var e=l.transformCartesianToWGS84(r);return(h=o<=n||n<=c?!h:h)?n+=s:n-=s,e.alt=n,l.transformWGS84ToCartesian(e)},!1)}catch(e){console.log(e)}},createCanvasGraphics:function(o){o&&o.positions&&(this._graphicsLayer.entities.add({rectangle:{coordinates:o.positions,material:new a.ImageMaterialProperty({image:new a.CallbackProperty(function(){var e=0,t=document.createElement("canvas"),i=t.getContext("2d"),n=new Image;if(n.src=o.img||"../../images/ysCesium/logo.png",i.clearRect(0,0,o.cwidth,o.cheight),!(e<=o.cwidth))return e=0,e+=3,t;i.drawImage(n,e,0)},!1),transparent:!0})}}),"function"==typeof o.callback)&&o.callback()},createFanShape:function({viewer:e,longitude:t,latitude:i,alt:n,custMaterial:o,speed:r=0,direction:s="+"}){var l,c,h;if(e)return l=this.createGraphics(),c=0,h=this._calcPoints(t,i,n,c),l.wall={positions:new a.CallbackProperty(()=>a.Cartesian3.fromDegreesArrayHeights(h),!1),material:o||a.Color.AQUAMARINE.withAlpha(.5)},e.clock.onTick.addEventListener(()=>{0<r&&(c+=r,h=this._calcPoints(t,i,n,s+c))}),this._graphicsLayer.entities.add(l)},_computeCirclularFlight(t,i,n,o,r,s){var l=[],c=(l.push(t),l.push(i),l.push(0),a.Cartesian3.distance(a.Cartesian3.fromDegrees(t,i),a.Cartesian3.fromDegrees(n,o)));for(let e=r;e<=r+s;e++){var h=c*Math.sin(e*Math.PI/180),u=Math.cos(e*Math.PI/180),d=(o-i)*u+i;l.push((n-t)*u+t),l.push(d),l.push(h)}return l},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,_calcPoints(e,t,i,n){var o=a.Transforms.eastNorthUpToFixedFrame(a.Cartesian3.fromDegrees(e,t)),r=i*Math.cos(n*Math.PI/180),i=i*Math.sin(n*Math.PI/180),n=a.Cartesian3.fromElements(r,i,0),r=a.Matrix4.multiplyByPoint(o,n,new a.Cartesian3),i=a.Cartographic.fromCartesian(r),o=a.Math.toDegrees(i.longitude),n=a.Math.toDegrees(i.latitude);return this._computeCirclularFlight(e,t,o,n,0,90)}};let l=null;function c(e,t,i){e&&(l=t,this._installMaterial())}function h(){}c.prototype={_installMaterial:function(){this._installWaveCircleMaterial(),this._installCircleFadeMaterial(),this._installCityLineMaterial(),this._installWarnMaterial(),this._installFlowMaterial(),this._installPolylineTrailLinkMaterial()},addMaterialLineGraphics:function(e){var t;if(this._viewer&&e&&e.image)return(t=this.createGraphics()).polyline={positions:e.positions,material:new l.PolylineCustomMaterialProperty({color:e.color||l.Color.RED,duration:e.duration||500}),width:e.width},this._viewer.entities.add(t)},getCustomMaterialLine:function(e){if(this._viewer&&e&&e.image)return this._initPolylineCustomMaterialProperty(e)},_initPolylineCustomMaterialProperty(i){if(i){var e=l.Color,t=l.defaultValue,n=l.defined,o=Object.defineProperties,r=l.Event,a=l.createPropertyDescriptor,s=l.Property,c=l.Material,h=e.WHITE,u=i.MaterialType||"wallType"+parseInt(1e3*Math.random());const d=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||l.Color.BLUE,this.duration=e.duration||1e3,this._time=void 0};return o(d.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),d.prototype.getType=function(){return u},d.prototype.getValue=function(e,t){return(t=n(t)?t:{}).color=s.getValueOrClonedDefault(this._color,e,h,t.color),t.image=i.image,void 0===this._time&&(this._time=e.secondsOfDay),t.time=1e3*(e.secondsOfDay-this._time)/this.duration,t},d.prototype.equals=function(e){return this===e||e instanceof d&&s.equals(this._color,e._color)},c._materialCache.addMaterial(u,{fabric:{type:u,uniforms:{color:i.color||new l.Color(1,0,0,.5),image:i.image,time:i.time||0},source:this._getDynamicLineShader({get:!0})},translucent:function(){return!0}}),new d(i)}},addMaterialWallGraphics:function(e){var t;if(this._viewer&&e&&e.image)return(t=this.createGraphics()).wall={positions:e.positions,material:this.getCustomMaterialWall(e),width:e.width},this._viewer.entities.add(t)},getCustomMaterialWall:function(e){if(this._viewer&&e&&e.image)return this._initWallCustomMaterialProperty(e)},_initWallCustomMaterialProperty(i){var n=l.Color,t=l.defaultValue,o=l.defined,e=Object.defineProperties,r=l.Event,a=l.createPropertyDescriptor,s=l.Property,c=l.Material,h=i.MaterialType||"wallType"+parseInt(1e3*Math.random());function u(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||n.BLUE,this.duration=e.duration||3e3,this._time=(new Date).getTime()}return e(u.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),u.prototype.getType=function(){return h},u.prototype.getValue=function(e,t){return(t=o(t)?t:{}).color=s.getValueOrClonedDefault(this._color,e,n.WHITE,t.color),t.image=i.image,t.time=((new Date).getTime()-this._time)%this.duration/this.duration,t},u.prototype.equals=function(e){return this===e||e instanceof u&&s.equals(this._color,e._color)},c._materialCache.addMaterial(h,{fabric:{type:h,uniforms:{color:new n(1,0,0,.5),image:i.image,time:0},source:this._getDirectionWallShader({get:!0,count:i.count,freely:i.freely,direction:i.direction})},translucent:function(){return!0}}),new u(i)},_installWaveCircleMaterial:function(){var t=l.Color,i=l.defaultValue,e=Object.defineProperties,n=l.Event,o=l.Property,r=l.Material;function a(e){e=e||{},this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this._duration=void 0,this._durationSubscription=void 0,this.color=i(e.color,t.fromBytes(0,255,255,255)),this.duration=i(e.duration,45),this.count=Math.max(i(e.count,2),1),this.gradient=i(e.gradient,.1),this.gradient<0?this.gradient=0:1<this.gradient&&(this.gradient=1)}e(a.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),a.prototype.getType=function(){return r.CircleWaveType},a.prototype.getValue=function(e,t){return(t=t||{}).color=o.getValueOrUndefined(this._color,e),t.duration=this._duration,t.count=this.count,t.gradient=this.gradient,t},a.prototype.equals=function(e){return this===e||e instanceof a&&l.Property.equals(this._color,e._color)},e(a.prototype,{color:l.createPropertyDescriptor("color"),duration:l.createPropertyDescriptor("duration")}),l.Scene.CircleWaveMaterialProperty=a,r.CircleWaveType="CircleWave",r._materialCache.addMaterial(r.CircleWaveType,{fabric:{type:r.CircleWaveType,uniforms:{color:new t(1,0,0,.7),duration:45,count:1,gradient:.1},source:this._getDynamicCircleShader({get:!0})},translucent:function(){return!0}})},_installCircleFadeMaterial:function(){var e=l.Color,t=l.defaultValue,i=Object.defineProperties,n=l.Event,o=l.Property,r=l.Material,a=new e(0,0,0,0);function s(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=t(e.color,a),this._duration=e.duration||1e3,this._time=void 0}i(s.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),s.prototype.getType=function(){return r.CircleFadeMaterialType},s.prototype.getValue=function(e,t){return(t=t||{}).color=o.getValueOrClonedDefault(this._color,e,a,t.color),void 0===this._time&&(this._time=(new Date).getTime()),t.time=((new Date).getTime()-this._time)/this._duration,t},s.prototype.equals=function(e){return this===e||e instanceof s&&l.Property.equals(this._color,e._color)},i(s.prototype,{color:l.createPropertyDescriptor("color")}),l.Scene.CircleFadeMaterialProperty=s,r.CircleFadeMaterialType="CircleFadeMaterial",r._materialCache.addMaterial(r.CircleFadeMaterialType,{fabric:{type:r.CircleFadeMaterialType,uniforms:{color:new e(1,0,0,1),time:1},source:this._getCircleFadeShader({get:!0})},translucent:function(){return!0}})},_installCityLineMaterial:function(){var e=l.Color,t=l.defaultValue,i=l.defined,n=Object.defineProperties,o=l.Event,r=l.createPropertyDescriptor,a=l.Property,s=l.Material,c=e.WHITE;function h(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||l.Color.BLUE,this.duration=e.duration||1e3,this._time=void 0,this._img=e.imgUrl||s.PolylineCityLinkImage}n(h.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:r("color")}),h.prototype.getType=function(){return s.PolylineCityLinkType},h.prototype.getValue=function(e,t){return(t=i(t)?t:{}).color=a.getValueOrClonedDefault(this._color,e,c,t.color),t.image=this._img,void 0===this._time&&(this._time=e.secondsOfDay),t.time=1e3*(e.secondsOfDay-this._time)/this.duration,t},h.prototype.equals=function(e){return this===e||e instanceof h&&a.equals(this._color,e._color)},l.Scene.PolylineCityLinkMaterialProperty=h,s.PolylineCityLinkType="PolylineCityLink",s.PolylineCityLinkImage=this.getDfSt(["material","PolylineCityLinkMaterialProperty"])||"static/data/images/Textures/meteor_01.png",s._materialCache.addMaterial(s.PolylineCityLinkType,{fabric:{type:s.PolylineCityLinkType,uniforms:{color:new e(1,0,0,1),image:s.PolylineCityLinkImage,time:0},source:this._getDynamicLightLineShader({get:!0})},translucent:function(){return!0}})},_installWarnMaterial:function(){var i=l.Color,t=l.defaultValue,n=l.defined,e=Object.defineProperties,o=l.Event,r=l.createPropertyDescriptor,a=l.Property,s=l.Material;function c(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||i.BLUE,this.duration=e.duration||3e3,this._time=(new Date).getTime()}e(c.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),c.prototype.getType=function(){return s.WarnLinkType},c.prototype.getValue=function(e,t){return(t=n(t)?t:{}).color=a.getValueOrClonedDefault(this._color,e,i.WHITE,t.color),t.image=s.WarnLinkImage,t.time=((new Date).getTime()-this._time)%this.duration/this.duration,t},c.prototype.equals=function(e){return this===e||e instanceof c&&a.equals(this._color,e._color)},e(c.prototype,{color:r("color")}),l.Scene.WarnLinkMaterialProperty=c,s.WarnLinkType="WarnWallLinkType",s.WarnLinkImage=this.getDfSt(["material","WarnLinkMaterialProperty"])||"static/data/images/Textures/jsx2.png",s._materialCache.addMaterial(s.WarnLinkType,{fabric:{type:s.WarnLinkType,uniforms:{color:new i(1,0,0,.5),image:s.WarnLinkImage,time:0},source:this._getDirectionWallShader({get:!0,count:10,freely:"cross",direction:"-"})},translucent:function(){return!0}})},_installFlowMaterial:function(){var t=l.Color,i=l.defaultValue,e=Object.defineProperties,n=l.Event,o=l.createPropertyDescriptor,r=l.Property,a=l.Material;function s(e){e=i(e,i.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||t.fromBytes(0,255,255,255),this._duration=void 0,this._durationSubscription=void 0,this.duration=i(e.duration,45)}e(s.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),s.prototype.getType=function(){return a.PolylineFlowType},s.prototype.getValue=function(e,t){return(t=t||{}).color=r.getValueOrClonedDefault(this._color,e,l.Color.WHITE,t.color),t.duration=this._duration,t},s.prototype.equals=function(e){return this===e||e instanceof s&&r.equals(this._color,e._color)},e(s.prototype,{color:o("color"),duration:o("duration")}),l.Scene.PolylineFlowMaterialProperty=s,a.PolylineFlowType="PolylineFlow",a._materialCache.addMaterial(a.PolylineFlowType,{fabric:{type:a.PolylineFlowType,uniforms:{color:new t(1,1,2,.7),duration:45},source:this._getFlowLineShader({get:!0})},translucent:function(){return!0}})},_installPolylineTrailLinkMaterial:function(){var e=l.Color,t=l.defaultValue,i=Object.defineProperties,n=l.createPropertyDescriptor,o=l.Event,r=l.Property,a=l.Material,s=this.getDfSt(["primitive","WaterPrimitive"]);function c(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this.color=e.color||l.Color.WHITE,this.image=e.image||s,this._colorSubscription=void 0,this.duration=e.duration||3e3,this._time=(new Date).getTime(),this.speed=e.speed,this.isTranslucent=function(){return!0}}i(c.prototype,{isConstant:{get:function(){return!1},configurable:!0},definitionChanged:{get:function(){return this._definitionChanged},configurable:!0},color:n("color"),duration:n("duration")}),c.prototype.getType=function(){return a.PolylineTrailLinkType},c.prototype.getValue=function(e,t){return(t=l.defined(t)?t:{}).color=r.getValueOrClonedDefault(this._color,e,this.color,t.color),t.image=a.PolylineTrailLinkImage,t.time=((new Date).getTime()-this._time)%this.duration/this.duration*this.speed,t},c.prototype.equals=function(e){return this===e||e instanceof c&&r.equals(this._color,e._color)},a.PolylineTrailLinkSource="\n uniform vec4 color;\n uniform float time;\n uniform sampler2D image;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n return material;\n }",l.Scene.PolylineTrailLinkMaterial=c,a.PolylineTrailLinkType="PolylineTrailLinkMaterial",a.PolylineTrailLinkImage=this.image||s||"static/data/images/Textures/river.png",a._materialCache.addMaterial(a.PolylineTrailLinkType,{fabric:{type:a.PolylineTrailLinkType,uniforms:{color:new e(1,1,1,1),image:a.PolylineTrailLinkImage,time:-20},source:a.PolylineTrailLinkSource},translucent:function(){return!0}})}},h.prototype={_getFlowLineShader:function(){return"uniform vec4 color;\n uniform float duration;\n \n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t =fract(czm_frameNumber / duration);\n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s);\n alpha += 0.1;\n vec4 fragColor;\n fragColor.rgb = (color.rgb) / 0.5;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = fragColor.rgb;\n material.alpha = alpha;\n material.emission = fragColor.rgb;\n return material;\n }\n "},_getDynamicLineShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n if(texture(image, vec2(0.0, 0.0)).a == 1.0){\n discard;\n }else{\n material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;\n }\n \n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n \n return material;\n }\n "},_getDynamicLightLineShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n vec4 colorImage = texture(image, vec2(fract(1.0 *st.s - 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;\n material.emission = fragColor.rgb;\n \n return material;\n }\n "},_getDirectionWallShader:function(e){var t;if(e&&e.get)return t="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n \n ","vertical"==e.freely?t+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.t "+e.direction+" time), fract(st.s)));\n ":t+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.s "+e.direction+" time), fract(st.t)));\n ",t+"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;\n material.emission = fragColor.rgb;\n \n return material;\n }\n "},_getCircleFadeShader:function(e){if(e&&e.get)return"czm_material czm_getMaterial(czm_materialInput materialInput)\n \n {\n \n czm_material material = czm_getDefaultMaterial(materialInput);\n \n material.diffuse = 1.5 * color.rgb;\n \n vec2 st = materialInput.st;\n \n float dis = distance(st, vec2(0.5, 0.5));\n \n float per = fract(time);\n \n if(dis > per * 0.5){\n \n //material.alpha = 0.0;\n \n discard;\n \n }else {\n \n material.alpha = color.a * dis / per / 2.0;\n \n }\n \n return material;\n \n }"},_getDynamicCircleShader:function(e){if(e&&e.get)return"uniform vec4 color;\n uniform float duration;\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 vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber / duration);\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;\n for (int i = 0; i <= 10; 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 } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl, gradient);\n }\n }\n }\n }\n return material;\n }\n "},_getRadarScanShader:function(e){if(e&&e.get)return"uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform vec3 u_scanLineNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\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 \n bool isPointOnLineRight(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){\n vec3 v01 = testPt - ptOnLine;\n normalize(v01);\n vec3 temp = cross(v01, lineNormal);\n float d = dot(temp, u_scanPlaneNormalEC);\n return d > 0.5;\n }\n \n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point -planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\n \n float distancePointToLine(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){\n vec3 tempPt = pointProjectOnPlane(lineNormal, ptOnLine, testPt);\n return length(tempPt - ptOnLine);\n }\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 void main(){\n out_FragColor = texture(colorTexture, v_textureCoordinates);\n float depth = getDepth( texture(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n float twou_radius = u_radius * 2.0;\n if(dis < u_radius){\n float f0 = 1.0 -abs(u_radius - dis) / u_radius;\n f0 = pow(f0, 64.0);\n vec3 lineEndPt = vec3(u_scanCenterEC.xyz) + u_scanLineNormalEC * u_radius;\n float f = 0.0;\n if(isPointOnLineRight(u_scanCenterEC.xyz, u_scanLineNormalEC.xyz, prjOnPlane.xyz)){\n float dis1= length(prjOnPlane.xyz - lineEndPt);\n f = abs(twou_radius -dis1) / twou_radius;\n f = pow(f, float("+e.width+"));\n }\n if(float("+e.border+") > 0.0){\n out_FragColor = mix(out_FragColor, u_scanColor, f + f0);\n } else {\n out_FragColor = mix(out_FragColor, u_scanColor, f);\n }\n }\n }\n "},_getCircleScanShader:function(e){if(e&&e.get)return"uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 u_scanCenterEC;\n uniform vec3 u_scanPlaneNormalEC;\n uniform float u_radius;\n uniform vec4 u_scanColor;\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 \n vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\n vec3 v01 = point - planeOrigin;\n float d = dot(planeNormal, v01) ;\n return (point - planeNormal * d);\n }\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 void main(){\n out_FragColor = texture(colorTexture, v_textureCoordinates);\n float depth = getDepth(texture(depthTexture, v_textureCoordinates));\n vec4 viewPos = toEye(v_textureCoordinates, depth);\n vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n if(dis < u_radius){\n float f = 1.0 - abs(u_radius - dis) / u_radius;\n f = pow(f, float("+e.border+"));\n out_FragColor = mix(out_FragColor, u_scanColor, f);\n }\n }\n "}};let u={},d=void 0;function p(e,t,i){e&&(this._viewer=e,u=t,d=i,this._drawLayer=new u.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer),this.myname="BASE",this._installBaiduImageryProvider(),this._installGooGleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox())}p.prototype={createGraphics:function(){return new u.Entity},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,getDfSt(e){if(d)return e=e.reduce((e,t)=>(e||d)[t],void 0),d.baseService+e},setOneSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})},setTwoSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})},setThreeSkyBox:function(){return new u.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})},setOneGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})},setTwoGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})},setThreeGroundSkyBox:function(){return new u.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})},setDarkEffect:function(e){return e=e||{},this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"darkEffect",fragmentShader:"uniform sampler2D colorTexture;\nin vec2 v_textureCoordinates;\nuniform float scale;\nuniform vec3 offset;\nvoid main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n out_FragColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);\n}\n",uniforms:{scale:1,offset:function(){return e.offset||new u.Cartesian3(.1,.2,.3)}}}))},setBlurBloom:function(e){if(this._viewer&&e)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"blur_x_direction",fragmentShader:"uniform float height;\nuniform float width;\nuniform sampler2D colorTexture1;\n\nin vec2 v_textureCoordinates;\n\nconst int SAMPLES = 9;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nfloat wr = float(1.0 / width);\nfloat hr = float(1.0 / height);\nvec4 result = vec4(0.0);\nint count = 0;\nfor(int i = -SAMPLES; i <= SAMPLES; ++i){\nfor(int j = -SAMPLES; j <= SAMPLES; ++j){\nvec2 offset = vec2(float(i) * wr, float(j) * hr);\nresult += texture(colorTexture1, st + offset);\n}\n}\nresult = result / float(count);\nout_FragColor = result;\n}\n",uniforms:{width:e.width,height:e.height,colorTexture1:"Bright"}}))},setRainEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"rainEffect",fragmentShader:"uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n \n float hash(float x){\n return fract(sin(x*23.3)*13.13);\n }\n \n void main(){\n float time = czm_frameNumber / 60.0;\n vec2 resolution = czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 c=vec3(.6,.7,.8);\n float a=-.4;\n float si=sin(a),co=cos(a);\n uv*=mat2(co,-si,si,co);\n uv*=length(uv+vec2(0,4.9))*.3+1.;\n float v=1.-sin(hash(floor(uv.x*100.))*2.);\n float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n c*=v*b;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);\n }\n "}))},setSnowEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({name:"snowEffect",fragmentShader:"uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n float snow(vec2 uv,float scale){\n float time = czm_frameNumber / 60.0;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));\n if(w<.1)return 0.;\n uv+=time/scale;\n uv.y+=time*2./scale;\n uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;\n vec2 s=floor(uv),f=fract(uv),p;\n float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;\n d=length(p);\n k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*0.01);\n return k*w;\n }\n \n void main(){\n vec2 resolution = czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n float c = 0.0;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);\n \n }\n "}))},setFogEffect:function(){if(this._viewer)return this._viewer.scene.postProcessStages.add(new u.PostProcessStage({fragmentShader:"float getDistance(sampler2D depthTexture, vec2 texCoords) \n{ \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 interpolateByDistance(vec4 nearFarScalar, float distance) \n{ \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{ \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{ \n float distance = getDistance(depthTexture, v_textureCoordinates); \n vec4 sceneColor = texture(colorTexture, v_textureCoordinates); \n float blendAmount = interpolateByDistance(fogByDistance, distance); \n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount); \n out_FragColor = alphaBlend(finalFogColor, sceneColor); \n} \n",uniforms:{fogByDistance:new u.Cartesian4(10,0,200,.3),fogColor:u.Color.AZURE}}))},setDefSceneConfig:function(){this._viewer&&(this._viewer.scene.sun.show=!1,this._viewer.scene.moon.show=!1,this._viewer.scene.fxaa=!0,this._viewer.scene.globe.depthTestAgainstTerrain=!0,this._viewer.scene.undergroundMode=!1,this._viewer.scene.terrainProvider.isCreateSkirt=!1,this._viewer.scene.skyAtmosphere.show=!1,this._viewer.scene.globe.showGroundAtmosphere=!1,this._viewer.scene.globe.enableLighting=!0,this._viewer.scene.fog.enabled=!1,this._viewer.cesiumWidget.creditContainer.style.display="none")},setBloomLightScene:function(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=!0,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=!1,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=!1)},removePostProcessStage:function(e){e&&(Array.isArray(e)?e.forEach(e=>{this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e)}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e))},setView:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new u.Cartesian3(0,e.distance,window.opt.distance),e.position=u.Cartesian3.add(e.position,t,new u.Cartesian3)),this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:u.Math.toRadians(90),pitch:u.Math.toRadians(90),roll:u.Math.toRadians(0)}}))},flyTo:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new u.Cartesian3(0,e.distance,0),e.position=u.Cartesian3.add(e.position,t,new u.Cartesian3)),this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:u.Math.toRadians(90),pitch:u.Math.toRadians(90),roll:u.Math.toRadians(0)},easingFunction:e.easingFunction||u.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback}))},transformCartesianToWGS84:function(e){if(this._viewer&&e)return e=u.Ellipsoid.WGS84.cartesianToCartographic(e),{lng:u.Math.toDegrees(e.longitude),lat:u.Math.toDegrees(e.latitude),alt:e.height}},transformWGS84ArrayToCartesianArray:function(e,t){var i;if(this._viewer&&e)return i=this,e?e.map(function(e){return i.transformWGS84ToCartesian(e,t)}):[]},transformWGS84ToCartesian:function(e,t){if(this._viewer)return e?u.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=t||e.alt,u.Ellipsoid.WGS84):u.Cartesian3.ZERO},transformCartesianArrayToWGS84Array:function(e){var t;if(this._viewer)return t=this,e?e.map(function(e){return t.transformCartesianToWGS84(e)}):[]},transformWGS84ToCartographic:function(e){return e?u.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):u.Cartographic.ZERO},lnglatArrayToCartesians:function(t){if(!t||t.length<1)return[];var i=[];for(let e=0;e<t.length;e++){var n=u.Cartesian3.fromDegrees(Number(t[e][0]),Number(t[e][1]),Number(t[e][2]||0));i.push(n)}return i},setCameraEotateHeading(l){if(l){let t=this._viewer,i=u.Cartesian3.fromDegrees(l.lng,l.lat,l.height),n=u.Math.toRadians(-30),o=12,r=5e3,e=u.JulianDate.fromDate(new Date),a=(t.clock.startTime=e.clone(),t.clock.currentTime=e.clone(),t.clock.clockRange=u.ClockRange.CLAMPED,t.clock.clockStep=u.ClockStep.SYSTEM_CLOCK,t.camera.heading),s=function(){var e=u.JulianDate.secondsDifference(t.clock.currentTime,t.clock.startTime),e=u.Math.toRadians(e*o)+a;t.scene.camera.setView({destination:i,orientation:{heading:e,pitch:n}}),t.scene.camera.moveBackward(r),0<=u.JulianDate.compare(t.clock.currentTime,t.clock.stopTime)&&t.clock.onTick.removeEventListener(s)};t.clock.onTick.addEventListener(s)}},getCatesian3FromPX:function(e){if(this._viewer&&e){var t,i,n=this._viewer.scene.pick(e),o=null,r=!1,a=!1;if((r=n instanceof u.Cesium3DTileFeature?!0:r)&&(o=this._viewer.scene.pickPosition(e))&&((t=u.Cartographic.fromCartesian(o)).height<0&&(t.height=0),s=u.Math.toDegrees(t.longitude),i=u.Math.toDegrees(t.latitude),t=t.height,o=this.transformWGS84ToCartesian({lng:s,lat:i,alt:t})),!n){var s=this._viewer.scene.camera.getPickRay(e);if(!s)return null;o=this._viewer.scene.globe.pick(s,this._viewer.scene),a=!0}return(o=r||a?o:this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid))?(i=this.transformCartesianToWGS84(o)).alt<0?this.transformWGS84ToCartesian(i,.1):o:!1}},getCameraPosition:function(){if(this._viewer){var e,t,i,n,o,r,a,s,l,c,h,d=this._viewer.scene.camera.pickEllipsoid(new u.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(d)return e=180*(d=u.Ellipsoid.WGS84.cartesianToCartographic(d)).longitude/Math.PI,d=180*d.latitude/Math.PI,n=this._viewer.camera._direction,t=u.Math.toDegrees(n.x),i=u.Math.toDegrees(n.y),n=u.Math.toDegrees(n.z),o=this._viewer.camera.positionCartographic.height,r=u.Math.toDegrees(this._viewer.camera.heading),a=u.Math.toDegrees(this._viewer.camera.pitch),s=u.Math.toDegrees(this._viewer.camera.roll),c=(l=this._viewer.camera.computeViewRectangle()).west/Math.PI*180,h=l.north/Math.PI*180,c=(c+l.east/Math.PI*180)/2,h=(h+l.south/Math.PI*180)/2,{lon:e,lat:d,height:o,heading:r,pitch:a,roll:s,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:c,y:h},direction:new u.Cartesian3(t,i,n)}}},getHandlerClickPosition(e){var t,i,n;if(this._viewer)return n=this._viewer.scene,t=this._viewer,i=n.camera.pickEllipsoid(e.position,n.globe.elliposid),t={heading:u.Math.toDegrees(t.camera.heading),pitch:u.Math.toDegrees(t.camera.pitch),roll:u.Math.toDegrees(t.camera.roll),position:t.camera.position},(i=u.Cartographic.fromCartesian(i)).height<0&&(i.height=0),i={alt:i.height,lat:u.Math.toDegrees(i.latitude),lon:u.Math.toDegrees(i.longitude)},n=n.pickPosition(e.position),{wgs84Coor:i,graphicCoor:{height:(e=u.Cartographic.fromCartesian(n)).height,latitude:u.Math.toDegrees(e.latitude),longitude:u.Math.toDegrees(e.longitude)},cameraPosition:t}},updateCameraState:function(e){this._viewer.scene._screenSpaceCameraController.enableRotate=e,this._viewer.scene._screenSpaceCameraController.enableTranslate=e,this._viewer.scene._screenSpaceCameraController.enableZoom=e,this._viewer.scene._screenSpaceCameraController.enableTilt=e,this._viewer.scene._screenSpaceCameraController.enableLook=e},bindHandelEvent:function({leftClick:t,mouseMove:i,doubleClick:n,leftDown:o,mouseWheel:r,leftUp:a}){var s;this._viewer&&(s=new u.ScreenSpaceEventHandler(this._viewer.canvas),t&&s.setInputAction(function(e){t(e,s)},u.ScreenSpaceEventType.LEFT_CLICK),i&&s.setInputAction(function(e){i(e,s)},u.ScreenSpaceEventType.MOUSE_MOVE),n&&s.setInputAction(function(e){n(e,s)},u.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),o&&s.setInputAction(function(e){o(e,s)},u.ScreenSpaceEventType.LEFT_DOWN),r&&s.setInputAction(function(e){r(e,s)},u.ScreenSpaceEventType.WHEEL),a)&&s.setInputAction(function(e){a(e,s)},u.ScreenSpaceEventType.LEFT_UP)},getHandelPosition:function(t){var i,n;this._viewer&&(i=new u.ScreenSpaceEventHandler(this._viewer.scene.canvas),n=this,i.setInputAction(function(e){e=n._viewer.scene.camera.pickEllipsoid(e.endPosition,n._viewer.scene.globe.ellipsoid);"function"==typeof t&&t(n.transformCartesianToWGS84(e),i)},u.ScreenSpaceEventType.MOUSE_MOVE))},saveSceneImages:function(){var e,t;this._viewer&&(t=this._viewer.scene.canvas.toDataURL("image/png").replace("image/png","image/octet-stream"),e=document.createElement("a"),t=function(e){for(var e=e.split(","),t=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,o=new Uint8Array(n);n--;)o[n]=i.charCodeAt(n);return new Blob([o],{type:t})}(t),t=URL.createObjectURL(t),e.download="scene.png",e.href=t,e.click())},_installAmapImageryProvider:function(){u.Scene.AmapImageryProvider=function(e){return e.url="img"===e.style?"https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}":"http://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}",e.subdomains||(e.subdomains=["01","02","03","04"]),new u.UrlTemplateImageryProvider(e)}},_installTdtImageryProvider:function(){u.Scene.TdtImageryProvider=function(e){return new u.WebMapTileServiceImageryProvider({url:"https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}".replace(/\{layer\}/g,e.style||"vec").replace(/\{key\}/g,e.key||""),layer:e.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}},_installTencentImageryProvider:function(){u.Scene.TencentImageryProvider=function(e){return"img"===e.layer?(e.url||(e.url="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229"),e.subdomains||(e.subdomains=["0","1","2"]),e.customTags={sx:function(e,t,i,n){return t>>4},sy:function(e,t,i,n){return(1<<n)-i>>4}}):e.url||(e.url="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1"),new u.UrlTemplateImageryProvider(e)}},_installGooGleImageryProvider:function(){u.Scene.GoogleImageryProvider=function(e){return e.url="img"===e.style?"http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali":"ter"===e.style?"http://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile":"http://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",e.subdomains||(e.subdomains=["1","2","3","4","5"]),new u.UrlTemplateImageryProvider(e)}},_installBaiduImageryProvider:function(){var t="http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function e(e){t=e.url||t,this._url=t,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new u.WebMercatorTilingScheme({rectangleSouthwestInMeters:new u.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new u.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=e.style||"normal",this._ready=!0}Object.defineProperties(e.prototype,{url:{get:function(){return this._url}},token:{get:function(){return this._token}},tileWidth:{get:function(){if(this.ready)return this._tileWidth;throw new u.DeveloperError("tileWidth must not be called before the imagery provider is ready.")}},tileHeight:{get:function(){if(this.ready)return this._tileHeight;throw new u.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},maximumLevel:{get:function(){if(this.ready)return this._tileHeight;throw new u.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},minimumLevel:{get:function(){if(this.ready)return 0;throw new u.DeveloperError("minimumLevel must not be called before the imagery provider is ready.")}},tilingScheme:{get:function(){if(this.ready)return this._tilingScheme;throw new u.DeveloperError("tilingScheme must not be called before the imagery provider is ready.")}},rectangle:{get:function(){if(this.ready)return this._rectangle;throw new u.DeveloperError("rectangle must not be called before the imagery provider is ready.")}},ready:{get:function(){return!!this._url}},credit:{get:function(){return this._credit}},readyPromise:{get:function(){return this._readyPromise.promise}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),e.prototype.getTileCredits=function(e,t,i){},e.prototype.requestImage=function(e,t,i){var n,o,r,a;if(this.ready)return e=e,t=t,i=i,o=(n=this)._style,r=n._url+"&x={x}&y={y}&z={z}&customid={style}",a=n._tilingScheme.getNumberOfXTilesAtLevel(i),n=n._tilingScheme.getNumberOfYTilesAtLevel(i),r=r.replace("{x}",e-a/2).replace("{y}",n/2-t-1).replace("{z}",i).replace("{style}",o),u.ImageryProvider.loadImage(this,r);throw new u.DeveloperError("requestImage must not be called before the imagery provider is ready.")},u.Scene.BaiduImageryProvider=e},_installGroundSkyBox:function(){var a=u.BoxGeometry,s=u.Cartesian3,t=u.defaultValue,l=u.defined,i=u.destroyObject,c=u.DeveloperError,h=u.GeometryPipeline,e=u.Matrix3,d=u.Matrix4,p=u.Transforms,m=u.VertexFormat,g=u.BufferUsage,f=u.CubeMap,n=u.DrawCommand,y=u.loadCubeMap,v=u.RenderState,w=u.VertexArray,_=u.BlendingState,C=u.SceneMode,P=u.ShaderProgram,x=u.ShaderSource;function o(e){this.sources=e.sources,this._sources=void 0,this.show=t(e.show,!0),this._command=new n({modelMatrix:d.clone(d.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}l(d.getRotation)||(d.getRotation=d.getMatrix3);var b=new e;o.prototype.update=function(e,t){var i=this;if(this.show&&(e.mode===C.SCENE3D||e.mode===C.MORPHING)&&e.passes.render){var n=e.context;if(this._sources!==this.sources){this._sources=this.sources;var o=this.sources;if(!(l(o.positiveX)&&l(o.negativeX)&&l(o.positiveY)&&l(o.negativeY)&&l(o.positiveZ)&&l(o.negativeZ)))throw new c("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof o.positiveX!=typeof o.negativeX||typeof o.positiveX!=typeof o.positiveY||typeof o.positiveX!=typeof o.negativeY||typeof o.positiveX!=typeof o.positiveZ||typeof o.positiveX!=typeof o.negativeZ)throw new c("this.sources properties must all be the same type.");"string"==typeof o.positiveX?y(n,this._sources).then(function(e){i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:n,source:o}))}var r=this._command;if(r.modelMatrix=p.eastNorthUpToFixedFrame(e.camera._positionWC),l(r.vertexArray)||(r.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return d.getRotation(r.modelMatrix,b)}},o=a.createGeometry(a.fromDimensions({dimensions:new s(2,2,2),vertexFormat:m.POSITION_ONLY})),e=this._attributeLocations=h.createAttributeLocations(o),r.vertexArray=w.fromGeometry({context:n,geometry:o,attributeLocations:e,bufferUsage:g._DRAW}),r.renderState=v.fromCache({blending:_.ALPHA_BLEND})),l(r.shaderProgram)&&this._useHdr===t||(o=new x({defines:[t?"HDR":""],sources:["uniform samplerCube u_cubeMap;\n in vec3 v_texCoord;\n void main()\n {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n "]}),r.shaderProgram=P.fromCache({context:n,vertexShaderSource:"in vec3 position;\n out vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\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.xyz;\n }\n ",fragmentShaderSource:o,attributeLocations:this._attributeLocations}),this._useHdr=t),l(this._cubeMap))return r}},o.prototype.isDestroyed=function(){return!1},o.prototype.destroy=function(){var 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(),i(this)},u.Scene.GroundSkyBox=o},removeHandlerByName(e=[]){e.forEach(e=>{this._viewer.screenSpaceEventHandler.removeInputAction(u.ScreenSpaceEventType[e])})}};let m={};function f(e,t){e&&(this._viewer=e,m=t)}f.prototype={splitCartesians3:function(e){for(var t=[],i=0;i<e.length;i+=3){var n=new m.Cartesian3(e[i],e[i+1],e[i+2]);t.push(n)}return t.push(t[0]),t},getLinkedPointList:function(e,t,i,n){if(this._viewer){var o=[],r=m.Cartographic.fromCartesian(e),a=m.Cartographic.fromCartesian(t),s=180*r.longitude/Math.PI,r=180*r.latitude/Math.PI,l=180*a.longitude/Math.PI,a=180*a.latitude/Math.PI,c=Math.sqrt((s-l)*(s-l)+(r-a)*(r-a))*i,h=m.Cartesian3.clone(e),u=m.Cartesian3.clone(t),d=m.Cartesian3.distance(h,m.Cartesian3.ZERO),p=m.Cartesian3.distance(u,m.Cartesian3.ZERO);if(m.Cartesian3.normalize(h,h),m.Cartesian3.normalize(u,u),0!=m.Cartesian3.distance(h,u)){var g=m.Cartesian3.angleBetween(h,u);o.push(e);for(var f=1;f<n-1;f++){var y=+f/(n-1),v=1-y,w=Math.sin(v*g)/Math.sin(g),_=Math.sin(y*g)/Math.sin(g),w=m.Cartesian3.multiplyByScalar(h,w,new m.Cartesian3),_=m.Cartesian3.multiplyByScalar(u,_,new m.Cartesian3),w=m.Cartesian3.add(w,_,new m.Cartesian3),_=y*Math.PI,v=d*v+p*y+Math.sin(_)*c,w=m.Cartesian3.multiplyByScalar(w,v,w);o.push(w)}o.push(t)}return o}},getPositionsAngle:function(e){var t,i,n,o;if(e)return i=e.position1,o=e.position2,n=m.Transforms.eastNorthUpToFixedFrame(i),n=m.Matrix4.inverse(n,new m.Matrix4),i=m.Matrix4.multiplyByPoint(n,i,new m.Cartesian3),n=m.Matrix4.multiplyByPoint(n,o,new m.Cartesian3),"pitch"===e.type?t=Math.atan2(n.z-i.z,n.x-i.x):"heading "===e.type&&(t=Math.atan2(n.y-i.y,n.x-i.x)),(o=t*(180/Math.PI))<0&&(o+=360),o},getPositionsArea:function(n){let e=0;if(n){let t=0,i=m.Ellipsoid.WGS84;n.push(n[0]);for(let e=1;e<n.length;e++){var o=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e-1])),r=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e]));t+=o.x*r.y-r.x*o.y}e=Math.abs(t).toFixed(2)}return e},getPolygonArea:function(i){if(this._viewer){let r=Math.PI/180,a=180/Math.PI;const l=function(e,t){var i=e.lat*r,e=e.lon*r,n=t.lat*r,t=t.lon*r;let o=-Math.atan2(Math.sin(e-t)*Math.cos(n),Math.cos(i)*Math.sin(n)-Math.sin(i)*Math.cos(n)*Math.cos(e-t));return o<0&&(o+=2*Math.PI),o*=a};let t=0;for(let e=0;e<i.length-2;e++){var n=(e+1)%i.length,o=(e+2)%i.length,s=function(e,t,i){let n=l(t,e)-l(t,i);return n<0&&(n+=360),n}(i[e],i[n],i[o]);t+=this.getPointDistance(this.transformWGS84ToCartesian(i[e]),this.transformWGS84ToCartesian(i[n]))*this.getPointDistance(this.transformWGS84ToCartesian(i[n]),this.transformWGS84ToCartesian(i[o]))*Math.abs(Math.sin(s))}return t.toFixed(2)}},getPointDistance:function(e,t){var i;if(this._viewer)return e=m.Cartographic.fromCartesian(e),t=m.Cartographic.fromCartesian(t),(i=new m.EllipsoidGeodesic).setEndPoints(e,t),i=i.surfaceDistance,Math.sqrt(Math.pow(i,2)+Math.pow(t.height-e.height,2))},getPositionDistance:function(t){let i=0;for(let e=0;e<t.length-1;e++){var n=this.transformWGS84ToCartographic(t[e]),o=this.transformWGS84ToCartographic(t[e+1]),r=new m.EllipsoidGeodesic,r=(r.setEndPoints(n,o),r.surfaceDistance),r=Math.sqrt(Math.pow(r,2)+Math.pow(o.height-n.height,2));i+=r}return i.toFixed(3)},getIntersectObj:function(e,t,i=[],n=!1){if(this._viewer)return t=m.Cartesian3.normalize(m.Cartesian3.subtract(t,e,new m.Cartesian3),new m.Cartesian3),e=new m.Ray(e,t),t=[],n?t=this._viewer.scene.drillPickFromRay(e,10,i):(n=this._viewer.scene.pickFromRay(e,i),m.defined(n)&&(t=[n])),t},getPointOnEllipsoid:function(e,t,i,n,o,r,a,s,l,c){var h,u,d,p;if(this._viewer)return h=new m.Cartesian3,u=new m.Cartesian3,d=new m.Quaternion,p=new m.Matrix3,t=e+t,m.Cartesian3.multiplyByScalar(n,Math.cos(t),h),m.Cartesian3.multiplyByScalar(i,Math.sin(t),u),m.Cartesian3.add(h,u,h),n=Math.cos(e),n*=n,i=Math.sin(e),i*=i,t=r/Math.sqrt(a*n+o*i)/s,m.Quaternion.fromAxisAngle(h,t,d),m.Matrix3.fromQuaternion(d,p),m.Matrix3.multiplyByVector(p,l,c),m.Cartesian3.normalize(c,c),m.Cartesian3.multiplyByScalar(c,s,c),c},raisePositionsToHeight:function(e,t,i){if(this._viewer){for(var n=new m.Cartesian3,o=new m.Cartesian3,r=new m.Cartesian3,a=new m.Cartesian3,s=t.ellipsoid,l=t.height,c=t.extrudedHeight,t=i?e.length/3*2:e.length/3,h=new Float64Array(3*t),u=e.length,d=i?u:0,p=0;p<u;p+=3){var g=p+1,f=p+2,y=m.Cartesian3.fromArray(e,p,n),v=(s.scaleToGeodeticSurface(y,y),m.Cartesian3.clone(y,o)),w=s.geodeticSurfaceNormal(y,a),_=m.Cartesian3.multiplyByScalar(w,l,r);m.Cartesian3.add(y,_,y),i&&(m.Cartesian3.multiplyByScalar(w,c,_),m.Cartesian3.add(v,_,v),h[p+d]=v.x,h[g+d]=v.y,h[f+d]=v.z),h[p]=y.x,h[g]=y.y,h[f]=y.z}return h}},computeEllipseEdgePositions:function(e){if(this._viewer){for(var t=new m.Cartesian3,i=new m.Cartesian3,n=new m.Cartesian3,o=new m.Cartesian3,r=e.semiMinorAxis,a=e.semiMajorAxis,s=e.rotation,l=e.center,e=e.granularity&&"number"==typeof e.granularity?e.granularity:Math.PI/180,c=((e=e>Math.PI/12?Math.PI/12:e)<Math.PI/180&&(e=Math.PI/180),r*r),h=a*a,u=a*r,d=m.Cartesian3.magnitude(l),p=m.Cartesian3.normalize(l,t),g=m.Cartesian3.cross(m.Cartesian3.UNIT_Z,l,i),g=m.Cartesian3.normalize(g,g),f=m.Cartesian3.cross(p,g,n),y=Math.ceil(2*m.Math.PI/e),v=e,w=o,_=0,C=[],P=0;P<y;P++)w=this.getPointOnEllipsoid(P*v,s,f,g,c,u,h,d,p,w),C[_++]=w.x,C[_++]=w.y,C[_++]=w.z;a={};return a.numPts=y,a.outerPositions=C,a}},computeSectorEdgePositions:function(e){if(this._viewer){for(var t=new m.Cartesian3,i=new m.Cartesian3,n=new m.Cartesian3,o=new m.Cartesian3,r=e.semiMinorAxis,a=e.semiMajorAxis,s=e.rotation,l=e.angle||2*Math.PI,c=e.center,e=e.granularity&&"number"==typeof e.granularity?e.granularity:Math.PI/180,h=((e=e>Math.PI/12?Math.PI/12:e)<Math.PI/180&&(e=Math.PI/180),r*r),u=a*a,d=a*r,p=m.Cartesian3.magnitude(c),g=m.Cartesian3.normalize(c,t),f=m.Cartesian3.cross(m.Cartesian3.UNIT_Z,c,i),f=m.Cartesian3.normalize(f,f),y=m.Cartesian3.cross(g,f,n),v=Math.ceil(l/e),w=e,_=o,C=0,P=[],x=0;x<v;x++)_=this.getPointOnEllipsoid(x*w,s,y,f,h,d,u,p,g,_),P[C++]=_.x,P[C++]=_.y,P[C++]=_.z;a={};return a.numPts=v,a.outerPositions=P,a}},computeLonlatPointsTerrainData:function(e,t){if(this._viewer){for(var i=[],n=0;n<e.length;n++)i.push(m.Cartographic.fromDegrees(e[n].lon,e[n].lat));this._viewer.scene.clampToHeightMostDetailed(i).then(function(e){t(e)})}},computeCartographicPointsTerrainData:function(e,o){if(this._viewer&&!(e.length<=0)){for(var t=[],i=0;i<e.length;i++)t.push(m.Cartesian3.fromRadians(e[i].longitude,e[i].latitude,e[i].height));var n=this._viewer.scene.clampToHeightMostDetailed(t),r=this;n.then(function(e){for(var t=[],i=r._viewer.scene.globe.ellipsoid,n=0;n<e.length;n++)t.push(i.cartesianToCartographic(e[n]));o(t)}).catch(function(e){console.log(e)})}},_checkLonDegree:function(e){return!(180<e||e<-180)},_checkLatDegree:function(e){return!(90<e||e<-90)},computeInterpolateLineLonlat:function(e,t){if(!e||!t)return null;if(e.lon||!e.lat||!t.lon||!t.lat)return null;if(!(this._checkLonDegree(e.lon)&&this._checkLonDegree(t.lon)&&this._checkLatDegree(e.lat)&&this._checkLatDegree(t.lat)))return null;var i=[],n=(i.push([e.lon,e.lat]),Math.sqrt(Math.pow(t.lon-e.lon,2)+Math.pow(t.lat-e.lat,2)));if(n<=1e-5)i.push([t.lon,t.lat]);else for(var o=n/1e-5,r=(t.lon-e.lon)/o,a=(t.lat-e.lat)/o,s=0;s<o;s++){var l=e.lon+(s+1)*r,c=e.lat+(s+1)*a;i.push([l,c])}return i},computeInterpolateLineCartographic:function(e,t,i){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var n=[],o=(n.push(new m.Cartographic(e.longitude,e.latitude)),Math.sqrt(Math.pow(t.longitude-e.longitude,2)+Math.pow(t.latitude-e.latitude,2))),i=i&&"number"==typeof i?i:1e-5*Math.PI/180;if(o<=i)n.push(new m.Cartographic(t.longitude,t.latitude));else{for(var r=o/i,a=(t.longitude-e.longitude)/r,s=(t.latitude-e.latitude)/r,l=0;l<r;l++){var c=e.longitude+(l+1)*a,h=e.latitude+(l+1)*s;n.push(new m.Cartographic(c,h))}n.push(new m.Cartographic(t.longitude,t.latitude,t.height))}return n},computeInterpolateLineHeightCartographic:function(e,t){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var i=[],n=(i.push(new m.Cartographic(e.longitude,e.latitude,e.height)),Math.sqrt(Math.pow(t.longitude-e.longitude,2)+Math.pow(t.latitude-e.latitude,2)));if(!(n<=1e-5*Math.PI/180))for(var o=n/1e-5*Math.PI/180,r=(t.longitude-e.longitude)/o,a=(t.latitude-e.latitude)/o,s=(t.height-e.height)/o,l=0;l<o;l++){var c=e.longitude+(l+1)*r,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;i.push(new m.Cartographic(c,h,u))}return i.push(new m.Cartographic(t.longitude,t.latitude,t.height)),i},computeInterpolate2IndexLineHeightCartographic:function(e,t,i,n){if(!e||!t)return null;if(!(e.longitude&&e.latitude&&t.longitude&&t.latitude))return null;var o=[];o.push(new m.Cartographic(e.longitude,e.latitude,e.height));for(var r=(t.longitude-e.longitude)/i,a=(t.latitude-e.latitude)/i,s=(t.height-e.height)/i,l=0;l<n;l++){var c=e.longitude+(l+1)*r,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;o.push(new m.Cartographic(c,h,u))}return o},computeInterpolateIndexLineHeightCartographic:function(e,t,i,n){var o,r;return e&&t&&e.longitude&&e.latitude&&t.longitude&&t.latitude?(o=(t.longitude-e.longitude)/i,r=(t.latitude-e.latitude)/i,t=(t.height-e.height)/i,i=e.longitude+n*o,o=e.latitude+n*r,r=e.height+n*t,new m.Cartographic(i,o,r)):null}};let g=null;function v(e,t,i){e&&(this._viewer=e,g=t,this._installPrimitives())}v.prototype={_installPrimitives:function(){this._installProbingPrimitive(),this._installTexturePrimitive(),this._installWaterPrimitive(),this._installPointsPrimitive(),this._installShadowPrimitive(),this._installArrowPolylinePrimitive(),this._installXyzAxisPrimitive(),this._installTetrahedronPrimitive()},_installTetrahedronPrimitive:function(){try{function e(e){this.show=!0,this._command=void 0,this._enuMatrix=void 0,this._scaleMatrix=void 0,this._localPosition=e.position,this._createCommand=T,this._angle=0,this._distance=b(e.distance,1),this._setInterval=void 0,this._viewer=S,this._speed=b(e.speed,1),this._color=b(e.color,new t(1,1,0,.8)),this._scale=b(e.scale,new i(10,10,15)),this._texture=void 0,this._imageUrl=M,this._modelMatrix=R(this),this._height=k(this),D(this)}var i=g.Cartesian3,n=g.ComponentDatatype,a=g.PrimitiveType,o=g.BoundingSphere,r=g.GeometryAttribute,s=g.GeometryPipeline,l=g.Geometry,c=g.defined,h=g.RenderState,u=g.ShaderSource,d=g.ShaderProgram,p=g.DrawCommand,m=g.Pass,f=g.Appearance,y=g.BufferUsage,t=g.Color,v=g.VertexArray,w=(g.buildModuleUrl,g.Matrix4),_=g.Matrix3,C=g.Texture,P=g.Resource,x=g.Transforms,b=g.defaultValue,S=this._viewer,M=this.getDfSt(["primitive","TetrahedronPrimitive"])||"static/data/images/Textures/fence.png";e.prototype.update=function(e){this.show&&(c(this._command)||(this._command=this._createCommand(e.context,this)),c(this._command))&&e.commandList.push(this._command)},e.prototype.isDestroyed=function(){return!1},e.prototype.destroy=function(){return c(this._command)&&(this._command.shaderProgram=this._command.shaderProgram&&this._command.shaderProgram.destroy()),destroyObject(this)},e.prototype.startAnimate=function(){let t=this;this._setInterval=setInterval(function(){t._angle=t._angle+.01,0<Math.sin(t._angle)?t._height=.01:t._height=-.01;var e=new g.Cartesian3(0,0,t._height),e=(w.multiplyByTranslation(t._modelMatrix,e,t._modelMatrix),w.fromRotationTranslation(_.fromRotationZ(g.Math.toRadians(t._speed))));w.multiply(t._modelMatrix,e,t._modelMatrix)},5)},e.prototype.closeAnimate=function(){clearInterval(this._setInterval)};const T=function(e,t){var i=L(),n=I(),o=f.getDefaultRenderState(!1,!0,void 0),o=h.fromCache(o),i=new u({sources:[i]}),n=new u({sources:[n]}),r={color:function(){return t._color},myImage:function(){return c(t._texture)?t._texture:t._viewer.scene.context.defaultTexture}},i=d.fromCache({context:e,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:{position:0,textureCoordinates:1}});return new p({vertexArray:A(e),primitiveType:a.TRIANGLES,renderState:o,shaderProgram:i,uniformMap:r,owner:this,pass:m.TRANSLUCENT,modelMatrix:t._modelMatrix})},A=function(e){var t=E(),t=new l({attributes:{position:new r({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.positions}),textureCoordinates:new r({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:t.sts})},indices:t.indices,primitiveType:a.TRIANGLES,boundingSphere:o.fromVertices(t.positions)}),t=s.computeNormal(t);return v.fromGeometry({context:e,geometry:t,attributeLocations:{position:0,textureCoordinates:1},bufferUsage:y.STATIC_DRAW})},E=function(){var e=new Float64Array(15),t=(e[0]=0,e[1]=1,e[2]=0,e[3]=-1,e[4]=0,e[5]=0,e[6]=0,e[7]=-1,e[8]=0,e[9]=1,e[10]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=-1,new Uint16Array(18));return t[0]=4,t[1]=2,t[2]=3,t[3]=4,t[4]=3,t[5]=0,t[6]=4,t[7]=0,t[8]=1,t[9]=4,t[10]=1,t[11]=2,t[12]=1,t[13]=2,t[14]=3,t[15]=1,t[16]=3,t[17]=0,{indices:t,positions:e,sts:new Float32Array([0,0,1,0,1,1,0,1,.5,.5])}},L=function(){return"#version 300 es\n in vec3 position;\n in vec3 normal;\n in vec2 st;\n in float batchId;\n out vec3 v_positionEC;\n out vec3 v_normalEC;\n out vec2 v_st;\n out vec4 v_pickColor;\n void main()\n {\n v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz;\n v_normalEC = czm_normal * normal;\n v_st = st;\n // v_pickColor = czm_batchTable_pickColor(batchId);\n gl_Position = czm_modelViewProjection * vec4(position, 1.0);\n }\n "},I=function(){return"#version 300 es\n precision mediump float;\n in vec3 v_positionEC;\n in vec3 v_normalEC;\n in vec2 v_st;\n uniform vec4 color;\n in vec4 v_pickColor;\n uniform sampler2D myImage;\n void main()\n {\n vec3 positionToEyeEC = -v_positionEC;\n vec3 normalEC = normalize(v_normalEC);\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n vec2 st = materialInput.st;\n czm_material material = czm_getDefaultMaterial(materialInput);\n float dt_a11 = fract(czm_frameNumber / 100.0) * 3.14159265 * 2.0;\n float dt_a12 = sin(dt_a11);\n float vst=smoothstep(0.7, 1.0, dt_a12)+0.4;\n vec4 colorImage = texture(myImage, vec2(fract(st.s- czm_frameNumber*0.003), st.t));\n material.alpha =mix(0.1,1.0,clamp((1.0-st.t) * color.a,0.0,1.0)) +(1.0-sign(st.t-czm_frameNumber*0.001))*0.2*(1.0-colorImage.r)+0.4;\n material.diffuse =(1.0-colorImage.a)*vec3(1.0,2.0,1.0)+colorImage.rgb*vec3(1.0,2.0,1.0);\n #ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n #endif\n }\n "},D=function(i){P.createIfNeeded(i._imageUrl).fetchImage().then(function(e){var t=i._viewer.scene.context,t=c(e.internalFormat)?new C({context:t,pixelFormat:e.internalFormat,width:e.naturalWidth,height:e.naturalHeight,source:{arrayBufferView:e.bufferView}}):new C({context:t,source:e});i._texture=t})},R=function(e){var t=x.eastNorthUpToFixedFrame(e._localPosition),i=w.fromScale(e._scale),n=w.multiply(t,i,new w);return e._scaleMatrix=i,e._enuMatrix=t,n},k=function(e){var t=i.fromElements(0,0,e._distance,new g.Cartesian3),t=g.Matrix4.multiplyByPoint(e._enuMatrix,t,new i),t=w.multiplyByPoint(e._viewer.scene.camera._viewMatrix,t,new i),e=w.multiplyByPoint(e._viewer.scene.camera.frustum.projectionMatrix,t,new i);return i.normalize(e,new i).z};g.Scene.TetrahedronPrimitive=e}catch(i){console.log(i)}},_installXyzAxisPrimitive:function(){function e(e){this._viewer=e.viewer,this._model=e.model,this._matrix=e.matrix,this._radius=void 0,this._layer=new g.CustomDataSource("xyz-axis"),this._viewer.dataSources.add(this._layer),this._handler=new g.ScreenSpaceEventHandler(this._viewer.scene.canvas),this._xyzState=!1,this._xyzPid=void 0,this._builds()}e.prototype={_builds(){this._createAxisXYZ(),this._bindHandler()},remove(){this._layer._primitives.removeAll(),this._handler.distory()},_createAxisXYZ:function(){this._model.readyPromise.then(e=>{var t=g.Matrix4.getTranslation(e.modelMatrix,new g.Cartesian3),e=e.boundingSphere,i=e.radius,n=new g.ArrowPolylinePrimitive({id:"axisZ",color:g.Color.RED,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),o=new g.ArrowPolylinePrimitive({id:"axisX",color:g.Color.GREEN,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),t=new g.ArrowPolylinePrimitive({id:"axisY",color:g.Color.BLUE,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),i=g.Matrix3.fromRotationY(g.Math.toRadians(90)),i=(this._rotationX=g.Matrix4.fromRotationTranslation(i),g.Matrix4.multiply(o.geometryInstances[0].modelMatrix,this._rotationX,o.geometryInstances[0].modelMatrix),g.Matrix4.multiply(o.geometryInstances[1].modelMatrix,this._rotationX,o.geometryInstances[1].modelMatrix),g.Matrix3.fromRotationX(g.Math.toRadians(90)));this._rotationY=g.Matrix4.fromRotationTranslation(i),g.Matrix4.multiply(t.geometryInstances[0].modelMatrix,this._rotationY,t.geometryInstances[0].modelMatrix),g.Matrix4.multiply(t.geometryInstances[1].modelMatrix,this._rotationY,t.geometryInstances[1].modelMatrix),this._layer._primitives.add(n),this._layer._primitives.add(o),this._layer._primitives.add(t),this._radius=e.radius,this._createAxisSphere()})},_createAxisSphere:function(){var t=[];for(let e=0;e<=360;e+=3){const i=Math.sin(g.Math.toRadians(e)),n=Math.cos(g.Math.toRadians(e)),o=this._radius*n,r=this._radius*i;t.push(new g.Cartesian3(o,r,0))}var e=this._createAxisSpheres("axisSphereZ",t,this._matrix,g.Color.RED);this._layer._primitives.add(e);const i=this._createAxisSpheres("axisSphereY",t,this._matrix,g.Color.GREEN),n=(this._layer._primitives.add(i),g.Matrix4.multiply(i.geometryInstances.modelMatrix,this._rotationY,i.geometryInstances.modelMatrix),this._createAxisSpheres("axisSphereX",t,this._matrix,g.Color.BLUE));this._layer._primitives.add(n),g.Matrix4.multiply(n.geometryInstances.modelMatrix,this._rotationX,n.geometryInstances.modelMatrix)},_createAxisSpheres:function(e,t,i,n){t=new g.PolylineGeometry({positions:t,width:10}),t=new g.GeometryInstance({geometry:t,id:e,attributes:{color:g.ColorGeometryInstanceAttribute.fromColor(n)}});return new g.Primitive({geometryInstances:t,appearance:new g.PolylineColorAppearance({translucent:!1}),modelMatrix:i})},_updateAxis(i){if(this._layer){var n=this._layer._primitives._primitives;for(let e=1,t=n.length;e<t;e++){var o=n[e],r=g.Matrix4.fromTranslation(new g.Cartesian3(i.x,i.y,i.z));g.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=g.Matrix4.fromTranslation(new g.Cartesian3(i.x,i.y,i.z));g.Matrix4.multiply(this._model.modelMatrix,e,this._model.modelMatrix)},_updateAxisSphere(i){if(this._layer){var n=this._layer._primitives._primitives;for(let e=1,t=n.length;e<t;e++){var o=n[e],r=g.Matrix4.fromRotationTranslation(i);g.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=g.Matrix4.fromRotationTranslation(i);g.Matrix4.multiply(this._model.modelMatrix,e,this._model.modelMatrix)},_bindHandler(){this._handler.setInputAction(e=>{if(this._xyzState&&this._xyzPid)switch(this._xyzPid){case"axisX-line":this._updateAxis({x:-1,y:0,z:0});break;case"axisY-line":this._updateAxis({x:0,y:-1,z:0});break;case"axisZ-line":this._updateAxis({x:0,y:0,z:-1});break;case"axisX-arrow":this._updateAxis({x:1,y:0,z:0});break;case"axisY-arrow":this._updateAxis({x:0,y:1,z:0});break;case"axisZ-arrow":this._updateAxis({x:0,y:0,z:1});break;case"axisSphereX":this._updateAxisSphere(g.Matrix3.fromRotationX(g.Math.toRadians(1)));break;case"axisSphereY":this._updateAxisSphere(g.Matrix3.fromRotationY(g.Math.toRadians(1)));break;case"axisSphereZ":this._updateAxisSphere(g.Matrix3.fromRotationZ(g.Math.toRadians(1)))}},g.ScreenSpaceEventType.MOUSE_MOVE),this._handler.setInputAction(e=>{e=viewer.scene.pick(e.position);e&&e.id&&(this._xyzPid=e.id,this._xyzState=!0)},g.ScreenSpaceEventType.LEFT_DOWN),this._handler.setInputAction(()=>{this._xyzState=!1,this._xyzPid=void 0},g.ScreenSpaceEventType.LEFT_UP)}},g.Scene.XyzAxisPrimitive=e},_installArrowPolylinePrimitive:function(){g.Scene.ArrowPolylinePrimitive=function(e={}){this._color=e.color||g.Color.RED,this._width=e.width||3,this._headWidth=e.headWidth||2*this._width,this._length=e.length||300,this._headLength=e.headLength||10,this._inverse=e.inverse||!1,this.position=e.position;var e=e.id,t=g.CylinderGeometry.createGeometry(new g.CylinderGeometry({length:this._length,topRadius:this._width,bottomRadius:this._width})),i=g.CylinderGeometry.createGeometry(new g.CylinderGeometry({length:this._headLength,topRadius:0,bottomRadius:this._headWidth}));let n=(this._length+this._headLength)/2;this._inverse&&(n=-n);var o=i,r=[0,0,n],a=new g.Cartesian3;r.length?(a.x=r[0],a.y=r[1],a.z=r[2]):g.Cartesian3.clone(r,a);for(let e=0;e<o.attributes.position.values.length;e+=3)o.attributes.position.values[e]+=a.x,o.attributes.position.values[e+1]+=a.y,o.attributes.position.values[e+2]+=a.z;return new g.Primitive({modelMatrix:g.Transforms.eastNorthUpToFixedFrame(this.position),geometryInstances:[new g.GeometryInstance({id:e+"-line",geometry:t}),new g.GeometryInstance({id:e+"-arrow",geometry:i})],appearance:new g.MaterialAppearance({material:g.Material.fromType("Color",{color:this._color})})})}},_installShadowPrimitive:function(){function e(e){var t=(e=g.defaultValue(e,g.defaultValue.EMPTY_OBJECT)).scene;if(!g.defined(t))throw new g.DeveloperError("scene is required.");var i=(this._scene=t)._context;if(!g.defined(i))throw new g.DeveloperError("context is required.");if(!g.defined(e.viewerPosition))throw new g.DeveloperError("this view position is required.");this._viewerPosition=e.viewerPosition,this._positions=void 0,this._indices=void 0,this._drawLineCommand=void 0,this._depthCamera=new g.Camera(t),this._depthCamera.position=this._viewerPosition,this._direction=0,this._pitch=0,this._horizontalFov=g.defaultValue(e.horizontalFov,60),this._verticalFov=g.defaultValue(e.verticalFov,45),this._cameraUpdated=!1,this._targetPoint=this._viewerPosition.clone();t=new g.Cartesian3(0,0,100),e=g.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);g.Matrix4.multiplyByPoint(e,t,this._targetPoint),this._distance=100,this._cameraUpdated=!1,this._modelMatrix=new g.Matrix4,this._shadowMap=new g.ShadowMap({context:i,enabled:!0,lightCamera:this._depthCamera,cascadesEnabled:!1}),this.show=!0,this._invisiblyColor=g.Color.RED,this._visiblyColor=g.Color.GREEN,this._shadowMap.useCustomColor=!0,this.shadowMap._customColor={invisibly:g.Color.RED,visibly:g.Color.GREEN},this._initialize=function(){this._positions=new Float32Array(633),this._indices=new Uint16Array(408);var e=this._indices,t=0;e[t++]=0,e[t++]=1,e[t++]=0,e[t++]=21,e[t++]=0,e[t++]=85,e[t++]=0,e[t++]=105;for(var i=0,n=0;n<5;++n){i++;for(var o=0;o<20;++o)e[t++]=i++,e[t++]=i}i++;for(var r=0;r<20;++r)for(var a=0;a<5;++a)e[t++]=i,e[t++]=5+i++;this._initialized=!0},this._debugLightFrustum=void 0,this._debugShow=!0}Object.defineProperties(e.prototype,{shadowMap:{get:function(){return this._shadowMap}},debugLightFrustum:{get:function(){return this._debugLightFrustum}},debugShow:{get:function(){return this._debugShow},set:function(e){this.shadowMap.debugShow=e,this._debugShow=e}},invisiblyColor:{get:function(){return this._invisiblyColor},set:function(e){this._invisiblyColor=e,this.shadowMap._customColor.invisibly=e}},visiblyColor:{get:function(){return this._visiblyColor},set:function(e){this._visiblyColor=e,this.shadowMap._customColor.visibly=e}},viewerPosition:{get:function(){return this._viewerPosition},set:function(e){this._viewerPosition=e,this._cameraUpdated=!1}},direction:{get:function(){return this._direction},set:function(e){this._direction=e,this._cameraUpdated=!1}},pitch:{get:function(){return this._pitch},set:function(e){this._pitch=e,this._cameraUpdated=!1}},horizontalFov:{get:function(){return this._horizontalFov},set:function(e){this._horizontalFov=e,this._cameraUpdated=!1,this._hintLineUpdated=!1}},verticalFov:{get:function(){return this._verticalFov},set:function(e){this._verticalFov=e,this._cameraUpdated=!1,this._hintLineUpdated=!1}},distance:{get:function(){return this._distance},set:function(e){this._distance=e,this._cameraUpdated=!1}}}),e.prototype.setDebugFrustumEffect=function(t,i){var e,n;this.debugShow&&(e=this.debugLightFrustum._planesPrimitives,n=this.debugLightFrustum._outlinePrimitives,e.forEach(function(e){e.show=t}),n.forEach(function(e){e.show=i}))},e.prototype.update=function(e){var t;this.show&&(this._cameraUpdated||(this._updateCamera(),this.debugShow&&!g.defined(this.debugLightFrustum)&&(this._debugLightFrustum=new g.DebugCameraPrimitive({camera:this._depthCamera,color:g.Color.YELLOW,updateOnChange:!0}),this.setDebugFrustumEffect(!1,!0))),t=e.frustumSplits[1],e.frustumSplits[1]=this._distance,this._debugLightFrustum.update(e),e.frustumSplits[1]=t,e.shadowMaps.push(this.shadowMap))},e.prototype._updateCamera=function(){this._depthCamera.frustum.near=.001*this._distance,this._depthCamera.frustum.far=this._distance,this._depthCamera.frustum.fov=g.Math.toRadians(Math.max(this._horizontalFov,this._verticalFov)),this._depthCamera.frustum.aspectRatio=this._horizontalFov/this._verticalFov,this._depthCamera.setView({destination:this._viewerPosition,orientation:{heading:g.Math.toRadians(this._direction),pitch:g.Math.toRadians(this._pitch)}}),this._modelMatrix=this._depthCamera.inverseViewMatrix,this._cameraUpdated=!0},e.prototype.setPoseByTargetPoint=function(e){this.distance=g.Cartesian3.distance(this._viewerPosition,e);var t=new g.Cartesian3,i=g.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);g.Matrix4.inverse(i,i),g.Matrix4.multiplyByPoint(i,e,t),g.Cartesian3.normalize(t,t),this.direction=g.Math.toDegrees(Math.atan2(t.x,t.y)),this.pitch=g.Math.toDegrees(Math.asin(t.z))},e.prototype._updateHintLine=function(e){var t,i=this._positions,n=g.Math.toRadians(this._horizontalFov),o=g.Math.toRadians(this._verticalFov),r=Math.tan(.5*n),o=Math.tan(.5*o),a=-(r=this._distance*r),o=-(t=this._distance*o),a=new g.Cartesian3(a,o,-this._distance),o=new g.Cartesian3(r,t,0),r=(g.Matrix4.multiplyByPoint(this._modelMatrix,a,a),g.Matrix4.multiplyByPoint(this._modelMatrix,o,o),g.BoundingSphere.fromCornerPoints(a,o));if(e.cullingVolume.computeVisibility(r)!==Intersect.OUTSIDE){this._valid=!0;var s=0;i[s++]=0,i[s++]=0,i[s++]=0;for(var l,c=Math.PI-.5*n,h=n/4,u=0;u<5;++u)for(var d=c+u*h,p=t/(this._distance/Math.cos(d)),m=-(w=Math.atan(p)),f=w/10,y=0;y<21;++y)l=m+y*f,i[s++]=this._distance*Math.cos(l)*Math.sin(d),i[s++]=this._distance*Math.sin(l),i[s++]=this._distance*Math.cos(l)*Math.cos(d);for(var h=n/20,v=0;v<21;++v){d=c+v*h;for(var w,p=t/(this._distance/Math.cos(d)),m=-(w=Math.atan(p)),f=w/2,_=0;_<5;++_)l=m+_*f,i[s++]=this._distance*Math.cos(l)*Math.sin(d),i[s++]=this._distance*Math.sin(l),i[s++]=this._distance*Math.cos(l)*Math.cos(d)}var C,P=e.context,a=g.Buffer.createIndexBuffer({context:P,typedArray:new Uint32Array(this._indices),usage:g.BufferUsage.STATIC_DRAW,indexDatatype:IndexDatatype.UNSIGNED_INT}),o=g.Buffer.createVertexBuffer({context:P,typedArray:g.ComponentDatatype.createTypedArray(g.ComponentDatatype.FLOAT,this._positions),usage:g.BufferUsage.STATIC_DRAW}),n=[],e=(n.push({index:0,vertexBuffer:o,componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1}),new g.VertexArray({context:P,attributes:n,indexBuffer:a}));g.defined(this._drawLineCommand)?(this._drawLineCommand.vertexArray.destroy(),this._drawLineCommand.vertexArray=e,this._drawLineCommand.modelMatrix=this._modelMatrix,this._drawLineCommand.boundingVolume=r):(o=g.ShaderProgram.fromCache({context:P,vertexShaderSource:"in vec3 position;\n uniform mat4 u_modelViewMatrix;\n void main()\n {\n gl_Position = czm_projection* u_modelViewMatrix* vec4(position.xyz,1.0);\n }\n ",fragmentShaderSource:"uniform vec4 u_bgColor;\n void main()\n {\n out_FragColor = u_bgColor;\n }\n "}),n=g.RenderState.fromCache({depthTest:{enabled:!0}}),a={u_bgColor:function(){return C._lineColor},u_modelViewMatrix:function(){return P.uniformState.modelView}},(C=this)._drawLineCommand=new g.DrawCommand({boundingVolume:r,modelMatrix:C._modelMatrix,primitiveType:g.PrimitiveType.LINES,vertexArray:e,shaderProgram:o,castShadows:!1,receiveShadows:!1,uniformMap:a,renderState:n,pass:g.Pass.OPAQUE})),this._hintLineUpdated=!0}else this._valid=!1},g.Scene.ShadowPrimitive=e},_installPointsPrimitive:function(){function e(e){e&&e.viewer&&e.Cartesians&&(this._vertexShader=this.getVSPolylie(),this._fragmentShader=this.getFSPolyline(),this._geometry=null,this._appearance=null,this._viewer=e.viewer,this.build(e))}e.prototype={build:function(e){if(e.Cartesians&&2<=e.Cartesians.length){var t=[],i=[],n=[];if(e.Colors&&e.Colors.length===4*e.Cartesians.length){for(var o=0;o<e.Cartesians.length;o++)t.push(e.Cartesians[o].x),t.push(e.Cartesians[o].y),t.push(e.Cartesians[o].z);i=e.Colors}else for(var r=0;r<e.Cartesians.length;r++)t.push(e.Cartesians[r].x),t.push(e.Cartesians[r].y),t.push(e.Cartesians[r].z),i.push(0),i.push(0),i.push(1),i.push(1);for(var a=0;a<e.Cartesians.length;a++)n.push(a);this.positionArr=new Float64Array(t),this.colorArr=new Float32Array(i),this.indiceArr=new Uint16Array(n)}else{var s=g.Cartesian3.fromDegrees(0,0,-10),l=g.Cartesian3.fromDegrees(0,.001,-10);this.positionArr=new Float64Array([s.x,s.y,s.z,l.x,l.y,l.z]),this.colorArr=new Float32Array([0,0,1,1,0,0,1,1]),this.indiceArr=new Uint16Array([0,1])}this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),this._appearance=this.createAppearence(this._fragmentShader,this._vertexShader),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},getVSPolylie:function(){return"in vec3 position3DHigh; in vec3 position3DLow; in vec4 color; out vec4 v_color; in float batchId; void main() { vec4 p = czm_computePosition(); v_color =color; p = czm_modelViewProjectionRelativeToEye * p; gl_Position = p; gl_PointSize=4.0; } "},getFSPolyline:function(){return"in vec4 v_color; void main() { float d = distance(gl_PointCoord, vec2(0.5,0.5)); if(d < 0.5){ out_FragColor = v_color; }else{ discard; } } "},createAppearence:function(e,t){return new g.Appearance({renderState:{blending:g.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:e,vertexShaderSource:t})},createGeometry:function(e,t,i){return new g.Geometry({attributes:{position:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),color:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:4,values:t})},indices:i,primitiveType:g.PrimitiveType.POINTS,boundingSphere:g.BoundingSphere.fromVertices(e)})},remove:function(){null!=this.primitive&&(this._viewer.scene.primitives.remove(this.primitive),this.primitive=null)},updateCartesianPosition:function(e){if(null!=this.primitive&&(this._viewer.scene.primitives.remove(this.primitive),!(e&&e.length<2))){if(e.length===this.positionArr.length/3){var t=e[0],i=e[1];this.positionArr=new Float64Array([t.x,t.y,t.z,i.x,i.y,i.z]),this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr)}else{for(var n=[],o=[],r=[],a=0;a<e.length;a++)n.push(e[a].x),n.push(e[a].y),n.push(e[a].z),o.push(0),o.push(0),o.push(1),o.push(1);for(var s=0;s<e.length;s++)r.push(s);this.positionArr=new Float64Array(n),this.colorArr=new Float32Array(o),this.indiceArr=new Uint16Array(r),geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),appearance=this.createAppearence(this._fragmentShader,this._vertexShader)}this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}},updateCartesianPositionColor:function(e,t){if(t.length===4*e.length&&null!=this.primitive&&(viewer.scene.primitives.remove(this.primitive),!(e&&e.length<2))){if(e.length===this.positionArr.length/3){var i=e[0],n=e[1];this.positionArr=new Float64Array([i.x,i.y,i.z,n.x,n.y,n.z]),this.colorArr=new Float32Array(t),geometry=CreateGeometry(this.positionArr,this.colorArr,this.indiceArr)}else{for(var o=[],r=[],a=0;a<e.length;a++)o.push(e[a].x),o.push(e[a].y),o.push(e[a].z);for(a=0;a<e.length;a++)r.push(a);this.positionArr=new Float64Array(o),this.colorArr=new Float32Array(t),this.indiceArr=new Uint16Array(r),this._geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),this._appearance=this.createAppearence(this._fragmentShader,this._vertexShader)}this.primitive=viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}}},g.Scene.PointsPrimitive=e},_installWaterPrimitive:function(){let t=this;function e(e){this._positions=e.positions,this._url=e.img||this.getDfSt(["primitive","WaterPrimitive"])||"static/data/images/Textures/waterNormals.jpg",this._frequency=e.frequency||1e3,this._animationSpeed=e.animationSpeed||.01,this._amplitude=e.amplitude||10,this._extrudedHeight=e.extrudedHeight||0,this._viewer=t._viewer,this._fs=this.getFS()}e.prototype.build=function(){this._geometry=this._createGeometry(),this._appearance=this._createAppearence(),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({allowPicking:!1,geometryInstances:new g.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createAppearence=function(){return new g.EllipsoidSurfaceAppearance({material:new g.Material({fabric:{type:"Water",uniforms:{normalMap:this._url,frequency:this._frequency,animationSpeed:this._animationSpeed,amplitude:this._amplitude}}}),fragmentShaderSource:this._fs})},e.prototype._createGeometry=function(){return new g.PolygonGeometry({polygonHierarchy:new g.PolygonHierarchy(g.Cartesian3.fromDegreesArray(this._positions)),extrudedHeight:this._extrudedHeight,perPositionHeight:!0})},e.prototype.getFS=function(){return"\n precision highp float;\n struct Light {\n vec3 position;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n };\n in vec3 position;\n in vec2 textureCoord;\n\n uniform vec3 viewPos;\n uniform Light light;\n\n uniform sampler2D normalSampler;\n uniform samplerCube skybox;\n uniform float detalX;\n\n void main() {\n\n float z = gl_FragCoord.z / gl_FragCoord.w;\n const float LOG2 = 1.442695;\n float density = 0.005;\n float normalFactor = exp( -density * density * z * z * LOG2 );\n normalFactor = clamp(normalFactor, 0.0, 1.0);\n\n vec4 normalTex1 = texture(normalSampler, vec2(textureCoord.s + detalX/1024.0, textureCoord.t - detalX/1024.0));\n vec3 normalTex2 = texture(normalSampler, vec2(textureCoord.t, textureCoord.s)).rgb;\n vec3 normal1 = normalize(vec3(normalTex1.r * 2.0 - 1.0, normalTex1.b,normalTex1.g*2.0-1.0));\n vec3 normal2 = normalize(vec3(normalTex2.r * 2.0 - 1.0, normalTex2.b,normalTex2.g*2.0-1.0));\n\n vec3 normal = mix(normal1,normal2,0.2);\n\n normal = mix(vec3(0.0,1.0,0.0),normal,0.2);\n\n normal = mix(vec3(0.0,1.0,0.0),normal,normalFactor);\n\n vec3 viewDir = normalize(viewPos - position);\n\n vec3 I = normalize(position - viewPos);\n vec3 R = reflect(I, normal);\n vec3 reflection = texture(skybox, R).rgb;\n\n float ratio = 1.00 / 1.33;\n vec3 Rr = refract(I, normal , ratio);\n vec3 refraction = texture(skybox, Rr).rgb;\n\n float reflectivity = 0.02;\n float theta = max( dot( viewDir, normal ), 0.0 );\n float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 2.0 );\n\n vec3 reflectanceColor = mix( refraction, reflection, reflectance );\n\n out_FragColor = vec4(reflectanceColor,1.0);\n\n }\n "},e.prototype.getVS=function(){return" in vec3 normal;in vec2 st;in float batchId; out vec3 v_normalEC;uniform mat4 u_modelViewMatrix;uniform mat4 u_invWorldViewMatrix;uniform int u_clampToGroud;uniform vec3 u_camPos;uniform vec3 u_scale;out vec3 vToEye;out vec2 vUv;out vec4 vCoord;void main(void){v_normalEC = czm_normal * normal;if (u_clampToGroud == 1){} else {vCoord = gl_Position;}vUv = st;}"},e.prototype.getFS2=function(){return"in vec3 v_positionMC;\n in vec3 v_positionEC;\n in vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n #ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n out_FragColor.a = 0.5;\n #endif\n }\n "},v.prototype.updateDegreesPosition=function(e,t){null==this.primitive||(this._viewer.scene.primitives.remove(this.primitive),e&&e.length<3)||(e=this._createGeometry(e,t||0),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({allowPicking:!1,geometryInstances:new g.GeometryInstance({geometry:e}),appearance:this._appearance,asynchronous:!1})))},g.Scene.WaterPrimitive=e},_installTexturePrimitive:function(){function e(e){this._vertexShader=this.getVS(),this._fragmentShader=this.getFS(),this._materialShader=this.getMS(),this._url=e.url,this._cartesians=e.cartesians,this._id=e.id||""}e.prototype.build=function(){for(var e=[],t=0;t<this._cartesians.length;t++)e.push(this._cartesians[t].x),e.push(this._cartesians[t].y),e.push(this._cartesians[t].z);this._positionArr=new Float32Array(e),this._sts=new Uint8Array([0,0,1,0,1,1,0,1]),this._indiceArr=new Uint16Array([0,1,2,0,2,3]),this._geometry=this._createGeometry(),this._appearance=this._createAppearence(),this.primitive=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:new g.GeometryInstance({geometry:this._geometry,id:this._id}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createGeometry=function(){var e=new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:this._sts});return new g.Geometry({attributes:{position:new g.GeometryAttribute({componentDatatype:g.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:this._positions}),st:e},indices:this._indices,primitiveType:g.PrimitiveType.TRIANGLES,boundingSphere:g.BoundingSphere.fromVertices(positions)})},e.prototype._createAppearence=function(){return new g.Appearance({material:new g.Material({fabric:{uniforms:{image:this._url},source:this._materialShader}}),aboveGround:!0,faceForward:!0,flat:!0,translucent:!1,renderState:{blending:g.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:this._fragmentShader,vertexShaderSource:this._vertexShader})},e.prototype.getVS=function(){return"in vec3 position3DHigh; in vec3 position3DLow; in vec2 st; in float batchId; out vec2 v_st; void main() { vec4 p = czm_computePosition(); v_st=st; p = czm_modelViewProjectionRelativeToEye * p; gl_Position = p; } "},e.prototype.getFS=function(){return"in vec2 v_st; void main() { czm_materialInput materialInput; czm_material material=czm_getMaterial(materialInput,v_st); vec4 color=vec4(material.diffuse + material.emission,material.alpha); if(color.x==1.0&&color.y==1.0&&color.z==1.0&&color.w==1.0) color=vec4(vec3(0.0,0.0,0.0),0.0); out_FragColor =color; } "},e.prototype.getMS=function(){return"czm_material czm_getMaterial(czm_materialInput materialInput,vec2 v_st) { vec4 color = texture(image, v_st); czm_material material = czm_getDefaultMaterial(materialInput); material.diffuse= color.rgb; material.alpha=color.a; return material; } "},g.Scene.TexturePrimitive=e},_installProbingPrimitive:function(){var t={color:new g.Color(1,0,1,.8),repeat:30,offset:0,thickness:.3,center:g.Cartesian3.fromDegrees(116.39,39.9),length:4e5,bottom:1e3,top:0},i=this._viewer;function e(e){this._viewer=i,this._length=e.length||t.length,this._center=e.center||t.center,this._color=e.color||t.color,this._repeat=e.repeat||t.repeat,this._offset=e.offset||t.offset,this._thickness=e.thickness||t.thickness,this._bottom=e.bottom||t.bottom,this._top=e.top||t.top,this._radar=void 0,this.build()}e.prototype.build=function(){var e=new g.CylinderGeometry({length:this._length,topRadius:this._top,bottomRadius:this._bottom,vertexFormat:g.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat}),e=new g.GeometryInstance({geometry:e,modelMatrix:this.getModelMatrix()}),t=new g.MaterialAppearance({material:this.getMaterial(),faceForward:!1,closed:!0}),i=this;this._radar=this._viewer.scene.primitives.add(new g.Primitive({geometryInstances:[e],appearance:t})),this._viewer.scene.preUpdate.addEventListener(function(){var e=i._radar.appearance.material.uniforms.offset;1<(e-=.001)&&(e=0),i._radar.appearance.material.uniforms.offset=e})},e.prototype.getModelMatrix=function(){return g.Matrix4.multiplyByTranslation(g.Transforms.eastNorthUpToFixedFrame(this._center),new g.Cartesian3(0,0,.5*this._length),new g.Matrix4)},e.prototype.updateModelMatrix=function(){},e.prototype.getMaterial=function(){return new g.Material({fabric:{type:"radarPrimitive",uniforms:{color:this._color,repeat:this._repeat,offset:this._offset,thickness:this._thickness},source:"uniform vec4 color; \n uniform float repeat; \n uniform float offset; \n uniform float thickness;\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float sp = 1.0/repeat;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n float m = mod(dis + offset, sp);\n float a = step(sp*(1.0-thickness), m); \n\n material.diffuse = color.rgb;\n material.alpha = a * color.a;\n return material;\n }"},translucent:!1})},e.prototype.remove=function(){this._radar&&this._viewer.scene.primitives.remove(this._radar)},g.Scene.ProbingPrimitive=e},_initCustomPrimitive:function(e){let u=g;function t({img:e,center:t,height1:i=0,height2:n=3e5,scale:o=.003}){this.drawCommand=null,this._texture=null,this._image=null,this.img=e,this.center=t,this.height1=i,this.height2=n,this.scale=o}return t.prototype.update=function(e){null===this.drawCommand&&this.createDrawCommand(e.context),null===this._texture&&this.createTexture(e.context),e.commandList.push(this.drawCommand)},t.prototype.isDestroyed=function(){return!1},t.prototype.createTexture=function(e){null===this._image&&(this._image=new Image,this._image.src=this.img||"static/data/images/Textures/beautiful.jpg",this._image.onload=()=>{this._texture=new u.Texture({context:e,source:this._image})})},t.prototype.createDrawCommand=function(e){var t=this.createPyramidGeometry(),i=u.VertexArray.fromGeometry({context:e,geometry:t,attributeLocations:u.GeometryPipeline.createAttributeLocations(t)}),t=u.ShaderProgram.fromCache({context:e,vertexShaderSource:"in vec3 position3DHigh;\nin vec3 position3DLow;\nin float batchId;\nin vec3 position;\nin vec2 st;\nout vec2 v_st;\nuniform vec3 v1;\nuniform vec3 v2;\n\n// 罗德里格旋转公式\nmat4 RodriguesRotation(vec3 v1, vec3 v2, float theta) {\n\n vec3 _p = v2 - v1;\n vec3 p = normalize(_p);\n\n float x = p.x;\n float y = p.y;\n float z = p.z;\n\n float xy = x * y;\n float xx = x * x;\n float xz = x * z;\n float yy = y * y;\n float yz = y * z;\n float zz = z * z;\n\n float sintheta = sin(radians(theta));\n float costheta = cos(radians(theta));\n\n float _m00 = costheta + xx * (1.0 - costheta);\n float _m01 = z * sintheta + xy * (1.0 - costheta);\n float _m02 = -y * sintheta + xz * (1.0 - costheta);\n float _m03 = 0.0;\n float _m10 = -z * sintheta + xy * (1.0 - costheta);\n float _m11 = costheta + yy * (1.0 - costheta);\n float _m12 = x * sintheta + yz * (1.0 - costheta);\n float _m13 = 0.0;\n float _m20 = y * sintheta + xz * (1.0 - costheta);\n float _m21 = -x * sintheta + yz * (1.0 - costheta);\n float _m22 = costheta + zz * (1.0 - costheta);\n float _m23 = 0.0;\n\n return mat4(_m00, _m01, _m02, _m03, _m10, _m11, _m12, _m13, _m20, _m21, _m22,\n _m23, 0, 0, 0, 1.0);\n}\n\nvoid main() {\n float ty = abs(cos(czm_frameNumber / 60.0)) * 0.3;\n mat4 translateY = mat4(1, 0, 0, 0, 0, 1, 0, ty, 0, 0, 1, 0, 0, 0, 0, 1);\n mat4 roatateAxis = RodriguesRotation(v1, v2, czm_frameNumber);\n //vec4 roatePosition = roatateAxis * vec4(position, 1.0);\n vec4 roatePosition = vec4(position, 1.0);\n v_st = st;\n gl_Position = czm_projection * czm_modelView * roatePosition * translateY;\n}",fragmentShaderSource:"in vec2 v_st;\nuniform sampler2D wenli;\nuniform vec2 iResolution;\nvoid main() {\n vec2 uv = gl_FragCoord.xy / iResolution.xy;\n float r = 0.01;\n // 使用length 实现圆弧光带\n uv.x *= iResolution.x / iResolution.y;\n float d = length(uv);\n r = abs(sin(r * czm_frameNumber) * iResolution.x / iResolution.y);\n vec4 wenli = texture(wenli, v_st);\n vec4 centerColor = vec4(0.0, 255.0, 0.0, 1.0);\n float ratio =\n smoothstep(r, r + 0.02, d) - smoothstep(r + 0.0029, r + 0.06, d);\n vec4 mixColor = vec4(mix(vec4(ratio), centerColor, ratio));\n out_FragColor = vec4(mix(wenli, mixColor, ratio));\n}\n",attributeLocations:u.GeometryPipeline.createAttributeLocations(t)});let n=new u.Cartesian2(e.canvas.width,e.canvas.height),o={v1:()=>this.v1,v2:()=>this.v2,wenli:()=>null!==this._texture?this._texture:e.defaultTexture,iResolution:()=>n},r=u.RenderState.fromCache();this.drawCommand=new u.DrawCommand({vertexArray:i,shaderProgram:t,uniformMap:o,renderState:r,pass:u.Pass.OPAQUE})},t.prototype.createPyramidGeometry=function(){let e=this.height1,i=this.height2,t=this.scale,n=this.center||[104.057605,30.607196],o=h(n,[-t,t]),r=h(n,[t,t]),a=h(n,[-t,-t]),s=h(n,[t,t]),l=[];function c(e,t=i){e=u.Cartesian3.fromDegrees(...e,t);return[e.x,e.y,e.z]}function h(e,t){return[t[0]+e[0],t[1]+e[1]]}return l.push(...c(n,e),...c(o),...c(r),...c(a),...c(s)),this.v1=new u.Cartesian3(...c(n,e)),this.v2=new u.Cartesian3(...c(n,i)),new u.Geometry({attributes:{position:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(l)}),st:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array([.5,.5,0,1,1,1,0,0,1,0])})},indices:[0,1,3,0,1,2,0,2,4,0,3,4,1,2,3,2,3,4],boundingSphere:u.BoundingSphere.fromVertices(l)})},new t(e)},customPrimivive(e){return this._initCustomPrimitive(e)}};let y=null;class _{constructor(e,t){y=t,this._viewer=e,this._labelEntity=null,this.$graphics=new s(e,t),this.isInit=!1}initTool(){this.isInit||(this._labelEntity=this._viewer.entities.add({position:y.Cartesian3.fromDegrees(0,0),label:this.$graphics.getLabelGraphics({l_text:"操作提示",l_fillColor:y.Color.CYAN,l_outlineColor:y.Color.BLACK})}),this._labelEntity.show=!1,this.isInit=!0)}setVisible(e){this.isInit&&(this._labelEntity.show=!!e)}showAt(e,t){this.isInit&&e&&t&&(this._labelEntity.show=!0,(e=this._viewer.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid))?(this._labelEntity.position=e,this._labelEntity.show=!0,this._labelEntity.label.text=t):this._labelEntity.show=!1)}showAtCartesian(e,t){this.isInit&&e&&t&&(this._labelEntity.show=!0,this._labelEntity.position=e,this._labelEntity.show=!0,this._labelEntity.label.text=t)}}let w=null,C=null;function P(e,t,i){e&&(w=t,this._drawLayer=new w.CustomDataSource("drawLayer"),s.prototype={...s.prototype,...p.prototype},this.$graphics=new s(e,t),e&&e.dataSources.add(this._drawLayer),this.tooltip=new _(e,t),this.tooltip.initTool())}P.prototype={drawPointGraphics:function(t){var i,n,e,o,r,a;(t=t||{}).style=t.style||{image:this.getDfSt(["drawPointGraphics"])||"static/data/images/file/location4.png",width:35,height:40,clampToGround:!0,scale:1,pixelOffset:new w.Cartesian2(0,-20)},this._viewer&&t&&(e=new w.Entity,o=[],r=this,a=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas),(C=a).setInputAction(function(e){e=r.getCatesian3FromPX(e.position);r.tooltip.showAtCartesian(e,"右键单击结束!"),e&&e.x&&(i=e,o.push(e))},w.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);e&&e.x&&(i=e,(o=[]).push(e)),a.destroy(),a=null,r.tooltip.setVisible(!1),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(o),n)},w.ScreenSpaceEventType.RIGHT_CLICK),e.billboard=t.style,e.position=new w.CallbackProperty(function(){return i},!1),n=this._drawLayer.entities.add(e))},drawLineGraphics:function(t){if(t=t||{},this._viewer&&t){var i,n=[],e=new w.Entity,o=this,r=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);(C=r).setInputAction(function(e){e=o.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&n.push(e.clone()),t.measure&&a(e),2==n.length&&"straightLine"===t.type&&(r.destroy(),r=null,"function"==typeof t.callback)&&t.callback(o.transformCartesianArrayToWGS84Array(n),i),n.push(e))},w.ScreenSpaceEventType.LEFT_CLICK),r.setInputAction(function(e){e=o.getCatesian3FromPX(e.endPosition);o.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.length&&e&&e.x&&(n.pop(),n.push(e))},w.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(function(e){o.tooltip.setVisible(!1),r.destroy(),r=null;e=o.getCatesian3FromPX(e.position);t.measure&&a(e),"function"==typeof t.callback&&t.callback(o.transformCartesianArrayToWGS84Array(n),i)},w.ScreenSpaceEventType.RIGHT_CLICK),e.polyline={width:t.width||5,material:t.material||w.Color.BLUE.withAlpha(.8),clampToGround:t.clampToGround||!1,clampToS3M:t.clampToS3M||!1},e.polyline.positions=new w.CallbackProperty(function(){return n},!1),i=this._drawLayer.entities.add(e);const a=function(e){var t=new w.Entity;t.position=e,t.point={pixelSize:10,outlineColor:w.Color.BLUE,outlineWidth:5},t.label={text:(o.getPositionDistance(o.transformCartesianArrayToWGS84Array(n))/1e3).toFixed(4)+"公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,-80)},o._drawLayer.entities.add(t)}}},drawPolygonGraphics:function(i){i=i||{};const t={width:3,material:w.Color.BLUE.withAlpha(.8),clampToGround:!0};if(i.style?i.style=Object.assign({},t,i.style):i.style=t,this._viewer&&i){var n=[],o=new w.PolygonHierarchy,r=new w.Entity,a=this,s=null,l=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=l;const t=function(){r.polyline=i.style,r.polyline.positions=new w.CallbackProperty(function(){return n},!1),r.polygon={hierarchy:new w.CallbackProperty(function(){return o},!1),material:w.Color.WHITE.withAlpha(.1),clampToGround:a._objHasOwnProperty(i,"clampToGround",!1)},r.clampToS3M=!0,s=a._drawLayer.entities.add(r)};l.setInputAction(function(e){e=a.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&(o.positions.push(e.clone()),n.push(e.clone())),n.push(e.clone()),o.positions.push(e.clone()),s||t())},w.ScreenSpaceEventType.LEFT_CLICK),l.setInputAction(function(e){e=a.getCatesian3FromPX(e.endPosition);a.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.length&&e&&e.x&&(n.pop(),n.push(e),o.positions.pop(),o.positions.push(e))},w.ScreenSpaceEventType.MOUSE_MOVE),l.setInputAction(function(){var e,t;l.destroy(),a.tooltip.setVisible(!1),n.push(n[0]),i.height&&(r.polygon.extrudedHeight=i.height,r.polygon.material=w.Color.BLUE.withAlpha(.5)),i.measure&&(e=n[0],(t=new w.Entity).position=e,t.point={pixelSize:10,outlineColor:w.Color.BLUE,outlineWidth:5},t.label={text:(a.getPositionsArea(a.transformCartesianArrayToWGS84Array(n))/1e6).toFixed(4)+"平方公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,-50)},a._drawLayer.entities.add(t)),"function"==typeof i.callback&&i.callback(a.transformCartesianArrayToWGS84Array(n),s)},w.ScreenSpaceEventType.RIGHT_CLICK)}},drawRectangleGraphics:function(t){var i,n,e,o,r,a;(t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t&&(n=[],e=new w.Entity,o=new w.Rectangle,r=this,a=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas),(C=a).setInputAction(function(e){e=r.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length?n.push(e.clone()):(a.destroy(),n.push(e.clone()),o=w.Rectangle.fromCartesianArray([...n,e],w.Ellipsoid.WGS84),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(n),i)))},w.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);e&&(o=w.Rectangle.fromCartesianArray([...n,e],w.Ellipsoid.WGS84))},w.ScreenSpaceEventType.MOUSE_MOVE),e.rectangle=t.style,t.height&&(e.rectangle.extrudedHeight=t.height),e.rectangle.coordinates=new w.CallbackProperty(function(){return o},!1),i=this._drawLayer.entities.add(e))},drawCircleGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t){var i,n=void 0,o=new w.Entity,r=this,a=1,s=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=s;const l=function(e,t){var e=w.Cartographic.fromCartesian(e),t=w.Cartographic.fromCartesian(t),i=new w.EllipsoidGeodesic,i=(i.setEndPoints(e,t),i.surfaceDistance);a=Math.sqrt(Math.pow(i,2)+Math.pow(t.height-e.height,2))};s.setInputAction(function(e){e=r.getCatesian3FromPX(e.position);r.tooltip.showAtCartesian(e,"左键单击结束!"),e&&e.x&&(n?(l(n,e),r.tooltip.setVisible(!1),s.destroy(),"function"==typeof t.callback&&t.callback({center:n,radius:a},i)):(n=e,o.ellipse=t.style,o.ellipse.semiMajorAxis=new w.CallbackProperty(function(){return a},!1),o.ellipse.semiMinorAxis=new w.CallbackProperty(function(){return a},!1),o.position=new w.CallbackProperty(function(){return n},!1),o.point={pixelSize:5,outlineColor:w.Color.RED,outlineWidth:3},t.height&&(o.ellipse.extrudedHeight=t.height),i=r._drawLayer.entities.add(o)))},w.ScreenSpaceEventType.LEFT_CLICK),s.setInputAction(function(e){e=r._viewer.scene.camera.pickEllipsoid(e.endPosition,r._viewer.scene.globe.ellipsoid);n&&e&&e.x&&l(n,e)},w.ScreenSpaceEventType.MOUSE_MOVE)}},drawTrianglesGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:w.Color.BLUE.withAlpha(.5)},this._viewer&&t){var i=new w.Entity,n=new w.Entity,o=new w.Entity,r=[],a=[],s=[],l=this,c=new w.ScreenSpaceEventHandler(this._viewer.scene.canvas);C=c;c.setInputAction(function(e){e=l.getCatesian3FromPX(e.position);if(!e)return!1;0==r.length?(r.push(e.clone()),r.push(e.clone()),a.push(e.clone()),a.push(e.clone())):(c.destroy(),"function"==typeof t.callback&&t.callback({e:i,e2:n,e3:o}))},w.ScreenSpaceEventType.LEFT_CLICK),c.setInputAction(function(e){var t,i,e=l.getCatesian3FromPX(e.endPosition);e&&0<r.length&&(r.pop(),r.push(e.clone()),t=r,i=w.Cartographic.fromCartesian(t[0]),t=w.Cartographic.fromCartesian(t[1]),i=w.Cartesian3.fromDegrees(w.Math.toDegrees(i.longitude),w.Math.toDegrees(i.latitude),t.height),a.pop(),a.push(i.clone()),s.pop(),s.pop(),s.push(e.clone()),s.push(i.clone()))},w.ScreenSpaceEventType.MOUSE_MOVE),i.polyline={positions:new w.CallbackProperty(function(){return r},!1),...t.style},i.position=new w.CallbackProperty(function(){return r[0]},!1),i.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},i.label={text:new w.CallbackProperty(function(){return"直线:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(r))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(50,-100)},n.polyline={positions:new w.CallbackProperty(function(){return a},!1),...t.style},n.position=new w.CallbackProperty(function(){return s[1]},!1),n.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},n.label={text:new w.CallbackProperty(function(){return"高度:"+(t=a[1],!(e=a[0])&&!t||w.Cartesian3.equals(e,t)?0:(e=w.Cartographic.fromCartesian(e),(w.Cartographic.fromCartesian(t).height-e.height).toFixed(2)))+"米";var e,t},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-20,100)},o.polyline={positions:new w.CallbackProperty(function(){return s},!1),...t.style},o.position=new w.CallbackProperty(function(){return r[1]},!1),o.point={pixelSize:5,outlineColor:w.Color.BLUE,outlineWidth:5},o.label={text:new w.CallbackProperty(function(){return"水平距离:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(s))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:w.HorizontalOrigin.LEFT,verticalOrigin:w.VerticalOrigin.BOTTOM,pixelOffset:new w.Cartesian2(-150,-20)},this._drawLayer.entities.add(o),this._drawLayer.entities.add(n),this._drawLayer.entities.add(i)}},drawWallGraphics:function(a){a=a||{};var s,e={material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE};a.style?a.style=Object.assign({},e,a.style):a.style=e,this._viewer&&a&&(s=this).drawPolygonGraphics({clampToGround:s._objHasOwnProperty(a.style,"clampToGround",!0),style:{material:a.style.material},callback:function(e,t){var i=s.transformWGS84ArrayToCartesianArray(e),n=[],o=[];if(a.style.maximumHeights){let e=0;for(;e<i.length;)n.push(a.style.maximumHeights[e%2]),e++;a.style.maximumHeights=n}if(a.style.minimumHeights){let e=0;for(;e<i.length;)o.push(a.style.minimumHeights[e%2]),e++;a.style.minimumHeights=o}var r=s._drawLayer.entities.add({wall:{positions:i,...a.style}});"function"==typeof a.callback&&a.callback(e,r)}})},drawEllipsoidGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawCircleGraphics({callback:function(e,t){var i=o.createGraphics(),t=(i.ellipsoid=o.$graphics.getEllipsoidGraphics({radii:e.radius}),i.position=e.center,o._drawLayer.entities.remove(t),o._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},t)}})},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,drawCylinderGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawCircleGraphics({callback:function(e,t){var i=o._drawLayer.entities.add({position:e.center,cylinder:{length:2*e.radius||n.length,topRadius:n.topRadius||e.radius,bottomRadius:n.bottomRadius||e.radius,material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE}});o._drawLayer.entities.remove(t),"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},i)}})},drawCorridorGraphics:function(n){var o;(n=n||{}).style=n.style||{},this._viewer&&n&&(o=this).drawLineGraphics({callback:function(e,t){var i=o.createGraphics(),t=(i.corridor={positions:o.transformWGS84ArrayToCartesianArray(e),height:n.height||1,width:n.width||100,cornerType:w.CornerType.BEVELED,extrudedHeight:n.extrudedHeight||1,material:w.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:w.Color.WHITE},o._drawLayer.entities.remove(t),o._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback(e,t)}})},drawPolylineVolumeGraphics:function(o){(o=o||{}).style=o.style||{};const r=o.circleRadius||20,a=o.arms||7,s=o.rOuter||150,l=o.rInner||75;var c;this._viewer&&o&&(c=this).drawLineGraphics({callback:function(e,t){var i=c.createGraphics(),n="fivePoint"===o.shape?c.computeStar2d(a,s,l):c.computeCircleShap(r),n=(i.polylineVolume={positions:c.transformWGS84ArrayToCartesianArray(e),shape:n,cornerType:w.CornerType.MITERED,material:o.color||w.Color.RED},c._drawLayer.entities.remove(t),c._drawLayer.entities.add(i));"function"==typeof o.callback&&o.callback(e,n)}})},removeAll(){this._drawLayer.entities.removeAll()},removeEventHandler(){C&&!C.isDestroyed()&&(C.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),C.removeInputAction(w.ScreenSpaceEventType.RIGHT_CLICK),C.removeInputAction(w.ScreenSpaceEventType.LEFT_CLICK))}};let x={};function S(e,t){e&&(this._viewer=e,x=t)}S.prototype={mathDistance2d:function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},getCirclePoints2d:function(e,t,i,n){for(var o=[],r=Math.PI/180*Math.round(360/n),a=0;a<n;a++){var s=t+e*Math.sin(r*a),l=i+e*Math.cos(r*a);o.unshift({x:s,y:l})}return o},wholeDistance2d:function(i){let n=0;return i&&Array.isArray(i)&&0<i.length&&i.forEach((e,t)=>{t<i.length-1&&(n+=this.mathDistance2d(e,i[t+1]))}),n},getBaseLength2d:function(e){return Math.pow(this.wholeDistance2d(e),.99)},computeStar2d(e,t,i){for(var n=Math.PI/e,o=2*e,r=new Array(o),a=0;a<o;a++){var s=a%2==0?t:i;r[a]=new x.Cartesian2(Math.cos(a*n)*s,Math.sin(a*n)*s)}return r},computeCircleShap(t){var i=[];for(let e=0;e<360;e++){var n=x.Math.toRadians(e);i.push(new x.Cartesian2(t*Math.cos(n),t*Math.sin(n)))}return i},mid2d:function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},getCircleCenterOfThreePoints2d:function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],t=[n[0]-e[1]+t[1],n[1]+e[0]-t[0]],o=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[o[0]-e[1]+i[1],o[1]+e[0]-i[0]];return this.getIntersectPoint2d(n,t,o,e)},getIntersectPoint2d:function(e,t,i,n){return e[1]===t[1]?[(n[0]-i[0])/(n[1]-i[1])*(e[1]-i[1])+i[0],e[1]]:i[1]===n[1]?[(t[0]-e[0])/(t[1]-e[1])*(i[1]-e[1])+e[0],i[1]]:(t=(t[0]-e[0])/(t[1]-e[1]),n=(n[0]-i[0])/(n[1]-i[1]),[t*(i=(t*e[1]-e[0]-n*i[1]+i[0])/(t-n))-t*e[1]+e[0],i])},getAzimuth2d:function(e,t){let i,n=Math.asin(Math.abs(t[1]-e[1])/this.mathDistance2d(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},getAngleOfThreePoints2d:function(e,t,i){e=this.getAzimuth2d(t,e)-this.getAzimuth2d(t,i);return e<0?e+2*Math.PI:e},isClockWise2d:function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},getPointOnLine2d:function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},getCubicValue2d:function(e,t,i,n,o){var[r,a]=[1-(e=Math.max(Math.min(e,1),0)),e*e],s=a*e,l=r*r,c=l*r;return[c*t[0]+3*l*e*i[0]+3*r*a*n[0]+s*o[0],c*t[1]+3*l*e*i[1]+3*r*a*n[1]+s*o[1]]},getThirdPoint2d:function(e,t,i,n,o){e=this.getAzimuth2d(e,t),o=o?e+i:e-i,e=n*Math.cos(o),i=n*Math.sin(o);return[t[0]+e,t[1]+i]},inherits2d:function(e,o){function t(){}t.prototype=o.prototype,e.superClass_=o.prototype,e.prototype=new t,(e.prototype.constructor=e).base=function(e,t,i){var n=Array.prototype.slice.call(arguments,2);return o.prototype[t].apply(e,n)}},getArcPoints2d:function(t,i,n,e){var[o,r,a,s]=[null,null,[],e-n],s=s<0?s+2*Math.PI:s;for(let e=0;e<=100;e++){var l=n+s*e/100,o=t[0]+i*Math.cos(l),r=t[1]+i*Math.sin(l);a.push([o,r])}return a},getBisectorNormals2d:function(e,t,i,n){let o=this.getNormal2d(t,i,n),[r,a,s,l,c]=[null,null,null,null,null],h=Math.sqrt(o[0]*o[0]+o[1]*o[1]),u=o[0]/h,d=o[1]/h,p=this.mathDistance2d(t,i),m=this.mathDistance2d(i,n);return a=(c=1e-4<h?this.isClockWise(t,i,n)?(s=e*p,l=i[0]-s*d,c=i[1]+s*u,r=[l,c],s=e*m,l=i[0]+s*d,i[1]-s*u):(s=e*p,l=i[0]+s*d,c=i[1]-s*u,r=[l,c],s=e*m,l=i[0]-s*d,i[1]+s*u):(l=i[0]+e*(t[0]-i[0]),c=i[1]+e*(t[1]-i[1]),r=[l,c],l=i[0]+e*(n[0]-i[0]),i[1]+e*(n[1]-i[1])),[l,c]),[r,a]},getNormal2d:function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],o=Math.sqrt(n*n+e*e),o=(n/=o,e/=o,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(o*o+i*i);return[n+(o/=t),e+(i/=t)]},getLeftMostControlPoint2d:function(e,t){let[i,n,o,r,a]=[e[0],e[1],e[2],null,null],s=this.getBisectorNormals2d(0,i,n,o)[0],l=this.getNormal2d(i,n,o);var c,h,u,d,p;return a=1e-4<Math.sqrt(l[0]*l[0]+l[1]*l[1])?(e=this.mid2d(i,n),u=i[0]-e[0],c=i[1]-e[1],u=2*(c=-(h=2/this.mathDistance2d(i,n))*c)*(h=h*u),d=s[0]-e[0],p=s[1]-e[1],r=e[0]+(c*c-h*h)*d+u*p,e[1]+u*d+(h*h-c*c)*p):(r=i[0]+t*(n[0]-i[0]),i[1]+t*(n[1]-i[1])),[r,a]},getRightMostControlPoint2d:function(e,t){let i=e.length,n=e[i-3],o=e[i-2],r=e[i-1],a=this.getBisectorNormals2d(0,n,o,r)[1],s=this.getNormal2d(n,o,r),l=Math.sqrt(s[0]*s[0]+s[1]*s[1]),[c,h]=[null,null];var u,d,p,m,g;return h=1e-4<l?(e=this.mid2d(o,r),p=r[0]-e[0],u=r[1]-e[1],p=2*(u=-(d=2/this.mathDistance2d(o,r))*u)*(d=d*p),m=a[0]-e[0],g=a[1]-e[1],c=e[0]+(u*u-d*d)*m+p*g,e[1]+p*m+(d*d-u*u)*g):(c=r[0]+t*(o[0]-r[0]),r[1]+t*(o[1]-r[1])),[c,h]},getCurvePoints2d:function(t,i){let e=this.getLeftMostControlPoint2d(i,t),[n,o,r,a,s]=[null,null,null,[e],[]];for(let e=0;e<i.length-2;e++){[n,o,r]=[i[e],i[e+1],i[e+2]];var l=this.getBisectorNormals2d(t,n,o,r);a=a.concat(l)}var c=this.getRightMostControlPoint2d(i,t);c&&a.push(c);for(let t=0;t<i.length-1;t++){n=i[t],o=i[t+1],s.push(n);for(let e=0;e<100;e++){var h=this.getCubicValue2d(e/100,n,a[2*t],a[2*t+1],o);s.push(h)}s.push(o)}return s},getBezierPoints2d:function(o){if(o.length<=2)return o;var e=[],r=o.length-1;for(let n=0;n<=1;n+=.01){let[t,i]=[0,0];for(let e=0;e<=r;e++){var a=this.getBinomialFactor2d(r,e),s=Math.pow(n,e),l=Math.pow(1-n,r-e);t+=a*s*l*o[e][0],i+=a*s*l*o[e][1]}e.push([t,i])}return e.push(o[r]),e},getFactorial2d:function(t){let i=1;switch(t){case t<=1:i=1;break;case 2===t:i=2;break;case 3===t:i=6;break;case 24===t:i=24;break;case 5===t:i=120;break;default:for(let e=1;e<=t;e++)i*=e}return i},getBinomialFactor2d:function(e,t){return this.getFactorial2d(e)/(this.getFactorial2d(t)*this.getFactorial2d(e-t))},getQBSplinePoints2d:function(r){if(r.length<=2)return r;var[a,e]=[2,[]],t=r.length-a-1;e.push(r[0]);for(let o=0;o<=t;o++)for(let n=0;n<=1;n+=.05){let[t,i]=[0,0];for(let e=0;e<=a;e++){var s=this.getQuadricBSplineFactor2d(e,n);t+=s*r[o+e][0],i+=s*r[o+e][1]}e.push([t,i])}return e.push(r[r.length-1]),e},getQuadricBSplineFactor2d:function(e,t){let i=0;return 0===e?i=Math.pow(t-1,2)/2:1===e?i=(-2*Math.pow(t,2)+2*t+1)/2:2===e&&(i=Math.pow(t,2)/2),i}};let b=null;function M(e,t){e&&(this._viewer=e,s.prototype={...s.prototype,...p.prototype},this.$graphics=new s(e,t),b=t)}M.prototype={setCircleScanEffect:function(e){var t,i,n,o,r,a,s,l,c,h,u;if(e&&e.position)return t=e.id||"CircleScan"+parseInt(1e3*Math.random()),l=e.position,i=e.radius,n=e.color||b.Color.RED,o=e.duration||1500,r=this,a=e.circleMode||"CircleScan",e=e.border||4,u=l,s=new b.Cartesian4(u.x,u.y,u.z,1),u=this.transformCartesianToWGS84(l),l=this.transformWGS84ToCartesian({lng:u.lng,lat:u.lat,alt:u.alt+500}),c=new b.Cartesian4(l.x,l.y,l.z,1),h=(new Date).getTime(),u=new b.PostProcessStage({name:t,fragmentShader:this._getCircleScanShader({get:!0,border:e}),uniforms:{u_scanCenterEC:function(){return b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new b.Cartesian4)},u_scanPlaneNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new b.Cartesian4),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,c,new b.Cartesian4),i=new b.Cartesian3;return i.x=t.x-e.x,i.y=t.y-e.y,i.z=t.z-e.z,b.Cartesian3.normalize(i,i),i},u_radius:function(){return"CircleScan"==a?i*(((new Date).getTime()-h)%o)/o:i},u_scanColor:n}}),this._viewer.scene.postProcessStages.add(u),u},setRadarScanEffect:function(e){var t,i,n,o,r,a,s,l,c,h,u,d,p,m,g,f,y,v,w;if(e&&e.position)return t=e.id||"radarScan"+parseInt(1e3*Math.random()),c=e.position,i=e.radius,n=e.color||b.Color.RED,o=e.duration||1500,r=this,a=e.border||1,e=e.width||3,w=c,s=new b.Cartesian4(w.x,w.y,w.z,1),w=this.transformCartesianToWGS84(c),c=this.transformWGS84ToCartesian({lng:w.lng,lat:w.lat,alt:w.alt+500}),l=new b.Cartesian4(c.x,c.y,c.z,1),c=this.transformWGS84ToCartesian({lng:w.lng+.001,lat:w.lat,alt:w.alt}),h=new b.Cartesian4(c.x,c.y,c.z,1),u=(new Date).getTime(),d=new b.Quaternion,p=new b.Matrix3,m=new b.Cartesian4,g=new b.Cartesian4,f=new b.Cartesian4,y=new b.Cartesian3,v=new b.Cartesian3,w=new b.PostProcessStage({name:t,fragmentShader:this._getRadarScanShader({border:a,width:e,get:!0}),uniforms:{u_scanCenterEC:function(){return b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m)},u_scanPlaneNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,g);return y.x=t.x-e.x,y.y=t.y-e.y,y.z=t.z-e.z,b.Cartesian3.normalize(y,y),y},u_scanLineNormalEC:function(){var e=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,g),i=b.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,h,f),t=(y.x=t.x-e.x,y.y=t.y-e.y,y.z=t.z-e.z,b.Cartesian3.normalize(y,y),v.x=i.x-e.x,v.y=i.y-e.y,v.z=i.z-e.z,((new Date).getTime()-u)%o/o);return b.Quaternion.fromAxisAngle(y,t*b.Math.PI*2,d),b.Matrix3.fromQuaternion(d,p),b.Matrix3.multiplyByVector(p,v,v),b.Cartesian3.normalize(v,v),v},u_radius:i,u_scanColor:n}}),this._viewer.scene.postProcessStages.add(w),w},satelliteScan:function(e){var t,i,n,o,r,a,s,l,c,h,u,d;if(e&&e.position)return t=b.Cartesian3,i=b.GeometryInstance,n=b.Primitive,o=b.MaterialAppearance,r=b.Material,a=b.Color,s=b.Matrix4,h=b.Transforms,o=b.MaterialAppearance,l=b.CylinderGeometry,u=e.position||[116.39,39.9],c=e.length||4e4,u=t.fromDegrees(u[0],u[1]),h=s.multiplyByTranslation(h.eastNorthUpToFixedFrame(u),new t(0,0,.5*c),new s),u=new i({geometry:new l({length:c,topRadius:0,bottomRadius:.5*c,vertexFormat:o.MaterialSupport.TEXTURED.vertexFormat}),modelMatrix:h}),d=this._viewer.scene.primitives.add(new n({geometryInstances:u,appearance:new o({material:new r({fabric:{uniforms:{color:e.color||new a(.2,1,0,1),repeat:e.repeat||30,offset:0,thickness:e.thickness||.2},source:"\n uniform vec4 color;\n uniform float repeat;\n uniform float offset;\n uniform float thickness;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n float sp = 1.0/repeat;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n float m = mod(dis + offset, sp);\n float a = step(sp*(1.0-thickness), m);\n material.diffuse = color.rgb;\n material.alpha = a * color.a;\n vec3 normalMC = material.normal;\n if(normalMC.y < 0.0 && normalMC.z < 0.0)\n { \n discard;\n }\n return material;\n }"},translucent:!0}),faceForward:!1,closed:!0,vertexShaderSource:"\n in vec3 position3DHigh;\n in vec3 position3DLow;\n in vec3 normal;\n in vec2 st;\n in float batchId;\n out vec3 v_positionEC;\n out vec3 v_normalEC;\n out vec2 v_st;\n void main()\n {\n vec4 p = czm_computePosition();\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = normal; // normal in world coordinates\n v_st = st;\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n }"})})),this._viewer.scene.preUpdate.addEventListener(function(){var e=d.appearance.material.uniforms.offset;1<(e-=.001)&&(e=0),d.appearance.material.uniforms.offset=e}),d},lighitCentrumScanEffect:function(t){var i=this.createLightScan_getCirclePoints(t.circle[0],t.circle[1],t.circle[2],t.circle[3]),n=this.createLightScan_entityCList(this._viewer,i,t);for(let e=0;e<n.length;e++)e!==n.length-1?this.createLightScan_changeOnePosition(t,n[e],[i[e].x,i[e].y,i[e+1].x,i[e+1].y]):this.createLightScan_changeOnePosition(t,n[e],[i[e].x,i[e].y,i[0].x,i[0].y]);return n},createLightScan_getCirclePoints:function(e,t,i,n){let o=[],r=Math.PI/180*Math.round(360/n),a=0;for(;a<n;a++){var s=t+e*Math.sin(r*a),l=i+e*Math.cos(r*a);o.unshift({x:s,y:l})}return o},createLightScan_changeOnePosition:function(t,e,i){const n=t.positionList;let o,r,a,s,l,c,h=0,u=0;function d(e){o=n[e+1][0]-n[e][0],r=n[e+1][1]-n[e][1],a=o/t.number,s=r/t.number,u=0}d(h),e.polygon.hierarchy=new b.CallbackProperty(function(){return Math.abs(l)>=Math.abs(o)&&Math.abs(c)>=Math.abs(r)&&((h+=1)===n.length-1&&(h=0),i[0]=i[0]+l,i[1]=i[1]+c,i[2]=i[2]+l,i[3]=i[3]+c,d(h)),l=u*a,c=u*s,u++,new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([t.observer[0],t.observer[1],t.observer[2],i[0]+l,i[1]+c,0,i[2]+l,i[3]+c,0]))},!1)},createLightScan_entityCList:function(t,i,n){var o=n.observer[0],r=n.observer[1],a=n.observer[2],s=[];for(let e=0;e<i.length;e++){var l=e===i.length-1?new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([o,r,a,i[e].x,i[e].y,0,i[0].x,i[0].y,0])):new b.PolygonHierarchy(b.Cartesian3.fromDegreesArrayHeights([o,r,a,i[e].x,i[e].y,0,i[e+1].x,i[e+1].y,0])),l=t.entities.add({name:"三角形",polygon:{hierarchy:l,outline:!1,perPositionHeight:!0,material:n.material}});s.push(l)}return s},createFireParticleSystem(e){var t,i,n,o,r,a,s,l,c,h,u,d;if(e&&e.position)return{fireImage:e,startScale:t,endScale:i,minimumParticleLife:n,maximumParticleLife:o,minimumSpeed:r,maximumSpeed:a,particleSize:s,emissionRate:l,position:c,startColor:h,endColor:u,emitter:d}=Object.assign({},{fireImage:"static/data/images/file/fire.png",startScale:3,endScale:1.5,minimumParticleLife:1.5,maximumParticleLife:1.8,minimumSpeed:7,maximumSpeed:9,particleSize:2,emissionRate:200,startColor:new b.Color(1,1,1,1),endColor:new b.Color(.5,0,0,0),emitter:new b.ConeEmitter(b.Math.toRadians(45))},e),new b.ParticleSystem({image:e,startScale:t,endScale:i,minimumParticleLife:n,maximumParticleLife:o,minimumSpeed:r,maximumSpeed:a,emissionRate:l,startColor:h,endColor:u,emitter:d,imageSize:new b.Cartesian2(s,s),lifetime:16,loop:!0,sizeInMeters:!0,modelMatrix:b.Transforms.eastNorthUpToFixedFrame(c)})}};const T="uniform vec4 u_intersectionColor;\nuniform float u_intersectionWidth;\nuniform vec4 u_lineColor;\n\nbool inSensorShadow(vec3 coneVertexWC, vec3 inverseRadii, vec3 pointWC) {\n // Diagonal matrix from the unscaled ellipsoid space to the scaled space.\n vec3 D = inverseRadii;\n\n // Sensor vertex in the scaled ellipsoid space\n vec3 q = D * coneVertexWC;\n float qMagnitudeSquared = dot(q, q);\n float test = qMagnitudeSquared - 1.0;\n\n // Sensor vertex to fragment vector in the ellipsoid's scaled space\n vec3 temp = D * pointWC - q;\n float d = dot(temp, q);\n\n // Behind silhouette plane and inside silhouette cone\n return (d < -test) && (d / length(temp) < -sqrt(test));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n\nvec4 getLineColor() { return u_lineColor; }\n\nvec4 getIntersectionColor() { return u_intersectionColor; }\n\nfloat getIntersectionWidth() { return u_intersectionWidth; }\n\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC) {\n // (s, t) both in the range [0, 1]\n float t = pointMC.z / sensorRadius;\n float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\n s = s - floor(s);\n\n return vec2(s, t);\n}",E='#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n uniform bool u_showIntersection;\nuniform bool u_showThroughEllipsoid;\n\nuniform float u_radius;\nuniform float u_xHalfAngle;\nuniform float u_yHalfAngle;\nuniform float u_normalDirection;\nuniform float u_type;\n\nin vec3 v_position;\nin vec3 v_positionWC;\nin vec3 v_positionEC;\nin vec3 v_normalEC;\n\nvec4 getColor(float sensorRadius, vec3 pointEC) {\n czm_materialInput materialInput;\n\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n materialInput.str = pointMC / sensorRadius;\n\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n\n vec3 normalEC = normalize(v_normalEC);\n materialInput.normalEC = u_normalDirection * normalEC;\n\n czm_material material = czm_getMaterial(materialInput);\n\n return mix(\n czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),\n vec4(material.diffuse, material.alpha), 0.4);\n}\n\nbool isOnBoundary(float value, float epsilon) {\n float width = getIntersectionWidth();\n float tolerance = width * epsilon;\n\n#ifdef GL_OES_standard_derivatives\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\n float pixels = width * delta;\n float temp = abs(value);\n // There are a couple things going on here.\n // First we test the value at the current fragment to see if it is within the\n // tolerance. We also want to check if the value of an adjacent pixel is\n // within the tolerance, but we don\'t want to admit points that are obviously\n // not on the surface. For example, if we are looking for "value" to be close\n // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1\n // and "temp - delta" would be "1 - 1" which is zero even though neither of\n // the points is close to zero.\n return temp < tolerance && temp < pixels ||\n (delta < 10.0 * tolerance && temp - delta < tolerance &&\n temp < pixels);\n#else\n return abs(value) < tolerance;\n#endif\n}\n\nvec4 shade(bool isOnBoundary) {\n if (u_showIntersection && isOnBoundary) {\n return getIntersectionColor();\n }\n if (u_type == 1.0) {\n return getLineColor();\n }\n return getColor(u_radius, v_positionEC);\n}\n\nfloat ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {\n vec3 scaled = inverseRadii * point;\n return dot(scaled, scaled) - 1.0;\n}\n\nvoid main() {\n vec3 sensorVertexWC =\n czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n vec3 sensorVertexEC =\n czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n\n // vec3 pixDir = normalize(v_position);\n float positionX = v_position.x;\n float positionY = v_position.y;\n float positionZ = v_position.z;\n\n vec3 zDir = vec3(0.0, 0.0, 1.0);\n vec3 lineX = vec3(positionX, 0, positionZ);\n vec3 lineY = vec3(0, positionY, positionZ);\n float resX = dot(normalize(lineX), zDir);\n if (resX < cos(u_xHalfAngle) - 0.00001) {\n discard;\n }\n float resY = dot(normalize(lineY), zDir);\n if (resY < cos(u_yHalfAngle) - 0.00001) {\n discard;\n }\n\n // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n float ellipsoidValue =\n ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);\n\n // Occluded by the ellipsoid?\n if (!u_showThroughEllipsoid) {\n // Discard if in the ellipsoid\n // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done\n // on the CPU first.\n if (ellipsoidValue < 0.0) {\n discard;\n }\n\n // Discard if in the sensor\'s shadow\n if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,\n v_positionWC)) {\n discard;\n }\n }\n\n // Notes: Each surface functions should have an associated tolerance based on\n // the floating point error.\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n // isOnEllipsoid = false;\n // if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){\n /*if(false){\n out_FragColor = vec4(1.0,0.0,0.0,1.0);\n }else{\n out_FragColor = shade(isOnEllipsoid);\n }\n*/\nout_FragColor = shade(isOnEllipsoid);\n}';let A={};function I(t){var P=(A=t).BoundingSphere,x=A.Cartesian3,i=A.Color,d=A.combine,b=A.ComponentDatatype,n=A.defaultValue,o=A.defined,S=(A.destroyObject,A.DeveloperError),M=A.Matrix4,r=A.PrimitiveType,L=A.Buffer,I=A.BufferUsage,a=A.DrawCommand,D=A.Pass,R=A.RenderState,k=A.ShaderProgram,z=A.ShaderSource,O=A.VertexArray,G=A.BlendingState,F=A.CullFace,s=A.Material,Q=A.SceneMode,B=A.VertexFormat,U=A.Math,H=A.Matrix3,V=(M=A.Matrix4,A.JulianDate),u=(A.BoxGeometry,A.EllipsoidGeometry,Math.sin),W=Math.cos,N=Math.tan,j=Math.atan,q={position:0,normal:1};function e(e){var t=this;e=n(e,n.EMPTY_OBJECT),this.show=n(e.show,!0),this.slice=n(e.slice,32),this.modelMatrix=M.clone(e.modelMatrix,new M),this._modelMatrix=new M,this._computedModelMatrix=new M,this._computedScanPlaneModelMatrix=new M,this.radius=n(e.radius,Number.POSITIVE_INFINITY),this._radius=void 0,this.xHalfAngle=n(e.xHalfAngle,0),this._xHalfAngle=void 0,this.yHalfAngle=n(e.yHalfAngle,0),this._yHalfAngle=void 0,this.lineColor=n(e.lineColor,i.WHITE),this.showSectorLines=n(e.showSectorLines,!0),this.showSectorSegmentLines=n(e.showSectorSegmentLines,!0),this.showLateralSurfaces=n(e.showLateralSurfaces,!0),this.material=o(e.material)?e.material:s.fromType(s.ColorType),this._material=void 0,this._translucent=void 0,this.lateralSurfaceMaterial=o(e.lateralSurfaceMaterial)?e.lateralSurfaceMaterial:s.fromType(s.ColorType),this._lateralSurfaceMaterial=void 0,this._lateralSurfaceTranslucent=void 0,this.showDomeSurfaces=n(e.showDomeSurfaces,!0),this.domeSurfaceMaterial=o(e.domeSurfaceMaterial)?e.domeSurfaceMaterial:s.fromType(s.ColorType),this._domeSurfaceMaterial=void 0,this.showDomeLines=n(e.showDomeLines,!0),this.showIntersection=n(e.showIntersection,!0),this.intersectionColor=n(e.intersectionColor,i.WHITE),this.intersectionWidth=n(e.intersectionWidth,5),this.showThroughEllipsoid=n(e.showThroughEllipsoid,!1),this._showThroughEllipsoid=void 0,this.showScanPlane=n(e.showScanPlane,!0),this.scanPlaneColor=n(e.scanPlaneColor,i.WHITE),this.scanPlaneMode=n(e.scanPlaneMode,"horizontal"),this.scanPlaneRate=n(e.scanPlaneRate,10),this._scanePlaneXHalfAngle=0,this._scanePlaneYHalfAngle=0,this._time=V.now(),this._boundingSphere=new P,this._boundingSphereWC=new P,this._sectorFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorVA=void 0,this._sectorLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._sectorLineVA=void 0,this._sectorSegmentLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._sectorSegmentLineVA=void 0,this._domeFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeVA=void 0,this._domeLineCommand=new a({owner:this,primitiveType:r.LINES,boundingVolume:this._boundingSphereWC}),this._domeLineVA=void 0,this._scanPlaneFrontCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanPlaneBackCommand=new a({owner:this,primitiveType:r.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanRadialCommand=void 0,this._colorCommands=[],this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._uniforms={u_type:function(){return 0},u_xHalfAngle:function(){return t.xHalfAngle},u_yHalfAngle:function(){return t.yHalfAngle},u_radius:function(){return t.radius},u_showThroughEllipsoid:function(){return t.showThroughEllipsoid},u_showIntersection:function(){return t.showIntersection},u_intersectionColor:function(){return t.intersectionColor},u_intersectionWidth:function(){return t.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return t.lineColor}},this._scanUniforms={u_xHalfAngle:function(){return t._scanePlaneXHalfAngle},u_yHalfAngle:function(){return t._scanePlaneYHalfAngle},u_radius:function(){return t.radius},u_color:function(){return t.scanPlaneColor},u_showThroughEllipsoid:function(){return t.showThroughEllipsoid},u_showIntersection:function(){return t.showIntersection},u_intersectionColor:function(){return t.intersectionColor},u_intersectionWidth:function(){return t.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return t.lineColor}}}e.prototype.update=function(e){var t,i,n,o,r=e.mode;if(this.show&&r===Q.SCENE3D){var r=!1,a=!1,s=!1,l=this.xHalfAngle,c=this.yHalfAngle;if(l<0||c<0)throw new S("halfAngle must be greater than or equal to zero.");if(0!=l&&0!=c){this._xHalfAngle===l&&this._yHalfAngle===c||(this._xHalfAngle=l,this._yHalfAngle=c,r=!0);var h=this.radius;if(h<0)throw new S("this.radius must be greater than or equal to zero.");var u,d,p,m,g=!1,h=(this._radius!==h&&(g=!0,this._radius=h,this._boundingSphere=new P(x.ZERO,this.radius)),M.equals(this.modelMatrix,this._modelMatrix)&&!g||(M.clone(this.modelMatrix,this._modelMatrix),M.multiplyByUniformScale(this.modelMatrix,this.radius,this._computedModelMatrix),P.transform(this._boundingSphere,this.modelMatrix,this._boundingSphereWC)),this.showThroughEllipsoid),g=(this._showThroughEllipsoid!==this.showThroughEllipsoid&&(this._showThroughEllipsoid=h,a=!0),this.material),f=(this._material!==g&&(this._material=g,s=a=!0),g.isTranslucent()),y=(this._translucent!==f&&(this._translucent=f,a=!0),this.showScanPlane&&(m=e.time,(p=V.secondsDifference(m,this._time))<0&&(this._time=V.clone(m,this._time)),m=Math.max(p%this.scanPlaneRate/this.scanPlaneRate,0),"horizontal"==this.scanPlaneMode?(p=W(u=2*c*m-c),d=N(l),p=j(p*d),this._scanePlaneXHalfAngle=p,this._scanePlaneYHalfAngle=u,A.Matrix3.fromRotationX(this._scanePlaneYHalfAngle,Y)):(u=2*l*m-l,d=N(c),p=W(u),m=j(p*d),this._scanePlaneXHalfAngle=u,this._scanePlaneYHalfAngle=m,A.Matrix3.fromRotationY(this._scanePlaneXHalfAngle,Y)),A.Matrix4.multiplyByMatrix3(this.modelMatrix,Y,this._computedScanPlaneModelMatrix),M.multiplyByUniformScale(this._computedScanPlaneModelMatrix,this.radius,this._computedScanPlaneModelMatrix)),r&&(l=this,c=e.context,d=Z(p=l,l.xHalfAngle,l.yHalfAngle),u=p.xHalfAngle,p=p.yHalfAngle,m=d.zoy,d=d.zox,r=[],n=H.fromRotationY(u,Y),r.push(m.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)})),n=H.fromRotationX(-p,Y),r.push(d.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)}).reverse()),n=H.fromRotationY(-u,Y),r.push(m.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)}).reverse()),n=H.fromRotationX(p,Y),r.push(d.map(function(e){return H.multiplyByVector(n,e,new A.Cartesian3)})),u=r,l.showLateralSurfaces&&(l._sectorVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(18*i),o=0,r=0,a=t.length;r<a;r++)for(var s=t[r],l=x.normalize(x.cross(s[0],s[s.length-1],X),X),c=0,i=s.length-1;c<i;c++)n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z,n[o++]=s[c].x,n[o++]=s[c].y,n[o++]=s[c].z,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z,n[o++]=s[c+1].x,n[o++]=s[c+1].y,n[o++]=s[c+1].z,n[o++]=-l.x,n[o++]=-l.y,n[o++]=-l.z;var h=L.createVertexBuffer({context:e,typedArray:n,usage:I.STATIC_DRAW}),u=6*Float32Array.BYTES_PER_ELEMENT,h=[{index:q.position,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:u},{index:q.normal,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:3*Float32Array.BYTES_PER_ELEMENT,strideInBytes:u}];return new O({context:e,attributes:h})}(c,u)),l.showSectorLines&&(l._sectorLineVA=function(e,t){for(var i=new Float32Array(9*t.length),n=0,o=0,r=t.length;o<r;o++){var a=t[o];i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=a[0].x,i[n++]=a[0].y,i[n++]=a[0].z}var s=L.createVertexBuffer({context:e,typedArray:i,usage:I.STATIC_DRAW}),l=3*Float32Array.BYTES_PER_ELEMENT,s=[{index:q.position,vertexBuffer:s,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:l}];return new O({context:e,attributes:s})}(c,u)),l.showSectorSegmentLines&&(l._sectorSegmentLineVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(9*i),o=0,r=0,a=t.length;r<a;r++)for(var s=t[r],l=0,i=s.length-1;l<i;l++)n[o++]=s[l].x,n[o++]=s[l].y,n[o++]=s[l].z,n[o++]=s[l+1].x,n[o++]=s[l+1].y,n[o++]=s[l+1].z;var c=L.createVertexBuffer({context:e,typedArray:n,usage:I.STATIC_DRAW}),h=3*Float32Array.BYTES_PER_ELEMENT,c=[{index:q.position,vertexBuffer:c,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:h}];return new O({context:e,attributes:c})}(c,u)),l.showDomeSurfaces&&(l._domeVA=(m=c,p=A.EllipsoidGeometry.createGeometry(new A.EllipsoidGeometry({vertexFormat:B.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),O.fromGeometry({context:m,geometry:p,attributeLocations:q,bufferUsage:I.STATIC_DRAW,interleave:!1}))),l.showDomeLines&&(l._domeLineVA=(d=c,r=A.EllipsoidOutlineGeometry.createGeometry(new A.EllipsoidOutlineGeometry({vertexFormat:B.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),O.fromGeometry({context:d,geometry:r,attributeLocations:q,bufferUsage:I.STATIC_DRAW,interleave:!1}))),l.showScanPlane)&&("horizontal"==l.scanPlaneMode?(o=Z(l,U.PI_OVER_TWO,0),l._scanPlaneVA=$(c,o.zox)):(o=Z(l,0,U.PI_OVER_TWO),l._scanPlaneVA=$(c,o.zoy))),a&&(r=this,l=h,f?(r._frontFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:G.ALPHA_BLEND,cull:{enabled:!0,face:F.BACK}}),r._backFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:G.ALPHA_BLEND,cull:{enabled:!0,face:F.FRONT}}),r._pickRS=R.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:G.ALPHA_BLEND})):(r._frontFaceRS=R.fromCache({depthTest:{enabled:!l},depthMask:!0}),r._pickRS=R.fromCache({depthTest:{enabled:!0},depthMask:!0}))),s&&(o=c=this,l=h=g,g=(r=e).context,t="in vec4 position;\nin vec3 normal;\n\nout vec3 v_position;\nout vec3 v_positionWC;\nout vec3 v_positionEC;\nout vec3 v_normalEC;\n\nvoid main() {\n gl_Position = czm_modelViewProjection * position;\n v_position = vec3(position);\n v_positionWC = (czm_model * position).xyz;\n v_positionEC = (czm_modelView * position).xyz;\n v_normalEC = czm_normal * normal;\n}",i=new z({sources:[T,l.shaderSource,E]}),o._sp=k.replaceCache({context:g,shaderProgram:o._sp,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:q}),i=new z({sources:[T,l.shaderSource,E],pickColorQualifier:"uniform"}),o._pickSP=k.replaceCache({context:g,shaderProgram:o._pickSP,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:q}),c.showScanPlane)&&(l=c,g=h,o=r.context,g=new z({sources:[T,g.shaderSource,'#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n uniform bool u_showIntersection;\nuniform bool u_showThroughEllipsoid;\n\nuniform float u_radius;\nuniform float u_xHalfAngle;\nuniform float u_yHalfAngle;\nuniform float u_normalDirection;\nuniform vec4 u_color;\n\nin vec3 v_position;\nin vec3 v_positionWC;\nin vec3 v_positionEC;\nin vec3 v_normalEC;\n\nvec4 getColor(float sensorRadius, vec3 pointEC) {\n czm_materialInput materialInput;\n\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n materialInput.str = pointMC / sensorRadius;\n\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n\n vec3 normalEC = normalize(v_normalEC);\n materialInput.normalEC = u_normalDirection * normalEC;\n\n czm_material material = czm_getMaterial(materialInput);\n\n material.diffuse = u_color.rgb;\n material.alpha = u_color.a;\n\n return mix(\n czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),\n vec4(material.diffuse, material.alpha), 0.4);\n}\n\nbool isOnBoundary(float value, float epsilon) {\n float width = getIntersectionWidth();\n float tolerance = width * epsilon;\n\n#ifdef GL_OES_standard_derivatives\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\n float pixels = width * delta;\n float temp = abs(value);\n // There are a couple things going on here.\n // First we test the value at the current fragment to see if it is within the\n // tolerance. We also want to check if the value of an adjacent pixel is\n // within the tolerance, but we don\'t want to admit points that are obviously\n // not on the surface. For example, if we are looking for "value" to be close\n // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1\n // and "temp - delta" would be "1 - 1" which is zero even though neither of\n // the points is close to zero.\n return temp < tolerance && temp < pixels ||\n (delta < 10.0 * tolerance && temp - delta < tolerance &&\n temp < pixels);\n#else\n return abs(value) < tolerance;\n#endif\n}\n\nvec4 shade(bool isOnBoundary) {\n if (u_showIntersection && isOnBoundary) {\n return getIntersectionColor();\n }\n return getColor(u_radius, v_positionEC);\n}\n\nfloat ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {\n vec3 scaled = inverseRadii * point;\n return dot(scaled, scaled) - 1.0;\n}\n\nvoid main() {\n vec3 sensorVertexWC =\n czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n vec3 sensorVertexEC =\n czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\n\n // vec3 pixDir = normalize(v_position);\n float positionX = v_position.x;\n float positionY = v_position.y;\n float positionZ = v_position.z;\n\n vec3 zDir = vec3(0.0, 0.0, 1.0);\n vec3 lineX = vec3(positionX, 0, positionZ);\n vec3 lineY = vec3(0, positionY, positionZ);\n float resX = dot(normalize(lineX), zDir);\n if (resX < cos(u_xHalfAngle) - 0.0001) {\n discard;\n }\n float resY = dot(normalize(lineY), zDir);\n if (resY < cos(u_yHalfAngle) - 0.0001) {\n discard;\n }\n\n // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n float ellipsoidValue =\n ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);\n\n // Occluded by the ellipsoid?\n if (!u_showThroughEllipsoid) {\n // Discard if in the ellipsoid\n // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done\n // on the CPU first.\n if (ellipsoidValue < 0.0) {\n discard;\n }\n\n // Discard if in the sensor\'s shadow\n if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,\n v_positionWC)) {\n discard;\n }\n }\n\n // Notes: Each surface functions should have an associated tolerance based on\n // the floating point error.\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n out_FragColor = shade(isOnEllipsoid);\n}']}),l._scanePlaneSP=k.replaceCache({context:o,shaderProgram:l._scanePlaneSP,vertexShaderSource:"in vec4 position;\nin vec3 normal;\n\nout vec3 v_position;\nout vec3 v_positionWC;\nout vec3 v_positionEC;\nout vec3 v_normalEC;\n\nvoid main() {\n gl_Position = czm_modelViewProjection * position;\n v_position = vec3(position);\n v_positionWC = (czm_model * position).xyz;\n v_positionEC = (czm_modelView * position).xyz;\n v_normalEC = czm_normal * normal;\n}",fragmentShaderSource:g,attributeLocations:q})),(a||s)&&(t=f,(i=this)._colorCommands.length=0,c=t?D.TRANSLUCENT:D.OPAQUE,i.showLateralSurfaces&&J(i,i._sectorFrontCommand,i._sectorBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorVA,i._uniforms,i._computedModelMatrix,t,c),i.showSectorLines&&J(i,i._sectorLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showSectorSegmentLines&&J(i,i._sectorSegmentLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorSegmentLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showDomeSurfaces&&J(i,i._domeFrontCommand,i._domeBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._domeVA,i._uniforms,i._computedModelMatrix,t,c),i.showDomeLines&&J(i,i._domeLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._domeLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showScanPlane)&&J(i,i._scanPlaneFrontCommand,i._scanPlaneBackCommand,i._frontFaceRS,i._backFaceRS,i._scanePlaneSP,i._scanPlaneVA,i._scanUniforms,i._computedScanPlaneModelMatrix,t,c),e.commandList),h=e.passes,v=this._colorCommands;if(h.render)for(var w=0,_=v.length;w<_;w++){var C=v[w];y.push(C)}}}};var Y=new H,X=new x;function Z(e,t,i){for(var n=e.slice,e=W(i),i=N(i),o=W(t),t=N(t),r=j(o*i),a=j(e*t),s=[],l=0;l<n;l++){var c=2*r*l/(n-1)-r;s.push(new x(0,u(c),W(c)))}for(var h=[],l=0;l<n;l++)h.push(new x(u(c=2*a*l/(n-1)-a),0,W(c)));return{zoy:s,zox:h}}function $(e,t){for(var i=t.length-1,n=new Float32Array(9*i),o=0,r=0;r<i;r++)n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=t[r].x,n[o++]=t[r].y,n[o++]=t[r].z,n[o++]=t[r+1].x,n[o++]=t[r+1].y,n[o++]=t[r+1].z;var a=L.createVertexBuffer({context:e,typedArray:n,usage:I.STATIC_DRAW}),s=3*Float32Array.BYTES_PER_ELEMENT,a=[{index:q.position,vertexBuffer:a,componentsPerAttribute:3,componentDatatype:b.FLOAT,offsetInBytes:0,strideInBytes:s}];return new O({context:e,attributes:a})}function J(e,t,i,n,o,r,a,s,l,c,h,u){c&&i&&(i.vertexArray=a,i.renderState=o,i.shaderProgram=r,i.uniformMap=d(s,e._material._uniforms),i.uniformMap.u_normalDirection=function(){return-1},i.pass=h,i.modelMatrix=l,e._colorCommands.push(i)),t.vertexArray=a,t.renderState=n,t.shaderProgram=r,t.uniformMap=d(s,e._material._uniforms),u&&(t.uniformMap.u_type=function(){return 1}),t.pass=h,t.modelMatrix=l,e._colorCommands.push(t)}return e}let L={};function D(e){var t=(L=e).defaultValue,i=L.defined,e=Object.defineProperties,n=L.DeveloperError,o=L.Event,r=L.createMaterialPropertyDescriptor,a=L.createPropertyDescriptor;function s(e){this._show=void 0,this._radius=void 0,this._xHalfAngle=void 0,this._yHalfAngle=void 0,this._lineColor=void 0,this._showSectorLines=void 0,this._showSectorSegmentLines=void 0,this._showLateralSurfaces=void 0,this._material=void 0,this._showDomeSurfaces=void 0,this._showDomeLines=void 0,this._showIntersection=void 0,this._intersectionColor=void 0,this._intersectionWidth=void 0,this._showThroughEllipsoid=void 0,this._gaze=void 0,this._showScanPlane=void 0,this._scanPlaneColor=void 0,this._scanPlaneMode=void 0,this._scanPlaneRate=void 0,this._definitionChanged=new o,this.merge(t(e,t.EMPTY_OBJECT))}return e(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),radius:a("radius"),xHalfAngle:a("xHalfAngle"),yHalfAngle:a("yHalfAngle"),lineColor:a("lineColor"),showSectorLines:a("showSectorLines"),showSectorSegmentLines:a("showSectorSegmentLines"),showLateralSurfaces:a("showLateralSurfaces"),material:r("material"),showDomeSurfaces:a("showDomeSurfaces"),showDomeLines:a("showDomeLines "),showIntersection:a("showIntersection"),intersectionColor:a("intersectionColor"),intersectionWidth:a("intersectionWidth"),showThroughEllipsoid:a("showThroughEllipsoid"),gaze:a("gaze"),showScanPlane:a("showScanPlane"),scanPlaneColor:a("scanPlaneColor"),scanPlaneMode:a("scanPlaneMode"),scanPlaneRate:a("scanPlaneRate")}),s.prototype.clone=function(e){return(e=i(e)?e:new s).show=this.show,e.radius=this.radius,e.xHalfAngle=this.xHalfAngle,e.yHalfAngle=this.yHalfAngle,e.lineColor=this.lineColor,e.showSectorLines=this.showSectorLines,e.showSectorSegmentLines=this.showSectorSegmentLines,e.showLateralSurfaces=this.showLateralSurfaces,e.material=this.material,e.showDomeSurfaces=this.showDomeSurfaces,e.showDomeLines=this.showDomeLines,e.showIntersection=this.showIntersection,e.intersectionColor=this.intersectionColor,e.intersectionWidth=this.intersectionWidth,e.showThroughEllipsoid=this.showThroughEllipsoid,e.gaze=this.gaze,e.showScanPlane=this.showScanPlane,e.scanPlaneColor=this.scanPlaneColor,e.scanPlaneMode=this.scanPlaneMode,e.scanPlaneRate=this.scanPlaneRate,e},s.prototype.merge=function(e){if(!i(e))throw new n("source is required.");this.show=t(this.show,e.show),this.radius=t(this.radius,e.radius),this.xHalfAngle=t(this.xHalfAngle,e.xHalfAngle),this.yHalfAngle=t(this.yHalfAngle,e.yHalfAngle),this.lineColor=t(this.lineColor,e.lineColor),this.showSectorLines=t(this.showSectorLines,e.showSectorLines),this.showSectorSegmentLines=t(this.showSectorSegmentLines,e.showSectorSegmentLines),this.showLateralSurfaces=t(this.showLateralSurfaces,e.showLateralSurfaces),this.material=t(this.material,e.material),this.showDomeSurfaces=t(this.showDomeSurfaces,e.showDomeSurfaces),this.showDomeLines=t(this.showDomeLines,e.showDomeLines),this.showIntersection=t(this.showIntersection,e.showIntersection),this.intersectionColor=t(this.intersectionColor,e.intersectionColor),this.intersectionWidth=t(this.intersectionWidth,e.intersectionWidth),this.showThroughEllipsoid=t(this.showThroughEllipsoid,e.showThroughEllipsoid),this.gaze=t(this.gaze,e.gaze),this.showScanPlane=t(this.showScanPlane,e.showScanPlane),this.scanPlaneColor=t(this.scanPlaneColor,e.scanPlaneColor),this.scanPlaneMode=t(this.scanPlaneMode,e.scanPlaneMode),this.scanPlaneRate=t(this.scanPlaneRate,e.scanPlaneRate)},s}let k={};function z(e,v){function c(e,t,i){var n=t[e.id];C(n)&&(n=n.primitive,i.remove(n),n&&!n.isDestroyed()&&n.destroy(),delete t[e.id])}var i,w,_,C,o,P,x,b,S,M,T,A,E,L,I,D,R,n;if(e)return i=(k=e).AssociativeArray,w=k.Cartesian3,_=k.Color,C=k.defined,o=k.destroyObject,P=k.DeveloperError,x=k.Matrix3,b=k.Matrix4,S=k.Quaternion,M=k.MaterialProperty,T=k.Property,A=new x,new b,E=new w,L=new w,I=new S,D=new w,R=new S,(n=function(e,t){if(!C(e))throw new P("scene is required.");if(!C(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(n.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._hash={},this._entitiesToVisualize=new i,this._onCollectionChanged(t,t.values,[],[])}).prototype.update=function(e){if(!C(e))throw new P("time is required.");for(var t=this._entitiesToVisualize.values,i=this._hash,n=this._primitives,o=0,r=t.length;o<r;o++){var a,s,l,c=t[o],h=c._rectangularSensor,u=i[c.id],d=c.isShowing&&c.isAvailable(e)&&T.getValueOrDefault(h._show,e,!0);if(d&&(a=T.getValueOrUndefined(c._position,e,E),f=T.getValueOrUndefined(c._orientation,e,I),y=T.getValueOrUndefined(h._radius,e),s=T.getValueOrUndefined(h._xHalfAngle,e),l=T.getValueOrUndefined(h._yHalfAngle,e),d=C(a)&&C(s)&&C(l)),d){d=C(u)?u.primitive:void 0,c=(C(d)||((d=new v).id=c,n.add(d),i[c.id]=u={primitive:d,position:void 0,orientation:void 0}),T.getValueOrUndefined(h._gaze,e));if(C(c)){var p=T.getValueOrUndefined(c._position,e,L);if(!C(a)||!C(p))continue;var m=w.subtract(a,p,D),g=w.angleBetween(k.Cartesian3.UNIT_Z,m),m=w.cross(k.Cartesian3.UNIT_Z,m,D),f=S.fromAxisAngle(m,g-Math.PI,R),y=w.distance(a,p);d.modelMatrix=b.fromRotationTranslation(x.fromQuaternion(f,A),a,d.modelMatrix)}else w.equals(a,u.position)&&S.equals(f,u.orientation)||(C(f)?(d.modelMatrix=b.fromRotationTranslation(x.fromQuaternion(f,A),a,d.modelMatrix),u.position=w.clone(a,u.position),u.orientation=S.clone(f,u.orientation)):(d.modelMatrix=k.Transforms.eastNorthUpToFixedFrame(a),u.position=w.clone(a,u.position)));d.show=!0,d.gaze=c,d.radius=y,d.xHalfAngle=s,d.yHalfAngle=l,d.lineColor=T.getValueOrDefault(h._lineColor,e,_.WHITE),d.showSectorLines=T.getValueOrDefault(h._showSectorLines,e,!0),d.showSectorSegmentLines=T.getValueOrDefault(h._showSectorSegmentLines,e,!0),d.showLateralSurfaces=T.getValueOrDefault(h._showLateralSurfaces,e,!0),d.material=M.getValue(e,h._material,d.material),d.showDomeSurfaces=T.getValueOrDefault(h._showDomeSurfaces,e,!0),d.showDomeLines=T.getValueOrDefault(h._showDomeLines,e,!0),d.showIntersection=T.getValueOrDefault(h._showIntersection,e,!0),d.intersectionColor=T.getValueOrDefault(h._intersectionColor,e,_.WHITE),d.intersectionWidth=T.getValueOrDefault(h._intersectionWidth,e,1),d.showThroughEllipsoid=T.getValueOrDefault(h._showThroughEllipsoid,e,!0),d.scanPlaneMode=T.getValueOrDefault(h._scanPlaneMode,e),d.scanPlaneColor=T.getValueOrDefault(h._scanPlaneColor,e,_.WHITE),d.showScanPlane=T.getValueOrDefault(h._showScanPlane,e,!0),d.scanPlaneRate=T.getValueOrDefault(h._scanPlaneRate,e,1)}else C(u)&&(u.primitive.show=!1)}return!0},n.prototype.isDestroyed=function(){return!1},n.prototype.destroy=function(){for(var e=this._entitiesToVisualize.values,t=this._hash,i=this._primitives,n=e.length-1;-1<n;n--)c(e[n],t,i);return o(this)},n.prototype._onCollectionChanged=function(e,t,i,n){for(var o,r=this._entitiesToVisualize,a=this._hash,s=this._primitives,l=t.length-1;-1<l;l--)o=t[l],C(o._rectangularSensor)&&C(o._position)&&r.set(o.id,o);for(l=n.length-1;-1<l;l--)o=n[l],C(o._rectangularSensor)&&C(o._position)?r.set(o.id,o):(c(o,a,s),r.remove(o.id));for(l=i.length-1;-1<l;l--)c(o=i[l],a,s),r.remove(o.id)},n}let R=null;function G(e,t){e&&(this.viewer=e,R=t,this._installPlugin())}G.prototype={_installPlugin:function(){this._installCounputeVertex(),this._installCylinderGeometry(),this._installRadarPrimitive()},_installCylinderGeometry:function(){function b(e){this.length=e.length,this.topRadius=e.topRadius,this.bottomRadius=e.bottomRadius,this.slices=e.slices||64,this.zReverse=e.zReverse}var M=new R.Cartesian2,S=new R.Cartesian3,T=new R.Ray;b._createGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,o=e.slices,r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=M;p.z=Math.sin(e);for(var m=Math.cos(e),g=0;g<u.length;g++){c[g]=[];for(var f=h[g],y=0;y<o;y++){c[g].push(d++);var v=r*y,w=f*Math.cos(v),_=f*Math.sin(v);a.push(w,_,u[g]),w=m*Math.cos(v),_=m*Math.sin(v),s.push(w,_,p.z),l.push(g/(u.length-1),0)}}for(var C=[],g=1;g<u.length;g++)for(y=1;y<o;y++){var P=c[g-1][y-1],x=c[g][y-1],b=c[g][y],S=c[g-1][y];C.push(b),C.push(S),C.push(P),C.push(b),C.push(P),C.push(x),y==c[g].length-1&&(P=c[g-1][y],x=c[g][y],b=c[g][0],S=c[g-1][0],C.push(b),C.push(S),C.push(P),C.push(b),C.push(P),C.push(x))}C=new Int16Array(C),a=new Float32Array(a),s=new Float32Array(s),l=new Float32Array(l),n={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),normal:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:s}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:l})},i=R.BoundingSphere.fromVertices(a),t=new R.Geometry({attributes:n,indices:C,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:i});return a=[],C=[],l=[],t},b.createGeometry=function(e,t){if(!t)return b._createGeometry(e);R.Matrix4.multiplyByPoint(t,R.Cartesian3.ZERO,S),S.clone(T.origin);var i=e.length,n=e.topRadius,o=(e.bottomRadius,e.slices),r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[0,e.zReverse?-i:i],u=0,u=0;a.push(0,0,0),s.push(1,1),u++;for(var d=new R.Cartesian3,p=n/15,m=0;m<16;m++){for(var g=p*m,f=[],y=0;y<o;y++){var v=r*y,w=g*Math.cos(v),v=g*Math.sin(v);d.x=w,d.y=v,d.z=h[1],(0,R.Scene.extend2Earth)(d,t,T)?(f.push(u),a.push(w,v,h[1]),s.push(m/15,1),u++):f.push(-1)}c.push(f)}for(var _,C,P=[0,c.length-1],x=0;x<P.length;x++)for(m=P[x],y=1;y<c[m].length;y++)_=c[m][y-1],C=c[m][y],0<=_&&0<=C&&l.push(0,_,C);a=new Float32Array(a),l=new Int32Array(l),s=new Float32Array(s),e={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:s})},i=R.BoundingSphere.fromVertices(a),n=new R.Geometry({attributes:e,indices:l,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:i});return(0,R.Scene.computeVertexNormals)(n),a=[],l=[],n},b.createOutlineGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,o=e.slices,r=2*Math.PI/(o-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=M;p.z=Math.sin(e);for(var m=Math.cos(e),g=0;g<u.length;g++){c[g]=[];for(var f=h[g],y=0;y<o;y++){c[g].push(d++);var v=r*y,w=f*Math.cos(v),_=f*Math.sin(v);a.push(w,_,u[g]),w=m*Math.cos(v),_=m*Math.sin(v),s.push(w,_,p.z),l.push(g/(u.length-1),0)}}for(var C=[],g=1;g<u.length;g++)for(y=1;y<o;y+=1){var P=c[g-1][y-1],x=c[g][y-1];c[g][y],c[g-1][y],y%8==1&&C.push(P,x)}C=new Int16Array(C),a=new Float32Array(a),s=new Float32Array(s),l=new Float32Array(l),n={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),normal:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:s}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:l})},i=R.BoundingSphere.fromVertices(a),t=new R.Geometry({attributes:n,indices:C,primitiveType:R.PrimitiveType.LINES,boundingSphere:i});return a=[],C=[],l=[],t},b.fromAngleAndLength=function(e,t,i){return e=R.Math.toRadians(e),new b({topRadius:Math.tan(e)*t/2,bottomRadius:0,length:t,zReverse:i})},R.Scene.CylinderGeometry=b},_installRadarPrimitive:function(){var i;function e(e,t){t=t||{},i=e.scene.globe.ellipsoid,this._geometry=null,this._angle=t.angle,this._radius=t.radius||5,this._position=t.position,this._rotation=t.rotation||{heading:0,pitch:0,roll:0},this._trackedEntity=t.trackedEntity,this.defaultColor=t.color||R.Color.YELLOW,this.defaultLineColor=t.lineColor||this.defaultColor,this._show=R.defaultValue(t.show,!0),this._outline=R.defaultValue(t.outline,!1),this._topShow=R.defaultValue(t.top,!0),this._topOutline=R.defaultValue(t.topOutline,!0),this._modelMatrix=R.Matrix4.clone(R.Matrix4.IDENTITY),this._quaternion=new R.Quaternion,this._translation=new R.Cartesian3,this._scale=new R.Cartesian3(1,1,1),this._matrix=new R.Matrix4,this._inverseMatrix=new R.Matrix4,this._positionCartographic=new R.Cartographic,this._positionCartesian=null,this._drawCommands=[],this._outlinePositions=[],this.viewer=e,this.viewer.scene.primitives.add(this),this.updateGeometry(),this._groundArea=R.defaultValue(t.groundArea,!1),this.addGroundAreaEntity(this._groundArea)}Object.defineProperties(e.prototype,{trackedEntity:{get:function(){return this._trackedEntity},set:function(e){this._trackedEntity=e}},color:{get:function(){return this.defaultColor},set:function(e){this.defaultColor=e}},lineColor:{get:function(){return this.defaultLineColor},set:function(e){this.defaultLineColor=e}},show:{get:function(){return this._show},set:function(e){this._show=e}},outline:{get:function(){return this._outline},set:function(e){this._outline=e,this.updateGeometry()}},top:{get:function(){return this._topShow},set:function(e){this._topShow=e,this.updateGeometry()}},topOutline:{get:function(){return this._topOutline},set:function(e){this._topOutline=e,this.updateGeometry()}},groundArea:{get:function(){return this._groundArea},set:function(e){this._groundArea=e,this.addGroundAreaEntity(this._groundArea)}},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this.updateGroundCircleRadius(),this.updateGeometry()}},radius:{get:function(){return this._radius},set:function(e){this._radius=e,this.updateGroundCircleRadius(),this.updateGeometry()}},heading:{get:function(){return this._rotation.heading},set:function(e){this._rotation.heading=e}},pitch:{get:function(){return this._rotation.pitch},set:function(e){this._rotation.pitch=e}},roll:{get:function(){return this._rotation.roll},set:function(e){this._rotation.roll=e}},position:{get:function(){return this._position},set:function(e){this._position=e}}}),e.prototype.updateGroundCircleRadius=function(){this._ground_radius=this._radius*Math.cos(R.Math.toRadians(this._angle))},e.prototype.addGroundAreaEntity=function(e){var t;e&&!this.groundAreaEntity&&((t=this).updateGroundCircleRadius(),this.groundAreaEntity=viewer.entities.add({position:this._position,ellipse:{show:0===this._rotation.pitch&&0===this._rotation.roll,semiMinorAxis:new R.CallbackProperty(function(e){return t._ground_radius},!1),semiMajorAxis:new R.CallbackProperty(function(e){return t._ground_radius},!1),material:this.defaultColor},polyline:{show:this._trackedEntityPosition&&(0!==this._rotation.pitch||0!==this._rotation.roll),positions:new R.CallbackProperty(function(e){return!t._trackedEntityPosition||R.Cartesian3.distance(t._position,t._trackedEntityPosition)>t._radius?[]:[t._position,t._trackedEntityPosition]},!1),followSurface:!1,material:new R.PolylineDashMaterialProperty({color:R.Color.CYAN}),width:1}}))};var n=new R.Cartesian3;e.prototype.computeMatrix=function(e,t){return this._positionCartesian||(this._positionCartesian=new R.Cartesian3),this.position instanceof R.Cartesian3?this._positionCartesian=this.position:"function"==typeof this.position.getValue?this._positionCartesian=this.position.getValue(e):this.position._value&&this.position._value instanceof R.Cartesian3&&(this._positionCartesian=this.position._value),this._trackedEntity&&this._trackedEntity.position&&(this._positionCartesian,e=R.Property.getValueOrUndefined(this._trackedEntity.position,e,n))&&(this._trackedEntityPosition=e,this._rotation.heading=0,this._rotation.pitch=40,this._rotation.roll=0),this._modelMatrix=R.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,i,this._modelMatrix),this._positionCartographic=R.Cartographic.fromCartesian(this._positionCartesian,i,this._positionCartographic),R.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,i,this._modelMatrix),R.Quaternion.fromHeadingPitchRoll(this._rotation,this._quaternion),this._matrix=R.Matrix4.fromTranslationQuaternionRotationScale(this._translation,this._quaternion,this._scale,this._matrix),R.Matrix4.multiplyTransformation(this._modelMatrix,this._matrix,this._matrix),R.Matrix4.inverseTransformation(this._matrix,this._inverseMatrix),this._matrix},e.prototype.getTopGeometry=function(){for(var e=this.radius,t=[],i=[],n=[],o=[],r=90-parseInt(this.angle),a=r<1?r/8:1,s=2*Math.PI/127,l=0,c=this.angle;c<91;c+=a){for(var h=R.Math.toRadians(c<90?c:90),h=Math.cos(h)*e,u=[],d=0;d<128;d++){var p=s*d,m=h*Math.cos(p),p=h*Math.sin(p),g=Math.sqrt(e*e-m*m-p*p);t.push(m,p,g),i.push(1,1),u.push(l++)}o.push(u)}for(c=1;c<o.length;c++)for(d=1;d<o[c].length;d++){var f=o[c-1][d-1],y=o[c][d-1],v=o[c][d],w=o[c-1][d];n.push(f,y,v),n.push(f,v,w)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),r={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:i})},_=R.BoundingSphere.fromVertices(t),r=new R.Geometry({attributes:r,indices:n,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:_});return(0,R.Scene.computeVertexNormals)(r),r},e.prototype.getTopOutlineGeometry=function(){for(var e=this.radius,t=[],i=[],n=[],o=[],r=90-parseInt(this.angle),a=r<1?r/8:1,s=2*Math.PI/127,l=0,c=this.angle;c<91;c+=a){for(var h=R.Math.toRadians(c<90?c:90),h=Math.cos(h)*e,u=[],d=0;d<128;d++){var p=s*d,m=h*Math.cos(p),p=h*Math.sin(p),g=Math.sqrt(e*e-m*m-p*p);t.push(m,p,g),i.push(1,1),u.push(l++)}o.push(u)}for(c=1;c<o.length;c++)for(d=1;d<o[c].length;d++){var f=o[c-1][d-1],y=o[c][d-1],v=o[c][d];o[c-1][d],d%8==1&&n.push(f,y),c%8==1&&n.push(y,v)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),r={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:i})},w=R.BoundingSphere.fromVertices(t),r=new R.Geometry({attributes:r,indices:n,primitiveType:R.PrimitiveType.LINES,boundingSphere:w});return(0,R.Scene.computeVertexNormals)(r),r},e.prototype.updateGeometry=function(){this._geometry=R.Scene.CylinderGeometry.createGeometry(new R.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(R.Math.toRadians(this.angle)),bottomRadius:0,length:this._radius*Math.sin(R.Math.toRadians(this.angle))})),this._topGeometry=this.getTopGeometry(),this._topOutlineGeometry=this.getTopOutlineGeometry(),this._outlineGeometry=R.Scene.CylinderGeometry.createOutlineGeometry(new R.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(R.Math.toRadians(this.angle)),bottomRadius:0,slices:128,length:this._radius*Math.sin(R.Math.toRadians(this.angle))})),this._positions=new Float32Array(this._geometry.attributes.position.values.length);for(var e=0;e<this._positions.length;e++)this._positions[e]=this._geometry.attributes.position.values[e];this._drawCommands&&this._drawCommands.length&&(this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy()}),this._drawCommands.splice(0,this._drawCommands.length))},e.prototype.update=function(t){this._show&&(this.computeMatrix(t.time),t.mode===R.SceneMode.SCENE3D?(this._geometry.boundingSphere=R.BoundingSphere.fromVertices(this._geometry.attributes.position.values),this._drawCommands&&this._drawCommands.length||(this._drawCommands.push(this.createDrawCommand(this._geometry,t)),this._outline&&this._drawCommands.push(this.createDrawCommand(this._outlineGeometry,t)),this._topShow&&(this._drawCommands.push(this.createDrawCommand(this._topGeometry,t)),this._topOutline)&&this._drawCommands.push(this.createDrawCommand(this._topOutlineGeometry,t))),this._drawCommands.forEach(function(e){t.commandList.push(e)}),this.groundAreaEntity&&(this.groundAreaEntity.ellipse.show=this._groundArea&&0===this._rotation.pitch&&0===this._rotation.roll,this.groundAreaEntity.polyline.show=!1)):(this.groundAreaEntity||this.addGroundAreaEntity(!0),this.groundAreaEntity.ellipse.show=0===this._rotation.pitch&&0===this._rotation.roll,this.groundAreaEntity.polyline.show=this._trackedEntityPosition&&(0!==this._rotation.pitch||0!==this._rotation.roll)))},e.prototype.getFragmentShaderSource=function(e){return"#version 300 es\n in vec3 v_position;\n in vec3 v_normal; \n uniform float picked; \n uniform vec4 pickedColor; \n uniform vec4 defaultColor; \n uniform float specular; \n uniform float shininess; \n uniform vec3 emission; \n in vec2 v_st; \n uniform bool isLine; \n uniform float glowPower; \n void main() { \n vec3 positionToEyeEC = -v_position; \n vec3 normalEC = normalize(v_normal); \n vec4 color = defaultColor; \n if (picked != 0.0) { \n color = pickedColor; \n } \n czm_material material; \n material.specular = specular; \n material.shininess = shininess; \n material.normal = normalEC; \n material.emission = emission;//vec3(0.2,0.2,0.2);\n material.diffuse = color.rgb ;\n if(isLine){\n material.alpha = 1.0; \n }\n else{ \n material.alpha = color.a; \n }\n if(v_st.x==0.0){ \n out_FragColor =color ;\n }else { \n out_FragColor = czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC) ; \n } \n }"},e.prototype.getVertexShaderSource=function(e){return"#version 300 es\n #ifdef GL_ES\n precision highp float;\n #endif\n\n in vec3 position;\n in vec2 st;\n in vec3 normal;\n uniform mat4 modelViewMatrix;\n uniform mat3 normalMatrix;\n uniform mat4 projectionMatrix;\n out vec3 v_position;\n out vec3 v_normal;\n out vec2 v_st;\n\n out vec3 v_light0Direction;\n\n void main(void) \n {\n vec4 pos = modelViewMatrix * vec4( position,1.0);\n v_normal = normalMatrix * normal;\n v_st = st;\n v_position = pos.xyz;\n v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);\n gl_Position = projectionMatrix * pos;\n }"},e.prototype.createDrawCommand=function(e,t,i){var n=t.context,o=new R.Cartesian3,o=(R.Matrix4.multiplyByPoint(this._matrix,e.boundingSphere.center,o),new R.BoundingSphere(o,e.boundingSphere.radius)),i=new R.DrawCommand({modelMatrix:i||this._matrix,owner:this,primitiveType:e.primitiveType,pass:R.Pass.TRANSLUCENT,boundingVolume:o}),r=this,o=R.GeometryPipeline.createAttributeLocations(e);return i.vertexArray=R.VertexArray.fromGeometry({context:n,geometry:e,attributeLocations:o,bufferUsage:R.BufferUsage.STATIC_DRAW}),i.vertexArray._attributeLocations=o,i.shaderProgram=R.ShaderProgram.replaceCache({context:n,vertexShaderSource:this.getVertexShaderSource(e),fragmentShaderSource:this.getFragmentShaderSource(e),attributeLocations:o}),i.renderState=R.RenderState.fromCache({blending:R.BlendingState.ALPHA_BLEND,depthTest:{enabled:!0,func:R.DepthFunction.LESS},cull:{enabled:!1,face:R.CullFace.BACK}}),i.uniformMap={},i.uniformMap.projectionMatrix=function(){return t.context.uniformState.projection},i.uniformMap.modelViewMatrix=function(){return t.context.uniformState.modelView},i.uniformMap.shininess=function(){return r.shininess||(r.shininess=0),r.shininess},i.uniformMap.emission=function(){return r.emission||(r.emission=new R.Cartesian3(.2,.2,.2)),r.emission},i.uniformMap.specular=function(){return r.specular||(r.specular=0),r.specular},i.uniformMap.isLine=function(){return e.primitiveType==R.PrimitiveType.LINES||e.primitiveType==R.PrimitiveType.LINE_STRIP},i.uniformMap.defaultColor=function(){return e.primitiveType==R.PrimitiveType.LINES||e.primitiveType==R.PrimitiveType.LINE_STRIP?(r.defaultLineColor||(r.defaultLineColor=new R.Color(1,1,0,1)),r.defaultLineColor):(r.defaultColor||(r.defaultColor=new R.Color(1,0,0,1)),r.defaultColor)},i.uniformMap.picked=function(){return r.picked||(r.picked=0),r.picked},i.uniformMap.pickedColor=function(){return r.pickedColor||(r.pickedColor=new R.Color(1,1,0,1)),r.pickedColor},i.uniformMap.normalMatrix=function(){return t.context.uniformState.normal},i.uniformMap.glowPower=function(){return.25},i},e.prototype.remove=function(){this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity)},e.prototype.addToScene=function(){this.viewer.scene.primitives.add(this),this.groundAreaEntity&&this.viewer.entities.add(this.groundAreaEntity)},e.prototype.destroy=function(e){e&&(this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity),this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy()}),this._drawCommands=[])},R.Scene.ConeSensorPrimitive=e},_installCounputeVertex:function(){var o=new R.Cartesian3,r=(new R.Ray,new R.Cartographic);R.Scene.computeVertexNormals=function(e){var t=e.indices,i=e.attributes,n=t.length;if(i.position){var o=i.position.values;if(void 0===i.normal)i.normal=new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(o.length)});else for(var r=i.normal.values,a=0;a<n;a++)r[a]=0;for(var s,l,c,h=i.normal.values,u=new R.Cartesian3,d=new R.Cartesian3,p=new R.Cartesian3,m=new R.Cartesian3,g=new R.Cartesian3,a=0;a<n;a+=3)s=3*t[a+0],l=3*t[a+1],c=3*t[a+2],R.Cartesian3.fromArray(o,s,u),R.Cartesian3.fromArray(o,l,d),R.Cartesian3.fromArray(o,c,p),R.Cartesian3.subtract(p,d,m),R.Cartesian3.subtract(u,d,g),R.Cartesian3.cross(m,g,m),h[s]+=m.x,h[1+s]+=m.y,h[2+s]+=m.z,h[l]+=m.x,h[1+l]+=m.y,h[2+l]+=m.z,h[c]+=m.x,h[1+c]+=m.y,h[2+c]+=m.z;for(var f,y,v,w,_=e.attributes.normal.values,C=0;C<_.length;C+=3)f=_[C],y=_[C+1],v=_[C+2],w=1/Math.sqrt(f*f+y*y+v*v),_[C]=f*w,_[C+1]=y*w,_[C+2]=v*w;i.normal.needsUpdate=!0}return e},R.Scene.extend2Earth=function(e,t,i,n){n=n||R.Ellipsoid.WGS84,R.Matrix4.multiplyByPoint(t,e,o),R.Cartesian3.subtract(o,i.origin,i.direction),R.Cartesian3.normalize(i.direction,i.direction);t=R.IntersectionTests.rayEllipsoid(i,n),n=null;if(n=t?R.Ray.getPoint(i,t.start):n)try{R.Cartographic.fromCartesian(n,null,r)}catch(e){return null}return n}}};let O={};function F(e,t){if(t){new G(e,O=t);const i=new I(t),n=new D(t),r=new z(t,i);O.Scene.RectangularSensorPrimitive=i,O.Scene.RectangularSensorGraphics=n,O.Scene.RectangularSensorVisualizer=r;var e=O.DataSourceDisplay,o=e.defaultVisualizersCallback;e.defaultVisualizersCallback=function(e,t,i){var n=i.entities;return o(e,t,i).concat([new r(e,n)])}}}let B=null;function H(e,t){e&&(this._viewer=e,B=t,this._customPluginLayer=new B.CustomDataSource("_customPluginLayer"),new F(e,t),e)&&e.dataSources.add(this._customPluginLayer)}H.prototype={createRectangularSensorGraphics:function(e){var t,i;if(this._customPluginLayer&&e)return t=new B.HeadingPitchRoll(B.Math.toRadians(e.heading||90),B.Math.toRadians(e.pitch||0),B.Math.toRadians(e.roll||0)),i=e.position,this._customPluginLayer.entities.add({position:i,orientation:B.Transforms.headingPitchRollQuaternion(i,t),rectangularSensor:new B.Scene.RectangularSensorGraphics({radius:e.radius||1e5,xHalfAngle:B.Math.toRadians(e.xHalfAngle||45),yHalfAngle:B.Math.toRadians(e.yHalfAngle||45),material:e.material||new B.Color(1,0,1,.4),lineColor:e.lineColor||new B.Color(1,0,1,1),showScanPlane:this._objHasOwnProperty(e,"showScanPlane",!0),showSectorLines:this._objHasOwnProperty(e,"showSectorLines",!0),showLateralSurfaces:this._objHasOwnProperty(e,"showLateralSurfaces",!0),modelMatrix:e.modelMatrix||new B.Matrix4,scanPlaneColor:e.scanPlaneColor||new B.Color(1,0,1,1),scanPlaneMode:e.scanPlaneMode||"vertical",scanPlaneRate:e.scanPlaneRate||3,showThroughEllipsoid:this._objHasOwnProperty(e,"showThroughEllipsoid",!1),show:this._objHasOwnProperty(e,"show",!0)})})},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e.field:i,createSatelliteCoverageSimulationGraphics:function(e){if(e)return new B.Scene.SatelliteCoverageSimulation(this._viewer,{position:e.position,angle1:e.angle1||30,angle2:e.angle2||45,areaType:e.areaType||2,rotation:{heading:B.Math.toRadians(e.heading||0),pitch:B.Math.toRadians(e.pitch||0),roll:B.Math.toRadians(e.roll||0)},color:e.color||{red:.43137254901960786,green:.9607843137254902,blue:0,alpha:.8}})},createRadarPrimitive:function(e){if(e)return new B.Scene.ConeSensorPrimitive(this._viewer,{position:e.position,angle:e.angle||80,radius:e.radius||7e5,rotation:{heading:B.Math.toRadians(e.heading||0),pitch:B.Math.toRadians(e.pitch||40),roll:B.Math.toRadians(e.roll||0)},color:e.color||{red:1,green:0,blue:0,alpha:.4},lineColor:e.lineColor||{red:1,green:1,blue:1,alpha:.9}})}};let V,W,U=null,N={},j="move",Y=null;function X(e,t){e&&(this._viewer=e,Y=e,U=t,this._installFileDragDropHandler())}X.prototype={_installFileDragDropHandler(){function i(e,t){var i=document.createElement("div");i.id="fileDragDrop",i.classList.add("filedragdrop"),i.innerHTML="请将Json文件拖拽到此区域",this._dragBox=i,this._viewer=t,(this._parentDiv=e).appendChild(i),this.fileDragDropCallBack=void 0,this.callBackParms=void 0}i.prototype.startuploadfile=function(){var i=this,e=i._dragBox,t=null;document.ondragover=function(){clearTimeout(t),t=setTimeout(function(){e.innerHTML="请将文件拖拽到此区域"},200)},e.ondragenter=function(){e.innerHTML="请释放鼠标"},e.ondragover=function(){return!1},e.ondragleave=function(){e.innerHTML="请将文件拖拽到此区域"},e.ondrop=function(e){e.preventDefault();var e=e.dataTransfer.files[0],t=new FileReader;return t.readAsText(e,"UTF-8"),t.onload=function(){var e=JSON.parse(this.result);i.fileDragDropCallBack&&i.fileDragDropCallBack(i.callBackParms,e,i._viewer)},t.onloadstart=function(){},t.onloadend=function(){},t.onabort=function(){alert("读取数据中断")},!(t.onerror=function(){alert("读取数据失败")})}},U.Scene.FileDragDropMixin=function(e){var t=new i(document.querySelector(".cesium-viewer"),e);Object.defineProperties(e,{fileDragDropMixin:{get:function(){return t}}})}},showLoadDataToScenePanel(e){if(e=e||{}){let e=new i,o=this._viewer,t=e.addFolder("加载数据文件"),n=e=>{let t=document.createElement("input");t.type="file",t.className="datgui_upload",t.onchange=function(){"function"==typeof e&&t.files.length&&e(URL.createObjectURL(t.files[0]))},document.getElementsByTagName("body")&&document.getElementsByTagName("body")[0].appendChild(t),t.click()},r={point:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.point={color:U.Color.BLUE}}o.flyTo(e)})})},polyline:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.polyline.width=5,n.polyline.material=new U.PolylineGlowMaterialProperty({glowPower:.1,color:U.Color.ORANGERED.withAlpha(.9)})}o.flyTo(e)})})},polygon:()=>{n(e=>{U.GeoJsonDataSource.load(e).then(function(e){o.dataSources.add(e);for(var t=e.entities.values,i=0;i<t.length;i++){var n=t[i];n.nameID=i,n.polygon.width=10,n.polygon.material=U.Color.BLUE.withAlpha(.9)}o.flyTo(e)})})},model:()=>{n(e=>{o.flyTo(d3kit.createModelGraphics({position:U.Cartesian3.fromDegrees(120.38105869,31.10115627),m_url:e}))})},czml:()=>{n(e=>{o.flyTo(o.dataSources.add(U.CzmlDataSource.load(e)))})},"3dtilset":()=>{n(e=>{o.flyTo(o.scene.primitives.add(new U.Cesium3DTileset({url:e})))})}};t.add(r,"point"),t.add(r,"polyline"),t.add(r,"polygon"),t.add(r,"model"),t.add(r,"czml"),t.add(r,"3dtilset"),t.open()}},showPostProcessStagesPanel(e){e=e||{};let t=null,n=new function(){this.blackAndWhiteShow=!1,this.blackAndWhiteGradations=5,this.brightnessShow=!1,this.brightnessValue=.5,this.nightVisionShow=!1,this.silhouette=!1},o=(e&&e.elementId?(t=new i({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new i,this._viewer.scene.postProcessStages),r=o.add(U.PostProcessStageLibrary.createSilhouetteStage()),a=o.add(U.PostProcessStageLibrary.createBlackAndWhiteStage()),s=o.add(U.PostProcessStageLibrary.createBrightnessStage()),l=o.add(U.PostProcessStageLibrary.createNightVisionStage());r.uniforms.color=e.silhouetteColor||U.Color.YELLOW,r.enabled=!1,a.enabled=!1,a.uniforms.gradations=5,s.enabled=!1,s.uniforms.brightness=.5,l.enabled=!1,t.add(n,"blackAndWhiteShow").name("blackAndWhiteShow").onChange(function(e){a.enabled=e}),t.add(n,"blackAndWhiteGradations",0,10,.1).name("blackAndWhiteGradations").onChange(function(e){a.uniforms.gradations=e}),t.add(n,"brightnessShow").name("brightnessShow").onChange(function(e){s.enabled=e}),t.add(n,"brightnessValue",0,10,.1).name("brightnessValue").onChange(function(e){s.uniforms.brightness=e}),t.add(n,"nightVisionShow").name("nightVisionShow").onChange(function(e){l.enabled=e}),t.add(n,"silhouette").name("silhouette").onChange(function(e){r.enabled=e})},showSceneBloomPanel(e){let t=null,n=new function(){this.contrast=128,this.brightness=-.3,this.delta=1,this.gamma=3.5,this.enabled=!1,this.highDynamicRange=!1,this.shadows=!1,this.glowOnly=!1,this.sigma=1,this.stepSize=5},o=(e&&e.elementId?(t=new i({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new i,this._viewer),r=(t.__closeButton.innerHTML="收缩面板",o.scene.postProcessStages.bloom);t.add(n,"enabled").name("bloom").onChange(function(e){r.enabled=e}),t.add(n,"glowOnly").name("发光").onChange(function(e){r.uniforms.glowOnly=e}),t.add(n,"enabled").name("启用模糊").onChange(function(e){r.enabled=e}),t.add(n,"contrast",-255,255,.01).name("对比度").onChange(function(e){r.uniforms.contrast=e}),t.add(n,"brightness",-1,1,.01).name("光泽亮度").onChange(function(e){r.uniforms.brightness=e}),t.add(n,"delta",1,5,.01).name("因子").onChange(function(e){r.uniforms.delta=e}),t.add(n,"sigma",1,10,.01).name("sigma").onChange(function(e){r.uniforms.sigma=e}),t.add(n,"stepSize",.1,10).name("stepSize").onChange(function(e){r.uniforms.stepSize=e}),t.add(n,"shadows").name("启用阴影").onChange(function(e){o.shadows=e}),t.add(n,"highDynamicRange").name("高动态范围").onChange(function(e){o.scene.highDynamicRange=e}),t.add(n,"gamma",1,10,.01).name("伽马亮度").onChange(function(e){o.scene.gamma=e})},showPrimitiveMatrixPanel(t){let n=t.primitives._delegate||t.primitives,o=t.primitives,e=(this._viewer,null);t&&t.elementId?(e=new i({autoPlace:!1}),document.getElementById(t.elementId).appendChild(e.domElement)):e=new i;var r=e.addFolder("离地高度"),r=(r.add({height:100},"height",0,1e3,1).onChange(function(e){var t=o.boundingSphere,t=U.Cartographic.fromCartesian(t.center),i=U.Cartesian3.fromRadians(t.longitude,t.latitude,0),t=U.Cartesian3.fromRadians(t.longitude,t.latitude,e),e=U.Cartesian3.subtract(t,i,new U.Cartesian3);o.modelMatrix=U.Matrix4.fromTranslation(e)}),r.open(),e.addFolder("缩放大小")),a={"m+Scale":()=>{n.readyPromise.then(e=>{var t=e.root.transform;U.Matrix4.multiplyByUniformScale(t,1.2,t),e.root.transform=t})},"m-Scale":()=>{n.readyPromise.then(e=>{var t=e.root.transform;U.Matrix4.multiplyByUniformScale(t,.8,t),e.root.transform=t})}},a=(r.add(a,"m+Scale"),r.add(a,"m-Scale"),r.open(),{"x+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(20,0,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"x-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(-20,0,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"y+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,20,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"y-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,-20,0));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"z+Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,0,20));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)},"z-Axis":()=>{var e=U.Matrix4.fromTranslation(new U.Cartesian3(0,0,-20));U.Matrix4.multiply(n.modelMatrix,e,n.modelMatrix)}}),r=e.addFolder("矩阵平移");r.add(a,"x+Axis"),r.add(a,"x-Axis"),r.add(a,"y+Axis"),r.add(a,"y-Axis"),r.add(a,"z+Axis"),r.add(a,"z-Axis"),r.open();let s={x:0,y:0,z:0},l={"x+Axis":()=>{s.x+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationX(U.Math.toRadians(s.x)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"x-Axis":()=>{s.x-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationX(U.Math.toRadians(s.x)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"y+Axis":()=>{s.y+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationY(U.Math.toRadians(s.y)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"y-Axis":()=>{s.y-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationY(U.Math.toRadians(s.y)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"z+Axis":()=>{s.z+=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationZ(U.Math.toRadians(s.z)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})},"z-Axis":()=>{s.z-=15,n.readyPromise.then(e=>{var t=U.Matrix3.fromRotationZ(U.Math.toRadians(s.z)),t=U.Matrix4.fromRotationTranslation(t),i=U.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);U.Matrix4.multiply(i,t,i),e._root.transform=i})}},c=e.addFolder("旋转矩阵");c.add(l,"x+Axis"),c.add(l,"x-Axis"),c.add(l,"y+Axis"),c.add(l,"y-Axis"),c.add(l,"z+Axis"),c.add(l,"z-Axis"),c.open(),t.cb&&((a=e.addFolder("获取调整后的模型矩阵")).add({getModelMaterix:()=>{n.readyPromise.then(e=>{e=e.root.transform;t.cb({modelTransformMatrix:U.Matrix4.toArray(e),modelMatrix:U.Matrix4.toArray(o.modelMatrix)})})}},"getModelMaterix").name("获取模型矩阵"),a.open()),e.__closeButton.innerHTML="收缩面板"},showLayerParamPanel:function(t,n){if(t){let e=null;n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i;var n=new function(){this.alpha=t.alpha,this.brightness=t.brightness,this.contrast=t.contrast,this.gamma=t.gamma,this.hue=t.hue,this.dayAlpha=t.dayAlpha,this.nightAlpha=t.nightAlpha,this.saturation=t.saturation},o=e.addFolder("图层调整");o.add(n,"alpha",0,1,.05).name("透明度").onChange(function(e){t.alpha=e}),o.add(n,"brightness",0,5,.05).name("亮度").onChange(function(e){t.brightness=e}),o.add(n,"contrast",0,5,.05).name("对比").onChange(function(e){t.contrast=e}),o.add(n,"gamma",0,5,.05).name("伽马").onChange(function(e){t.gamma=e}),o.add(n,"hue",0,5,.05).name("色调").onChange(function(e){t.hue=e}),o.add(n,"dayAlpha",0,1,.05).name("白天透明").onChange(function(e){t.dayAlpha=e}),o.add(n,"nightAlpha",0,1,.05).name("夜晚透明").onChange(function(e){t.nightAlpha=e}),o.add(n,"saturation",0,5,.05).name("饱和").onChange(function(e){t.saturation=e}),o.open()}},showLayerSwitchPanel:function(t,n,o){if(t&&t.length){let e=null;n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i;var r=new function(){t.forEach(e=>{this[e.id]=e.show})},a=e.addFolder("图层切换"),s=(t.forEach(t=>{a.add(r,t.id).name(t.name).onChange(function(e){t.show=e,o&&o({key:t.id,val:e})})}),new function(){t.forEach(e=>{this[e.id]=e.alpha})}),l=e.addFolder("透明度");t.forEach(t=>{l.add(s,t.id,0,1,.05).name(t.name).onChange(function(e){t.alpha=e})}),a.open(),l.open()}},showSceneEffectEditPanel:function(e){var t,n,o;e=e||{},i&&this._viewer.scene.colorCorrection&&(o=new i,(t=this._viewer).scene.lightSource.ambientLightColor=e.ambientLightColor||new U.Color(.3,.3,.3,1),t.scene.colorCorrection.show=e.colorCorrection||!1,t.scene.colorCorrection.saturation=e.saturation||3.1,t.scene.colorCorrection.brightness=e.brightness||1.8,t.scene.colorCorrection.contrast=e.contrast||1.2,t.scene.colorCorrection.hue=e.hue||0,t.scene.bloomEffect.show=e.bloomEffect||!1,t.scene.hdrEnabled=e.hdrEnabled||!0,t.scene.bloomEffect.threshold=e.threshold||1,t.scene.bloomEffect.bloomIntensity=e.bloomIntensity||2,n=new function(){this.bloomEffectShow=e.bloomEffect||!1,this.bloomThreshold=e.threshold||1,this.bloomIntensity=e.bloomIntensity||2,this.ambientLightColor=e.ambientLightColor||.3,this.hdrEnabled=e.hdrEnabled||!0,this.colorCorrectionShow=!1,this.colorCorrectionSaturation=e.saturation||3.1,this.colorCorrectionBrightness=e.brightness||1.8,this.colorCorrectionContrast=e.contrast||1.2,this.colorCorrectionHue=e.hue||0},(o=o.addFolder("场景效果")).add(n,"bloomEffectShow").name("泛光开关").onChange(function(e){t.scene.bloomEffect.show=e,t.scene.bloomEffect.threshold=n.bloomThreshold,t.scene.bloomEffect.bloomIntensity=n.bloomIntensity}),o.add(n,"bloomThreshold",0,1,.1).name("泛光阈值").onChange(function(e){t.scene.bloomEffect.threshold=e}),o.add(n,"bloomIntensity",0,10,.1).name("泛光强度").onChange(function(e){t.scene.bloomEffect.bloomIntensity=e}),o.add(n,"hdrEnabled").name("HDR开关").onChange(function(e){t.scene.hdrEnabled=e}),o.add(n,"colorCorrectionShow").name("颜色校正").onChange(function(e){t.scene.colorCorrection.show=e}),o.add(n,"colorCorrectionSaturation",0,5,.1).name("饱和度").onChange(function(e){t.scene.colorCorrection.saturation=e}),o.add(n,"colorCorrectionBrightness",0,5,.1).name("亮度").onChange(function(e){t.scene.colorCorrection.brightness=e}),o.add(n,"colorCorrectionContrast",0,5,.1).name("对比度").onChange(function(e){t.scene.colorCorrection.contrast=e}),o.add(n,"colorCorrectionHue",0,5,.1).name("色调").onChange(function(e){t.scene.hdrEnabled=e}),o.add(n,"colorCorrectionHue",0,1,.1).name("环境光").onChange(function(e){t.scene.lightSource.ambientLightColor=new U.Color(e,e,e,1)}),o.open())},showEntityOrientationEditPanel:function(n={}){if(n.entity){let t=n.entity;var e=new i,o=(n&&n.elementId?(e=new i({autoPlace:!1}),document.getElementById(n.elementId).appendChild(e.domElement)):e=new i,new function(){this.heading=360,this.pitch=1,this.roll=1}),e=e.addFolder("实体姿态调整"),r=this;e.add(o,"heading",0,360,1).name("角度").onChange(function(e){o.heading=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.add(o,"pitch",0,360,1).name("航向").onChange(function(e){o.pitch=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.add(o,"roll",0,360,1).name("翻转").onChange(function(e){o.roll=e;e=U.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new U.HeadingPitchRoll(U.Math.toRadians(o.heading),U.Math.toRadians(o.pitch),U.Math.toRadians(o.roll)));t.orientation=e,n.cb&&n.cb({orientation:e})}),e.open()}},definedMouseEvent({targetEntity:e,ctrlFlag:t}){W=e,N=t,this.bindHandelEvent({leftDown:this.defLeftDown,mouseMove:this.defMouseMove,mouseWheel:this.defMouseWheel,leftUp:this.defLeftUp})},defMouseMove(t){if(N.leftDown&&V){let e=Y.camera.getPickRay(t.endPosition),o=Y.scene.globe.pick(e,Y.scene);if(document.body.style.cursor="pointer",V&&V.id&&"move"===j){let e=U.JulianDate.fromDate(new Date),t=W.position.getValue(e),i=U.Cartographic.fromCartesian(t),n=Number(i.height.toFixed(3));W.position=new U.CallbackProperty(()=>{var e=Y.scene.globe.ellipsoid.cartesianToCartographic(o),t=U.Math.toDegrees(e.longitude),e=U.Math.toDegrees(e.latitude);return U.Cartesian3.fromDegrees(t,e,n)},!1)}else{var i,n,r;V&&V.id&&"rotate"===j&&(n=U.JulianDate.fromDate(new Date),n=W.position.getValue(n),r=Y.scene.camera.pickEllipsoid(t.startPosition),t=Y.scene.camera.pickEllipsoid(t.endPosition),i=U.Cartesian3.subtract(n,t,new U.Cartesian3),i=U.Cartesian3.normalize(i,new U.Cartesian3),r=U.Cartesian3.subtract(r,n,new U.Cartesian3),t=U.Cartesian3.subtract(t,n,new U.Cartesian3),n=U.Cartesian3.angleBetween(r,t),r=U.Quaternion.fromAxisAngle(i,100*n),W.orientation=r)}}},defLeftDown(e){V=Y.scene.pick(e.position),U.defined(V)&&j?(N.selected=!0,N.leftDown=!0):N.selected=!1},defMouseWheel(n){if(V&&V.id&&"scale"===j){let e=U.JulianDate.fromDate(new Date),t=W.box.dimensions.getValue(e),i=0<n?2:.5;W.box.dimensions=new U.CallbackProperty(()=>U.Cartesian3.multiplyByScalar(t,i,new U.Cartesian3),!1)}},defLeftUp(e){N.leftDown=!1,document.body.style.cursor="default"},manualMoveModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableRotate=!1,this._viewer.scene.screenSpaceCameraController.enableZoom=!0},manualRotateModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableRotate=!1,this._viewer.scene.screenSpaceCameraController.enableZoom=!0},manualScaleModel:function(e){j=e,this._viewer.scene.screenSpaceCameraController.enableZoom=!1}};let q=null;var Z=3.141592653589793,J=6378245,Q=.006693421622965943;function K(e,t,i){e&&(this._viewer=e,q=t,this._queryRouteKey="8dc49b1fa65a79d306ef12dae4229842",this._pluginLayer=new q.CustomDataSource("pluginLayer"),e&&e.dataSources.add(this._pluginLayer),this._installPlugin())}K.routeQueryType={DRIVE:"drive",WALK:"walk",CYCLE:"cycle"},K.prototype={_installPlugin:function(){this._installCss3Renderer(),this._installTerrainClipPlan()},_installTerrainClipPlan:function(){function e(e,t){this.viewer=e,this.options=t||{},this._positions=t.positions,this._height=this.options.height||0,this.bottomImg=t.bottomImg,this.wallImg=t.wallImg,this.splitNum=q.defaultValue(t.splitNum,50),this._positions&&0<this._positions.length&&this.updateData(this._positions)}Object.defineProperties(e.prototype,{show:{get:function(){return this._show},set:function(e){this._show=e,this.viewer.scene.globe.clippingPlanes&&(this.viewer.scene.globe.clippingPlanes.enabled=e),this._switchExcavate(e)}},height:{get:function(){return this._height},set:function(e){this._height=e,this._updateExcavateDepth(e)}}}),e.prototype.updateData=function(e){var t=[],i=e.length-1,n=new q.Cartesian3,o=0<q.Cartesian3.subtract(e[0],e[1],n).x;this.excavateMinHeight=9999;for(var r=0;r<i;r++){var a=(r+1)%i,s=q.Cartesian3.midpoint(e[r],e[a],new q.Cartesian3),l=q.Cartographic.fromCartesian(e[r]),l=this.viewer.scene.globe.getHeight(l)||l.height;l<this.excavateMinHeight&&(this.excavateMinHeight=l);l=q.Cartesian3.normalize(s,new q.Cartesian3),a=o?q.Cartesian3.subtract(e[r],s,new q.Cartesian3):q.Cartesian3.subtract(e[a],s,new q.Cartesian3),a=(a=q.Cartesian3.normalize(a,a),q.Cartesian3.cross(a,l,new q.Cartesian3)),a=q.Cartesian3.normalize(a,a),l=new q.Plane(a,0),l=q.Plane.getPointDistance(l,s);t.push(new q.ClippingPlane(a,l))}this.viewer.scene.globe.clippingPlanes=new q.ClippingPlaneCollection({planes:t,edgeWidth:1,edgeColor:q.Color.WHITE,enabled:!0}),this._prepareWell(e),this._createWell(this.wellData)},e.prototype.clear=function(){this.viewer.scene.globe.clippingPlanes&&(this.viewer.scene.globe.clippingPlanes.enabled=!1,this.viewer.scene.globe.clippingPlanes.removeAll(),this.viewer.scene.globe.clippingPlanes.isDestroyed()||this.viewer.scene.globe.clippingPlanes.destroy()),this.viewer.scene.globe.clippingPlanes=void 0,this.bottomSurface&&this.viewer.scene.primitives.remove(this.bottomSurface),this.wellWall&&this.viewer.scene.primitives.remove(this.wellWall),delete this.bottomSurface,delete this.wellWall,this.viewer.scene.render()},e.prototype._prepareWell=function(e){var t=this.splitNum,i=e.length;if(0!=i){for(var n=this.excavateMinHeight-this.height,o=[],r=[],a=[],s=0;s<i;s++){var l=s==i-1?0:s+1,c=q.Cartographic.fromCartesian(e[s]),l=q.Cartographic.fromCartesian(e[l]),h=[c.longitude,c.latitude],u=[l.longitude,l.latitude];0==s&&(a.push(new q.Cartographic(h[0],h[1])),r.push(q.Cartesian3.fromRadians(h[0],h[1],n)),o.push(q.Cartesian3.fromRadians(h[0],h[1],0)));for(var d=1;d<=t;d++){var p=q.Math.lerp(h[0],u[0],d/t),m=q.Math.lerp(h[1],u[1],d/t);s==i-1&&d==t||(a.push(new q.Cartographic(p,m)),r.push(q.Cartesian3.fromRadians(p,m,n)),o.push(q.Cartesian3.fromRadians(p,m,0)))}}this.wellData={lerp_pos:a,bottom_pos:r,no_height_top:o}}},e.prototype._createWell=function(r){var a;this.viewer.terrainProvider._layers?((a=this)._createBottomSurface(r.bottom_pos),q.sampleTerrainMostDetailed(this.viewer.terrainProvider,r.lerp_pos).then(function(e){for(var t=e.length,i=[],n=0;n<t;n++){var o=q.Cartesian3.fromRadians(e[n].longitude,e[n].latitude,e[n].height);i.push(o)}a._createWellWall(r.bottom_pos,i)})):(this._createBottomSurface(r.bottom_pos),this._createWellWall(r.bottom_pos,r.no_height_top))},e.prototype._getMinHeight=function(t){let i=5e6,n=null;for(let e=0;e<t.length;e++){var o=t[e].z;o<i&&(i=o,n=this._ellipsoidToLonLat(t[e]))}return n.altitude},e.prototype._ellipsoidToLonLat=function(e){var t=this.viewer.scene.globe.ellipsoid,e=new q.Cartesian3(e.x,e.y,e.z),t=t.cartesianToCartographic(e),e=q.Math.toDegrees(t.latitude);return{longitude:q.Math.toDegrees(t.longitude),latitude:e,altitude:t.height}},e.prototype._createBottomSurface=function(t){if(t.length){var i=this._getMinHeight(t),n=[];for(let e=0;e<t.length;e++){var o=this._ellipsoidToLonLat(t[e]);n.push(o.longitude),n.push(o.latitude),n.push(i)}var e=new q.PolygonGeometry({polygonHierarchy:new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights(n)),perPositionHeight:!0}),e=q.PolygonGeometry.createGeometry(e),r=new q.Material({fabric:{type:"Image",uniforms:{image:this.bottomImg}}}),r=new q.MaterialAppearance({translucent:!1,flat:!0,material:r});this.bottomSurface=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e}),appearance:r,asynchronous:!1}),this.viewer.scene.primitives.add(this.bottomSurface)}},e.prototype._createWellWall=function(e,t){var i=this._getMinHeight(e),n=[],o=[];for(let e=0;e<t.length;e++)n.push(this._ellipsoidToLonLat(t[e]).altitude),o.push(i);var e=new q.WallGeometry({positions:t,maximumHeights:n,minimumHeights:o}),e=q.WallGeometry.createGeometry(e),r=new q.Material({fabric:{type:"Image",uniforms:{image:this.wallImg}}}),r=new q.MaterialAppearance({translucent:!1,flat:!0,material:r});this.wellWall=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e,attributes:{color:q.ColorGeometryInstanceAttribute.fromColor(q.Color.GREY)},id:"PitWall"}),appearance:r,asynchronous:!1}),this.viewer.scene.primitives.add(this.wellWall)},e.prototype._switchExcavate=function(e){e?(this.viewer.scene.globe.material=q.Material.fromType("WaJue"),this.wellWall.show=!0,this.bottomSurface.show=!0):(this.viewer.scene.globe.material=null,this.wellWall.show=!1,this.bottomSurface.show=!1)},e.prototype._updateExcavateDepth=function(e){this.bottomSurface&&this.viewer.scene.primitives.remove(this.bottomSurface),this.wellWall&&this.viewer.scene.primitives.remove(this.wellWall);for(var t=this.wellData.lerp_pos,i=[],n=t.length,o=0;o<n;o++)i.push(q.Cartesian3.fromRadians(t[o].longitude,t[o].latitude,this.excavateMinHeight-e));this.wellData.bottom_pos=i,this._createWell(this.wellData),this.viewer.scene.primitives.add(this.bottomSurface),this.viewer.scene.primitives.add(this.wellWall)},q.Scene.TerrainClipPlan=e},buildLightScanGraphics:function(e){if(this._viewer&&e){function t(t,e,i){var n,o,r,a,s,l,c=t.positionList,h=0,u=0;function d(e){n=c[e+1][0]-c[e][0],o=c[e+1][1]-c[e][1],r=n/t.number,a=o/t.number,u=0}d(h),e.polygon.hierarchy=new q.CallbackProperty(function(){return Math.abs(s)>=Math.abs(n)&&Math.abs(l)>=Math.abs(o)&&((h+=1)===c.length-1&&(h=0),i[0]=i[0]+s,i[1]=i[1]+l,i[2]=i[2]+s,i[3]=i[3]+l,d(h)),s=u*r,l=u*a,u++,new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([t.observer[0],t.observer[1],t.observer[2],i[0]+s,i[1]+l,0,i[2]+s,i[3]+l,0]))},!1)}for(var l=this,i=l._getCirclePoints(e.circle[0],e.circle[1],e.circle[2],e.circle[3]),n=function(e,t){for(var i=t.observer[0],n=t.observer[1],o=t.observer[2],r=[],a=0;a<e.length;a++){var s=a===e.length-1?new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,o,e[a].x,e[a].y,0,e[0].x,e[0].y,0])):new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,o,e[a].x,e[a].y,0,e[a+1].x,e[a+1].y,0])),s=l._pluginLayer.entities.add({name:"三角形",polygon:{hierarchy:s,outline:!1,perPositionHeight:!0,material:t.material}});r.push(s)}return r}(i,e),o=0;o<n.length;o++)o!==n.length-1?t(e,n[o],[i[o].x,i[o].y,i[o+1].x,i[o+1].y]):t(e,n[o],[i[o].x,i[o].y,i[0].x,i[0].y]);return n}},buildPathRoaming:function(e){if(this._viewer&&e&&e.paths){for(var t=e.paths,i=this.createGraphics(),n=[],o=0;o<t.length;o++){var r=q.Cartesian3.fromDegrees(Number(t[o].lng),Number(t[o].lat),Number(t[o].alt));n.push(r)}if(i.position=this._createSampledPosition(n),i.name=e.name||"路径漫游",i.availability=new q.TimeIntervalCollection([new q.TimeInterval({start:this.startTime,stop:this.stopTime})]),i.orientation=this._sampleOrientation(),e.polyline){const{width:t,material:o,clampToGround:r,...a}=e.polyline;i.polyline={positions:new q.CallbackProperty(function(){return n},!1),width:t||10,material:o||new q.PolylineGlowMaterialProperty({glowPower:1,color:q.Color.RED}),clampToGround:r||!0,resOpt:a}}return e.model&&(i.model=this.getModelGraphics(e.model)),e.label&&(i.label=this.getLabelGraphics(e)),e.billboard&&(i.billboard=this.getBillboardGraphics(e)),this.droneEntity=i,this._beginRoamTrace(e),this._viewer.entities.add(i)}},_beginRoamTrace(i){this._viewer.clock.onTick.addEventListener(()=>{var e,t;this._viewer.clock.shouldAnimate&&(t=this._viewer.clock.currentTime,e=this.droneEntity.position.getValue(t),t=this.droneEntity.orientation.getValue(t),e)&&t&&(t=q.Matrix4.fromRotationTranslation(q.Matrix3.fromQuaternion(t),e),this._viewer.camera.lookAtTransform(t,i.cameraOffset()))})},_createSampledPosition(t){this.startTime=q.JulianDate.now(),this.stopTime=q.JulianDate.addSeconds(this.startTime,60*t.length,new q.JulianDate),this._viewer.clock.startTime=this.startTime.clone(),this._viewer.clock.stopTime=this.stopTime.clone(),this._viewer.clock.currentTime=this.startTime.clone(),this._viewer.clock.clockRange=q.ClockRange.CLAMPED;var i=new q.SampledPositionProperty;for(let e=0;e<t.length;e++){var n=q.JulianDate.addSeconds(this.startTime,60*e,new q.JulianDate),o=t[e];i.addSample(n,o)}return i},_sampleOrientation(){let o,r,a;return new q.CallbackProperty(e=>{var t=this.droneEntity.position.getValue(e);if(r=this.droneEntity.position.getValue(q.JulianDate.addSeconds(e,1/60,new q.JulianDate)),t&&r){o=t;const e=q.Cartesian3.subtract(r,o,new q.Cartesian3),i=q.Cartesian3.normalize(e,new q.Cartesian3),n=q.Transforms.rotationMatrixFromPositionVelocity(o,i,q.Ellipsoid.WGS84);a=q.Quaternion.fromRotationMatrix(n)}return a},!1)},_installCss3Renderer:function(){function e(e,t){this._scratch=new q.Cartesian2,this._viewer=i,this._scene=i.scene,this._camera=i.camera,this._container=null,this._elements=e,this._isBackHide=t,this.init()}var i;this._viewer&&(i=this._viewer,e.prototype.init=function(){var o=document.createElement("div"),r=(o.className="ys-css3-container",document.getElementById("info-warp").appendChild(o),this._container=o,this._elements.forEach(function(e){o.insertAdjacentHTML("beforeend",e.element)}),this);this._scene.preRender.addEventListener(function(){for(var e=0;e<o.children.length;e++){var t,i=q.Cartesian3.fromDegrees(r._elements[e].position[0],r._elements[e].position[1],r._elements[e].position[2]||0),n=r._scene.cartesianToCanvasCoordinates(i,r._scratch);q.defined(n)&&(o.children[e].style.left=parseFloat(n.x)+parseFloat(r._elements[e].offset[0])+"px",o.children[e].style.top=parseFloat(n.y)+parseFloat(r._elements[e].offset[1])+"px",r._isBackHide)&&(n=r._camera.position,t=r._scene.globe.ellipsoid.cartesianToCartographic(n).height,t+=+r._scene.globe.ellipsoid.maximumRadius,q.Cartesian3.distance(n,i)>t?o.children[e].style.display="none":o.children[e].style.display="block")}})},e.prototype.remove=function(e){this._elements=this._elements.filter(function(e){e.id}),this._container.removeChild(document.getElementById(e))},e.prototype.append=function(e){this._elements.push(e),this._container.insertAdjacentHTML("beforeend",e.element)},e.prototype.removeEntityLayer=function(e){this._viewer.entities.removeById(e+"_1"),this._viewer.entities.removeById(e+"_2"),this._viewer.entities.removeById(e+"_3"),this.remove(e)},e.prototype.addEntityLayer=function(e){var t=e.position[0],i=e.position[1],n=this,o=(setTimeout(function(e){},300),q.Math.toRadians(30)),r=q.Math.toRadians(30),a=e.boxHeight||300,s=e.boxHeightMax||400,l=e.boxHeightDif||10,c=!0;e.boxShow?this._viewer.entities.add({id:e.id+"_1",name:"立方体盒子",position:new q.CallbackProperty(function(){return(a+=l)>=s&&(a=s),q.Cartesian3.fromDegrees(t,i,a/2)},!1),box:{dimensions:new q.CallbackProperty(function(){return(a+=l)>=s&&(a=s,c)&&(c=!1,n.append(e,!0)),new q.Cartesian3(e.boxSide||100,e.boxSide||100,a)},!1),material:e.boxMaterial||q.Color.DEEPSKYBLUE.withAlpha(.5)}}):setTimeout(function(){n.append(e,!0)},100),e.circleShow&&(e.circleSize=e.circleSize||120,this._viewer.entities.add({id:e.id+"_2",name:"椭圆",position:q.Cartesian3.fromDegrees(t,i),ellipse:{semiMinorAxis:new q.CallbackProperty(function(){return.001},!1),semiMajorAxis:new q.CallbackProperty(function(){return.001},!1),material:this.getDfSt(["plugin","Css3Renderer_one"])||"static/data/images/Textures/circle2.png",rotation:new q.CallbackProperty(function(){return o+=.05},!1),stRotation:new q.CallbackProperty(function(){return o+=.05},!1),zIndex:2}}),this._viewer.entities.add({id:e.id+"_3",name:"椭圆",position:q.Cartesian3.fromDegrees(t,i),ellipse:{semiMinorAxis:new q.CallbackProperty(function(){return.001},!1),semiMajorAxis:new q.CallbackProperty(function(){return.001},!1),material:this.getDfSt(["plugin","Css3Renderer_two"])||"static/data/images/Textures/circle1.png",rotation:new q.CallbackProperty(function(){return r-=.03},!1),stRotation:new q.CallbackProperty(function(){return r-=.03},!1),zIndex:3}}))},q.Scene.Css3Renderer=e)},transformJD(e,t){t=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return(t+=2*(20*Math.sin(6*e*Z)+20*Math.sin(2*e*Z))/3)+2*(20*Math.sin(e*Z)+40*Math.sin(e/3*Z))/3+2*(150*Math.sin(e/12*Z)+300*Math.sin(e/30*Z))/3},transformWD(e,t){var 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*Z)+20*Math.sin(2*e*Z))/3)+2*(20*Math.sin(t*Z)+40*Math.sin(t/3*Z))/3+2*(160*Math.sin(t/12*Z)+320*Math.sin(t*Z/30))/3},gcj2wgs(e){var t=Number(e[0]),e=Number(e[1]),i=this.transformWD(t-105,e-35),n=this.transformJD(t-105,e-35),o=e/180*Z,r=Math.sin(o),r=1-Q*r*r,a=Math.sqrt(r),i=180*i/(J*(1-Q)/(r*a)*Z),r=2*t-(t+180*n/(J/a*Math.cos(o)*Z)),t=2*e-(e+i);return[r=Number(r.toFixed(6)),t=Number(t.toFixed(6))]},wgs2gcj(e){var t=Number(e[0]),e=Number(e[1]),i=this.transformWD(t-105,e-35),n=this.transformJD(t-105,e-35),o=e/180*Z,r=Math.sin(o),r=1-Q*r*r,a=Math.sqrt(r),e=e+180*i/(J*(1-Q)/(r*a)*Z),i=t+180*n/(J/a*Math.cos(o)*Z);return[i=Number(i.toFixed(6)),e=Number(e.toFixed(6))]},transformData(s,l,e){for(var c=this,h=e.paths,u=[],t=0;t<h.length;t++)!function(e){for(var t=h[e],i=[],n=[],e=t.distance,o=0;o<t.steps.length;o++){var r=t.steps[o],a=t.steps[o].instruction;r.polyline.split(";").forEach(function(e){e=e.split(","),e=c.gcj2wgs(e),i.push([e[0],e[1]])}),n.push(a)}i.unshift(s),i.push(l),u.push({lnglats:i,instructions:n,distance:e})}(t);return u},_queryDrivingRoute(e,i,n,o){if((i=i||{}).origin)if(i.destination){var r=i.key||this._queryRouteKey,a=(delete i.key,i.origin),s=(s=this.wgs2gcj(a))[0]+","+s[1],l=(delete i.origin,i.destination),c=(c=this.wgs2gcj(l))[0]+","+c[1],h=(delete i.destination,"");if(i.avoidpolygons)for(var u=0;u<i.avoidpolygons.length;u++){for(var d=i.avoidpolygons[u],p="",m="",g=0;g<d.length;g++){var f=d[g];m+=(f=this.wgs2gcj(f))[0]+","+f[1]+",",0==g&&(p=f[0]+","+f[1])}m+=p,u==i.avoidpolygons.length-1?h+=m:h+=m+"|"}delete i.avoidpolygons;var y={key:r,origin:s,destination:c,strategy:0,avoidpolygons:h,show_fields:"polyline"},y=Object.assign(y,i||{}),v=this;let t="";Object.keys(y).map(e=>{t+=t?`&${e}=`+y[e]:`?${e}=`+y[e]}),fetch(e+t).then(function(e){return e.json()}).then(function(e){"1"!=e.status||"10000"!=e.infocode?(console.log("查询失败!"),o&&o(e)):(e=v.transformData(a,l,e.route),n&&n(e))})}else alert("缺少终点坐标!");else alert("缺少起点坐标!")},queryPathPlan(e,t,i,n){let o;e===K.routeQueryType.DRIVE?(o=t.url||"https://restapi.amap.com/v5/direction/driving",delete t.url,this._queryDrivingRoute(o,t,i,n)):e===K.routeQueryType.WALK?(o=t.url||"https://restapi.amap.com/v3/direction/walking",delete t.url,this._queryWalkCycleRoute(o,t,i,n)):e===K.routeQueryType.CYCLE?(o=t.url||"https://restapi.amap.com/v5/direction/bicycling",delete t.url,this._queryWalkCycleRoute(o,t,i,n)):alert("查询参数type 错误(walk:步行,cycle:骑行)!")},_queryWalkCycleRoute(e,i,n,o){if((i=i||{}).origin)if(i.destination){var r,a=i.key||this._queryRouteKey,s=(delete i.key,i.origin),l=(this.wgs2gcj(s),s[0]+","+s[1]),c=(delete i.origin,i.destination),h=(this.wgs2gcj(c),c[0]+","+c[1]),u=(delete i.destination,{key:a,origin:l,destination:h,show_fields:"polyline"}),u=Object.assign(u,i||{}),d=this;let t="";Object.keys(u).map(e=>{t+=t?`&${e}=`+u[e]:`?${e}=`+u[e]}),fetch(e+t).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("errcode")?0!=e.errcode||"OK"!=e.errmsg?(console.log("查询失败!",e.errdetail),o&&o(e)):(r=d.transformData(s,c,e.data),n&&n(r)):e.hasOwnProperty("status")?"1"!=e.status||"10000"!=e.infocode?(console.log("查询失败!",e.info),o&&o(e)):(r=d.transformData(s,c,e.route),n&&n(r)):(console.log("查询失败,未知错误!"),o&&o(e))})}else alert("缺少终点坐标!");else alert("缺少起点坐标!")}};let $=null;function ee(e,t,i){e&&($=t,this._analysisLayer=new $.CustomDataSource("analysisLayer"),f.prototype={...f.prototype,...p.prototype},s.prototype={...s.prototype,...p.prototype},this.$math3d=new f(e,t),this.$graphics=new s(e,t),e)&&e.dataSources.add(this._analysisLayer)}function te(e){if(e&&e.positions){var t=e.positions,i=e.that,n=[],e=[],o=[],r=i.transformWGS84ToCartesian(t[0]),t=i.transformWGS84ToCartesian(t[1]),n=i.$graphics.createPointsGraphics({point:!0,positions:[r,t]}),a=i.$math3d.getIntersectObj(r,t,n,!0);if(0===a.length)return alert("没有取到相交点 , 请检查是否开启深度检测。"),!1;for(let e=a.length-1;0<=e;e--){const l=a[e];$.defined(l.position)||a.splice(e,1)}if(!$.defined(a[0].position))throw new $.DeveloperError("position is undefined");var s=a[0].position,l=$.Cartesian3.distance(s,t)<5,s=[r,a[0].position],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:$.ArcType.NONE,material:new $.PolylineArrowMaterialProperty($.Color.GREEN)}});e.push(s),l||(s=[a[0].position,t],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:$.ArcType.NONE,material:new $.PolylineArrowMaterialProperty($.Color.RED)}}),e.push(s));for(let e=0;e<a.length;++e){var c,h=a[e].object;h&&(h instanceof $.Cesium3DTileFeature?(o.push(h),h.oldColor=h.color.clone(),h.color=$.Color.fromAlpha($.Color.YELLOW,h.color.alpha)):h.id instanceof $.Entity&&(c=(h=h.id).polygon||h.polyline,o.push(h),h=c.material.color.getValue(),c.oldColor=h.clone(),c.material=$.Color.fromAlpha($.Color.YELLOW,h.alpha))),n.push(i._analysisLayer.entities.add({position:a[e].position,ellipsoid:{radii:new $.Cartesian3(.8,.8,.8),material:$.Color.RED}}))}var s=$.Cartographic.fromCartesian(r),e=$.Cartographic.fromCartesian(t),s={longitude:s.longitude/Math.PI*180,latitude:s.latitude/Math.PI*180,height:s.height},e={longitude:e.longitude/Math.PI*180,latitude:e.latitude/Math.PI*180,height:e.height},r=Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2)+Math.pow(r.z-t.z,2)),t=Math.abs(e.height-s.height),u=Math.sqrt(Math.pow(r,2)+Math.pow(t,2)),l=l?"是":"否",s="起点坐标: ("+s.longitude.toFixed(6)+"°,"+s.latitude.toFixed(6)+"°,"+s.height.toFixed(2)+")\n终点坐标: ("+e.longitude.toFixed(6)+"°,"+e.latitude.toFixed(6)+"°,"+e.height.toFixed(2)+")\n垂直距离: "+t.toFixed(2)+"m\n水平距离: "+r.toFixed(2)+"m\n空间距离: "+u.toFixed(2)+"m\n是否可视: "+l;n&&n[0]&&(n[0].label={text:s,showBackground:!0,font:"14px monospace",fillColor:$.Color.YELLOW,pixelOffset:{x:0,y:-20},verticalOrigin:$.VerticalOrigin.BOTTOM,horizontalOrigin:$.HorizontalOrigin.LEFT})}te.prototype.remove=function(){}}function ie(e){if(!e&&!e.center&&!e.radius&&e.that)return alert("没有获取到分析参数"),!1;var l=e.that,t=this;if(!l._viewer.scene.globe.depthTestAgainstTerrain)return alert("请开启深度检测"),!1;var c=e.viewHeight||10,i=$.Cartographic.fromCartesian(e.center);try{var n=e.radius,o={},r=(o.semiMinorAxis=n,o.semiMajorAxis=n,o.rotation=0,o.center=e.center,o.granularity=Math.PI/30,l.computeEllipseEdgePositions(o));for(let e=0;e<r.outerPositions.length;e+=3){var a=new $.Cartesian3(r.outerPositions[e],r.outerPositions[e+1],r.outerPositions[e+2]),s=$.Cartographic.fromCartesian(a),h=5e-4*Math.PI/180,u=l.computeInterpolateLineCartographic(i,s,h);l.computeCartographicPointsTerrainData(u,function(r){if(0<r.length){let i=!0,n=[],o=[];for(let e=1;e<r.length;e++){let t=!0;if(1<e){var a=new $.Cartographic(r[0].longitude,r[0].latitude,r[0].height+c);if(i)t=l.computeInterpolateIndexLineHeightCartographic(a,r[e],e,e-1).height>=r[e-1].height?i=!0:i=!1;else{var s=l.computeInterpolateIndexLineHeightCartographic(a,r[e],e,e-1);for(let e=0;e<s.length;e++){if(!(s[e].height>=r[e].height)){i=!1,t=!1;break}i=!0,t=!0}}}a=$.Cartesian3.fromRadians(r[e].longitude,r[e].latitude,r[e].height+1);n.push(a),t?(o.push(0),o.push(0),o.push(1)):(o.push(1),o.push(0),o.push(0)),o.push(1)}t._pointsKSYResult=new $.Scene.PointsPrimitive({viewer:l._viewer,Cartesians:n,Colors:o})}else alert("高程异常!")})}}catch(e){console.log(e)}ie.prototype.remove=function(){}}function ne(e){if(e&&e.positions){for(var t=e.positions,i=e.that,o=i.transformWGS84ToCartesian(t[0]),r=i.transformWGS84ToCartesian(t[1]),a=[$.Cartographic.fromCartesian(o)],s=new $.Cartesian3,l=[0],c=[0],h=1;h<=10;h++){$.Cartesian3.lerp(o,r,h/10,s);var u=$.Cartographic.fromCartesian(s),d=i._viewer.scene.globe.getHeight(u),d=(u.height=d,a.push(u),a[h-1]),p=$.Cartesian3.distance($.Cartographic.toCartesian(d),$.Cartographic.toCartesian(u));c.push(c[h-1]+p),u=Math.asin((u.height-d.height)/p),l.push(100*Math.tan(u))}e=document.createElement("div"),t=(e.className="echart-viewer",i._viewer.container.appendChild(e,"dark",{renderer:"canvas",width:640,height:480}),e.style.position="absolute",e.style.left="20px",e.style.bottom="20px",e.style.height="300px",e.style.width="640px",e.style.overflow="hidden",e.style.zIndex="9999",{title:{text:"剖面示意图",left:"center",subtext:"",textStyle:{color:"white",fontSize:15}},tooltip:{trigger:"axis"},legend:{data:[""]},toolbox:{show:!(e.style.opacity=.9),feature:{mark:{show:!0},dataView:{show:!0,readOnly:!1},magicType:{show:!0,type:["line","bar"]},restore:{show:!0},saveAsImage:{show:!0}}},calculable:!0,xAxis:[{type:"category",name:"长度(米)",boundaryGap:!1,data:c,axisLabel:{textStyle:{color:"white"}},axisLine:{lineStyle:{color:"white"}}}],yAxis:[{type:"value",name:"坡度(%)",axisLabel:{formatter:function(e){return e.toFixed(2)+"%"},textStyle:{color:"white"}},axisLine:{lineStyle:{color:"white"}}}],series:[{name:"坡度",type:"line",areaStyle:{},smooth:!0,data:l,markPoint:{data:[{type:"max",name:"最大值"},{type:"min",name:"最小值"}]},markLine:{data:[{type:"average",name:"平均值"}]}}]});n.init(e).setOption(t)}}function re(e){if(e&&e.positions&&e.that){var t=e.that,e=e.positions,i=this;if(t._viewer.terrainProvider.availability){var n=Math.PI/Math.pow(2,11);n/=64;var o,r,a,s,l,c,h,u,n=new $.PolygonGeometry.fromPositions({positions:e,vertexFormat:$.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,granularity:n}),d=new $.PolygonGeometry.createGeometry(n),p=0,m=0,g=new $.Cartesian3;for(let e=0;e<d.indices.length;e+=3){h=d.indices[e],r=d.indices[e+1],l=d.indices[e+2],c=d.attributes.position.values,g.x=c[3*h],g.y=c[3*h+1],g.z=c[3*h+2],h=$.Cartographic.fromCartesian(g),o=t._viewer.scene.globe.getHeight(h),a=$.Cartesian3.fromRadians(h.longitude,h.latitude,o),u=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),m<o&&(m=o),g.x=c[3*r],g.y=c[3*r+1],g.z=c[3*r+2],h=$.Cartographic.fromCartesian(g),r=t._viewer.scene.globe.getHeight(h),s=$.Cartesian3.fromRadians(h.longitude,h.latitude,r),y=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),m<r&&(m=r),g.x=c[3*l],g.y=c[3*l+1],g.z=c[3*l+2],h=$.Cartographic.fromCartesian(g),c=t._viewer.scene.globe.getHeight(h),l=$.Cartesian3.fromRadians(h.longitude,h.latitude,c),m<c&&(m=c),u=u,y=y,h=$.Cartesian3.fromRadians(h.longitude,h.latitude,0),u=((f=$.Cartesian3.distance(u,y))+(y=$.Cartesian3.distance(y,h))+(h=$.Cartesian3.distance(h,u)))/2,p+=Math.sqrt(u*(u-f)*(u-y)*(u-h))*(o-15e3+r-15e3+c-15e3)/3;var f=[],y=(f.push(a),f.push(s),f.push(l),{polygon:{hierarchy:{positions:f},extrudedHeight:0,perPositionHeight:!0,material:$.Color.fromRandom().withAlpha(.5),outline:!0,closeTop:!0,closeBottom:!0,outlineColor:$.Color.WHITE,outlineWidth:2}});t._analysisLayer.entities.add(y)}n=function(e){for(var t=[],i=[],n=0;n<e.length;n++){var o=$.Cartographic.fromCartesian(e[n]);t.push(o.longitude),i.push(o.latitude)}for(var r,a,s,l=0,c=0,h=0,u=0,d=0,n=0;n<e.length;n++)h+=s=(r=t[n])*(c=n==e.length-1?(l=t[0],i[0]):(l=t[n+1],i[n+1]))-l*(a=i[n]),u+=(r+l)*s,d+=(a+c)*s;return u/=6*(h*=.5),d/=6*h,new $.Cartographic(u,d)}(e),i._volumeLabel=t._analysisLayer.entities.add({position:$.Cartesian3.fromRadians(n.longitude,n.latitude,m+1e3),label:{text:"Cut Volume "+p.toString()+"m3"}})}else alert("未获取到地形")}}ee.prototype={createVisibilityAnalysis:function(i){i=i||{};var n=this;n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new te({positions:e,that:n});n._graphicsLayer&&n._graphicsLayer.entities.remove(t),"function"==typeof i.callback&&i.callback(e)}})},createLookAroundAnalysis:function(i){var n;i=i||{},this._viewer&&i&&(n=this).drawCircleGraphics({callback:function(e,t){n._drawLayer.entities.remove(t);t=new ie({that:n,radius:e.radius,center:e.center});"function"==typeof i.callback&&i.callback(t)}})},createVisualFieldAnalysis:function(e){var i,n;e=e||{},this._viewer&&e&&(n=null,(i=this).bindHandelEvent({leftClick:function(e,t){e=i._viewer.scene.pickPosition(e.position);if(!e)return!1;$.defined(n)?t.destroy():(n=new $.Scene.ShadowPrimitive({scene:i._viewer.scene,viewerPosition:e}),i._analysisLayer._primitives.add(n))},mouseMove:function(e){e=i._viewer.scene.pickPosition(e.endPosition);if(!e)return!1;n&&n.setPoseByTargetPoint(e)}}))},createClipPlanAnalysis:function(i){var n,o,r,a,s;i=i||{},this._viewer&&i&&(n=this,o=i.height||30,r=i.splitNum||50,a=i.wallImg||this.getDfSt(["amalysis","createClipPlanAnalysis_wallImg"])||"static/data/images/file/excavate_side_min.jpg",s=i.bottomImg||this.getDfSt(["amalysis","createClipPlanAnalysis_bottomImg"])||"static/data/images/file/excavate_bottom_min.jpg",n.drawPolygonGraphics({callback:function(e,t){n._drawLayer.entities.remove(t);t=new $.Scene.TerrainClipPlan(n._viewer,{height:o,splitNum:r,wallImg:a,bottomImg:s}),e=n.transformWGS84ArrayToCartesianArray(e);t.updateData(e),"function"==typeof i.callback&&i.callback(t)}}))},createSubmergedAnalysis:function(e){var t,n,o,r,a;e=e||{},this._viewer&&e&&(t=this,n=e.maxH||15,o=e.speed||1,r=e.interval||10,a=e.matrialUrl||this.getDfSt(["amalysis","createSubmergedAnalysis"])||"static/data/images/file/water.png",t.drawPolygonGraphics({height:1,callback:function(e,i){if(!t._viewer.scene.globe.depthTestAgainstTerrain)return alert("请开启深度检测"),!1;i&&setTimeout(()=>{i.polygon.heightReference="CLAMP_TO_GROUND",i.polygon.material=a;var e=0,t=(i.polygon.extrudedHeight=e,setInterval(function(){(e+=o)>=n&&(e=n,clearTimeout(t)),i.polygon.extrudedHeight=e},r))},2e3)}}))},createSlopeAnalysis:function(i){if(i=i||{},!n)return alert("需要引入echarts库"),!1;var o=this;this._viewer&&i&&o.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new ne({positions:e,that:o});o._graphicsLayer&&o._graphicsLayer.entities.remove(t),"function"==typeof i.callback&&i.callback(e)}})},createCutVolumeAnalysis:function(t){var i;t=t||{},this._viewer&&t&&(i=this).drawWallGraphics({callback:function(e){e=new re({positions:i.transformWGS84ArrayToCartesianArray(e,100),that:i});"function"==typeof t.callback&&t.callback(e)}})}};var oe={version:"1.0.0",PlotUtils:{}},ae=(oe.PlotUtils.distance=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},oe.PlotUtils.wholeDistance=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=oe.PlotUtils.distance(e[i],e[i+1]);return t},oe.PlotUtils.getBaseLength=function(e){return Math.pow(oe.PlotUtils.wholeDistance(e),.99)},oe.PlotUtils.mid=function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},oe.PlotUtils.getCircleCenterOfThreePoints=function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],t=[n[0]-e[1]+t[1],n[1]+e[0]-t[0]],o=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[o[0]-e[1]+i[1],o[1]+e[0]-i[0]];return oe.PlotUtils.getIntersectPoint(n,t,o,e)},oe.PlotUtils.getIntersectPoint=function(e,t,i,n){var o,r,a;return e[1]==t[1]?[(o=(n[0]-i[0])/(n[1]-i[1]))*(e[1]-i[1])+i[0],r=e[1]]:i[1]==n[1]?[(a=(t[0]-e[0])/(t[1]-e[1]))*(i[1]-e[1])+e[0],r=i[1]]:(a=(t[0]-e[0])/(t[1]-e[1]),o=(n[0]-i[0])/(n[1]-i[1]),[a*(r=(a*e[1]-e[0]-o*i[1]+i[0])/(a-o))-a*e[1]+e[0],r])},oe.PlotUtils.getAzimuth=function(e,t){var i,n=Math.asin(Math.abs(t[1]-e[1])/oe.PlotUtils.distance(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=oe.Constants.TWO_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},oe.PlotUtils.getAngleOfThreePoints=function(e,t,i){e=oe.PlotUtils.getAzimuth(t,e)-oe.PlotUtils.getAzimuth(t,i);return e<0?e+oe.Constants.TWO_PI:e},oe.PlotUtils.isClockWise=function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},oe.PlotUtils.getPointOnLine=function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},oe.PlotUtils.getCubicValue=function(e,t,i,n,o){var r=1-(e=Math.max(Math.min(e,1),0)),a=e*e,s=a*e,l=r*r,c=l*r;return[c*t[0]+3*l*e*i[0]+3*r*a*n[0]+s*o[0],c*t[1]+3*l*e*i[1]+3*r*a*n[1]+s*o[1]]},oe.PlotUtils.getThirdPoint=function(e,t,i,n,o){e=oe.PlotUtils.getAzimuth(e,t),o=o?e+i:e-i,e=n*Math.cos(o),i=n*Math.sin(o);return[t[0]+e,t[1]+i]},oe.PlotUtils.getArcPoints=function(e,t,i,n){for(var o=[],r=(r=n-i)<0?r+oe.Constants.TWO_PI:r,a=0;a<=oe.Constants.FITTING_COUNT;a++){var s=i+r*a/oe.Constants.FITTING_COUNT,l=e[0]+t*Math.cos(s),s=e[1]+t*Math.sin(s);o.push([l,s])}return o},oe.PlotUtils.getBisectorNormals=function(e,t,i,n){var o,r,a=oe.PlotUtils.getNormal(t,i,n),s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),l=a[0]/s,a=a[1]/s,c=oe.PlotUtils.distance(t,i),h=oe.PlotUtils.distance(i,n),s=s>oe.Constants.ZERO_TOLERANCE?oe.PlotUtils.isClockWise(t,i,n)?(o=[i[0]-(r=e*c)*a,i[1]+r*l],[i[0]+(r=e*h)*a,i[1]-r*l]):(o=[i[0]+(r=e*c)*a,i[1]-r*l],[i[0]-(r=e*h)*a,i[1]+r*l]):(o=[i[0]+e*(t[0]-i[0]),i[1]+e*(t[1]-i[1])],[i[0]+e*(n[0]-i[0]),i[1]+e*(n[1]-i[1])]);return[o,s]},oe.PlotUtils.getNormal=function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],o=Math.sqrt(n*n+e*e),o=(n/=o,e/=o,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(o*o+i*i);return[n+(o/=t),e+(i/=t)]},oe.PlotUtils.getCurvePoints=function(e,t){for(var i=[oe.PlotUtils.getLeftMostControlPoint(t)],n=0;n<t.length-2;n++)var o=t[n],r=t[n+1],a=t[n+2],a=oe.PlotUtils.getBisectorNormals(e,o,r,a),i=i.concat(a);for(var s=oe.PlotUtils.getRightMostControlPoint(t),l=(i.push(s),[]),n=0;n<t.length-1;n++){for(o=t[n],r=t[n+1],l.push(o),e=0;e<oe.Constants.FITTING_COUNT;e++){var c=oe.PlotUtils.getCubicValue(e/oe.Constants.FITTING_COUNT,o,i[2*n],i[2*n+1],r);l.push(c)}l.push(r)}return l},oe.PlotUtils.getLeftMostControlPoint=function(e){var i,n,o,r,a,s=e[0],l=e[1],e=e[2],c=oe.PlotUtils.getBisectorNormals(0,s,l,e)[0],e=oe.PlotUtils.getNormal(s,l,e),e=Math.sqrt(e[0]*e[0]+e[1]*e[1])>oe.Constants.ZERO_TOLERANCE?(e=oe.PlotUtils.mid(s,l),o=s[0]-e[0],i=s[1]-e[1],n=2/oe.PlotUtils.distance(s,l),r=c[0]-e[0],c=c[1]-e[1],a=e[0]+((i=-n*i)*i-(n=n*o)*n)*r+(o=2*i*n)*c,e[1]+o*r+(n*n-i*i)*c):(a=s[0]+t*(l[0]-s[0]),s[1]+t*(l[1]-s[1]));return[a,e]},oe.PlotUtils.getRightMostControlPoint=function(e){var i,n,o,r,a,s=e.length,l=e[s-3],c=e[s-2],e=e[s-1],s=oe.PlotUtils.getBisectorNormals(0,l,c,e)[1],l=oe.PlotUtils.getNormal(l,c,e),l=Math.sqrt(l[0]*l[0]+l[1]*l[1])>oe.Constants.ZERO_TOLERANCE?(l=oe.PlotUtils.mid(c,e),o=e[0]-l[0],i=e[1]-l[1],n=2/oe.PlotUtils.distance(c,e),r=s[0]-l[0],s=s[1]-l[1],a=l[0]+((i=-n*i)*i-(n=n*o)*n)*r+(o=2*i*n)*s,l[1]+o*r+(n*n-i*i)*s):(a=e[0]+t*(c[0]-e[0]),e[1]+t*(c[1]-e[1]));return[a,l]},oe.PlotUtils.getBezierPoints=function(e){if(e.length<=2)return e;for(var t=[],i=e.length-1,n=0;n<=1;n+=.01){for(var o=0,r=0,a=0;a<=i;a++){var s=oe.PlotUtils.getBinomialFactor(i,a),l=Math.pow(n,a),c=Math.pow(1-n,i-a);o+=s*l*c*e[a][0],r+=s*l*c*e[a][1]}t.push([o,r])}return t.push(e[i]),t},oe.PlotUtils.getBinomialFactor=function(e,t){return oe.PlotUtils.getFactorial(e)/(oe.PlotUtils.getFactorial(t)*oe.PlotUtils.getFactorial(e-t))},oe.PlotUtils.getFactorial=function(e){if(e<=1)return 1;if(2==e)return 2;if(3==e)return 6;if(4==e)return 24;if(5==e)return 120;for(var t=1,i=1;i<=e;i++)t*=i;return t},oe.PlotUtils.getQBSplinePoints=function(e){if(e.length<=2)return e;var t=[],i=e.length-2-1;t.push(e[0]);for(var n=0;n<=i;n++)for(var o=0;o<=1;o+=.05){for(var r=0,a=0,s=0;s<=2;s++){var l=oe.PlotUtils.getQuadricBSplineFactor(s,o);r+=l*e[n+s][0],a+=l*e[n+s][1]}t.push([r,a])}return t.push(e[e.length-1]),t},oe.PlotUtils.getQuadricBSplineFactor=function(e,t){return 0==e?Math.pow(t-1,2)/2:1==e?(-2*Math.pow(t,2)+2*t+1)/2:2==e?Math.pow(t,2)/2:0},oe.Constants={TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,FITTING_COUNT:100,ZERO_TOLERANCE:1e-4},{version:"1.0.0",createTime:"2018.6.19",author:"xupinhui"}),se="doublearrow",le={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1},ce={tailWidthFactor:.15,neckWidthFactor:.2,headWidthFactor:.25,headAngle:Math.PI/8.5,neckAngle:Math.PI/13};ae.algorithm={},ae.algorithm.doubleArrow=function(e,t){this.connPoint=null;var i={controlPoint:this.tempPoint4=null,polygonalPoint:null};if(!((a=(this.points=e).length)<2)){if(2==a)return e;var n=this.points[0],o=this.points[1],r=this.points[2],a=e.length,a=(this.tempPoint4=3==a?ae.algorithm.getTempPoint4(n,o,r):this.points[3],this.connPoint=3==a||4==a?oe.PlotUtils.mid(n,o):this.points[4],e=oe.PlotUtils.isClockWise(n,o,r)?(h=ae.algorithm.getArrowPoints(n,this.connPoint,this.tempPoint4,!1),ae.algorithm.getArrowPoints(this.connPoint,o,r,!0)):(h=ae.algorithm.getArrowPoints(o,this.connPoint,r,!1),ae.algorithm.getArrowPoints(this.connPoint,n,this.tempPoint4,!0)),h.length),s=(a-5)/2,l=h.slice(0,s),c=h.slice(s,5+s),h=h.slice(5+s,a),u=e.slice(0,s),d=e.slice(s,5+s),e=e.slice(5+s,a),u=oe.PlotUtils.getBezierPoints(u),s=oe.PlotUtils.getBezierPoints(e.concat(l.slice(1))),h=oe.PlotUtils.getBezierPoints(h),a=u.concat(d,s,c,h),e=ae.algorithm.array2Dto1D(a);i.controlPoint=[n,o,r,this.tempPoint4,this.connPoint],i.polygonalPoint=t.Cartesian3.fromDegreesArray(e)}return i},ae.algorithm.threeArrow=function(e){this.connPoint=null,this.tempPoint4=null;var t={controlPoint:this.tempPoint5=null,polygonalPoint:null};if(2<=(r=(this.points=e).length)){if(2==r)return e;var i=this.points[0],n=this.points[1],o=this.points[2],r=(3==(r=e.length)?(this.tempPoint4=ae.algorithm.getTempPoint4(i,n,o),this.tempPoint5=oe.PlotUtils.mid(o,this.tempPoint4)):(this.tempPoint4=this.points[3],this.tempPoint5=this.points[4]),this.connPoint=r<6?oe.PlotUtils.mid(i,n):this.points[5],e=oe.PlotUtils.isClockWise(i,n,o)?(c=ae.algorithm.getArrowPoints(i,this.connPoint,this.tempPoint4,!1),ae.algorithm.getArrowPoints(this.connPoint,n,o,!0)):(c=ae.algorithm.getArrowPoints(n,this.connPoint,o,!1),ae.algorithm.getArrowPoints(this.connPoint,i,this.tempPoint4,!0)),c.length),a=(r-5)/2,s=c.slice(0,a),l=c.slice(a,5+a),c=c.slice(5+a,r),h=e.slice(0,a),u=e.slice(a,5+a),e=e.slice(5+a,r),h=oe.PlotUtils.getBezierPoints(h),a=oe.PlotUtils.getBezierPoints(e.concat(s.slice(1))),c=oe.PlotUtils.getBezierPoints(c),r=h.concat(u,a,l,c),e=ae.algorithm.array2Dto1D(r);t.controlPoint=[i,n,o,this.tempPoint4,this.tempPoint5,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(e)}return t},ae.algorithm.array2Dto1D=function(e){var t=[];return e.forEach(function(e){t.push(e[0]),t.push(e[1])}),t},ae.algorithm.getArrowPoints=function(e,t,i,n){this.type=se,this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15;var o=oe.PlotUtils.mid(e,t),r=oe.PlotUtils.distance(o,i),a=oe.PlotUtils.getThirdPoint(i,o,0,.3*r,!0),s=oe.PlotUtils.getThirdPoint(i,o,0,.5*r,!0),a=[o,oe.PlotUtils.getThirdPoint(o,a,oe.Constants.HALF_PI,r/5,n),oe.PlotUtils.getThirdPoint(o,s,oe.Constants.HALF_PI,r/4,n),i],o=ae.algorithm.getArrowHeadPoints(a,this.headHeightFactor,this.headWidthFactor,this.neckHeightFactor,this.neckWidthFactor),s=o[0],r=o[4],n=oe.PlotUtils.distance(e,t)/oe.PlotUtils.getBaseLength(a)/2,i=ae.algorithm.getArrowBodyPoints(a,s,r,n),a=i.length,n=i.slice(0,a/2),i=i.slice(a/2,a);return n.push(s),i.push(r),(n=n.reverse()).push(t),(i=i.reverse()).push(e),n.reverse().concat(o,i)},ae.algorithm.getArrowHeadPoints=function(e,t,i){this.type=se,this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15;var n=oe.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],t=(oe.PlotUtils.distance(t,i),n*this.headWidthFactor),i=n*this.neckWidthFactor,r=n*this.neckHeightFactor,n=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,t,!1),n=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,t,!0);return[oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,i,!1),r,o,n,oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,i,!0)]},ae.algorithm.getArrowBodyPoints=function(e,t,i,n){for(var o=oe.PlotUtils.wholeDistance(e),r=oe.PlotUtils.getBaseLength(e)*n,a=(r-oe.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=oe.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=oe.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=oe.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=oe.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ae.algorithm.getTempPoint4=function(e,t,i){var n,o,r,t=oe.PlotUtils.mid(e,t),a=oe.PlotUtils.distance(t,i),i=oe.PlotUtils.getAngleOfThreePoints(e,t,i),a=i<oe.Constants.HALF_PI?(n=a*Math.sin(i),o=a*Math.cos(i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!1),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!0)):i>=oe.Constants.HALF_PI&&i<Math.PI?(n=a*Math.sin(Math.PI-i),o=a*Math.cos(Math.PI-i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!1),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!1)):i>=Math.PI&&i<1.5*Math.PI?(n=a*Math.sin(i-Math.PI),o=a*Math.cos(i-Math.PI),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!0),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!0)):(n=a*Math.sin(2*Math.PI-i),o=a*Math.cos(2*Math.PI-i),r=oe.PlotUtils.getThirdPoint(e,t,oe.Constants.HALF_PI,n,!0),oe.PlotUtils.getThirdPoint(t,r,oe.Constants.HALF_PI,o,!1));return a},ae.algorithm.tailedAttackArrow=function(e,t){e=ae.algorithm.dereplication(e),this.tailWidthFactor=le.tailWidthFactor,this.swallowTailFactor=le.swallowTailFactor,this.swallowTailPnt=le.swallowTailPnt;var i={controlPoint:null,polygonalPoint:null};if(!((i.controlPoint=e).length<2)){if(2==e.length)return i.polygonalPoint=e,i;var n=e[0],o=e[1],e=(oe.PlotUtils.isClockWise(e[0],e[1],e[2])&&(n=e[1],o=e[0]),[oe.PlotUtils.mid(n,o)].concat(e.slice(2))),r=ae.algorithm.getAttackArrowHeadPoints(e,n,o,le),a=r[0],s=r[4],l=oe.PlotUtils.distance(n,o),c=oe.PlotUtils.getBaseLength(e),h=c*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=oe.PlotUtils.getThirdPoint(e[1],e[0],0,h,!0);h=ae.algorithm.getAttackArrowBodyPoints(e,a,s,l/c),e=h.length,l=[n].concat(h.slice(0,e/2));l.push(a);c=[o].concat(h.slice(e/2,e));c.push(s),l=oe.PlotUtils.getQBSplinePoints(l),c=oe.PlotUtils.getQBSplinePoints(c),n=ae.algorithm.array2Dto1D(l.concat(r,c.reverse(),[this.swallowTailPnt,l[0]])),i.polygonalPoint=t.Cartesian3.fromDegreesArray(n)}return i},ae.algorithm.getAttackArrowHeadPoints=function(e,t,i,n){this.headHeightFactor=n.headHeightFactor,this.headTailFactor=n.headTailFactor,this.headWidthFactor=n.headWidthFactor,this.neckWidthFactor=n.neckWidthFactor,this.neckHeightFactor=n.neckHeightFactor;var n=oe.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],r=oe.PlotUtils.distance(o,e[e.length-2]),t=oe.PlotUtils.distance(t,i),i=(n=n>t*this.headTailFactor?t*this.headTailFactor:n)*this.headWidthFactor,t=n*this.neckWidthFactor,r=(n=r<n?r:n)*this.neckHeightFactor,n=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=oe.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,i,!1),n=oe.PlotUtils.getThirdPoint(o,n,oe.Constants.HALF_PI,i,!0);return[oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,t,!1),r,o,n,oe.PlotUtils.getThirdPoint(o,e,oe.Constants.HALF_PI,t,!0)]},ae.algorithm.getAttackArrowBodyPoints=function(e,t,i,n){for(var o=oe.PlotUtils.wholeDistance(e),r=oe.PlotUtils.getBaseLength(e)*n,a=(r-oe.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=oe.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=oe.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=oe.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=oe.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ae.algorithm.dereplication=function(e){var t=e[e.length-1],i=!1,n=[],n=e.filter(function(e){if(e[0]!=t[0]&&e[1]!=t[1])return e;i=!0});return i&&n.push(t),n},ae.algorithm.fineArrow=function(e,t,i){var n,o,r,a,s,l,c;if(!(e.length<2||t.length<2))return n=ce.tailWidthFactor,c=ce.neckWidthFactor,s=ce.headWidthFactor,a=ce.headAngle,l=ce.neckAngle,(o=[])[0]=e,o[1]=t,e=o[0],t=o[1],c=(o=oe.PlotUtils.getBaseLength(o))*c,s=o*s,n=oe.PlotUtils.getThirdPoint(t,e,oe.Constants.HALF_PI,o=o*n,!0),o=oe.PlotUtils.getThirdPoint(t,e,oe.Constants.HALF_PI,o,!1),r=oe.PlotUtils.getThirdPoint(e,t,a,s,!1),a=oe.PlotUtils.getThirdPoint(e,t,a,s,!0),s=oe.PlotUtils.getThirdPoint(e,t,l,c,!1),l=oe.PlotUtils.getThirdPoint(e,t,l,c,!0),(c=[]).push(n[0],n[1],s[0],s[1],r[0],r[1],t[0],t[1],a[0],a[1],l[0],l[1],o[0],o[1],e[0],e[1]),c.some(e=>isNaN(e))?"":i.Cartesian3.fromDegreesArray(c)};let he=null;function ue(e,t){this.viewer=e,he=t,this.handler=new he.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.fillMaterial=he.Color.RED.withAlpha(.5),this.positions=[],this.state=-1,this.floatPoint=null,this.arrowEntity=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null,this.xp=ae,this.tooltip=new _(e,t),this.tooltip.initTool()}ue.prototype.clear=function(){this.state=0,this.firstPoint&&this.viewer.entities.remove(this.firstPoint),this.floatPoint&&this.viewer.entities.remove(this.floatPoint),this.arrowEntity&&this.viewer.entities.remove(this.arrowEntity),this.state=-1},ue.prototype.disableHandler=function(){this.handler&&(this.handler.destroy(),this.handler=new he.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)};let de=null;var pe=function(e,t){ue.call(this,e,t),de=t,this.type="AttackArrow",this.fillMaterial=de.Color.RED.withAlpha(.5)};function me(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}pe.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){var e=me(e.position,i.viewer);e&&(0==i.positions.length&&(i.floatPoint=i.creatPoint(e),i.floatPoint.wz=-1),i.positions.push(e),e=i.creatPoint(e),2<i.positions.length?e.wz=i.positions.length-1:e.wz=i.positions.length,i.pointArr.push(e))},de.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!i.floatPoint||i.positions.length<2||(e=me(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),i.tooltip.showAtCartesian(e,"右键结束!"),2<=i.positions.length)&&(de.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),i.arrowEntity.objId=i.objId,t&&t(i.objId)))},de.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){e=me(e.position,i.viewer);if(e){for(var t=0;t<i.pointArr.length;t++)i.pointArr[t].show=!1;i.floatPoint.show=!1,i.viewer.entities.remove(i.floatPoint),i.floatPoint=null;e=i.creatPoint(e);e.show=!1,e.wz=i.positions.length,i.pointArr.push(e),i.handler.destroy(),i.handler=null,i.tooltip.setVisible(!1),i.arrowEntity=null}},de.ScreenSpaceEventType.RIGHT_CLICK)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=de.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var o=this.creatPoint(this.positions[i]);o.show=!1,o.wz=i+1,this.pointArr.push(o)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;for(var n=this,e=0;e<n.pointArr.length;e++)n.pointArr[e].show=!0;this.modifyHandler||(this.modifyHandler=new de.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(de.defined(t)&&t.id)n.clickStep++,t.id.objId||(n.selectPoint=t.id);else{for(var i=0;i<n.pointArr.length;i++)n.pointArr[i].show=!1;n.floatPoint&&(n.floatPoint.show=!1),n.state=-1,n.modifyHandler.destroy(),n.modifyHandler=null,n.tooltip.setVisible(!1)}2==n.clickStep&&(n.clickStep=0,t=me(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},de.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=me(e.endPosition,n.viewer);e&&(n.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),n.selectPoint)&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},de.ScreenSpaceEventType.MOUSE_MOVE)},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){e=this.viewer.entities.add({position:e,point:{pixelSize:10,color:de.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new de.PolygonGraphics({hierarchy:new de.CallbackProperty(function(){if(r.length<3)return null;for(var e=[],t=0;t<r.length;t++){var i=a.cartesianToLatlng(r[t]);e.push(i)}var n=a.xp.algorithm.tailedAttackArrow(e,de),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new de.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=de.Math.toDegrees(e.latitude);return[de.Math.toDegrees(e.longitude),t]}},(pe.prototype=Object.create(Object.assign({},pe.prototype,ue.prototype))).constructor=pe;let fe=null;var ge=function(e,t){ue.call(this,e,t),fe=t,this.type="StraightArrow",this.fillMaterial=fe.Color.fromCssColorString("#0000FF").withAlpha(.8)};function ve(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}ge.prototype={disable:function(){this.positions=[],this.firstPoint&&(this.viewer.entities.remove(this.firstPoint),this.firstPoint=null),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){e=ve(e.position,i.viewer);e&&(0==i.positions.length&&(i.firstPoint=i.creatPoint(e),i.firstPoint.type="firstPoint",i.floatPoint=i.creatPoint(e),i.floatPoint.type="floatPoint",i.positions.push(e),i.firstPoint.position.setValue(e),i.firstPoint.show=!0),i.positions&&3==i.positions.length&&(i.firstPoint.show=!1,i.floatPoint.show=!1,i.handler.destroy(),i.handler=null,i.tooltip.setVisible(!1),i.arrowEntity=null),i.positions.push(e.clone()))},fe.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){i.positions.length<1||(e=ve(e.endPosition,i.viewer))&&(i.tooltip.showAtCartesian(e,"左键单击结束!"),i.floatPoint.position.setValue(e),2<=i.positions.length)&&(fe.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),t&&t(i.objId)))},fe.ScreenSpaceEventType.MOUSE_MOVE)},startModify:function(){this.state=2,this.firstPoint.show=!0,this.floatPoint.show=!0;var i=this;this.clickStep=0,this.modifyHandler||(this.modifyHandler=new fe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);fe.defined(t)&&t.id?(i.clickStep++,t.id.objId||(i.selectPoint=t.id)):(i.modifyHandler.destroy(),i.modifyHandler=null,i.firstPoint.show=!1,i.floatPoint.show=!1,i.state=-1,i.tooltip.setVisible(!1)),2==i.clickStep&&(i.clickStep=0,t=ve(e.position,i.viewer))&&i.selectPoint&&i.selectPoint.position&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},fe.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=ve(e.endPosition,i.viewer);e&&(i.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),i.selectPoint)&&i.selectPoint.position&&(i.selectPoint.position.setValue(e),"firstPoint"==i.selectPoint.type&&(i.positions[1]=e),"floatPoint"==i.selectPoint.type)&&(i.positions[2]=e)},fe.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.state=-1,this.positions=[];for(var t=[],i=0;i<e.length;i++){var n=fe.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}this.positions=t,this.firstPoint=this.creatPoint(this.positions[1]),this.firstPoint.type="firstPoint",this.floatPoint=this.creatPoint(this.positions[2]),this.floatPoint.type="floatPoint",this.arrowEntity=this.showArrowOnMap(this.positions),this.firstPoint.show=!1,this.floatPoint.show=!1,this.arrowEntity.objId=this.objId},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){e=this.viewer.entities.add({position:e,point:{pixelSize:10,color:fe.Color.RED}});return e.attr="editPoint",e},showArrowOnMap:function(a){var s=this;return this.viewer.entities.add({id:s.objId,polygon:new fe.PolygonGraphics({hierarchy:new fe.CallbackProperty(function(){if(a.length<2)return null;var e=a[1],t=a[2],e=s.cartesianToLatlng(e),t=s.cartesianToLatlng(t),i=[],n=s.xp.algorithm.fineArrow([e[0],e[1]],[t[0],t[1]],fe);if(-1!=JSON.stringify(n).indexOf("null"))return[];for(var o=0;o<n.length;o++){var r=new fe.Cartesian3(n[o].x,n[o].y,n[o].z);i.push(r)}return new fe.PolygonHierarchy(i)},!1),show:!0,fill:!0,material:s.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=fe.Math.toDegrees(e.latitude);return[fe.Math.toDegrees(e.longitude),t]}},(ge.prototype=Object.create(Object.assign({},ge.prototype,ue.prototype))).constructor=ge;let ye=null;var _e=function(e,t){ue.call(this,e,t),ye=t,this.type="PincerArrow",this.fillMaterial=ye.Color.YELLOW.withAlpha(.8)};function we(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}_e.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},startDraw:function(e){let t=null;t="object"==typeof e?(this.fillMaterial=e.fillMaterial,e.callback):e,this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var n=this;this.state=1,this.handler||(this.handler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){e=we(e.position,n.viewer);if(e)if(0==n.positions.length&&(n.floatPoint=n.creatPoint(e)),4<n.positions.length){(i=n.creatPoint(e)).wz=n.positions.length,n.pointArr.push(i);for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;n.floatPoint&&(n.floatPoint.show=!1,n.viewer.entities.remove(n.floatPoint),n.floatPoint=null)}else{n.positions.push(e);var i=n.creatPoint(e);2<n.positions.length?i.wz=n.positions.length-1:i.wz=n.positions.length,n.pointArr.push(i)}},ye.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!n.floatPoint||n.positions.length<2||(e=we(e.endPosition,n.viewer))&&(n.floatPoint.position.setValue(e),n.tooltip.showAtCartesian(e,"右键单击结束!"),2<=n.positions.length)&&(ye.defined(n.arrowEntity)?(n.positions.pop(),n.positions.push(e)):(n.positions.push(e),n.arrowEntity=n.showArrowOnMap(n.positions),n.arrowEntity.objId=n.objId,t&&t(n.objId)))},ye.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(4<=n.positions.length){e=we(e.position,n.viewer);if(e){for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;n.floatPoint&&(n.floatPoint.show=!1),n.viewer.entities.remove(n.floatPoint),n.floatPoint=null;e=n.creatPoint(e);e.show=!1,e.wz=n.positions.length,n.pointArr.push(e),n.handler.destroy(),n.handler=null,n.tooltip.setVisible(!1),n.arrowEntity=null}}},ye.ScreenSpaceEventType.RIGHT_CLICK)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=ye.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var o=this.creatPoint(this.positions[i]);o.show=!1,o.wz=i+1,this.pointArr.push(o)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;var i=this;for(let e=0;e<i.pointArr.length;e++)i.pointArr[e].show=!0;this.modifyHandler||(this.modifyHandler=new ye.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);if(ye.defined(t)&&t.id)i.clickStep++,t.id.objId||(i.selectPoint=t.id);else{for(let e=0;e<i.pointArr.length;e++)i.pointArr[e].show=!1;i.state=-1,i.modifyHandler.destroy(),i.modifyHandler=null,i.tooltip.setVisible(!1)}2==i.clickStep&&(i.clickStep=0,t=we(e.position,i.viewer))&&i.selectPoint&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},ye.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){e=we(e.endPosition,i.viewer);e&&(i.tooltip.showAtCartesian(e,"左键选取圆点开始修改,单击停止修改,点击图形之外结束!"),i.selectPoint)&&(i.selectPoint.position.setValue(e),i.positions[i.selectPoint.wz-1]=e)},ye.ScreenSpaceEventType.MOUSE_MOVE)},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){return this.viewer.entities.add({position:e,point:{pixelSize:10,color:ye.Color.RED},show:!0})},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new ye.PolygonGraphics({hierarchy:new ye.CallbackProperty(function(){if(r.length<3)return null;for(var e=[],t=0;t<r.length;t++){var i=a.cartesianToLatlng(r[t]);e.push(i)}var n=a.xp.algorithm.doubleArrow(e,ye),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new ye.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=ye.Math.toDegrees(e.latitude);return[ye.Math.toDegrees(e.longitude),t]}},(_e.prototype=Object.create(Object.assign({},_e.prototype,ue.prototype))).constructor=_e;let Ce=null,Pe=null;function xe(e,t,i,n){if(e&&n){const{threeGlobal:i,containerId:o,threeContainerId:r}=n;Ce=t,Pe=i,this._viewer=e,this._containerId=o,this._threeContainerId=r,this._Scene=function({THREE:a,Cesium:s,viewer:l}){class e extends a.Scene{constructor(t={}){if(super(),this.type="ThreeCesiumScene",!t.cesiumDom)throw new Error("THREE.ThreeCesiumScene not found cesiumDom.");if(!(t.camera&&t.camera instanceof a.PerspectiveCamera))throw new Error("THREE.ThreeCesiumScene (not found cesiumDom) OR ( not THREE.PerspectiveCamera ).");if(!t.renderer)throw new Error("THREE.ThreeCesiumScene not found THREE.WebGLRender.");this.options=t,this.cesiumViewer=l;var i=("string"==typeof t.cesiumDom?document.getElementById(t.cesiumDom):t.cesiumDom).children[0].children;for(let e=0;e<i.length;e++)0!==e&&(i[e].style.zIndex="100");this.ellipsoid=this.cesiumViewer.scene.globe.ellipsoid,t.threeHabit&&(this.cesiumViewer.scene.screenSpaceCameraController.tiltEventTypes=[s.CameraEventType.LEFT_DRAG],this.cesiumViewer.scene.screenSpaceCameraController.zoomEventTypes=[s.CameraEventType.MIDDLE_DRAG,s.CameraEventType.WHEEL,s.CameraEventType.PINCH],this.cesiumViewer.scene.screenSpaceCameraController.rotateEventTypes=[s.CameraEventType.RIGHT_DRAG]),this.camera=t.camera,this.cameraOffset=new a.Vector3,this.renderer=t.renderer,this.lngLat=t.lngLat&&1<t.lngLat.length?t.lngLat:[114.23,31.55],this.cameraCenter=new a.Vector3(0,0,0);var e=new s.EllipsoidGeometry({vertexFormat:s.VertexFormat.POSITION_ONLY,radii:new s.Cartesian3(this.ellipsoid.maximumRadius-1,this.ellipsoid.maximumRadius-1,this.ellipsoid.minimumRadius-1),slicePartitions:1024,stackPartitions:1024}),e=function(e,t){t=t||new a.BufferGeometry;const i=e.attributes;for(const e in i){var n,o;i.hasOwnProperty(e)&&i[e]&&((o=(n=i[e]).values)instanceof Float64Array&&(o=new Float32Array(o)),o=new a.BufferAttribute(o,n.componentsPerAttribute,n.normalize),t.setAttribute(e,o))}if(i.st&&(t.attributes.uv=t.attributes.st,t.deleteAttribute("st")),e.indices){const i=new a.BufferAttribute(e.indices,1,!1);t.setIndex(i)}if(e.boundingSphere){const i=e.boundingSphere;t.boundingSphere||(t.boundingSphere=new a.Sphere),t.boundingSphere.center.copy(i.center),t.boundingSphere.radius=i.radius}return t}(s.EllipsoidGeometry.createGeometry(e)),n=new a.MeshBasicMaterial({color:"#ff00ff",blending:a.MultiplyBlending}),e=new a.Mesh(e,n),n=(t.axesHelper&&e.add(new a.AxesHelper(8e6)),super.add(e),this.sphere=e,new a.Group),e=(super.add(n),this.syncGroup=n,new a.SphereGeometry(this.ellipsoid.minimumRadius,512,256,0,2*Math.PI,3.1,Math.PI-3.1)),o=new a.MeshBasicMaterial({color:"#fff00f",blending:a.MultiplyBlending}),e=new a.Mesh(e,o),o=(e.rotateX(90*Math.PI/180),e.position.z=this.ellipsoid.minimumRadius,new a.Group),r=(o.rotateX(-90*Math.PI/180),o.position.z=-1,this.syncGroup=n,this.childrenGroup=o,this.sunUp=new a.Group,this.sunLightColor=new a.Color,this.sunLightIntensity=1,this.cesiumViewer.scene.light);if(this.sunLightColor.r=r.color.red,this.sunLightColor.g=r.color.green,this.sunLightColor.b=r.color.blue,this.sunLightIntensity=r.intensity,this.sun=new a.DirectionalLight(this.sunLightColor,this.sunLightIntensity),this.sun.castShadow=!0,this.sun.shadow.camera.far=Math.pow(10,14),this.sun.position.set(0,0,2*this.ellipsoid.maximumRadius+1e3),this.sun.target=this.childrenGroup,this.sunUp.add(this.sun),n.add(e),n.add(o),n.add(this.sunUp),this._enableLighting=!1,Object.defineProperty(this,"enableLighting",{get(){return this._enableLighting},set(e){this.cesiumViewer.scene.globe.enableLighting=e,this._enableLighting=e,this.sun.visible=!!e}}),void 0!==t.enableLighting&&null!==t.enableLighting&&(this.enableLighting=t.enableLighting),t.cesiumLayers&&0<t.cesiumLayers.length)for(let e=0;e<t.cesiumLayers.length;e++)this.addImageryProvider(t.cesiumLayers[e].type,t.cesiumLayers[e].option)}renderCesium(){return this.cesiumViewer.render(),this}renderThree(){return this.renderer.render(this,this.camera),this}updateSunMatrix(){var e=this.cesiumViewer.scene.sun._boundingVolume.center,e=this.cartesian3ToVector(e);return this.sunUp.lookAt(e.x-this.cameraOffset.x,e.y-this.cameraOffset.y,-(e.z-this.cameraOffset.z)),this}updateCameraMatrix(){this.camera.fov=s.Math.toDegrees(this.cesiumViewer.camera.frustum.fovy),this.camera.updateProjectionMatrix(),this.camera.matrixAutoUpdate=!1;var e=this.cesiumViewer.camera.viewMatrix,t=this.cesiumViewer.camera.inverseViewMatrix,t=(this.camera.lookAt(this.cameraCenter),this.camera.matrixWorld.set(t[0],t[4],t[8],t[12]-this.cameraOffset.x,t[1],t[5],t[9],t[13]-this.cameraOffset.y,t[2],t[6],t[10],t[14]-this.cameraOffset.z,t[3],t[7],t[11],t[15]),this.camera.matrixWorldInverse.set(e[0],e[4],e[8],e[12]-this.cameraOffset.x,e[1],e[5],e[9],e[13]-this.cameraOffset.y,e[2],e[6],e[10],e[14]-this.cameraOffset.z,e[3],e[7],e[11],e[15]),this.cesiumViewer.scene.canvas.clientWidth),e=this.cesiumViewer.scene.canvas.clientHeight;return this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),this}updateGroupMatrixWorld(){var e=this.cartesian3ToVector(s.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],0)),t=this.cartesian3ToVector(s.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],2)),t=(new a.Vector3).subVectors(e,t).normalize();return this.syncGroup.lookAt(t),this.syncGroup.up.copy(t),this.syncGroup.updateMatrix(),this.cameraOffset.copy(e),this.syncGroup.up.set(0,0,-1),this.up.set(0,0,-1),this}update(){this.updateSunMatrix(),this.updateGroupMatrixWorld(),this.updateCameraMatrix(),this.renderThree(),this.renderCesium()}add(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.childrenGroup.add(arguments[e]);else e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this.childrenGroup,this.childrenGroup.children.push(e),e.dispatchEvent({type:"added"})):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.childrenGroup.remove(arguments[e]);else{var t=this.childrenGroup.children.indexOf(e);-1!==t&&(e.parent=null,this.childrenGroup.children.splice(t,1),e.dispatchEvent({type:"removed"}))}return this}clear(){for(let e=0;e<this.childrenGroup.children.length;e++){var t=this.childrenGroup.children[e];t.parent=null,t.dispatchEvent({type:"removed"})}return this.childrenGroup.children.length=0,this}traverse(i){i(this.childrenGroup);var n=this.childrenGroup.children;for(let e=0,t=n.length;e<t;e++)n[e].traverse(i)}traverseVisible(i){if(!1!==this.visible&&!1!==this.childrenGroup.visible){i(this.childrenGroup);var n=this.childrenGroup.children;for(let e=0,t=n.length;e<t;e++)n[e].traverseVisible(i)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={},n=(e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{},options:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),{});if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid),null!==this.fog&&(n.fog=this.fog.toJSON()),this.options){n.options={};for(const t in this.options)["camera","renderer"].includes(t)||(n.options[t]=this.options[t])}if(0<this.childrenGroup.children.length){n.children=[];for(let e=0;e<this.childrenGroup.children.length;e++)n.children.push(this.childrenGroup.children[e].toJSON(t).object)}if(e){const e=o(t.geometries),n=o(t.materials),r=o(t.textures),a=o(t.images),s=o(t.shapes),l=o(t.skeletons),c=o(t.animations),h=o(t.nodes);0<e.length&&(i.geometries=e),0<n.length&&(i.materials=n),0<r.length&&(i.textures=r),0<a.length&&(i.images=a),0<s.length&&(i.shapes=s),0<l.length&&(i.skeletons=l),0<c.length&&(i.animations=c),0<h.length&&(i.nodes=h)}return n.isGIS=!0,i.object=n,i;function o(e){var t=[];for(const n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}dispose(){this.update=()=>{},this.renderCesium=()=>{},this.renderThree=()=>{},this.updateSunMatrix=()=>{},this.updateCameraMatrix=()=>{},this.updateGroupMatrixWorld=()=>{},this.cesiumViewer.destroy()}cartesian3ToVector(e){return new a.Vector3(e.x,e.y,e.z)}}return e.prototype.isScene=!0,e.prototype.isGIS=!0,e}({THREE:Pe,Cesium:Ce,viewer:e}),this._initContainer()}}function Se({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:a={},imageryProvider:l={},MapImageryList:u=[],defaultStatic:d,viewer:m}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";var g,y,w;if(i||m)return r=new o(e).init({containerId:i,viewerConfig:r,extraConfig:a,MapImageryList:u,imageryProvider:l,viewer:m}),y=e,w=d,{viewer:g=r,material:(a=function(e,o){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)o.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new o(g,y,w),e.forEach(e=>{e.call(t,g,y,w)})):(i(e),t=new o(g,y,w),e.call(t,g,y,w)),t})([p,h],c),graphics:a(p,s),math3d:a(p,f),math2d:new S(r,e),primitive:a(p,v),draw:a([p,f,S],P),passEffect:a([p,h],M),customCesiumPlugin:a(p,H),control:a(p,X),plugin:a([p,s],K),base:new p(r,e),analysis:a([p,P,K],ee),attackArrowObj:new pe(r,e),straightArrowObj:new ge(r,e),pincerArrowObj:new _e(r,e),threeJs:new xe(r,e,d,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")};throw"Missing containerId parameter, please check the calling function initCesium."}xe.prototype={_initContainer:function(){if(this.cesiumContainer=void 0,this.threeContainer=void 0,this.cesiumContainer=document.getElementById(this._containerId),this.threeContainer=document.getElementById(this._threeContainerId),!this.cesiumContainer)return alert("未获取到 cesiumContainer 容器!"),!1;var e;"absolute"!==this.cesiumContainer.style.position&&(this.cesiumContainer.style.position="absolute",this.cesiumContainer.style.top=0,this.cesiumContainer.style.left=0,this.cesiumContainer.style.height="100%",this.cesiumContainer.style.width="100%",this.cesiumContainer.style.margin=0,this.cesiumContainer.style.overflow="hidden",this.cesiumContainer.style.padding=0,this.cesiumContainer.style.fontFamily="sans-serif"),this.threeContainer||(e=document.getElementsByTagName("body")[0])&&(this.threeContainer=document.createElement("div"),this.threeContainer.id=this._threeContainerId,this.threeContainer.style.position="absolute",this.threeContainer.style.top=0,this.threeContainer.style.left=0,this.threeContainer.style.height="100%",this.threeContainer.style.width="100%",this.threeContainer.style.margin=0,this.threeContainer.style.overflow="hidden",this.threeContainer.style.padding=0,this.threeContainer.style.fontFamily="sans-serif",this.threeContainer.style.pointerEvents="none",e.appendChild(this.threeContainer))},initThree:function(e){var t=e.fov||45,i=window.innerWidth,n=window.innerHeight,i=e.aspect||i/n,n=e.near||1,o=e.far||1e7;return this._three={renderer:null,camera:null,scene:null},this._three.camera=new Pe.PerspectiveCamera(t,i,n,o),this._three.renderer=new Pe.WebGLRenderer({alpha:!0,antialias:!0,logarithmicDepthBuffer:!0,stencil:!0,depth:!0}),this._three.renderer.outputEncoding=Pe.sRGBEncoding,this._three.renderer.shadowMap.enabled=!0,this._three.renderer.shadowMap.type=Pe.PCFSoftShadowMap,this._three.scene=new this._Scene({cesiumDom:this._containerId,threeHabit:this._objHasOwnProperty(e,"threeHabit",!0),enableLighting:this._objHasOwnProperty(e,"enableLighting",!0),axesHelper:this._objHasOwnProperty(e,"axesHelper",!1),camera:this._three.camera,renderer:this._three.renderer,lngLat:e.center||[104.081701757991,30.627042558105988]}),this.threeContainer&&this.threeContainer.appendChild(this._three.renderer.domElement),this._three},loop(t){function i(){var e=requestAnimationFrame(i);t&&t(e)}i()},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e[t]:i,destroyThreeJS(){this._three.scene.dispose()}};class be{constructor(e){return this.init(e)}init({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:a={},MapImageryList:s=[],defaultStatic:l,baseExtendsCom:c=[],extendsCom:h,extendsComName:u,viewer:d}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";if(i||d)return{viewer:r=new o(e).init({containerId:i,viewerConfig:r,extraConfig:a,MapImageryList:s,viewer:d}),[u]:this.prototypeExtends(r,e,l,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")(c,h)};throw"Missing containerId parameter, please check the calling function initCesium."}prototypeExtends(n,r,a,s){return function(e,o){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)o.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new o(n,r,a,s),e.forEach(e=>{e.call(t,n,r,a,s)})):(i(e),t=new o(n,r,a,s),e.call(t,n,r,a,s)),t}}}class Me extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:s,extendsComName:"graphics"})}}class Te extends be{constructor(e){return super({...e,baseExtendsCom:[p,h],extendsCom:c,extendsComName:"material"})}}class Ee extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:v,extendsComName:"primitive"})}}class Ae extends be{constructor(e){return super({...e,baseExtendsCom:[p,f,S],extendsCom:P,extendsComName:"draw"})}}class Ie{constructor(e){var t=new Ae(e);return this._initCurrMeasure(e,t)}_initCurrMeasure(e,t){var i=new pe(t.viewer,e.cesiumGlobal),n=new ge(t.viewer,e.cesiumGlobal),e=new _e(t.viewer,e.cesiumGlobal);return{...t,attackArrowObj:i,straightArrowObj:n,pincerArrowObj:e}}}class Le extends be{constructor(e){return super({...e,baseExtendsCom:[p,P,K],extendsCom:ee,extendsComName:"analysis"})}}class De extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:H,extendsComName:"customCesiumPlugin"})}}class ke{constructor(e){return new De(e)}}class ze extends be{constructor(e){return super({...e,baseExtendsCom:[p,h],extendsCom:M,extendsComName:"passEffect"})}}class Re extends be{constructor(e){return super({...e,baseExtendsCom:[p,s],extendsCom:K,extendsComName:"plugin"})}}class Ge extends be{constructor(e){return super({...e,baseExtendsCom:[],extendsCom:xe,extendsComName:"threeJs"})}}class Oe extends be{constructor(e){return super({...e,baseExtendsCom:p,extendsCom:X,extendsComName:"control"})}}export{Le as Analysis,pe as AttackArrow,Oe as Control,ke as CustomCesiumPlugin,Ie as Draw,Me as Graphics,Te as Material,S as Math2d,f as Math3d,ze as PassEffect,_e as PincerArrow,Re as Plugin,Ee as Primitive,ge as StraightArrow,Ge as ThreeJs,Se as initCesium};
|