xufenglei
2019-03-25 1830f5429730a40f7d2f17ca748a80a4b1046c21
src/main/webapp/js/moralmap.js
@@ -550,7 +550,6 @@
   //new BMap.Marker()这种写法IE7会报错,很奇葩
   moralMap.MoralMarker.prototype = new BMap.Marker();
   //监控点对象 包装Mark对象
   var showMonitorpointInfoWindow = null;
   moralMap.Monitorpoint = function(option) {
      var icon = {};
      icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png"];
@@ -600,9 +599,6 @@
         }
         return new BMap.InfoWindow(getAdressOutHtml(), winOpts);
      })();
      if (!showMonitorpointInfoWindow) {
         showMonitorpointInfoWindow = infoWindow;
      }
      if(moralMarker["infoWindow"] == undefined) {
         moralMarker["infoWindow"] = infoWindow;
      }
@@ -642,7 +638,6 @@
   }
   //设备以mac为key储存
   //监控点对象 包装MoralMark对象
   var showEquipmentInfoWindow = null;
   moralMap.Equipment = function(option) {
      var icon = {};
      icon["stateIcons"] = ["/img/ico_coo00.png", "/img/ico_coo01.png", "/img/ico_coo02.png", "/img/ico_coo03.png", "/img/ico_coo04.png"];
@@ -697,10 +692,7 @@
         }
         return new BMap.InfoWindow(getAdressOutHtml(), winOpts);
      })();
      if (!showEquipmentInfoWindow) {
         showEquipmentInfoWindow = infoWindow;
      }
      /*var infoWindow = (function() {
         //生成信息框
         var winOpts = {
@@ -782,7 +774,7 @@
      }
        var  mouseOverHandle = option['mouseover'];
      //弹窗打开和关闭
      moralMarker.addEventListener("mouseover", function() {
      /*moralMarker.addEventListener("mouseover", function() {
         if(mouseOverHandle!=null&&mouseOverHandle instanceof  Function){
                //将arguments转换成数组
                var args = Array.prototype.slice.call(arguments);
@@ -790,7 +782,7 @@
         }
         moralMap.closeSearchBox();
         baiduMap.openInfoWindow(infoWindow, this._point); //开启信息窗口
         /*if(infoWindow.getContent() == "") {
         if(infoWindow.getContent() == "") {
            var data = this.getData();
            var option = this.getOption();
            if(data==null||data["state"]==4){
@@ -802,13 +794,21 @@
            }
            infoWindow.setContent(dataHandle._getDataOutHtml(data));
            infoWindow.redraw();
         }*/
         }
      });
      moralMarker.addEventListener("mouseout", function() {
         baiduMap.closeInfoWindow();
         infoWindow.setContent("");
         moralMap.openSearchBox();
      });*/
      moralMarker.addEventListener("mouseover", function() {
         moralMap.openInfoWindow(infoWindow, this._point); //开启信息窗口
      });
      moralMarker.addEventListener("mouseout", function() {
            moralMap.closeInfoWindow();
      });
      //==================infoWindow-end============================
      //储存监控点
      moralMap.putEquipment(option['mac'], moralMarker);
@@ -956,39 +956,23 @@
   }
    moralMap.callJS = function(condition) {
      var condition = JSON.parse(condition);
      var new_point = new BMap.Point(condition.longitude, condition.latitude);
      baiduMap.panTo(new_point);
      baiduMap.setCenter(new_point);
      if (condition.type == "mpoint") {
         baiduMap.setZoom(17);
         new moralMap.Monitorpoint(condition);
         moralMap.openInfoWindow(showMonitorpointInfoWindow, new_point);
         showMonitorpointInfoWindow = null;
      } else if (condition.type == "device") {
         var parma={};
          parma["layer"] = "equipments";
          parma["markerKeys"] = [condition.mac];
           parma["areaCode"] = moralMap['params']["areaCode"];
           parma["orgId"] = moralMap['params']["orgId"];
         baiduMap.setZoom(18);
         //condition.data = {};
         new moralMap.Equipment(condition);
         moralMap.openInfoWindow(showEquipmentInfoWindow, new_point);
         showEquipmentInfoWindow = null;
         /*$.ajax({
                type: "post",
                url: "get-real-state-data",
                data:JSON.stringify(parma),
                dataType:"json",
                contentType:"application/json;charset=utf-8",
                cache: false,
                async: true,
                success: function(data) {
                }
            });*/
      }
       var new_point = new BMap.Point(condition.longitude, condition.latitude);
       baiduMap.panTo(new_point);
       baiduMap.setCenter(new_point);
      baiduMap.setZoom(condition.type == "mpoint" ? 17 : 18);
       var interval = setInterval(function(){
          var marker;
          if (condition.type == "mpoint") {
             marker = moralMap.getMpoint(condition.id);
          } else if (condition.type == "device") {
             marker = moralMap.getEquipment(condition.mac);
          }
         if(marker){
            clearInterval(interval);
            moralMap.openInfoWindow(marker["infoWindow"], new_point);
         }
      }, 50);
   }