[fusion-commits] r2871 - in trunk: . layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Aug 12 08:04:49 PDT 2014


Author: jng
Date: 2014-08-12 08:04:49 -0700 (Tue, 12 Aug 2014)
New Revision: 2871

Modified:
   trunk/
   trunk/layers/MapGuide/MapGuide.js
Log:
Merged revision(s) 2845-2846 from sandbox/tiling:
Add support for tile set definitions and the updated CREATERUNTIMEMAP/DESCRIBERUNTIMEMAP response format
........
Revert tile set checking instead of being always on
........



Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
   + /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/tiling:2845-2846

Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js	2014-07-30 07:22:43 UTC (rev 2870)
+++ trunk/layers/MapGuide/MapGuide.js	2014-08-12 15:04:49 UTC (rev 2871)
@@ -55,7 +55,9 @@
         1155581.153, 2311162.307, 4622324.614, 9244649.227, 18489298.45, 
         36978596.91, 73957193.82, 147914387.6, 295828775.3, 591657550.5
     ],
+    defaultTileSize: [300,300],
     bUseNativeServices: false,
+    bHasTileSetSupport: false,
     selectionAsOverlay: true,
     useAsyncOverlay: false,
     defaultFormat: 'PNG',
@@ -169,10 +171,12 @@
         //that use layer property mappings as they will be lazy loaded due to us not calling LoadMap.php, which 
         //would've pre-cached such information. but we get much better map init performance
         this.bUseNativeServices = false;
+        this.bHasTileSetSupport = false;
         var vMajor = this.siteVersion[0];
         var vMinor = this.siteVersion[1];
         if (vMajor > 2) { // 3.0 or higher
             this.bUseNativeServices = true;
+            this.bHasTileSetSupport = true;
         } else {
             if (vMajor == 2) { // 2.x
                 if (vMinor >= 6) { // >= 2.6
@@ -285,6 +289,9 @@
         if (this.bUseNativeServices) {
             var features = (1 | 2 | 4); //We want the whole lot
             var r = new Fusion.Lib.MGRequest.MGCreateRuntimeMap(resourceId, features, 25);
+            if (this.bHasTileSetSupport) {
+                r.setParams({ version: "3.0.0" });
+            }
             var mapName = this.calcMapName(resourceId, true);
             r.setParams({ 
                 targetMapName: mapName,
@@ -352,9 +359,9 @@
                     parentUniqueId: grp.ParentId ? grp.ParentId[0] : "",
                     visible: (grp.Visible[0] == "true"),
                     actuallyVisible: (grp.ActuallyVisible[0] == "true"),
-                    isBaseMapGroup: (grp.Type[0] == "2")
+                    isBaseMapGroup: (grp.Type[0] == "2" || grp.Type[0] == "3")
                 };
-                if (grp.Type[0] == "2")
+                if (cg.isBaseMapGroup)
                     lm.hasBaseMapLayers = true;
                 else
                     lm.hasDynamicLayers = true;
@@ -665,14 +672,28 @@
         this.triggerEvent(Fusion.Event.LAYER_LOADED);
 
     },
+    convertAndLoadMapResponse: function(o) {
+        var co = this.convertResponse(o);
+        if (this.bHasTileSetSupport && o.RuntimeMap.TileSetDefinition) {
+            //Override default tile size based on what's in the 
+            if (o.RuntimeMap.TileWidth && o.RuntimeMap.TileHeight) {
+                this.defaultTileSize = [
+                    parseInt(o.RuntimeMap.TileWidth[0]),
+                    parseInt(o.RuntimeMap.TileHeight[0])
+                ];
+            }
+            this._tileSetId = o.RuntimeMap.TileSetDefinition[0];
+        }
+        this.initLoadMapResponse(co.LoadMap);
+        return co;
+    },
     /**
      * Callback function from a CREATERUNTIMEMAP request
      */
     onRuntimeMapCreated: function(r) {
         if (r.status == 200) {
             var o = Fusion.parseJSON(r.responseText);
-            var co = this.convertResponse(o);
-            this.initLoadMapResponse(co.LoadMap);
+            var co = this.convertAndLoadMapResponse(o);
             //Need to wait for the right event to trigger loadScaleRanges, so stash our
             //prepared result for when it comes
             this._initScaleRanges = co.LoadScaleRanges;
@@ -1008,7 +1029,7 @@
 
       } else {
         params = {      //tiled version
-          mapdefinition: this._sResourceId,
+          mapdefinition: this._tileSetId || this._sResourceId,
           basemaplayergroupname: baselayerGroupName, 
           session: this.getSessionID(),
           clientagent: this.clientAgent
@@ -1046,6 +1067,9 @@
         }
       }
       
+      if (!bSingleTile)
+        layerOptions.defaultSize = new OpenLayers.Size(this.defaultTileSize[0], this.defaultTileSize[1]);
+      
       var oNewLayerOL = new OpenLayers.Layer.MapGuide( layerName, url, params, layerOptions );
       if (!bSingleTile) {
         if (oNewLayerOL.scales.length == this.aCmsScales.length) { 



More information about the fusion-commits mailing list