[fusion-commits] r2138 - sandbox/adsk/2.2gp/lib sandbox/adsk/2.2gp/widgets/BufferPanel sandbox/adsk/2.2gp/widgets/Search sandbox/adsk/2.2gp/widgets/Theme trunk/lib trunk/widgets/BufferPanel trunk/widgets/Search trunk/widgets/Theme

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Apr 8 14:02:53 EDT 2010


Author: chrisclaydon
Date: 2010-04-08 14:02:52 -0400 (Thu, 08 Apr 2010)
New Revision: 2138

Modified:
   sandbox/adsk/2.2gp/lib/Map.js
   sandbox/adsk/2.2gp/widgets/BufferPanel/Buffer.php
   sandbox/adsk/2.2gp/widgets/BufferPanel/BufferReport.templ
   sandbox/adsk/2.2gp/widgets/BufferPanel/ErrorPage.templ
   sandbox/adsk/2.2gp/widgets/Search/ErrorPage.templ
   sandbox/adsk/2.2gp/widgets/Search/Search.php
   sandbox/adsk/2.2gp/widgets/Theme/thememain.php
   trunk/lib/Map.js
   trunk/widgets/BufferPanel/Buffer.php
   trunk/widgets/BufferPanel/BufferReport.templ
   trunk/widgets/BufferPanel/ErrorPage.templ
   trunk/widgets/Search/ErrorPage.templ
   trunk/widgets/Search/Search.php
   trunk/widgets/Theme/thememain.php
Log:
Fixes #384 - Buffer / Theme cause the map to zoom to its initial extents when commercial base map layers are present in the map.

Modified: sandbox/adsk/2.2gp/lib/Map.js
===================================================================
--- sandbox/adsk/2.2gp/lib/Map.js	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/lib/Map.js	2010-04-08 18:02:52 UTC (rev 2138)
@@ -215,7 +215,7 @@
             this.aMaps[i].oLayerOL.destroy();
           }
         }
- 
+
         this._fMetersperunit = -1;
         this.oMapOL.center = null;
         this.maxExtent = new OpenLayers.Bounds();
@@ -281,7 +281,7 @@
             this.cumulativeDelta = 0;
         }
         this.cumulativeDelta += (deltaZ < 0)?-1:1;
-        
+
         this.wheelTimer = setTimeout(OpenLayers.Function.bind(function(){this.doWheelChange(evt, deltaZ);}, this), 200);
     },
 
@@ -408,6 +408,18 @@
       }
     },
 
+    //this method allows a specified map to be reloaded, rather than reloading all of them
+    reloadNamedMap: function(mapName) {
+        if(mapName != null && mapName != "") {
+            for (var i=0; i<this.aMaps.length; ++i) {
+                var map = this.aMaps[i];
+                if(map.getMapName() == mapName) {
+                    window.setTimeout(OpenLayers.Function.bind(map.reloadMap, map),1);
+                }
+            }
+        }
+    },
+
     loadScaleRanges: function(userFunc) {
       for (var i=0; i<this.aMaps.length; ++i) {
         var map = this.aMaps[i];
@@ -503,8 +515,8 @@
          this.oSelection = {};
          this.nSelectionMaps = 0;
          for (var i=0; i<this.aMaps.length; i++ ) {
-		     if(this.aMaps[i].layerType == "Google" || this.aMaps[i].layerType == "Yahoo" ||this.aMaps[i].layerType == "VirtualEarth" )
-			     continue;
+             if(this.aMaps[i].layerType == "Google" || this.aMaps[i].layerType == "Yahoo" ||this.aMaps[i].layerType == "VirtualEarth" )
+                 continue;
              this.nSelectionMaps++;
              this.aMaps[i].getSelection(
                     OpenLayers.Function.bind(this.accumulateSelection, this, this.aMaps[i]),
@@ -619,11 +631,11 @@
 
     redraw: function() {
       for (var i=0; i<this.aMaps.length; i++ ) {
-	    if(this.aMaps[i].oLayerOL.params){
+        if(this.aMaps[i].oLayerOL.params){
             this.aMaps[i].oLayerOL.params.ts = (new Date()).getTime();
             //mergeNewParams calls redraw on the layer, which will get called below anyway
             //this.aMaps[i].oLayerOL.mergeNewParams({ts : (new Date()).getTime()});
-		}
+        }
       }
       this.oMapOL.setCenter(this.oMapOL.getCenter(), this.oMapOL.getZoom(), false, true);
     },
@@ -1066,12 +1078,12 @@
         }
         return OpenLayers.Util.getParameterString(queryParams);
      },
-     
+
      getMapTip: function(oMapTips) {
         //TODO send this to the correct aMap object
         this.aMaps[0].getMapTip(oMapTips);
      },
-     
+
      supressContextMenu: function( bSupress ) {
          this.bSupressContextMenu = bSupress;
      },

Modified: sandbox/adsk/2.2gp/widgets/BufferPanel/Buffer.php
===================================================================
--- sandbox/adsk/2.2gp/widgets/BufferPanel/Buffer.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/BufferPanel/Buffer.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -361,7 +361,7 @@
 
 function OnError($title, $msg)
 {
-    global $target, $popup;
+    global $target, $popup, $mapName;
     $templ = Localize(file_get_contents("./ErrorPage.templ"), $locale, GetClientOS());
     print sprintf($templ, $popup, $mapName, $title, $msg);
 }

Modified: sandbox/adsk/2.2gp/widgets/BufferPanel/BufferReport.templ
===================================================================
--- sandbox/adsk/2.2gp/widgets/BufferPanel/BufferReport.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/BufferPanel/BufferReport.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -24,13 +24,13 @@
 <script language=javascript>
 
 var popup = %s;
-var errors = false; //this page is only returned for success; 
+var errors = false; //this page is only returned for success;
 var mapName = '%s';
 
 function InitDocument()
 {
     var map = GetParent().Fusion.getMapByName(mapName);
-    map.reloadMap();
+    map.reloadNamedMap(mapName);
     if (!errors) {
       Back();
     }
@@ -42,7 +42,7 @@
         history.back();
     } else {
         var TaskPaneId=this.frameElement.taskPaneId;
-        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();  
+        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();
     }
 }
 

Modified: sandbox/adsk/2.2gp/widgets/BufferPanel/ErrorPage.templ
===================================================================
--- sandbox/adsk/2.2gp/widgets/BufferPanel/ErrorPage.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/BufferPanel/ErrorPage.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -31,8 +31,12 @@
 
 function InitDocument()
 {
-    var map = GetParent().Fusion.getMapByName('%s');
-    map.aMaps[0].reloadMap();
+    var mapName = '%s';
+    var map = GetParent().Fusion.getMapByName(mapName);
+    if(map != null)
+    {
+        map.reloadNamedMap(mapName);
+    }
 }
 
 function Back()

Modified: sandbox/adsk/2.2gp/widgets/Search/ErrorPage.templ
===================================================================
--- sandbox/adsk/2.2gp/widgets/Search/ErrorPage.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/Search/ErrorPage.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -31,8 +31,12 @@
 
 function InitDocument()
 {
+    var mapName = '%s';
     var map = GetParent().Fusion.getMapByName(mapName);
-    map.reloadMap();
+    if(map != null)
+    {
+        map.reloadNamedMap(mapName);
+    }
 }
 
 function Back()
@@ -41,7 +45,7 @@
         history.back();
     } else {
         var TaskPaneId=this.frameElement.taskPaneId;
-        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();  
+        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();
     }
 }
 

Modified: sandbox/adsk/2.2gp/widgets/Search/Search.php
===================================================================
--- sandbox/adsk/2.2gp/widgets/Search/Search.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/Search/Search.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -274,9 +274,9 @@
 
 function OnError($title, $msg)
 {
-    global $target, $popup;
+    global $target, $popup, $mapName;
     $templ = file_get_contents("./ErrorPage.templ");
-    print sprintf($templ, $popup, $title, $msg);
+    print sprintf($templ, $popup, $mapName, $title, $msg);
 }
 
 function GetParameters($params)

Modified: sandbox/adsk/2.2gp/widgets/Theme/thememain.php
===================================================================
--- sandbox/adsk/2.2gp/widgets/Theme/thememain.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ sandbox/adsk/2.2gp/widgets/Theme/thememain.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -359,7 +359,7 @@
                 themeReqHandler = null;
 
                 var map = parent.Fusion.getMapByName(mapName);
-                map.reloadMap();
+                map.reloadNamedMap(mapName);
 
             }
         }

Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/lib/Map.js	2010-04-08 18:02:52 UTC (rev 2138)
@@ -53,57 +53,57 @@
 Fusion.Constant.LAYER_DWF_TYPE = 5;
 
 Fusion.Widget.Map = OpenLayers.Class(Fusion.Lib.EventMgr, {
-    
+
     /** The DOM object that holds the map */
     _oDomObj: null,
-    
+
     /** The id of DOM object */
     _sDomObj: '',
-    
+
     /** The internal name used for the map, usually assigned by the server */
     _sMapname: '',
-    
+
     /** conversion factor to convert from map units to meters */
     _fMetersperunit: -1,
-    
+
     /** scale denominator value */
     _fScale: -1,
-    
+
     /** Dots per inch setting for the server */
     _nDpi: 96,
-    
+
     /** The current bounds of the map, this is updated on every map draw */
     _oCurrentExtents: null,
-    
+
     /** The maximum extent of the map */
     maxExtent: new OpenLayers.Bounds(),
-    
+
     /** counter of worker threads for the ActivityIndicator widget  */
     _nWorkers: 0,
-    
+
     /** The context menu object for right click */
     oContextMenu: null,
-    
+
     /** flag to disable the map context menu, set this in the Map extension  */
     bSupressContextMenu: false,
-    
+
     /** an array to hold all the individual map layer objects */
     aMaps: null,
-    
+
     /** flag to indicate if all the map layers are loaded */
     mapsLoaded: false,
-    
+
     /** the root of the layer structure for the Legend */
     layerRoot: null,
-    
+
     /** flag to indicate if the map is tiled or not, set in the Map extension */
     singleTile: true,
-    
+
     /** flag to indicate if fractional zoom is supported, ie. allow any scale
     *   value rather than a fixed set of scales
     */
     fractionalZoom: true,
-    
+
     /** The DOM object that holds the map */
     maxScale: null, //set this to a large number in AppDef to zoom out beyond maxExtent, e.g. 1 billion
 
@@ -279,7 +279,7 @@
             this.aMaps[i].oLayerOL.destroy();
           }
         }
- 
+
         this._fMetersperunit = -1;
         this.oMapOL.center = null;
         this.maxExtent = new OpenLayers.Bounds();
@@ -305,7 +305,7 @@
     /**
      * Function: layerLoaded
      *
-     * Called after each layer is loaded in the OL viewport.  Nothing happens 
+     * Called after each layer is loaded in the OL viewport.  Nothing happens
      * here until the last layer is laoded, then it sets the OL baselayer and
      * zooms to the initial extent.
      *
@@ -348,7 +348,7 @@
      *
      * handles mouse wheel events by accummulating the events and setting a timer
      * to do the actual zoom in/out
-     * 
+     *
      * Parameters:
      * evt - {Event} the mouse wheel event object
      * deltaZ - {Integer} the number of ticks wheeled
@@ -360,7 +360,7 @@
             this.cumulativeDelta = 0;
         }
         this.cumulativeDelta += (deltaZ < 0)?-1:1;
-        
+
         this.wheelTimer = setTimeout(OpenLayers.Function.bind(function(){this.doWheelChange(evt, deltaZ);}, this), 200);
     },
 
@@ -540,7 +540,7 @@
                   projection: this.projection
           });
         }
-        
+
         map.registerForEvent(Fusion.Event.MAP_SELECTION_OFF,
                 OpenLayers.Function.bind(this.selectionHandler, this));
         map.registerForEvent(Fusion.Event.MAP_SELECTION_ON,
@@ -577,6 +577,18 @@
       }
     },
 
+    //this method allows a specified map to be reloaded, rather than reloading all of them
+    reloadNamedMap: function(mapName) {
+        if(mapName != null && mapName != "") {
+            for (var i=0; i<this.aMaps.length; ++i) {
+                var map = this.aMaps[i];
+                if(map.getMapName() == mapName) {
+                    window.setTimeout(OpenLayers.Function.bind(map.reloadMap, map),1);
+                }
+            }
+        }
+    },
+
     /**
      * Function: loadScaleRanges
      *
@@ -676,8 +688,8 @@
          this.oSelection = {};
          this.nSelectionMaps = 0;
          for (var i=0; i<this.aMaps.length; i++ ) {
-		     if(this.aMaps[i].layerType == "Google" || this.aMaps[i].layerType == "Yahoo" ||this.aMaps[i].layerType == "VirtualEarth" )
-			     continue;
+             if(this.aMaps[i].layerType == "Google" || this.aMaps[i].layerType == "Yahoo" ||this.aMaps[i].layerType == "VirtualEarth" )
+                 continue;
              this.nSelectionMaps++;
              this.aMaps[i].getSelection(
                     OpenLayers.Function.bind(this.accumulateSelection, this, this.aMaps[i]),
@@ -690,8 +702,8 @@
       *
       * sets a Selection XML back to the server for each of the maps
       *
-      * Parameters: 
-      * {String} selText - the selection string 
+      * Parameters:
+      * {String} selText - the selection string
       * {Boolean} zoomTo - if set, will zoom to the selection on completion
       */
       setSelection: function(selText, zoomTo) {
@@ -752,7 +764,7 @@
 
     /**
      * Function: _addWorker
-     * 
+     *
      * indicate that a new asynchronous process has started and make sure the
      * visual indicator is visible for the user.  This is intended to be used
      * internally by gMap but could be used by external tools if appropriate.
@@ -765,7 +777,7 @@
 
     /**
      * Function: _removeWorker
-     * 
+     *
      * indicate that an asynchronous process has completed and hide the
      * visual indicator if no remaining processes are active.  This is
      * intended to be used internally by gMap but could be used by
@@ -784,7 +796,7 @@
      * Function: mapExtentsChanged
      *
      * OpenLayers event handler for whenever the map changes either zoom level
-     * of the center has changed.  This in turn triggers the Fusion event. 
+     * of the center has changed.  This in turn triggers the Fusion event.
      *
      * Parameters: none
      *
@@ -811,7 +823,7 @@
     /**
      * Function: sizeChanged
      *
-     * callback for when the browser window size changes, simply calls resize 
+     * callback for when the browser window size changes, simply calls resize
      * on the map viewport layout object
      *
      * Parameters: none
@@ -884,7 +896,7 @@
      * handle selection events from maps and republish for
      * widgets as appropriate
      *
-     * Parameters: {Object} oExtents - an OpenLayers.Bounds object or an array 
+     * Parameters: {Object} oExtents - an OpenLayers.Bounds object or an array
      *                            of 4 values that will be converted to Bounds
      *
      * Return: none
@@ -910,7 +922,7 @@
 
     /**
      * Function: setInitialExtents
-     * 
+     *
      * determine the initialExtents of the map from (in order of precedence):
      * 1. a URL query parameter called 'extent'
      * 2. an <InitialView> specified in the MapGroup in AppDef
@@ -949,7 +961,7 @@
      *
      * gets the intitial extents from all maps with or without including the
      * extent of any Generic/commercial layers
-     * 
+     *
      * Return: {Object} an OpenLayers.Bounds object which is the initial extent
      */
     getMapGroupExtent: function(includeGenericLayers) {
@@ -965,7 +977,7 @@
 
     /**
      * Function: fullExtents
-     * 
+     *
      * sets the extent of the map to the max as returned by loadMap
      */
     fullExtents: function() {
@@ -975,8 +987,8 @@
 
     /**
      * Function: isMapLoaded
-     * 
-     * returns if the map has finished loading (based on setting the 
+     *
+     * returns if the map has finished loading (based on setting the
      * _oCurrentExtent value)
      *
      * Returns {Boolean} true if the map is loaded and extent has been set
@@ -987,7 +999,7 @@
 
     /**
      * Function: zoom
-     * 
+     *
      * sets the map zoom and extent.
      *
      * Parameters:
@@ -1039,7 +1051,7 @@
 
     /**
      * Function: zoom
-     * 
+     *
      * sets the map zoom and extent.
      *
      * Parameters:
@@ -1061,7 +1073,7 @@
 
     /**
      * Function: zoom
-     * 
+     *
      * sets the map zoom and extent.
      *
      * Parameters:
@@ -1079,7 +1091,7 @@
 
     /**
      * Function: zoom
-     * 
+     *
      * sets the map zoom and extent.
      *
      * Parameters:
@@ -1406,12 +1418,12 @@
         }
         return OpenLayers.Util.getParameterString(queryParams);
      },
-     
+
      getMapTip: function(oMapTips) {
         //TODO send this to the correct aMap object
         this.aMaps[0].getMapTip(oMapTips);
      },
-     
+
      supressContextMenu: function( bSupress ) {
          this.bSupressContextMenu = bSupress;
      },

Modified: trunk/widgets/BufferPanel/Buffer.php
===================================================================
--- trunk/widgets/BufferPanel/Buffer.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/BufferPanel/Buffer.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -361,7 +361,7 @@
 
 function OnError($title, $msg)
 {
-    global $target, $popup;
+    global $target, $popup, $mapName;
     $templ = Localize(file_get_contents("./ErrorPage.templ"), $locale, GetClientOS());
     print sprintf($templ, $popup, $mapName, $title, $msg);
 }

Modified: trunk/widgets/BufferPanel/BufferReport.templ
===================================================================
--- trunk/widgets/BufferPanel/BufferReport.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/BufferPanel/BufferReport.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -24,13 +24,13 @@
 <script language=javascript>
 
 var popup = %s;
-var errors = false; //this page is only returned for success; 
+var errors = false; //this page is only returned for success;
 var mapName = '%s';
 
 function InitDocument()
 {
     var map = GetParent().Fusion.getMapByName(mapName);
-    map.reloadMap();
+    map.reloadNamedMap(mapName);
     if (!errors) {
       Back();
     }
@@ -42,7 +42,7 @@
         history.back();
     } else {
         var TaskPaneId=this.frameElement.taskPaneId;
-        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();  
+        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();
     }
 }
 

Modified: trunk/widgets/BufferPanel/ErrorPage.templ
===================================================================
--- trunk/widgets/BufferPanel/ErrorPage.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/BufferPanel/ErrorPage.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -31,8 +31,12 @@
 
 function InitDocument()
 {
-    var map = GetParent().Fusion.getMapByName('%s');
-    map.aMaps[0].reloadMap();
+    var mapName = '%s';
+    var map = GetParent().Fusion.getMapByName(mapName);
+    if(map != null)
+    {
+        map.reloadNamedMap(mapName);
+    }
 }
 
 function Back()

Modified: trunk/widgets/Search/ErrorPage.templ
===================================================================
--- trunk/widgets/Search/ErrorPage.templ	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/Search/ErrorPage.templ	2010-04-08 18:02:52 UTC (rev 2138)
@@ -31,8 +31,12 @@
 
 function InitDocument()
 {
+    var mapName = '%s';
     var map = GetParent().Fusion.getMapByName(mapName);
-    map.reloadMap();
+    if(map != null)
+    {
+        map.reloadNamedMap(mapName);
+    }
 }
 
 function Back()
@@ -41,7 +45,7 @@
         history.back();
     } else {
         var TaskPaneId=this.frameElement.taskPaneId;
-        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();  
+        GetParent().Fusion.getWidgetById(TaskPaneId).goHome();
     }
 }
 

Modified: trunk/widgets/Search/Search.php
===================================================================
--- trunk/widgets/Search/Search.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/Search/Search.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -274,9 +274,9 @@
 
 function OnError($title, $msg)
 {
-    global $target, $popup;
+    global $target, $popup, $mapName;
     $templ = file_get_contents("./ErrorPage.templ");
-    print sprintf($templ, $popup, $title, $msg);
+    print sprintf($templ, $popup, $mapName, $title, $msg);
 }
 
 function GetParameters($params)

Modified: trunk/widgets/Theme/thememain.php
===================================================================
--- trunk/widgets/Theme/thememain.php	2010-04-07 22:54:19 UTC (rev 2137)
+++ trunk/widgets/Theme/thememain.php	2010-04-08 18:02:52 UTC (rev 2138)
@@ -359,7 +359,7 @@
                 themeReqHandler = null;
 
                 var map = parent.Fusion.getMapByName(mapName);
-                map.reloadMap();
+                map.reloadNamedMap(mapName);
 
             }
         }



More information about the fusion-commits mailing list