From 94876df3b4763dda4d22b1adf52281168c8840c5 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Tue, 12 Jun 2018 17:26:06 +0800
Subject: [PATCH] 地图添加边界
---
src/main/webapp/js/moralmap.js | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index c2b46ce..975ed08 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -54,12 +54,21 @@
style: "normal" //������������������������������
}
map.setMapStyle(mapStyle);
- var showZoom = 13;
- if(arguments.length == 2) {
- map.centerAndZoom(new BMap.Point(arguments[0], arguments[1]), showZoom);
- } else if(arguments.length == 1) {
- map.centerAndZoom(arguments[0], showZoom);
- }
+ var showZoom = 12;
+ var address = arguments[0];
+ var regoinNames = address.split(" ");
+ var cityName = regoinNames.length>1?regoinNames[1]:regoinNames[0];
+ map.setCurrentCity(cityName);
+ // ���������������������������������������,���������������������
+ // ���������������������������
+ var myGeo = new BMap.Geocoder();
+ myGeo.getPoint(address, function(point){
+ if (point) {
+ map.centerAndZoom(point, showZoom);
+ }else{
+ alert("������������������������������������!");
+ }
+ }, cityName);
//������������������
map.enableScrollWheelZoom(true);
var navigation = new BMap.NavigationControl({
@@ -182,7 +191,6 @@
isOver = true;
moralMap.setMaxBounds(bs);
} else {
- debugger;
isOver = (bs.northeastLng > _bounds.northeastLng
|| bs.northeastLat > _bounds.northeastLat
|| bs.southwestLng < _bounds.southwestLng
--
Gitblit v1.8.0