Changeset 11257 in josm for trunk/test/unit


Ignore:
Timestamp:
2016-11-15T21:46:24+01:00 (8 years ago)
Author:
wiktorn
Message:

Make DefaultLayer a type that can have layerName and tileMatrixSet

As WMTS specification gives possibility to have many tileMatrixSet's for
one layer and projection, default layer must specify both - layerName
and tileMatrixSet.

Accommodate to that fact layer selection dialogs and internal
computations in WMTS TileSource.

Closes: #13975

File:
1 edited

Legend:

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

    r10945 r11257  
    88import java.io.IOException;
    99import java.net.MalformedURLException;
     10import java.util.ArrayList;
     11import java.util.Collection;
    1012
    1113import org.junit.Ignore;
     
    3840    private ImageryInfo testDuplicateTags = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-identifier.xml");
    3941    private ImageryInfo testMissingStyleIdentifer = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-missing-style-identifier.xml");
     42    private ImageryInfo testMultipleTileMatrixForLayer = getImagery(TestUtils.getTestDataRoot() +
     43            "wmts/bug13975-multiple-tile-matrices-for-one-layer-projection.xml");
    4044
    4145    /**
     
    263267    }
    264268
     269    @Test
     270    public void testForMultipleTileMatricesForOneLayerProjection() throws Exception {
     271        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
     272        ImageryInfo copy = new ImageryInfo(testMultipleTileMatrixForLayer);
     273        Collection<DefaultLayer> defaultLayers = new ArrayList<>(1);
     274        defaultLayers.add(new WMTSDefaultLayer("Mashhad_BaseMap_1", "default028mm"));
     275        copy.setDefaultLayers(defaultLayers);
     276        WMTSTileSource testSource = new WMTSTileSource(copy);
     277        testSource.initProjection(Main.getProjection());
     278        assertEquals(
     279                "http://188.253.0.155:6080/arcgis/rest/services/Mashhad_BaseMap_1/MapServer/WMTS/tile/1.0.0/Mashhad_BaseMap_1"
     280                        + "/default/default028mm/1/3/2",
     281                testSource.getTileUrl(1, 2, 3)
     282                );
     283    }
     284
    265285    private void verifyTile(LatLon expected, WMTSTileSource source, int x, int y, int z) {
    266286        LatLon ll = new LatLon(source.tileXYToLatLon(x, y, z));
     
    277297        LatLon result = new LatLon(testSource.tileXYToLatLon(x, y, z));
    278298        LatLon expected = new LatLon(verifier.tileXYToLatLon(x, y, z + zoomOffset));
    279         //System.out.println(z + "/" + x + "/" + y + " - result: " + result.toDisplayString() + " osmMercator: " +  expected.toDisplayString());
    280299        assertEquals("Longitude", LatLon.normalizeLon(expected.lon() - result.lon()), 0.0, 1e-04);
    281300        assertEquals("Latitude", expected.lat(), result.lat(), 1e-04);
Note: See TracChangeset for help on using the changeset viewer.