| | |
| | | // 将地址解析结果显示在地图上,并调整地图视野 |
| | | // 创建地址解析器实例 |
| | | var myGeo = new BMap.Geocoder(); |
| | | address = address.replace(/\s*/g, ""); |
| | | myGeo.getPoint(address, function (point) { |
| | | if (point) { |
| | | if ("大同市" == cityName) { |
| | |
| | | } else if ("渝北区" == cityName) { |
| | | 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); |
| | |
| | | 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"]) |
| | | }); |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | moralMap.WindMarker = function (option, moralMap) { |
| | | var _option = option; |
| | | var _pointObj = new BMap.Point(_option['longitude'], _option['latitude']); |
| | | var _iconObj = _getWindIcon(1); |
| | | 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"]) |
| | | }); |
| | |
| | | offset: new BMap.Size(0, -11), |
| | | enableMassClear: true |
| | | }) |
| | | |
| | | |
| | | return $.extend(this, { |
| | | refreshWindDir: function (windDir, windSpeed) { |
| | | //状态发生变化的时候设置图标风向 |
| | |
| | | if (speedLevel == 0) { |
| | | moralMap.removeOverlay(this); |
| | | } else { |
| | | moralMap.addOverlay(this); |
| | | var iconObj = _getWindIcon(speedLevel); |
| | | this.setIcon(iconObj); |
| | | this.setRotation(windDir); |
| | |
| | | }, |
| | | setOption: function (option) { |
| | | _option = option; |
| | | } |
| | | }, |
| | | |
| | | }) |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | 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; |
| | |
| | | } |
| | | } |
| | | 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; |
| | |
| | | |
| | | 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) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | 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"]; |