Changeset 8542 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2015-06-30T13:57:53+02:00 (9 years ago)
Author:
wiktorn
Message:

Add warnings about supported projections for WMS layers

File:
1 edited

Legend:

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

    r8530 r8542  
    4848            }
    4949        }
     50        verifyTileSquarness(source, 2270, 1323, 12);
    5051        verifyLocation(source, new LatLon(53.5937132, 19.5652017));
    5152        verifyLocation(source, new LatLon(53.501565692302854, 18.54455233898721));
     
    6263        verifyTileSquarness(source, 2, 2, 2);
    6364        verifyTileSquarness(source, 150, 20, 18);
     65        verifyTileSquarness(source, 2270, 1323, 12);
    6466    }
    6567
     
    7476        verifyTileSquarness(source, 2, 2, 2);
    7577        verifyTileSquarness(source, 150, 20, 18);
    76 
     78        verifyTileSquarness(source, 2270, 1323, 12);
    7779    }
    7880
     
    112114    private void verifyTileSquarness(TemplatedWMSTileSource source, int x, int y, int z) {
    113115        Projection proj = Main.getProjection();
    114         EastNorth min = proj.latlon2eastNorth(getTileLatLon(source, x, y, z));
    115         EastNorth max = proj.latlon2eastNorth(getTileLatLon(source, x + 1, y + 1, z));
    116         double y_size = Math.abs(min.getY() - max.getY());
    117         double x_size = Math.abs(min.getX() - max.getX());
     116        /**
     117         * t1 | t2
     118         * -------
     119         * t3 | t4
     120         */
     121        EastNorth t1 = proj.latlon2eastNorth(getTileLatLon(source, x, y, z));
     122        EastNorth t2 = proj.latlon2eastNorth(getTileLatLon(source, x + 1, y, z));
     123        EastNorth t3 = proj.latlon2eastNorth(getTileLatLon(source, x, y + 1, z));
     124        EastNorth t4 = proj.latlon2eastNorth(getTileLatLon(source, x + 1, y + 1, z));
     125        double y_size = Math.abs(t1.getY() - t4.getY());
     126        double x_size = Math.abs(t1.getX() - t4.getX());
    118127        assertEquals(x_size, y_size, 1e-05);
     128        assertEquals(y_size, Math.abs(t1.getY() - t3.getY()), 1e-05);
     129        assertEquals(x_size, Math.abs(t1.getX() - t2.getX()), 1e-05);
     130
     131        t1 = source.getTileEastNorth(x, y, z);
     132        t2 = source.getTileEastNorth(x + 1, y, z);
     133        t3 = source.getTileEastNorth(x, y + 1, z);
     134        t4 = source.getTileEastNorth(x + 1, y + 1, z);
     135        y_size = Math.abs(t1.getY() - t4.getY());
     136        x_size = Math.abs(t1.getX() - t4.getX());
     137        assertEquals(x_size, y_size, 1e-05);
     138        assertEquals(y_size, Math.abs(t1.getY() - t3.getY()), 1e-05);
     139        assertEquals(x_size, Math.abs(t1.getX() - t2.getX()), 1e-05);
    119140    }
    120141
Note: See TracChangeset for help on using the changeset viewer.