XWWitPark/witpark_jzzs/xw_jzzs_web/public/widgets/navXZQH/widget.js
2024-09-12 08:10:00 +08:00

2 lines
1.0 KiB
JavaScript

/* 2020-9-24 14:48:22 | 版权所有 军懋国兴 */
mars3d.widget.bindClass(mars3d.widget.BaseWidget.extend({options:{view:{type:"window",url:"view.html",windowOptions:{width:220,height:440}}},create:function(){},viewWindow:null,winCreateOK:function(t,e){this.viewWindow=e},activate:function(){},disable:function(){this.viewWindow=null,this.clearLastRegion()},last_region:null,clearLastRegion:function(){null!=this.last_region&&(this.viewer.dataSources.remove(this.last_region),this.last_region=null),-1!=this.last_timetemp&&(clearTimeout(this.last_timetemp),this.last_timetemp=-1)},last_timetemp:-1,showRegionExtent:function(t){this.clearLastRegion();var e=this;Cesium.GeoJsonDataSource.load(t,{clampToGround:!0,stroke:new Cesium.Color.fromCssColorString("#ffffff"),strokeWidth:2,fill:new Cesium.Color.fromCssColorString("#ffff00").withAlpha(.5)}).then(function(t){e.viewer.dataSources.add(t),e.last_region=t,e.viewer.flyTo(t.entities.values,{duration:2})}).otherwise(function(t){toastr.error(t)})},goHome:function(){this.clearLastRegion(),this.viewer.mars.centerAt()}}));