2 lines
8.2 KiB
JavaScript
2 lines
8.2 KiB
JavaScript
|
/* 2020-9-24 14:48:21 | 版权所有 军懋国兴 */
|
||
|
mars3d.widget.bindClass(mars3d.widget.BaseWidget.extend({options:{view:{type:"window",url:"view.html",windowOptions:{width:320,height:400}}},create:function(){},viewWindow:null,winCreateOK:function(e,i){this.viewWindow=i},activate:function(){},disable:function(){this.viewWindow=null,this.destroyAll()},openTerrainDepthTest:function(){this._last_depthTestAgainstTerrain=this.viewer.scene.globe.depthTestAgainstTerrain,this.viewer.scene.globe.depthTestAgainstTerrain=!0},resetTerrainDepthTest:function(){Cesium.defined(this._last_depthTestAgainstTerrain)&&(this.viewer.scene.globe.depthTestAgainstTerrain=this._last_depthTestAgainstTerrain,delete this._last_depthTestAgainstTerrain)},destroyAll:function(){this.destroyRZFX(),this.destroyPDPX(),this.destroyKSY(),this.destroyFLFX(),this.destroyDXKW(),this.destroyDBTM(),this.destroyMXPQ(),this.destroyMXYP(),this.destroyMXCJ()},enableControl:function(e){this.viewer.mars.popup&&(this.viewer.mars.popup.enable=e),this.viewer.mars.tooltip&&(this.viewer.mars.tooltip.enable=e),this.viewer.mars.contextmenu&&(this.viewer.mars.contextmenu.enable=e)},createRZFX:function(){this.viewer.clock.onTick.addEventListener(this.showNowTimeRZFX,this)},destroyRZFX:function(){this.viewer.clock.clockRange=Cesium.ClockRange.UNBOUNDED,this.viewer.clock.multiplier=1,this.viewer.clock.onTick.removeEventListener(this.showNowTimeRZFX,this),this.viewer.shadows=!1},showNowTimeRZFX:function(){var e,i;this.viewWindow&&this.viewer.clock.shouldAnimate&&(e=this.viewer.clock.currentTime,i=Cesium.JulianDate.toDate(e),this.viewWindow.setRZFXNowTime(i))},clearRZFX:function(){this.viewer.shadows=!1,this.viewer.clock.shouldAnimate=!1},startPlayRZFX:function(e,i){this.stopTime&&(this.viewer.clock.currentTime=this.stopTime),this.viewer.clock.startTime=Cesium.JulianDate.fromDate(e),this.viewer.clock.currentTime=Cesium.JulianDate.fromDate(e),this.viewer.clock.stopTime=Cesium.JulianDate.fromDate(i),this.viewer.clock.clockRange=Cesium.ClockRange.LOOP_STOP,this.viewer.clock.multiplier=1600,this.viewer.clock.shouldAnimate=!0,this.viewer.shadows=!0},pauseRZFX:function(){return this.viewer.clock.shouldAnimate?(this.stopTime=this.viewer.clock.currentTime,this.viewer.clock.shouldAnimate=!1):(this.viewer.clock.currentTime=this.stopTime||this.viewer.clock.currentTime,this.viewer.clock.shouldAnimate=!0),this.viewer.clock.shouldAnimate},createKSY:function(){this.viewer.scene.postProcessStages.fxaa.enabled=!0,this.openTerrainDepthTest()},destroyKSY:function(){this.clearKSY(),this.resetTerrainDepthTest()},clearKSY:function(){for(var e=0,i=this.arrKsyList.length;e<i;e++)this.arrKsyList[e].destroy();this.arrKsyList=[],delete this.lastViewField},arrKsyList:[],getLastKSY:function(){return this.lastViewField||{}},addKSY:function(e){var i=this,t=new mars3d.analysi.ViewShed3D(this.viewer,{horizontalAngle:e.horizontalAngle,verticalAngle:e.verticalAngle,distance:e.distance,offsetHeight:1.5,calback:function(e){i.viewWindow&&i.viewWindow.updateKsyDistance(e)}});this.lastViewField=t,this.arrKsyList.push(t)},updateKsyDebugFrustum:function(e){for(var i=0,t=this.arrKsyList.length;i<t;i++)this.arrKsyList[i].debugFrustum=e},createFLFX:function(){var e;this.measureObj||((e=this).measureObj=new mars3d.analysi.MeasureVolume(viewer,{heightLabel:!0,offsetLabel:!1,onStart:function(){haoutil.loading.show({type:"loader-bar"})},onStop:function(){haoutil.loading.hide(),e.viewWindow.showFLFXHeightRg(e.measureObj)}}))},destroyFLFX:function(){this.measureObj&&(this.measureObj.destroy(),delete this.measureObj)},clearFLFX:function(){this.measureObj&&this.measureObj.clear()},createDXKW:function(){this.openTerrainDepthTest()},startDrawDXKW:function(){var t=this;this.enableControl(!1),viewer.mars.draw.startDraw({type:"polygon",style:{color:"#29cf34",opacity:.5,clampToGround:!0},success:function(e){t.enableControl(!0);var i=viewer.mars.draw.getPositions(e);viewer.mars.draw.deleteAll(),t.showDXKWClippingPlanes(i,!0)}})},startDrawDXKWExtent:function(){var t=this;this.enableControl(!1),viewer.mars.draw.startDraw({type:"rectangle",style:{color:"#007be6",opacity:.8,outline:!1},success
|