[fusion-commits] r2183 - trunk/layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Jun 22 05:40:33 EDT 2010


Author: hubu
Date: 2010-06-22 09:40:33 +0000 (Tue, 22 Jun 2010)
New Revision: 2183

Modified:
   trunk/layers/MapGuide/MapGuide.js
Log:
Fix ticket  #396 -- Calling map.reloadMap() twice at same time result in error.

Reviewed by Bruce Dechant.

Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js	2010-06-21 15:30:13 UTC (rev 2182)
+++ trunk/layers/MapGuide/MapGuide.js	2010-06-22 09:40:33 UTC (rev 2183)
@@ -364,7 +364,7 @@
         this.aHideGroups = [];
         this.aRefreshLayers = [];
         this.layerRoot.clear();
-        this.oldLayers = $A(this.aLayers);
+        var oldLayers = $A(this.aLayers);
         this.aLayers = [];
 
         var sl = Fusion.getScriptLanguage();
@@ -374,7 +374,7 @@
 
         var params = {'mapname': this._sMapname, 'session': sessionid};
         var options = {
-              onSuccess: OpenLayers.Function.bind(this.mapReloaded,this),
+              onSuccess: OpenLayers.Function.bind(this.mapReloaded,this,oldLayers),
               onException: OpenLayers.Function.bind(this.reloadFailed, this),
               parameters: params};
         Fusion.ajaxRequest(loadmapScript, options);
@@ -439,22 +439,21 @@
         }
     },
 //TBD: this function not yet converted for OL
-    mapReloaded: function(r) {
+    mapReloaded: function(oldLayers,r) {
         if (r.status == 200) {
             var o;
             eval('o='+r.responseText);
             this.parseMapLayersAndGroups(o);
             for (var i=0; i<this.aLayers.length; ++i) {
               var newLayer = this.aLayers[i];
-              for (var j=0; j<this.oldLayers.length; ++j){
-                if (this.oldLayers[j].uniqueId == newLayer.uniqueId) {
-                  newLayer.selectedFeatureCount = this.oldLayers[j].selectedFeatureCount;
-                  newLayer.noCache = this.oldLayers[j].noCache;
+              for (var j=0; j<oldLayers.length; ++j){
+                if (oldLayers[j].uniqueId == newLayer.uniqueId) {
+                  newLayer.selectedFeatureCount = oldLayers[j].selectedFeatureCount;
+                  newLayer.noCache = oldLayers[j].noCache;
                   break;
                 }
               }
             }
-            this.oldLayers = null;
             this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);
             this.drawMap();
         }



More information about the fusion-commits mailing list