From 2d0b1b3da347f201cfe608e426fb2b7fdb9629a7 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 17 Aug 2018 17:13:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/webapp/view/map.jsp |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/src/main/webapp/view/map.jsp b/src/main/webapp/view/map.jsp
index 60b70ab..6ccc96b 100644
--- a/src/main/webapp/view/map.jsp
+++ b/src/main/webapp/view/map.jsp
@@ -305,8 +305,9 @@
     if(!!mapType && !!eval(mapType)) {
         mapOption["mapType"] = eval(mapType);
     }
+    var showZoom = getUrlParam("showZoom");
 	//������������������������������
-	moralMap.mapInit(params["regionName"],mapOption);
+	moralMap.mapInit(params["regionName"],mapOption,showZoom);
 	//������������
      var listView  =moralMap.initListView({id: "#equ_list",pageSize:12});
      window["listView"] = listView;
@@ -390,11 +391,10 @@
 										longitude: _obj['longitude'],
 										latitude: _obj['latitude'],
                                         monitorPointId: _obj['monitorPointId'],
-									    version:_obj['deviceVersion']['version']
+									    version:_obj['deviceVersion']['vers\t\t\t\t\t\t\t\t\t\tconsole.log(equStr);\nion']
 									}
 									var equStr = JSON.stringify(equ);
 									if(window["console"]!=undefined){
-										console.log(equStr);
 									}
                         			if(!!window['external']&&!!window['external']['callWin']){
                                         window['external'].callWin(equStr);
@@ -437,10 +437,75 @@
 	        paramMap["Le"]=  bounds.southwestLng;//���������������������������������
             loadLazy("getMonitorpointList",paramMap,addOverMpoints);
             startRefreshPage();
+            showGrid();
 	});
 	//��������������������� ���������������,���������
 	moralMap.addEventListener("tilesloaded", function(type, target) {
+        showGrid();
 	});
+
+    //map���������������
+    // TODO ������
+    function getBounds() {
+        var bs = moralMap.getBounds();  //������������������������������������
+        // var bssw = bs.getSouthWest();		//���������������������������(������������)
+        // var bsne = bs.getNorthEast();		//���������������������������(������������)
+		if(!getBounds.topLeftAnchor){
+            getBounds.topLeftAnchor = {};
+            getBounds.topLeftAnchor.x0 =  bs.southwestLng;
+            getBounds.topLeftAnchor.y0 =  bs.northeastLat;
+		}
+        return { 'x1': bs.southwestLng, 'y1': bs.southwestLat, 'x2': bs.northeastLng, 'y2': bs.northeastLat };
+    }
+    /**
+     * ������������
+     */
+    // TODO ������
+    function showGrid(){
+        var isShowGrid = getUrlParam("isShowGrid");
+        if(!!isShowGrid){
+            $(".tools_box").hide();
+		}
+        // if(!isShowGrid||moralMap.getZoom()<14){
+        if(!isShowGrid||moralMap.getZoom()<14){
+           return;
+		}
+        var XY = getBounds();
+        var polygons = [];
+        console.log(XY);
+        var X1 = XY.x1;
+        var Y2 = XY.y2;
+        var X0 = getBounds.topLeftAnchor.x0;
+        var Y0 = getBounds.topLeftAnchor.y0;
+        var width = 0.0063;
+        var height = 0.0048;
+        // var multiple = 1000000;
+        if(!!getBounds.topLeftAnchor) {
+            X1=X0 + Math.ceil((X1-X0)/width-1)*width;
+            Y2=Y0 + Math.ceil((Y2-Y0)/height)*height;
+		}
+        for (var i = X1; i < XY.x2; i = i + width) {
+            for (var j = Y2; j > XY.y1; j = j - height) {
+                //���������������������������������������������������:������������������Point���������������������������,���������������������������,���������������������������,���������������������������������������������������������������������������������������������������������������,������������������������������������������������������������������
+                var polygon = new BMap.Polygon([
+                    new BMap.Point(i, j),    //������������������
+                    new BMap.Point(i, j-height),  //������������������
+                    new BMap.Point(i+width, j-height),	 //������������������
+                    new BMap.Point(i+width, j)			//������������������
+                ], {strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5, fillOpacity:0.1});
+                // polygon .addEventListener("click",function clickFunction(){
+                //     alert("������������������");
+                // });
+                // moralMap.addOverlay(polygon);
+                polygons.push(polygon);
+            }
+        }
+        moralMap.addOverlays(polygons);
+        if(!!showGrid.polygons){
+            moralMap.removeOverlays(showGrid.polygons);
+		}
+        showGrid.polygons = polygons;
+    }
 	// ������������������ ������������
     moralMap.addEventListener("click", function(type, target) {
         moralMap.closePopupbox("#popup_box");
@@ -450,7 +515,7 @@
 	//������������������������������������������
 	moralMap.addEventListener('zoomend', function(type) {
 	     var endZoom = this.getZoom();
-	     if(endZoom>=moralMap.getZooMConfine()){//������������������������
+	     if(endZoom>=moralMap.getZoomConfine()){//������������������������
 	     		loadOverlays("get-devices",addOverEquipments);
 	     }else{
 				loadOverlays("get-monitorpoints",addOverMpoints);
@@ -459,7 +524,7 @@
 	});
 	moralMap.addEventListener('moveend', function(type) {
 	     var endZoom = this.getZoom();
-	     if(endZoom>=moralMap.getZooMConfine()){//������������������������
+	     if(endZoom>=moralMap.getZoomConfine()){//������������������������
 	     		loadOverlays("get-devices",addOverEquipments);
 	     }else{
 				loadOverlays("get-monitorpoints",addOverMpoints);

--
Gitblit v1.8.0