[OpenLayers-Commits] r5100 - in trunk/openlayers: examples lib/OpenLayers/Layer tests/Layer

commits at openlayers.org commits at openlayers.org
Thu Nov 1 22:16:45 EDT 2007


Author: crschmidt
Date: 2007-11-01 22:16:44 -0400 (Thu, 01 Nov 2007)
New Revision: 5100

Modified:
   trunk/openlayers/examples/tilecache.html
   trunk/openlayers/lib/OpenLayers/Layer/TileCache.js
   trunk/openlayers/tests/Layer/test_TileCache.html
Log:
Update TileCache format determination to support TileCache's weird jpg->jpeg
translation correctly. Also, update example to show usage, and tests to test
jpeg instead of testing png incorrectly.


Modified: trunk/openlayers/examples/tilecache.html
===================================================================
--- trunk/openlayers/examples/tilecache.html	2007-11-01 23:06:10 UTC (rev 5099)
+++ trunk/openlayers/examples/tilecache.html	2007-11-02 02:16:44 UTC (rev 5100)
@@ -28,7 +28,7 @@
                      "http://c2.labs.metacarta.com/wms-c/cache/",
                      "http://c3.labs.metacarta.com/wms-c/cache/",
                      "http://c4.labs.metacarta.com/wms-c/cache/"],
-                    "basic");
+                    "basic", {'format': 'image/png'});
             map.addLayer(layer);
             map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         }

Modified: trunk/openlayers/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/TileCache.js	2007-11-01 23:06:10 UTC (rev 5099)
+++ trunk/openlayers/lib/OpenLayers/Layer/TileCache.js	2007-11-02 02:16:44 UTC (rev 5100)
@@ -52,7 +52,7 @@
         OpenLayers.Layer.Grid.prototype.initialize.apply(this,
                                                          [name, url, {}, options]);
         this.extension = this.format.split('/')[1].toLowerCase();
-        this.extension = (this.extension == 'jpeg') ? 'jpg' : this.extension;
+        this.extension = (this.extension == 'jpg') ? 'jpeg' : this.extension;
     },    
 
     /**

Modified: trunk/openlayers/tests/Layer/test_TileCache.html
===================================================================
--- trunk/openlayers/tests/Layer/test_TileCache.html	2007-11-01 23:06:10 UTC (rev 5099)
+++ trunk/openlayers/tests/Layer/test_TileCache.html	2007-11-02 02:16:44 UTC (rev 5100)
@@ -110,16 +110,16 @@
         t.plan(2);
         
         var map = new OpenLayers.Map('map', options);
-        var options = {'layername':'basic', 'type':'png'}; 
+        var options = {'layername':'basic', 'format':'image/jpg'}; 
         layer = new OpenLayers.Layer.TileCache(name, url, layername, options);
         map.addLayer(layer);
         map.setCenter(new OpenLayers.LonLat(0,0), 9);
         var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
-        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/basic/09/000/000/522/000/000/384.png", "Tile URL is correct");
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/basic/09/000/000/522/000/000/384.jpeg", "Tile URL is correct");
 
         layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
         tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
-        t.eq(tileurl, "http://tilecache3/basic/09/000/000/522/000/000/384.png", "Tile URL is deterministic");
+        t.eq(tileurl, "http://tilecache2/basic/09/000/000/522/000/000/384.jpeg", "Tile URL is deterministic");
     }
 
     function test_11_Layer_TileCache_setMap(t) {



More information about the Commits mailing list