Changeset 8569 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r8568 r8569 162 162 private double crsScale; 163 163 private TransferMode transferMode; 164 private String style = ""; 164 165 165 166 /** … … 374 375 .replaceAll("\\{TileMatrix\\}", tileMatrix.identifier) 375 376 .replaceAll("\\{TileRow\\}", Integer.toString(tiley)) 376 .replaceAll("\\{TileCol\\}", Integer.toString(tilex)); 377 .replaceAll("\\{TileCol\\}", Integer.toString(tilex)) 378 .replaceAll("\\{Style\\}", this.style); 377 379 } 378 380 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r8568 r8569 22 22 private ImageryInfo testImageryTOPO_PL = getImagery("test/data/wmts/getcapabilities-TOPO.xml"); 23 23 private ImageryInfo testImageryORTO_PL = getImagery("test/data/wmts/getcapabilities-ORTO.xml"); 24 24 private ImageryInfo testImageryWIEN = getImagery("test/data/wmts/getCapabilities-wien.xml"); 25 private ImageryInfo testImageryWALLONIE = getImagery("test/data/wmts/WMTSCapabilities-Wallonie.xml"); 25 26 26 27 @BeforeClass … … 66 67 assertEquals("TileXMax", 2, testSource.getTileXMax(2)); 67 68 assertEquals("TileYMax", 2, testSource.getTileYMax(2)); 69 assertEquals("TileXMax", 5, testSource.getTileXMax(3)); 70 assertEquals("TileYMax", 4, testSource.getTileYMax(3)); 71 72 } 73 74 @Test 75 public void testWALLONIE() throws MalformedURLException, IOException { 76 Main.setProjection(Projections.getProjectionByCode("EPSG:31370")); 77 WMTSTileSource testSource = new WMTSTileSource(testImageryWALLONIE); 78 } 79 80 @Test 81 public void testWIEN() throws MalformedURLException, IOException { 82 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 83 WMTSTileSource testSource = new WMTSTileSource(testImageryWIEN); 84 int zoomOffset = 10; 85 86 verifyMercatorTile(testSource, 0, 0, 1, zoomOffset); 87 verifyMercatorTile(testSource, 0, 0, 2, zoomOffset); 88 verifyMercatorTile(testSource, 1, 1, 2, zoomOffset); 89 for(int x = 0; x < 4; x++) { 90 for(int y = 0; y < 4; y++) { 91 verifyMercatorTile(testSource, x, y, 3, zoomOffset); 92 } 93 } 94 for(int x = 0; x < 8; x++) { 95 for(int y = 0; y < 4; y++) { 96 verifyMercatorTile(testSource, x, y, zoomOffset); 97 } 98 } 99 100 verifyMercatorTile(testSource, 2<<9 - 1, 2<<8 - 1, zoomOffset); 101 102 assertEquals("TileXMax", 1, testSource.getTileXMax(1)); 103 assertEquals("TileYMax", 1, testSource.getTileYMax(1)); 104 assertEquals("TileXMax", 2, testSource.getTileXMax(2)); 105 assertEquals("TileYMax", 2, testSource.getTileYMax(2)); 68 106 assertEquals("TileXMax", 4, testSource.getTileXMax(3)); 69 107 assertEquals("TileYMax", 4, testSource.getTileYMax(3)); … … 77 115 verifyTile(new LatLon(56,12), testSource, 0, 0, 1); 78 116 verifyTile(new LatLon(56,12), testSource, 0, 0, 2); 79 verifyTile(new LatLon(51.1 323176, 16.8676823), testSource, 1, 1, 2);117 verifyTile(new LatLon(51.1268639, 16.8731360), testSource, 1, 1, 2); 80 118 81 119 assertEquals("TileXMax", 37, testSource.getTileXMax(1)); … … 117 155 118 156 private void verifyMercatorTile(WMTSTileSource testSource, int x, int y, int z) { 157 verifyMercatorTile(testSource, x, y, z, -1); 158 } 159 160 private void verifyMercatorTile(WMTSTileSource testSource, int x, int y, int z, int zoomOffset) { 119 161 TemplatedTMSTileSource verifier = new TemplatedTMSTileSource(testImageryTMS); 120 162 LatLon result = new LatLon(testSource.tileXYToLatLon(x, y, z)); 121 LatLon expected = new LatLon(verifier.tileXYToLatLon(x, y, z -1));163 LatLon expected = new LatLon(verifier.tileXYToLatLon(x, y, z + zoomOffset)); 122 164 System.out.println(z + "/" + x + "/" + y + " - result: " + result.toDisplayString() + " osmMercator: " + expected.toDisplayString()); 123 165 assertEquals("Longitude" , expected.lon(), result.lon(), 1e-04);
Note:
See TracChangeset
for help on using the changeset viewer.