Changeset 8584 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2015-07-08T20:59:09+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r8570 r8584 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertTrue; 5 6 6 7 import java.io.File; … … 10 11 import org.junit.BeforeClass; 11 12 import org.junit.Test; 13 import org.openstreetmap.gui.jmapviewer.TileXY; 12 14 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 13 15 import org.openstreetmap.josm.JOSMFixture; 14 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.data.Bounds; 15 18 import org.openstreetmap.josm.data.coor.LatLon; 16 19 import org.openstreetmap.josm.data.projection.Projections; … … 69 72 assertEquals("TileXMax", 5, testSource.getTileXMax(3)); 70 73 assertEquals("TileYMax", 4, testSource.getTileYMax(3)); 74 71 75 } 72 76 … … 75 79 Main.setProjection(Projections.getProjectionByCode("EPSG:31370")); 76 80 WMTSTileSource testSource = new WMTSTileSource(testImageryWALLONIE); 77 } 81 Bounds wallonieBounds = new Bounds( 82 new LatLon(49.485372459967245, 2.840548314430268), 83 new LatLon(50.820959517561256, 6.427849693016202) 84 ); 85 verifyBounds(wallonieBounds, testSource, 10, 20324, 17724); 86 87 } 88 89 private void verifyBounds(Bounds bounds, WMTSTileSource testSource, int z, int x, int y) { 90 LatLon ret = new LatLon(testSource.tileXYToLatLon(y, y, z)); 91 assertTrue(ret.toDisplayString() + " doesn't lie within: " + bounds.toString(), bounds.contains(ret)); 92 } 93 94 78 95 79 96 @Test … … 83 100 int zoomOffset = 10; 84 101 102 // Linz - 11/1105/709.png 85 103 verifyMercatorTile(testSource, 0, 0, 1, zoomOffset); 104 verifyMercatorTile(testSource, 1105, 709, 2, zoomOffset); 105 verifyMercatorTile(testSource, 1, 1, 1, zoomOffset); 106 verifyMercatorTile(testSource, 2, 2, 1, zoomOffset); 86 107 verifyMercatorTile(testSource, 0, 0, 2, zoomOffset); 87 108 verifyMercatorTile(testSource, 1, 1, 2, zoomOffset); 88 for (int x = 0; x < 4; x++) { 89 for (int y = 0; y < 4; y++) { 109 110 111 LatLon ll = new LatLon(testSource.tileXYToLatLon(500, 500, 1)); 112 113 TileXY xy = testSource.latLonToTileXY(new LatLon(48.21, 14.24).toCoordinate(), 1); 114 assertTrue("X index is negative: " + xy.getXIndex(), xy.getXIndex() > 0); 115 assertTrue(xy.getYIndex() > 0); 116 for(int x = 0; x < 4; x++) { 117 for(int y = 0; y < 4; y++) { 90 118 verifyMercatorTile(testSource, x, y, 3, zoomOffset); 91 119 } 92 120 } 93 for 94 for 121 for(int x = 0; x < 8; x++) { 122 for(int y = 0; y < 4; y++) { 95 123 verifyMercatorTile(testSource, x, y, zoomOffset); 96 124 } 97 125 } 98 126 99 verifyMercatorTile(testSource, 2 << 9 - 1, 2 <<8 - 1, zoomOffset);127 verifyMercatorTile(testSource, 2<<9 - 1, 2<<8 - 1, zoomOffset); 100 128 101 129 assertEquals("TileXMax", 1, testSource.getTileXMax(1)); … … 122 150 assertEquals("TileYMax", 74, testSource.getTileYMax(3)); 123 151 assertEquals( 124 "http://mapy.geoportal.gov.pl/wss/service/WMTS/guest/wmts/TOPO?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=MAPA " 125 + "TOPOGRAFICZNA&STYLE=&FORMAT=image/jpeg&TileMatrixSet=EPSG:4326&TileMatrix=EPSG:4326:0&TileRow=1&TileCol=1", 152 "http://mapy.geoportal.gov.pl/wss/service/WMTS/guest/wmts/TOPO?SERVICE=WMTS&REQUEST=GetTile&" 153 + "VERSION=1.0.0&LAYER=MAPA TOPOGRAFICZNA&STYLE=&FORMAT=image/jpeg&tileMatrixSet=EPSG:4326&" 154 + "tileMatrix=EPSG:4326:0&tileRow=1&tileCol=1", 126 155 testSource.getTileUrl(1, 1, 1)); 127 156 }
Note:
See TracChangeset
for help on using the changeset viewer.