[OpenLayers-Commits] r11614 - in sandbox/jennier/openlayers/lib/OpenLayers: Layer LocalTileStorage Tile Tile/Image

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Mar 3 13:12:55 EST 2011


Author: jennier
Date: 2011-03-03 10:12:54 -0800 (Thu, 03 Mar 2011)
New Revision: 11614

Modified:
   sandbox/jennier/openlayers/lib/OpenLayers/Layer/Grid.js
   sandbox/jennier/openlayers/lib/OpenLayers/Layer/WMS.js
   sandbox/jennier/openlayers/lib/OpenLayers/LocalTileStorage/TileSQLStorage.js
   sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image.js
   sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image/IFrame.js
Log:
Fixing failing IFrame test.  All tests should now pass and map tiles requested should be successfully stored in Web Storage or Web SQL. Still requires local storage test to be implemented. 

Modified: sandbox/jennier/openlayers/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/jennier/openlayers/lib/OpenLayers/Layer/Grid.js	2011-03-03 15:57:24 UTC (rev 11613)
+++ sandbox/jennier/openlayers/lib/OpenLayers/Layer/Grid.js	2011-03-03 18:12:54 UTC (rev 11614)
@@ -889,16 +889,15 @@
      * {String} a GetMap query string for this layer or the data URI for this 
      * image from local storage. To be used as the img src.
      */
-     getCacheURL: function (url, tile) {
+     getCacheURL: function (url, imgDiv) {
         
     	// If we want to use the local cache, check to see if they exist and 
     	// use those values if they do.
         if (this.params.ENABLELOCALCACHE) {        
 
 	        // check to see if the tile exists in the cache
-	        var imageCached = this.store.get(url, tile.imgDiv);	    	 
+	        var imageCached = this.store.get(url, imgDiv);	    	 
 	        	
-	        console.log("in get Cache URL: "+imageCached);
 	        if (imageCached) {
 	        	return imageCached;
 	        } 

Modified: sandbox/jennier/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- sandbox/jennier/openlayers/lib/OpenLayers/Layer/WMS.js	2011-03-03 15:57:24 UTC (rev 11613)
+++ sandbox/jennier/openlayers/lib/OpenLayers/Layer/WMS.js	2011-03-03 18:12:54 UTC (rev 11614)
@@ -186,7 +186,7 @@
      *          passed-in bounds and appropriate tile size specified as 
      *          parameters.
      */
-    getURL: function (bounds, tile) {
+    getURL: function (bounds, imgDiv) {
         bounds = this.adjustBounds(bounds);
         
         var imageSize = this.getImageSize();
@@ -201,7 +201,7 @@
         var url= this.getFullRequestString(newParams);
 
         // Check to see if the Image has been stored locally
-        return OpenLayers.Layer.Grid.prototype.getCacheURL.apply(this, [url, tile]);
+        return OpenLayers.Layer.Grid.prototype.getCacheURL.apply(this, [url, imgDiv]);
         
     },
 

Modified: sandbox/jennier/openlayers/lib/OpenLayers/LocalTileStorage/TileSQLStorage.js
===================================================================
--- sandbox/jennier/openlayers/lib/OpenLayers/LocalTileStorage/TileSQLStorage.js	2011-03-03 15:57:24 UTC (rev 11613)
+++ sandbox/jennier/openlayers/lib/OpenLayers/LocalTileStorage/TileSQLStorage.js	2011-03-03 18:12:54 UTC (rev 11614)
@@ -66,16 +66,15 @@
 				});
 		});
 	},
-	get: function(key, tile) {
+	get: function(key, imgDiv) {
 		this.db.transaction( 
 			function(tx) {
-				console.log("Select value from OLTable where key="+key);
 				tx.executeSql("Select value from OLTable where key=?",
 				[key], 
 				function(tx, result) {
 				  if(result.rows.length){
-					tile.src = result.rows.item(0).value;
-					return tile.src;
+					imgDiv.src = result.rows.item(0).value;
+					return imgDiv.src;
 				  }
 			    }, function(tx, error) {
 		        	console.debug(error);
@@ -101,7 +100,6 @@
 		var name = this.name;
 		this.db.transaction(
 				function(tx) {
-				//	console.log("Select count(*) as count from OLTable");
 					tx.executeSql("Select count(*) as count from OLTable",
 					[], 
 					function(tx, result) {

Modified: sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image/IFrame.js
===================================================================
--- sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image/IFrame.js	2011-03-03 15:57:24 UTC (rev 11613)
+++ sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image/IFrame.js	2011-03-03 18:12:54 UTC (rev 11614)
@@ -68,7 +68,7 @@
      * Method: initImgDiv
      * Creates the imgDiv property on the tile.
      */
-    initImgDiv: function() {
+    initImgDiv: function(imgDiv) {    	
         this.useIFrame = this.maxGetUrlLength !== null && !this.layer.async &&
             this.url.length > this.maxGetUrlLength;
         if (this.imgDiv != null) {

Modified: sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image.js	2011-03-03 15:57:24 UTC (rev 11613)
+++ sandbox/jennier/openlayers/lib/OpenLayers/Tile/Image.js	2011-03-03 18:12:54 UTC (rev 11614)
@@ -289,7 +289,8 @@
      */
     renderTile: function() {
         if (this.layer.async) {
-            this.initImgDiv();
+        	var imgDiv = this.createImgDiv();
+            this.initImgDiv(imgDiv);
             // Asyncronous image requests call the asynchronous getURL method
             // on the layer to fetch an image that covers 'this.bounds', in the scope of
             // 'this', setting the 'url' property of the layer itself, and running
@@ -299,11 +300,11 @@
             // syncronous image requests get the url and position the frame immediately,
             // and don't wait for an image request to come back.
         	
-        	this.initImgDiv();
-        	
-            this.url = this.layer.getURL(this.bounds, this);
-            this.imgDiv.src = this.url;
+        	var imgDiv = this.createImgDiv();
+        	        	        	
+            this.url = this.layer.getURL(this.bounds, imgDiv);
 
+            this.initImgDiv(imgDiv);
         	
             // position the frame immediately
             this.positionImage(); 
@@ -352,34 +353,49 @@
         }
     },
 
+    createImgDiv: function() {
+
+          var offset = this.layer.imageOffset; 
+          var size = this.layer.getImageSize(this.bounds); 
+          var imgDiv;
+          
+        if (this.layerAlphaHack) {
+            imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
+                                                           offset,
+                                                           size,
+                                                           null,
+                                                           "relative",
+                                                           null,
+                                                           null,
+                                                           null,
+                                                           true);
+        } else {
+            imgDiv = OpenLayers.Util.createImage(null,
+                                                      offset,
+                                                      size,
+                                                      null,
+                                                      "relative",
+                                                      null,
+                                                      null,
+                                                      true);
+        }
+        return imgDiv;
+
+    },
+    
     /**
      * Method: initImgDiv
      * Creates the imgDiv property on the tile.
      */
-    initImgDiv: function() {
+    initImgDiv: function(imgDiv) {
         if (this.imgDiv == null) {
             var offset = this.layer.imageOffset; 
             var size = this.layer.getImageSize(this.bounds); 
 
-            if (this.layerAlphaHack) {
-                this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
-                                                               offset,
-                                                               size,
-                                                               null,
-                                                               "relative",
-                                                               null,
-                                                               null,
-                                                               null,
-                                                               true);
+            if (imgDiv) {
+              this.imgDiv  = imgDiv;
             } else {
-                this.imgDiv = OpenLayers.Util.createImage(null,
-                                                          offset,
-                                                          size,
-                                                          null,
-                                                          "relative",
-                                                          null,
-                                                          null,
-                                                          true);
+              this.imgDiv = this.createImgDiv();
             }
 
             // needed for changing to a different server for onload error



More information about the Commits mailing list