Changeset 8697 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r8696 r8697 110 110 111 111 for (int zoom = getMinZoom(); zoom <= getMaxZoom(); zoom++) { 112 // use well known scale set "GoogleCompatibile" from OGC WMTS spec to calculate number of tiles per zoom level 113 // this makes the zoom levels "glued" to standard TMS zoom levels 114 degreesPerTile[zoom] = (SCALE_DENOMINATOR_ZOOM_LEVEL_1 / Math.pow(2, zoom - 1)) * crsScale; 112 115 TileXY maxTileIndex = latLonToTileXY(bottomRight.toCoordinate(), zoom); 113 116 tileXMax[zoom] = maxTileIndex.getXIndex(); 114 117 tileYMax[zoom] = maxTileIndex.getYIndex(); 115 // use well known scale set "GoogleCompatibile" from OGC WMTS spec to calculate number of tiles per zoom level 116 // this makes the zoom levels "glued" to standard TMS zoom levels 117 degreesPerTile[zoom] = (SCALE_DENOMINATOR_ZOOM_LEVEL_1 / Math.pow(2, zoom - 1)) * crsScale; 118 } 119 118 } 120 119 } 121 120 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r8651 r8697 36 36 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 37 37 TemplatedWMSTileSource source = new TemplatedWMSTileSource(testImageryWMS); 38 verifyMercatorTile(source, 0, 1, 2);39 38 verifyMercatorTile(source, 0, 0, 1); 40 39 verifyMercatorTile(source, 0, 0, 2); … … 126 125 TemplatedTMSTileSource verifier = new TemplatedTMSTileSource(testImageryTMS); 127 126 LatLon result = getTileLatLon(source, x, y, z); 128 LatLon expected = new LatLon(verifier.tileYToLat(y, z - 1), verifier.tileXToLon(x, z - 1)); // 129 assertTrue("result: " + result.toDisplayString() + " osmMercator: " + expected.toDisplayString(), result.equalsEpsilon(expected)); 127 LatLon expected = new LatLon(verifier.tileYToLat(y, z - 1), verifier.tileXToLon(x, z - 1)); 128 assertEquals(expected.lat(), result.lat(), 1e-4); 129 assertEquals(expected.lon(), result.lon(), 1e-4); 130 //assertTrue("result: " + result.toDisplayString() + " osmMercator: " + expected.toDisplayString(), result.equalsEpsilon(expected)); 130 131 LatLon tileCenter = new Bounds(result, getTileLatLon(source, x+1, y+1, z)).getCenter(); 131 132 TileXY backwardsResult = source.latLonToTileXY(tileCenter.toCoordinate(), z); … … 136 137 private void verifyLocation(TemplatedWMSTileSource source, LatLon location) { 137 138 for (int z = source.getMaxZoom(); z > source.getMinZoom() + 1; z--) { 138 verifyLocation(source, location, z); 139 if (source.getTileXMax(z) != source.getTileXMin(z) && source.getTileYMax(z) != source.getTileYMin(z)) { 140 // do the tests only where there is more than one tile 141 verifyLocation(source, location, z); 142 } 139 143 } 140 144 }
Note:
See TracChangeset
for help on using the changeset viewer.