qinbo
2021-11-16 a868809ac8d2ecf25a7f1369421a16161e91473a
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
111
112
113
114
115
116
117
118
119
120
121
122
'use script' //开发环境建议开启严格模式
  ;
(function (window, mars3d) {
  //创建widget类,需要继承BaseWidget
  class MyWidget extends mars3d.widget.BaseWidget {
    //弹窗配置,2个弹窗的情形
    get view() {
      return {
        type: "window",
        url: "view.html",
        windowOptions: {
          width: 360,
          height: 320,
          left: 5,
          top: 120
        },
      };
    }
    //初始化[仅执行1次]
    create() {
      this.grid_1000 = this.map.getLayerById(3001);
      this.grid_3000 = this.map.getLayerById(3002);
      this.grid_5000 = this.map.getLayerById(3003);
      this.style_options = this.grid_1000.options.style_options;
      this.style_selected = this.grid_1000.options.style_selected;
 
      this.nodejs_url_predix = mars3d.global_variables.nodejs_url_predix;
      this.heatmapGroupLayer = new mars3d.layer.GroupLayer({ id: 5000, pid: 50, name: "", show: false });
      this.map.addLayer(this.heatmapGroupLayer);
    }
 
 
 
    //每个窗口创建完成后调用
    winCreateOK(opt, result) {
      this.grid_1000.show = true;
      this.grid_3000.show = true;
      this.grid_5000.show = true;
      //this.map.setCameraView(mars3d.global_variables.grid_camerview.grid5000);
      this.datatype = mars3d.global_variables.queryDataType;
      this.datatime = mars3d.global_variables.queryDataTStart;
    }
 
    showGridmapLayers() {
      this.grid_1000.show = true;
      this.grid_3000.show = true;
      this.grid_5000.show = true;
 
    }
 
    hideGridmapLayers() {
      this.grid_1000.show = false;
      this.grid_3000.show = false;
      this.grid_5000.show = false;
 
    }
 
    showHeatmapLayers(){
      this.heatmapGroupLayer.show = true;
      this.heatmapGroupLayer.getLayers().forEach(layer => {
        layer.show= true;
      });
    }
    hideHeatmapLayers(){
      this.heatmapGroupLayer.show = false;
      console.log(this.heatmapGroupLayer);
      this.heatmapGroupLayer.getLayers().forEach(layer => {
        layer.show= false;
      });
    }
 
    //打开激活
    activate() {
 
    }
 
    changeCamerView(gridlevel) {
      this.map.setCameraView(mars3d.global_variables.grid_camerview[gridlevel]);
    }
    //关闭释放
    disable() {
      this.grid_1000.show = false;
      this.grid_3000.show = false;
      this.grid_5000.show = false;
      this.heatmapGroupLayer.getLayers().forEach(layer => {
        layer.show= false;
      });
    }
 
    update_grid_style(new_style) {
      this.grid_1000.options.parameters.styles = this.grid_1000.options.style_prefix + new_style;
      this.grid_1000.options.style_selected = new_style;
      this.grid_1000.reload();
      this.grid_3000.options.parameters.styles = this.grid_1000.options.style_prefix + new_style;
      this.grid_3000.options.style_selected = new_style;
      this.grid_3000.reload();
      this.grid_5000.options.parameters.styles = this.grid_1000.options.style_prefix + new_style;
      this.grid_5000.options.style_selected = new_style;
      this.grid_5000.reload();
    }
 
    setHeatmapAlpha(value) {
      this.heatmapGroupLayer.getLayers().forEach(layer => {
        layer.opacity= value;
      });
    }
    setGridmapAlpha(value) {
      this.grid_1000.opacity = value;
      this.grid_3000.opacity = value;
      this.grid_5000.opacity = value;
      
    }
 
 
 
  }
 
  //注册到widget管理器中。
  mars3d.widget.bindClass(MyWidget)
 
  //每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。
})(window, mars3d)