From b548f17e642210ac5301db8493b5b5fe28dfab65 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Mon, 13 Aug 2018 14:43:56 +0800
Subject: [PATCH] 地图更新

---
 src/main/webapp/view/map.jsp |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/view/map.jsp b/src/main/webapp/view/map.jsp
index 60b70ab..022fe90 100644
--- a/src/main/webapp/view/map.jsp
+++ b/src/main/webapp/view/map.jsp
@@ -437,10 +437,55 @@
 	        paramMap["Le"]=  bounds.southwestLng;//���������������������������������
             loadLazy("getMonitorpointList",paramMap,addOverMpoints);
             startRefreshPage();
+            showGrid();
 	});
 	//��������������������� ���������������,���������
 	moralMap.addEventListener("tilesloaded", function(type, target) {
+        showGrid();
 	});
+
+    //map���������������
+    // TODO ������
+    function bs() {
+        var bs = moralMap.getBounds();  //������������������������������������
+        // var bssw = bs.getSouthWest();		//���������������������������(������������)
+        // var bsne = bs.getNorthEast();		//���������������������������(������������)
+        return { 'x1': bs.southwestLng, 'y1': bs.southwestLat, 'x2': bs.northeastLng, 'y2': bs.northeastLat };
+    }
+    /**
+     * ������������
+     */
+    // TODO ������
+    function showGrid(){
+        var isShowGrid = getUrlParam("isShowGrid");
+        if(!isShowGrid||moralMap.getZoom()<15){
+           return;
+		}
+        var XY = bs();
+        var polygons = [];
+        console.log(XY);
+        for (var i = XY.x1; i < XY.x2; i = i + 0.0063) {
+            for (var j = XY.y2; j > XY.y1; j = j - 0.0048) {
+                //���������������������������������������������������:������������������Point���������������������������,���������������������������,���������������������������,���������������������������������������������������������������������������������������������������������������,������������������������������������������������������������������
+                var polygon = new BMap.Polygon([
+                    new BMap.Point(i, j),    //������������������
+                    new BMap.Point(i, j-0.0048),  //������������������
+                    new BMap.Point(i+0.0063, j-0.0048),	 //������������������
+                    new BMap.Point(i+0.0063, j)			//������������������
+                ], {strokeColor:"blue", strokeWeight:2, strokeOpacity:1, 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 +495,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 +504,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