From 3a46aae0a8e9e4bd3cb8dcd1185a69a74668995b Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Tue, 15 Dec 2020 14:08:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/main/webapp/js/newmoralmap.js | 366 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 315 insertions(+), 51 deletions(-)
diff --git a/src/main/webapp/js/newmoralmap.js b/src/main/webapp/js/newmoralmap.js
index 6e08a5b..9cdac74 100644
--- a/src/main/webapp/js/newmoralmap.js
+++ b/src/main/webapp/js/newmoralmap.js
@@ -56,6 +56,7 @@
// ���������������������������������������,���������������������
// ���������������������������
var myGeo = new BMap.Geocoder();
+ address = address.replace(/\s*/g, "");
myGeo.getPoint(address, function (point) {
if (point) {
if ("���������" == cityName) {
@@ -395,7 +396,7 @@
var timer = setTimeout(function () {
baiduMap.closeInfoWindow.apply(baiduMap, arguments);
moralMap["_closeInfoWinTimer"] = null;
- }, 1200);
+ }, 500);
moralMap["_closeInfoWinTimer"] = timer;
}
moralMap.clearOverlays = function () {
@@ -644,6 +645,7 @@
return listView;
}
+
moralMap.MoralMarker = function (option) {
var _option = option;
var _pointObj = new BMap.Point(_option['longitude'], _option['latitude']);
@@ -655,7 +657,11 @@
state = state == null ? 0 : state;
var icon = _option["icon"];
//var url = icon["stateIcons"][state];
- var url = icon["url"] + state + ".png";
+ if (state==5 || state==6){
+ var url = icon["url"] + "0"+state + ".png";
+ }else {
+ var url = icon["url"] + state + ".png";
+ }
return new BMap.Icon(url, new BMap.Size(icon["width"], icon["height"]), {
imageSize: new BMap.Size(icon["width"], icon["height"])
});
@@ -695,8 +701,80 @@
}
})
}
+
+
+ moralMap.WindMarker = function (option, moralMap) {
+ var _option = option;
+ var _pointObj = new BMap.Point(_option['longitude'], _option['latitude']);
+ var _iconObj = _getWindIcon(0);
+ this._point = _pointObj;
+
+ function _getWindIcon(speedLevel) {
+ speedLevel = speedLevel == null ? 0 : speedLevel;
+ var windIcon = _option["windIcon"];
+ var windUrl = windIcon["url"] + speedLevel + ".png";
+
+ return new BMap.Icon(windUrl, new BMap.Size(windIcon["width"], windIcon["height"]), {
+ imageSize: new BMap.Size(windIcon["width"], windIcon["height"])
+ });
+ }
+
+ this.constructor.call(this, _pointObj, {
+ icon: _iconObj,
+ offset: new BMap.Size(0, -11),
+ enableMassClear: true
+ })
+
+
+ return $.extend(this, {
+ refreshWindDir: function (windDir, windSpeed) {
+ //���������������������������������������������
+ if (windDir == undefined || windSpeed == undefined) {
+ moralMap.removeOverlay(this);
+ } else {
+ var speedLevel;
+ if (windSpeed >= 0 && windSpeed <= 0.2) {
+ speedLevel = 0;
+ } else if (windSpeed > 0.2 && windSpeed <= 1.5) {
+ speedLevel = 1;
+ } else if (windSpeed > 1.5 && windSpeed <= 3.3) {
+ speedLevel = 2;
+ } else if (windSpeed > 3.3 && windSpeed <= 5.4) {
+ speedLevel = 3;
+ } else if (windSpeed > 5.4 && windSpeed <= 7.9) {
+ speedLevel = 4;
+ } else if (windSpeed > 7.9 && windSpeed <= 10.7) {
+ speedLevel = 5;
+ } else if (windSpeed > 10.7 && windSpeed <= 13.8) {
+ speedLevel = 6;
+ } else if (windSpeed > 13.8 && windSpeed <= 17.1) {
+ speedLevel = 7;
+ } else if (windSpeed > 17.1) {
+ speedLevel = 8;
+ }
+ if (speedLevel == 0) {
+ moralMap.removeOverlay(this);
+ } else {
+ var iconObj = _getWindIcon(speedLevel);
+ this.setIcon(iconObj);
+ this.setRotation(windDir);
+ }
+ }
+ },
+ getOption: function () {
+ return _option;
+ },
+ setOption: function (option) {
+ _option = option;
+ },
+
+ })
+
+ }
+
//new BMap.Marker()������������IE7���������������������
moralMap.MoralMarker.prototype = new BMap.Marker();
+ moralMap.WindMarker.prototype = new BMap.Marker();
//��������������� ������Mark������
moralMap.Monitorpoint = function (option) {
if (monitorPointStates) {
@@ -708,7 +786,7 @@
}
}
var icon = {};
- icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png"];
+ icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png","/img/ico05.png", "/img/ico06.png"];
icon["url"] = "/img/ico0";
icon["width"] = 50;
icon["height"] = 50;
@@ -777,7 +855,7 @@
var sensorsDescriptionMap;
var sensorsUnitMap;
$.ajax({
- url: "getSensorsMap",
+ url: "getSensorsAllMap",
type: "get",
dataType: "json",
success: function (data) {
@@ -785,6 +863,41 @@
sensorsUnitMap = data[1];
}
});
+
+ moralMap.Device = function (option) {
+ if (deviceStates) {
+ for (var i in deviceStates) {
+ var state = deviceStates[i];
+ if (state.id == option.id) {
+ option.state = state.state;
+ }
+ }
+ }
+ var windIcon = {};
+ windIcon["url"] = "/img/icoWind0";
+ windIcon["width"] = 25;
+ windIcon["height"] = 25;
+ option["windIcon"] = windIcon;
+ var windMarker = new moralMap.WindMarker(option, moralMap);
+ moralMap.putDevice(option['mac'], windMarker);
+ var refreshWindMarker = windMarker.refreshWindDir;
+ return $.extend(windMarker, {
+ refreshWindDir: function (data) {
+ if (data != null && data != "") {
+ this.setData(data); //������������
+ refreshWindMarker.call(this, data["e23"], data["e18"]);
+ }
+ },
+ setData: function (data) {
+ var option = this.getOption();
+ option["data"] = data;
+ this.setOption(option);
+ },
+ getData: function () {
+ return this.getOption()["data"];
+ }
+ });
+ }
//���������mac���key������
//��������������� ������MoralMark������
@@ -798,7 +911,7 @@
}
}
var icon = {};
- icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png"];
+ icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png","/img/ico005.png", "/img/ico006.png"];
icon["url"] = "/img/ico0";
icon["width"] = 50;
icon["height"] = 50;
@@ -840,55 +953,50 @@
}
var mouseOverHandle = option['mouseover'];
moralMarker.addEventListener("mouseover", function () {
- var obj = {};
- obj['methodName'] = 'deliverMac';
- obj['mac'] = option['mac'];
- var objStr = JSON.stringify(obj);
- if (!!window['external'] && !!window['external']['callWin']) {
- window['external'].callWin(objStr);
- } else {
- alert(objStr);
- }
-
moralMap.showSensors = function (jsonData) {
+ var deviceSensors = jsonData;
+ var mac = deviceSensors["mac"];
if (!jsonData.hasOwnProperty('mac')) {
infoWindow.setContent("");
infoWindow.redraw();
} else {
- var adressOutHtml = '<div style="min-height:20px;overflow:auto;max-height:400px;font-size: 12px;" onmouseover="moralMap.clearCloseInfoWindow()" onmouseout="moralMap.closeInfoWindow()">';
- var y, m, d, h, mm, s;
- var date = new Date(jsonData['time']);
- y = 1900 + date.getYear();
- m = "0" + (date.getMonth() + 1);
- d = "0" + date.getDate();
- h = "0" + date.getHours();
- mm = "0" + date.getMinutes();
- s = "0" + date.getSeconds();
- date = y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length) + " " + h.substring(h.length - 2, h.length) + ":" + mm.substring(mm.length - 2, mm.length) + ":" + s.substring(s.length - 2, s.length);
- adressOutHtml += '<p style="height: 18px;line-height: 18px">' + "��������� " + date + " </p>";
- for (var prop in jsonData) {
- if (jsonData.hasOwnProperty(prop) && prop != 'ver' && prop != 'methodName' && prop != 'mac' && prop != 'time') {
- for (var key in sensorsDescriptionMap) {
- if (prop == key) {
- var sensorsDescription = sensorsDescriptionMap[key];
- }
- }
- for (var key in sensorsUnitMap) {
- if (prop == key) {
- var sensorsUnit = sensorsUnitMap[key];
- if (sensorsUnit == null) {
- sensorsUnit = "";
+ if (mac == option['mac']) {
+ var adressOutHtml = '<div style="min-height:20px;overflow:auto;max-height:480px;font-size: 12px;" onmouseover="moralMap.clearCloseInfoWindow()" onmouseout="moralMap.closeInfoWindow()">';
+ var y, m, d, h, mm, s;
+ var date = new Date($.now());
+ y = 1900 + date.getYear();
+ m = "0" + (date.getMonth() + 1);
+ d = "0" + date.getDate();
+ h = "0" + date.getHours();
+ mm = "0" + date.getMinutes();
+ s = "0" + date.getSeconds();
+ date = y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length) + " " + h.substring(h.length - 2, h.length) + ":" + mm.substring(mm.length - 2, mm.length) + ":" + s.substring(s.length - 2, s.length);
+ adressOutHtml += '<p style="height: 18px;line-height: 18px">' + "��������� " + date + " </p>";
+ for (var prop in jsonData) {
+ if (jsonData.hasOwnProperty(prop) && prop != 'ver' && prop != 'methodName' && prop != 'mac' && prop != 'time') {
+ for (var key in sensorsDescriptionMap) {
+ if (prop == key) {
+ var sensorsDescription = sensorsDescriptionMap[key];
}
}
+ for (var key in sensorsUnitMap) {
+ if (prop == key) {
+ var sensorsUnit = sensorsUnitMap[key];
+ if (sensorsUnit == null) {
+ sensorsUnit = "";
+ }
+ }
+ }
+ adressOutHtml += ('<p style="height: 18px;line-height: 18px">' + sensorsDescription + "���" + jsonData[prop] + sensorsUnit + "</p>");
}
- adressOutHtml += ('<p style="height: 18px;line-height: 18px">' + sensorsDescription + "���" + jsonData[prop] + sensorsUnit + "</p>");
}
+ adressOutHtml += "</div>";
+ infoWindow.setContent(adressOutHtml);
+ infoWindow.redraw();
}
- adressOutHtml += "</div>";
- infoWindow.setContent(adressOutHtml);
- infoWindow.redraw();
}
}
+ // }
/* if (!$.isEmptyObject(sensorInfo)) {
moralMap.openInfoWindow(infoWindow, this._point); //������������������
}*/
@@ -896,14 +1004,6 @@
});
moralMarker.addEventListener("mouseout", function () {
- var obj = {};
- obj['methodName'] = 'stopDeliverMac';
- var objStr = JSON.stringify(obj);
- if (!!window['external'] && !!window['external']['callWin']) {
- window['external'].callWin(objStr);
- } else {
- alert(objStr);
- }
moralMap.closeInfoWindow();
});
@@ -952,6 +1052,31 @@
moralMap.getEquipments = function (key) {
return moralMap['_equipments'];
}
+
+ moralMap.putDevice = function (key, obj) {
+ if (key != null && key != "") {
+ key = String.prototype.toLowerCase.call(key);
+ if (moralMap['_devices'] == undefined) {
+ moralMap['_devices'] = {};
+ }
+ moralMap['_devices'][key] = obj;
+ }
+ }
+
+ moralMap.getDevice = function (key) {
+ if (key == null) {
+ return null;
+ }
+ key = String.prototype.toLowerCase.call(key);
+ if (typeof moralMap['_devices'] === 'object') {
+ return moralMap['_devices'][key];
+ }
+ }
+
+ moralMap.getDevices = function (key) {
+ return moralMap['_devices'];
+ }
+
moralMap.clearEquipments = function () {
if (moralMap['_equipments'] != undefined) {
delete moralMap['_equipments'];
@@ -985,12 +1110,53 @@
if (longitude < bounds.northeastLng && longitude > bounds.southwestLng && latitude < bounds.northeastLat && latitude > bounds.southwestLat) {
markers.push(oldmarker);
}
+ if ("���������" === option["monitorPoint"]["description"]) {
+ var icon05 = new BMap.Icon("/img/ico05.png", new BMap.Size(50, 50));
+ var mark05 = new BMap.Marker(new BMap.Point(option["monitorPoint"]["longitude"], option["monitorPoint"]["latitude"]), {icon: icon05});
+ markers.push(mark05);
+ } else if ("���������" === option["monitorPoint"]["description"]) {
+ var icon06 = new BMap.Icon("/img/ico06.png", new BMap.Size(50, 50));
+ var mark06 = new BMap.Marker(new BMap.Point(option["monitorPoint"]["longitude"], option["monitorPoint"]["latitude"]), {icon: icon06});
+ markers.push(mark06);
+ } else if ("���������" === option["monitorPoint"]["description"]) {
+ var icon08 = new BMap.Icon("/img/ico08.png", new BMap.Size(50, 50));
+ var mark08 = new BMap.Marker(new BMap.Point(option["monitorPoint"]["longitude"], option["monitorPoint"]["latitude"]), {icon: icon08});
+ markers.push(mark08);
+ }
}
}
}
}
return markers;
}
+
+ moralMap.getHorizonWindMarkers = function (isShow) {
+ var bounds = moralMap.getBounds();
+ var oldWindMarkerList;
+ var isShow = (isShow) ? baiduMap : null;
+ if (moralMap.layer() == "equipments") {
+ oldWindMarkerList = moralMap.getDevices();
+ }
+ var markers = [];
+ if (oldWindMarkerList != null && typeof oldWindMarkerList == "object") {
+ for (var i in oldWindMarkerList) {
+ var oldWindMarker = oldWindMarkerList[i];
+ if (oldWindMarker != null && oldWindMarker instanceof BMap.Overlay && oldWindMarker.getMap() == isShow) {
+ var option = oldWindMarker.getOption();
+ if (typeof option == 'object') {
+ var longitude = option['longitude'];
+ var latitude = option['latitude'];
+ // ������������������������������������
+ if (longitude < bounds.northeastLng && longitude > bounds.southwestLng && latitude < bounds.northeastLat && latitude > bounds.southwestLat) {
+ markers.push(oldWindMarker);
+ }
+ }
+ }
+ }
+ }
+ return markers;
+ }
+
moralMap.showPointMonitor = function (id) {
var mpointMarker = moralMap.getMpoint(id);
var mpoint = mpointMarker.getOption();
@@ -1044,7 +1210,57 @@
var deviceStates;
var monitorPointStates;
- moralMap.refreshState = function (states) {
+ moralMap.refreshState = function (states, orgId, regionCode, accountId) {
+ var state = JSON.stringify(states);
+ var state1 = $(".pp2").html()
+ var paramMap = {};
+ var abc = '';
+ paramMap["orgId"] = orgId;
+ paramMap["regionCode"] = regionCode;
+ paramMap["accountId"] = accountId;
+ paramMap["states"] = state;
+ paramMap["states1"] = state1;
+ $.ajax({
+ url: "/screen/tellAlarm",
+ type: "post",
+ dataType: "json",
+ data: paramMap,
+ success: function (info) {
+ var alarm = JSON.parse(JSON.stringify(info));
+ if (alarm.length > 0) {
+ $("#box").attr("style", "display:block;");//������div
+ $("#tou").attr("style", "display:block;color: #d9534f;font-size: 20px;");//������div
+ for (var i = 0; i < alarm.length; i++) {
+ var text = "<span style='line-height: 25px><p style='line-height: 25px'>";
+ var lookString = alarm[i][0]["time"] + " " + alarm[i][0]["name"];
+ for (var j = 0; j < alarm[i].length; j++) {
+ var value = "";
+ if (alarm[i].length > 1) {
+ if (j == 0) {
+ value = alarm[i][j]["sensor"] + "=" + alarm[i][j]["value"];
+ lookString = lookString + value;
+ } else {
+ value = alarm[i][j]["sensor"] + "=" + alarm[i][j]["value"];
+ lookString = lookString + "," + value;
+ }
+ } else {
+ value = alarm[i][j]["sensor"] + "=" + alarm[i][j]["value"];
+ lookString = lookString + value;
+ }
+ text = text + lookString + "������" + "</p><hr></hr></span>";
+ $("#box1").prepend(text);
+ }
+
+ }
+ for (var j = 0; j < $("#box1").children("span").length; j++) {
+ if ($("#box1").children("span").length > 50) {
+ $("#box1 span:last").remove() ;
+ }
+ }
+ }
+ },
+ })
+ state1 = $(".pp2").html(state);
monitorPointStates = states;
deviceStates = [];
for (var i in states) {
@@ -1072,5 +1288,53 @@
}
}
+
+ moralMap.getRoad = function (data, regionCode) {
+
+ var wind = data["e23"];
+ var mac = data["mac"];
+ var windSpeed = data["e18"];
+ var speedLevel;
+ if (windSpeed >= 0 && windSpeed <= 0.2) {
+ speedLevel = 0;
+ } else if (windSpeed > 0.2 && windSpeed <= 1.5) {
+ speedLevel = 1;
+ } else if (windSpeed > 1.5 && windSpeed <= 3.3) {
+ speedLevel = 2;
+ } else if (windSpeed > 3.3 && windSpeed <= 5.4) {
+ speedLevel = 3;
+ } else if (windSpeed > 5.4 && windSpeed <= 7.9) {
+ speedLevel = 4;
+ } else if (windSpeed > 7.9 && windSpeed <= 10.7) {
+ speedLevel = 5;
+ } else if (windSpeed > 10.7 && windSpeed <= 13.8) {
+ speedLevel = 6;
+ } else if (windSpeed > 13.8 && windSpeed <= 17.1) {
+ speedLevel = 7;
+ } else if (windSpeed > 17.1) {
+ speedLevel = 8;
+ }
+
+ $.ajax({
+ url: "/screen/getAlarm",
+ type: "get",
+ dataType: "json",
+ data: {"windData": wind, "code": regionCode, "mac": mac, "speedLevel": speedLevel},
+ success: function (info) {
+ console.log("---------------" + info);
+ },
+
+ })
+ }
+
+ moralMap.refreshWindDir = function (devicesInfo) {
+ var deviceInfo = devicesInfo;
+ var mac = deviceInfo["mac"];
+ var device = moralMap.getDevice(mac);
+ if (device) {
+ device.refreshWindDir(deviceInfo);
+ }
+ }
+
window.moralMap = moralMap;
})(jQuery, BMap, window);
--
Gitblit v1.8.0