Changeset 8659 in josm for trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
- Timestamp:
- 2015-08-12T23:10:17+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r8652 r8659 43 43 private int[] tileXMax; 44 44 private int[] tileYMax; 45 private double[] degreesPerTile; 45 46 46 47 private static final Pattern PATTERN_HEADER = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}"); … … 95 96 tileXMax = new int[getMaxZoom() + 1]; 96 97 tileYMax = new int[getMaxZoom() + 1]; 98 degreesPerTile = new double[getMaxZoom() +1]; 97 99 for (int zoom = getMinZoom(); zoom <= getMaxZoom(); zoom++) { 98 100 TileXY maxTileIndex = latLonToTileXY(bottomRight.toCoordinate(), zoom); 99 101 tileXMax[zoom] = maxTileIndex.getXIndex(); 100 102 tileYMax[zoom] = maxTileIndex.getYIndex(); 101 } 103 int tilesPerZoom = (int) Math.pow(2d, zoom - 1); 104 degreesPerTile[zoom] = Math.max( 105 Math.abs(max.getY() - min.getY()) / tilesPerZoom, 106 Math.abs(max.getX() - min.getX()) / tilesPerZoom 107 ); 108 109 } 110 102 111 } 103 112 … … 382 391 383 392 private double getDegreesPerTile(int zoom) { 384 Projection proj = Main.getProjection(); 385 EastNorth min = proj.latlon2eastNorth(worldBounds.getMin()); 386 EastNorth max = proj.latlon2eastNorth(worldBounds.getMax()); 387 388 int tilesPerZoom = (int) Math.pow(2d, zoom - 1); 389 return Math.max( 390 Math.abs(max.getY() - min.getY()) / tilesPerZoom, 391 Math.abs(max.getX() - min.getX()) / tilesPerZoom 392 ); 393 return degreesPerTile[zoom]; 393 394 } 394 395
Note:
See TracChangeset
for help on using the changeset viewer.