OpenLayers OpenLayers

Changeset 5394

Show
Ignore:
Timestamp:
12/13/07 09:04:49 (1 year ago)
Author:
ianmayo
Message:

Andrew's updated version that allows user to zoom in & out further

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/ianmayo/branches/worldwind/openlayers/lib/OpenLayers/Layer/WorldWind.js

    r5242 r5394  
    6161     * be present in a subdirectory named n. eg if the url of the layer is set to file:///home/wwcache/ then worldwind 
    6262     * 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 options then this function tests for the presence 
     63     * If running on Internet Explorer or Firefox then this function tests for the presence 
    6464     * of the file 0000/0000_0000.jpg to confirm the presence of the cache files. 
    6565     */ 
     
    6767     
    6868        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         
    7272            var fso = false; 
    7373            var mozFile = false; 
    74              
    75             if(options != undefined && options.checkCache) { 
     74 
     75            if(url.substr(0,7) != 'file://') { 
    7676                 
    7777                try { 
     
    158158        var zoom = this.map.getZoom(); 
    159159        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); 
    161162        return zoom; 
    162163    }, 
     
    177178        var zoom = this.getZoom(); 
    178179        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)); 
    180181        var x = Math.floor((bounds.left - extent.left)/deg); 
    181182        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) { 
    184185            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        //
    188189 
    189190    }, 
     
    207208    */ 
    208209    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); 
    209233         
    210234        if(this.cacheDir[z] != undefined) { 
     
    222246         
    223247    }, 
     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    }, 
    224258 
    225259 
    226260    CLASS_NAME: "OpenLayers.Layer.WorldWind" 
    227261}); 
    228