From 121a5b01a2461b5d9d5c188f9dd36c2e4673db9d Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Mon, 28 Sep 2020 10:41:08 +0800
Subject: [PATCH] 实时风向与因子数据从同一个websokceket获取优化
---
src/main/webapp/view/newmap.jsp | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/src/main/webapp/view/newmap.jsp b/src/main/webapp/view/newmap.jsp
index 205811d..0648bcc 100644
--- a/src/main/webapp/view/newmap.jsp
+++ b/src/main/webapp/view/newmap.jsp
@@ -340,7 +340,8 @@
background: url(/img/charts_btn_bg_2.png) left top no-repeat;
background-size: 70%;
}
- .wind_explain{
+
+ .wind_explain {
position: absolute;
height: 200px;
width: 110px;
@@ -348,20 +349,28 @@
top: 110px;
z-index: 1;
}
- .wind_explain li{
+
+ .wind_explain li {
height: 25px;
}
- .wind_explain li span{
+
+ .wind_explain li span {
display: inline-block;
height: 25px;
line-height: 25px;
}
- .wind_explain li img{
+
+ .wind_explain li img {
vertical-align: top;
}
</style>
<body>
+<div>
+</div>
+<textarea id="close" hidden></textarea>
+
<div class="main_body">
+ <%--<input id="button" type="button" value="������" onclick="getJs();">--%>
<div class="tools_box">
<div class="charts_btn">
</div>
@@ -517,6 +526,19 @@
} else {
alert(equStr);
}
+ }
+ if ("���������" === obj["monitorPoint"]["description"]) {
+ var icon05 = new BMap.Icon("/img/ico05.png", new BMap.Size(50, 50));
+ var mark05 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon05});
+ moralMap.addOverlay(mark05);
+ } else if ("���������" === obj["monitorPoint"]["description"]) {
+ var icon06 = new BMap.Icon("/img/ico06.png", new BMap.Size(50, 50));
+ var mark06 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon06});
+ moralMap.addOverlay(mark06);
+ } else if ("���������" === obj["monitorPoint"]["description"]) {
+ var icon08 = new BMap.Icon("/img/ico08.png", new BMap.Size(50, 50));
+ var mark08 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon08});
+ moralMap.addOverlay(mark08);
}
var moralMask = new moralMap.Equipment(obj);
moralMap.addOverlay(moralMask);
@@ -677,24 +699,29 @@
if (typeof (WebSocket) === "undefined") {
alert("������������������������WebSocket");
} else {
- ws = new WebSocket('ws://' + hostAndPort + '/screen/webSocket/' + orgId + '&' + accountId);
+ ws = new WebSocket('ws://' + hostAndPort + '/screen/webSocket/' + orgId + '&' + accountId + '_' + regionCode);
ws.onopen = function () {
};
-
//������������������
ws.onmessage = function (msg) {
// $("#searchParam").val(JSON.parse(msg.data));
moralMap.refreshWindDir(JSON.parse(JSON.parse(msg.data)));
- if (moralMap.showSensors && typeof (moralMap.showSensors) == "function") {
- moralMap.showSensors(JSON.parse(JSON.parse(msg.data)));
+ /* if (moralMap.showSensors && typeof (moralMap.showSensors) == "function") {
+ moralMap.showSensors(JSON.parse(JSON.parse(msg.data)));
+ }*/
+ if ($("#close").html() == "CloseMq") {
+ ws.close(JSON.parse(msg.data));
}
+ moralMap.showSensors(JSON.parse(JSON.parse(msg.data)));
};
//������������
ws.onclose = function () {
+ $("#close").html("websocket������������");
};
//���������������������
ws.onerror = function () {
+ $("#close").html("websocket������������");
};
}
@@ -803,6 +830,7 @@
}
function callJS(jsonData) {
+ $("#close").html(jsonData);
var jsonData = JSON.parse(jsonData);
var methodName = jsonData.methodName;
// $("#searchParam").val(JSON.stringify(jsonData));
@@ -811,8 +839,9 @@
} else if ("RefreshState" == methodName) {
var states = jsonData.states;
moralMap.refreshState(states);
- } else if ("DeliverSensors" == methodName) {
- // moralMap.showSensors(jsonData);
+ } else if ("CloseMq" == methodName) {
+ $("#close").html(methodName);
}
}
+
</script>
--
Gitblit v1.8.0