fuchengshen
2022-07-27 fc138d928dc7fe32b40afb1f6b0a0b10bb033409
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'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)