wangzhibo
2021-09-06 2efb5d2a02ce47a9fd6f1cec138496aba72f0815
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
"use script"; //开发环境建议开启严格模式
 
//对应widget.js中MyWidget实例化后的对象
var thisWidget;
 
//当前页面业务
function initWidgetView(_thisWidget) {
  thisWidget = _thisWidget;
 
  $("#btnDraw").click(function () {
    thisWidget.drawPolygon();
  });
 
  $("#begin").click(function () {
    if (thisWidget.floodByGraphic.positions == null) {
      haoutil.msg("请首先绘制分析区域!");
      return;
    }
 
    var minValue = Number($("#minHeight").val());
    var maxValue = Number($("#maxHeight").val());
    var speed = Number($("#speed").val());
 
    thisWidget.floodByGraphic.setOptions({
      minHeight: minValue,
      maxHeight: maxValue,
      speed: speed,
    });
 
    $("#range_currHeight").attr("min", minValue);
    $("#range_currHeight").attr("max", maxValue);
    onChangeHeight(minValue);
 
    $("#paramView").hide();
    $("#resultView").show();
    $("#btn_start").click(); //自动启动
  });
  //滑动条
  $("#range_currHeight").range({
    onChange: function (value, bfb) {
      thisWidget.floodByGraphic.height = value;
      $("#lbl_nowHeight").html("当前高度:" + value.toFixed(1));
 
      $("#btn_start").val("自动播放");
    },
  });
 
  $("#btn_start").click(function () {
    if (thisWidget.floodByGraphic.isStart) {
      thisWidget.floodByGraphic.stop();
      $("#btn_start").val("自动播放");
    } else {
      thisWidget.floodByGraphic.start();
      $("#btn_start").val("暂停");
    }
  });
 
  $("#clear").click(function () {
    $("#resultView").hide();
    $("#paramView").show();
 
    thisWidget.clear();
  });
}
 
function onChangeHeight(height) {
  $("#range_currHeight").val(height).change();
  $("#lbl_nowHeight").html("当前高度:" + height.toFixed(1));
}
 
function updateHeightForDraw(minDraw, maxDraw) {
  $("#minHeight").val(minDraw.toFixed(1));
  $("#maxHeight").val(maxDraw.toFixed(1));
}