Changeset 16636 in josm for trunk/test/unit/org
- Timestamp:
- 2020-06-14T17:17:17+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/imagery
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r16635 r16636 132 132 133 133 verifyTileSquareness(source, 0, 1, 4); 134 verifyLocation(source, new LatLon(60, 18. 1), 3);135 verifyLocation(source, new LatLon(60, 18. 1));134 verifyLocation(source, new LatLon(60, 18.05008), 3); 135 verifyLocation(source, new LatLon(60, 18.05008)); 136 136 } 137 137 … … 171 171 TemplatedWMSTileSource ts = new TemplatedWMSTileSource(testImageryWMS, projection); 172 172 assertEquals("https://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery_Dates/MapServer/WMSServer?SERVICE=WMS&" 173 + "VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&BBOX=-13 49.9999381,539.9999691,-989.9999536,899.9999536&WIDTH=512&"173 + "VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&BBOX=-1350.0000000,540.0000000,-990.0000000,900.0000000&WIDTH=512&" 174 174 + "HEIGHT=512&LAYERS=0&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE", 175 175 ts.getTileUrl(1, 2, 3)); 176 176 assertEquals("https://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery_Dates/MapServer/WMSServer?SERVICE=WMS&" 177 + "VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&BBOX=- 89.9999923,-0.0000077,0.0000039,89.9999884&WIDTH=512&HEIGHT=512&"177 + "VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&BBOX=-90.0000000,0.0000000,-0.0000000,90.0000000&WIDTH=512&HEIGHT=512&" 178 178 + "LAYERS=0&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE", 179 179 ts.getTileUrl(3, 2, 1)); … … 188 188 assertEquals("https://services.slip.wa.gov.au/public/services/SLIP_Public_Services/Transport/MapServer/WMSServer?LAYERS=8&" 189 189 + "TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG:4326&" 190 + "BBOX=5 39.9999691,-1349.9999381,899.9999536,-989.9999536&WIDTH=512&HEIGHT=512",190 + "BBOX=540.0000000,-1350.0000000,900.0000000,-990.0000000&WIDTH=512&HEIGHT=512", 191 191 ts.getTileUrl(1, 2, 3)); 192 192 assertEquals("https://services.slip.wa.gov.au/public/services/SLIP_Public_Services/Transport/MapServer/WMSServer?LAYERS=8&" 193 193 + "TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG:4326&" 194 + "BBOX= -0.0000077,-89.9999923,89.9999884,0.0000039&WIDTH=512&HEIGHT=512", ts.getTileUrl(3, 2, 1));194 + "BBOX=0.0000000,-90.0000000,90.0000000,-0.0000000&WIDTH=512&HEIGHT=512", ts.getTileUrl(3, 2, 1)); 195 195 } 196 196 … … 231 231 tileIndex.getYIndex() <= source.getTileYMax(z)); 232 232 233 EastNorth locationEN = projection.latlon2eastNorth(location); 234 EastNorth x1 = projection.latlon2eastNorth(getTileLatLon(source, tileIndex, z)); 235 EastNorth x2 = projection.latlon2eastNorth(getTileLatLon(source, tileIndex.getXIndex() + 1, tileIndex.getYIndex() + 1, z)); 233 ICoordinate x1 = source.tileXYToLatLon(tileIndex.getXIndex(), tileIndex.getYIndex(), z); 234 ICoordinate x2 = source.tileXYToLatLon(tileIndex.getXIndex() + 1, tileIndex.getYIndex() + 1, z); 235 if (x1.getLon() > x2.getLon()) { 236 x2.setLon(180); 237 } 238 Bounds bounds = new Bounds(x1.getLat(), x1.getLon(), true); 239 bounds.extend(x2.getLat(), x2.getLon()); 236 240 // test that location is within tile bounds 237 assertTrue(locationEN.toString() + " not within " + bboxStr(x1, x2) + 238 " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex(), 239 isWithin(locationEN, x1, x2)); 241 assertTrue(location + " not within " + bounds + " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex(), 242 bounds.contains(location)); 240 243 verifyTileSquareness(source, tileIndex.getXIndex(), tileIndex.getYIndex(), z); 241 }242 243 private static boolean isWithin(EastNorth point, EastNorth topLeft, EastNorth bottomRight) {244 return Math.min(topLeft.east(), bottomRight.east()) <= point.east() &&245 point.east() <= Math.max(topLeft.east(), bottomRight.east()) &&246 Math.min(topLeft.north(), bottomRight.north()) <= point.north() &&247 point.north() <= Math.max(topLeft.north(), bottomRight.north());248 }249 250 private static String bboxStr(EastNorth x1, EastNorth x2) {251 return "[" + x1.east() +", " + x1.north() + ", " + x2.east() + ", " + x2.north() +"]";252 }253 254 private LatLon getTileLatLon(TemplatedWMSTileSource source, TileXY tileIndex, int z) {255 return getTileLatLon(source, tileIndex.getXIndex(), tileIndex.getYIndex(), z);256 244 } 257 245 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java
r16424 r16636 83 83 + "REQUEST=GetMap&LAYERS=single_node_in_way&STYLES=default&" 84 84 + "CRS=EPSG:3857&WIDTH=512&HEIGHT=512&" 85 + "BBOX=2003750 6.6204108,-60112521.5836107,60112521.5836107,-20037506.6204108", tileSource.getTileUrl(1, 1, 1));85 + "BBOX=20037508.3427893,-60112525.0283678,60112525.0283678,-20037508.3427893", tileSource.getTileUrl(1, 1, 1)); 86 86 } 87 87 … … 141 141 + "WIDTH=512&" 142 142 + "HEIGHT=512&" 143 + "BBOX=2003750 6.6204108,-60112521.5836107,60112521.5836107,-20037506.6204108",143 + "BBOX=20037508.3427893,-60112525.0283678,60112525.0283678,-20037508.3427893", 144 144 tileSource.getTileUrl(1, 1, 1)); 145 145 }
Note:
See TracChangeset
for help on using the changeset viewer.