"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));
|
}
|