Changeset 389
- Timestamp:
- 09/06/08 22:09:30 (2 months ago)
- Location:
- trunk/geowebcache/src/main/java/org/geowebcache
- Files:
-
- 4 modified
-
layer/Grid.java (modified) (3 diffs)
-
layer/GridCalculator.java (modified) (7 diffs)
-
rest/SeedResource.java (modified) (1 diff)
-
rest/SeedTask.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/layer/Grid.java
r388 r389 17 17 package org.geowebcache.layer; 18 18 19 import java.util.List;20 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 21 import org.geowebcache.GeoWebCacheException; 22 22 import org.geowebcache.util.wms.BBOX; 23 import org.mortbay.log.Log;24 23 25 24 /** … … 28 27 29 28 public class Grid { 29 private static Log log = LogFactory.getLog(org.geowebcache.layer.Grid.class); 30 30 31 private SRS srs = null; 31 32 … … 144 145 private GridCalculator initGridCalculator() throws GeoWebCacheException { 145 146 if(zoomStart < 0 || zoomStop < zoomStart || zoomStop == 0) { 146 Log.debug("Missing values, setting zoomStart,zoomStop to 0,30");147 log.debug("Missing values, setting zoomStart,zoomStop to 0,30"); 147 148 zoomStart = 0; 148 149 zoomStop = 30; -
trunk/geowebcache/src/main/java/org/geowebcache/layer/GridCalculator.java
r388 r389 50 50 51 51 private double[] resolutions; 52 53 // The following are for a tile, zoomed out all the way54 //private double maxTileWidth;55 56 //private double maxTileHeight;57 52 58 53 private int zoomStart; 59 54 60 55 private int zoomStop; 61 62 // Special treatment of "zoomed out tile" for EPSG 432663 //private boolean worldBoundsCoverTwoTiles = false;64 56 65 57 private int[] zoomedOutGridLoc = null; … … 151 143 152 144 // We still need the full array, even though we only care about a part of it 153 this.resolutions = new double[this.zoomStop + 1];154 for(int i= this.zoomStart; i<= this.zoomStop; i++) {155 this.resolutions[i] = baseResolution;145 resolutions = new double[this.zoomStop + 1]; 146 for(int i=0; i<= this.zoomStop; i++) { 147 resolutions[i] = baseResolution; 156 148 baseResolution = baseResolution / 2; 157 149 } … … 163 155 // We'll just waste a few bytes, for cheap lookups 164 156 int[][] gridLevels = new int[zoomStop + 1][4]; 165 166 //int tileCountX = (int) Math.round(gridWidth / resolutions[0]);167 //int tileCountY = (int) Math.round(gridHeight / resolutions[0]);168 169 //int metaLarger = (metaHeight > metaWidth) ? metaHeight : metaWidth;170 171 //System.out.println("lb: " +layerBounds+ " base:" +172 // " tileWidth: " + tileWidth);173 157 174 158 double[] rawNumber = new double[4]; … … 196 180 rawNumber[3] = (layerBounds.coords[3] - gridBounds.coords[1] - 0.00001) / tileDelta; 197 181 gridLevels[level][3] = (int) Math.floor(rawNumber[3]); 198 199 //System.out.println(Arrays.toString(rawNumber) + " "+ Arrays.toString(gridLevels[level]));200 //System.out.println("postOrig: " +201 // );202 //203 //System.out.println("tileCountX "+tileCountX + " metaLarger: "204 // + metaLarger);205 206 //tileCountX = tileCountX * 2;207 //tileCountY = tileCountY * 2;208 182 } 209 183 return gridLevels; … … 239 213 240 214 double reqTileWidth = tileBounds.coords[2] - tileBounds.coords[0]; 241 242 //Arrays.binarySearch(a, key)243 //double zoomLevel = Math.log(gridWidth / reqTileWidth) / Math.log(2);244 245 //long roundedZoomLevel = Math.round(zoomLevel);246 247 215 248 216 // (Z) Zoom level 249 217 // For EPSG 4326, reqTileWidth = 0.087 log(4096) / log(2) - 1; -> 11 250 218 retVals[2] = this.binarySearchForResolution(reqTileWidth / GridCalculator.TILEPIXELS); 219 220 if(retVals[2] < zoomStart) { 221 throw new BadTileException("zoomStart is " + zoomStart 222 + " but tile would be " + retVals[2]); 223 } 251 224 252 225 double tileWidth = resolutions[retVals[2]] * GridCalculator.TILEPIXELS; … … 458 431 public double[] getResolutions() { 459 432 return resolutions; 460 //double[] ret = new double[zoomStop - zoomStart + 1];461 //double tileWidth = maxTileWidth / widthPixels;462 463 //for(int i=0; i<ret.length; i++) {464 // ret[i] = tileWidth;465 // tileWidth = tileWidth / 2;466 // }467 468 //return ret;469 433 } 470 434 471 435 private int binarySearchForResolution(double reqResolution) 472 436 throws BadTileException { 473 return binarySearchForResolution(this.resolutions, reqResolution , this.zoomStart);474 } 475 476 protected static int binarySearchForResolution(double[] resolutions, double reqResolution , int zoomStart)437 return binarySearchForResolution(this.resolutions, reqResolution); 438 } 439 440 protected static int binarySearchForResolution(double[] resolutions, double reqResolution) 477 441 throws BadTileException { 478 int low = zoomStart;442 int low = 0; 479 443 int high = resolutions.length - 1; 480 444 … … 484 448 485 449 // Deal with the edge cases first 486 if(re qLower > resolutions[low]) {450 if(resolutions[low] < reqUpper) { 487 451 if(resolutions[0] < reqLower) { 488 452 throw new BadTileException("Resolution "+reqResolution+" is too big for grid," 489 453 +" biggest supported is " + resolutions[0]); 490 454 } 491 return 0;492 } 493 494 if(re qUpper < resolutions[high - 1]) {455 return low; 456 } 457 458 if(resolutions[high] > reqLower) { 495 459 if(resolutions[high] / 1.5 > reqUpper) { 496 460 throw new BadTileException("Resolution "+reqResolution+" is too small for grid," -
trunk/geowebcache/src/main/java/org/geowebcache/rest/SeedResource.java
r384 r389 182 182 if(null == rq.getThreadCount() 183 183 || rq.getThreadCount() < 1 184 || type.equalsIgnoreCase(" seed")) {184 || type.equalsIgnoreCase("truncate")) { 185 185 threadCount = 1; 186 186 } else { -
trunk/geowebcache/src/main/java/org/geowebcache/rest/SeedTask.java
r370 r389 69 69 } 70 70 SRS srs = req.getSRS(); 71 if(srs == null) { 72 srs = tl.getGrids().entrySet().iterator().next().getKey(); 73 } 74 71 75 BBOX bounds = req.getBounds(); 76 if(bounds == null) { 77 bounds = tl.getGrid(srs).getBounds(); 78 } 72 79 73 80 int[][] coveredGridLevels = tl.getCoveredGridLevels(srs,bounds);
