cesium_dev_kit 1.0.79 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var i=e(require("libgif")),n=require("dat.gui"),r=e(require("echarts"));let o=null;class a{constructor(e){o=e,this.init_data()}init_data(){this.viewer=null}init({containerId:e,viewerConfig:t,extraConfig:i,MapImageryList:n}){var r=new o.SingleTileImageryProvider({url:"https://mapv-data.oss-cn-hangzhou.aliyuncs.com/Cesium-1.82-hawk/background.png",tileWidth:256,tileHeight:256}),a={contextOptions:{webgl:{alpha:!1}},animation:!1,timeline:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,selectionIndicator:!1,shadow:!0,sceneMode:o.SceneMode.SCENE3D,infoBox:!1,sceneModePicker:!1,navigationHelpButton:!1,projectionPicker:!1,baseLayerPicker:!1,shouldAnimate:!0,navigation:!1,showRenderLoopErrors:!0},t=(o.Ion.defaultAccessToken=i.AccessToken||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmYzkwZWEwYy1mMmIwLTQwYjctOWJlOC00OWU4ZWU1YTZhOTkiLCJpZCI6MTIxODIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NjA0OTUyNDN9.wagvw7GxUjxvHXO6m2jjX5Jh9lN0UyTJhNGEcSm2pgE",a=Object.assign(a,t),new o.Viewer(e,a));if(0!==n.length){const e=this.setOneimageryProvider(n[0]);this.addImageLayerToScene(t,e)}else this.addImageLayerToScene(t,r);return i.logo||(t.cesiumWidget.creditContainer.style.display="none"),i.depthTest&&(t.scene.globe.depthTestAgainstTerrain=!0),this.setConfigMapList(t,n),this.removeJagged(t),this.viewer=t}setOneimageryProvider(e){var t;return e.classConfig.customTags&&(e.classConfig.customTags=(t="("+e.classConfig.customTags+")",new Function("return "+t)())),new o[e.type](e.classConfig)}addImageLayerToScene(e,t){e=e.imageryLayers,t=new o.ImageryLayer(t);e.add(t)}setConfigMapList(n,e){n.imageryLayers,e.some((e,t)=>{if(0===t)return!1;t=this.setOneimageryProvider(e);this.addImageLayerToScene(n,t)}),e.some((t,e)=>{const i=n.imageryLayers.get(e);t.interfaceConfig&&Object.getOwnPropertyNames(t.interfaceConfig).forEach(function(e){i[e]=t.interfaceConfig[e]}),i.invertColor=t.invertswitch,i.filterRGB=[255,255,255],"#000000"!==t.filterRGB&&"#ffffff"!==t.filterRGB&&(i.filterRGB=function(t){let i=t.toLowerCase();if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(i)){if(4===i.length){let t="#";for(let e=1;e<4;e+=1)t+=i.slice(e,e+1).concat(i.slice(e,e+1));i=t}const t=[];for(let e=1;e<7;e+=2)t.push(parseInt("0x"+i.slice(e,e+2)));return t}return[]}(t.filterRGB));e=t.offset.split(",");if(2===e.length)try{const n=[parseFloat(e[0]),parseFloat(e[1])];i._imageryProvider&&(i._imageryProvider._tilingScheme._rectangleNortheastInMeters.x+=n[0],i._imageryProvider._tilingScheme._rectangleNortheastInMeters.y+=n[1])}catch(e){console.log(e)}this.changeImageryProviderColors(n,i)})}removeJagged(t){if(t.scene.postProcessStages.fxaa.enabled=!1,t.scene.fxaa=!1,t.cesiumWidget._supportsImageRenderingPixelated){let e=window.devicePixelRatio;for(;2<=e;)e/=2;t.resolutionScale=e}}changeImageryProviderColors(e,i){var n=e.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<n.length;t++){var o=n[t],r="color = czm_saturation(color, textureSaturation);\n#endif\n";let e="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor&&(e=(e+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n ")+`
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var i=e(require("libgif")),n=require("dat.gui"),r=e(require("echarts"));let o=null;class a{constructor(e){o=e,this.init_data()}init_data(){this.viewer=null}init({containerId:e,viewerConfig:t,extraConfig:i,MapImageryList:n}){var r=new o.SingleTileImageryProvider({url:"https://mapv-data.oss-cn-hangzhou.aliyuncs.com/Cesium-1.82-hawk/background.png",tileWidth:256,tileHeight:256}),a={contextOptions:{webgl:{alpha:!1}},animation:!1,timeline:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,selectionIndicator:!1,shadow:!0,sceneMode:o.SceneMode.SCENE3D,infoBox:!1,sceneModePicker:!1,navigationHelpButton:!1,projectionPicker:!1,baseLayerPicker:!1,shouldAnimate:!0,navigation:!1,showRenderLoopErrors:!0},t=(o.Ion.defaultAccessToken=i.AccessToken||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmYzkwZWEwYy1mMmIwLTQwYjctOWJlOC00OWU4ZWU1YTZhOTkiLCJpZCI6MTIxODIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NjA0OTUyNDN9.wagvw7GxUjxvHXO6m2jjX5Jh9lN0UyTJhNGEcSm2pgE",a=Object.assign(a,t),new o.Viewer(e,a));if(0!==n.length){const e=this.setOneimageryProvider(n[0]);this.addImageLayerToScene(t,e)}else this.addImageLayerToScene(t,r);return i.logo||(t.cesiumWidget.creditContainer.style.display="none"),i.depthTest&&(t.scene.globe.depthTestAgainstTerrain=!0),this.setConfigMapList(t,n),this.removeJagged(t),this.viewer=t}setOneimageryProvider(e){var t;return e.classConfig.customTags&&(e.classConfig.customTags=(t="("+e.classConfig.customTags+")",new Function("return "+t)())),new o[e.type](e.classConfig)}addImageLayerToScene(e,t){e=e.imageryLayers,t=new o.ImageryLayer(t);e.add(t)}setConfigMapList(n,e){n.imageryLayers,e.some((e,t)=>{if(0===t)return!1;t=this.setOneimageryProvider(e);this.addImageLayerToScene(n,t)}),e.some((t,e)=>{const i=n.imageryLayers.get(e);t.interfaceConfig&&Object.getOwnPropertyNames(t.interfaceConfig).forEach(function(e){i[e]=t.interfaceConfig[e]}),i.invertColor=t.invertswitch,i.filterRGB=[255,255,255],"#000000"!==t.filterRGB&&"#ffffff"!==t.filterRGB&&(i.filterRGB=function(t){let i=t.toLowerCase();if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(i)){if(4===i.length){let t="#";for(let e=1;e<4;e+=1)t+=i.slice(e,e+1).concat(i.slice(e,e+1));i=t}const t=[];for(let e=1;e<7;e+=2)t.push(parseInt("0x"+i.slice(e,e+2)));return t}return[]}(t.filterRGB));e=t.offset.split(",");if(2===e.length)try{const n=[parseFloat(e[0]),parseFloat(e[1])];i._imageryProvider&&(i._imageryProvider._tilingScheme._rectangleNortheastInMeters.x+=n[0],i._imageryProvider._tilingScheme._rectangleNortheastInMeters.y+=n[1])}catch(e){console.log(e)}this.changeImageryProviderColors(n,i)})}removeJagged(t){if(t.scene.postProcessStages.fxaa.enabled=!1,t.scene.fxaa=!1,t.cesiumWidget._supportsImageRenderingPixelated){let e=window.devicePixelRatio;for(;2<=e;)e/=2;t.resolutionScale=e}}changeImageryProviderColors(e,i){var n=e.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<n.length;t++){var r=n[t],o="color = czm_saturation(color, textureSaturation);\n#endif\n";let e="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor&&(e=(e+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n ")+`
2
2
  color.r = color.r * ${i.filterRGB[0]}.0/255.0;
3
3
  color.g = color.g * ${i.filterRGB[1]}.0/255.0;
4
4
  color.b = color.b * ${i.filterRGB[2]}.0/255.0;
5
- `),-1!==o.indexOf(r)&&(n[t]=n[t].replace(r,e))}}getCurCenterlonLat(e){e=e.camera.pickEllipsoid(new o.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2)),e=o.Ellipsoid.WGS84.cartesianToCartographic(e);return{lon:180*e.longitude/Math.PI,lat:180*e.latitude/Math.PI}}}let s=null;function l(e,t,i){e&&(s=t,this._graphicsLayer=new s.CustomDataSource("graphicsLayer"),e)&&e.dataSources.add(this._graphicsLayer)}l.prototype={getPointGraphics:function(e){if(e=e||{})return new s.PointGraphics({color:e.color||s.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||s.Color.WHITE,outlineWidth:e.outlineWidth||1})},getLineGraphics:function(e){if((e=e||{})&&e.positions)return new s.PolylineGraphics({show:!0,positions:e.positions,material:e.material||s.Color.YELLOW,width:e.width||1,clampToGround:e.clampToGround||!1})},getPolygonGraphics:function(e){if((e=e||{})&&e.positions)return new s.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||s.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||!1})},getLabelGraphics:function(e){if((e=e||{})&&e.l_text)return new s.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||s.Color.GOLD,style:e.l_style||s.LabelStyle.FILL_AND_OUTLINE,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||!1,backgroundColor:e.l_backgroundColor||new s.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||s.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new s.Cartesian2(0,-30)})},getBillboardGraphics:function(e){if((e=e||{})&&e.b_img)return new s.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 s.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0})},getPathGraphics:function(e){if(e=e||{})return new s.PathGraphics({resolution:e.resolution||1,material:new s.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||s.Color.YELLOW}),width:e.width||30})},getModelGraphics:function(e){if(e=e||{})return new s.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:!0})},getEllipseGraphics:function(e){if(e=e||{})return new s.EllipseGraphics({semiMajorAxis:e.e_semiMinorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||s.Color.RED.withAlpha(.5),outline:e.e_outline||!0})},getEllipsoidGraphics:function(e){var t;if(e=e||{})return t=e.radii||1e6,new s.EllipsoidGraphics({radii:new s.Cartesian3(t,t,t),maximumCone:e.maximumCone||s.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||s.Color.YELLOW,outline:e.outline||!0,fill:e.fill||!0,material:e.material||s.Color.RED.withAlpha(.1)})},getBoxGraphics:function(e){if(e=e||{show:!0,outline:!1,fill:!0})return new s.BoxGraphics({show:e.show,fill:e.fill,dimensions:e.dimensions||new s.Cartesian3(0,0,0),material:e.material,outline:e.outline,outlineColor:e.outlineColor||s.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})},getPlaneGraphics:function(e){if(e=e||{})return new s.PlaneGraphics({plane:e.plane||new s.Plane(s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(170,130),material:e.material||s.Color.BLUE})},getCylinderGraphics:function(e){if(e=e||{})return new s.CylinderGraphics({HeightReference:s.HeightReference.RELATIVE_TO_GROUND,length:e.length||250,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new s.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=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 s.Scene.WarnLinkMaterialProperty({freely:"cross",color:s.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||s.Color.CHARTREUSE,width:e.width||5,clampToGround:e.clampToGround||!1},t.polyline.positions=new s.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 s.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime),e=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=s.Math.toDegrees(e.latitude),e=s.Math.toDegrees(e.longitude);return s.Cartesian3.fromDegrees(e,t,0)},!1),t.cylinder.length=new s.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 s.Scene.CircleFadeMaterialProperty({color:e.color||s.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:s.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new s.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=e.flog||!0,t.position=e.position,t.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new s.ColorMaterialProperty(new s.CallbackProperty(function(){return n?(i-=.05)<=0&&(n=!1):1<=(i+=.05)&&(n=!0),s.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,a=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 s.ImageMaterialProperty({image:i.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:!0});n.position=new s.CallbackProperty(function(){return o.transformWGS84ToCartesian(r)},!1),n.orientation=new s.CallbackProperty(function(){return s.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(r),new s.HeadingPitchRoll(s.Math.toRadians(0),s.Math.toRadians(0),s.Math.toRadians(0)))},!1);let e=a,t=!1;return n.ellipse={material:i,height:h,semiMajorAxis:new s.CallbackProperty(function(){return a},!1),semiMinorAxis:new s.CallbackProperty(function(){return a},!1),stRotation:new s.CallbackProperty(function(){return 0<l&&360<=(c+=l)&&(c=0),u&&((t=u<=a||a<=e?!t:t)?a+=2:a-=2),d&&(a<=d?a+=2:a=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||s.Color.RED,o=e.speed||.003,(r=this.createGraphics()).wall={positions:e.positions,material:new s.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:!0,color:new s.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.img||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 s.NearFarScalar(150,.7,15e6,.5),verticalOrigin:s.VerticalOrigin.BOTTOM,pixelOffset:t.b_pixelOffset||new s.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 s.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 s.Plane(s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(200,150),material:new s.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 s.Plane(e.normal||s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(200,150),material:new s.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(t)},createGifBillboardGraphics:function(e){var t,n,o,r,a,l,c;if(i&&e&&e.position)return n=e.url,o=0,r=n,a=t=[],(l=document.createElement("img")).src=r,l.setAttribute("rel:animated_src",r),l.setAttribute("rel:auto_play","0"),document.body.appendChild(l),c=new i({gif:l}),new Promise(e=>{c.load(()=>{for(let e=1;e<=c.get_length();e++)c.move_to(e),a.push(c.get_canvas().toDataURL());e(a)})}),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:s.VerticalOrigin.BASELINE,image:new s.CallbackProperty(function(){return t.length?(o<6*(t.length-1)?o++:o=0,t[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 s.CallbackProperty(function(){return o.transformWGS84ToCartesian(n)},!1),t.orientation=new s.CallbackProperty(function(){return 0<i&&(n.heading+=i,360===n.heading)&&(n.heading=0),s.Transforms.headingPitchRollQuaternion(o.transformWGS84ToCartesian(n),new s.HeadingPitchRoll(s.Math.toRadians(n.heading),s.Math.toRadians(n.pitch),s.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,a=e.speed||.06,l=this,c=n,h=!1;r.length?t.positions=new s.CallbackProperty(function(){var e,t=l.transformCartesianArrayToWGS84Array(r);for(e in t){var i=t[e];(h=o<=n||n<=c?!h:h)?n+=a:n-=a,i.alt=n}return l.transformWGS84ArrayToCartesianArray(t)},!1):t.position=new s.CallbackProperty(function(){var e=l.transformCartesianToWGS84(r);return(h=o<=n||n<=c?!h:h)?n+=a:n-=a,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 s.ImageMaterialProperty({image:new s.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:a="+"}){var l,c,h;if(e)return l=this.createGraphics(),c=0,h=this._calcPoints(t,i,n,c),l.wall={positions:new s.CallbackProperty(()=>s.Cartesian3.fromDegreesArrayHeights(h),!1),material:o||s.Color.AQUAMARINE.withAlpha(.5)},e.clock.onTick.addEventListener(()=>{0<r&&(c+=r,h=this._calcPoints(t,i,n,a+c))}),this._graphicsLayer.entities.add(l)},_computeCirclularFlight(t,i,n,o,r,a){var l=[],c=(l.push(t),l.push(i),l.push(0),s.Cartesian3.distance(s.Cartesian3.fromDegrees(t,i),s.Cartesian3.fromDegrees(n,o)));for(let e=r;e<=r+a;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},_calcPoints(e,t,i,n){var o=s.Transforms.eastNorthUpToFixedFrame(s.Cartesian3.fromDegrees(e,t)),r=i*Math.cos(n*Math.PI/180),i=i*Math.sin(n*Math.PI/180),n=s.Cartesian3.fromElements(r,i,0),r=s.Matrix4.multiplyByPoint(o,n,new s.Cartesian3),i=s.Cartographic.fromCartesian(r),o=s.Math.toDegrees(i.longitude),n=s.Math.toDegrees(i.latitude);return this._computeCirclularFlight(e,t,o,n,0,90)}};let c=null;function h(e,t,i){e&&(c=t,this._installMaterial())}function u(){}h.prototype={addMaterialLineGraphics:function(e){var t;if(this._viewer&&e&&e.image)return this._initPolylineCustomMaterialProperty(e),(t=this.createGraphics()).polyline={positions:e.positions,material:new c.PolylineCustomMaterialProperty({color:e.color||c.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=c.Color,t=c.defaultValue,n=c.defined,o=Object.defineProperties,r=c.Event,a=c.createPropertyDescriptor,s=c.Property,l=c.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||c.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)},l._materialCache.addMaterial(u,{fabric:{type:u,uniforms:{color:i.color||new c.Color(1,0,0,.5),image:i.image,time:i.color.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 this._initWallCustomMaterialProperty(e),(t=this.createGraphics()).wall={positions:e.positions,material:new c.Scene.WallLinkCustomMaterialProperty({color:e.color||c.Color.RED,duration:e.duration||500}),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=c.Color,t=c.defaultValue,o=c.defined,e=Object.defineProperties,r=c.Event,a=c.createPropertyDescriptor,s=c.Property,l=c.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)},l._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(c.Scene.WallLinkCustomMaterialProperty=u)(i)},_installMaterial:function(){this._installWaveCircleMaterial(),this._installCircleFadeMaterial(),this._installCityLineMaterial(),this._installWarnMaterial(),this._installFlowMaterial(),this._installPolylineTrailLinkMaterial()},_installWaveCircleMaterial:function(){var t=c.Color,i=c.defaultValue,e=Object.defineProperties,n=c.Event,o=c.Property,r=c.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&&c.Property.equals(this._color,e._color)},e(a.prototype,{color:c.createPropertyDescriptor("color"),duration:c.createPropertyDescriptor("duration")}),c.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=c.Color,t=c.defaultValue,i=Object.defineProperties,n=c.Event,o=c.Property,r=c.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&&c.Property.equals(this._color,e._color)},i(s.prototype,{color:c.createPropertyDescriptor("color")}),c.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=c.Color,t=c.defaultValue,i=c.defined,n=Object.defineProperties,o=c.Event,r=c.createPropertyDescriptor,a=c.Property,s=c.Material,l=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||c.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,l,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)},c.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=c.Color,t=c.defaultValue,n=c.defined,e=Object.defineProperties,o=c.Event,r=c.createPropertyDescriptor,a=c.Property,s=c.Material;function l(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(l.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),l.prototype.getType=function(){return s.WarnLinkType},l.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},l.prototype.equals=function(e){return this===e||e instanceof l&&a.equals(this._color,e._color)},e(l.prototype,{color:r("color")}),c.Scene.WarnLinkMaterialProperty=l,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=c.Color,i=c.defaultValue,e=Object.defineProperties,n=c.Event,o=c.createPropertyDescriptor,r=c.Property,a=c.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,c.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")}),c.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=c.Color,t=c.defaultValue,i=Object.defineProperties,n=c.createPropertyDescriptor,o=c.Event,r=c.Property,a=c.Material,s=this.getDfSt(["primitive","WaterPrimitive"]);function l(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this.color=e.color||c.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(l.prototype,{isConstant:{get:function(){return!1},configurable:!0},definitionChanged:{get:function(){return this._definitionChanged},configurable:!0},color:n("color"),duration:n("duration")}),l.prototype.getType=function(){return a.PolylineTrailLinkType},l.prototype.getValue=function(e,t){return(t=c.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},l.prototype.equals=function(e){return this===e||e instanceof l&&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 }",c.Scene.PolylineTrailLinkMaterial=l,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}})}},u.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 out vec4 myOutputColor;\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 myOutputColor = 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 myOutputColor = mix(myOutputColor, u_scanColor, f + f0);\n } else {\n myOutputColor = mix(myOutputColor, 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 out vec4 myOutputColor;\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 myOutputColor = 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 myOutputColor = mix(myOutputColor, u_scanColor, f);\n }\n }\n "}};let d={},p=void 0;function m(e,t,i){e&&(this._viewer=e,d=t,p=i,this._drawLayer=new d.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer),this.myname="BASE",this._installBaiduImageryProvider(),this._installGooGleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox())}m.prototype={createGraphics:function(){return new d.Entity},getDfSt(e){if(p)return e=e.reduce((e,t)=>(e||p)[t],void 0),p.baseService+e},setOneSkyBox:function(){return new d.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 d.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 d.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 d.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 d.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 d.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 d.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 d.Cartesian3(.1,.2,.3)}}}))},setBlurBloom:function(e){if(this._viewer&&e)return this._viewer.scene.postProcessStages.add(new d.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 d.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 d.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 d.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 d.Cartesian4(10,0,200,.3),fogColor:d.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 d.Cartesian3(0,e.distance,window.opt.distance),e.position=d.Cartesian3.add(e.position,t,new d.Cartesian3)),this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:d.Math.toRadians(90),pitch:d.Math.toRadians(90),roll:d.Math.toRadians(0)}}))},flyTo:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new d.Cartesian3(0,e.distance,e.distance),e.position=d.Cartesian3.add(e.position,t,new d.Cartesian3)),this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:d.Math.toRadians(90),pitch:d.Math.toRadians(90),roll:d.Math.toRadians(0)},easingFunction:e.easingFunction||d.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback}))},transformCartesianToWGS84:function(e){if(this._viewer&&e)return e=d.Ellipsoid.WGS84.cartesianToCartographic(e),{lng:d.Math.toDegrees(e.longitude),lat:d.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?d.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=t||e.alt,d.Ellipsoid.WGS84):d.Cartesian3.ZERO},transformCartesianArrayToWGS84Array:function(e){var t;if(this._viewer)return t=this,e?e.map(function(e){return t.transformCartesianToWGS84(e)}):[]},setCameraEotateHeading(l){if(l){let t=this._viewer,i=d.Cartesian3.fromDegrees(l.lng,l.lat,l.height),n=d.Math.toRadians(-30),o=12,r=5e3,e=d.JulianDate.fromDate(new Date),a=(t.clock.startTime=e.clone(),t.clock.currentTime=e.clone(),t.clock.clockRange=d.ClockRange.CLAMPED,t.clock.clockStep=d.ClockStep.SYSTEM_CLOCK,t.camera.heading),s=function(){var e=d.JulianDate.secondsDifference(t.clock.currentTime,t.clock.startTime),e=d.Math.toRadians(e*o)+a;t.scene.camera.setView({destination:i,orientation:{heading:e,pitch:n}}),t.scene.camera.moveBackward(r),0<=d.JulianDate.compare(t.clock.currentTime,t.clock.stopTime)&&t.clock.onTick.removeEventListener(s)};t.clock.onTick.addEventListener(s)}},transformWGS84ToCartographic:function(e){return e?d.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):d.Cartographic.ZERO},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 d.Cesium3DTileFeature?!0:r)&&(o=this._viewer.scene.pickPosition(e))&&((t=d.Cartographic.fromCartesian(o)).height<0&&(t.height=0),s=d.Math.toDegrees(t.longitude),i=d.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,u=this._viewer.scene.camera.pickEllipsoid(new d.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(u)return e=180*(u=d.Ellipsoid.WGS84.cartesianToCartographic(u)).longitude/Math.PI,u=180*u.latitude/Math.PI,n=this._viewer.camera._direction,t=d.Math.toDegrees(n.x),i=d.Math.toDegrees(n.y),n=d.Math.toDegrees(n.z),o=this._viewer.camera.positionCartographic.height,r=d.Math.toDegrees(this._viewer.camera.heading),a=d.Math.toDegrees(this._viewer.camera.pitch),s=d.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:u,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 d.Cartesian3(t,i,n)}}},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 d.ScreenSpaceEventHandler(this._viewer.canvas),t&&s.setInputAction(function(e){t(e,s)},d.ScreenSpaceEventType.LEFT_CLICK),i&&s.setInputAction(function(e){i(e,s)},d.ScreenSpaceEventType.MOUSE_MOVE),n&&s.setInputAction(function(e){n(e,s)},d.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),o&&s.setInputAction(function(e){o(e,s)},d.ScreenSpaceEventType.LEFT_DOWN),r&&s.setInputAction(function(e){r(e,s)},d.ScreenSpaceEventType.WHEEL),a)&&s.setInputAction(function(e){a(e,s)},d.ScreenSpaceEventType.LEFT_UP)},getHandelPosition:function(t){var i,n;this._viewer&&(i=new d.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)},d.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(){d.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 d.UrlTemplateImageryProvider(e)}},_installTdtImageryProvider:function(){d.Scene.TdtImageryProvider=function(e){return new d.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(){d.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 d.UrlTemplateImageryProvider(e)}},_installGooGleImageryProvider:function(){d.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 d.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 d.WebMercatorTilingScheme({rectangleSouthwestInMeters:new d.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new d.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 d.DeveloperError("tileWidth must not be called before the imagery provider is ready.")}},tileHeight:{get:function(){if(this.ready)return this._tileHeight;throw new d.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},maximumLevel:{get:function(){if(this.ready)return this._tileHeight;throw new d.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},minimumLevel:{get:function(){if(this.ready)return 0;throw new d.DeveloperError("minimumLevel must not be called before the imagery provider is ready.")}},tilingScheme:{get:function(){if(this.ready)return this._tilingScheme;throw new d.DeveloperError("tilingScheme must not be called before the imagery provider is ready.")}},rectangle:{get:function(){if(this.ready)return this._rectangle;throw new d.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),d.ImageryProvider.loadImage(this,r);throw new d.DeveloperError("requestImage must not be called before the imagery provider is ready.")},d.Scene.BaiduImageryProvider=e},_installGroundSkyBox:function(){var a=d.BoxGeometry,s=d.Cartesian3,t=d.defaultValue,l=d.defined,i=d.destroyObject,c=d.DeveloperError,h=d.GeometryPipeline,e=d.Matrix3,u=d.Matrix4,p=d.Transforms,m=d.VertexFormat,f=d.BufferUsage,g=d.CubeMap,n=d.DrawCommand,v=d.loadCubeMap,_=d.RenderState,y=d.VertexArray,w=d.BlendingState,C=d.SceneMode,P=d.ShaderProgram,x=d.ShaderSource;function o(e){this.sources=e.sources,this._sources=void 0,this.show=t(e.show,!0),this._command=new n({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}l(u.getRotation)||(u.getRotation=u.getMatrix3);var S=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?v(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 g({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 u.getRotation(r.modelMatrix,S)}},o=a.createGeometry(a.fromDimensions({dimensions:new s(2,2,2),vertexFormat:m.POSITION_ONLY})),e=this._attributeLocations=h.createAttributeLocations(o),r.vertexArray=y.fromGeometry({context:n,geometry:o,attributeLocations:e,bufferUsage:f._DRAW}),r.renderState=_.fromCache({blending:w.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)},d.Scene.GroundSkyBox=o},removeHandlerByName(e=[]){e.forEach(e=>{this._viewer.screenSpaceEventHandler.removeInputAction(d.ScreenSpaceEventType[e])})}};let f={};function g(e,t){e&&(this._viewer=e,f=t)}g.prototype={splitCartesians3:function(e){for(var t=[],i=0;i<e.length;i+=3){var n=new f.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=f.Cartographic.fromCartesian(e),a=f.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=f.Cartesian3.clone(e),u=f.Cartesian3.clone(t),d=f.Cartesian3.distance(h,f.Cartesian3.ZERO),p=f.Cartesian3.distance(u,f.Cartesian3.ZERO);if(f.Cartesian3.normalize(h,h),f.Cartesian3.normalize(u,u),0!=f.Cartesian3.distance(h,u)){var m=f.Cartesian3.angleBetween(h,u);o.push(e);for(var g=1;g<n-1;g++){var v=+g/(n-1),_=1-v,y=Math.sin(_*m)/Math.sin(m),w=Math.sin(v*m)/Math.sin(m),y=f.Cartesian3.multiplyByScalar(h,y,new f.Cartesian3),w=f.Cartesian3.multiplyByScalar(u,w,new f.Cartesian3),y=f.Cartesian3.add(y,w,new f.Cartesian3),w=v*Math.PI,_=d*_+p*v+Math.sin(w)*c,y=f.Cartesian3.multiplyByScalar(y,_,y);o.push(y)}o.push(t)}return o}},getPositionsAngle:function(e){var t,i,n,o;if(e)return i=e.position1,o=e.position2,n=f.Transforms.eastNorthUpToFixedFrame(i),n=f.Matrix4.inverse(n,new f.Matrix4),i=f.Matrix4.multiplyByPoint(n,i,new f.Cartesian3),n=f.Matrix4.multiplyByPoint(n,o,new f.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=f.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(e){if(this._viewer){for(var t=function(e,t){var i=e.lat*radiansPerDegree,e=e.lon*radiansPerDegree,n=t.lat*radiansPerDegree,t=t.lon*radiansPerDegree,i=-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 i<0&&(i+=2*Math.PI),i*degreesPerRadian},i=0,n=0;n<e.length-2;n++){var o=(n+1)%e.length,r=(n+2)%e.length,a=(a=e[n],s=e[o],l=e[r],c=void 0,(c=t(s,a)-t(s,l))<0&&(c+=360),c);i+=this.getPositionsDistance(positions[n],positions[o])*this.getPositionsDistance(positions[o],positions[r])*Math.abs(Math.sin(a))}return(i/1e6).toFixed(4)}var a,s,l,c},getPointDistance:function(e,t){var i;if(this._viewer)return e=f.Cartographic.fromCartesian(e),t=f.Cartographic.fromCartesian(t),(i=new f.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 f.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=f.Cartesian3.normalize(f.Cartesian3.subtract(t,e,new f.Cartesian3),new f.Cartesian3),e=new f.Ray(e,t),t=[],n?t=this._viewer.scene.drillPickFromRay(e,10,i):(n=this._viewer.scene.pickFromRay(e,i),f.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 f.Cartesian3,u=new f.Cartesian3,d=new f.Quaternion,p=new f.Matrix3,t=e+t,f.Cartesian3.multiplyByScalar(n,Math.cos(t),h),f.Cartesian3.multiplyByScalar(i,Math.sin(t),u),f.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,f.Quaternion.fromAxisAngle(h,t,d),f.Matrix3.fromQuaternion(d,p),f.Matrix3.multiplyByVector(p,l,c),f.Cartesian3.normalize(c,c),f.Cartesian3.multiplyByScalar(c,s,c),c},raisePositionsToHeight:function(e,t,i){if(this._viewer){for(var n=new f.Cartesian3,o=new f.Cartesian3,r=new f.Cartesian3,a=new f.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 m=p+1,g=p+2,v=f.Cartesian3.fromArray(e,p,n),_=(s.scaleToGeodeticSurface(v,v),f.Cartesian3.clone(v,o)),y=s.geodeticSurfaceNormal(v,a),w=f.Cartesian3.multiplyByScalar(y,l,r);f.Cartesian3.add(v,w,v),i&&(f.Cartesian3.multiplyByScalar(y,c,w),f.Cartesian3.add(_,w,_),h[p+d]=_.x,h[m+d]=_.y,h[g+d]=_.z),h[p]=v.x,h[m]=v.y,h[g]=v.z}return h}},computeEllipseEdgePositions:function(e){if(this._viewer){for(var t=new f.Cartesian3,i=new f.Cartesian3,n=new f.Cartesian3,o=new f.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=f.Cartesian3.magnitude(l),p=f.Cartesian3.normalize(l,t),m=f.Cartesian3.cross(f.Cartesian3.UNIT_Z,l,i),m=f.Cartesian3.normalize(m,m),g=f.Cartesian3.cross(p,m,n),v=Math.ceil(2*f.Math.PI/e),_=e,y=o,w=0,C=[],P=0;P<v;P++)y=this.getPointOnEllipsoid(P*_,s,g,m,c,u,h,d,p,y),C[w++]=y.x,C[w++]=y.y,C[w++]=y.z;a={};return a.numPts=v,a.outerPositions=C,a}},computeSectorEdgePositions:function(e){if(this._viewer){for(var t=new f.Cartesian3,i=new f.Cartesian3,n=new f.Cartesian3,o=new f.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=f.Cartesian3.magnitude(c),m=f.Cartesian3.normalize(c,t),g=f.Cartesian3.cross(f.Cartesian3.UNIT_Z,c,i),g=f.Cartesian3.normalize(g,g),v=f.Cartesian3.cross(m,g,n),_=Math.ceil(l/e),y=e,w=o,C=0,P=[],x=0;x<_;x++)w=this.getPointOnEllipsoid(x*y,s,v,g,h,d,u,p,m,w),P[C++]=w.x,P[C++]=w.y,P[C++]=w.z;a={};return a.numPts=_,a.outerPositions=P,a}},computeLonlatPointsTerrainData:function(e,t){if(this._viewer){for(var i=[],n=0;n<e.length;n++)i.push(f.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(f.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 f.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 f.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 f.Cartographic(c,h))}n.push(new f.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 f.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 f.Cartographic(c,h,u))}return i.push(new f.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 f.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 f.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 f.Cartographic(i,o,r)):null}};let v=null;function y(e,t,i){e&&(this._viewer=e,v=t,this._installPrimitives())}y.prototype={_installPrimitives:function(){this._installProbingPrimitive(),this._installTexturePrimitive(),this._installWaterPrimitive(),this._installPointsPrimitive(),this._installShadowPrimitive(),this._installArrowPolylinePrimitive(),this._installXyzAxisPrimitive(),this._installTetrahedronPrimitive(),this._installCustomPrimitive()},_installCustomPrimitive:function(){},_installTetrahedronPrimitive:function(){try{var i=v.Cartesian3,n=v.ComponentDatatype,a=v.PrimitiveType,o=v.BoundingSphere,r=v.GeometryAttribute,s=v.GeometryPipeline,l=v.Geometry,c=v.defined,h=v.RenderState,u=v.ShaderSource,d=v.ShaderProgram,p=v.DrawCommand,m=v.Pass,f=v.Appearance,g=v.BufferUsage,t=v.Color,_=v.VertexArray,y=(v.buildModuleUrl,v.Matrix4),w=v.Matrix3,C=v.Texture,e=v.Resource,P=v.Transforms,x=v.defaultValue,S=this._viewer,M=this.getDfSt(["primitive","TetrahedronPrimitive"])||"static/data/images/Textures/fence.png",b=function(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=x(e.distance,1),this._setInterval=void 0,this._viewer=S,this._speed=x(e.speed,1),this._color=x(e.color,new t(1,1,0,.8)),this._scale=x(e.scale,new i(10,10,15)),this._texture=void 0,this._imageUrl=M,this._modelMatrix=R(this),this._height=k(this),D(this)};b.prototype.update=function(e){this.show&&(c(this._command)||(this._command=this._createCommand(e.context,this)),c(this._command))&&e.commandList.push(this._command)},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){return c(this._command)&&(this._command.shaderProgram=this._command.shaderProgram&&this._command.shaderProgram.destroy()),destroyObject(this)},b.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 v.Cartesian3(0,0,t._height),e=(y.multiplyByTranslation(t._modelMatrix,e,t._modelMatrix),y.fromRotationTranslation(w.fromRotationZ(v.Math.toRadians(t._speed))));y.multiply(t._modelMatrix,e,t._modelMatrix)},5)},b.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:E(e),primitiveType:a.TRIANGLES,renderState:o,shaderProgram:i,uniformMap:r,owner:this,pass:m.TRANSLUCENT,modelMatrix:t._modelMatrix})},E=function(e){var t=A(),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 _.fromGeometry({context:e,geometry:t,attributeLocations:{position:0,textureCoordinates:1},bufferUsage:g.STATIC_DRAW})},A=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){e.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=P.eastNorthUpToFixedFrame(e._localPosition),i=y.fromScale(e._scale),n=y.multiply(t,i,new y);return e._scaleMatrix=i,e._enuMatrix=t,n},k=function(e){var t=i.fromElements(0,0,e._distance,new v.Cartesian3),t=v.Matrix4.multiplyByPoint(e._enuMatrix,t,new i),t=y.multiplyByPoint(e._viewer.scene.camera._viewMatrix,t,new i),e=y.multiplyByPoint(e._viewer.scene.camera.frustum.projectionMatrix,t,new i);return i.normalize(e,new i).z};v.Scene.TetrahedronPrimitive=b}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 v.CustomDataSource("xyz-axis"),this._viewer.dataSources.add(this._layer),this._handler=new v.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=v.Matrix4.getTranslation(e.modelMatrix,new v.Cartesian3),e=e.boundingSphere,i=e.radius,n=new v.ArrowPolylinePrimitive({id:"axisZ",color:v.Color.RED,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),o=new v.ArrowPolylinePrimitive({id:"axisX",color:v.Color.GREEN,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),t=new v.ArrowPolylinePrimitive({id:"axisY",color:v.Color.BLUE,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),i=v.Matrix3.fromRotationY(v.Math.toRadians(90)),i=(this._rotationX=v.Matrix4.fromRotationTranslation(i),v.Matrix4.multiply(o.geometryInstances[0].modelMatrix,this._rotationX,o.geometryInstances[0].modelMatrix),v.Matrix4.multiply(o.geometryInstances[1].modelMatrix,this._rotationX,o.geometryInstances[1].modelMatrix),v.Matrix3.fromRotationX(v.Math.toRadians(90)));this._rotationY=v.Matrix4.fromRotationTranslation(i),v.Matrix4.multiply(t.geometryInstances[0].modelMatrix,this._rotationY,t.geometryInstances[0].modelMatrix),v.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(v.Math.toRadians(e)),n=Math.cos(v.Math.toRadians(e)),o=this._radius*n,r=this._radius*i;t.push(new v.Cartesian3(o,r,0))}var e=this._createAxisSpheres("axisSphereZ",t,this._matrix,v.Color.RED);this._layer._primitives.add(e);const i=this._createAxisSpheres("axisSphereY",t,this._matrix,v.Color.GREEN),n=(this._layer._primitives.add(i),v.Matrix4.multiply(i.geometryInstances.modelMatrix,this._rotationY,i.geometryInstances.modelMatrix),this._createAxisSpheres("axisSphereX",t,this._matrix,v.Color.BLUE));this._layer._primitives.add(n),v.Matrix4.multiply(n.geometryInstances.modelMatrix,this._rotationX,n.geometryInstances.modelMatrix)},_createAxisSpheres:function(e,t,i,n){t=new v.PolylineGeometry({positions:t,width:10}),t=new v.GeometryInstance({geometry:t,id:e,attributes:{color:v.ColorGeometryInstanceAttribute.fromColor(n)}});return new v.Primitive({geometryInstances:t,appearance:new v.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=v.Matrix4.fromTranslation(new v.Cartesian3(i.x,i.y,i.z));v.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=v.Matrix4.fromTranslation(new v.Cartesian3(i.x,i.y,i.z));v.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=v.Matrix4.fromRotationTranslation(i);v.Matrix4.multiply(o.modelMatrix,r,o.modelMatrix)}}var e=v.Matrix4.fromRotationTranslation(i);v.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(v.Matrix3.fromRotationX(v.Math.toRadians(1)));break;case"axisSphereY":this._updateAxisSphere(v.Matrix3.fromRotationY(v.Math.toRadians(1)));break;case"axisSphereZ":this._updateAxisSphere(v.Matrix3.fromRotationZ(v.Math.toRadians(1)))}},v.ScreenSpaceEventType.MOUSE_MOVE),this._handler.setInputAction(e=>{e=viewer.scene.pick(e.position);e&&e.id&&(this._xyzPid=e.id,this._xyzState=!0)},v.ScreenSpaceEventType.LEFT_DOWN),this._handler.setInputAction(()=>{this._xyzState=!1,this._xyzPid=void 0},v.ScreenSpaceEventType.LEFT_UP)}},v.Scene.XyzAxisPrimitive=e},_installArrowPolylinePrimitive:function(){v.Scene.ArrowPolylinePrimitive=function(e={}){this._color=e.color||v.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=v.CylinderGeometry.createGeometry(new v.CylinderGeometry({length:this._length,topRadius:this._width,bottomRadius:this._width})),i=v.CylinderGeometry.createGeometry(new v.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 v.Cartesian3;r.length?(a.x=r[0],a.y=r[1],a.z=r[2]):v.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 v.Primitive({modelMatrix:v.Transforms.eastNorthUpToFixedFrame(this.position),geometryInstances:[new v.GeometryInstance({id:e+"-line",geometry:t}),new v.GeometryInstance({id:e+"-arrow",geometry:i})],appearance:new v.MaterialAppearance({material:v.Material.fromType("Color",{color:this._color})})})}},_installShadowPrimitive:function(){function e(e){var t=(e=v.defaultValue(e,v.defaultValue.EMPTY_OBJECT)).scene;if(!v.defined(t))throw new v.DeveloperError("scene is required.");var i=(this._scene=t)._context;if(!v.defined(i))throw new v.DeveloperError("context is required.");if(!v.defined(e.viewerPosition))throw new v.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 v.Camera(t),this._depthCamera.position=this._viewerPosition,this._direction=0,this._pitch=0,this._horizontalFov=v.defaultValue(e.horizontalFov,60),this._verticalFov=v.defaultValue(e.verticalFov,45),this._cameraUpdated=!1,this._targetPoint=this._viewerPosition.clone();t=new v.Cartesian3(0,0,100),e=v.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);v.Matrix4.multiplyByPoint(e,t,this._targetPoint),this._distance=100,this._cameraUpdated=!1,this._modelMatrix=new v.Matrix4,this._shadowMap=new v.ShadowMap({context:i,enabled:!0,lightCamera:this._depthCamera,cascadesEnabled:!1}),this.show=!0,this._invisiblyColor=v.Color.RED,this._visiblyColor=v.Color.GREEN,this._shadowMap.useCustomColor=!0,this.shadowMap._customColor={invisibly:v.Color.RED,visibly:v.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&&!v.defined(this.debugLightFrustum)&&(this._debugLightFrustum=new v.DebugCameraPrimitive({camera:this._depthCamera,color:v.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=v.Math.toRadians(Math.max(this._horizontalFov,this._verticalFov)),this._depthCamera.frustum.aspectRatio=this._horizontalFov/this._verticalFov,this._depthCamera.setView({destination:this._viewerPosition,orientation:{heading:v.Math.toRadians(this._direction),pitch:v.Math.toRadians(this._pitch)}}),this._modelMatrix=this._depthCamera.inverseViewMatrix,this._cameraUpdated=!0},e.prototype.setPoseByTargetPoint=function(e){this.distance=v.Cartesian3.distance(this._viewerPosition,e);var t=new v.Cartesian3,i=v.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);v.Matrix4.inverse(i,i),v.Matrix4.multiplyByPoint(i,e,t),v.Cartesian3.normalize(t,t),this.direction=v.Math.toDegrees(Math.atan2(t.x,t.y)),this.pitch=v.Math.toDegrees(Math.asin(t.z))},e.prototype._updateHintLine=function(e){var t,i=this._positions,n=v.Math.toRadians(this._horizontalFov),o=v.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 v.Cartesian3(a,o,-this._distance),o=new v.Cartesian3(r,t,0),r=(v.Matrix4.multiplyByPoint(this._modelMatrix,a,a),v.Matrix4.multiplyByPoint(this._modelMatrix,o,o),v.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=-(y=Math.atan(p)),f=y/10,g=0;g<21;++g)l=m+g*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,_=0;_<21;++_){d=c+_*h;for(var y,p=t/(this._distance/Math.cos(d)),m=-(y=Math.atan(p)),f=y/2,w=0;w<5;++w)l=m+w*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=v.Buffer.createIndexBuffer({context:P,typedArray:new Uint32Array(this._indices),usage:v.BufferUsage.STATIC_DRAW,indexDatatype:IndexDatatype.UNSIGNED_INT}),o=v.Buffer.createVertexBuffer({context:P,typedArray:v.ComponentDatatype.createTypedArray(v.ComponentDatatype.FLOAT,this._positions),usage:v.BufferUsage.STATIC_DRAW}),n=[],e=(n.push({index:0,vertexBuffer:o,componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1}),new v.VertexArray({context:P,attributes:n,indexBuffer:a}));v.defined(this._drawLineCommand)?(this._drawLineCommand.vertexArray.destroy(),this._drawLineCommand.vertexArray=e,this._drawLineCommand.modelMatrix=this._modelMatrix,this._drawLineCommand.boundingVolume=r):(o=v.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=v.RenderState.fromCache({depthTest:{enabled:!0}}),a={u_bgColor:function(){return C._lineColor},u_modelViewMatrix:function(){return P.uniformState.modelView}},(C=this)._drawLineCommand=new v.DrawCommand({boundingVolume:r,modelMatrix:C._modelMatrix,primitiveType:v.PrimitiveType.LINES,vertexArray:e,shaderProgram:o,castShadows:!1,receiveShadows:!1,uniformMap:a,renderState:n,pass:v.Pass.OPAQUE})),this._hintLineUpdated=!0}else this._valid=!1},v.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=v.Cartesian3.fromDegrees(0,0,-10),l=v.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 v.Primitive({geometryInstances:new v.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 v.Appearance({renderState:{blending:v.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:e,vertexShaderSource:t})},createGeometry:function(e,t,i){return new v.Geometry({attributes:{position:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),color:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:4,values:t})},indices:i,primitiveType:v.PrimitiveType.POINTS,boundingSphere:v.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 v.Primitive({geometryInstances:new v.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 v.Primitive({geometryInstances:new v.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}}},v.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 v.Primitive({allowPicking:!1,geometryInstances:new v.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createAppearence=function(){return new v.EllipsoidSurfaceAppearance({material:new v.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 v.PolygonGeometry({polygonHierarchy:new v.PolygonHierarchy(v.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 "},y.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 v.Primitive({allowPicking:!1,geometryInstances:new v.GeometryInstance({geometry:e}),appearance:this._appearance,asynchronous:!1})))},v.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 v.Primitive({geometryInstances:new v.GeometryInstance({geometry:this._geometry,id:this._id}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createGeometry=function(){var e=new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:this._sts});return new v.Geometry({attributes:{position:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:this._positions}),st:e},indices:this._indices,primitiveType:v.PrimitiveType.TRIANGLES,boundingSphere:v.BoundingSphere.fromVertices(positions)})},e.prototype._createAppearence=function(){return new v.Appearance({material:new v.Material({fabric:{uniforms:{image:this._url},source:this._materialShader}}),aboveGround:!0,faceForward:!0,flat:!0,translucent:!1,renderState:{blending:v.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; } "},v.Scene.TexturePrimitive=e},_installProbingPrimitive:function(){var t={color:new v.Color(1,0,1,.8),repeat:30,offset:0,thickness:.3,center:v.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 v.CylinderGeometry({length:this._length,topRadius:this._top,bottomRadius:this._bottom,vertexFormat:v.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat}),e=new v.GeometryInstance({geometry:e,modelMatrix:this.getModelMatrix()}),t=new v.MaterialAppearance({material:this.getMaterial(),faceForward:!1,closed:!0}),i=this;this._radar=this._viewer.scene.primitives.add(new v.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 v.Matrix4.multiplyByTranslation(v.Transforms.eastNorthUpToFixedFrame(this._center),new v.Cartesian3(0,0,.5*this._length),new v.Matrix4)},e.prototype.updateModelMatrix=function(){},e.prototype.getMaterial=function(){return new v.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)},v.Scene.ProbingPrimitive=e}};let _=null,w=null;function C(e,t,i){e&&(_=t,this._drawLayer=new _.CustomDataSource("drawLayer"),this.$graphics=new l(e,t),e)&&e.dataSources.add(this._drawLayer)}C.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 _.Cartesian2(0,-20)},this._viewer&&t&&(e=new _.Entity,o=[],r=this,a=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas),(w=a).setInputAction(function(e){e=r._viewer.scene.camera.pickEllipsoid(e.position,r._viewer.scene.globe.ellipsoid);e&&e.x&&(i=e,o.push(e))},_.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){a.destroy(),a=null,"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(o),n)},_.ScreenSpaceEventType.RIGHT_CLICK),e.billboard=t.style,e.position=new _.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 _.Entity,o=this,r=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);(w=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))},_.ScreenSpaceEventType.LEFT_CLICK),r.setInputAction(function(e){e=o.getCatesian3FromPX(e.endPosition);2<=n.length&&e&&e.x&&(n.pop(),n.push(e))},_.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(function(e){r.destroy(),r=null;e=o.getCatesian3FromPX(e.position);t.measure&&a(e),"function"==typeof t.callback&&t.callback(o.transformCartesianArrayToWGS84Array(n),i)},_.ScreenSpaceEventType.RIGHT_CLICK),e.polyline={width:t.width||5,material:t.material||_.Color.BLUE.withAlpha(.8),clampToGround:t.clampToGround||!1,clampToS3M:t.clampToS3M||!1},e.polyline.positions=new _.CallbackProperty(function(){return n},!1),i=this._drawLayer.entities.add(e);const a=function(e){var t=new _.Entity;t.position=e,t.point={pixelSize:10,outlineColor:_.Color.BLUE,outlineWidth:5},t.label={text:(o.getPositionDistance(o.transformCartesianArrayToWGS84Array(n))/1e3).toFixed(4)+"公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,-80)},o._drawLayer.entities.add(t)}}},drawPolygonGraphics:function(i){if((i=i||{}).style=i.style||{width:3,material:_.Color.BLUE.withAlpha(.8),clampToGround:!0},this._viewer&&i){var n=[],t=new _.PolygonHierarchy,o=new _.Entity,r=this,a=null,s=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=s;s.setInputAction(function(e){e=r.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&(t.positions.push(e.clone()),n.push(e.clone())),n.push(e.clone()),t.positions.push(e.clone()),a||(o.polyline=i.style,o.polyline.positions=new _.CallbackProperty(function(){return n},!1),o.polygon={hierarchy:new _.CallbackProperty(function(){return t},!1),material:_.Color.WHITE.withAlpha(.1),clampToGround:i.clampToGround||!1},o.clampToS3M=!0,a=r._drawLayer.entities.add(o)))},_.ScreenSpaceEventType.LEFT_CLICK),s.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);2<=n.length&&e&&e.x&&(n.pop(),n.push(e),t.positions.pop(),t.positions.push(e))},_.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(function(){var e,t;s.destroy(),n.push(n[0]),i.height&&(o.polygon.extrudedHeight=i.height,o.polygon.material=_.Color.BLUE.withAlpha(.5)),i.measure&&(e=n[0],(t=new _.Entity).position=e,t.point={pixelSize:10,outlineColor:_.Color.BLUE,outlineWidth:5},t.label={text:(r.getPositionsArea(r.transformCartesianArrayToWGS84Array(n))/1e6).toFixed(4)+"平方公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,-50)},r._drawLayer.entities.add(t)),"function"==typeof i.callback&&i.callback(r.transformCartesianArrayToWGS84Array(n),a)},_.ScreenSpaceEventType.RIGHT_CLICK)}},drawRectangleGraphics:function(t){var i,n,e,o,r,a;(t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t&&(n=[],e=new _.Entity,o=new _.Rectangle,r=this,a=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas),(w=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=_.Rectangle.fromCartesianArray([...n,e],_.Ellipsoid.WGS84),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(n),i)))},_.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);e&&(o=_.Rectangle.fromCartesianArray([...n,e],_.Ellipsoid.WGS84))},_.ScreenSpaceEventType.MOUSE_MOVE),e.rectangle=t.style,t.height&&(e.rectangle.extrudedHeight=t.height),e.rectangle.coordinates=new _.CallbackProperty(function(){return o},!1),i=this._drawLayer.entities.add(e))},drawCircleGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t){var i,n=void 0,o=new _.Entity,r=this,a=1,s=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=s;const l=function(e,t){var e=_.Cartographic.fromCartesian(e),t=_.Cartographic.fromCartesian(t),i=new _.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);e&&e.x&&(n?(l(n,e),s.destroy(),"function"==typeof t.callback&&t.callback({center:n,radius:a},i)):(n=e,o.ellipse=t.style,o.ellipse.semiMajorAxis=new _.CallbackProperty(function(){return a},!1),o.ellipse.semiMinorAxis=new _.CallbackProperty(function(){return a},!1),o.position=new _.CallbackProperty(function(){return n},!1),o.point={pixelSize:5,outlineColor:_.Color.RED,outlineWidth:3},t.height&&(o.ellipse.extrudedHeight=t.height),i=r._drawLayer.entities.add(o)))},_.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)},_.ScreenSpaceEventType.MOUSE_MOVE)}},drawTrianglesGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5)},this._viewer&&t){var i=new _.Entity,n=new _.Entity,o=new _.Entity,r=[],a=[],s=[],l=this,c=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=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}))},_.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=_.Cartographic.fromCartesian(t[0]),t=_.Cartographic.fromCartesian(t[1]),i=_.Cartesian3.fromDegrees(_.Math.toDegrees(i.longitude),_.Math.toDegrees(i.latitude),t.height),a.pop(),a.push(i.clone()),s.pop(),s.pop(),s.push(e.clone()),s.push(i.clone()))},_.ScreenSpaceEventType.MOUSE_MOVE),i.polyline={positions:new _.CallbackProperty(function(){return r},!1),...t.style},i.position=new _.CallbackProperty(function(){return r[0]},!1),i.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},i.label={text:new _.CallbackProperty(function(){return"直线:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(r))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(50,-100)},n.polyline={positions:new _.CallbackProperty(function(){return a},!1),...t.style},n.position=new _.CallbackProperty(function(){return s[1]},!1),n.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},n.label={text:new _.CallbackProperty(function(){return"高度:"+(t=a[1],!(e=a[0])&&!t||_.Cartesian3.equals(e,t)?0:(e=_.Cartographic.fromCartesian(e),(_.Cartographic.fromCartesian(t).height-e.height).toFixed(2)))+"米";var e,t},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,100)},o.polyline={positions:new _.CallbackProperty(function(){return s},!1),...t.style},o.position=new _.CallbackProperty(function(){return r[1]},!1),o.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},o.label={text:new _.CallbackProperty(function(){return"水平距离:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(s))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-150,-20)},this._drawLayer.entities.add(o),this._drawLayer.entities.add(n),this._drawLayer.entities.add(i)}},drawWallGraphics:function(n){var o;(n=n||{}).style=n.style||{material:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.Color.WHITE},this._viewer&&n&&(o=this).drawPolygonGraphics({callback:function(e,t){var i=o._drawLayer.entities.add({wall:{positions:o.transformWGS84ArrayToCartesianArray(e),...n.style}});"function"==typeof n.callback&&n.callback(e,i)}})},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)}})},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:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.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:_.CornerType.BEVELED,extrudedHeight:n.extrudedHeight||1,material:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.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:_.CornerType.MITERED,material:o.color||_.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(){w&&(w.removeInputAction(_.ScreenSpaceEventType.MOUSE_MOVE),w.removeInputAction(_.ScreenSpaceEventType.RIGHT_CLICK),w.removeInputAction(_.ScreenSpaceEventType.LEFT_CLICK))}};let P={};function x(e,t){e&&(this._viewer=e,P=t)}x.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 P.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=P.Math.toRadians(e);i.push(new P.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,f;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],f=a[1]-e[1],c=e[0]+(u*u-d*d)*m+p*f,e[1]+p*m+(d*d-u*u)*f):(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 S=null;function M(e,t){e&&(this._viewer=e,S=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||S.Color.RED,o=e.duration||1500,r=this,a=e.circleMode||"CircleScan",e=e.border||4,u=l,s=new S.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 S.Cartesian4(l.x,l.y,l.z,1),h=(new Date).getTime(),u=new S.PostProcessStage({name:t,fragmentShader:this._getCircleScanShader({get:!0,border:e}),uniforms:{u_scanCenterEC:function(){return S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new S.Cartesian4)},u_scanPlaneNormalEC:function(){var e=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,new S.Cartesian4),t=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,c,new S.Cartesian4),i=new S.Cartesian3;return i.x=t.x-e.x,i.y=t.y-e.y,i.z=t.z-e.z,S.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,f,g,v,_,y;if(e&&e.position)return t=e.id||"radarScan"+parseInt(1e3*Math.random()),c=e.position,i=e.radius,n=e.color||S.Color.RED,o=e.duration||1500,r=this,a=e.border||1,e=e.width||3,y=c,s=new S.Cartesian4(y.x,y.y,y.z,1),y=this.transformCartesianToWGS84(c),c=this.transformWGS84ToCartesian({lng:y.lng,lat:y.lat,alt:y.alt+500}),l=new S.Cartesian4(c.x,c.y,c.z,1),c=this.transformWGS84ToCartesian({lng:y.lng+.001,lat:y.lat,alt:y.alt}),h=new S.Cartesian4(c.x,c.y,c.z,1),u=(new Date).getTime(),d=new S.Quaternion,p=new S.Matrix3,m=new S.Cartesian4,f=new S.Cartesian4,g=new S.Cartesian4,v=new S.Cartesian3,_=new S.Cartesian3,y=new S.PostProcessStage({name:t,fragmentShader:this._getRadarScanShader({border:a,width:e,get:!0}),uniforms:{u_scanCenterEC:function(){return S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m)},u_scanPlaneNormalEC:function(){var e=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,f);return v.x=t.x-e.x,v.y=t.y-e.y,v.z=t.z-e.z,S.Cartesian3.normalize(v,v),v},u_scanLineNormalEC:function(){var e=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,s,m),t=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,l,f),i=S.Matrix4.multiplyByVector(r._viewer.camera._viewMatrix,h,g),t=(v.x=t.x-e.x,v.y=t.y-e.y,v.z=t.z-e.z,S.Cartesian3.normalize(v,v),_.x=i.x-e.x,_.y=i.y-e.y,_.z=i.z-e.z,((new Date).getTime()-u)%o/o);return S.Quaternion.fromAxisAngle(v,t*S.Math.PI*2,d),S.Matrix3.fromQuaternion(d,p),S.Matrix3.multiplyByVector(p,_,_),S.Cartesian3.normalize(_,_),_},u_radius:i,u_scanColor:n}}),this._viewer.scene.postProcessStages.add(y),y},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 S.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 S.PolygonHierarchy(S.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 S.PolygonHierarchy(S.Cartesian3.fromDegreesArrayHeights([o,r,a,i[e].x,i[e].y,0,i[0].x,i[0].y,0])):new S.PolygonHierarchy(S.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}};const b="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}",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}",A='#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 E={};function I(t){var P=(E=t).BoundingSphere,x=E.Cartesian3,i=E.Color,d=E.combine,S=E.ComponentDatatype,n=E.defaultValue,o=E.defined,M=(E.destroyObject,E.DeveloperError),I=E.Matrix4,r=E.PrimitiveType,L=E.Buffer,D=E.BufferUsage,a=E.DrawCommand,R=E.Pass,k=E.RenderState,z=E.ShaderProgram,G=E.ShaderSource,F=E.VertexArray,O=E.BlendingState,B=E.CullFace,s=E.Material,$=E.SceneMode,V=E.VertexFormat,H=E.Math,W=E.Matrix3,U=(I=E.Matrix4,E.JulianDate),u=(E.BoxGeometry,E.EllipsoidGeometry,Math.sin),N=Math.cos,q=Math.tan,j=Math.atan,Y={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=I.clone(e.modelMatrix,new I),this._modelMatrix=new I,this._computedModelMatrix=new I,this._computedScanPlaneModelMatrix=new I,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=U.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===$.SCENE3D){var r=!1,a=!1,s=!1,l=this.xHalfAngle,c=this.yHalfAngle;if(l<0||c<0)throw new M("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 M("this.radius must be greater than or equal to zero.");var u,d,p,m,f=!1,h=(this._radius!==h&&(f=!0,this._radius=h,this._boundingSphere=new P(x.ZERO,this.radius)),I.equals(this.modelMatrix,this._modelMatrix)&&!f||(I.clone(this.modelMatrix,this._modelMatrix),I.multiplyByUniformScale(this.modelMatrix,this.radius,this._computedModelMatrix),P.transform(this._boundingSphere,this.modelMatrix,this._boundingSphereWC)),this.showThroughEllipsoid),f=(this._showThroughEllipsoid!==this.showThroughEllipsoid&&(this._showThroughEllipsoid=h,a=!0),this.material),g=(this._material!==f&&(this._material=f,s=a=!0),f.isTranslucent()),v=(this._translucent!==g&&(this._translucent=g,a=!0),this.showScanPlane&&(m=e.time,(p=U.secondsDifference(m,this._time))<0&&(this._time=U.clone(m,this._time)),m=Math.max(p%this.scanPlaneRate/this.scanPlaneRate,0),"horizontal"==this.scanPlaneMode?(p=N(u=2*c*m-c),d=q(l),p=j(p*d),this._scanePlaneXHalfAngle=p,this._scanePlaneYHalfAngle=u,E.Matrix3.fromRotationX(this._scanePlaneYHalfAngle,J)):(u=2*l*m-l,d=q(c),p=N(u),m=j(p*d),this._scanePlaneXHalfAngle=u,this._scanePlaneYHalfAngle=m,E.Matrix3.fromRotationY(this._scanePlaneXHalfAngle,J)),E.Matrix4.multiplyByMatrix3(this.modelMatrix,J,this._computedScanPlaneModelMatrix),I.multiplyByUniformScale(this._computedScanPlaneModelMatrix,this.radius,this._computedScanPlaneModelMatrix)),r&&(l=this,c=e.context,p=Z(l,l.xHalfAngle,l.yHalfAngle),d=l.xHalfAngle,u=l.yHalfAngle,m=p.zoy,p=p.zox,r=[],n=W.fromRotationY(d,J),r.push(m.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)})),n=W.fromRotationX(-u,J),r.push(p.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)}).reverse()),n=W.fromRotationY(-d,J),r.push(m.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)}).reverse()),n=W.fromRotationX(u,J),r.push(p.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)})),d=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:D.STATIC_DRAW}),u=6*Float32Array.BYTES_PER_ELEMENT,h=[{index:Y.position,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:u},{index:Y.normal,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:3*Float32Array.BYTES_PER_ELEMENT,strideInBytes:u}];return new F({context:e,attributes:h})}(c,d)),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:D.STATIC_DRAW}),l=3*Float32Array.BYTES_PER_ELEMENT,s=[{index:Y.position,vertexBuffer:s,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:l}];return new F({context:e,attributes:s})}(c,d)),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:D.STATIC_DRAW}),h=3*Float32Array.BYTES_PER_ELEMENT,c=[{index:Y.position,vertexBuffer:c,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:h}];return new F({context:e,attributes:c})}(c,d)),l.showDomeSurfaces&&(l._domeVA=(m=c,u=E.EllipsoidGeometry.createGeometry(new E.EllipsoidGeometry({vertexFormat:V.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),F.fromGeometry({context:m,geometry:u,attributeLocations:Y,bufferUsage:D.STATIC_DRAW,interleave:!1}))),l.showDomeLines&&(l._domeLineVA=(p=c,r=E.EllipsoidOutlineGeometry.createGeometry(new E.EllipsoidOutlineGeometry({vertexFormat:V.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),F.fromGeometry({context:p,geometry:r,attributeLocations:Y,bufferUsage:D.STATIC_DRAW,interleave:!1}))),l.showScanPlane)&&("horizontal"==l.scanPlaneMode?(o=Z(l,H.PI_OVER_TWO,0),l._scanPlaneVA=Q(c,o.zox)):(o=Z(l,0,H.PI_OVER_TWO),l._scanPlaneVA=Q(c,o.zoy))),a&&(r=this,l=h,g?(r._frontFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:B.BACK}}),r._backFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:B.FRONT}}),r._pickRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND})):(r._frontFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!0}),r._pickRS=k.fromCache({depthTest:{enabled:!0},depthMask:!0}))),s&&(o=c=this,l=h=f,f=(r=e).context,t=b,i=new G({sources:[T,l.shaderSource,A]}),o._sp=z.replaceCache({context:f,shaderProgram:o._sp,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:Y}),i=new G({sources:[T,l.shaderSource,A],pickColorQualifier:"uniform"}),o._pickSP=z.replaceCache({context:f,shaderProgram:o._pickSP,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:Y}),c.showScanPlane)&&(l=c,f=h,o=r.context,f=new G({sources:[T,f.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=z.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:f,attributeLocations:Y})),(a||s)&&(t=g,(i=this)._colorCommands.length=0,c=t?R.TRANSLUCENT:R.OPAQUE,i.showLateralSurfaces&&K(i,i._sectorFrontCommand,i._sectorBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorVA,i._uniforms,i._computedModelMatrix,t,c),i.showSectorLines&&K(i,i._sectorLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showSectorSegmentLines&&K(i,i._sectorSegmentLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorSegmentLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showDomeSurfaces&&K(i,i._domeFrontCommand,i._domeBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._domeVA,i._uniforms,i._computedModelMatrix,t,c),i.showDomeLines&&K(i,i._domeLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._domeLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showScanPlane)&&K(i,i._scanPlaneFrontCommand,i._scanPlaneBackCommand,i._frontFaceRS,i._backFaceRS,i._scanePlaneSP,i._scanPlaneVA,i._scanUniforms,i._computedScanPlaneModelMatrix,t,c),e.commandList),h=e.passes,_=this._colorCommands;if(h.render)for(var y=0,w=_.length;y<w;y++){var C=_[y];v.push(C)}}}};var J=new W,X=new x;function Z(e,t,i){for(var n=e.slice,e=N(i),i=q(i),o=N(t),t=q(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),N(c)))}for(var h=[],l=0;l<n;l++)h.push(new x(u(c=2*a*l/(n-1)-a),0,N(c)));return{zoy:s,zox:h}}function Q(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:D.STATIC_DRAW}),s=3*Float32Array.BYTES_PER_ELEMENT,a=[{index:Y.position,vertexBuffer:a,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:s}];return new F({context:e,attributes:a})}function K(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,_){function c(e,t,i){var n=t[e.id];C(n)&&(n=n.primitive,i.remove(n),n.isDestroyed()||n.destroy(),delete t[e.id])}var i,y,w,C,o,P,x,S,M,b,T,E,A,I,L,D,R,n;if(e)return i=(k=e).AssociativeArray,y=k.Cartesian3,w=k.Color,C=k.defined,o=k.destroyObject,P=k.DeveloperError,x=k.Matrix3,S=k.Matrix4,M=k.Quaternion,b=k.MaterialProperty,T=k.Property,E=new x,new S,A=new y,I=new y,L=new M,D=new y,R=new M,(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,A),g=T.getValueOrUndefined(c._orientation,e,L),v=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 _).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=y.subtract(a,p,D),f=y.angleBetween(k.Cartesian3.UNIT_Z,m),m=y.cross(k.Cartesian3.UNIT_Z,m,D),g=M.fromAxisAngle(m,f-Math.PI,R),v=y.distance(a,p);d.modelMatrix=S.fromRotationTranslation(x.fromQuaternion(g,E),a,d.modelMatrix)}else y.equals(a,u.position)&&M.equals(g,u.orientation)||(C(g)?(d.modelMatrix=S.fromRotationTranslation(x.fromQuaternion(g,E),a,d.modelMatrix),u.position=y.clone(a,u.position),u.orientation=M.clone(g,u.orientation)):(d.modelMatrix=k.Transforms.eastNorthUpToFixedFrame(a),u.position=y.clone(a,u.position)));d.show=!0,d.gaze=c,d.radius=v,d.xHalfAngle=s,d.yHalfAngle=l,d.lineColor=T.getValueOrDefault(h._lineColor,e,w.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=b.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,w.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,w.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 F(e,t){e&&(this.viewer=e,R=t,this._installPlugin())}F.prototype={_installPlugin:function(){this._installCounputeVertex(),this._installCylinderGeometry(),this._installRadarPrimitive()},_installCylinderGeometry:function(){function S(e){this.length=e.length,this.topRadius=e.topRadius,this.bottomRadius=e.bottomRadius,this.slices=e.slices||64,this.zReverse=e.zReverse}var b=new R.Cartesian2,M=new R.Cartesian3,T=new R.Ray;S._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=b;p.z=Math.sin(e);for(var m=Math.cos(e),f=0;f<u.length;f++){c[f]=[];for(var g=h[f],v=0;v<o;v++){c[f].push(d++);var _=r*v,y=g*Math.cos(_),w=g*Math.sin(_);a.push(y,w,u[f]),y=m*Math.cos(_),w=m*Math.sin(_),s.push(y,w,p.z),l.push(f/(u.length-1),0)}}for(var C=[],f=1;f<u.length;f++)for(v=1;v<o;v++){var P=c[f-1][v-1],x=c[f][v-1],S=c[f][v],M=c[f-1][v];C.push(S),C.push(M),C.push(P),C.push(S),C.push(P),C.push(x),v==c[f].length-1&&(P=c[f-1][v],x=c[f][v],S=c[f][0],M=c[f-1][0],C.push(S),C.push(M),C.push(P),C.push(S),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},S.createGeometry=function(e,t){if(!t)return S._createGeometry(e);R.Matrix4.multiplyByPoint(t,R.Cartesian3.ZERO,M),M.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 f=p*m,g=[],v=0;v<o;v++){var _=r*v,y=f*Math.cos(_),_=f*Math.sin(_);d.x=y,d.y=_,d.z=h[1],(0,R.Scene.extend2Earth)(d,t,T)?(g.push(u),a.push(y,_,h[1]),s.push(m/15,1),u++):g.push(-1)}c.push(g)}for(var w,C,P=[0,c.length-1],x=0;x<P.length;x++)for(m=P[x],v=1;v<c[m].length;v++)w=c[m][v-1],C=c[m][v],0<=w&&0<=C&&l.push(0,w,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},S.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=b;p.z=Math.sin(e);for(var m=Math.cos(e),f=0;f<u.length;f++){c[f]=[];for(var g=h[f],v=0;v<o;v++){c[f].push(d++);var _=r*v,y=g*Math.cos(_),w=g*Math.sin(_);a.push(y,w,u[f]),y=m*Math.cos(_),w=m*Math.sin(_),s.push(y,w,p.z),l.push(f/(u.length-1),0)}}for(var C=[],f=1;f<u.length;f++)for(v=1;v<o;v+=1){var P=c[f-1][v-1],x=c[f][v-1];c[f][v],c[f-1][v],v%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},S.fromAngleAndLength=function(e,t,i){return e=R.Math.toRadians(e),new S({topRadius:Math.tan(e)*t/2,bottomRadius:0,length:t,zReverse:i})},R.Scene.CylinderGeometry=S},_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),f=Math.sqrt(e*e-m*m-p*p);t.push(m,p,f),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 g=o[c-1][d-1],v=o[c][d-1],_=o[c][d],y=o[c-1][d];n.push(g,v,_),n.push(g,_,y)}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.TRIANGLES,boundingSphere:w});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),f=Math.sqrt(e*e-m*m-p*p);t.push(m,p,f),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 g=o[c-1][d-1],v=o[c][d-1],_=o[c][d];o[c-1][d],d%8==1&&n.push(g,v),c%8==1&&n.push(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})},y=R.BoundingSphere.fromVertices(t),r=new R.Geometry({attributes:r,indices:n,primitiveType:R.PrimitiveType.LINES,boundingSphere:y});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,f=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,f),R.Cartesian3.cross(m,f,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 g,v,_,y,w=e.attributes.normal.values,C=0;C<w.length;C+=3)g=w[C],v=w[C+1],_=w[C+2],y=1/Math.sqrt(g*g+v*v+_*_),w[C]=g*y,w[C+1]=v*y,w[C+2]=_*y;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 O(e,t){if(t){new F(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 O(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:e.showScanPlane||!0,scanPlaneColor:e.scanPlaneColor||new B.Color(1,0,1,1),scanPlaneMode:e.scanPlaneMode||"vertical",scanPlaneRate:e.scanPlaneRate||3,showThroughEllipsoid:e.showThroughEllipsoid||!1,show:!0})})},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,U,V=null,N={},j="move",Y=null;function X(e,t){e&&(this._viewer=e,Y=e,V=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("读取数据失败")})}},V.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 n.GUI,o=this._viewer,t=e.addFolder("加载数据文件"),i=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:()=>{i(e=>{V.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:V.Color.BLUE}}o.flyTo(e)})})},polyline:()=>{i(e=>{V.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 V.PolylineGlowMaterialProperty({glowPower:.1,color:V.Color.ORANGERED.withAlpha(.9)})}o.flyTo(e)})})},polygon:()=>{i(e=>{V.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=V.Color.BLUE.withAlpha(.9)}o.flyTo(e)})})},model:()=>{i(e=>{o.flyTo(d3kit.createModelGraphics({position:V.Cartesian3.fromDegrees(120.38105869,31.10115627),m_url:e}))})},czml:()=>{i(e=>{o.flyTo(o.dataSources.add(V.CzmlDataSource.load(e)))})},"3dtilset":()=>{i(e=>{o.flyTo(o.scene.primitives.add(new V.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,i=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 n.GUI({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new n.GUI,this._viewer.scene.postProcessStages),r=o.add(V.PostProcessStageLibrary.createSilhouetteStage()),a=o.add(V.PostProcessStageLibrary.createBlackAndWhiteStage()),s=o.add(V.PostProcessStageLibrary.createBrightnessStage()),l=o.add(V.PostProcessStageLibrary.createNightVisionStage());r.uniforms.color=e.silhouetteColor||V.Color.YELLOW,r.enabled=!1,a.enabled=!1,a.uniforms.gradations=5,s.enabled=!1,s.uniforms.brightness=.5,l.enabled=!1,t.add(i,"blackAndWhiteShow").name("blackAndWhiteShow").onChange(function(e){a.enabled=e}),t.add(i,"blackAndWhiteGradations",0,10,.1).name("blackAndWhiteGradations").onChange(function(e){a.uniforms.gradations=e}),t.add(i,"brightnessShow").name("brightnessShow").onChange(function(e){s.enabled=e}),t.add(i,"brightnessValue",0,10,.1).name("brightnessValue").onChange(function(e){s.uniforms.brightness=e}),t.add(i,"nightVisionShow").name("nightVisionShow").onChange(function(e){l.enabled=e}),t.add(i,"silhouette").name("silhouette").onChange(function(e){r.enabled=e})},showSceneBloomPanel(e){let t=null,i=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 n.GUI({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new n.GUI,this._viewer),r=(t.__closeButton.innerHTML="收缩面板",o.scene.postProcessStages.bloom);t.add(i,"enabled").name("bloom").onChange(function(e){r.enabled=e}),t.add(i,"glowOnly").name("发光").onChange(function(e){r.uniforms.glowOnly=e}),t.add(i,"enabled").name("启用模糊").onChange(function(e){r.enabled=e}),t.add(i,"contrast",-255,255,.01).name("对比度").onChange(function(e){r.uniforms.contrast=e}),t.add(i,"brightness",-1,1,.01).name("光泽亮度").onChange(function(e){r.uniforms.brightness=e}),t.add(i,"delta",1,5,.01).name("因子").onChange(function(e){r.uniforms.delta=e}),t.add(i,"sigma",1,10,.01).name("sigma").onChange(function(e){r.uniforms.sigma=e}),t.add(i,"stepSize",.1,10).name("stepSize").onChange(function(e){r.uniforms.stepSize=e}),t.add(i,"shadows").name("启用阴影").onChange(function(e){o.shadows=e}),t.add(i,"highDynamicRange").name("高动态范围").onChange(function(e){o.scene.highDynamicRange=e}),t.add(i,"gamma",1,10,.01).name("伽马亮度").onChange(function(e){o.scene.gamma=e})},showPrimitiveMatrixPanel(t){let i=t.primitives._delegate||t.primitives,o=t.primitives,e=(this._viewer,null);t&&t.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(t.elementId).appendChild(e.domElement)):e=new n.GUI;var r=e.addFolder("离地高度"),r=(r.add({height:100},"height",0,1e3,1).onChange(function(e){var t=o.boundingSphere,t=V.Cartographic.fromCartesian(t.center),i=V.Cartesian3.fromRadians(t.longitude,t.latitude,0),t=V.Cartesian3.fromRadians(t.longitude,t.latitude,e),e=V.Cartesian3.subtract(t,i,new V.Cartesian3);o.modelMatrix=V.Matrix4.fromTranslation(e)}),r.open(),e.addFolder("缩放大小")),a={"m+Scale":()=>{i.readyPromise.then(e=>{var t=e.root.transform;V.Matrix4.multiplyByUniformScale(t,1.2,t),e.root.transform=t})},"m-Scale":()=>{i.readyPromise.then(e=>{var t=e.root.transform;V.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=V.Matrix4.fromTranslation(new V.Cartesian3(20,0,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"x-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(-20,0,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"y+Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,20,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"y-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,-20,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"z+Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,0,20));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"z-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,0,-20));V.Matrix4.multiply(i.modelMatrix,e,i.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,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationX(V.Math.toRadians(s.x)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"x-Axis":()=>{s.x-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationX(V.Math.toRadians(s.x)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"y+Axis":()=>{s.y+=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationY(V.Math.toRadians(s.y)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"y-Axis":()=>{s.y-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationY(V.Math.toRadians(s.y)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"z+Axis":()=>{s.z+=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationZ(V.Math.toRadians(s.z)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"z-Axis":()=>{s.z-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationZ(V.Math.toRadians(s.z)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.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:()=>{i.readyPromise.then(e=>{e=e.root.transform;t.cb({modelTransformMatrix:e,modelMatrix:o.modelMatrix})})}},"getModelMaterix").name("获取模型矩阵"),a.open()),e.__closeButton.innerHTML="收缩面板"},showLayerParamPanel:function(t,i){if(t){let e=null;i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI;var i=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(i,"alpha",0,1,.05).name("透明度").onChange(function(e){t.alpha=e}),o.add(i,"brightness",0,5,.05).name("亮度").onChange(function(e){t.brightness=e}),o.add(i,"contrast",0,5,.05).name("对比").onChange(function(e){t.contrast=e}),o.add(i,"gamma",0,5,.05).name("伽马").onChange(function(e){t.gamma=e}),o.add(i,"hue",0,5,.05).name("色调").onChange(function(e){t.hue=e}),o.add(i,"dayAlpha",0,1,.05).name("白天透明").onChange(function(e){t.dayAlpha=e}),o.add(i,"nightAlpha",0,1,.05).name("夜晚透明").onChange(function(e){t.nightAlpha=e}),o.add(i,"saturation",0,5,.05).name("饱和").onChange(function(e){t.saturation=e}),o.open()}},showLayerSwitchPanel:function(t,i,o){if(t&&t.length){let e=null;i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI;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,i,o;e=e||{},n.GUI&&this._viewer.scene.colorCorrection&&(o=new n.GUI,(t=this._viewer).scene.lightSource.ambientLightColor=e.ambientLightColor||new V.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,i=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(i,"bloomEffectShow").name("泛光开关").onChange(function(e){t.scene.bloomEffect.show=e,t.scene.bloomEffect.threshold=i.bloomThreshold,t.scene.bloomEffect.bloomIntensity=i.bloomIntensity}),o.add(i,"bloomThreshold",0,1,.1).name("泛光阈值").onChange(function(e){t.scene.bloomEffect.threshold=e}),o.add(i,"bloomIntensity",0,10,.1).name("泛光强度").onChange(function(e){t.scene.bloomEffect.bloomIntensity=e}),o.add(i,"hdrEnabled").name("HDR开关").onChange(function(e){t.scene.hdrEnabled=e}),o.add(i,"colorCorrectionShow").name("颜色校正").onChange(function(e){t.scene.colorCorrection.show=e}),o.add(i,"colorCorrectionSaturation",0,5,.1).name("饱和度").onChange(function(e){t.scene.colorCorrection.saturation=e}),o.add(i,"colorCorrectionBrightness",0,5,.1).name("亮度").onChange(function(e){t.scene.colorCorrection.brightness=e}),o.add(i,"colorCorrectionContrast",0,5,.1).name("对比度").onChange(function(e){t.scene.colorCorrection.contrast=e}),o.add(i,"colorCorrectionHue",0,5,.1).name("色调").onChange(function(e){t.scene.hdrEnabled=e}),o.add(i,"colorCorrectionHue",0,1,.1).name("环境光").onChange(function(e){t.scene.lightSource.ambientLightColor=new V.Color(e,e,e,1)}),o.open())},showEntityOrientationEditPanel:function(i={}){if(i.entity){let t=i.entity;var e=new n.GUI,o=(i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI,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=V.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(o.heading),V.Math.toRadians(o.pitch),V.Math.toRadians(o.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.add(o,"pitch",0,360,1).name("航向").onChange(function(e){o.pitch=e;e=V.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(o.heading),V.Math.toRadians(o.pitch),V.Math.toRadians(o.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.add(o,"roll",0,360,1).name("翻转").onChange(function(e){o.roll=e;e=V.Transforms.headingPitchRollQuaternion(t.position.getValue(r._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(o.heading),V.Math.toRadians(o.pitch),V.Math.toRadians(o.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.open()}},definedMouseEvent({targetEntity:e,ctrlFlag:t}){U=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=V.JulianDate.fromDate(new Date),t=U.position.getValue(e),i=V.Cartographic.fromCartesian(t),n=Number(i.height.toFixed(3));U.position=new V.CallbackProperty(()=>{var e=Y.scene.globe.ellipsoid.cartesianToCartographic(o),t=V.Math.toDegrees(e.longitude),e=V.Math.toDegrees(e.latitude);return V.Cartesian3.fromDegrees(t,e,n)},!1)}else{var i,n,r;W&&W.id&&"rotate"===j&&(n=V.JulianDate.fromDate(new Date),n=U.position.getValue(n),r=Y.scene.camera.pickEllipsoid(t.startPosition),t=Y.scene.camera.pickEllipsoid(t.endPosition),i=V.Cartesian3.subtract(n,t,new V.Cartesian3),i=V.Cartesian3.normalize(i,new V.Cartesian3),r=V.Cartesian3.subtract(r,n,new V.Cartesian3),t=V.Cartesian3.subtract(t,n,new V.Cartesian3),n=V.Cartesian3.angleBetween(r,t),r=V.Quaternion.fromAxisAngle(i,100*n),U.orientation=r)}}},defLeftDown(e){W=Y.scene.pick(e.position),V.defined(W)&&j?(N.selected=!0,N.leftDown=!0):N.selected=!1},defMouseWheel(n){if(W&&W.id&&"scale"===j){let e=V.JulianDate.fromDate(new Date),t=U.box.dimensions.getValue(e),i=0<n?2:.5;U.box.dimensions=new V.CallbackProperty(()=>V.Cartesian3.multiplyByScalar(t,i,new V.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;function Z(e,t,i){e&&(this._viewer=e,q=t,this._pluginLayer=new q.CustomDataSource("pluginLayer"),e&&e.dataSources.add(this._pluginLayer),this._installPlugin())}Z.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,e;this.viewer.terrainProvider._layers?((a=this)._createBottomSurface(r.bottom_pos),e=q.sampleTerrainMostDetailed(this.viewer.terrainProvider,r.lerp_pos),q.when(e,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){for(var l=this,t=function(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)},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)}};let J=null;function Q(e,t,i){e&&(J=t,this._analysisLayer=new J.CustomDataSource("analysisLayer"),this.$math3d=new g(e,t),this.$graphics=new l(e,t),e)&&e.dataSources.add(this._analysisLayer)}function K(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];J.defined(l.position)||a.splice(e,1)}if(!J.defined(a[0].position))throw new J.DeveloperError("position is undefined");var s=a[0].position,l=J.Cartesian3.distance(s,t)<5,s=[r,a[0].position],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:J.ArcType.NONE,material:new J.PolylineArrowMaterialProperty(J.Color.GREEN)}});e.push(s),l||(s=[a[0].position,t],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:J.ArcType.NONE,material:new J.PolylineArrowMaterialProperty(J.Color.RED)}}),e.push(s));for(let e=0;e<a.length;++e){var c,h=a[e].object;h&&(h instanceof J.Cesium3DTileFeature?(o.push(h),h.oldColor=h.color.clone(),h.color=J.Color.fromAlpha(J.Color.YELLOW,h.color.alpha)):h.id instanceof J.Entity&&(c=(h=h.id).polygon||h.polyline,o.push(h),h=c.material.color.getValue(),c.oldColor=h.clone(),c.material=J.Color.fromAlpha(J.Color.YELLOW,h.alpha))),n.push(i._analysisLayer.entities.add({position:a[e].position,ellipsoid:{radii:new J.Cartesian3(.8,.8,.8),material:J.Color.RED}}))}var s=J.Cartographic.fromCartesian(r),e=J.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:J.Color.YELLOW,pixelOffset:{x:0,y:-20},verticalOrigin:J.VerticalOrigin.BOTTOM,horizontalOrigin:J.HorizontalOrigin.LEFT})}K.prototype.remove=function(){}}function $(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=J.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/45,l.computeEllipseEdgePositions(o));for(let e=0;e<r.outerPositions.length;e+=3){var a=new J.Cartesian3(r.outerPositions[e],r.outerPositions[e+1],r.outerPositions[e+2]),s=J.Cartographic.fromCartesian(a),h=5e-5*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 J.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=J.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 J.Scene.PointsPrimitive({viewer:l._viewer,Cartesians:n,Colors:o})}else alert("高程异常!")})}}catch(e){console.log(e)}$.prototype.remove=function(){}}function ee(e){if(e&&e.positions){for(var t=e.positions,i=e.that,n=i.transformWGS84ToCartesian(t[0]),o=i.transformWGS84ToCartesian(t[1]),a=[J.Cartographic.fromCartesian(n)],s=new J.Cartesian3,l=[0],c=[0],h=1;h<=10;h++){J.Cartesian3.lerp(n,o,h/10,s);var u=J.Cartographic.fromCartesian(s),d=i._viewer.scene.globe.getHeight(u),d=(u.height=d,a.push(u),a[h-1]),p=J.Cartesian3.distance(J.Cartographic.toCartesian(d),J.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");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",e.style.opacity=.9,r.init(e).setOption({title:{text:"剖面示意图",left:"center",subtext:"",textStyle:{color:"white",fontSize:15}},tooltip:{trigger:"axis"},legend:{data:[""]},toolbox:{show:!1,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:"平均值"}]}}]})}}function te(e){if(e&&e.positions&&e.that){var t=e.that,i=e.positions,e=this,n=t._viewer.terrainProvider.availability;if(n){for(var o=15e3,r=0;r<i.length;r++){var a=J.Cartographic.fromCartesian(i[r]),s=t._viewer.scene.globe.getHeight(a);s<o&&(o=s),n.computeMaximumLevelAtPosition(a)}var l=Math.PI/Math.pow(2,11);l/=64;for(var c,h,u,d,p,m,f,g,l=new J.PolygonGeometry.fromPositions({positions:i,vertexFormat:J.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,granularity:l}),v=new J.PolygonGeometry.createGeometry(l),_=0,y=0,w=new J.Cartesian3,r=0;r<v.indices.length;r+=3){c=v.indices[r],h=v.indices[r+1],p=v.indices[r+2],m=v.attributes.position.values,w.x=m[3*c],w.y=m[3*c+1],w.z=m[3*c+2],a=J.Cartographic.fromCartesian(w),c=t._viewer.scene.globe.getHeight(a),u=J.Cartesian3.fromRadians(a.longitude,a.latitude,c),g=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),y<c&&(y=c),w.x=m[3*h],w.y=m[3*h+1],w.z=m[3*h+2],a=J.Cartographic.fromCartesian(w),h=t._viewer.scene.globe.getHeight(a),d=J.Cartesian3.fromRadians(a.longitude,a.latitude,h),P=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),y<h&&(y=h),w.x=m[3*p],w.y=m[3*p+1],w.z=m[3*p+2],a=J.Cartographic.fromCartesian(w),m=t._viewer.scene.globe.getHeight(a),p=J.Cartesian3.fromRadians(a.longitude,a.latitude,m),y<m&&(y=m),g=g,P=P,f=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),0,g=((C=J.Cartesian3.distance(g,P))+(P=J.Cartesian3.distance(P,f))+(f=J.Cartesian3.distance(f,g)))/2,_+=Math.sqrt(g*(g-C)*(g-P)*(g-f))*(c-o+h-o+m-o)/3;var C=[],P=(C.push(u),C.push(d),C.push(p),{polygon:{hierarchy:{positions:C},extrudedHeight:0,perPositionHeight:!0,material:J.Color.fromRandom().withAlpha(.5),outline:!0,closeTop:!0,closeBottom:!0,outlineColor:J.Color.WHITE,outlineWidth:2}});t._analysisLayer.entities.add(P)}l=function(e){for(var t=[],i=[],n=0;n<e.length;n++){var o=J.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 J.Cartographic(u,d)}(i),e._volumeLabel=t._analysisLayer.entities.add({position:J.Cartesian3.fromRadians(l.longitude,l.latitude,y+1e3),label:{text:"Cut Volume "+_.toString()+"m3"}})}else alert("未获取到地形")}}Q.prototype={createVisibilityAnalysis:function(i){i=i||{};var n=this;n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new K({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 $({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;J.defined(n)?t.destroy():(n=new J.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 J.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&&(n=e.maxH||15,o=e.speed||1,r=e.interval||10,a=(t=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||{},!r)return alert("需要引入echarts库"),!1;var n=this;this._viewer&&i&&n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new ee({positions:e,that:n});n._graphicsLayer&&n._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 te({positions:i.transformWGS84ArrayToCartesianArray(e,100),that:i});"function"==typeof t.callback&&t.callback(e)}})}};var ie={version:"1.0.0",PlotUtils:{}},ne=(ie.PlotUtils.distance=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},ie.PlotUtils.wholeDistance=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=ie.PlotUtils.distance(e[i],e[i+1]);return t},ie.PlotUtils.getBaseLength=function(e){return Math.pow(ie.PlotUtils.wholeDistance(e),.99)},ie.PlotUtils.mid=function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},ie.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 ie.PlotUtils.getIntersectPoint(n,t,o,e)},ie.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])},ie.PlotUtils.getAzimuth=function(e,t){var i,n=Math.asin(Math.abs(t[1]-e[1])/ie.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=ie.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},ie.PlotUtils.getAngleOfThreePoints=function(e,t,i){e=ie.PlotUtils.getAzimuth(t,e)-ie.PlotUtils.getAzimuth(t,i);return e<0?e+ie.Constants.TWO_PI:e},ie.PlotUtils.isClockWise=function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},ie.PlotUtils.getPointOnLine=function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},ie.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]]},ie.PlotUtils.getThirdPoint=function(e,t,i,n,o){e=ie.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]},ie.PlotUtils.getArcPoints=function(e,t,i,n){for(var o=[],r=(r=n-i)<0?r+ie.Constants.TWO_PI:r,a=0;a<=ie.Constants.FITTING_COUNT;a++){var s=i+r*a/ie.Constants.FITTING_COUNT,l=e[0]+t*Math.cos(s),s=e[1]+t*Math.sin(s);o.push([l,s])}return o},ie.PlotUtils.getBisectorNormals=function(e,t,i,n){var o,r,a=ie.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=ie.PlotUtils.distance(t,i),h=ie.PlotUtils.distance(i,n),s=s>ie.Constants.ZERO_TOLERANCE?ie.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]},ie.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)]},ie.PlotUtils.getCurvePoints=function(e,t){for(var i=[ie.PlotUtils.getLeftMostControlPoint(t)],n=0;n<t.length-2;n++)var o=t[n],r=t[n+1],a=t[n+2],a=ie.PlotUtils.getBisectorNormals(e,o,r,a),i=i.concat(a);for(var s=ie.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<ie.Constants.FITTING_COUNT;e++){var c=ie.PlotUtils.getCubicValue(e/ie.Constants.FITTING_COUNT,o,i[2*n],i[2*n+1],r);l.push(c)}l.push(r)}return l},ie.PlotUtils.getLeftMostControlPoint=function(e){var i,n,o,r,a,s=e[0],l=e[1],e=e[2],c=ie.PlotUtils.getBisectorNormals(0,s,l,e)[0],e=ie.PlotUtils.getNormal(s,l,e),e=Math.sqrt(e[0]*e[0]+e[1]*e[1])>ie.Constants.ZERO_TOLERANCE?(e=ie.PlotUtils.mid(s,l),o=s[0]-e[0],i=s[1]-e[1],n=2/ie.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]},ie.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=ie.PlotUtils.getBisectorNormals(0,l,c,e)[1],l=ie.PlotUtils.getNormal(l,c,e),l=Math.sqrt(l[0]*l[0]+l[1]*l[1])>ie.Constants.ZERO_TOLERANCE?(l=ie.PlotUtils.mid(c,e),o=e[0]-l[0],i=e[1]-l[1],n=2/ie.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]},ie.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=ie.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},ie.PlotUtils.getBinomialFactor=function(e,t){return ie.PlotUtils.getFactorial(e)/(ie.PlotUtils.getFactorial(t)*ie.PlotUtils.getFactorial(e-t))},ie.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},ie.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=ie.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},ie.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},ie.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"}),re="doublearrow",oe=.25,ae=.3,se=.85,le=.15,ce={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1},he={tailWidthFactor:.15,neckWidthFactor:.2,headWidthFactor:.25,headAngle:Math.PI/8.5,neckAngle:Math.PI/13};ne.algorithm={},ne.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?ne.algorithm.getTempPoint4(n,o,r):this.points[3],this.connPoint=3==a||4==a?ie.PlotUtils.mid(n,o):this.points[4],e=ie.PlotUtils.isClockWise(n,o,r)?(h=ne.algorithm.getArrowPoints(n,this.connPoint,this.tempPoint4,!1),ne.algorithm.getArrowPoints(this.connPoint,o,r,!0)):(h=ne.algorithm.getArrowPoints(o,this.connPoint,r,!1),ne.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=ie.PlotUtils.getBezierPoints(u),s=ie.PlotUtils.getBezierPoints(e.concat(l.slice(1))),h=ie.PlotUtils.getBezierPoints(h),a=u.concat(d,s,c,h),e=ne.algorithm.array2Dto1D(a);i.controlPoint=[n,o,r,this.tempPoint4,this.connPoint],i.polygonalPoint=t.Cartesian3.fromDegreesArray(e)}return i},ne.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=ne.algorithm.getTempPoint4(i,n,o),this.tempPoint5=ie.PlotUtils.mid(o,this.tempPoint4)):(this.tempPoint4=this.points[3],this.tempPoint5=this.points[4]),this.connPoint=r<6?ie.PlotUtils.mid(i,n):this.points[5],e=ie.PlotUtils.isClockWise(i,n,o)?(c=ne.algorithm.getArrowPoints(i,this.connPoint,this.tempPoint4,!1),ne.algorithm.getArrowPoints(this.connPoint,n,o,!0)):(c=ne.algorithm.getArrowPoints(n,this.connPoint,o,!1),ne.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=ie.PlotUtils.getBezierPoints(h),a=ie.PlotUtils.getBezierPoints(e.concat(s.slice(1))),c=ie.PlotUtils.getBezierPoints(c),r=h.concat(u,a,l,c),e=ne.algorithm.array2Dto1D(r);t.controlPoint=[i,n,o,this.tempPoint4,this.tempPoint5,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(e)}return t},ne.algorithm.array2Dto1D=function(e){var t=[];return e.forEach(function(e){t.push(e[0]),t.push(e[1])}),t},ne.algorithm.getArrowPoints=function(e,t,i,n){this.type=re,this.headHeightFactor=oe,this.headWidthFactor=ae,this.neckHeightFactor=se,this.neckWidthFactor=le;var o=ie.PlotUtils.mid(e,t),r=ie.PlotUtils.distance(o,i),a=ie.PlotUtils.getThirdPoint(i,o,0,.3*r,!0),s=ie.PlotUtils.getThirdPoint(i,o,0,.5*r,!0),a=[o,ie.PlotUtils.getThirdPoint(o,a,ie.Constants.HALF_PI,r/5,n),ie.PlotUtils.getThirdPoint(o,s,ie.Constants.HALF_PI,r/4,n),i],o=ne.algorithm.getArrowHeadPoints(a,this.headHeightFactor,this.headWidthFactor,this.neckHeightFactor,this.neckWidthFactor),s=o[0],r=o[4],n=ie.PlotUtils.distance(e,t)/ie.PlotUtils.getBaseLength(a)/2,i=ne.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)},ne.algorithm.getArrowHeadPoints=function(e,t,i){this.type=re,this.headHeightFactor=oe,this.headWidthFactor=ae,this.neckHeightFactor=se,this.neckWidthFactor=le;var n=ie.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],t=(ie.PlotUtils.distance(t,i),n*this.headWidthFactor),i=n*this.neckWidthFactor,r=n*this.neckHeightFactor,n=ie.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=ie.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=ie.PlotUtils.getThirdPoint(o,n,ie.Constants.HALF_PI,t,!1),n=ie.PlotUtils.getThirdPoint(o,n,ie.Constants.HALF_PI,t,!0);return[ie.PlotUtils.getThirdPoint(o,e,ie.Constants.HALF_PI,i,!1),r,o,n,ie.PlotUtils.getThirdPoint(o,e,ie.Constants.HALF_PI,i,!0)]},ne.algorithm.getArrowBodyPoints=function(e,t,i,n){for(var o=ie.PlotUtils.wholeDistance(e),r=ie.PlotUtils.getBaseLength(e)*n,a=(r-ie.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=ie.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=ie.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=ie.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=ie.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ne.algorithm.getTempPoint4=function(e,t,i){var n,o,r,t=ie.PlotUtils.mid(e,t),a=ie.PlotUtils.distance(t,i),i=ie.PlotUtils.getAngleOfThreePoints(e,t,i),a=i<ie.Constants.HALF_PI?(n=a*Math.sin(i),o=a*Math.cos(i),r=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!1),ie.PlotUtils.getThirdPoint(t,r,ie.Constants.HALF_PI,o,!0)):i>=ie.Constants.HALF_PI&&i<Math.PI?(n=a*Math.sin(Math.PI-i),o=a*Math.cos(Math.PI-i),r=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!1),ie.PlotUtils.getThirdPoint(t,r,ie.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=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!0),ie.PlotUtils.getThirdPoint(t,r,ie.Constants.HALF_PI,o,!0)):(n=a*Math.sin(2*Math.PI-i),o=a*Math.cos(2*Math.PI-i),r=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!0),ie.PlotUtils.getThirdPoint(t,r,ie.Constants.HALF_PI,o,!1));return a},ne.algorithm.tailedAttackArrow=function(e,t){e=ne.algorithm.dereplication(e),this.tailWidthFactor=ce.tailWidthFactor,this.swallowTailFactor=ce.swallowTailFactor,this.swallowTailPnt=ce.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=(ie.PlotUtils.isClockWise(e[0],e[1],e[2])&&(n=e[1],o=e[0]),[ie.PlotUtils.mid(n,o)].concat(e.slice(2))),r=ne.algorithm.getAttackArrowHeadPoints(e,n,o,ce),a=r[0],s=r[4],l=ie.PlotUtils.distance(n,o),c=ie.PlotUtils.getBaseLength(e),h=c*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=ie.PlotUtils.getThirdPoint(e[1],e[0],0,h,!0);h=ne.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=ie.PlotUtils.getQBSplinePoints(l),c=ie.PlotUtils.getQBSplinePoints(c),n=ne.algorithm.array2Dto1D(l.concat(r,c.reverse(),[this.swallowTailPnt,l[0]])),i.polygonalPoint=t.Cartesian3.fromDegreesArray(n)}return i},ne.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=ie.PlotUtils.getBaseLength(e)*this.headHeightFactor,o=e[e.length-1],r=ie.PlotUtils.distance(o,e[e.length-2]),t=ie.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=ie.PlotUtils.getThirdPoint(e[e.length-2],o,0,n,!0),e=ie.PlotUtils.getThirdPoint(e[e.length-2],o,0,r,!0),r=ie.PlotUtils.getThirdPoint(o,n,ie.Constants.HALF_PI,i,!1),n=ie.PlotUtils.getThirdPoint(o,n,ie.Constants.HALF_PI,i,!0);return[ie.PlotUtils.getThirdPoint(o,e,ie.Constants.HALF_PI,t,!1),r,o,n,ie.PlotUtils.getThirdPoint(o,e,ie.Constants.HALF_PI,t,!0)]},ne.algorithm.getAttackArrowBodyPoints=function(e,t,i,n){for(var o=ie.PlotUtils.wholeDistance(e),r=ie.PlotUtils.getBaseLength(e)*n,a=(r-ie.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=ie.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(r/2-(s+=ie.PlotUtils.distance(e[h-1],e[h]))/o*a)/Math.sin(u),p=ie.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=ie.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ne.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},ne.algorithm.fineArrow=function(e,t,i){var n,o,r,a,s,l,c;if(!(e.length<2||t.length<2))return n=he.tailWidthFactor,c=he.neckWidthFactor,s=he.headWidthFactor,a=he.headAngle,l=he.neckAngle,(o=[])[0]=e,o[1]=t,e=o[0],t=o[1],c=(o=ie.PlotUtils.getBaseLength(o))*c,s=o*s,n=ie.PlotUtils.getThirdPoint(t,e,ie.Constants.HALF_PI,o=o*n,!0),o=ie.PlotUtils.getThirdPoint(t,e,ie.Constants.HALF_PI,o,!1),r=ie.PlotUtils.getThirdPoint(e,t,a,s,!1),a=ie.PlotUtils.getThirdPoint(e,t,a,s,!0),s=ie.PlotUtils.getThirdPoint(e,t,l,c,!1),l=ie.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 ue=null;function de(e,t){this.viewer=e,ue=t,this.handler=new ue.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.fillMaterial=ue.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=ne}de.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},de.prototype.disableHandler=function(){this.handler&&(this.handler.destroy(),this.handler=new ue.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)};let pe=null;var me=function(e,t){de.call(this,e,t),pe=t,this.type="AttackArrow",this.fillMaterial=pe.Color.RED.withAlpha(.5)};function fe(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}me.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 pe.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new pe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){(e=fe(e.position,i.viewer))&&(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))},pe.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!i.floatPoint||i.positions.length<2||(e=fe(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),2<=i.positions.length)&&(pe.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)))},pe.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(e=fe(e.position,i.viewer)){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.positions=[],i.pointArr=[],i.arrowEntity=null}},pe.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=pe.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 pe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(pe.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}2==n.clickStep&&(n.clickStep=0,t=fe(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},pe.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){(e=fe(e.endPosition,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},pe.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:pe.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new pe.PolygonGraphics({hierarchy:new pe.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,pe),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new pe.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=pe.Math.toDegrees(e.latitude);return[pe.Math.toDegrees(e.longitude),t]}},(me.prototype=Object.create(Object.assign({},me.prototype,de.prototype))).constructor=me;let ge=null;var ve=function(e,t){de.call(this,e,t),ge=t,this.type="StraightArrow",this.fillMaterial=ge.Color.fromCssColorString("#0000FF").withAlpha(.8)};function ye(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}ve.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 ge.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler.setInputAction(function(e){(e=ye(e.position,i.viewer))&&(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.positions=[],i.pointArr=[],i.arrowEntity=null),i.positions.push(e.clone()))},ge.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){i.positions.length<1||(e=ye(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),2<=i.positions.length)&&(ge.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),t&&t(i.objId)))},ge.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){(e=ye(e.position,i.viewer))&&(i.firstPoint.show=!1,i.positions=[],i.pointArr=[],i.arrowEntity=null,i.positions.push(e.clone()))},ge.ScreenSpaceEventType.RIGHT_CLICK)},startModify:function(){this.state=2,this.firstPoint.show=!0,this.floatPoint.show=!0;var i=this;this.clickStep=0,this.modifyHandler||(this.modifyHandler=new ge.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);ge.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),2==i.clickStep&&(i.clickStep=0,t=ye(e.position,i.viewer))&&i.selectPoint&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},ge.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){i.selectPoint&&(e=ye(e.endPosition,i.viewer))&&(i.selectPoint.position.setValue(e),"firstPoint"==i.selectPoint.type&&(i.positions[1]=e),"floatPoint"==i.selectPoint.type)&&(i.positions[2]=e)},ge.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.state=-1,this.positions=[];for(var t=[],i=0;i<e.length;i++){var n=ge.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:ge.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(a){var s=this;return this.viewer.entities.add({id:s.objId,polygon:new ge.PolygonGraphics({hierarchy:new ge.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]],ge);if(-1!=JSON.stringify(n).indexOf("null"))return[];for(var o=0;o<n.length;o++){var r=new ge.Cartesian3(n[o].x,n[o].y,n[o].z);i.push(r)}return new ge.PolygonHierarchy(i)},!1),show:!0,fill:!0,material:s.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=ge.Math.toDegrees(e.latitude);return[ge.Math.toDegrees(e.longitude),t]}},(ve.prototype=Object.create(Object.assign({},ve.prototype,de.prototype))).constructor=ve;let _e=null;var we=function(e,t){de.call(this,e,t),_e=t,this.type="PincerArrow",this.fillMaterial=_e.Color.YELLOW.withAlpha(.8)};function Ce(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}we.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 _e.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var n=this;this.state=1,this.handler.setInputAction(function(e){if(e=Ce(e.position,n.viewer))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),n.positions=[],n.pointArr=[],n.arrowEntity=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)}},_e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!n.floatPoint||n.positions.length<2||(e=Ce(e.endPosition,n.viewer))&&(n.floatPoint.position.setValue(e),2<=n.positions.length)&&(_e.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)))},_e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(4<=n.positions.length&&(e=Ce(e.position,n.viewer))){for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;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.positions=[],n.pointArr=[],n.arrowEntity=null}},_e.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=_e.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 _e.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(_e.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.state=-1,n.modifyHandler.destroy(),n.modifyHandler=null}2==n.clickStep&&(n.clickStep=0,t=Ce(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},_e.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){(e=Ce(e.endPosition,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},_e.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:_e.Color.YELLOW}})},showArrowOnMap:function(r){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new _e.PolygonGraphics({hierarchy:new _e.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,_e),o=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(o=n.polygonalPoint),new _e.PolygonHierarchy(o)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=_e.Math.toDegrees(e.latitude);return[_e.Math.toDegrees(e.longitude),t]}},(we.prototype=Object.create(Object.assign({},we.prototype,de.prototype))).constructor=we;let Pe=null,xe=null;function Se(e,t,i,n){if(e&&n){const{threeGlobal:i,containerId:o,threeContainerId:r}=n;Pe=t,xe=i,this._viewer=e,this._containerId=o,this._threeContainerId=r,this._initContainer(),this._initThree()}}Se.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(){var e=window.innerWidth/window.innerHeight;this._three={renderer:null,camera:null,scene:null},this._three.scene=new xe.Scene,this._three.camera=new xe.PerspectiveCamera(45,e,1,1e7),this._three.renderer=new xe.WebGLRenderer({alpha:!0}),this.threeContainer&&this.threeContainer.appendChild(this._three.renderer.domElement)},createThreeObject:function(){return new function(){this.threeMesh=null,this.minWGS84=null,this.maxWGS84=null}},addThreeObjects:function(e){e&&0<e.length&&(this._3Dobjects=e,this._renderCesium(),this._renderThreeObj(),this._loop())},_loop:function(){let e=this;window.loop=function(){e.requestID=requestAnimationFrame(window.loop),window.renderCesium(),e._renderThreeObjOfSize.call(e),e._renderCamera.call(e)},window.loop()},_renderCesium:function(){var e=this;window.renderCesium=function(){e._viewer&&e._viewer.render()}},_renderThreeObj:function(){var s=this;window.renderThreeObj=function(){function e(e){return new xe.Vector3(e.x,e.y,e.z)}if(s._three&&s._viewer&&s._3Dobjects){s._three.camera.fov=Pe.Math.toDegrees(s._viewer.camera.frustum.fovy),s._three.camera.updateProjectionMatrix();for(var t=0;t<s._3Dobjects.length;t++){var i=s._3Dobjects[t].minWGS84,n=s._3Dobjects[t].maxWGS84,o=Pe.Cartesian3.fromDegrees((i[0]+n[0])/2,(i[1]+n[1])/2),r=Pe.Cartesian3.fromDegrees((i[0]+n[0])/2,(i[1]+n[1])/2,1),a=e(Pe.Cartesian3.fromDegrees(i[0],i[1])),i=e(Pe.Cartesian3.fromDegrees(i[0],n[1])),n=(new xe.Vector3).subVectors(a,i).normalize();s._3Dobjects[t].threeMesh.position.copy(o),s._3Dobjects[t].threeMesh.lookAt(r),s._3Dobjects[t].threeMesh.up.copy(n)}}}},_renderThreeObjOfSize(){var e=this.threeContainer.clientWidth,t=this.threeContainer.clientHeight;this._three.renderer.setSize(e,t),this._three.renderer.render(this._three.scene,this._three.camera)},_renderCamera(){var e=this._three,t=(e.camera.fov=Pe.Math.toDegrees(this._viewer.camera.frustum.fovy),e.camera.updateProjectionMatrix(),e.camera.matrixAutoUpdate=!1,this._viewer.camera.viewMatrix),i=this._viewer.camera.inverseViewMatrix,i=(e.camera.lookAt(0,0,0),e.camera.matrixWorld.set(i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15]),e.camera.matrixWorldInverse.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this.threeContainer.clientWidth/this.threeContainer.clientHeight);e.camera.aspect=i,e.camera.updateProjectionMatrix()},destroyThreeJS(){for(cancelAnimationFrame(this.requestID);this.threeContainer.firstChild;)this.threeContainer.removeChild(this.threeContainer.firstChild);this._three.scene&&(this._three.scene.traverse(e=>{e.isMesh&&(e.geometry.dispose(),e.material.isMaterial)&&e.material.dispose()}),this._three.scene=null),this._three.renderer&&(this._three.renderer.forceContextLoss(),this._three.renderer.dispose(),this._three.renderer=null),this._three.camera&&(this._three.camera=null)}};class Me{constructor(e){return this.init(e)}init({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:o={},extraConfig:r={},MapImageryList:s=[],defaultStatic:l,baseExtendsCom:c=[],extendsCom:h,extendsComName:u}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";if(i)return{viewer:o=new a(e).init({containerId:i,viewerConfig:o,extraConfig:r,MapImageryList:s}),[u]:this.prototypeExtends(o,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 be extends Me{constructor(e){return super({...e,baseExtendsCom:[m,g,x],extendsCom:C,extendsComName:"draw"})}}class Te extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:H,extendsComName:"customCesiumPlugin"})}}exports.Analysis=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,C,Z],extendsCom:Q,extendsComName:"analysis"})}},exports.CustomCesiumPlugin=class{constructor(e){return new Te(e)}},exports.Draw=class{constructor(e){var t=new be(e);return this._initCurrMeasure(e,t)}_initCurrMeasure(e,t){var i=new me(t.viewer,e.cesiumGlobal),n=new ve(t.viewer,e.cesiumGlobal),e=new we(t.viewer,e.cesiumGlobal);return{...t,attackArrowObj:i,straightArrowObj:n,pincerArrowObj:e}}},exports.Graphics=class extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:l,extendsComName:"graphics"})}},exports.Material=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,u],extendsCom:h,extendsComName:"material"})}},exports.PassEffect=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,u],extendsCom:M,extendsComName:"passEffect"})}},exports.Plugin=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,l],extendsCom:Z,extendsComName:"plugin"})}},exports.Primitive=class extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:y,extendsComName:"primitive"})}},exports.ThreeJs=class extends Me{constructor(e){return super({...e,baseExtendsCom:[],extendsCom:Se,extendsComName:"threeJs"})}},exports.initCesium=function({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:o={},extraConfig:r={},MapImageryList:s=[],defaultStatic:c}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";var d,p,f;if(i)return o=new a(e).init({containerId:i,viewerConfig:o,extraConfig:r,MapImageryList:s}),p=e,f=c,{viewer:d=o,material:(r=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(d,p,f),e.forEach(e=>{e.call(t,d,p,f)})):(i(e),t=new o(d,p,f),e.call(t,d,p,f)),t})([m,u],h),graphics:r(m,l),math3d:r(m,g),primitive:r(m,y),draw:r([m,g,x],C),passEffect:r([m,u],M),customCesiumPlugin:r(m,H),control:r(m,X),plugin:r([m,l],Z),base:new m(o,e),analysis:r([m,C,Z],Q),attackArrowObj:new me(o,e),straightArrowObj:new ve(o,e),pincerArrowObj:new we(o,e),threeJs:new Se(o,e,c,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")};throw"Missing containerId parameter, please check the calling function initCesium."};
5
+ `),-1!==r.indexOf(o)&&(n[t]=n[t].replace(o,e))}}getCurCenterlonLat(e){e=e.camera.pickEllipsoid(new o.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2)),e=o.Ellipsoid.WGS84.cartesianToCartographic(e);return{lon:180*e.longitude/Math.PI,lat:180*e.latitude/Math.PI}}}let s=null;function l(e,t,i){e&&(s=t,this._graphicsLayer=new s.CustomDataSource("graphicsLayer"),e)&&e.dataSources.add(this._graphicsLayer)}l.prototype={getPointGraphics:function(e){if(e=e||{})return new s.PointGraphics({color:e.color||s.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||s.Color.WHITE,outlineWidth:e.outlineWidth||1})},getLineGraphics:function(e){if((e=e||{})&&e.positions)return new s.PolylineGraphics({show:!0,positions:e.positions,material:e.material||s.Color.YELLOW,width:e.width||1,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)})},getPolygonGraphics:function(e){if((e=e||{})&&e.positions)return new s.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||s.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||!1})},getLabelGraphics:function(e){if((e=e||{})&&e.l_text)return new s.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||s.Color.GOLD,style:e.l_style||s.LabelStyle.FILL_AND_OUTLINE,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||!1,backgroundColor:e.l_backgroundColor||new s.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||s.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new s.Cartesian2(0,-30)})},getBillboardGraphics:function(e){if((e=e||{})&&e.b_img)return new s.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 s.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0})},getPathGraphics:function(e){if(e=e||{})return new s.PathGraphics({resolution:e.resolution||1,material:new s.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||s.Color.YELLOW}),width:e.width||30})},getModelGraphics:function(e){if(e=e||{})return new s.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:!0})},getEllipseGraphics:function(e){if(e=e||{})return new s.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||s.Color.RED.withAlpha(.5),outline:!e.hasOwnProperty("e_outline")||e.e_outline})},getEllipsoidGraphics:function(e){var t;if(e=e||{})return t=e.radii||1e6,new s.EllipsoidGraphics({radii:new s.Cartesian3(t,t,t),innerRadii:this._objHasOwnProperty(e,"innerRadii",new s.Cartesian3(t/1.5,t/1.5,t/1.5)),maximumCone:e.maximumCone||s.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||s.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",!0),fill:this._objHasOwnProperty(e,"fill",!0),material:e.material||s.Color.RED.withAlpha(.1)})},_objHasOwnProperty:(e,t,i)=>e.hasOwnProperty(t)?e.field:i,getBoxGraphics:function(e){if(e=e||{})return new s.BoxGraphics({show:this._objHasOwnProperty(e,"show",!0),fill:this._objHasOwnProperty(e,"fill",!0),dimensions:e.dimensions||new s.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",!0),outlineColor:e.outlineColor||s.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})},getPlaneGraphics:function(e){if(e=e||{})return new s.PlaneGraphics({plane:e.plane||new s.Plane(s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(170,130),material:e.material||s.Color.BLUE})},getCylinderGraphics:function(e){if(e=e||{})return new s.CylinderGraphics({HeightReference:s.HeightReference.RELATIVE_TO_GROUND,length:e.length||250,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new s.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],r=this.createGraphics();r.name=e.name||"",r.oid=e.oid||"point",r.position=n,e.point&&(r.point=this.getPointGraphics()),e.billboard&&(r.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(r.label=this.getLabelGraphics(e.label)),i.push(this._graphicsLayer.entities.add(r))}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(o){if(o&&o.positions){let{positions:e,height:t,width:i,material:n,...r}=o;o=this.createGraphics();return o.corridor={positions:e,height:void 0===t?6:t,width:void 0===i?15:i,...r,material:n||new s.Scene.WarnLinkMaterialProperty({freely:"cross",color:s.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(o)}},craeteDynamicPolyLineGraphics:function(e){var t;if(e&&e.positions)return(t=this.createGraphics()).polyline={show:!0,positions:[],material:e.material||s.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",!1)},t.polyline.positions=new s.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 s.CallbackProperty(function(){var e=i.position.getValue(n._viewer.clock.currentTime),e=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=s.Math.toDegrees(e.latitude),e=s.Math.toDegrees(e.longitude);return s.Cartesian3.fromDegrees(e,t,0)},!1),t.cylinder.length=new s.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 s.Scene.CircleFadeMaterialProperty({color:e.color||s.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:s.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new s.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 s.ColorMaterialProperty(new s.CallbackProperty(function(){return n?(i-=.05)<=0&&(n=!1):1<=(i+=.05)&&(n=!0),s.Color.RED.withAlpha(i)},!1))},this._graphicsLayer.entities.add(t)},craeteDynamicCricleGraphics:function(i){if(i&&i.center){var n=this.createGraphics(),r=this,o=i.center,a=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 s.ImageMaterialProperty({image:i.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:!0});n.position=new s.CallbackProperty(function(){return r.transformWGS84ToCartesian(o)},!1),n.orientation=new s.CallbackProperty(function(){return s.Transforms.headingPitchRollQuaternion(r.transformWGS84ToCartesian(o),new s.HeadingPitchRoll(s.Math.toRadians(0),s.Math.toRadians(0),s.Math.toRadians(0)))},!1);let e=a,t=!1;return n.ellipse={material:i,height:h,semiMajorAxis:new s.CallbackProperty(function(){return a},!1),semiMinorAxis:new s.CallbackProperty(function(){return a},!1),stRotation:new s.CallbackProperty(function(){return 0<l&&360<=(c+=l)&&(c=0),u&&((t=u<=a||a<=e?!t:t)?a+=2:a-=2),d&&(a<=d?a+=2:a=e),c},!1)},this._graphicsLayer.entities.add(n)}},craeteDynamicShadeWallGraphics:function(e){var t,i,n,r,o;if(e&&e.positions)return t=e.alp||1,i=e.num||20,n=e.color||s.Color.RED,r=e.speed||.003,(o=this.createGraphics()).wall={positions:e.positions,material:new s.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:!0,color:new s.CallbackProperty(function(){return i%2==0?t-=r:t+=r,(t<=.1||1<=t)&&i++,n.withAlpha(t)},!1)})},this._graphicsLayer.entities.add(o)},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 s.NearFarScalar(150,.7,15e6,.5),verticalOrigin:s.VerticalOrigin.BOTTOM,pixelOffset:t.b_pixelOffset||new s.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,r;if(e&&e.center&&e.positions)return t=this.createGraphics(),i=0,n=e.positions,r=n[0],t.position=new s.CallbackProperty(function(){return 0==i?(r=n[0],i+=1):i<n.length-1?(r=n[i],i+=1):i==n.length-1&&(r=n[i],i=0),r},!1),t.plane={plane:new s.Plane(s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(200,150),material:new s.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 s.Plane(e.normal||s.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new s.Cartesian2(200,150),material:new s.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(t)},createGifBillboardGraphics:function(e){var t,n,r,o,a,l,c;if(i&&e&&e.position)return n=e.url,r=0,o=n,a=t=[],(l=document.createElement("img")).src=o,l.setAttribute("rel:animated_src",o),l.setAttribute("rel:auto_play","0"),document.body.appendChild(l),c=new i({gif:l}),new Promise(e=>{c.load(()=>{for(let e=1;e<=c.get_length();e++)c.move_to(e),a.push(c.get_canvas().toDataURL());e(a)})}),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:s.VerticalOrigin.BASELINE,image:new s.CallbackProperty(function(){return t.length?(r<6*(t.length-1)?r++:r=0,t[Math.floor(r/6)]):n},!1),scale:.2}})},setGraphicsRotate:function(e){var t,i,n,r;e&&e.entity&&e.rotateAmount&&(t=e.entity,i=e.rotateAmount,n=e.position,r=this,n.heading=0,n.pitch=0,n.roll=0,t.position=new s.CallbackProperty(function(){return r.transformWGS84ToCartesian(n)},!1),t.orientation=new s.CallbackProperty(function(){return 0<i&&(n.heading+=i,360===n.heading)&&(n.heading=0),s.Transforms.headingPitchRollQuaternion(r.transformWGS84ToCartesian(n),new s.HeadingPitchRoll(s.Math.toRadians(n.heading),s.Math.toRadians(n.pitch),s.Math.toRadians(n.roll)))},!1))},setGraphicsFloat:function(e){if(e&&e.entity&&e.maxHeiht)try{var t=e.entity,n=e.minHeiht||5,r=e.maxHeiht||100,o=e.cartesians,a=e.speed||.06,l=this,c=n,h=!1;o.length?t.positions=new s.CallbackProperty(function(){var e,t=l.transformCartesianArrayToWGS84Array(o);for(e in t){var i=t[e];(h=r<=n||n<=c?!h:h)?n+=a:n-=a,i.alt=n}return l.transformWGS84ArrayToCartesianArray(t)},!1):t.position=new s.CallbackProperty(function(){var e=l.transformCartesianToWGS84(o);return(h=r<=n||n<=c?!h:h)?n+=a:n-=a,e.alt=n,l.transformWGS84ToCartesian(e)},!1)}catch(e){console.log(e)}},createCanvasGraphics:function(r){r&&r.positions&&(this._graphicsLayer.entities.add({rectangle:{coordinates:r.positions,material:new s.ImageMaterialProperty({image:new s.CallbackProperty(function(){var e=0,t=document.createElement("canvas"),i=t.getContext("2d"),n=new Image;if(n.src=r.img||"../../images/ysCesium/logo.png",i.clearRect(0,0,r.cwidth,r.cheight),!(e<=r.cwidth))return e=0,e+=3,t;i.drawImage(n,e,0)},!1),transparent:!0})}}),"function"==typeof r.callback)&&r.callback()},createFanShape:function({viewer:e,longitude:t,latitude:i,alt:n,custMaterial:r,speed:o=0,direction:a="+"}){var l,c,h;if(e)return l=this.createGraphics(),c=0,h=this._calcPoints(t,i,n,c),l.wall={positions:new s.CallbackProperty(()=>s.Cartesian3.fromDegreesArrayHeights(h),!1),material:r||s.Color.AQUAMARINE.withAlpha(.5)},e.clock.onTick.addEventListener(()=>{0<o&&(c+=o,h=this._calcPoints(t,i,n,a+c))}),this._graphicsLayer.entities.add(l)},_computeCirclularFlight(t,i,n,r,o,a){var l=[],c=(l.push(t),l.push(i),l.push(0),s.Cartesian3.distance(s.Cartesian3.fromDegrees(t,i),s.Cartesian3.fromDegrees(n,r)));for(let e=o;e<=o+a;e++){var h=c*Math.sin(e*Math.PI/180),u=Math.cos(e*Math.PI/180),d=(r-i)*u+i;l.push((n-t)*u+t),l.push(d),l.push(h)}return l},_calcPoints(e,t,i,n){var r=s.Transforms.eastNorthUpToFixedFrame(s.Cartesian3.fromDegrees(e,t)),o=i*Math.cos(n*Math.PI/180),i=i*Math.sin(n*Math.PI/180),n=s.Cartesian3.fromElements(o,i,0),o=s.Matrix4.multiplyByPoint(r,n,new s.Cartesian3),i=s.Cartographic.fromCartesian(o),r=s.Math.toDegrees(i.longitude),n=s.Math.toDegrees(i.latitude);return this._computeCirclularFlight(e,t,r,n,0,90)}};let c=null;function h(e,t,i){e&&(c=t,this._installMaterial())}function u(){}h.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 c.PolylineCustomMaterialProperty({color:e.color||c.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=c.Color,t=c.defaultValue,n=c.defined,r=Object.defineProperties,o=c.Event,a=c.createPropertyDescriptor,s=c.Property,l=c.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 o,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||c.Color.BLUE,this.duration=e.duration||1e3,this._time=void 0};return r(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)},l._materialCache.addMaterial(u,{fabric:{type:u,uniforms:{color:i.color||new c.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=c.Color,t=c.defaultValue,r=c.defined,e=Object.defineProperties,o=c.Event,a=c.createPropertyDescriptor,s=c.Property,l=c.Material,h=i.MaterialType||"wallType"+parseInt(1e3*Math.random());function u(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new o,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=r(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)},l._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=c.Color,i=c.defaultValue,e=Object.defineProperties,n=c.Event,r=c.Property,o=c.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 o.CircleWaveType},a.prototype.getValue=function(e,t){return(t=t||{}).color=r.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&&c.Property.equals(this._color,e._color)},e(a.prototype,{color:c.createPropertyDescriptor("color"),duration:c.createPropertyDescriptor("duration")}),c.Scene.CircleWaveMaterialProperty=a,o.CircleWaveType="CircleWave",o._materialCache.addMaterial(o.CircleWaveType,{fabric:{type:o.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=c.Color,t=c.defaultValue,i=Object.defineProperties,n=c.Event,r=c.Property,o=c.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 o.CircleFadeMaterialType},s.prototype.getValue=function(e,t){return(t=t||{}).color=r.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&&c.Property.equals(this._color,e._color)},i(s.prototype,{color:c.createPropertyDescriptor("color")}),c.Scene.CircleFadeMaterialProperty=s,o.CircleFadeMaterialType="CircleFadeMaterial",o._materialCache.addMaterial(o.CircleFadeMaterialType,{fabric:{type:o.CircleFadeMaterialType,uniforms:{color:new e(1,0,0,1),time:1},source:this._getCircleFadeShader({get:!0})},translucent:function(){return!0}})},_installCityLineMaterial:function(){var e=c.Color,t=c.defaultValue,i=c.defined,n=Object.defineProperties,r=c.Event,o=c.createPropertyDescriptor,a=c.Property,s=c.Material,l=e.WHITE;function h(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this._colorSubscription=void 0,this.color=e.color||c.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:o("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,l,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)},c.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=c.Color,t=c.defaultValue,n=c.defined,e=Object.defineProperties,r=c.Event,o=c.createPropertyDescriptor,a=c.Property,s=c.Material;function l(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,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(l.prototype,{isvarant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),l.prototype.getType=function(){return s.WarnLinkType},l.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},l.prototype.equals=function(e){return this===e||e instanceof l&&a.equals(this._color,e._color)},e(l.prototype,{color:o("color")}),c.Scene.WarnLinkMaterialProperty=l,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=c.Color,i=c.defaultValue,e=Object.defineProperties,n=c.Event,r=c.createPropertyDescriptor,o=c.Property,a=c.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=o.getValueOrClonedDefault(this._color,e,c.Color.WHITE,t.color),t.duration=this._duration,t},s.prototype.equals=function(e){return this===e||e instanceof s&&o.equals(this._color,e._color)},e(s.prototype,{color:r("color"),duration:r("duration")}),c.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=c.Color,t=c.defaultValue,i=Object.defineProperties,n=c.createPropertyDescriptor,r=c.Event,o=c.Property,a=c.Material,s=this.getDfSt(["primitive","WaterPrimitive"]);function l(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new r,this._color=void 0,this.color=e.color||c.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(l.prototype,{isConstant:{get:function(){return!1},configurable:!0},definitionChanged:{get:function(){return this._definitionChanged},configurable:!0},color:n("color"),duration:n("duration")}),l.prototype.getType=function(){return a.PolylineTrailLinkType},l.prototype.getValue=function(e,t){return(t=c.defined(t)?t:{}).color=o.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},l.prototype.equals=function(e){return this===e||e instanceof l&&o.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 }",c.Scene.PolylineTrailLinkMaterial=l,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}})}},u.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 out vec4 myOutputColor;\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 myOutputColor = 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 myOutputColor = mix(myOutputColor, u_scanColor, f + f0);\n } else {\n myOutputColor = mix(myOutputColor, 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 out vec4 myOutputColor;\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 myOutputColor = 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 myOutputColor = mix(myOutputColor, u_scanColor, f);\n }\n }\n "}};let d={},p=void 0;function m(e,t,i){e&&(this._viewer=e,d=t,p=i,this._drawLayer=new d.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer),this.myname="BASE",this._installBaiduImageryProvider(),this._installGooGleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox())}m.prototype={createGraphics:function(){return new d.Entity},getDfSt(e){if(p)return e=e.reduce((e,t)=>(e||p)[t],void 0),p.baseService+e},setOneSkyBox:function(){return new d.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 d.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 d.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 d.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 d.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 d.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 d.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 d.Cartesian3(.1,.2,.3)}}}))},setBlurBloom:function(e){if(this._viewer&&e)return this._viewer.scene.postProcessStages.add(new d.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 d.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 d.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 d.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 d.Cartesian4(10,0,200,.3),fogColor:d.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 d.Cartesian3(0,e.distance,window.opt.distance),e.position=d.Cartesian3.add(e.position,t,new d.Cartesian3)),this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:d.Math.toRadians(90),pitch:d.Math.toRadians(90),roll:d.Math.toRadians(0)}}))},flyTo:function(e){var t;this._viewer&&e&&e.position&&(e.distance&&(t=new d.Cartesian3(0,e.distance,e.distance),e.position=d.Cartesian3.add(e.position,t,new d.Cartesian3)),this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:d.Math.toRadians(90),pitch:d.Math.toRadians(90),roll:d.Math.toRadians(0)},easingFunction:e.easingFunction||d.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback}))},transformCartesianToWGS84:function(e){if(this._viewer&&e)return e=d.Ellipsoid.WGS84.cartesianToCartographic(e),{lng:d.Math.toDegrees(e.longitude),lat:d.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?d.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=t||e.alt,d.Ellipsoid.WGS84):d.Cartesian3.ZERO},transformCartesianArrayToWGS84Array:function(e){var t;if(this._viewer)return t=this,e?e.map(function(e){return t.transformCartesianToWGS84(e)}):[]},setCameraEotateHeading(l){if(l){let t=this._viewer,i=d.Cartesian3.fromDegrees(l.lng,l.lat,l.height),n=d.Math.toRadians(-30),r=12,o=5e3,e=d.JulianDate.fromDate(new Date),a=(t.clock.startTime=e.clone(),t.clock.currentTime=e.clone(),t.clock.clockRange=d.ClockRange.CLAMPED,t.clock.clockStep=d.ClockStep.SYSTEM_CLOCK,t.camera.heading),s=function(){var e=d.JulianDate.secondsDifference(t.clock.currentTime,t.clock.startTime),e=d.Math.toRadians(e*r)+a;t.scene.camera.setView({destination:i,orientation:{heading:e,pitch:n}}),t.scene.camera.moveBackward(o),0<=d.JulianDate.compare(t.clock.currentTime,t.clock.stopTime)&&t.clock.onTick.removeEventListener(s)};t.clock.onTick.addEventListener(s)}},transformWGS84ToCartographic:function(e){return e?d.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):d.Cartographic.ZERO},getCatesian3FromPX:function(e){if(this._viewer&&e){var t,i,n=this._viewer.scene.pick(e),r=null,o=!1,a=!1;if((o=n instanceof d.Cesium3DTileFeature?!0:o)&&(r=this._viewer.scene.pickPosition(e))&&((t=d.Cartographic.fromCartesian(r)).height<0&&(t.height=0),s=d.Math.toDegrees(t.longitude),i=d.Math.toDegrees(t.latitude),t=t.height,r=this.transformWGS84ToCartesian({lng:s,lat:i,alt:t})),!n){var s=this._viewer.scene.camera.getPickRay(e);if(!s)return null;r=this._viewer.scene.globe.pick(s,this._viewer.scene),a=!0}return(r=o||a?r:this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid))?(i=this.transformCartesianToWGS84(r)).alt<0?this.transformWGS84ToCartesian(i,.1):r:!1}},getCameraPosition:function(){if(this._viewer){var e,t,i,n,r,o,a,s,l,c,h,u=this._viewer.scene.camera.pickEllipsoid(new d.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(u)return e=180*(u=d.Ellipsoid.WGS84.cartesianToCartographic(u)).longitude/Math.PI,u=180*u.latitude/Math.PI,n=this._viewer.camera._direction,t=d.Math.toDegrees(n.x),i=d.Math.toDegrees(n.y),n=d.Math.toDegrees(n.z),r=this._viewer.camera.positionCartographic.height,o=d.Math.toDegrees(this._viewer.camera.heading),a=d.Math.toDegrees(this._viewer.camera.pitch),s=d.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:u,height:r,heading:o,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 d.Cartesian3(t,i,n)}}},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:r,mouseWheel:o,leftUp:a}){var s;this._viewer&&(s=new d.ScreenSpaceEventHandler(this._viewer.canvas),t&&s.setInputAction(function(e){t(e,s)},d.ScreenSpaceEventType.LEFT_CLICK),i&&s.setInputAction(function(e){i(e,s)},d.ScreenSpaceEventType.MOUSE_MOVE),n&&s.setInputAction(function(e){n(e,s)},d.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),r&&s.setInputAction(function(e){r(e,s)},d.ScreenSpaceEventType.LEFT_DOWN),o&&s.setInputAction(function(e){o(e,s)},d.ScreenSpaceEventType.WHEEL),a)&&s.setInputAction(function(e){a(e,s)},d.ScreenSpaceEventType.LEFT_UP)},getHandelPosition:function(t){var i,n;this._viewer&&(i=new d.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)},d.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,r=new Uint8Array(n);n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:t})}(t),t=URL.createObjectURL(t),e.download="scene.png",e.href=t,e.click())},_installAmapImageryProvider:function(){d.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 d.UrlTemplateImageryProvider(e)}},_installTdtImageryProvider:function(){d.Scene.TdtImageryProvider=function(e){return new d.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(){d.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 d.UrlTemplateImageryProvider(e)}},_installGooGleImageryProvider:function(){d.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 d.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 d.WebMercatorTilingScheme({rectangleSouthwestInMeters:new d.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new d.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 d.DeveloperError("tileWidth must not be called before the imagery provider is ready.")}},tileHeight:{get:function(){if(this.ready)return this._tileHeight;throw new d.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},maximumLevel:{get:function(){if(this.ready)return this._tileHeight;throw new d.DeveloperError("tileHeight must not be called before the imagery provider is ready.")}},minimumLevel:{get:function(){if(this.ready)return 0;throw new d.DeveloperError("minimumLevel must not be called before the imagery provider is ready.")}},tilingScheme:{get:function(){if(this.ready)return this._tilingScheme;throw new d.DeveloperError("tilingScheme must not be called before the imagery provider is ready.")}},rectangle:{get:function(){if(this.ready)return this._rectangle;throw new d.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,r,o,a;if(this.ready)return e=e,t=t,i=i,r=(n=this)._style,o=n._url+"&x={x}&y={y}&z={z}&customid={style}",a=n._tilingScheme.getNumberOfXTilesAtLevel(i),n=n._tilingScheme.getNumberOfYTilesAtLevel(i),o=o.replace("{x}",e-a/2).replace("{y}",n/2-t-1).replace("{z}",i).replace("{style}",r),d.ImageryProvider.loadImage(this,o);throw new d.DeveloperError("requestImage must not be called before the imagery provider is ready.")},d.Scene.BaiduImageryProvider=e},_installGroundSkyBox:function(){var a=d.BoxGeometry,s=d.Cartesian3,t=d.defaultValue,l=d.defined,i=d.destroyObject,c=d.DeveloperError,h=d.GeometryPipeline,e=d.Matrix3,u=d.Matrix4,p=d.Transforms,m=d.VertexFormat,f=d.BufferUsage,g=d.CubeMap,n=d.DrawCommand,v=d.loadCubeMap,_=d.RenderState,y=d.VertexArray,w=d.BlendingState,C=d.SceneMode,P=d.ShaderProgram,x=d.ShaderSource;function r(e){this.sources=e.sources,this._sources=void 0,this.show=t(e.show,!0),this._command=new n({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}l(u.getRotation)||(u.getRotation=u.getMatrix3);var S=new e;r.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 r=this.sources;if(!(l(r.positiveX)&&l(r.negativeX)&&l(r.positiveY)&&l(r.negativeY)&&l(r.positiveZ)&&l(r.negativeZ)))throw new c("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof r.positiveX!=typeof r.negativeX||typeof r.positiveX!=typeof r.positiveY||typeof r.positiveX!=typeof r.negativeY||typeof r.positiveX!=typeof r.positiveZ||typeof r.positiveX!=typeof r.negativeZ)throw new c("this.sources properties must all be the same type.");"string"==typeof r.positiveX?v(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 g({context:n,source:r}))}var o=this._command;if(o.modelMatrix=p.eastNorthUpToFixedFrame(e.camera._positionWC),l(o.vertexArray)||(o.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return u.getRotation(o.modelMatrix,S)}},r=a.createGeometry(a.fromDimensions({dimensions:new s(2,2,2),vertexFormat:m.POSITION_ONLY})),e=this._attributeLocations=h.createAttributeLocations(r),o.vertexArray=y.fromGeometry({context:n,geometry:r,attributeLocations:e,bufferUsage:f._DRAW}),o.renderState=_.fromCache({blending:w.ALPHA_BLEND})),l(o.shaderProgram)&&this._useHdr===t||(r=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 "]}),o.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:r,attributeLocations:this._attributeLocations}),this._useHdr=t),l(this._cubeMap))return o}},r.prototype.isDestroyed=function(){return!1},r.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)},d.Scene.GroundSkyBox=r},removeHandlerByName(e=[]){e.forEach(e=>{this._viewer.screenSpaceEventHandler.removeInputAction(d.ScreenSpaceEventType[e])})}};let f={};function g(e,t){e&&(this._viewer=e,f=t)}g.prototype={splitCartesians3:function(e){for(var t=[],i=0;i<e.length;i+=3){var n=new f.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 r=[],o=f.Cartographic.fromCartesian(e),a=f.Cartographic.fromCartesian(t),s=180*o.longitude/Math.PI,o=180*o.latitude/Math.PI,l=180*a.longitude/Math.PI,a=180*a.latitude/Math.PI,c=Math.sqrt((s-l)*(s-l)+(o-a)*(o-a))*i,h=f.Cartesian3.clone(e),u=f.Cartesian3.clone(t),d=f.Cartesian3.distance(h,f.Cartesian3.ZERO),p=f.Cartesian3.distance(u,f.Cartesian3.ZERO);if(f.Cartesian3.normalize(h,h),f.Cartesian3.normalize(u,u),0!=f.Cartesian3.distance(h,u)){var m=f.Cartesian3.angleBetween(h,u);r.push(e);for(var g=1;g<n-1;g++){var v=+g/(n-1),_=1-v,y=Math.sin(_*m)/Math.sin(m),w=Math.sin(v*m)/Math.sin(m),y=f.Cartesian3.multiplyByScalar(h,y,new f.Cartesian3),w=f.Cartesian3.multiplyByScalar(u,w,new f.Cartesian3),y=f.Cartesian3.add(y,w,new f.Cartesian3),w=v*Math.PI,_=d*_+p*v+Math.sin(w)*c,y=f.Cartesian3.multiplyByScalar(y,_,y);r.push(y)}r.push(t)}return r}},getPositionsAngle:function(e){var t,i,n,r;if(e)return i=e.position1,r=e.position2,n=f.Transforms.eastNorthUpToFixedFrame(i),n=f.Matrix4.inverse(n,new f.Matrix4),i=f.Matrix4.multiplyByPoint(n,i,new f.Cartesian3),n=f.Matrix4.multiplyByPoint(n,r,new f.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)),(r=t*(180/Math.PI))<0&&(r+=360),r},getPositionsArea:function(n){let e=0;if(n){let t=0,i=f.Ellipsoid.WGS84;n.push(n[0]);for(let e=1;e<n.length;e++){var r=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e-1])),o=i.cartographicToCartesian(this.transformWGS84ToCartographic(n[e]));t+=r.x*o.y-o.x*r.y}e=Math.abs(t).toFixed(2)}return e},getPolygonArea:function(e){if(this._viewer){for(var t=function(e,t){var i=e.lat*radiansPerDegree,e=e.lon*radiansPerDegree,n=t.lat*radiansPerDegree,t=t.lon*radiansPerDegree,i=-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 i<0&&(i+=2*Math.PI),i*degreesPerRadian},i=0,n=0;n<e.length-2;n++){var r=(n+1)%e.length,o=(n+2)%e.length,a=(a=e[n],s=e[r],l=e[o],c=void 0,(c=t(s,a)-t(s,l))<0&&(c+=360),c);i+=this.getPositionsDistance(positions[n],positions[r])*this.getPositionsDistance(positions[r],positions[o])*Math.abs(Math.sin(a))}return(i/1e6).toFixed(4)}var a,s,l,c},getPointDistance:function(e,t){var i;if(this._viewer)return e=f.Cartographic.fromCartesian(e),t=f.Cartographic.fromCartesian(t),(i=new f.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]),r=this.transformWGS84ToCartographic(t[e+1]),o=new f.EllipsoidGeodesic,o=(o.setEndPoints(n,r),o.surfaceDistance),o=Math.sqrt(Math.pow(o,2)+Math.pow(r.height-n.height,2));i+=o}return i.toFixed(3)},getIntersectObj:function(e,t,i=[],n=!1){if(this._viewer)return t=f.Cartesian3.normalize(f.Cartesian3.subtract(t,e,new f.Cartesian3),new f.Cartesian3),e=new f.Ray(e,t),t=[],n?t=this._viewer.scene.drillPickFromRay(e,10,i):(n=this._viewer.scene.pickFromRay(e,i),f.defined(n)&&(t=[n])),t},getPointOnEllipsoid:function(e,t,i,n,r,o,a,s,l,c){var h,u,d,p;if(this._viewer)return h=new f.Cartesian3,u=new f.Cartesian3,d=new f.Quaternion,p=new f.Matrix3,t=e+t,f.Cartesian3.multiplyByScalar(n,Math.cos(t),h),f.Cartesian3.multiplyByScalar(i,Math.sin(t),u),f.Cartesian3.add(h,u,h),n=Math.cos(e),n*=n,i=Math.sin(e),i*=i,t=o/Math.sqrt(a*n+r*i)/s,f.Quaternion.fromAxisAngle(h,t,d),f.Matrix3.fromQuaternion(d,p),f.Matrix3.multiplyByVector(p,l,c),f.Cartesian3.normalize(c,c),f.Cartesian3.multiplyByScalar(c,s,c),c},raisePositionsToHeight:function(e,t,i){if(this._viewer){for(var n=new f.Cartesian3,r=new f.Cartesian3,o=new f.Cartesian3,a=new f.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 m=p+1,g=p+2,v=f.Cartesian3.fromArray(e,p,n),_=(s.scaleToGeodeticSurface(v,v),f.Cartesian3.clone(v,r)),y=s.geodeticSurfaceNormal(v,a),w=f.Cartesian3.multiplyByScalar(y,l,o);f.Cartesian3.add(v,w,v),i&&(f.Cartesian3.multiplyByScalar(y,c,w),f.Cartesian3.add(_,w,_),h[p+d]=_.x,h[m+d]=_.y,h[g+d]=_.z),h[p]=v.x,h[m]=v.y,h[g]=v.z}return h}},computeEllipseEdgePositions:function(e){if(this._viewer){for(var t=new f.Cartesian3,i=new f.Cartesian3,n=new f.Cartesian3,r=new f.Cartesian3,o=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),o*o),h=a*a,u=a*o,d=f.Cartesian3.magnitude(l),p=f.Cartesian3.normalize(l,t),m=f.Cartesian3.cross(f.Cartesian3.UNIT_Z,l,i),m=f.Cartesian3.normalize(m,m),g=f.Cartesian3.cross(p,m,n),v=Math.ceil(2*f.Math.PI/e),_=e,y=r,w=0,C=[],P=0;P<v;P++)y=this.getPointOnEllipsoid(P*_,s,g,m,c,u,h,d,p,y),C[w++]=y.x,C[w++]=y.y,C[w++]=y.z;a={};return a.numPts=v,a.outerPositions=C,a}},computeSectorEdgePositions:function(e){if(this._viewer){for(var t=new f.Cartesian3,i=new f.Cartesian3,n=new f.Cartesian3,r=new f.Cartesian3,o=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),o*o),u=a*a,d=a*o,p=f.Cartesian3.magnitude(c),m=f.Cartesian3.normalize(c,t),g=f.Cartesian3.cross(f.Cartesian3.UNIT_Z,c,i),g=f.Cartesian3.normalize(g,g),v=f.Cartesian3.cross(m,g,n),_=Math.ceil(l/e),y=e,w=r,C=0,P=[],x=0;x<_;x++)w=this.getPointOnEllipsoid(x*y,s,v,g,h,d,u,p,m,w),P[C++]=w.x,P[C++]=w.y,P[C++]=w.z;a={};return a.numPts=_,a.outerPositions=P,a}},computeLonlatPointsTerrainData:function(e,t){if(this._viewer){for(var i=[],n=0;n<e.length;n++)i.push(f.Cartographic.fromDegrees(e[n].lon,e[n].lat));this._viewer.scene.clampToHeightMostDetailed(i).then(function(e){t(e)})}},computeCartographicPointsTerrainData:function(e,r){if(this._viewer&&!(e.length<=0)){for(var t=[],i=0;i<e.length;i++)t.push(f.Cartesian3.fromRadians(e[i].longitude,e[i].latitude,e[i].height));var n=this._viewer.scene.clampToHeightMostDetailed(t),o=this;n.then(function(e){for(var t=[],i=o._viewer.scene.globe.ellipsoid,n=0;n<e.length;n++)t.push(i.cartesianToCartographic(e[n]));r(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 r=n/1e-5,o=(t.lon-e.lon)/r,a=(t.lat-e.lat)/r,s=0;s<r;s++){var l=e.lon+(s+1)*o,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=[],r=(n.push(new f.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(r<=i)n.push(new f.Cartographic(t.longitude,t.latitude));else{for(var o=r/i,a=(t.longitude-e.longitude)/o,s=(t.latitude-e.latitude)/o,l=0;l<o;l++){var c=e.longitude+(l+1)*a,h=e.latitude+(l+1)*s;n.push(new f.Cartographic(c,h))}n.push(new f.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 f.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 r=n/1e-5*Math.PI/180,o=(t.longitude-e.longitude)/r,a=(t.latitude-e.latitude)/r,s=(t.height-e.height)/r,l=0;l<r;l++){var c=e.longitude+(l+1)*o,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;i.push(new f.Cartographic(c,h,u))}return i.push(new f.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 r=[];r.push(new f.Cartographic(e.longitude,e.latitude,e.height));for(var o=(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)*o,h=e.latitude+(l+1)*a,u=e.height+(l+1)*s;r.push(new f.Cartographic(c,h,u))}return r},computeInterpolateIndexLineHeightCartographic:function(e,t,i,n){var r,o;return e&&t&&e.longitude&&e.latitude&&t.longitude&&t.latitude?(r=(t.longitude-e.longitude)/i,o=(t.latitude-e.latitude)/i,t=(t.height-e.height)/i,i=e.longitude+n*r,r=e.latitude+n*o,o=e.height+n*t,new f.Cartographic(i,r,o)):null}};let v=null;function y(e,t,i){e&&(this._viewer=e,v=t,this._installPrimitives())}y.prototype={_installPrimitives:function(){this._installProbingPrimitive(),this._installTexturePrimitive(),this._installWaterPrimitive(),this._installPointsPrimitive(),this._installShadowPrimitive(),this._installArrowPolylinePrimitive(),this._installXyzAxisPrimitive(),this._installTetrahedronPrimitive()},_installTetrahedronPrimitive:function(){try{var i=v.Cartesian3,n=v.ComponentDatatype,a=v.PrimitiveType,r=v.BoundingSphere,o=v.GeometryAttribute,s=v.GeometryPipeline,l=v.Geometry,c=v.defined,h=v.RenderState,u=v.ShaderSource,d=v.ShaderProgram,p=v.DrawCommand,m=v.Pass,f=v.Appearance,g=v.BufferUsage,t=v.Color,_=v.VertexArray,y=(v.buildModuleUrl,v.Matrix4),w=v.Matrix3,C=v.Texture,e=v.Resource,P=v.Transforms,x=v.defaultValue,S=this._viewer,M=this.getDfSt(["primitive","TetrahedronPrimitive"])||"static/data/images/Textures/fence.png",b=function(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=x(e.distance,1),this._setInterval=void 0,this._viewer=S,this._speed=x(e.speed,1),this._color=x(e.color,new t(1,1,0,.8)),this._scale=x(e.scale,new i(10,10,15)),this._texture=void 0,this._imageUrl=M,this._modelMatrix=R(this),this._height=k(this),D(this)};b.prototype.update=function(e){this.show&&(c(this._command)||(this._command=this._createCommand(e.context,this)),c(this._command))&&e.commandList.push(this._command)},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){return c(this._command)&&(this._command.shaderProgram=this._command.shaderProgram&&this._command.shaderProgram.destroy()),destroyObject(this)},b.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 v.Cartesian3(0,0,t._height),e=(y.multiplyByTranslation(t._modelMatrix,e,t._modelMatrix),y.fromRotationTranslation(w.fromRotationZ(v.Math.toRadians(t._speed))));y.multiply(t._modelMatrix,e,t._modelMatrix)},5)},b.prototype.closeAnimate=function(){clearInterval(this._setInterval)};const T=function(e,t){var i=I(),n=L(),r=f.getDefaultRenderState(!1,!0,void 0),r=h.fromCache(r),i=new u({sources:[i]}),n=new u({sources:[n]}),o={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:E(e),primitiveType:a.TRIANGLES,renderState:r,shaderProgram:i,uniformMap:o,owner:this,pass:m.TRANSLUCENT,modelMatrix:t._modelMatrix})},E=function(e){var t=A(),t=new l({attributes:{position:new o({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.positions}),textureCoordinates:new o({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:t.sts})},indices:t.indices,primitiveType:a.TRIANGLES,boundingSphere:r.fromVertices(t.positions)}),t=s.computeNormal(t);return _.fromGeometry({context:e,geometry:t,attributeLocations:{position:0,textureCoordinates:1},bufferUsage:g.STATIC_DRAW})},A=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){e.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=P.eastNorthUpToFixedFrame(e._localPosition),i=y.fromScale(e._scale),n=y.multiply(t,i,new y);return e._scaleMatrix=i,e._enuMatrix=t,n},k=function(e){var t=i.fromElements(0,0,e._distance,new v.Cartesian3),t=v.Matrix4.multiplyByPoint(e._enuMatrix,t,new i),t=y.multiplyByPoint(e._viewer.scene.camera._viewMatrix,t,new i),e=y.multiplyByPoint(e._viewer.scene.camera.frustum.projectionMatrix,t,new i);return i.normalize(e,new i).z};v.Scene.TetrahedronPrimitive=b}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 v.CustomDataSource("xyz-axis"),this._viewer.dataSources.add(this._layer),this._handler=new v.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=v.Matrix4.getTranslation(e.modelMatrix,new v.Cartesian3),e=e.boundingSphere,i=e.radius,n=new v.ArrowPolylinePrimitive({id:"axisZ",color:v.Color.RED,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),r=new v.ArrowPolylinePrimitive({id:"axisX",color:v.Color.GREEN,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),t=new v.ArrowPolylinePrimitive({id:"axisY",color:v.Color.BLUE,position:t,width:3,headWidth:5,length:2*i+50,headLength:10}),i=v.Matrix3.fromRotationY(v.Math.toRadians(90)),i=(this._rotationX=v.Matrix4.fromRotationTranslation(i),v.Matrix4.multiply(r.geometryInstances[0].modelMatrix,this._rotationX,r.geometryInstances[0].modelMatrix),v.Matrix4.multiply(r.geometryInstances[1].modelMatrix,this._rotationX,r.geometryInstances[1].modelMatrix),v.Matrix3.fromRotationX(v.Math.toRadians(90)));this._rotationY=v.Matrix4.fromRotationTranslation(i),v.Matrix4.multiply(t.geometryInstances[0].modelMatrix,this._rotationY,t.geometryInstances[0].modelMatrix),v.Matrix4.multiply(t.geometryInstances[1].modelMatrix,this._rotationY,t.geometryInstances[1].modelMatrix),this._layer._primitives.add(n),this._layer._primitives.add(r),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(v.Math.toRadians(e)),n=Math.cos(v.Math.toRadians(e)),r=this._radius*n,o=this._radius*i;t.push(new v.Cartesian3(r,o,0))}var e=this._createAxisSpheres("axisSphereZ",t,this._matrix,v.Color.RED);this._layer._primitives.add(e);const i=this._createAxisSpheres("axisSphereY",t,this._matrix,v.Color.GREEN),n=(this._layer._primitives.add(i),v.Matrix4.multiply(i.geometryInstances.modelMatrix,this._rotationY,i.geometryInstances.modelMatrix),this._createAxisSpheres("axisSphereX",t,this._matrix,v.Color.BLUE));this._layer._primitives.add(n),v.Matrix4.multiply(n.geometryInstances.modelMatrix,this._rotationX,n.geometryInstances.modelMatrix)},_createAxisSpheres:function(e,t,i,n){t=new v.PolylineGeometry({positions:t,width:10}),t=new v.GeometryInstance({geometry:t,id:e,attributes:{color:v.ColorGeometryInstanceAttribute.fromColor(n)}});return new v.Primitive({geometryInstances:t,appearance:new v.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 r=n[e],o=v.Matrix4.fromTranslation(new v.Cartesian3(i.x,i.y,i.z));v.Matrix4.multiply(r.modelMatrix,o,r.modelMatrix)}}var e=v.Matrix4.fromTranslation(new v.Cartesian3(i.x,i.y,i.z));v.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 r=n[e],o=v.Matrix4.fromRotationTranslation(i);v.Matrix4.multiply(r.modelMatrix,o,r.modelMatrix)}}var e=v.Matrix4.fromRotationTranslation(i);v.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(v.Matrix3.fromRotationX(v.Math.toRadians(1)));break;case"axisSphereY":this._updateAxisSphere(v.Matrix3.fromRotationY(v.Math.toRadians(1)));break;case"axisSphereZ":this._updateAxisSphere(v.Matrix3.fromRotationZ(v.Math.toRadians(1)))}},v.ScreenSpaceEventType.MOUSE_MOVE),this._handler.setInputAction(e=>{e=viewer.scene.pick(e.position);e&&e.id&&(this._xyzPid=e.id,this._xyzState=!0)},v.ScreenSpaceEventType.LEFT_DOWN),this._handler.setInputAction(()=>{this._xyzState=!1,this._xyzPid=void 0},v.ScreenSpaceEventType.LEFT_UP)}},v.Scene.XyzAxisPrimitive=e},_installArrowPolylinePrimitive:function(){v.Scene.ArrowPolylinePrimitive=function(e={}){this._color=e.color||v.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=v.CylinderGeometry.createGeometry(new v.CylinderGeometry({length:this._length,topRadius:this._width,bottomRadius:this._width})),i=v.CylinderGeometry.createGeometry(new v.CylinderGeometry({length:this._headLength,topRadius:0,bottomRadius:this._headWidth}));let n=(this._length+this._headLength)/2;this._inverse&&(n=-n);var r=i,o=[0,0,n],a=new v.Cartesian3;o.length?(a.x=o[0],a.y=o[1],a.z=o[2]):v.Cartesian3.clone(o,a);for(let e=0;e<r.attributes.position.values.length;e+=3)r.attributes.position.values[e]+=a.x,r.attributes.position.values[e+1]+=a.y,r.attributes.position.values[e+2]+=a.z;return new v.Primitive({modelMatrix:v.Transforms.eastNorthUpToFixedFrame(this.position),geometryInstances:[new v.GeometryInstance({id:e+"-line",geometry:t}),new v.GeometryInstance({id:e+"-arrow",geometry:i})],appearance:new v.MaterialAppearance({material:v.Material.fromType("Color",{color:this._color})})})}},_installShadowPrimitive:function(){function e(e){var t=(e=v.defaultValue(e,v.defaultValue.EMPTY_OBJECT)).scene;if(!v.defined(t))throw new v.DeveloperError("scene is required.");var i=(this._scene=t)._context;if(!v.defined(i))throw new v.DeveloperError("context is required.");if(!v.defined(e.viewerPosition))throw new v.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 v.Camera(t),this._depthCamera.position=this._viewerPosition,this._direction=0,this._pitch=0,this._horizontalFov=v.defaultValue(e.horizontalFov,60),this._verticalFov=v.defaultValue(e.verticalFov,45),this._cameraUpdated=!1,this._targetPoint=this._viewerPosition.clone();t=new v.Cartesian3(0,0,100),e=v.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);v.Matrix4.multiplyByPoint(e,t,this._targetPoint),this._distance=100,this._cameraUpdated=!1,this._modelMatrix=new v.Matrix4,this._shadowMap=new v.ShadowMap({context:i,enabled:!0,lightCamera:this._depthCamera,cascadesEnabled:!1}),this.show=!0,this._invisiblyColor=v.Color.RED,this._visiblyColor=v.Color.GREEN,this._shadowMap.useCustomColor=!0,this.shadowMap._customColor={invisibly:v.Color.RED,visibly:v.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 r=0;r<20;++r)e[t++]=i++,e[t++]=i}i++;for(var o=0;o<20;++o)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&&!v.defined(this.debugLightFrustum)&&(this._debugLightFrustum=new v.DebugCameraPrimitive({camera:this._depthCamera,color:v.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=v.Math.toRadians(Math.max(this._horizontalFov,this._verticalFov)),this._depthCamera.frustum.aspectRatio=this._horizontalFov/this._verticalFov,this._depthCamera.setView({destination:this._viewerPosition,orientation:{heading:v.Math.toRadians(this._direction),pitch:v.Math.toRadians(this._pitch)}}),this._modelMatrix=this._depthCamera.inverseViewMatrix,this._cameraUpdated=!0},e.prototype.setPoseByTargetPoint=function(e){this.distance=v.Cartesian3.distance(this._viewerPosition,e);var t=new v.Cartesian3,i=v.Transforms.eastNorthUpToFixedFrame(this._viewerPosition);v.Matrix4.inverse(i,i),v.Matrix4.multiplyByPoint(i,e,t),v.Cartesian3.normalize(t,t),this.direction=v.Math.toDegrees(Math.atan2(t.x,t.y)),this.pitch=v.Math.toDegrees(Math.asin(t.z))},e.prototype._updateHintLine=function(e){var t,i=this._positions,n=v.Math.toRadians(this._horizontalFov),r=v.Math.toRadians(this._verticalFov),o=Math.tan(.5*n),r=Math.tan(.5*r),a=-(o=this._distance*o),r=-(t=this._distance*r),a=new v.Cartesian3(a,r,-this._distance),r=new v.Cartesian3(o,t,0),o=(v.Matrix4.multiplyByPoint(this._modelMatrix,a,a),v.Matrix4.multiplyByPoint(this._modelMatrix,r,r),v.BoundingSphere.fromCornerPoints(a,r));if(e.cullingVolume.computeVisibility(o)!==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=-(y=Math.atan(p)),f=y/10,g=0;g<21;++g)l=m+g*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,_=0;_<21;++_){d=c+_*h;for(var y,p=t/(this._distance/Math.cos(d)),m=-(y=Math.atan(p)),f=y/2,w=0;w<5;++w)l=m+w*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=v.Buffer.createIndexBuffer({context:P,typedArray:new Uint32Array(this._indices),usage:v.BufferUsage.STATIC_DRAW,indexDatatype:IndexDatatype.UNSIGNED_INT}),r=v.Buffer.createVertexBuffer({context:P,typedArray:v.ComponentDatatype.createTypedArray(v.ComponentDatatype.FLOAT,this._positions),usage:v.BufferUsage.STATIC_DRAW}),n=[],e=(n.push({index:0,vertexBuffer:r,componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1}),new v.VertexArray({context:P,attributes:n,indexBuffer:a}));v.defined(this._drawLineCommand)?(this._drawLineCommand.vertexArray.destroy(),this._drawLineCommand.vertexArray=e,this._drawLineCommand.modelMatrix=this._modelMatrix,this._drawLineCommand.boundingVolume=o):(r=v.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=v.RenderState.fromCache({depthTest:{enabled:!0}}),a={u_bgColor:function(){return C._lineColor},u_modelViewMatrix:function(){return P.uniformState.modelView}},(C=this)._drawLineCommand=new v.DrawCommand({boundingVolume:o,modelMatrix:C._modelMatrix,primitiveType:v.PrimitiveType.LINES,vertexArray:e,shaderProgram:r,castShadows:!1,receiveShadows:!1,uniformMap:a,renderState:n,pass:v.Pass.OPAQUE})),this._hintLineUpdated=!0}else this._valid=!1},v.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 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=e.Colors}else 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.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=v.Cartesian3.fromDegrees(0,0,-10),l=v.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 v.Primitive({geometryInstances:new v.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 v.Appearance({renderState:{blending:v.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,depthTest:{enabled:!0},depthMask:!0},fragmentShaderSource:e,vertexShaderSource:t})},createGeometry:function(e,t,i){return new v.Geometry({attributes:{position:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),color:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:4,values:t})},indices:i,primitiveType:v.PrimitiveType.POINTS,boundingSphere:v.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=[],r=[],o=[],a=0;a<e.length;a++)n.push(e[a].x),n.push(e[a].y),n.push(e[a].z),r.push(0),r.push(0),r.push(1),r.push(1);for(var s=0;s<e.length;s++)o.push(s);this.positionArr=new Float64Array(n),this.colorArr=new Float32Array(r),this.indiceArr=new Uint16Array(o),geometry=this.createGeometry(this.positionArr,this.colorArr,this.indiceArr),appearance=this.createAppearence(this._fragmentShader,this._vertexShader)}this.primitive=this._viewer.scene.primitives.add(new v.Primitive({geometryInstances:new v.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 r=[],o=[],a=0;a<e.length;a++)r.push(e[a].x),r.push(e[a].y),r.push(e[a].z);for(a=0;a<e.length;a++)o.push(a);this.positionArr=new Float64Array(r),this.colorArr=new Float32Array(t),this.indiceArr=new Uint16Array(o),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 v.Primitive({geometryInstances:new v.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))}}},v.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 v.Primitive({allowPicking:!1,geometryInstances:new v.GeometryInstance({geometry:this._geometry}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createAppearence=function(){return new v.EllipsoidSurfaceAppearance({material:new v.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 v.PolygonGeometry({polygonHierarchy:new v.PolygonHierarchy(v.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 "},y.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 v.Primitive({allowPicking:!1,geometryInstances:new v.GeometryInstance({geometry:e}),appearance:this._appearance,asynchronous:!1})))},v.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 v.Primitive({geometryInstances:new v.GeometryInstance({geometry:this._geometry,id:this._id}),appearance:this._appearance,asynchronous:!1}))},e.prototype._createGeometry=function(){var e=new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:this._sts});return new v.Geometry({attributes:{position:new v.GeometryAttribute({componentDatatype:v.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:this._positions}),st:e},indices:this._indices,primitiveType:v.PrimitiveType.TRIANGLES,boundingSphere:v.BoundingSphere.fromVertices(positions)})},e.prototype._createAppearence=function(){return new v.Appearance({material:new v.Material({fabric:{uniforms:{image:this._url},source:this._materialShader}}),aboveGround:!0,faceForward:!0,flat:!0,translucent:!1,renderState:{blending:v.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; } "},v.Scene.TexturePrimitive=e},_installProbingPrimitive:function(){var t={color:new v.Color(1,0,1,.8),repeat:30,offset:0,thickness:.3,center:v.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 v.CylinderGeometry({length:this._length,topRadius:this._top,bottomRadius:this._bottom,vertexFormat:v.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat}),e=new v.GeometryInstance({geometry:e,modelMatrix:this.getModelMatrix()}),t=new v.MaterialAppearance({material:this.getMaterial(),faceForward:!1,closed:!0}),i=this;this._radar=this._viewer.scene.primitives.add(new v.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 v.Matrix4.multiplyByTranslation(v.Transforms.eastNorthUpToFixedFrame(this._center),new v.Cartesian3(0,0,.5*this._length),new v.Matrix4)},e.prototype.updateModelMatrix=function(){},e.prototype.getMaterial=function(){return new v.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)},v.Scene.ProbingPrimitive=e}};let _=null,w=null;function C(e,t,i){e&&(_=t,this._drawLayer=new _.CustomDataSource("drawLayer"),this.$graphics=new l(e,t),e)&&e.dataSources.add(this._drawLayer)}C.prototype={drawPointGraphics:function(t){var i,n,e,r,o,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 _.Cartesian2(0,-20)},this._viewer&&t&&(e=new _.Entity,r=[],o=this,a=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas),(w=a).setInputAction(function(e){e=o._viewer.scene.camera.pickEllipsoid(e.position,o._viewer.scene.globe.ellipsoid);e&&e.x&&(i=e,r.push(e))},_.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){a.destroy(),a=null,"function"==typeof t.callback&&t.callback(o.transformCartesianArrayToWGS84Array(r),n)},_.ScreenSpaceEventType.RIGHT_CLICK),e.billboard=t.style,e.position=new _.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 _.Entity,r=this,o=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);(w=o).setInputAction(function(e){e=r.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&n.push(e.clone()),t.measure&&a(e),2==n.length&&"straightLine"===t.type&&(o.destroy(),o=null,"function"==typeof t.callback)&&t.callback(r.transformCartesianArrayToWGS84Array(n),i),n.push(e))},_.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(function(e){e=r.getCatesian3FromPX(e.endPosition);2<=n.length&&e&&e.x&&(n.pop(),n.push(e))},_.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(function(e){o.destroy(),o=null;e=r.getCatesian3FromPX(e.position);t.measure&&a(e),"function"==typeof t.callback&&t.callback(r.transformCartesianArrayToWGS84Array(n),i)},_.ScreenSpaceEventType.RIGHT_CLICK),e.polyline={width:t.width||5,material:t.material||_.Color.BLUE.withAlpha(.8),clampToGround:t.clampToGround||!1,clampToS3M:t.clampToS3M||!1},e.polyline.positions=new _.CallbackProperty(function(){return n},!1),i=this._drawLayer.entities.add(e);const a=function(e){var t=new _.Entity;t.position=e,t.point={pixelSize:10,outlineColor:_.Color.BLUE,outlineWidth:5},t.label={text:(r.getPositionDistance(r.transformCartesianArrayToWGS84Array(n))/1e3).toFixed(4)+"公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,-80)},r._drawLayer.entities.add(t)}}},drawPolygonGraphics:function(i){if((i=i||{}).style=i.style||{width:3,material:_.Color.BLUE.withAlpha(.8),clampToGround:!0},this._viewer&&i){var n=[],t=new _.PolygonHierarchy,r=new _.Entity,o=this,a=null,s=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=s;s.setInputAction(function(e){e=o.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length&&(t.positions.push(e.clone()),n.push(e.clone())),n.push(e.clone()),t.positions.push(e.clone()),a||(r.polyline=i.style,r.polyline.positions=new _.CallbackProperty(function(){return n},!1),r.polygon={hierarchy:new _.CallbackProperty(function(){return t},!1),material:_.Color.WHITE.withAlpha(.1),clampToGround:i.clampToGround||!1},r.clampToS3M=!0,a=o._drawLayer.entities.add(r)))},_.ScreenSpaceEventType.LEFT_CLICK),s.setInputAction(function(e){e=o.getCatesian3FromPX(e.endPosition);2<=n.length&&e&&e.x&&(n.pop(),n.push(e),t.positions.pop(),t.positions.push(e))},_.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(function(){var e,t;s.destroy(),n.push(n[0]),i.height&&(r.polygon.extrudedHeight=i.height,r.polygon.material=_.Color.BLUE.withAlpha(.5)),i.measure&&(e=n[0],(t=new _.Entity).position=e,t.point={pixelSize:10,outlineColor:_.Color.BLUE,outlineWidth:5},t.label={text:(o.getPositionsArea(o.transformCartesianArrayToWGS84Array(n))/1e6).toFixed(4)+"平方公里",show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,-50)},o._drawLayer.entities.add(t)),"function"==typeof i.callback&&i.callback(o.transformCartesianArrayToWGS84Array(n),a)},_.ScreenSpaceEventType.RIGHT_CLICK)}},drawRectangleGraphics:function(t){var i,n,e,r,o,a;(t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t&&(n=[],e=new _.Entity,r=new _.Rectangle,o=this,a=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas),(w=a).setInputAction(function(e){e=o.getCatesian3FromPX(e.position);e&&e.x&&(0==n.length?n.push(e.clone()):(a.destroy(),n.push(e.clone()),r=_.Rectangle.fromCartesianArray([...n,e],_.Ellipsoid.WGS84),"function"==typeof t.callback&&t.callback(o.transformCartesianArrayToWGS84Array(n),i)))},_.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(function(e){e=o.getCatesian3FromPX(e.endPosition);e&&(r=_.Rectangle.fromCartesianArray([...n,e],_.Ellipsoid.WGS84))},_.ScreenSpaceEventType.MOUSE_MOVE),e.rectangle=t.style,t.height&&(e.rectangle.extrudedHeight=t.height),e.rectangle.coordinates=new _.CallbackProperty(function(){return r},!1),i=this._drawLayer.entities.add(e))},drawCircleGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5),clampToGround:!0},this._viewer&&t){var i,n=void 0,r=new _.Entity,o=this,a=1,s=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=s;const l=function(e,t){var e=_.Cartographic.fromCartesian(e),t=_.Cartographic.fromCartesian(t),i=new _.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=o.getCatesian3FromPX(e.position);e&&e.x&&(n?(l(n,e),s.destroy(),"function"==typeof t.callback&&t.callback({center:n,radius:a},i)):(n=e,r.ellipse=t.style,r.ellipse.semiMajorAxis=new _.CallbackProperty(function(){return a},!1),r.ellipse.semiMinorAxis=new _.CallbackProperty(function(){return a},!1),r.position=new _.CallbackProperty(function(){return n},!1),r.point={pixelSize:5,outlineColor:_.Color.RED,outlineWidth:3},t.height&&(r.ellipse.extrudedHeight=t.height),i=o._drawLayer.entities.add(r)))},_.ScreenSpaceEventType.LEFT_CLICK),s.setInputAction(function(e){e=o._viewer.scene.camera.pickEllipsoid(e.endPosition,o._viewer.scene.globe.ellipsoid);n&&e&&e.x&&l(n,e)},_.ScreenSpaceEventType.MOUSE_MOVE)}},drawTrianglesGraphics:function(t){if((t=t||{}).style=t.style||{width:3,material:_.Color.BLUE.withAlpha(.5)},this._viewer&&t){var i=new _.Entity,n=new _.Entity,r=new _.Entity,o=[],a=[],s=[],l=this,c=new _.ScreenSpaceEventHandler(this._viewer.scene.canvas);w=c;c.setInputAction(function(e){e=l.getCatesian3FromPX(e.position);if(!e)return!1;0==o.length?(o.push(e.clone()),o.push(e.clone()),a.push(e.clone()),a.push(e.clone())):(c.destroy(),"function"==typeof t.callback&&t.callback({e:i,e2:n,e3:r}))},_.ScreenSpaceEventType.LEFT_CLICK),c.setInputAction(function(e){var t,i,e=l.getCatesian3FromPX(e.endPosition);e&&0<o.length&&(o.pop(),o.push(e.clone()),t=o,i=_.Cartographic.fromCartesian(t[0]),t=_.Cartographic.fromCartesian(t[1]),i=_.Cartesian3.fromDegrees(_.Math.toDegrees(i.longitude),_.Math.toDegrees(i.latitude),t.height),a.pop(),a.push(i.clone()),s.pop(),s.pop(),s.push(e.clone()),s.push(i.clone()))},_.ScreenSpaceEventType.MOUSE_MOVE),i.polyline={positions:new _.CallbackProperty(function(){return o},!1),...t.style},i.position=new _.CallbackProperty(function(){return o[0]},!1),i.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},i.label={text:new _.CallbackProperty(function(){return"直线:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(o))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(50,-100)},n.polyline={positions:new _.CallbackProperty(function(){return a},!1),...t.style},n.position=new _.CallbackProperty(function(){return s[1]},!1),n.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},n.label={text:new _.CallbackProperty(function(){return"高度:"+(t=a[1],!(e=a[0])&&!t||_.Cartesian3.equals(e,t)?0:(e=_.Cartographic.fromCartesian(e),(_.Cartographic.fromCartesian(t).height-e.height).toFixed(2)))+"米";var e,t},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-20,100)},r.polyline={positions:new _.CallbackProperty(function(){return s},!1),...t.style},r.position=new _.CallbackProperty(function(){return o[1]},!1),r.point={pixelSize:5,outlineColor:_.Color.BLUE,outlineWidth:5},r.label={text:new _.CallbackProperty(function(){return"水平距离:"+l.getPositionDistance(l.transformCartesianArrayToWGS84Array(s))+"米"},!1),show:!0,showBackground:!0,font:"14px monospace",horizontalOrigin:_.HorizontalOrigin.LEFT,verticalOrigin:_.VerticalOrigin.BOTTOM,pixelOffset:new _.Cartesian2(-150,-20)},this._drawLayer.entities.add(r),this._drawLayer.entities.add(n),this._drawLayer.entities.add(i)}},drawWallGraphics:function(n){var r;(n=n||{}).style=n.style||{material:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.Color.WHITE},this._viewer&&n&&(r=this).drawPolygonGraphics({callback:function(e,t){var i=r._drawLayer.entities.add({wall:{positions:r.transformWGS84ArrayToCartesianArray(e),...n.style}});"function"==typeof n.callback&&n.callback(e,i)}})},drawEllipsoidGraphics:function(n){var r;(n=n||{}).style=n.style||{},this._viewer&&n&&(r=this).drawCircleGraphics({callback:function(e,t){var i=r.createGraphics(),t=(i.ellipsoid=r.$graphics.getEllipsoidGraphics({radii:e.radius}),i.position=e.center,r._drawLayer.entities.remove(t),r._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},t)}})},drawCylinderGraphics:function(n){var r;(n=n||{}).style=n.style||{},this._viewer&&n&&(r=this).drawCircleGraphics({callback:function(e,t){var i=r._drawLayer.entities.add({position:e.center,cylinder:{length:2*e.radius||n.length,topRadius:n.topRadius||e.radius,bottomRadius:n.bottomRadius||e.radius,material:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.Color.WHITE}});r._drawLayer.entities.remove(t),"function"==typeof n.callback&&n.callback({center:e.center,radius:e.radius},i)}})},drawCorridorGraphics:function(n){var r;(n=n||{}).style=n.style||{},this._viewer&&n&&(r=this).drawLineGraphics({callback:function(e,t){var i=r.createGraphics(),t=(i.corridor={positions:r.transformWGS84ArrayToCartesianArray(e),height:n.height||1,width:n.width||100,cornerType:_.CornerType.BEVELED,extrudedHeight:n.extrudedHeight||1,material:_.Color.BLUE.withAlpha(.5),outline:!0,outlineColor:_.Color.WHITE},r._drawLayer.entities.remove(t),r._drawLayer.entities.add(i));"function"==typeof n.callback&&n.callback(e,t)}})},drawPolylineVolumeGraphics:function(r){(r=r||{}).style=r.style||{};const o=r.circleRadius||20,a=r.arms||7,s=r.rOuter||150,l=r.rInner||75;var c;this._viewer&&r&&(c=this).drawLineGraphics({callback:function(e,t){var i=c.createGraphics(),n="fivePoint"===r.shape?c.computeStar2d(a,s,l):c.computeCircleShap(o),n=(i.polylineVolume={positions:c.transformWGS84ArrayToCartesianArray(e),shape:n,cornerType:_.CornerType.MITERED,material:r.color||_.Color.RED},c._drawLayer.entities.remove(t),c._drawLayer.entities.add(i));"function"==typeof r.callback&&r.callback(e,n)}})},removeAll(){this._drawLayer.entities.removeAll()},removeEventHandler(){w&&!w.isDestroyed()&&(w.removeInputAction(_.ScreenSpaceEventType.MOUSE_MOVE),w.removeInputAction(_.ScreenSpaceEventType.RIGHT_CLICK),w.removeInputAction(_.ScreenSpaceEventType.LEFT_CLICK))}};let P={};function x(e,t){e&&(this._viewer=e,P=t)}x.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 r=[],o=Math.PI/180*Math.round(360/n),a=0;a<n;a++){var s=t+e*Math.sin(o*a),l=i+e*Math.cos(o*a);r.unshift({x:s,y:l})}return r},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,r=2*e,o=new Array(r),a=0;a<r;a++){var s=a%2==0?t:i;o[a]=new P.Cartesian2(Math.cos(a*n)*s,Math.sin(a*n)*s)}return o},computeCircleShap(t){var i=[];for(let e=0;e<360;e++){var n=P.Math.toRadians(e);i.push(new P.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]],r=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[r[0]-e[1]+i[1],r[1]+e[0]-i[0]];return this.getIntersectPoint2d(n,t,r,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,r){var[o,a]=[1-(e=Math.max(Math.min(e,1),0)),e*e],s=a*e,l=o*o,c=l*o;return[c*t[0]+3*l*e*i[0]+3*o*a*n[0]+s*r[0],c*t[1]+3*l*e*i[1]+3*o*a*n[1]+s*r[1]]},getThirdPoint2d:function(e,t,i,n,r){e=this.getAzimuth2d(e,t),r=r?e+i:e-i,e=n*Math.cos(r),i=n*Math.sin(r);return[t[0]+e,t[1]+i]},inherits2d:function(e,r){function t(){}t.prototype=r.prototype,e.superClass_=r.prototype,e.prototype=new t,(e.prototype.constructor=e).base=function(e,t,i){var n=Array.prototype.slice.call(arguments,2);return r.prototype[t].apply(e,n)}},getArcPoints2d:function(t,i,n,e){var[r,o,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,r=t[0]+i*Math.cos(l),o=t[1]+i*Math.sin(l);a.push([r,o])}return a},getBisectorNormals2d:function(e,t,i,n){let r=this.getNormal2d(t,i,n),[o,a,s,l,c]=[null,null,null,null,null],h=Math.sqrt(r[0]*r[0]+r[1]*r[1]),u=r[0]/h,d=r[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,o=[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,o=[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]),o=[l,c],l=i[0]+e*(n[0]-i[0]),i[1]+e*(n[1]-i[1])),[l,c]),[o,a]},getNormal2d:function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],r=Math.sqrt(n*n+e*e),r=(n/=r,e/=r,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(r*r+i*i);return[n+(r/=t),e+(i/=t)]},getLeftMostControlPoint2d:function(e,t){let[i,n,r,o,a]=[e[0],e[1],e[2],null,null],s=this.getBisectorNormals2d(0,i,n,r)[0],l=this.getNormal2d(i,n,r);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],o=e[0]+(c*c-h*h)*d+u*p,e[1]+u*d+(h*h-c*c)*p):(o=i[0]+t*(n[0]-i[0]),i[1]+t*(n[1]-i[1])),[o,a]},getRightMostControlPoint2d:function(e,t){let i=e.length,n=e[i-3],r=e[i-2],o=e[i-1],a=this.getBisectorNormals2d(0,n,r,o)[1],s=this.getNormal2d(n,r,o),l=Math.sqrt(s[0]*s[0]+s[1]*s[1]),[c,h]=[null,null];var u,d,p,m,f;return h=1e-4<l?(e=this.mid2d(r,o),p=o[0]-e[0],u=o[1]-e[1],p=2*(u=-(d=2/this.mathDistance2d(r,o))*u)*(d=d*p),m=a[0]-e[0],f=a[1]-e[1],c=e[0]+(u*u-d*d)*m+p*f,e[1]+p*m+(d*d-u*u)*f):(c=o[0]+t*(r[0]-o[0]),o[1]+t*(r[1]-o[1])),[c,h]},getCurvePoints2d:function(t,i){let e=this.getLeftMostControlPoint2d(i,t),[n,r,o,a,s]=[null,null,null,[e],[]];for(let e=0;e<i.length-2;e++){[n,r,o]=[i[e],i[e+1],i[e+2]];var l=this.getBisectorNormals2d(t,n,r,o);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],r=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],r);s.push(h)}s.push(r)}return s},getBezierPoints2d:function(r){if(r.length<=2)return r;var e=[],o=r.length-1;for(let n=0;n<=1;n+=.01){let[t,i]=[0,0];for(let e=0;e<=o;e++){var a=this.getBinomialFactor2d(o,e),s=Math.pow(n,e),l=Math.pow(1-n,o-e);t+=a*s*l*r[e][0],i+=a*s*l*r[e][1]}e.push([t,i])}return e.push(r[o]),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(o){if(o.length<=2)return o;var[a,e]=[2,[]],t=o.length-a-1;e.push(o[0]);for(let r=0;r<=t;r++)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*o[r+e][0],i+=s*o[r+e][1]}e.push([t,i])}return e.push(o[o.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 S=null;function M(e,t){e&&(this._viewer=e,S=t)}M.prototype={setCircleScanEffect:function(e){var t,i,n,r,o,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||S.Color.RED,r=e.duration||1500,o=this,a=e.circleMode||"CircleScan",e=e.border||4,u=l,s=new S.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 S.Cartesian4(l.x,l.y,l.z,1),h=(new Date).getTime(),u=new S.PostProcessStage({name:t,fragmentShader:this._getCircleScanShader({get:!0,border:e}),uniforms:{u_scanCenterEC:function(){return S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,s,new S.Cartesian4)},u_scanPlaneNormalEC:function(){var e=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,s,new S.Cartesian4),t=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,c,new S.Cartesian4),i=new S.Cartesian3;return i.x=t.x-e.x,i.y=t.y-e.y,i.z=t.z-e.z,S.Cartesian3.normalize(i,i),i},u_radius:function(){return"CircleScan"==a?i*(((new Date).getTime()-h)%r)/r:i},u_scanColor:n}}),this._viewer.scene.postProcessStages.add(u),u},setRadarScanEffect:function(e){var t,i,n,r,o,a,s,l,c,h,u,d,p,m,f,g,v,_,y;if(e&&e.position)return t=e.id||"radarScan"+parseInt(1e3*Math.random()),c=e.position,i=e.radius,n=e.color||S.Color.RED,r=e.duration||1500,o=this,a=e.border||1,e=e.width||3,y=c,s=new S.Cartesian4(y.x,y.y,y.z,1),y=this.transformCartesianToWGS84(c),c=this.transformWGS84ToCartesian({lng:y.lng,lat:y.lat,alt:y.alt+500}),l=new S.Cartesian4(c.x,c.y,c.z,1),c=this.transformWGS84ToCartesian({lng:y.lng+.001,lat:y.lat,alt:y.alt}),h=new S.Cartesian4(c.x,c.y,c.z,1),u=(new Date).getTime(),d=new S.Quaternion,p=new S.Matrix3,m=new S.Cartesian4,f=new S.Cartesian4,g=new S.Cartesian4,v=new S.Cartesian3,_=new S.Cartesian3,y=new S.PostProcessStage({name:t,fragmentShader:this._getRadarScanShader({border:a,width:e,get:!0}),uniforms:{u_scanCenterEC:function(){return S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,s,m)},u_scanPlaneNormalEC:function(){var e=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,s,m),t=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,l,f);return v.x=t.x-e.x,v.y=t.y-e.y,v.z=t.z-e.z,S.Cartesian3.normalize(v,v),v},u_scanLineNormalEC:function(){var e=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,s,m),t=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,l,f),i=S.Matrix4.multiplyByVector(o._viewer.camera._viewMatrix,h,g),t=(v.x=t.x-e.x,v.y=t.y-e.y,v.z=t.z-e.z,S.Cartesian3.normalize(v,v),_.x=i.x-e.x,_.y=i.y-e.y,_.z=i.z-e.z,((new Date).getTime()-u)%r/r);return S.Quaternion.fromAxisAngle(v,t*S.Math.PI*2,d),S.Matrix3.fromQuaternion(d,p),S.Matrix3.multiplyByVector(p,_,_),S.Cartesian3.normalize(_,_),_},u_radius:i,u_scanColor:n}}),this._viewer.scene.postProcessStages.add(y),y},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 r=[],o=Math.PI/180*Math.round(360/n),a=0;for(;a<n;a++){var s=t+e*Math.sin(o*a),l=i+e*Math.cos(o*a);r.unshift({x:s,y:l})}return r},createLightScan_changeOnePosition:function(t,e,i){const n=t.positionList;let r,o,a,s,l,c,h=0,u=0;function d(e){r=n[e+1][0]-n[e][0],o=n[e+1][1]-n[e][1],a=r/t.number,s=o/t.number,u=0}d(h),e.polygon.hierarchy=new S.CallbackProperty(function(){return Math.abs(l)>=Math.abs(r)&&Math.abs(c)>=Math.abs(o)&&((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 S.PolygonHierarchy(S.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 r=n.observer[0],o=n.observer[1],a=n.observer[2],s=[];for(let e=0;e<i.length;e++){var l=e===i.length-1?new S.PolygonHierarchy(S.Cartesian3.fromDegreesArrayHeights([r,o,a,i[e].x,i[e].y,0,i[0].x,i[0].y,0])):new S.PolygonHierarchy(S.Cartesian3.fromDegreesArrayHeights([r,o,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}};const b="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}",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}",A='#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 E={};function I(t){var P=(E=t).BoundingSphere,x=E.Cartesian3,i=E.Color,d=E.combine,S=E.ComponentDatatype,n=E.defaultValue,r=E.defined,M=(E.destroyObject,E.DeveloperError),I=E.Matrix4,o=E.PrimitiveType,L=E.Buffer,D=E.BufferUsage,a=E.DrawCommand,R=E.Pass,k=E.RenderState,z=E.ShaderProgram,G=E.ShaderSource,F=E.VertexArray,O=E.BlendingState,B=E.CullFace,s=E.Material,$=E.SceneMode,V=E.VertexFormat,H=E.Math,W=E.Matrix3,U=(I=E.Matrix4,E.JulianDate),u=(E.BoxGeometry,E.EllipsoidGeometry,Math.sin),N=Math.cos,q=Math.tan,j=Math.atan,Y={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=I.clone(e.modelMatrix,new I),this._modelMatrix=new I,this._computedModelMatrix=new I,this._computedScanPlaneModelMatrix=new I,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=r(e.material)?e.material:s.fromType(s.ColorType),this._material=void 0,this._translucent=void 0,this.lateralSurfaceMaterial=r(e.lateralSurfaceMaterial)?e.lateralSurfaceMaterial:s.fromType(s.ColorType),this._lateralSurfaceMaterial=void 0,this._lateralSurfaceTranslucent=void 0,this.showDomeSurfaces=n(e.showDomeSurfaces,!0),this.domeSurfaceMaterial=r(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=U.now(),this._boundingSphere=new P,this._boundingSphereWC=new P,this._sectorFrontCommand=new a({owner:this,primitiveType:o.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorBackCommand=new a({owner:this,primitiveType:o.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorVA=void 0,this._sectorLineCommand=new a({owner:this,primitiveType:o.LINES,boundingVolume:this._boundingSphereWC}),this._sectorLineVA=void 0,this._sectorSegmentLineCommand=new a({owner:this,primitiveType:o.LINES,boundingVolume:this._boundingSphereWC}),this._sectorSegmentLineVA=void 0,this._domeFrontCommand=new a({owner:this,primitiveType:o.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeBackCommand=new a({owner:this,primitiveType:o.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeVA=void 0,this._domeLineCommand=new a({owner:this,primitiveType:o.LINES,boundingVolume:this._boundingSphereWC}),this._domeLineVA=void 0,this._scanPlaneFrontCommand=new a({owner:this,primitiveType:o.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanPlaneBackCommand=new a({owner:this,primitiveType:o.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,r,o=e.mode;if(this.show&&o===$.SCENE3D){var o=!1,a=!1,s=!1,l=this.xHalfAngle,c=this.yHalfAngle;if(l<0||c<0)throw new M("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,o=!0);var h=this.radius;if(h<0)throw new M("this.radius must be greater than or equal to zero.");var u,d,p,m,f=!1,h=(this._radius!==h&&(f=!0,this._radius=h,this._boundingSphere=new P(x.ZERO,this.radius)),I.equals(this.modelMatrix,this._modelMatrix)&&!f||(I.clone(this.modelMatrix,this._modelMatrix),I.multiplyByUniformScale(this.modelMatrix,this.radius,this._computedModelMatrix),P.transform(this._boundingSphere,this.modelMatrix,this._boundingSphereWC)),this.showThroughEllipsoid),f=(this._showThroughEllipsoid!==this.showThroughEllipsoid&&(this._showThroughEllipsoid=h,a=!0),this.material),g=(this._material!==f&&(this._material=f,s=a=!0),f.isTranslucent()),v=(this._translucent!==g&&(this._translucent=g,a=!0),this.showScanPlane&&(m=e.time,(p=U.secondsDifference(m,this._time))<0&&(this._time=U.clone(m,this._time)),m=Math.max(p%this.scanPlaneRate/this.scanPlaneRate,0),"horizontal"==this.scanPlaneMode?(p=N(u=2*c*m-c),d=q(l),p=j(p*d),this._scanePlaneXHalfAngle=p,this._scanePlaneYHalfAngle=u,E.Matrix3.fromRotationX(this._scanePlaneYHalfAngle,J)):(u=2*l*m-l,d=q(c),p=N(u),m=j(p*d),this._scanePlaneXHalfAngle=u,this._scanePlaneYHalfAngle=m,E.Matrix3.fromRotationY(this._scanePlaneXHalfAngle,J)),E.Matrix4.multiplyByMatrix3(this.modelMatrix,J,this._computedScanPlaneModelMatrix),I.multiplyByUniformScale(this._computedScanPlaneModelMatrix,this.radius,this._computedScanPlaneModelMatrix)),o&&(l=this,c=e.context,p=Z(l,l.xHalfAngle,l.yHalfAngle),d=l.xHalfAngle,u=l.yHalfAngle,m=p.zoy,p=p.zox,o=[],n=W.fromRotationY(d,J),o.push(m.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)})),n=W.fromRotationX(-u,J),o.push(p.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)}).reverse()),n=W.fromRotationY(-d,J),o.push(m.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)}).reverse()),n=W.fromRotationX(u,J),o.push(p.map(function(e){return W.multiplyByVector(n,e,new E.Cartesian3)})),d=o,l.showLateralSurfaces&&(l._sectorVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(18*i),r=0,o=0,a=t.length;o<a;o++)for(var s=t[o],l=x.normalize(x.cross(s[0],s[s.length-1],X),X),c=0,i=s.length-1;c<i;c++)n[r++]=0,n[r++]=0,n[r++]=0,n[r++]=-l.x,n[r++]=-l.y,n[r++]=-l.z,n[r++]=s[c].x,n[r++]=s[c].y,n[r++]=s[c].z,n[r++]=-l.x,n[r++]=-l.y,n[r++]=-l.z,n[r++]=s[c+1].x,n[r++]=s[c+1].y,n[r++]=s[c+1].z,n[r++]=-l.x,n[r++]=-l.y,n[r++]=-l.z;var h=L.createVertexBuffer({context:e,typedArray:n,usage:D.STATIC_DRAW}),u=6*Float32Array.BYTES_PER_ELEMENT,h=[{index:Y.position,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:u},{index:Y.normal,vertexBuffer:h,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:3*Float32Array.BYTES_PER_ELEMENT,strideInBytes:u}];return new F({context:e,attributes:h})}(c,d)),l.showSectorLines&&(l._sectorLineVA=function(e,t){for(var i=new Float32Array(9*t.length),n=0,r=0,o=t.length;r<o;r++){var a=t[r];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:D.STATIC_DRAW}),l=3*Float32Array.BYTES_PER_ELEMENT,s=[{index:Y.position,vertexBuffer:s,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:l}];return new F({context:e,attributes:s})}(c,d)),l.showSectorSegmentLines&&(l._sectorSegmentLineVA=function(e,t){for(var i=Array.prototype.concat.apply([],t).length-t.length,n=new Float32Array(9*i),r=0,o=0,a=t.length;o<a;o++)for(var s=t[o],l=0,i=s.length-1;l<i;l++)n[r++]=s[l].x,n[r++]=s[l].y,n[r++]=s[l].z,n[r++]=s[l+1].x,n[r++]=s[l+1].y,n[r++]=s[l+1].z;var c=L.createVertexBuffer({context:e,typedArray:n,usage:D.STATIC_DRAW}),h=3*Float32Array.BYTES_PER_ELEMENT,c=[{index:Y.position,vertexBuffer:c,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:h}];return new F({context:e,attributes:c})}(c,d)),l.showDomeSurfaces&&(l._domeVA=(m=c,u=E.EllipsoidGeometry.createGeometry(new E.EllipsoidGeometry({vertexFormat:V.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),F.fromGeometry({context:m,geometry:u,attributeLocations:Y,bufferUsage:D.STATIC_DRAW,interleave:!1}))),l.showDomeLines&&(l._domeLineVA=(p=c,o=E.EllipsoidOutlineGeometry.createGeometry(new E.EllipsoidOutlineGeometry({vertexFormat:V.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),F.fromGeometry({context:p,geometry:o,attributeLocations:Y,bufferUsage:D.STATIC_DRAW,interleave:!1}))),l.showScanPlane)&&("horizontal"==l.scanPlaneMode?(r=Z(l,H.PI_OVER_TWO,0),l._scanPlaneVA=Q(c,r.zox)):(r=Z(l,0,H.PI_OVER_TWO),l._scanPlaneVA=Q(c,r.zoy))),a&&(o=this,l=h,g?(o._frontFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:B.BACK}}),o._backFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND,cull:{enabled:!0,face:B.FRONT}}),o._pickRS=k.fromCache({depthTest:{enabled:!l},depthMask:!1,blending:O.ALPHA_BLEND})):(o._frontFaceRS=k.fromCache({depthTest:{enabled:!l},depthMask:!0}),o._pickRS=k.fromCache({depthTest:{enabled:!0},depthMask:!0}))),s&&(r=c=this,l=h=f,f=(o=e).context,t=b,i=new G({sources:[T,l.shaderSource,A]}),r._sp=z.replaceCache({context:f,shaderProgram:r._sp,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:Y}),i=new G({sources:[T,l.shaderSource,A],pickColorQualifier:"uniform"}),r._pickSP=z.replaceCache({context:f,shaderProgram:r._pickSP,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:Y}),c.showScanPlane)&&(l=c,f=h,r=o.context,f=new G({sources:[T,f.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=z.replaceCache({context:r,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:f,attributeLocations:Y})),(a||s)&&(t=g,(i=this)._colorCommands.length=0,c=t?R.TRANSLUCENT:R.OPAQUE,i.showLateralSurfaces&&K(i,i._sectorFrontCommand,i._sectorBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorVA,i._uniforms,i._computedModelMatrix,t,c),i.showSectorLines&&K(i,i._sectorLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showSectorSegmentLines&&K(i,i._sectorSegmentLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._sectorSegmentLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showDomeSurfaces&&K(i,i._domeFrontCommand,i._domeBackCommand,i._frontFaceRS,i._backFaceRS,i._sp,i._domeVA,i._uniforms,i._computedModelMatrix,t,c),i.showDomeLines&&K(i,i._domeLineCommand,void 0,i._frontFaceRS,i._backFaceRS,i._sp,i._domeLineVA,i._uniforms,i._computedModelMatrix,t,c,!0),i.showScanPlane)&&K(i,i._scanPlaneFrontCommand,i._scanPlaneBackCommand,i._frontFaceRS,i._backFaceRS,i._scanePlaneSP,i._scanPlaneVA,i._scanUniforms,i._computedScanPlaneModelMatrix,t,c),e.commandList),h=e.passes,_=this._colorCommands;if(h.render)for(var y=0,w=_.length;y<w;y++){var C=_[y];v.push(C)}}}};var J=new W,X=new x;function Z(e,t,i){for(var n=e.slice,e=N(i),i=q(i),r=N(t),t=q(t),o=j(r*i),a=j(e*t),s=[],l=0;l<n;l++){var c=2*o*l/(n-1)-o;s.push(new x(0,u(c),N(c)))}for(var h=[],l=0;l<n;l++)h.push(new x(u(c=2*a*l/(n-1)-a),0,N(c)));return{zoy:s,zox:h}}function Q(e,t){for(var i=t.length-1,n=new Float32Array(9*i),r=0,o=0;o<i;o++)n[r++]=0,n[r++]=0,n[r++]=0,n[r++]=t[o].x,n[r++]=t[o].y,n[r++]=t[o].z,n[r++]=t[o+1].x,n[r++]=t[o+1].y,n[r++]=t[o+1].z;var a=L.createVertexBuffer({context:e,typedArray:n,usage:D.STATIC_DRAW}),s=3*Float32Array.BYTES_PER_ELEMENT,a=[{index:Y.position,vertexBuffer:a,componentsPerAttribute:3,componentDatatype:S.FLOAT,offsetInBytes:0,strideInBytes:s}];return new F({context:e,attributes:a})}function K(e,t,i,n,r,o,a,s,l,c,h,u){c&&i&&(i.vertexArray=a,i.renderState=r,i.shaderProgram=o,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=o,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,r=L.Event,o=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 r,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:o("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,_){function c(e,t,i){var n=t[e.id];C(n)&&(n=n.primitive,i.remove(n),n.isDestroyed()||n.destroy(),delete t[e.id])}var i,y,w,C,r,P,x,S,M,b,T,E,A,I,L,D,R,n;if(e)return i=(k=e).AssociativeArray,y=k.Cartesian3,w=k.Color,C=k.defined,r=k.destroyObject,P=k.DeveloperError,x=k.Matrix3,S=k.Matrix4,M=k.Quaternion,b=k.MaterialProperty,T=k.Property,E=new x,new S,A=new y,I=new y,L=new M,D=new y,R=new M,(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,r=0,o=t.length;r<o;r++){var a,s,l,c=t[r],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,A),g=T.getValueOrUndefined(c._orientation,e,L),v=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 _).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=y.subtract(a,p,D),f=y.angleBetween(k.Cartesian3.UNIT_Z,m),m=y.cross(k.Cartesian3.UNIT_Z,m,D),g=M.fromAxisAngle(m,f-Math.PI,R),v=y.distance(a,p);d.modelMatrix=S.fromRotationTranslation(x.fromQuaternion(g,E),a,d.modelMatrix)}else y.equals(a,u.position)&&M.equals(g,u.orientation)||(C(g)?(d.modelMatrix=S.fromRotationTranslation(x.fromQuaternion(g,E),a,d.modelMatrix),u.position=y.clone(a,u.position),u.orientation=M.clone(g,u.orientation)):(d.modelMatrix=k.Transforms.eastNorthUpToFixedFrame(a),u.position=y.clone(a,u.position)));d.show=!0,d.gaze=c,d.radius=v,d.xHalfAngle=s,d.yHalfAngle=l,d.lineColor=T.getValueOrDefault(h._lineColor,e,w.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=b.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,w.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,w.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 r(this)},n.prototype._onCollectionChanged=function(e,t,i,n){for(var r,o=this._entitiesToVisualize,a=this._hash,s=this._primitives,l=t.length-1;-1<l;l--)r=t[l],C(r._rectangularSensor)&&C(r._position)&&o.set(r.id,r);for(l=n.length-1;-1<l;l--)r=n[l],C(r._rectangularSensor)&&C(r._position)?o.set(r.id,r):(c(r,a,s),o.remove(r.id));for(l=i.length-1;-1<l;l--)c(r=i[l],a,s),o.remove(r.id)},n}let R=null;function F(e,t){e&&(this.viewer=e,R=t,this._installPlugin())}F.prototype={_installPlugin:function(){this._installCounputeVertex(),this._installCylinderGeometry(),this._installRadarPrimitive()},_installCylinderGeometry:function(){function S(e){this.length=e.length,this.topRadius=e.topRadius,this.bottomRadius=e.bottomRadius,this.slices=e.slices||64,this.zReverse=e.zReverse}var b=new R.Cartesian2,M=new R.Cartesian3,T=new R.Ray;S._createGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,r=e.slices,o=2*Math.PI/(r-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=b;p.z=Math.sin(e);for(var m=Math.cos(e),f=0;f<u.length;f++){c[f]=[];for(var g=h[f],v=0;v<r;v++){c[f].push(d++);var _=o*v,y=g*Math.cos(_),w=g*Math.sin(_);a.push(y,w,u[f]),y=m*Math.cos(_),w=m*Math.sin(_),s.push(y,w,p.z),l.push(f/(u.length-1),0)}}for(var C=[],f=1;f<u.length;f++)for(v=1;v<r;v++){var P=c[f-1][v-1],x=c[f][v-1],S=c[f][v],M=c[f-1][v];C.push(S),C.push(M),C.push(P),C.push(S),C.push(P),C.push(x),v==c[f].length-1&&(P=c[f-1][v],x=c[f][v],S=c[f][0],M=c[f-1][0],C.push(S),C.push(M),C.push(P),C.push(S),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},S.createGeometry=function(e,t){if(!t)return S._createGeometry(e);R.Matrix4.multiplyByPoint(t,R.Cartesian3.ZERO,M),M.clone(T.origin);var i=e.length,n=e.topRadius,r=(e.bottomRadius,e.slices),o=2*Math.PI/(r-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 f=p*m,g=[],v=0;v<r;v++){var _=o*v,y=f*Math.cos(_),_=f*Math.sin(_);d.x=y,d.y=_,d.z=h[1],(0,R.Scene.extend2Earth)(d,t,T)?(g.push(u),a.push(y,_,h[1]),s.push(m/15,1),u++):g.push(-1)}c.push(g)}for(var w,C,P=[0,c.length-1],x=0;x<P.length;x++)for(m=P[x],v=1;v<c[m].length;v++)w=c[m][v-1],C=c[m][v],0<=w&&0<=C&&l.push(0,w,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},S.createOutlineGeometry=function(e){var t=e.length,i=e.topRadius,n=e.bottomRadius,r=e.slices,o=2*Math.PI/(r-1),a=[],s=[],l=[],c=[],h=[n,i],u=[0,e.zReverse?-t:t],d=0,e=Math.atan2(n-i,t),p=b;p.z=Math.sin(e);for(var m=Math.cos(e),f=0;f<u.length;f++){c[f]=[];for(var g=h[f],v=0;v<r;v++){c[f].push(d++);var _=o*v,y=g*Math.cos(_),w=g*Math.sin(_);a.push(y,w,u[f]),y=m*Math.cos(_),w=m*Math.sin(_),s.push(y,w,p.z),l.push(f/(u.length-1),0)}}for(var C=[],f=1;f<u.length;f++)for(v=1;v<r;v+=1){var P=c[f-1][v-1],x=c[f][v-1];c[f][v],c[f-1][v],v%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},S.fromAngleAndLength=function(e,t,i){return e=R.Math.toRadians(e),new S({topRadius:Math.tan(e)*t/2,bottomRadius:0,length:t,zReverse:i})},R.Scene.CylinderGeometry=S},_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=[],r=[],o=90-parseInt(this.angle),a=o<1?o/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),f=Math.sqrt(e*e-m*m-p*p);t.push(m,p,f),i.push(1,1),u.push(l++)}r.push(u)}for(c=1;c<r.length;c++)for(d=1;d<r[c].length;d++){var g=r[c-1][d-1],v=r[c][d-1],_=r[c][d],y=r[c-1][d];n.push(g,v,_),n.push(g,_,y)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),o={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),o=new R.Geometry({attributes:o,indices:n,primitiveType:R.PrimitiveType.TRIANGLES,boundingSphere:w});return(0,R.Scene.computeVertexNormals)(o),o},e.prototype.getTopOutlineGeometry=function(){for(var e=this.radius,t=[],i=[],n=[],r=[],o=90-parseInt(this.angle),a=o<1?o/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),f=Math.sqrt(e*e-m*m-p*p);t.push(m,p,f),i.push(1,1),u.push(l++)}r.push(u)}for(c=1;c<r.length;c++)for(d=1;d<r[c].length;d++){var g=r[c-1][d-1],v=r[c][d-1],_=r[c][d];r[c-1][d],d%8==1&&n.push(g,v),c%8==1&&n.push(v,_)}var t=new Float32Array(t),n=new Int32Array(n),i=new Float32Array(i),o={position:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}),st:new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:i})},y=R.BoundingSphere.fromVertices(t),o=new R.Geometry({attributes:o,indices:n,primitiveType:R.PrimitiveType.LINES,boundingSphere:y});return(0,R.Scene.computeVertexNormals)(o),o},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,r=new R.Cartesian3,r=(R.Matrix4.multiplyByPoint(this._matrix,e.boundingSphere.center,r),new R.BoundingSphere(r,e.boundingSphere.radius)),i=new R.DrawCommand({modelMatrix:i||this._matrix,owner:this,primitiveType:e.primitiveType,pass:R.Pass.TRANSLUCENT,boundingVolume:r}),o=this,r=R.GeometryPipeline.createAttributeLocations(e);return i.vertexArray=R.VertexArray.fromGeometry({context:n,geometry:e,attributeLocations:r,bufferUsage:R.BufferUsage.STATIC_DRAW}),i.vertexArray._attributeLocations=r,i.shaderProgram=R.ShaderProgram.replaceCache({context:n,vertexShaderSource:this.getVertexShaderSource(e),fragmentShaderSource:this.getFragmentShaderSource(e),attributeLocations:r}),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 o.shininess||(o.shininess=0),o.shininess},i.uniformMap.emission=function(){return o.emission||(o.emission=new R.Cartesian3(.2,.2,.2)),o.emission},i.uniformMap.specular=function(){return o.specular||(o.specular=0),o.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?(o.defaultLineColor||(o.defaultLineColor=new R.Color(1,1,0,1)),o.defaultLineColor):(o.defaultColor||(o.defaultColor=new R.Color(1,0,0,1)),o.defaultColor)},i.uniformMap.picked=function(){return o.picked||(o.picked=0),o.picked},i.uniformMap.pickedColor=function(){return o.pickedColor||(o.pickedColor=new R.Color(1,1,0,1)),o.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 r=new R.Cartesian3,o=(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 r=i.position.values;if(void 0===i.normal)i.normal=new R.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(r.length)});else for(var o=i.normal.values,a=0;a<n;a++)o[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,f=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(r,s,u),R.Cartesian3.fromArray(r,l,d),R.Cartesian3.fromArray(r,c,p),R.Cartesian3.subtract(p,d,m),R.Cartesian3.subtract(u,d,f),R.Cartesian3.cross(m,f,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 g,v,_,y,w=e.attributes.normal.values,C=0;C<w.length;C+=3)g=w[C],v=w[C+1],_=w[C+2],y=1/Math.sqrt(g*g+v*v+_*_),w[C]=g*y,w[C+1]=v*y,w[C+2]=_*y;i.normal.needsUpdate=!0}return e},R.Scene.extend2Earth=function(e,t,i,n){n=n||R.Ellipsoid.WGS84,R.Matrix4.multiplyByPoint(t,e,r),R.Cartesian3.subtract(r,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,o)}catch(e){return null}return n}}};let G={};function O(e,t){if(t){new F(e,G=t);const i=new I(t),n=new D(t),o=new z(t,i);G.Scene.RectangularSensorPrimitive=i,G.Scene.RectangularSensorGraphics=n,G.Scene.RectangularSensorVisualizer=o;var e=G.DataSourceDisplay,r=e.defaultVisualizersCallback;e.defaultVisualizersCallback=function(e,t,i){var n=i.entities;return r(e,t,i).concat([new o(e,n)])}}}let B=null;function H(e,t){e&&(this._viewer=e,B=t,this._customPluginLayer=new B.CustomDataSource("_customPluginLayer"),new O(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:e.showScanPlane||!0,scanPlaneColor:e.scanPlaneColor||new B.Color(1,0,1,1),scanPlaneMode:e.scanPlaneMode||"vertical",scanPlaneRate:e.scanPlaneRate||3,showThroughEllipsoid:e.showThroughEllipsoid||!1,show:!0})})},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,U,V=null,N={},j="move",Y=null;function X(e,t){e&&(this._viewer=e,Y=e,V=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("读取数据失败")})}},V.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 n.GUI,r=this._viewer,t=e.addFolder("加载数据文件"),i=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()},o={point:()=>{i(e=>{V.GeoJsonDataSource.load(e).then(function(e){r.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:V.Color.BLUE}}r.flyTo(e)})})},polyline:()=>{i(e=>{V.GeoJsonDataSource.load(e).then(function(e){r.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 V.PolylineGlowMaterialProperty({glowPower:.1,color:V.Color.ORANGERED.withAlpha(.9)})}r.flyTo(e)})})},polygon:()=>{i(e=>{V.GeoJsonDataSource.load(e).then(function(e){r.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=V.Color.BLUE.withAlpha(.9)}r.flyTo(e)})})},model:()=>{i(e=>{r.flyTo(d3kit.createModelGraphics({position:V.Cartesian3.fromDegrees(120.38105869,31.10115627),m_url:e}))})},czml:()=>{i(e=>{r.flyTo(r.dataSources.add(V.CzmlDataSource.load(e)))})},"3dtilset":()=>{i(e=>{r.flyTo(r.scene.primitives.add(new V.Cesium3DTileset({url:e})))})}};t.add(o,"point"),t.add(o,"polyline"),t.add(o,"polygon"),t.add(o,"model"),t.add(o,"czml"),t.add(o,"3dtilset"),t.open()}},showPostProcessStagesPanel(e){e=e||{};let t=null,i=new function(){this.blackAndWhiteShow=!1,this.blackAndWhiteGradations=5,this.brightnessShow=!1,this.brightnessValue=.5,this.nightVisionShow=!1,this.silhouette=!1},r=(e&&e.elementId?(t=new n.GUI({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new n.GUI,this._viewer.scene.postProcessStages),o=r.add(V.PostProcessStageLibrary.createSilhouetteStage()),a=r.add(V.PostProcessStageLibrary.createBlackAndWhiteStage()),s=r.add(V.PostProcessStageLibrary.createBrightnessStage()),l=r.add(V.PostProcessStageLibrary.createNightVisionStage());o.uniforms.color=e.silhouetteColor||V.Color.YELLOW,o.enabled=!1,a.enabled=!1,a.uniforms.gradations=5,s.enabled=!1,s.uniforms.brightness=.5,l.enabled=!1,t.add(i,"blackAndWhiteShow").name("blackAndWhiteShow").onChange(function(e){a.enabled=e}),t.add(i,"blackAndWhiteGradations",0,10,.1).name("blackAndWhiteGradations").onChange(function(e){a.uniforms.gradations=e}),t.add(i,"brightnessShow").name("brightnessShow").onChange(function(e){s.enabled=e}),t.add(i,"brightnessValue",0,10,.1).name("brightnessValue").onChange(function(e){s.uniforms.brightness=e}),t.add(i,"nightVisionShow").name("nightVisionShow").onChange(function(e){l.enabled=e}),t.add(i,"silhouette").name("silhouette").onChange(function(e){o.enabled=e})},showSceneBloomPanel(e){let t=null,i=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},r=(e&&e.elementId?(t=new n.GUI({autoPlace:!1}),document.getElementById(e.elementId).appendChild(t.domElement)):t=new n.GUI,this._viewer),o=(t.__closeButton.innerHTML="收缩面板",r.scene.postProcessStages.bloom);t.add(i,"enabled").name("bloom").onChange(function(e){o.enabled=e}),t.add(i,"glowOnly").name("发光").onChange(function(e){o.uniforms.glowOnly=e}),t.add(i,"enabled").name("启用模糊").onChange(function(e){o.enabled=e}),t.add(i,"contrast",-255,255,.01).name("对比度").onChange(function(e){o.uniforms.contrast=e}),t.add(i,"brightness",-1,1,.01).name("光泽亮度").onChange(function(e){o.uniforms.brightness=e}),t.add(i,"delta",1,5,.01).name("因子").onChange(function(e){o.uniforms.delta=e}),t.add(i,"sigma",1,10,.01).name("sigma").onChange(function(e){o.uniforms.sigma=e}),t.add(i,"stepSize",.1,10).name("stepSize").onChange(function(e){o.uniforms.stepSize=e}),t.add(i,"shadows").name("启用阴影").onChange(function(e){r.shadows=e}),t.add(i,"highDynamicRange").name("高动态范围").onChange(function(e){r.scene.highDynamicRange=e}),t.add(i,"gamma",1,10,.01).name("伽马亮度").onChange(function(e){r.scene.gamma=e})},showPrimitiveMatrixPanel(t){let i=t.primitives._delegate||t.primitives,r=t.primitives,e=(this._viewer,null);t&&t.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(t.elementId).appendChild(e.domElement)):e=new n.GUI;var o=e.addFolder("离地高度"),o=(o.add({height:100},"height",0,1e3,1).onChange(function(e){var t=r.boundingSphere,t=V.Cartographic.fromCartesian(t.center),i=V.Cartesian3.fromRadians(t.longitude,t.latitude,0),t=V.Cartesian3.fromRadians(t.longitude,t.latitude,e),e=V.Cartesian3.subtract(t,i,new V.Cartesian3);r.modelMatrix=V.Matrix4.fromTranslation(e)}),o.open(),e.addFolder("缩放大小")),a={"m+Scale":()=>{i.readyPromise.then(e=>{var t=e.root.transform;V.Matrix4.multiplyByUniformScale(t,1.2,t),e.root.transform=t})},"m-Scale":()=>{i.readyPromise.then(e=>{var t=e.root.transform;V.Matrix4.multiplyByUniformScale(t,.8,t),e.root.transform=t})}},a=(o.add(a,"m+Scale"),o.add(a,"m-Scale"),o.open(),{"x+Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(20,0,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"x-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(-20,0,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"y+Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,20,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"y-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,-20,0));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"z+Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,0,20));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)},"z-Axis":()=>{var e=V.Matrix4.fromTranslation(new V.Cartesian3(0,0,-20));V.Matrix4.multiply(i.modelMatrix,e,i.modelMatrix)}}),o=e.addFolder("矩阵平移");o.add(a,"x+Axis"),o.add(a,"x-Axis"),o.add(a,"y+Axis"),o.add(a,"y-Axis"),o.add(a,"z+Axis"),o.add(a,"z-Axis"),o.open();let s={x:0,y:0,z:0},l={"x+Axis":()=>{s.x+=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationX(V.Math.toRadians(s.x)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"x-Axis":()=>{s.x-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationX(V.Math.toRadians(s.x)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"y+Axis":()=>{s.y+=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationY(V.Math.toRadians(s.y)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"y-Axis":()=>{s.y-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationY(V.Math.toRadians(s.y)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"z+Axis":()=>{s.z+=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationZ(V.Math.toRadians(s.z)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.Matrix4.multiply(i,t,i),e._root.transform=i})},"z-Axis":()=>{s.z-=15,i.readyPromise.then(e=>{var t=V.Matrix3.fromRotationZ(V.Math.toRadians(s.z)),t=V.Matrix4.fromRotationTranslation(t),i=V.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center);V.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:()=>{i.readyPromise.then(e=>{e=e.root.transform;t.cb({modelTransformMatrix:e,modelMatrix:r.modelMatrix})})}},"getModelMaterix").name("获取模型矩阵"),a.open()),e.__closeButton.innerHTML="收缩面板"},showLayerParamPanel:function(t,i){if(t){let e=null;i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI;var i=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},r=e.addFolder("图层调整");r.add(i,"alpha",0,1,.05).name("透明度").onChange(function(e){t.alpha=e}),r.add(i,"brightness",0,5,.05).name("亮度").onChange(function(e){t.brightness=e}),r.add(i,"contrast",0,5,.05).name("对比").onChange(function(e){t.contrast=e}),r.add(i,"gamma",0,5,.05).name("伽马").onChange(function(e){t.gamma=e}),r.add(i,"hue",0,5,.05).name("色调").onChange(function(e){t.hue=e}),r.add(i,"dayAlpha",0,1,.05).name("白天透明").onChange(function(e){t.dayAlpha=e}),r.add(i,"nightAlpha",0,1,.05).name("夜晚透明").onChange(function(e){t.nightAlpha=e}),r.add(i,"saturation",0,5,.05).name("饱和").onChange(function(e){t.saturation=e}),r.open()}},showLayerSwitchPanel:function(t,i,r){if(t&&t.length){let e=null;i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI;var o=new function(){t.forEach(e=>{this[e.id]=e.show})},a=e.addFolder("图层切换"),s=(t.forEach(t=>{a.add(o,t.id).name(t.name).onChange(function(e){t.show=e,r&&r({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,i,r;e=e||{},n.GUI&&this._viewer.scene.colorCorrection&&(r=new n.GUI,(t=this._viewer).scene.lightSource.ambientLightColor=e.ambientLightColor||new V.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,i=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},(r=r.addFolder("场景效果")).add(i,"bloomEffectShow").name("泛光开关").onChange(function(e){t.scene.bloomEffect.show=e,t.scene.bloomEffect.threshold=i.bloomThreshold,t.scene.bloomEffect.bloomIntensity=i.bloomIntensity}),r.add(i,"bloomThreshold",0,1,.1).name("泛光阈值").onChange(function(e){t.scene.bloomEffect.threshold=e}),r.add(i,"bloomIntensity",0,10,.1).name("泛光强度").onChange(function(e){t.scene.bloomEffect.bloomIntensity=e}),r.add(i,"hdrEnabled").name("HDR开关").onChange(function(e){t.scene.hdrEnabled=e}),r.add(i,"colorCorrectionShow").name("颜色校正").onChange(function(e){t.scene.colorCorrection.show=e}),r.add(i,"colorCorrectionSaturation",0,5,.1).name("饱和度").onChange(function(e){t.scene.colorCorrection.saturation=e}),r.add(i,"colorCorrectionBrightness",0,5,.1).name("亮度").onChange(function(e){t.scene.colorCorrection.brightness=e}),r.add(i,"colorCorrectionContrast",0,5,.1).name("对比度").onChange(function(e){t.scene.colorCorrection.contrast=e}),r.add(i,"colorCorrectionHue",0,5,.1).name("色调").onChange(function(e){t.scene.hdrEnabled=e}),r.add(i,"colorCorrectionHue",0,1,.1).name("环境光").onChange(function(e){t.scene.lightSource.ambientLightColor=new V.Color(e,e,e,1)}),r.open())},showEntityOrientationEditPanel:function(i={}){if(i.entity){let t=i.entity;var e=new n.GUI,r=(i&&i.elementId?(e=new n.GUI({autoPlace:!1}),document.getElementById(i.elementId).appendChild(e.domElement)):e=new n.GUI,new function(){this.heading=360,this.pitch=1,this.roll=1}),e=e.addFolder("实体姿态调整"),o=this;e.add(r,"heading",0,360,1).name("角度").onChange(function(e){r.heading=e;e=V.Transforms.headingPitchRollQuaternion(t.position.getValue(o._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(r.heading),V.Math.toRadians(r.pitch),V.Math.toRadians(r.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.add(r,"pitch",0,360,1).name("航向").onChange(function(e){r.pitch=e;e=V.Transforms.headingPitchRollQuaternion(t.position.getValue(o._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(r.heading),V.Math.toRadians(r.pitch),V.Math.toRadians(r.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.add(r,"roll",0,360,1).name("翻转").onChange(function(e){r.roll=e;e=V.Transforms.headingPitchRollQuaternion(t.position.getValue(o._viewer.clock.currentTime),new V.HeadingPitchRoll(V.Math.toRadians(r.heading),V.Math.toRadians(r.pitch),V.Math.toRadians(r.roll)));t.orientation=e,i.cb&&i.cb({orientation:e})}),e.open()}},definedMouseEvent({targetEntity:e,ctrlFlag:t}){U=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),r=Y.scene.globe.pick(e,Y.scene);if(document.body.style.cursor="pointer",W&&W.id&&"move"===j){let e=V.JulianDate.fromDate(new Date),t=U.position.getValue(e),i=V.Cartographic.fromCartesian(t),n=Number(i.height.toFixed(3));U.position=new V.CallbackProperty(()=>{var e=Y.scene.globe.ellipsoid.cartesianToCartographic(r),t=V.Math.toDegrees(e.longitude),e=V.Math.toDegrees(e.latitude);return V.Cartesian3.fromDegrees(t,e,n)},!1)}else{var i,n,o;W&&W.id&&"rotate"===j&&(n=V.JulianDate.fromDate(new Date),n=U.position.getValue(n),o=Y.scene.camera.pickEllipsoid(t.startPosition),t=Y.scene.camera.pickEllipsoid(t.endPosition),i=V.Cartesian3.subtract(n,t,new V.Cartesian3),i=V.Cartesian3.normalize(i,new V.Cartesian3),o=V.Cartesian3.subtract(o,n,new V.Cartesian3),t=V.Cartesian3.subtract(t,n,new V.Cartesian3),n=V.Cartesian3.angleBetween(o,t),o=V.Quaternion.fromAxisAngle(i,100*n),U.orientation=o)}}},defLeftDown(e){W=Y.scene.pick(e.position),V.defined(W)&&j?(N.selected=!0,N.leftDown=!0):N.selected=!1},defMouseWheel(n){if(W&&W.id&&"scale"===j){let e=V.JulianDate.fromDate(new Date),t=U.box.dimensions.getValue(e),i=0<n?2:.5;U.box.dimensions=new V.CallbackProperty(()=>V.Cartesian3.multiplyByScalar(t,i,new V.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;function Z(e,t,i){e&&(this._viewer=e,q=t,this._pluginLayer=new q.CustomDataSource("pluginLayer"),e&&e.dataSources.add(this._pluginLayer),this._installPlugin())}Z.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,r=0<q.Cartesian3.subtract(e[0],e[1],n).x;this.excavateMinHeight=9999;for(var o=0;o<i;o++){var a=(o+1)%i,s=q.Cartesian3.midpoint(e[o],e[a],new q.Cartesian3),l=q.Cartographic.fromCartesian(e[o]),l=this.viewer.scene.globe.getHeight(l)||l.height;l<this.excavateMinHeight&&(this.excavateMinHeight=l);l=q.Cartesian3.normalize(s,new q.Cartesian3),a=r?q.Cartesian3.subtract(e[o],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,r=[],o=[],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])),o.push(q.Cartesian3.fromRadians(h[0],h[1],n)),r.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)),o.push(q.Cartesian3.fromRadians(p,m,n)),r.push(q.Cartesian3.fromRadians(p,m,0)))}}this.wellData={lerp_pos:a,bottom_pos:o,no_height_top:r}}},e.prototype._createWell=function(o){var a,e;this.viewer.terrainProvider._layers?((a=this)._createBottomSurface(o.bottom_pos),e=q.sampleTerrainMostDetailed(this.viewer.terrainProvider,o.lerp_pos),q.when(e,function(e){for(var t=e.length,i=[],n=0;n<t;n++){var r=q.Cartesian3.fromRadians(e[n].longitude,e[n].latitude,e[n].height);i.push(r)}a._createWellWall(o.bottom_pos,i)})):(this._createBottomSurface(o.bottom_pos),this._createWellWall(o.bottom_pos,o.no_height_top))},e.prototype._getMinHeight=function(t){let i=5e6,n=null;for(let e=0;e<t.length;e++){var r=t[e].z;r<i&&(i=r,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 r=this._ellipsoidToLonLat(t[e]);n.push(r.longitude),n.push(r.latitude),n.push(i)}var e=new q.PolygonGeometry({polygonHierarchy:new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights(n)),perPositionHeight:!0}),e=q.PolygonGeometry.createGeometry(e),o=new q.Material({fabric:{type:"Image",uniforms:{image:this.bottomImg}}}),o=new q.MaterialAppearance({translucent:!1,flat:!0,material:o});this.bottomSurface=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e}),appearance:o,asynchronous:!1}),this.viewer.scene.primitives.add(this.bottomSurface)}},e.prototype._createWellWall=function(e,t){var i=this._getMinHeight(e),n=[],r=[];for(let e=0;e<t.length;e++)n.push(this._ellipsoidToLonLat(t[e]).altitude),r.push(i);var e=new q.WallGeometry({positions:t,maximumHeights:n,minimumHeights:r}),e=q.WallGeometry.createGeometry(e),o=new q.Material({fabric:{type:"Image",uniforms:{image:this.wallImg}}}),o=new q.MaterialAppearance({translucent:!1,flat:!0,material:o});this.wellWall=new q.Primitive({geometryInstances:new q.GeometryInstance({geometry:e,attributes:{color:q.ColorGeometryInstanceAttribute.fromColor(q.Color.GREY)},id:"PitWall"}),appearance:o,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,r=0;r<n;r++)i.push(q.Cartesian3.fromRadians(t[r].longitude,t[r].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){for(var l=this,t=function(t,e,i){var n,r,o,a,s,l,c=t.positionList,h=0,u=0;function d(e){n=c[e+1][0]-c[e][0],r=c[e+1][1]-c[e][1],o=n/t.number,a=r/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(r)&&((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*o,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)},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],r=t.observer[2],o=[],a=0;a<e.length;a++){var s=a===e.length-1?new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,r,e[a].x,e[a].y,0,e[0].x,e[0].y,0])):new q.PolygonHierarchy(q.Cartesian3.fromDegreesArrayHeights([i,n,r,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}});o.push(s)}return o}(i,e),r=0;r<n.length;r++)r!==n.length-1?t(e,n[r],[i[r].x,i[r].y,i[r+1].x,i[r+1].y]):t(e,n[r],[i[r].x,i[r].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=[],r=0;r<t.length;r++){var o=q.Cartesian3.fromDegrees(Number(t[r].lng),Number(t[r].lat),Number(t[r].alt));n.push(o)}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:r,clampToGround:o,...a}=e.polyline;i.polyline={positions:new q.CallbackProperty(function(){return n},!1),width:t||10,material:r||new q.PolylineGlowMaterialProperty({glowPower:1,color:q.Color.RED}),clampToGround:o||!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),r=t[e];i.addSample(n,r)}return i},_sampleOrientation(){let r,o,a;return new q.CallbackProperty(e=>{var t=this.droneEntity.position.getValue(e);if(o=this.droneEntity.position.getValue(q.JulianDate.addSeconds(e,1/60,new q.JulianDate)),t&&o){r=t;const e=q.Cartesian3.subtract(o,r,new q.Cartesian3),i=q.Cartesian3.normalize(e,new q.Cartesian3),n=q.Transforms.rotationMatrixFromPositionVelocity(r,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 r=document.createElement("div"),o=(r.className="ys-css3-container",document.getElementById("info-warp").appendChild(r),this._container=r,this._elements.forEach(function(e){r.insertAdjacentHTML("beforeend",e.element)}),this);this._scene.preRender.addEventListener(function(){for(var e=0;e<r.children.length;e++){var t,i=q.Cartesian3.fromDegrees(o._elements[e].position[0],o._elements[e].position[1],o._elements[e].position[2]||0),n=o._scene.cartesianToCanvasCoordinates(i,o._scratch);q.defined(n)&&(r.children[e].style.left=parseFloat(n.x)+parseFloat(o._elements[e].offset[0])+"px",r.children[e].style.top=parseFloat(n.y)+parseFloat(o._elements[e].offset[1])+"px",o._isBackHide)&&(n=o._camera.position,t=o._scene.globe.ellipsoid.cartesianToCartographic(n).height,t+=+o._scene.globe.ellipsoid.maximumRadius,q.Cartesian3.distance(n,i)>t?r.children[e].style.display="none":r.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,r=(setTimeout(function(e){},300),q.Math.toRadians(30)),o=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 r+=.05},!1),stRotation:new q.CallbackProperty(function(){return r+=.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 o-=.03},!1),stRotation:new q.CallbackProperty(function(){return o-=.03},!1),zIndex:3}}))},q.Scene.Css3Renderer=e)}};let J=null;function Q(e,t,i){e&&(J=t,this._analysisLayer=new J.CustomDataSource("analysisLayer"),this.$math3d=new g(e,t),this.$graphics=new l(e,t),e)&&e.dataSources.add(this._analysisLayer)}function K(e){if(e&&e.positions){var t=e.positions,i=e.that,n=[],e=[],r=[],o=i.transformWGS84ToCartesian(t[0]),t=i.transformWGS84ToCartesian(t[1]),n=i.$graphics.createPointsGraphics({point:!0,positions:[o,t]}),a=i.$math3d.getIntersectObj(o,t,n,!0);if(0===a.length)return alert("没有取到相交点 , 请检查是否开启深度检测。"),!1;for(let e=a.length-1;0<=e;e--){const l=a[e];J.defined(l.position)||a.splice(e,1)}if(!J.defined(a[0].position))throw new J.DeveloperError("position is undefined");var s=a[0].position,l=J.Cartesian3.distance(s,t)<5,s=[o,a[0].position],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:J.ArcType.NONE,material:new J.PolylineArrowMaterialProperty(J.Color.GREEN)}});e.push(s),l||(s=[a[0].position,t],s=i._analysisLayer.entities.add({polyline:{positions:s,width:10,arcType:J.ArcType.NONE,material:new J.PolylineArrowMaterialProperty(J.Color.RED)}}),e.push(s));for(let e=0;e<a.length;++e){var c,h=a[e].object;h&&(h instanceof J.Cesium3DTileFeature?(r.push(h),h.oldColor=h.color.clone(),h.color=J.Color.fromAlpha(J.Color.YELLOW,h.color.alpha)):h.id instanceof J.Entity&&(c=(h=h.id).polygon||h.polyline,r.push(h),h=c.material.color.getValue(),c.oldColor=h.clone(),c.material=J.Color.fromAlpha(J.Color.YELLOW,h.alpha))),n.push(i._analysisLayer.entities.add({position:a[e].position,ellipsoid:{radii:new J.Cartesian3(.8,.8,.8),material:J.Color.RED}}))}var s=J.Cartographic.fromCartesian(o),e=J.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},o=Math.sqrt(Math.pow(o.x-t.x,2)+Math.pow(o.y-t.y,2)+Math.pow(o.z-t.z,2)),t=Math.abs(e.height-s.height),u=Math.sqrt(Math.pow(o,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水平距离: "+o.toFixed(2)+"m\n空间距离: "+u.toFixed(2)+"m\n是否可视: "+l;n&&n[0]&&(n[0].label={text:s,showBackground:!0,font:"14px monospace",fillColor:J.Color.YELLOW,pixelOffset:{x:0,y:-20},verticalOrigin:J.VerticalOrigin.BOTTOM,horizontalOrigin:J.HorizontalOrigin.LEFT})}K.prototype.remove=function(){}}function $(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=J.Cartographic.fromCartesian(e.center);try{var n=e.radius,r={},o=(r.semiMinorAxis=n,r.semiMajorAxis=n,r.rotation=0,r.center=e.center,r.granularity=Math.PI/45,l.computeEllipseEdgePositions(r));for(let e=0;e<o.outerPositions.length;e+=3){var a=new J.Cartesian3(o.outerPositions[e],o.outerPositions[e+1],o.outerPositions[e+2]),s=J.Cartographic.fromCartesian(a),h=5e-5*Math.PI/180,u=l.computeInterpolateLineCartographic(i,s,h);l.computeCartographicPointsTerrainData(u,function(o){if(0<o.length){let i=!0,n=[],r=[];for(let e=1;e<o.length;e++){let t=!0;if(1<e){var a=new J.Cartographic(o[0].longitude,o[0].latitude,o[0].height+c);if(i)t=l.computeInterpolateIndexLineHeightCartographic(a,o[e],e,e-1).height>=o[e-1].height?i=!0:i=!1;else{var s=l.computeInterpolateIndexLineHeightCartographic(a,o[e],e,e-1);for(let e=0;e<s.length;e++){if(!(s[e].height>=o[e].height)){i=!1,t=!1;break}i=!0,t=!0}}}a=J.Cartesian3.fromRadians(o[e].longitude,o[e].latitude,o[e].height+1);n.push(a),t?(r.push(0),r.push(0),r.push(1)):(r.push(1),r.push(0),r.push(0)),r.push(1)}t._pointsKSYResult=new J.Scene.PointsPrimitive({viewer:l._viewer,Cartesians:n,Colors:r})}else alert("高程异常!")})}}catch(e){console.log(e)}$.prototype.remove=function(){}}function ee(e){if(e&&e.positions){for(var t=e.positions,i=e.that,n=i.transformWGS84ToCartesian(t[0]),o=i.transformWGS84ToCartesian(t[1]),a=[J.Cartographic.fromCartesian(n)],s=new J.Cartesian3,l=[0],c=[0],h=1;h<=10;h++){J.Cartesian3.lerp(n,o,h/10,s);var u=J.Cartographic.fromCartesian(s),d=i._viewer.scene.globe.getHeight(u),d=(u.height=d,a.push(u),a[h-1]),p=J.Cartesian3.distance(J.Cartographic.toCartesian(d),J.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");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",e.style.opacity=.9,r.init(e).setOption({title:{text:"剖面示意图",left:"center",subtext:"",textStyle:{color:"white",fontSize:15}},tooltip:{trigger:"axis"},legend:{data:[""]},toolbox:{show:!1,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:"平均值"}]}}]})}}function te(e){if(e&&e.positions&&e.that){var t=e.that,i=e.positions,e=this,n=t._viewer.terrainProvider.availability;if(n){for(var r=15e3,o=0;o<i.length;o++){var a=J.Cartographic.fromCartesian(i[o]),s=t._viewer.scene.globe.getHeight(a);s<r&&(r=s),n.computeMaximumLevelAtPosition(a)}var l=Math.PI/Math.pow(2,11);l/=64;for(var c,h,u,d,p,m,f,g,l=new J.PolygonGeometry.fromPositions({positions:i,vertexFormat:J.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,granularity:l}),v=new J.PolygonGeometry.createGeometry(l),_=0,y=0,w=new J.Cartesian3,o=0;o<v.indices.length;o+=3){c=v.indices[o],h=v.indices[o+1],p=v.indices[o+2],m=v.attributes.position.values,w.x=m[3*c],w.y=m[3*c+1],w.z=m[3*c+2],a=J.Cartographic.fromCartesian(w),c=t._viewer.scene.globe.getHeight(a),u=J.Cartesian3.fromRadians(a.longitude,a.latitude,c),g=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),y<c&&(y=c),w.x=m[3*h],w.y=m[3*h+1],w.z=m[3*h+2],a=J.Cartographic.fromCartesian(w),h=t._viewer.scene.globe.getHeight(a),d=J.Cartesian3.fromRadians(a.longitude,a.latitude,h),P=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),y<h&&(y=h),w.x=m[3*p],w.y=m[3*p+1],w.z=m[3*p+2],a=J.Cartographic.fromCartesian(w),m=t._viewer.scene.globe.getHeight(a),p=J.Cartesian3.fromRadians(a.longitude,a.latitude,m),y<m&&(y=m),g=g,P=P,f=J.Cartesian3.fromRadians(a.longitude,a.latitude,0),0,g=((C=J.Cartesian3.distance(g,P))+(P=J.Cartesian3.distance(P,f))+(f=J.Cartesian3.distance(f,g)))/2,_+=Math.sqrt(g*(g-C)*(g-P)*(g-f))*(c-r+h-r+m-r)/3;var C=[],P=(C.push(u),C.push(d),C.push(p),{polygon:{hierarchy:{positions:C},extrudedHeight:0,perPositionHeight:!0,material:J.Color.fromRandom().withAlpha(.5),outline:!0,closeTop:!0,closeBottom:!0,outlineColor:J.Color.WHITE,outlineWidth:2}});t._analysisLayer.entities.add(P)}l=function(e){for(var t=[],i=[],n=0;n<e.length;n++){var r=J.Cartographic.fromCartesian(e[n]);t.push(r.longitude),i.push(r.latitude)}for(var o,a,s,l=0,c=0,h=0,u=0,d=0,n=0;n<e.length;n++)h+=s=(o=t[n])*(c=n==e.length-1?(l=t[0],i[0]):(l=t[n+1],i[n+1]))-l*(a=i[n]),u+=(o+l)*s,d+=(a+c)*s;return u/=6*(h*=.5),d/=6*h,new J.Cartographic(u,d)}(i),e._volumeLabel=t._analysisLayer.entities.add({position:J.Cartesian3.fromRadians(l.longitude,l.latitude,y+1e3),label:{text:"Cut Volume "+_.toString()+"m3"}})}else alert("未获取到地形")}}Q.prototype={createVisibilityAnalysis:function(i){i=i||{};var n=this;n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new K({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 $({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;J.defined(n)?t.destroy():(n=new J.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,r,o,a,s;i=i||{},this._viewer&&i&&(n=this,r=i.height||30,o=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 J.Scene.TerrainClipPlan(n._viewer,{height:r,splitNum:o,wallImg:a,bottomImg:s}),e=n.transformWGS84ArrayToCartesianArray(e);t.updateData(e),"function"==typeof i.callback&&i.callback(t)}}))},createSubmergedAnalysis:function(e){var t,n,r,o,a;e=e||{},this._viewer&&e&&(t=this,n=e.maxH||15,r=e.speed||1,o=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+=r)>=n&&(e=n,clearTimeout(t)),i.polygon.extrudedHeight=e},o))},2e3)}}))},createSlopeAnalysis:function(i){if(i=i||{},!r)return alert("需要引入echarts库"),!1;var n=this;this._viewer&&i&&n.drawLineGraphics({type:"straightLine",clampToGround:!1,callback:function(e,t){e=new ee({positions:e,that:n});n._graphicsLayer&&n._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 te({positions:i.transformWGS84ArrayToCartesianArray(e,100),that:i});"function"==typeof t.callback&&t.callback(e)}})}};var ie={version:"1.0.0",PlotUtils:{}},ne=(ie.PlotUtils.distance=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},ie.PlotUtils.wholeDistance=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=ie.PlotUtils.distance(e[i],e[i+1]);return t},ie.PlotUtils.getBaseLength=function(e){return Math.pow(ie.PlotUtils.wholeDistance(e),.99)},ie.PlotUtils.mid=function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},ie.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]],r=[(e[0]+i[0])/2,(e[1]+i[1])/2],e=[r[0]-e[1]+i[1],r[1]+e[0]-i[0]];return ie.PlotUtils.getIntersectPoint(n,t,r,e)},ie.PlotUtils.getIntersectPoint=function(e,t,i,n){var r,o,a;return e[1]==t[1]?[(r=(n[0]-i[0])/(n[1]-i[1]))*(e[1]-i[1])+i[0],o=e[1]]:i[1]==n[1]?[(a=(t[0]-e[0])/(t[1]-e[1]))*(i[1]-e[1])+e[0],o=i[1]]:(a=(t[0]-e[0])/(t[1]-e[1]),r=(n[0]-i[0])/(n[1]-i[1]),[a*(o=(a*e[1]-e[0]-r*i[1]+i[0])/(a-r))-a*e[1]+e[0],o])},ie.PlotUtils.getAzimuth=function(e,t){var i,n=Math.asin(Math.abs(t[1]-e[1])/ie.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=ie.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},ie.PlotUtils.getAngleOfThreePoints=function(e,t,i){e=ie.PlotUtils.getAzimuth(t,e)-ie.PlotUtils.getAzimuth(t,i);return e<0?e+ie.Constants.TWO_PI:e},ie.PlotUtils.isClockWise=function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},ie.PlotUtils.getPointOnLine=function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},ie.PlotUtils.getCubicValue=function(e,t,i,n,r){var o=1-(e=Math.max(Math.min(e,1),0)),a=e*e,s=a*e,l=o*o,c=l*o;return[c*t[0]+3*l*e*i[0]+3*o*a*n[0]+s*r[0],c*t[1]+3*l*e*i[1]+3*o*a*n[1]+s*r[1]]},ie.PlotUtils.getThirdPoint=function(e,t,i,n,r){e=ie.PlotUtils.getAzimuth(e,t),r=r?e+i:e-i,e=n*Math.cos(r),i=n*Math.sin(r);return[t[0]+e,t[1]+i]},ie.PlotUtils.getArcPoints=function(e,t,i,n){for(var r=[],o=(o=n-i)<0?o+ie.Constants.TWO_PI:o,a=0;a<=ie.Constants.FITTING_COUNT;a++){var s=i+o*a/ie.Constants.FITTING_COUNT,l=e[0]+t*Math.cos(s),s=e[1]+t*Math.sin(s);r.push([l,s])}return r},ie.PlotUtils.getBisectorNormals=function(e,t,i,n){var r,o,a=ie.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=ie.PlotUtils.distance(t,i),h=ie.PlotUtils.distance(i,n),s=s>ie.Constants.ZERO_TOLERANCE?ie.PlotUtils.isClockWise(t,i,n)?(r=[i[0]-(o=e*c)*a,i[1]+o*l],[i[0]+(o=e*h)*a,i[1]-o*l]):(r=[i[0]+(o=e*c)*a,i[1]-o*l],[i[0]-(o=e*h)*a,i[1]+o*l]):(r=[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[r,s]},ie.PlotUtils.getNormal=function(e,t,i){var n=e[0]-t[0],e=e[1]-t[1],r=Math.sqrt(n*n+e*e),r=(n/=r,e/=r,i[0]-t[0]),i=i[1]-t[1],t=Math.sqrt(r*r+i*i);return[n+(r/=t),e+(i/=t)]},ie.PlotUtils.getCurvePoints=function(e,t){for(var i=[ie.PlotUtils.getLeftMostControlPoint(t)],n=0;n<t.length-2;n++)var r=t[n],o=t[n+1],a=t[n+2],a=ie.PlotUtils.getBisectorNormals(e,r,o,a),i=i.concat(a);for(var s=ie.PlotUtils.getRightMostControlPoint(t),l=(i.push(s),[]),n=0;n<t.length-1;n++){for(r=t[n],o=t[n+1],l.push(r),e=0;e<ie.Constants.FITTING_COUNT;e++){var c=ie.PlotUtils.getCubicValue(e/ie.Constants.FITTING_COUNT,r,i[2*n],i[2*n+1],o);l.push(c)}l.push(o)}return l},ie.PlotUtils.getLeftMostControlPoint=function(e){var i,n,r,o,a,s=e[0],l=e[1],e=e[2],c=ie.PlotUtils.getBisectorNormals(0,s,l,e)[0],e=ie.PlotUtils.getNormal(s,l,e),e=Math.sqrt(e[0]*e[0]+e[1]*e[1])>ie.Constants.ZERO_TOLERANCE?(e=ie.PlotUtils.mid(s,l),r=s[0]-e[0],i=s[1]-e[1],n=2/ie.PlotUtils.distance(s,l),o=c[0]-e[0],c=c[1]-e[1],a=e[0]+((i=-n*i)*i-(n=n*r)*n)*o+(r=2*i*n)*c,e[1]+r*o+(n*n-i*i)*c):(a=s[0]+t*(l[0]-s[0]),s[1]+t*(l[1]-s[1]));return[a,e]},ie.PlotUtils.getRightMostControlPoint=function(e){var i,n,r,o,a,s=e.length,l=e[s-3],c=e[s-2],e=e[s-1],s=ie.PlotUtils.getBisectorNormals(0,l,c,e)[1],l=ie.PlotUtils.getNormal(l,c,e),l=Math.sqrt(l[0]*l[0]+l[1]*l[1])>ie.Constants.ZERO_TOLERANCE?(l=ie.PlotUtils.mid(c,e),r=e[0]-l[0],i=e[1]-l[1],n=2/ie.PlotUtils.distance(c,e),o=s[0]-l[0],s=s[1]-l[1],a=l[0]+((i=-n*i)*i-(n=n*r)*n)*o+(r=2*i*n)*s,l[1]+r*o+(n*n-i*i)*s):(a=e[0]+t*(c[0]-e[0]),e[1]+t*(c[1]-e[1]));return[a,l]},ie.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 r=0,o=0,a=0;a<=i;a++){var s=ie.PlotUtils.getBinomialFactor(i,a),l=Math.pow(n,a),c=Math.pow(1-n,i-a);r+=s*l*c*e[a][0],o+=s*l*c*e[a][1]}t.push([r,o])}return t.push(e[i]),t},ie.PlotUtils.getBinomialFactor=function(e,t){return ie.PlotUtils.getFactorial(e)/(ie.PlotUtils.getFactorial(t)*ie.PlotUtils.getFactorial(e-t))},ie.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},ie.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 r=0;r<=1;r+=.05){for(var o=0,a=0,s=0;s<=2;s++){var l=ie.PlotUtils.getQuadricBSplineFactor(s,r);o+=l*e[n+s][0],a+=l*e[n+s][1]}t.push([o,a])}return t.push(e[e.length-1]),t},ie.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},ie.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"}),re="doublearrow",oe=.25,ae=.3,se=.85,le=.15,ce={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1},he={tailWidthFactor:.15,neckWidthFactor:.2,headWidthFactor:.25,headAngle:Math.PI/8.5,neckAngle:Math.PI/13};ne.algorithm={},ne.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],r=this.points[1],o=this.points[2],a=e.length,a=(this.tempPoint4=3==a?ne.algorithm.getTempPoint4(n,r,o):this.points[3],this.connPoint=3==a||4==a?ie.PlotUtils.mid(n,r):this.points[4],e=ie.PlotUtils.isClockWise(n,r,o)?(h=ne.algorithm.getArrowPoints(n,this.connPoint,this.tempPoint4,!1),ne.algorithm.getArrowPoints(this.connPoint,r,o,!0)):(h=ne.algorithm.getArrowPoints(r,this.connPoint,o,!1),ne.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=ie.PlotUtils.getBezierPoints(u),s=ie.PlotUtils.getBezierPoints(e.concat(l.slice(1))),h=ie.PlotUtils.getBezierPoints(h),a=u.concat(d,s,c,h),e=ne.algorithm.array2Dto1D(a);i.controlPoint=[n,r,o,this.tempPoint4,this.connPoint],i.polygonalPoint=t.Cartesian3.fromDegreesArray(e)}return i},ne.algorithm.threeArrow=function(e){this.connPoint=null,this.tempPoint4=null;var t={controlPoint:this.tempPoint5=null,polygonalPoint:null};if(2<=(o=(this.points=e).length)){if(2==o)return e;var i=this.points[0],n=this.points[1],r=this.points[2],o=(3==(o=e.length)?(this.tempPoint4=ne.algorithm.getTempPoint4(i,n,r),this.tempPoint5=ie.PlotUtils.mid(r,this.tempPoint4)):(this.tempPoint4=this.points[3],this.tempPoint5=this.points[4]),this.connPoint=o<6?ie.PlotUtils.mid(i,n):this.points[5],e=ie.PlotUtils.isClockWise(i,n,r)?(c=ne.algorithm.getArrowPoints(i,this.connPoint,this.tempPoint4,!1),ne.algorithm.getArrowPoints(this.connPoint,n,r,!0)):(c=ne.algorithm.getArrowPoints(n,this.connPoint,r,!1),ne.algorithm.getArrowPoints(this.connPoint,i,this.tempPoint4,!0)),c.length),a=(o-5)/2,s=c.slice(0,a),l=c.slice(a,5+a),c=c.slice(5+a,o),h=e.slice(0,a),u=e.slice(a,5+a),e=e.slice(5+a,o),h=ie.PlotUtils.getBezierPoints(h),a=ie.PlotUtils.getBezierPoints(e.concat(s.slice(1))),c=ie.PlotUtils.getBezierPoints(c),o=h.concat(u,a,l,c),e=ne.algorithm.array2Dto1D(o);t.controlPoint=[i,n,r,this.tempPoint4,this.tempPoint5,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(e)}return t},ne.algorithm.array2Dto1D=function(e){var t=[];return e.forEach(function(e){t.push(e[0]),t.push(e[1])}),t},ne.algorithm.getArrowPoints=function(e,t,i,n){this.type=re,this.headHeightFactor=oe,this.headWidthFactor=ae,this.neckHeightFactor=se,this.neckWidthFactor=le;var r=ie.PlotUtils.mid(e,t),o=ie.PlotUtils.distance(r,i),a=ie.PlotUtils.getThirdPoint(i,r,0,.3*o,!0),s=ie.PlotUtils.getThirdPoint(i,r,0,.5*o,!0),a=[r,ie.PlotUtils.getThirdPoint(r,a,ie.Constants.HALF_PI,o/5,n),ie.PlotUtils.getThirdPoint(r,s,ie.Constants.HALF_PI,o/4,n),i],r=ne.algorithm.getArrowHeadPoints(a,this.headHeightFactor,this.headWidthFactor,this.neckHeightFactor,this.neckWidthFactor),s=r[0],o=r[4],n=ie.PlotUtils.distance(e,t)/ie.PlotUtils.getBaseLength(a)/2,i=ne.algorithm.getArrowBodyPoints(a,s,o,n),a=i.length,n=i.slice(0,a/2),i=i.slice(a/2,a);return n.push(s),i.push(o),(n=n.reverse()).push(t),(i=i.reverse()).push(e),n.reverse().concat(r,i)},ne.algorithm.getArrowHeadPoints=function(e,t,i){this.type=re,this.headHeightFactor=oe,this.headWidthFactor=ae,this.neckHeightFactor=se,this.neckWidthFactor=le;var n=ie.PlotUtils.getBaseLength(e)*this.headHeightFactor,r=e[e.length-1],t=(ie.PlotUtils.distance(t,i),n*this.headWidthFactor),i=n*this.neckWidthFactor,o=n*this.neckHeightFactor,n=ie.PlotUtils.getThirdPoint(e[e.length-2],r,0,n,!0),e=ie.PlotUtils.getThirdPoint(e[e.length-2],r,0,o,!0),o=ie.PlotUtils.getThirdPoint(r,n,ie.Constants.HALF_PI,t,!1),n=ie.PlotUtils.getThirdPoint(r,n,ie.Constants.HALF_PI,t,!0);return[ie.PlotUtils.getThirdPoint(r,e,ie.Constants.HALF_PI,i,!1),o,r,n,ie.PlotUtils.getThirdPoint(r,e,ie.Constants.HALF_PI,i,!0)]},ne.algorithm.getArrowBodyPoints=function(e,t,i,n){for(var r=ie.PlotUtils.wholeDistance(e),o=ie.PlotUtils.getBaseLength(e)*n,a=(o-ie.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=ie.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(o/2-(s+=ie.PlotUtils.distance(e[h-1],e[h]))/r*a)/Math.sin(u),p=ie.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=ie.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ne.algorithm.getTempPoint4=function(e,t,i){var n,r,o,t=ie.PlotUtils.mid(e,t),a=ie.PlotUtils.distance(t,i),i=ie.PlotUtils.getAngleOfThreePoints(e,t,i),a=i<ie.Constants.HALF_PI?(n=a*Math.sin(i),r=a*Math.cos(i),o=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!1),ie.PlotUtils.getThirdPoint(t,o,ie.Constants.HALF_PI,r,!0)):i>=ie.Constants.HALF_PI&&i<Math.PI?(n=a*Math.sin(Math.PI-i),r=a*Math.cos(Math.PI-i),o=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!1),ie.PlotUtils.getThirdPoint(t,o,ie.Constants.HALF_PI,r,!1)):i>=Math.PI&&i<1.5*Math.PI?(n=a*Math.sin(i-Math.PI),r=a*Math.cos(i-Math.PI),o=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!0),ie.PlotUtils.getThirdPoint(t,o,ie.Constants.HALF_PI,r,!0)):(n=a*Math.sin(2*Math.PI-i),r=a*Math.cos(2*Math.PI-i),o=ie.PlotUtils.getThirdPoint(e,t,ie.Constants.HALF_PI,n,!0),ie.PlotUtils.getThirdPoint(t,o,ie.Constants.HALF_PI,r,!1));return a},ne.algorithm.tailedAttackArrow=function(e,t){e=ne.algorithm.dereplication(e),this.tailWidthFactor=ce.tailWidthFactor,this.swallowTailFactor=ce.swallowTailFactor,this.swallowTailPnt=ce.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],r=e[1],e=(ie.PlotUtils.isClockWise(e[0],e[1],e[2])&&(n=e[1],r=e[0]),[ie.PlotUtils.mid(n,r)].concat(e.slice(2))),o=ne.algorithm.getAttackArrowHeadPoints(e,n,r,ce),a=o[0],s=o[4],l=ie.PlotUtils.distance(n,r),c=ie.PlotUtils.getBaseLength(e),h=c*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=ie.PlotUtils.getThirdPoint(e[1],e[0],0,h,!0);h=ne.algorithm.getAttackArrowBodyPoints(e,a,s,l/c),e=h.length,l=[n].concat(h.slice(0,e/2));l.push(a);c=[r].concat(h.slice(e/2,e));c.push(s),l=ie.PlotUtils.getQBSplinePoints(l),c=ie.PlotUtils.getQBSplinePoints(c),n=ne.algorithm.array2Dto1D(l.concat(o,c.reverse(),[this.swallowTailPnt,l[0]])),i.polygonalPoint=t.Cartesian3.fromDegreesArray(n)}return i},ne.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=ie.PlotUtils.getBaseLength(e)*this.headHeightFactor,r=e[e.length-1],o=ie.PlotUtils.distance(r,e[e.length-2]),t=ie.PlotUtils.distance(t,i),i=(n=n>t*this.headTailFactor?t*this.headTailFactor:n)*this.headWidthFactor,t=n*this.neckWidthFactor,o=(n=o<n?o:n)*this.neckHeightFactor,n=ie.PlotUtils.getThirdPoint(e[e.length-2],r,0,n,!0),e=ie.PlotUtils.getThirdPoint(e[e.length-2],r,0,o,!0),o=ie.PlotUtils.getThirdPoint(r,n,ie.Constants.HALF_PI,i,!1),n=ie.PlotUtils.getThirdPoint(r,n,ie.Constants.HALF_PI,i,!0);return[ie.PlotUtils.getThirdPoint(r,e,ie.Constants.HALF_PI,t,!1),o,r,n,ie.PlotUtils.getThirdPoint(r,e,ie.Constants.HALF_PI,t,!0)]},ne.algorithm.getAttackArrowBodyPoints=function(e,t,i,n){for(var r=ie.PlotUtils.wholeDistance(e),o=ie.PlotUtils.getBaseLength(e)*n,a=(o-ie.PlotUtils.distance(t,i))/2,s=0,l=[],c=[],h=1;h<e.length-1;h++){var u=ie.PlotUtils.getAngleOfThreePoints(e[h-1],e[h],e[h+1])/2,d=(o/2-(s+=ie.PlotUtils.distance(e[h-1],e[h]))/r*a)/Math.sin(u),p=ie.PlotUtils.getThirdPoint(e[h-1],e[h],Math.PI-u,d,!0),u=ie.PlotUtils.getThirdPoint(e[h-1],e[h],u,d,!1);l.push(p),c.push(u)}return l.concat(c)},ne.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},ne.algorithm.fineArrow=function(e,t,i){var n,r,o,a,s,l,c;if(!(e.length<2||t.length<2))return n=he.tailWidthFactor,c=he.neckWidthFactor,s=he.headWidthFactor,a=he.headAngle,l=he.neckAngle,(r=[])[0]=e,r[1]=t,e=r[0],t=r[1],c=(r=ie.PlotUtils.getBaseLength(r))*c,s=r*s,n=ie.PlotUtils.getThirdPoint(t,e,ie.Constants.HALF_PI,r=r*n,!0),r=ie.PlotUtils.getThirdPoint(t,e,ie.Constants.HALF_PI,r,!1),o=ie.PlotUtils.getThirdPoint(e,t,a,s,!1),a=ie.PlotUtils.getThirdPoint(e,t,a,s,!0),s=ie.PlotUtils.getThirdPoint(e,t,l,c,!1),l=ie.PlotUtils.getThirdPoint(e,t,l,c,!0),(c=[]).push(n[0],n[1],s[0],s[1],o[0],o[1],t[0],t[1],a[0],a[1],l[0],l[1],r[0],r[1],e[0],e[1]),c.some(e=>isNaN(e))?"":i.Cartesian3.fromDegreesArray(c)};let ue=null;function de(e,t){this.viewer=e,ue=t,this.handler=new ue.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.fillMaterial=ue.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=ne}de.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},de.prototype.disableHandler=function(){this.handler&&(this.handler.destroy(),this.handler=new ue.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)};let pe=null;var me=function(e,t){de.call(this,e,t),pe=t,this.type="AttackArrow",this.fillMaterial=pe.Color.RED.withAlpha(.5)};function fe(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}me.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 pe.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler||(this.handler=new pe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(e){(e=fe(e.position,i.viewer))&&(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))},pe.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!i.floatPoint||i.positions.length<2||(e=fe(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),2<=i.positions.length)&&(pe.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)))},pe.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(e=fe(e.position,i.viewer)){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.positions=[],i.pointArr=[],i.arrowEntity=null}},pe.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=pe.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var r=this.creatPoint(this.positions[i]);r.show=!1,r.wz=i+1,this.pointArr.push(r)}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 pe.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(pe.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}2==n.clickStep&&(n.clickStep=0,t=fe(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},pe.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){(e=fe(e.endPosition,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},pe.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:pe.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(o){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new pe.PolygonGraphics({hierarchy:new pe.CallbackProperty(function(){if(o.length<3)return null;for(var e=[],t=0;t<o.length;t++){var i=a.cartesianToLatlng(o[t]);e.push(i)}var n=a.xp.algorithm.tailedAttackArrow(e,pe),r=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(r=n.polygonalPoint),new pe.PolygonHierarchy(r)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=pe.Math.toDegrees(e.latitude);return[pe.Math.toDegrees(e.longitude),t]}},(me.prototype=Object.create(Object.assign({},me.prototype,de.prototype))).constructor=me;let ge=null;var ve=function(e,t){de.call(this,e,t),ge=t,this.type="StraightArrow",this.fillMaterial=ge.Color.fromCssColorString("#0000FF").withAlpha(.8)};function ye(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}ve.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 ge.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var i=this;this.state=1,this.handler.setInputAction(function(e){(e=ye(e.position,i.viewer))&&(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.positions=[],i.pointArr=[],i.arrowEntity=null),i.positions.push(e.clone()))},ge.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){i.positions.length<1||(e=ye(e.endPosition,i.viewer))&&(i.floatPoint.position.setValue(e),2<=i.positions.length)&&(ge.defined(i.arrowEntity)?(i.positions.pop(),i.positions.push(e)):(i.positions.push(e),i.arrowEntity=i.showArrowOnMap(i.positions),t&&t(i.objId)))},ge.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){(e=ye(e.position,i.viewer))&&(i.firstPoint.show=!1,i.positions=[],i.pointArr=[],i.arrowEntity=null,i.positions.push(e.clone()))},ge.ScreenSpaceEventType.RIGHT_CLICK)},startModify:function(){this.state=2,this.firstPoint.show=!0,this.floatPoint.show=!0;var i=this;this.clickStep=0,this.modifyHandler||(this.modifyHandler=new ge.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=i.viewer.scene.pick(e.position);ge.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),2==i.clickStep&&(i.clickStep=0,t=ye(e.position,i.viewer))&&i.selectPoint&&(i.selectPoint.position.setValue(t),i.selectPoint=null)},ge.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){i.selectPoint&&(e=ye(e.endPosition,i.viewer))&&(i.selectPoint.position.setValue(e),"firstPoint"==i.selectPoint.type&&(i.positions[1]=e),"floatPoint"==i.selectPoint.type)&&(i.positions[2]=e)},ge.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.state=-1,this.positions=[];for(var t=[],i=0;i<e.length;i++){var n=ge.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:ge.Color.YELLOW}});return e.attr="editPoint",e},showArrowOnMap:function(a){var s=this;return this.viewer.entities.add({id:s.objId,polygon:new ge.PolygonGraphics({hierarchy:new ge.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]],ge);if(-1!=JSON.stringify(n).indexOf("null"))return[];for(var r=0;r<n.length;r++){var o=new ge.Cartesian3(n[r].x,n[r].y,n[r].z);i.push(o)}return new ge.PolygonHierarchy(i)},!1),show:!0,fill:!0,material:s.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=ge.Math.toDegrees(e.latitude);return[ge.Math.toDegrees(e.longitude),t]}},(ve.prototype=Object.create(Object.assign({},ve.prototype,de.prototype))).constructor=ve;let _e=null;var we=function(e,t){de.call(this,e,t),_e=t,this.type="PincerArrow",this.fillMaterial=_e.Color.YELLOW.withAlpha(.8)};function Ce(e,t){e=t.camera.getPickRay(e);return e?t.scene.globe.pick(e,t.scene):null}we.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 _e.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(t){this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0));var n=this;this.state=1,this.handler.setInputAction(function(e){if(e=Ce(e.position,n.viewer))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),n.positions=[],n.pointArr=[],n.arrowEntity=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)}},_e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(e){!n.floatPoint||n.positions.length<2||(e=Ce(e.endPosition,n.viewer))&&(n.floatPoint.position.setValue(e),2<=n.positions.length)&&(_e.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)))},_e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(e){if(4<=n.positions.length&&(e=Ce(e.position,n.viewer))){for(var t=0;t<n.pointArr.length;t++)n.pointArr[t].show=!1;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.positions=[],n.pointArr=[],n.arrowEntity=null}},_e.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=_e.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}for(this.positions=t,i=0;i<this.positions.length;i++){var r=this.creatPoint(this.positions[i]);r.show=!1,r.wz=i+1,this.pointArr.push(r)}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 _e.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction(function(e){var t=n.viewer.scene.pick(e.position);if(_e.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.state=-1,n.modifyHandler.destroy(),n.modifyHandler=null}2==n.clickStep&&(n.clickStep=0,t=Ce(e.position,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(t),n.selectPoint=null)},_e.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction(function(e){(e=Ce(e.endPosition,n.viewer))&&n.selectPoint&&(n.selectPoint.position.setValue(e),n.positions[n.selectPoint.wz-1]=e)},_e.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:_e.Color.YELLOW}})},showArrowOnMap:function(o){var a=this;return this.viewer.entities.add({id:a.objId,polygon:new _e.PolygonGraphics({hierarchy:new _e.CallbackProperty(function(){if(o.length<3)return null;for(var e=[],t=0;t<o.length;t++){var i=a.cartesianToLatlng(o[t]);e.push(i)}var n=a.xp.algorithm.doubleArrow(e,_e),r=[];return-1==JSON.stringify(n.polygonalPoint).indexOf("null")&&(r=n.polygonalPoint),new _e.PolygonHierarchy(r)},!1),show:!0,fill:!0,material:a.fillMaterial})})},cartesianToLatlng:function(e){var e=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),t=_e.Math.toDegrees(e.latitude);return[_e.Math.toDegrees(e.longitude),t]}},(we.prototype=Object.create(Object.assign({},we.prototype,de.prototype))).constructor=we;let Pe=null,xe=null;function Se(e,t,i,n){if(e&&n){const{threeGlobal:i,containerId:r,threeContainerId:o}=n;Pe=t,xe=i,this._viewer=e,this._containerId=r,this._threeContainerId=o,this._initContainer(),this._initThree()}}Se.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(){var e=window.innerWidth/window.innerHeight;this._three={renderer:null,camera:null,scene:null},this._three.scene=new xe.Scene,this._three.camera=new xe.PerspectiveCamera(45,e,1,1e7),this._three.renderer=new xe.WebGLRenderer({alpha:!0}),this.threeContainer&&this.threeContainer.appendChild(this._three.renderer.domElement)},createThreeObject:function(){return new function(){this.threeMesh=null,this.minWGS84=null,this.maxWGS84=null}},addThreeObjects:function(e){e&&0<e.length&&(this._3Dobjects=e,this._renderCesium(),this._renderThreeObj(),this._loop())},_loop:function(){let e=this;window.loop=function(){e.requestID=requestAnimationFrame(window.loop),window.renderCesium(),e._renderThreeObjOfSize.call(e),e._renderCamera.call(e)},window.loop()},_renderCesium:function(){var e=this;window.renderCesium=function(){e._viewer&&e._viewer.render()}},_renderThreeObj:function(){var s=this;window.renderThreeObj=function(){function e(e){return new xe.Vector3(e.x,e.y,e.z)}if(s._three&&s._viewer&&s._3Dobjects){s._three.camera.fov=Pe.Math.toDegrees(s._viewer.camera.frustum.fovy),s._three.camera.updateProjectionMatrix();for(var t=0;t<s._3Dobjects.length;t++){var i=s._3Dobjects[t].minWGS84,n=s._3Dobjects[t].maxWGS84,r=Pe.Cartesian3.fromDegrees((i[0]+n[0])/2,(i[1]+n[1])/2),o=Pe.Cartesian3.fromDegrees((i[0]+n[0])/2,(i[1]+n[1])/2,1),a=e(Pe.Cartesian3.fromDegrees(i[0],i[1])),i=e(Pe.Cartesian3.fromDegrees(i[0],n[1])),n=(new xe.Vector3).subVectors(a,i).normalize();s._3Dobjects[t].threeMesh.position.copy(r),s._3Dobjects[t].threeMesh.lookAt(o),s._3Dobjects[t].threeMesh.up.copy(n)}}}},_renderThreeObjOfSize(){var e=this.threeContainer.clientWidth,t=this.threeContainer.clientHeight;this._three.renderer.setSize(e,t),this._three.renderer.render(this._three.scene,this._three.camera)},_renderCamera(){var e=this._three,t=(e.camera.fov=Pe.Math.toDegrees(this._viewer.camera.frustum.fovy),e.camera.updateProjectionMatrix(),e.camera.matrixAutoUpdate=!1,this._viewer.camera.viewMatrix),i=this._viewer.camera.inverseViewMatrix,i=(e.camera.lookAt(0,0,0),e.camera.matrixWorld.set(i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15]),e.camera.matrixWorldInverse.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this.threeContainer.clientWidth/this.threeContainer.clientHeight);e.camera.aspect=i,e.camera.updateProjectionMatrix()},destroyThreeJS(){for(cancelAnimationFrame(this.requestID);this.threeContainer.firstChild;)this.threeContainer.removeChild(this.threeContainer.firstChild);this._three.scene&&(this._three.scene.traverse(e=>{e.isMesh&&(e.geometry.dispose(),e.material.isMaterial)&&e.material.dispose()}),this._three.scene=null),this._three.renderer&&(this._three.renderer.forceContextLoss(),this._three.renderer.dispose(),this._three.renderer=null),this._three.camera&&(this._three.camera=null)}};class Me{constructor(e){return this.init(e)}init({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:o={},MapImageryList:s=[],defaultStatic:l,baseExtendsCom:c=[],extendsCom:h,extendsComName:u}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";if(i)return{viewer:r=new a(e).init({containerId:i,viewerConfig:r,extraConfig:o,MapImageryList:s}),[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,o,a,s){return function(e,r){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)r.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new r(n,o,a,s),e.forEach(e=>{e.call(t,n,o,a,s)})):(i(e),t=new r(n,o,a,s),e.call(t,n,o,a,s)),t}}}class be extends Me{constructor(e){return super({...e,baseExtendsCom:[m,g,x],extendsCom:C,extendsComName:"draw"})}}class Te extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:H,extendsComName:"customCesiumPlugin"})}}exports.Analysis=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,C,Z],extendsCom:Q,extendsComName:"analysis"})}},exports.AttackArrow=me,exports.Control=class extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:X,extendsComName:"control"})}},exports.CustomCesiumPlugin=class{constructor(e){return new Te(e)}},exports.Draw=class{constructor(e){var t=new be(e);return this._initCurrMeasure(e,t)}_initCurrMeasure(e,t){var i=new me(t.viewer,e.cesiumGlobal),n=new ve(t.viewer,e.cesiumGlobal),e=new we(t.viewer,e.cesiumGlobal);return{...t,attackArrowObj:i,straightArrowObj:n,pincerArrowObj:e}}},exports.Graphics=class extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:l,extendsComName:"graphics"})}},exports.Material=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,u],extendsCom:h,extendsComName:"material"})}},exports.Math2d=x,exports.Math3d=g,exports.PassEffect=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,u],extendsCom:M,extendsComName:"passEffect"})}},exports.PincerArrow=we,exports.Plugin=class extends Me{constructor(e){return super({...e,baseExtendsCom:[m,l],extendsCom:Z,extendsComName:"plugin"})}},exports.Primitive=class extends Me{constructor(e){return super({...e,baseExtendsCom:m,extendsCom:y,extendsComName:"primitive"})}},exports.StraightArrow=ve,exports.ThreeJs=class extends Me{constructor(e){return super({...e,baseExtendsCom:[],extendsCom:Se,extendsComName:"threeJs"})}},exports.initCesium=function({cesiumGlobal:e,threeGlobal:t,containerId:i,threeContainerId:n,viewerConfig:r={},extraConfig:o={},MapImageryList:s=[],defaultStatic:c}){if(!e)throw"Missing cesiumGlobal parameter, please check the calling function initCesium.";var d,p,f;if(i)return r=new a(e).init({containerId:i,viewerConfig:r,extraConfig:o,MapImageryList:s}),p=e,f=c,{viewer:d=r,material:(o=function(e,r){var t=null;function i(e){for(var t=Object.keys(e.prototype),i=0,n=t.length;i<n;i++)r.prototype[t[i]]=e.prototype[t[i]]}return Array.isArray(e)?(e.forEach(e=>{i(e)}),t=new r(d,p,f),e.forEach(e=>{e.call(t,d,p,f)})):(i(e),t=new r(d,p,f),e.call(t,d,p,f)),t})([m,u],h),graphics:o(m,l),math3d:o(m,g),math2d:new x(r,e),primitive:o(m,y),draw:o([m,g,x],C),passEffect:o([m,u],M),customCesiumPlugin:o(m,H),control:o(m,X),plugin:o([m,l],Z),base:new m(r,e),analysis:o([m,C,Z],Q),attackArrowObj:new me(r,e),straightArrowObj:new ve(r,e),pincerArrowObj:new we(r,e),threeJs:new Se(r,e,c,t?{threeGlobal:t,containerId:i,threeContainerId:n}:"")};throw"Missing containerId parameter, please check the calling function initCesium."};