'use script' //开发环境建议开启严格模式
|
;
|
(function (window, mars3d) {
|
//创建widget类,需要继承BaseWidget
|
class MyWidget extends mars3d.widget.BaseWidget {
|
//弹窗配置,2个弹窗的情形
|
get view() {
|
return {
|
type: "window",
|
url: "view.html",
|
windowOptions: {
|
width: 350,
|
height: 345,
|
left: 5,
|
top: 120
|
},
|
};
|
}
|
//初始化[仅执行1次]
|
create() {
|
this.grid_500 = this.map.getLayerById(3000);
|
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_500.show = true;
|
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_500.show = true;
|
this.grid_1000.show = true;
|
this.grid_3000.show = true;
|
this.grid_5000.show = true;
|
|
}
|
|
hideGridmapLayers() {
|
this.grid_500.show = true;
|
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_500.show = true;
|
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_500.options.parameters.styles = this.grid_500.options.style_prefix + new_style;
|
this.grid_500.options.style_selected = new_style;
|
this.grid_500.reload();
|
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_500.opacity = 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)
|