| | |
| | | |
| | | 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"]) |
| | | }); |
| | | } |
| | | |
| | |
| | | } 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 () { |
| | |
| | | var sensorsDescriptionMap; |
| | | var sensorsUnitMap; |
| | | $.ajax({ |
| | | url: "getSensorsMap", |
| | | url: "getSensorsAllMap", |
| | | type: "get", |
| | | dataType: "json", |
| | | success: function (data) { |
| | |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | |
| | | } |
| | | 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); |
| | | }*/ |
| | | 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 { |
| | | 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]; |
| | | } |
| | | /* var deviceSensors = jsonData; |
| | | var mac = deviceSensors["mac"]; |
| | | if (mac == option['mac']) {*/ |
| | | if (!jsonData.hasOwnProperty('mac')) { |
| | | infoWindow.setContent(""); |
| | | infoWindow.redraw(); |
| | | } else { |
| | | 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>"); |
| | | } |
| | | 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 += "</div>"; |
| | | infoWindow.setContent(adressOutHtml); |
| | | infoWindow.redraw(); |
| | | } |
| | | adressOutHtml += "</div>"; |
| | | infoWindow.setContent(adressOutHtml); |
| | | infoWindow.redraw(); |
| | | } |
| | | } |
| | | // } |
| | | /* if (!$.isEmptyObject(sensorInfo)) { |
| | | moralMap.openInfoWindow(infoWindow, this._point); //开启信息窗口 |
| | | }*/ |
| | |
| | | }); |
| | | |
| | | 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); |
| | | }*/ |
| | | 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(); |
| | | }); |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |