Ignore:
Timestamp:
2015-07-04T23:29:53+02:00 (9 years ago)
Author:
wiktorn
Message:

Add tests for Wallonie and Wien, fixed Style substitution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java

    r8568 r8569  
    2222    private ImageryInfo testImageryTOPO_PL = getImagery("test/data/wmts/getcapabilities-TOPO.xml");
    2323    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");
    2526
    2627    @BeforeClass
     
    6667        assertEquals("TileXMax", 2, testSource.getTileXMax(2));
    6768        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));
    68106        assertEquals("TileXMax", 4, testSource.getTileXMax(3));
    69107        assertEquals("TileYMax", 4, testSource.getTileYMax(3));
     
    77115        verifyTile(new LatLon(56,12), testSource, 0, 0, 1);
    78116        verifyTile(new LatLon(56,12), testSource, 0, 0, 2);
    79         verifyTile(new LatLon(51.1323176, 16.8676823), testSource, 1, 1, 2);
     117        verifyTile(new LatLon(51.1268639, 16.8731360), testSource, 1, 1, 2);
    80118
    81119        assertEquals("TileXMax", 37, testSource.getTileXMax(1));
     
    117155
    118156    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) {
    119161        TemplatedTMSTileSource verifier = new TemplatedTMSTileSource(testImageryTMS);
    120162        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));
    122164        System.out.println(z + "/" + x + "/" + y + " - result: " + result.toDisplayString() + " osmMercator: " +  expected.toDisplayString());
    123165        assertEquals("Longitude" , expected.lon(), result.lon(), 1e-04);
Note: See TracChangeset for help on using the changeset viewer.