'use script' //开发环境建议开启严格模式 ; (function (window, mars3d) { //创建widget类,需要继承BaseWidget class MyWidget extends mars3d.widget.BaseWidget { // get resources(){ // return [ // 'viewl.js' // ] // } get view () { return { type: 'window', url: 'view.html', windowOptions: { width: 400, height: 800, position: { top: 180, right: 5, bottom: 110 }, }, } } reloadData (new_taxi_sn) { // this.viewWindow.resetStartQueryTaxiDataText(new_taxi_sn); this.taxi_sn = new_taxi_sn; if (this.startGraphic) { this.startGraphic.remove(); this.startGraphic = null; } if (this.endGraphic) { this.endGraphic.remove(); this.endGraphic = null; } this.routeLayer.clear(); } //初始化[仅执行1次] create () { //图层管理使用的分组 this.groupLayer = new mars3d.layer.GroupLayer({ name: this.config.name, pid: 50, //图层管理 中使用,父节点id }); //创建矢量数据图层 this.pointLayer = new mars3d.layer.GraphicLayer({ name: this.config.name + "-起止点", }); this.groupLayer.addLayer(this.pointLayer); //加入分组 this.routeLayer = new mars3d.layer.GraphicLayer({ name: this.config.name + "-路线", }); this.groupLayer.addLayer(this.routeLayer); //加入分组 } openTest (word) { console.log(word, "eee") } locateAndHighlight (lon, lat) { this.map.flyToPoint(Cesium.Cartesian3.fromDegrees(lon, lat, 0.2)); } setSingleTaxiReplayData (datas) { let data = datas; } //每个窗口创建完成后调用 winCreateOK (opt, result) { this.viewWindow = result; console.log(result, "创建完成") console.log(this.config, "this.config") this.logic_id = this.config.params.logic_id; console.log(this.config) // this.viewWindow.resetStartQueryTaxiDataText(this.taxi_sn); } //打开激活 activate () { console.log("激活完成s") this.map.addLayer(this.groupLayer); console.log("添加完成") } //关闭释放 disable () { console.log("释放完毕") if (this.startGraphic) { this.startGraphic.remove(); this.startGraphic = null; } if (this.endGraphic) { this.endGraphic.remove(); this.endGraphic = null; } this.map.removeLayer(this.groupLayer); } } //注册到widget管理器中。 mars3d.widget.bindClass(MyWidget) //每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。 })(window, mars3d)