[fusion-commits] r2176 - sandbox/jxlib-3.0/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon May 31 15:56:11 EDT 2010


Author: madair
Date: 2010-05-31 15:56:10 -0400 (Mon, 31 May 2010)
New Revision: 2176

Modified:
   sandbox/jxlib-3.0/widgets/MapMenu.js
Log:
adding an option to MapMenu.js to allow a map to load at it's max extent (ignoring the current extent)

Modified: sandbox/jxlib-3.0/widgets/MapMenu.js
===================================================================
--- sandbox/jxlib-3.0/widgets/MapMenu.js	2010-05-31 18:06:45 UTC (rev 2175)
+++ sandbox/jxlib-3.0/widgets/MapMenu.js	2010-05-31 19:56:10 UTC (rev 2176)
@@ -45,6 +45,9 @@
         
         var json = this.widgetTag.extension;
         
+        this.loadMaxExtent = json.LoadMaxExtent ? 
+                      (json.LoadMaxExtent[0].toLowerCase() == 'true') : false;
+        
         //If no folder is specified for enumeration, build a menu
         //from the mapgroup alone. Folders are only supported with MapGuide.
         //Otherwise, create a hash of mapgroup resourceId to mapGroup data
@@ -222,18 +225,20 @@
     switchMap: function(data) {
         var ce = this.getMap().getCurrentExtents();
         var dest = null;
-        for (var i=0; i<data.maps.length; ++i) {
-          if (data.maps[i].layerOptions && data.maps[i].layerOptions.projection) {
-            dest = new OpenLayers.Projection(data.maps[i].layerOptions.projection);
-            if (data.maps[i].layerOptions.isBaseLayer) {
-              break;
+        if (!this.loadMaxExtent) {
+          for (var i=0; i<data.maps.length; ++i) {
+            if (data.maps[i].layerOptions && data.maps[i].layerOptions.projection) {
+              dest = new OpenLayers.Projection(data.maps[i].layerOptions.projection);
+              if (data.maps[i].layerOptions.isBaseLayer) {
+                break;
+              }
             }
           }
+          if (!dest) {
+            dest = new OpenLayers.Projection("EPSG:4326");
+          }
+          ce = ce.transform(this.oMap.oMapOL.getProjectionObject(), dest);
         }
-        if (!dest) {
-          dest = new OpenLayers.Projection("EPSG:4326");
-        }
-        ce = ce.transform(this.oMap.oMapOL.getProjectionObject(), dest);
         data.initialView = {minX:ce.left,
                             minY:ce.bottom,
                             maxX:ce.right,



More information about the fusion-commits mailing list