[fusion-commits] r2597 - in sandbox/ol212: layers/Generic lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Sep 17 01:55:10 PDT 2012


Author: jng
Date: 2012-09-17 01:55:09 -0700 (Mon, 17 Sep 2012)
New Revision: 2597

Modified:
   sandbox/ol212/layers/Generic/Generic.js
   sandbox/ol212/lib/Map.js
Log:
Add support for client-side stretching of tiled layers (made possible with client-zoom support in OpenLayers 2.12). This will only happen if all the tiled layers in question inherit from OpenLayers.Layer.Grid. If there is a single, non-Grid layer present (eg. Google) this trick will not work.

Modified: sandbox/ol212/layers/Generic/Generic.js
===================================================================
--- sandbox/ol212/layers/Generic/Generic.js	2012-09-17 07:51:38 UTC (rev 2596)
+++ sandbox/ol212/layers/Generic/Generic.js	2012-09-17 08:55:09 UTC (rev 2597)
@@ -199,10 +199,10 @@
             }
             else {
                 this.oLayerOL = new OpenLayers.Layer[this.layerType](this.getMapName(), this.mapTag.layerOptions );
+                //fractionalZoom not permitted with tiled base layers regardless
+                this.mapWidget.fractionalZoom = false;
+                this.mapWidget.oMapOL.setOptions({fractionalZoom: false});
             }
-            //fractionalZoom not permitted with tiled base layers regardless
-            this.mapWidget.fractionalZoom = false;
-            this.mapWidget.oMapOL.setOptions({fractionalZoom: false});
         }
         
         

Modified: sandbox/ol212/lib/Map.js
===================================================================
--- sandbox/ol212/lib/Map.js	2012-09-17 07:51:38 UTC (rev 2596)
+++ sandbox/ol212/lib/Map.js	2012-09-17 08:55:09 UTC (rev 2597)
@@ -409,6 +409,42 @@
       if (this.aMaps.length == 1) {
         this.oMapOL.setBaseLayer(this.aMaps[0].oLayerOL);
       }
+
+      if (this.fractionalZoom) {
+        var newResolutions = null;
+        var mgResolutions = null;
+        for (var i = 0; i < this.aMaps.length; i++) {
+            if (this.aMaps[i].arch == 'MapGuide') {
+                mgResolutions = this.aMaps[i].oLayerOL.resolutions;
+            }
+        }
+        for (var i = 0; i < this.aMaps.length; i++) {
+            if (this.aMaps[i].arch == 'Generic') {
+                var oLayer = this.aMaps[i].oLayerOL;
+                oLayer.serverResolutions = oLayer.resolutions;
+                if (newResolutions == null) {
+                    newResolutions = [];
+                    for (var j = 0; j < oLayer.serverResolutions.length; j++) {
+                        newResolutions.push(oLayer.serverResolutions[j]);
+                    }
+                    for (var j = 0; j < mgResolutions.length; j++) {
+                        if (mgResolutions[j] < oLayer.minResolution) {
+                            newResolutions.push(mgResolutions[j]);
+                        }
+                    }
+                }
+                oLayer.resolutions = newResolutions;
+                var newScales = [];
+                for (var i = 0; i < newResolutions.length; i++) {
+                    newScales.push(OpenLayers.Util.getScaleFromResolution(newResolutions[i], oLayer.units));
+                }
+                oLayer.scales = newScales;
+                oLayer.minResolution = newResolutions[newResolutions.length - 1];
+                oLayer.maxScale = newScales[newScales.length - 1];
+                oLayer.numZoomLevels = newScales.length;
+            }
+        }
+      }
       
       var initialExtent = this.setInitialExtents();
       this.setExtents(initialExtent);



More information about the fusion-commits mailing list