Changeset 422
- Timestamp:
- 11/12/08 17:43:08 (8 weeks ago)
- Location:
- trunk/geowebcache/src/main/java/org/geowebcache
- Files:
-
- 4 modified
-
cache/file/FilePathKey2.java (modified) (1 diff)
-
cache/file/FilePathKey2Filter.java (modified) (3 diffs)
-
layer/GridCalculator.java (modified) (3 diffs)
-
rest/TruncateTask.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/cache/file/FilePathKey2.java
r418 r422 87 87 if (number > 9) { 88 88 if(number > 11) { 89 numberOrder = (int) Math.ceil(Math.log10(number) - 0.0 1);89 numberOrder = (int) Math.ceil(Math.log10(number) - 0.02); 90 90 } else { 91 91 numberOrder = 2; -
trunk/geowebcache/src/main/java/org/geowebcache/cache/file/FilePathKey2Filter.java
r420 r422 53 53 * * EPSG_2163_01 54 54 */ 55 public boolean accept(File dir, String name) { 56 System.out.println(dir.getAbsolutePath() + " " + name); 57 55 public boolean accept(File dir, String name) { 58 56 if(name.startsWith("EPSG_")) { 59 57 // srs and zoomlevel level … … 80 78 } else { 81 79 int tmp = findZoomLevel(name); 82 if(tmp < zoomStart || tmp >zoomStop) {80 if(tmp <= zoomStart || tmp >= zoomStop) { 83 81 return false; 84 82 } … … 121 119 122 120 // [2, 5, 5, 6] , why that when we've got 00_05 ? 123 if (x < = box[0] || x >=box[2]) {121 if (x < box[0] || x > box[2]) { 124 122 return false; 125 123 } 126 124 127 if (y < = box[1] || y >=box[3]) {125 if (y < box[1] || y > box[3]) { 128 126 return false; 129 127 } 130 128 } 129 130 System.out.println(dir.getAbsolutePath() + " " + name); 131 131 132 132 return true; -
trunk/geowebcache/src/main/java/org/geowebcache/layer/GridCalculator.java
r407 r422 190 190 } 191 191 192 public int[][] getGridBounds() { 193 int[][] ret = new int[boundsGridLevels.length][boundsGridLevels[0].length]; 194 195 for(int i=0; i<boundsGridLevels.length; i++) { 196 ret[i] = boundsGridLevels[i].clone(); 197 } 198 199 return ret; 200 } 201 192 202 /** 193 203 * Determines the location in a three dimensional grid based on WMS … … 236 246 retVals[0] = (int) Math.round(xLoc); 237 247 double absdiff = Math.abs(retVals[0]*tileWidth - xdiff); 238 239 // This doesn't work too great240 // http://localhost:8080/geowebcache/service/wms?LAYERS=topp%3Aopen_space&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=-8238077.159316406,4955673.447285157,-8218509.280078124,4965241.326523438&WIDTH=256&HEIGHT=256241 248 if(absdiff > 0.00005 && (absdiff / tileWidth) > 0.05) { 242 249 throw new BadTileException("Your bounds in the x direction are offset" … … 515 522 } 516 523 524 /** 525 * Expands the 2-dim array with bounds to cover complete metatiles 526 * 527 * Note that these may exceed the bounds of the layer. 528 * 529 * @param gridBounds 530 * @param reqBounds 531 * @param meta 532 * @return 533 */ 534 public static int[][] expandBoundsToMetaTiles(int[][] gridBounds, int[][] reqBounds, int[] meta) { 535 int[][] ret = new int[reqBounds.length][reqBounds[0].length]; 536 537 for (int i = 0; i < reqBounds.length; i++) { 538 // Go down 539 ret[i][0] = (reqBounds[i][0] - (reqBounds[i][0] % meta[0])); 540 ret[i][1] = (reqBounds[i][1] - (reqBounds[i][1] % meta[1])); 541 542 // Go up 543 ret[i][2] = (reqBounds[i][2] - (reqBounds[i][2] % meta[0]) + meta[0] - 1); 544 ret[i][3] = (reqBounds[i][3] - (reqBounds[i][3] % meta[1]) + meta[1] - 1); 545 546 // Then check against grid 547 //if(ret[i][0] < gridBounds[i][0]) { 548 // ret[i][0] = 0; 549 //} 550 //if(ret[i][1] < gridBounds[i][1]) { 551 // ret[i][1] = 0; 552 //} 553 //if(ret[i][2] > gridBounds[i][2]) { 554 // ret[i][2] = gridBounds[i][2]; 555 //} 556 //if(ret[i][3] > gridBounds[i][3]) { 557 // ret[i][3] = gridBounds[i][3]; 558 //} 559 } 560 561 return ret; 562 } 563 517 564 public static double[] get900913Resolutions() { 518 565 return GridCalculator.RESOLUTIONS900913; -
trunk/geowebcache/src/main/java/org/geowebcache/rest/TruncateTask.java
r418 r422 21 21 import org.geowebcache.GeoWebCacheException; 22 22 import org.geowebcache.cache.Cache; 23 import org.geowebcache.layer.GridCalculator; 23 24 import org.geowebcache.layer.TileLayer; 24 25 import org.geowebcache.mime.MimeType; … … 50 51 } 51 52 53 // Check if MimeType supports metatiling, in which case 54 // we may have to throw a wider net 55 MimeType mimeType = null; 56 if(req.getMimeFormat() != null && req.getMimeFormat().length() > 0) { 57 mimeType = MimeType.createFromFormat(req.getMimeFormat()); 58 59 int[] metaFactors = tl.getMetaTilingFactors(); 60 61 int gridBounds[][] = tl.getGrid(req.getSRS()).getGridCalculator().getGridBounds(); 62 63 if(metaFactors[0] > 1 || metaFactors[1] > 1 64 && mimeType.supportsTiling()) { 65 bounds = GridCalculator.expandBoundsToMetaTiles(gridBounds, bounds, metaFactors); 66 } 67 } 68 52 69 cache.truncate(tl, req.getSRS(), 53 70 req.getZoomStart(), req.getZoomStop(), 54 bounds, MimeType.createFromFormat(req.getMimeFormat()));71 bounds, mimeType); 55 72 } 56 73
