[fusion-commits] r2701 - sandbox/createruntimemap/layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed May 15 03:47:18 PDT 2013


Author: jng
Date: 2013-05-15 03:47:18 -0700 (Wed, 15 May 2013)
New Revision: 2701

Modified:
   sandbox/createruntimemap/layers/MapGuide/MapGuide.js
Log:
Figured out why visibility toggles do nothing. There's 2 calls to CREATERUNTIMEMAP. One from the main viewer and one from the overview map. The second runtime map overwrites the first runtime map due to the mapname being the same, derived from the resource id. LoadMap.php appended a unique suffix to prevent this. Thus our layer/group toggles are toggling layers of a runtime map that no longer existed. 

We solved this on the MapGuide end by supporting a TARGETMAPNAME parameter indicating the desired map name. In fusion, we pass this along with our CREATERUNTIMEMAP request. This ensures 2 unique runtime maps are created.

Probably should figure out why we need 2 runtime maps in Fusion. Stock OpenLayers OverviewMap certainly doesn't.

Modified: sandbox/createruntimemap/layers/MapGuide/MapGuide.js
===================================================================
--- sandbox/createruntimemap/layers/MapGuide/MapGuide.js	2013-05-14 15:09:43 UTC (rev 2700)
+++ sandbox/createruntimemap/layers/MapGuide/MapGuide.js	2013-05-15 10:47:18 UTC (rev 2701)
@@ -203,6 +203,15 @@
         return this.session[0];
     },
 
+    calcMapName: function(resourceId, bAppendUniqueId) {
+        var slIdx = resourceId.lastIndexOf("/") + 1;
+        var dIdx = resourceId.lastIndexOf(".");
+        var name = resourceId.substring(slIdx, dIdx);
+        if (bAppendUniqueId)
+            name += (new Date()).getTime();
+        return name;
+    },
+
     loadMap: function(resourceId, options) {
         this.bMapLoaded = false;
         
@@ -232,6 +241,8 @@
         if (this.bUseNativeServices) {
             var features = (1 | 2 | 4); //We want the whole lot
             var r = new Fusion.Lib.MGRequest.MGCreateRuntimeMap(resourceId, features, 25);
+            var mapName = this.calcMapName(resourceId, true);
+            r.setParams({ targetMapName: mapName });
             if (this.session.length == 1)
                 r.setParams({ session: this.session[0] });
             Fusion.oBroker.dispatchRequest(r, OpenLayers.Function.bind(this.onRuntimeMapCreated, this));



More information about the fusion-commits mailing list