From d3c5982218db1413c8f609f1f51b49c49a2db496 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Wed, 21 Oct 2020 17:19:58 +0800
Subject: [PATCH] 大屏多设备数据报表接口

---
 src/main/webapp/js/moralmap.js |  712 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 490 insertions(+), 222 deletions(-)

diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index 6737c74..50524d8 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -65,16 +65,176 @@
         var address = arguments[0];
         var regoinNames = address.split(" ");
         var cityName = regoinNames.length > 1 ? regoinNames[1] : regoinNames[0];
+        if (cityName == "���������" || cityName == "���" || cityName == "���������������������������") {
+            cityName = regoinNames[2];
+        }
         map.setCurrentCity(cityName);
         // ���������������������������������������,���������������������
         // ���������������������������
         var myGeo = new BMap.Geocoder();
+        address = address.replace(/\s*/g, "");
         myGeo.getPoint(address, function (point) {
             if (point) {
                 if ("���������" == cityName) {
                     var longitude = 113.30640743;
                     var latitude = 40.08256467;
-                    var point = new BMap.Point(longitude, latitude);
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������" == cityName) {
+                    var longitude = 105.733648;
+                    var latitude = 38.858951;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������" == cityName) {
+                    var longitude = 113.136019;
+                    var latitude = 41.001403;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 104.647678;
+                    var latitude = 28.758767;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������" == cityName) {
+                    var longitude = 92.056768;
+                    var latitude = 31.482684;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 105.930055;
+                    var latitude = 29.363305;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 105.727253;
+                    var latitude = 29.714369;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 106.061728;
+                    var latitude = 29.852264;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 106.654609;
+                    var latitude = 29.035883;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 106.889359;
+                    var latitude = 28.907664;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 107.735181;
+                    var latitude = 29.869663;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 107.336118;
+                    var latitude = 30.334042;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������" == cityName) {
+                    var longitude = 108.04224;
+                    var latitude = 30.30452;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 108.671036;
+                    var latitude = 31.953145;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 109.576402;
+                    var latitude = 31.40266;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 109.879221;
+                    var latitude = 31.087199;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 109.468749;
+                    var latitude = 31.024849;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������������������" == cityName) {
+                    var longitude = 108.118685;
+                    var latitude = 30.006859;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������������������������" == cityName) {
+                    var longitude = 108.17085;
+                    var latitude = 29.301729;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������������������������" == cityName) {
+                    var longitude = 108.774583;
+                    var latitude = 28.848811;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������������������������" == cityName) {
+                    var longitude = 109.011853;
+                    var latitude = 28.454209;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 108.656267;
+                    var latitude = 19.101378;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.397709;
+                    var latitude = 18.799833;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������" == cityName) {
+                    var longitude = 109.522965;
+                    var latitude = 18.782911;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.47882;
+                    var latitude = 19.265073;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.105702;
+                    var latitude = 19.358194;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.363233;
+                    var latitude = 19.686848;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.803934;
+                    var latitude = 19.549335;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 110.010636;
+                    var latitude = 19.745166;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 109.693419;
+                    var latitude = 19.920291;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������������" == cityName) {
+                    var longitude = 109.702907;
+                    var latitude = 18.647732;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������" == cityName) {
+                    var longitude = 110.045039;
+                    var latitude = 18.513155;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������������" == cityName) {
+                    var longitude = 109.842786;
+                    var latitude = 19.041625;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������" == cityName) {
+                    var longitude = 109.060164;
+                    var latitude = 19.304817;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������" == cityName) {
+                    var longitude = 109.453447;
+                    var latitude = 19.232744;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 109.588035;
+                    var latitude = 19.526327;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("������������������������������" == cityName) {
+                    var longitude = 103.380977;
+                    var latitude = 23.380877;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������������������������" == cityName) {
+                    var longitude = 100.800568;
+                    var latitude = 22.023519;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 100.972567;
+                    var latitude = 22.830712;
+                    point = new BMap.Point(longitude, latitude);
+                } else if ("���������" == cityName) {
+                    var longitude = 106.638135;
+                    var latitude = 29.709625;
+                    point = new BMap.Point(longitude, latitude);
                 }
                 map.centerAndZoom(point, showZoom);
             } else {
@@ -127,23 +287,10 @@
         var endZoom = baiduMap.getZoom();
         var startZoom = moralMap.startZoom();
         //������key������������������
-        //	   var key = moralMap.lazyKeyer();
+        //       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("equipments");
+        moralMap.clearOverlays();
     }
     moralMap.layer = (function () {
         var _layers = ["equipments", "monitorpoints"];
@@ -265,7 +412,7 @@
         var timer = setTimeout(function () {
             baiduMap.closeInfoWindow.apply(baiduMap, arguments);
             moralMap["_closeInfoWinTimer"] = null;
-        }, 1200);
+        }, 500);
         moralMap["_closeInfoWinTimer"] = timer;
     }
     moralMap.clearOverlays = function () {
@@ -415,7 +562,7 @@
                     break;
                 case 4:
                     state = 'state04';
-                    stateName = '������';
+                    stateName = '������';
                     break;
             }
             return {
@@ -514,6 +661,7 @@
 
         return listView;
     }
+
     moralMap.MoralMarker = function (option) {
         var _option = option;
         var _pointObj = new BMap.Point(_option['longitude'], _option['latitude']);
@@ -565,8 +713,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) {
@@ -584,7 +804,7 @@
         icon["height"] = 50;
         option["icon"] = icon;
         var moralMarker = new moralMap.MoralMarker(option);
-        //	    var mark =new BMap.Marker(pointObj,{icon:iconObj});
+        //        var mark =new BMap.Marker(pointObj,{icon:iconObj});
         //==================infoWindow-start============================
         var infoWindow;
         if (moralMarker["infoWindow"] == undefined) {
@@ -643,21 +863,57 @@
         }
 
     }
+
+    var sensorsDescriptionMap;
+    var sensorsUnitMap;
+    $.ajax({
+        url: "getSensorsAllMap",
+        type: "get",
+        dataType: "json",
+        success: function (data) {
+            sensorsDescriptionMap = data[0];
+            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������
     moralMap.Equipment = function (option) {
-        var sensorsDescriptionMap;
-        var sensorsUnitMap;
-        $.ajax({
-            url: "getSensorsMap?mac=" + option['mac'],
-            type: "get",
-            dataType: "json",
-            success: function (data) {
-                sensorsDescriptionMap = data[0];
-                sensorsUnitMap = data[1];
-            }
-        });
-
         if (deviceStates) {
             for (var i in deviceStates) {
                 var state = deviceStates[i];
@@ -667,17 +923,13 @@
             }
         }
         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});
+        //        var mark =new BMap.Marker(pointObj,{icon:iconObj});
         //==================infoWindow-start============================
         var infoWindow = (function () {
             //���������������
@@ -708,164 +960,55 @@
             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()">';
-                    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">' + "���������&nbsp;" + date + "&nbsp;</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">' + "���������&nbsp;" + date + "&nbsp;</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); //������������������
                }*/
@@ -873,14 +1016,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();
         });
 
@@ -895,37 +1030,6 @@
                     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) {
@@ -960,6 +1064,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'];
@@ -993,12 +1122,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();
@@ -1052,7 +1222,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: "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) {
@@ -1080,5 +1300,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);
+})(jQuery, BMap, window);
\ No newline at end of file

--
Gitblit v1.8.0