Changeset 5394
- Timestamp:
- 12/13/07 09:04:49 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/ianmayo/branches/worldwind/openlayers/lib/OpenLayers/Layer/WorldWind.js
r5242 r5394 61 61 * be present in a subdirectory named n. eg if the url of the layer is set to file:///home/wwcache/ then worldwind 62 62 * level 1 data is expected to be found in the directory /home/wwcache/1. 63 * If running on Internet Explorer or Firefox and checkCache is set in optionsthen this function tests for the presence63 * If running on Internet Explorer or Firefox then this function tests for the presence 64 64 * of the file 0000/0000_0000.jpg to confirm the presence of the cache files. 65 65 */ … … 67 67 68 68 this.cacheDir = new Array(); 69 70 if((options != undefined && options.localCache) || url.substr(0,7) == 'file://') {71 69 70 if((options != undefined && options.localCache) || (url.substr(0,7) == 'file://')) { 71 72 72 var fso = false; 73 73 var mozFile = false; 74 75 if( options != undefined && options.checkCache) {74 75 if(url.substr(0,7) != 'file://') { 76 76 77 77 try { … … 158 158 var zoom = this.map.getZoom(); 159 159 var extent = this.map.getMaxExtent(); 160 zoom = zoom - Math.log(this.maxResolution / (this.lzd/512))/Math.log(2); 160 /* zoom = zoom - Math.log(this.maxResolution / (this.lzd/512))/Math.log(2);*/ 161 zoom = zoom - Math.log(this.maxResolution / (this.lzd/Math.min(this.tileSize.w,512)))/Math.log(2); 161 162 return zoom; 162 163 }, … … 177 178 var zoom = this.getZoom(); 178 179 var extent = this.map.getMaxExtent(); 179 var deg = this.lzd/Math.pow(2, this.getZoom());180 var deg = this.lzd/Math.pow(2,Math.min(zoom,this.zoomLevels)); 180 181 var x = Math.floor((bounds.left - extent.left)/deg); 181 182 var y = Math.floor((bounds.bottom - extent.bottom)/deg); 182 if (this.map.getResolution() <= (this.lzd/512)183 && this.getZoom()<= this.zoomLevels) {183 //if (this.map.getResolution() <= (this.lzd/512) && this.getZoom() <= this.zoomLevels) { 184 //if (this.map.getResolution() <= (this.lzd/this.tileSize.w) && zoom <= this.zoomLevels) { 184 185 return this.getURLForTile(zoom,x,y); 185 } else {186 return OpenLayers.Util.getImagesLocation() + "blank.gif";187 }186 //} else { 187 // return OpenLayers.Util.getImagesLocation() + "blank.gif"; 188 //} 188 189 189 190 }, … … 207 208 */ 208 209 getURLForTile: function(z,x,y) { 210 211 if(this.map.getResolution() > (this.lzd/this.tileSize.w)) { 212 if(this.adjustTileSizeAndRedraw(512 / (2*(this.getZoomForResolution(this.lzd/512) - this.map.getZoom())))) { 213 return; 214 } 215 } 216 else if(this.tileSize.w < 512 && (this.map.getResolution() <= (this.lzd/512)) ) { 217 if(this.adjustTileSizeAndRedraw(512)) { 218 return; 219 } 220 } 221 else if(this.tileSize.w > 512 && z <= this.zoomLevels) { 222 if(this.adjustTileSizeAndRedraw(512)) { 223 return; 224 } 225 } 226 else if(this.getZoom() > this.zoomLevels) { 227 if(this.adjustTileSizeAndRedraw(512 * (2*(this.getZoom() - this.zoomLevels)))) { 228 return; 229 } 230 } 231 232 z = Math.min(z,this.zoomLevels); 209 233 210 234 if(this.cacheDir[z] != undefined) { … … 222 246 223 247 }, 248 249 adjustTileSizeAndRedraw: function(tileSize) { 250 if(this.tileSize.w != tileSize) { 251 this.clearGrid(); 252 this.tileSize = new OpenLayers.Size(tileSize,tileSize); 253 this.redraw(); 254 return true; 255 } 256 return false; 257 }, 224 258 225 259 226 260 CLASS_NAME: "OpenLayers.Layer.WorldWind" 227 261 }); 228
