From 00e38ff225eb948f5234934afc01aa54c94e0de6 Mon Sep 17 00:00:00 2001 From: 于紫祥_1901 <email@yuzixiang_1910> Date: Sat, 10 Oct 2020 11:29:36 +0800 Subject: [PATCH] update --- src/main/webapp/js/newmoralmap.js | 122 +++++++++++++++++++++++++++------------- 1 files changed, 81 insertions(+), 41 deletions(-) diff --git a/src/main/webapp/js/newmoralmap.js b/src/main/webapp/js/newmoralmap.js index c45648a..bcb1e24 100644 --- a/src/main/webapp/js/newmoralmap.js +++ b/src/main/webapp/js/newmoralmap.js @@ -218,6 +218,10 @@ var longitude = 106.638135; var latitude = 29.709625; point = new BMap.Point(longitude, latitude); + } else if ("���������" == regoinNames[2]) { + var longitude = 120.332826; + var latitude = 33.772274; + point = new BMap.Point(longitude, latitude); } map.centerAndZoom(point, showZoom); } else { @@ -395,7 +399,7 @@ var timer = setTimeout(function () { baiduMap.closeInfoWindow.apply(baiduMap, arguments); moralMap["_closeInfoWinTimer"] = null; - }, 1200); + }, 500); moralMap["_closeInfoWinTimer"] = timer; } moralMap.clearOverlays = function () { @@ -705,10 +709,10 @@ function _getWindIcon(speedLevel) { speedLevel = speedLevel == null ? 0 : speedLevel; - var icon = _option["icon"]; - var url = icon["url"] + speedLevel + ".png"; - return new BMap.Icon(url, new BMap.Size(icon["width"], icon["height"]), { - imageSize: new BMap.Size(icon["width"], icon["height"]) + 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"]) }); } @@ -743,13 +747,14 @@ } else if (windSpeed > 17.1) { speedLevel = 8; } - } - if (speedLevel == 0) { - moralMap.removeOverlay(this); - } else { - var iconObj = _getWindIcon(speedLevel); - this.setIcon(iconObj); - this.setRotation(windDir); + if (speedLevel == 0) { + moralMap.removeOverlay(this); + } else { + moralMap.addOverlay(this); + var iconObj = _getWindIcon(speedLevel); + this.setIcon(iconObj); + this.setRotation(windDir); + } } }, getOption: function () { @@ -845,7 +850,7 @@ var sensorsDescriptionMap; var sensorsUnitMap; $.ajax({ - url: "getSensorsMap", + url: "getSensorsAllMap", type: "get", dataType: "json", success: function (data) { @@ -863,11 +868,11 @@ } } } - var icon = {}; - icon["url"] = "/img/icoWind0"; - icon["width"] = 25; - icon["height"] = 25; - option["icon"] = icon; + 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; @@ -943,24 +948,14 @@ } 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 (mac == option['mac']) { - if (!jsonData.hasOwnProperty('mac')) { - infoWindow.setContent(""); - infoWindow.redraw(); - } else { + if (!jsonData.hasOwnProperty('mac')) { + infoWindow.setContent(""); + infoWindow.redraw(); + } else { + 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()); @@ -996,6 +991,7 @@ } } } + // } /* if (!$.isEmptyObject(sensorInfo)) { moralMap.openInfoWindow(infoWindow, this._point); //������������������ }*/ @@ -1003,14 +999,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(); }); @@ -1116,6 +1104,19 @@ // ������������������������������������ 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); } } } @@ -1232,6 +1233,45 @@ } } + + 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"]; -- Gitblit v1.8.0