[OpenLayers-Commits] r12285 - sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Aug 30 07:50:43 EDT 2011


Author: erilem
Date: 2011-08-30 04:50:42 -0700 (Tue, 30 Aug 2011)
New Revision: 12285

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
Log:
"clientzoom" support for TMS, TileCache, and XYZ; and API docs for serverResolutions

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-08-29 12:50:44 UTC (rev 12284)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-08-30 11:50:42 UTC (rev 12285)
@@ -98,6 +98,13 @@
     tileLoadingDelay: 100,
 
     /**
+     * Property: serverResolutions
+     * {Array(Number}} This property is documented in subclasses as
+     *     an API property.
+     */
+    serverResolutions: null,
+
+    /**
      * Property: timerId
      * {Number} - The id of the tileLoadingDelay timer.
      */

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js	2011-08-29 12:50:44 UTC (rev 12284)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TMS.js	2011-08-30 11:50:42 UTC (rev 12285)
@@ -87,8 +87,17 @@
 
     /**
      * APIProperty: serverResolutions
-     * {Array} A list of all resolutions available on the server.  Only set this 
-     *     property if the map resolutions differs from the server.
+     * {Array} A list of all resolutions available on the server.  Only set this
+     *     property if the map resolutions differ from the server. This
+     *     property serves two purposes. (a) <serverResolutions> can include
+     *     resolutions that the server supports and that you don't want to
+     *     provide with this layer; you can also look at <zoomOffset>, which is
+     *     an alternative to <serverResolutions> for that specific purpose.
+     *     (b) The map can work with resolutions that aren't supported by
+     *     the server, i.e. that aren't in <serverResolutions>. When the
+     *     map is displayed in such a resolution data for the closest
+     *     server-supported resolution is loaded and the layer div is
+     *     stretched as necessary.
      */
     serverResolutions: null,
 
@@ -171,12 +180,12 @@
      */
     getURL: function (bounds) {
         bounds = this.adjustBounds(bounds);
-        var res = this.map.getResolution();
+        var res = this.getAvailableResolution();
         var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
         var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
         var z = this.serverResolutions != null ?
             OpenLayers.Util.indexOf(this.serverResolutions, res) :
-            this.map.getZoom() + this.zoomOffset;
+            this.getAvailableZoom() + this.zoomOffset;
         var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; 
         var url = this.url;
         if (OpenLayers.Util.isArray(url)) {

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js	2011-08-29 12:50:44 UTC (rev 12284)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/TileCache.js	2011-08-30 11:50:42 UTC (rev 12285)
@@ -37,8 +37,15 @@
 
     /**
      * APIProperty: serverResolutions
-     * {Array} A list of all resolutions available on the server.  Only set this 
-     *     property if the map resolutions differs from the server.
+     * {Array} A list of all resolutions available on the server.  Only set this
+     *     property if the map resolutions differ from the server. This
+     *     property serves two purposes. (a) <serverResolutions> can include
+     *     resolutions that the server supports and that you don't want to
+     *     provide with this layer. (b) The map can work with resolutions
+     *     that aren't supported by the server, i.e. that aren't in
+     *     <serverResolutions>. When the map is displayed in such a resolution
+     *     data for the closest server-supported resolution is loaded and the
+     *     layer div is stretched as necessary.
      */
     serverResolutions: null,
 
@@ -102,7 +109,7 @@
      *     passed-in bounds and appropriate tile size specified as parameters.
      */
     getURL: function(bounds) {
-        var res = this.map.getResolution();
+        var res = this.getAvailableResolution();
         var bbox = this.maxExtent;
         var size = this.tileSize;
         var tileX = Math.round((bounds.left - bbox.left) / (res * size.w));

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js	2011-08-29 12:50:44 UTC (rev 12284)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/WMTS.js	2011-08-30 11:50:42 UTC (rev 12285)
@@ -150,8 +150,19 @@
      *     the <matrixIds> property.  Defaults to 0 (no zoom offset).
      */
     zoomOffset: 0,
-    
+
     /**
+     * APIProperty: serverResolutions
+     * {Array} A list of all resolutions available on the server.  Only set this
+     *     property if the map resolutions differ from the server. The map can
+     *     work with resolutions that aren't supported by the server, i.e. that
+     *     aren't in <serverResolutions>. When the map is displayed in such a
+     *     resolution data for the closest server-supported resolution is
+     *     loaded and the layer div is stretched as necessary.
+     */
+    serverResolutions: null,
+
+    /**
      * Property: formatSuffixMap
      * {Object} a map between WMTS 'format' request parameter and tile image file suffix
      */

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js	2011-08-29 12:50:44 UTC (rev 12284)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js	2011-08-30 11:50:42 UTC (rev 12285)
@@ -49,7 +49,16 @@
     /**
      * APIProperty: serverResolutions
      * {Array} A list of all resolutions available on the server.  Only set this
-     *     property if the map resolutions differs from the server.
+     *     property if the map resolutions differ from the server. This
+     *     property serves two purposes. (a) <serverResolutions> can include
+     *     resolutions that the server supports and that you don't want to
+     *     provide with this layer; you can also look at <zoomOffset>, which is
+     *     an alternative to <serverResolutions> for that specific purpose.
+     *     (b) The map can work with resolutions that aren't supported by
+     *     the server, i.e. that aren't in <serverResolutions>. When the
+     *     map is displayed in such a resolution data for the closest
+     *     server-supported resolution is loaded and the layer div is
+     *     stretched as necessary.
      */
     serverResolutions: null,
 
@@ -139,14 +148,14 @@
      * {Object} - an object with x, y and z properties.
      */
     getXYZ: function(bounds) {
-        var res = this.map.getResolution();
+        var res = this.getAvailableResolution();
         var x = Math.round((bounds.left - this.maxExtent.left) /
             (res * this.tileSize.w));
         var y = Math.round((this.maxExtent.top - bounds.top) /
             (res * this.tileSize.h));
         var z = this.serverResolutions != null ?
             OpenLayers.Util.indexOf(this.serverResolutions, res) :
-            this.map.getZoom() + this.zoomOffset;
+            this.getAvailableZoom() + this.zoomOffset;
 
         var limit = Math.pow(2, z);
         if (this.wrapDateLine)



More information about the Commits mailing list