| | |
| | | // 将地址解析结果显示在地图上,并调整地图视野 |
| | | // 创建地址解析器实例 |
| | | var myGeo = new BMap.Geocoder(); |
| | | address = address.replace(/\s*/g, ""); |
| | | myGeo.getPoint(address, function (point) { |
| | | if (point) { |
| | | 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); |
| | | } else { |
| | |
| | | //刷新key防止延迟加载 |
| | | // var key = moralMap.lazyKeyer(); |
| | | var confine = moralMap.getZoomConfine(); |
| | | if (endZoom > startZoom) { |
| | | //放大超过边界 |
| | | if (endZoom >= confine && startZoom <= confine) { |
| | | //清空控件 |
| | | moralMap.layer("equipments"); |
| | | moralMap.clearOverlays(); |
| | | } |
| | | } else { |
| | | //缩小超过边界 |
| | | if (endZoom != startZoom && startZoom >= confine && endZoom < confine) { |
| | | //清空控件 |
| | | moralMap.layer("monitorpoints"); |
| | | moralMap.clearOverlays(); |
| | | } |
| | | } |
| | | } |
| | | moralMap.layer = (function () { |
| | | var _layers = ["equipments", "monitorpoints"]; |
| | |
| | | var timer = setTimeout(function () { |
| | | baiduMap.closeInfoWindow.apply(baiduMap, arguments); |
| | | moralMap["_closeInfoWinTimer"] = null; |
| | | }, 1200); |
| | | }, 500); |
| | | moralMap["_closeInfoWinTimer"] = timer; |
| | | } |
| | | moralMap.clearOverlays = function () { |
| | |
| | | |
| | | return listView; |
| | | } |
| | | |
| | | moralMap.MoralMarker = function (option) { |
| | | var _option = option; |
| | | var _pointObj = new BMap.Point(_option['longitude'], _option['latitude']); |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | } |
| | | //设备以mac为key储存 |
| | | //监控点对象 包装MoralMark对象 |
| | | moralMap.Equipment = function (option) { |
| | | |
| | | var sensorsDescriptionMap; |
| | | var sensorsUnitMap; |
| | | $.ajax({ |
| | | url: "getSensorsMap?mac=" + option['mac'], |
| | | url: "getSensorsAllMap", |
| | | type: "get", |
| | | dataType: "json", |
| | | success: function (data) { |
| | |
| | | } |
| | | }); |
| | | |
| | | 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对象 |
| | | moralMap.Equipment = function (option) { |
| | | if (deviceStates) { |
| | | for (var i in deviceStates) { |
| | | var state = deviceStates[i]; |
| | |
| | | } |
| | | } |
| | | var icon = {}; |
| | | icon["stateIcons"] = ["/img/ico_coo00.png", "/img/ico_coo01.png", "/img/ico_coo02.png", "/img/ico_coo03.png", "/img/ico_coo04.png"]; |
| | | icon["url"] = "/img/ico_coo0"; |
| | | icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png"]; |
| | | icon["url"] = "/img/ico0"; |
| | | icon["width"] = 50; |
| | | icon["height"] = 60; |
| | | icon["height"] = 50; |
| | | option["icon"] = icon; |
| | | option["offline_width"] = 300; |
| | | option["offline_height"] = 80; |
| | | option["online_width"] = 355; |
| | | option["online_height"] = 385; |
| | | var moralMarker = new moralMap.MoralMarker(option); |
| | | // var mark =new BMap.Marker(pointObj,{icon:iconObj}); |
| | | //==================infoWindow-start============================ |
| | |
| | | return new BMap.InfoWindow("", winOpts); |
| | | })(); |
| | | |
| | | /*var infoWindow = (function() { |
| | | //生成信息框 |
| | | var winOpts = { |
| | | width: option["online_width"], // 信息窗口宽度 |
| | | height:option["online_height"], // 信息窗口高度 |
| | | title: getTitleOutHtml(), // 信息窗口标题 |
| | | offset: new BMap.Size(-2, -10) //设置信息窗偏移 |
| | | } |
| | | |
| | | function getTitleOutHtml() { |
| | | //title太长用引号... |
| | | var title = (option["name"] == null) ? "" : option["name"]; |
| | | if(title.length > 13) { |
| | | title = title.slice(0, 13) + "..."; |
| | | } |
| | | var titleOutHtml = ""; |
| | | titleOutHtml += "<p style='width:210px;font:bold 14px/16px arial,sans-serif;margin:0;color:#cc5522;white-space:nowrap;overflow:hidden'" |
| | | titleOutHtml += "title='" + option["name"] + "'>"; |
| | | titleOutHtml += title + "</p>"; |
| | | return titleOutHtml; |
| | | } |
| | | return new BMap.InfoWindow("", winOpts); |
| | | })(); |
| | | var dataHandle = { |
| | | _getDataOutHtml: function(data) { |
| | | if(data==null||data["state"]==4){ |
| | | return "<br/><h3>设备正在维护升级,暂时没有数据!</h3>"; |
| | | } |
| | | var mac = data['mac']; |
| | | var itme_mac_key = "item-" + mac + "-" + key; |
| | | var dataOutHtml = "<div id='"+itme_mac_key+"' class='equ-data-box'><ul class='equ-data-list'>"; |
| | | for(var key in data) { |
| | | if($.inArray(key,showSensorKeys)!=-1) { |
| | | var dataValue = data[key]; |
| | | var name = sensorNames[key][0]; |
| | | var unit = sensorNames[key][1]; |
| | | var itme_state = dataHandle._getSensorState(data, key); |
| | | // var itme_name_mac_key = "item-name-" + mac + "-" + key; |
| | | var itme_data_mac_key = "item-data-" + mac + "-" + key; |
| | | var item = "<li>"; |
| | | item += "<p>"+name+"</p>"; |
| | | item += "<span id='"+itme_data_mac_key+"' class='"+itme_state+"'>"+dataValue+"</span>"; |
| | | item += "<em>"+unit+"</em>"; |
| | | item += "</li>"; |
| | | dataOutHtml += item; |
| | | } |
| | | |
| | | } |
| | | dataOutHtml += "</ul></div>"; |
| | | return dataOutHtml; |
| | | }, |
| | | _getSensorState: function(data, key) { |
| | | var grade="grade"; |
| | | var levels; |
| | | if(data["level3"]!=null){ |
| | | levels = data["level3"] instanceof Array ? data["level3"]:JSON.parse(data["level3"]); |
| | | if($.inArray(key,levels)!=-1){ |
| | | return grade+"03"; |
| | | } |
| | | } |
| | | if(data["level2"] !=null){ |
| | | levels = data["level2"] instanceof Array ? data["level2"]:JSON.parse(data["level2"]); |
| | | if($.inArray(key,levels)!=-1){ |
| | | return grade+"02"; |
| | | } |
| | | } |
| | | if(data["level1"] !=null){ |
| | | levels = data["level1"] instanceof Array ? data["level1"]:JSON.parse(data["level1"]); |
| | | if($.inArray(key,levels)!=-1){ |
| | | return grade+"01"; |
| | | } |
| | | } |
| | | return grade+"00"; |
| | | } |
| | | };*/ |
| | | |
| | | if (moralMarker["infoWindow"] == undefined) { |
| | | moralMarker["infoWindow"] = infoWindow; |
| | | } |
| | | var mouseOverHandle = option['mouseover']; |
| | | //弹窗打开和关闭 |
| | | /*moralMarker.addEventListener("mouseover", function() { |
| | | if(mouseOverHandle!=null&&mouseOverHandle instanceof Function){ |
| | | //将arguments转换成数组 |
| | | var args = Array.prototype.slice.call(arguments); |
| | | mouseOverHandle.apply(this, args); |
| | | } |
| | | moralMap.closeSearchBox(); |
| | | baiduMap.openInfoWindow(infoWindow, this._point); //开启信息窗口 |
| | | if(infoWindow.getContent() == "") { |
| | | var data = this.getData(); |
| | | var option = this.getOption(); |
| | | if(data==null||data["state"]==4){ |
| | | infoWindow.setHeight(option["offline_height"]); |
| | | infoWindow.setWidth(option["offline_width"]); |
| | | }else{ |
| | | infoWindow.setHeight(option["online_height"]); |
| | | infoWindow.setWidth(option["online_width"]); |
| | | } |
| | | infoWindow.setContent(dataHandle._getDataOutHtml(data)); |
| | | infoWindow.redraw(); |
| | | } |
| | | }); |
| | | moralMarker.addEventListener("mouseout", function() { |
| | | baiduMap.closeInfoWindow(); |
| | | infoWindow.setContent(""); |
| | | moralMap.openSearchBox(); |
| | | });*/ |
| | | 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()">'; |
| | | 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(jsonData['time']); |
| | | var date = new Date($.now()); |
| | | y = 1900 + date.getYear(); |
| | | m = "0" + (date.getMonth() + 1); |
| | | d = "0" + date.getDate(); |
| | |
| | | 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); |
| | | } |
| | | moralMap.closeInfoWindow(); |
| | | }); |
| | | |
| | |
| | | var state = this.getOption()["state"]; |
| | | this.setData(data); //更新数据 |
| | | _super_refreshState.call(this, data["state"]); |
| | | //如果当前窗体时打开的,刷新窗体里的数据 |
| | | /*if(infoWindow.isOpen()) { |
| | | if(data["state"]==4){ |
| | | if(state!=4){ |
| | | infoWindow.setHeight(option["offline_height"]); |
| | | infoWindow.setWidth(option["offline_width"]); |
| | | infoWindow.setContent(dataHandle._getDataOutHtml(data)); |
| | | infoWindow.redraw(); |
| | | } |
| | | return; |
| | | } |
| | | var mac = data["mac"]; |
| | | var itme_mac_key = "#item-" + mac + "-" + key; |
| | | if($(itme_mac_key).length==0){ |
| | | infoWindow.setHeight(option["online_height"]); |
| | | infoWindow.setWidth(option["online_width"]); |
| | | infoWindow.setContent(dataHandle._getDataOutHtml(data)); |
| | | infoWindow.redraw(); |
| | | } |
| | | for(var key in data) { |
| | | if($.inArray(key,showSensorKeys)!=-1) { |
| | | var dataValue = data[key]; |
| | | var itme_state = dataHandle._getSensorState(data, key); |
| | | var itme_data_mac_key = "#item-data-" + mac + "-" + key; |
| | | if(!$(itme_data_mac_key).hasClass(itme_state)) { |
| | | $(itme_data_mac_key).attr("class", itme_state); |
| | | } |
| | | $(itme_data_mac_key).text(dataValue); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | }, |
| | | setData: function (data) { |
| | |
| | | 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']; |
| | |
| | | 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(); |
| | |
| | | |
| | | 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: "get", |
| | | 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"]; |
| | | var device = moralMap.getDevice(mac); |
| | | if (device) { |
| | | device.refreshWindDir(deviceInfo); |
| | | } |
| | | } |
| | | |
| | | window.moralMap = moralMap; |
| | | })(jQuery, BMap, window); |