[mapserver-commits] r9537 - branches/branch-5-4/docs/_static

svn at osgeo.org svn at osgeo.org
Tue Nov 10 07:28:56 EST 2009


Author: tbonfort
Date: 2009-11-10 07:28:54 -0500 (Tue, 10 Nov 2009)
New Revision: 9537

Modified:
   branches/branch-5-4/docs/_static/ol.js
Log:
change map theme


Modified: branches/branch-5-4/docs/_static/ol.js
===================================================================
--- branches/branch-5-4/docs/_static/ol.js	2009-11-09 20:24:25 UTC (rev 9536)
+++ branches/branch-5-4/docs/_static/ol.js	2009-11-10 12:28:54 UTC (rev 9537)
@@ -1,6 +1,6 @@
 var lon = 240750;
 var lat = 5070290;
-var zoom = 2;
+var zoom = 5;
 var map;
 
 
@@ -28,9 +28,33 @@
     return this.div;
 };
 
+function restrictExtent() {
+        var re;
+        //return;
+        if(map.zoom >= 9) {
+                re = new OpenLayers.Bounds(232128.90549511,5061987.4207997,251589.88109746,5081199.6882021);
+                map.restrictedExtent = re;
+            
+        } else if (map.zoom >= 7) {
+                re = new OpenLayers.Bounds(185699.84723398,4927656.4983161,366154.16113992,5191548.6526213);
+                map.restrictedExtent = re;
+        } else if (map.zoom >= 6) {
+                re = new OpenLayers.Bounds(-13249.073112705,4734973.415064,649796.40217677,5391405.8401392);
+                map.restrictedExtent = re;
+        } else if (map.zoom >= 5) {
+                re = new OpenLayers.Bounds(-350504.44654968,4397719.5711671,964297.62123439,5717725.108365);
+                map.restrictedExtent = re;
+        } else {
+                re = new OpenLayers.Bounds(-1096452.6548487,4297707.1251797,935546.2478719,6675428.0634347);
+                map.restrictedExtent = re;
+        }
+            if(!re.containsBounds(map.getExtent())) {
+                map.panTo(new OpenLayers.LonLat(lon,lat));
+            }
+        }
+
 function olmapinit(){
-  map = new OpenLayers.Map( 'olmap', {
-restrictedExtent: new OpenLayers.Bounds(235459.12591906,5064998.3775063,246042.4535374,5075581.7051247),
+    map = new OpenLayers.Map( 'olmap', {eventListeners: {"zoomend": restrictExtent},
 controls:[new OpenLayers.Control.Navigation(),
 new OpenLayers.Control.PanZoom()]
 });
@@ -38,10 +62,10 @@
         var wms = new OpenLayers.Layer.TileCache( "Barcelona", 
         ['http://mapserver-tile-1.osgeo.org/tilecache',
         'http://mapserver-tile-2.osgeo.org/tilecache'],
-        'barcelona',
+        'bcn',
         {
           maxExtent: new OpenLayers.Bounds(-20000000,-20000000,20000000,20000000),
-          scales: [5000,10000,25000,50000,100000,250000,500000,1000000,2500000],
+          scales: [5000,10000,25000,50000,100000,250000,500000,1000000,2500000,5000000,10000000,25000000],
           units: 'm',
           projection:new OpenLayers.Projection("EPSG:900913"),
           buffer:0,



More information about the mapserver-commits mailing list