- Timestamp:
- 09/05/08 02:30:42 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/layer/GridCalculator.java
r387 r388 69 69 public GridCalculator(Grid grid) throws GeoWebCacheException { 70 70 71 //TODO this is messed up, ignoring Grid object72 71 this.grid = grid; 73 this.zoomStart = 0; 74 this.zoomStop = 30; 75 //this.metaWidth = metaWidth; 76 //this.metaHeight = metaHeight; 77 72 78 73 if(grid.resolutions != null) { 79 74 this.resolutions = grid.resolutions; 80 75 this.zoomStop = resolutions.length - 1; 76 } else { 77 this.zoomStart = grid.getZoomStart(); 78 this.zoomStop = grid.getZoomStop(); 81 79 } 82 80 … … 96 94 private void determineGrid() throws GeoWebCacheException { 97 95 if(grid.resolutions == null) { 98 // Figure out the appro riate resolutions96 // Figure out the appropriate resolutions 99 97 100 98 double ratio = gridWidth / gridHeight; … … 152 150 } 153 151 154 this.resolutions = new double[this.zoomStop - this.zoomStart + 1]; 152 // We still need the full array, even though we only care about a part of it 153 this.resolutions = new double[this.zoomStop + 1]; 155 154 for(int i=this.zoomStart; i<= this.zoomStop; i++) { 156 155 this.resolutions[i] = baseResolution; … … 472 471 private int binarySearchForResolution(double reqResolution) 473 472 throws BadTileException { 474 return binarySearchForResolution(this.resolutions, reqResolution );475 } 476 477 protected static int binarySearchForResolution(double[] resolutions, double reqResolution )473 return binarySearchForResolution(this.resolutions, reqResolution, this.zoomStart); 474 } 475 476 protected static int binarySearchForResolution(double[] resolutions, double reqResolution, int zoomStart) 478 477 throws BadTileException { 479 int low = 0;478 int low = zoomStart; 480 479 int high = resolutions.length - 1; 481 480 … … 485 484 486 485 // Deal with the edge cases first 487 if(reqLower > resolutions[ 1]) {486 if(reqLower > resolutions[low]) { 488 487 if(resolutions[0] < reqLower) { 489 488 throw new BadTileException("Resolution "+reqResolution+" is too big for grid,"
