- Timestamp:
- 2018-12-08T01:04:03+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r14516 r14519 13 13 import java.util.Set; 14 14 import java.util.TreeMap; 15 import java.util.stream.Collectors; 15 16 16 17 import org.junit.Rule; … … 27 28 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds; 28 29 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 30 import org.openstreetmap.josm.data.imagery.Shape; 29 31 import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource; 30 32 import org.openstreetmap.josm.data.imagery.WMSEndpointTileSource; 31 33 import org.openstreetmap.josm.data.imagery.WMTSTileSource; 32 34 import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException; 35 import org.openstreetmap.josm.data.projection.Projection; 33 36 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 34 37 import org.openstreetmap.josm.testutils.JOSMTestRules; 38 import org.openstreetmap.josm.tools.Geometry; 35 39 import org.openstreetmap.josm.tools.HttpClient; 36 40 import org.openstreetmap.josm.tools.HttpClient.Response; … … 102 106 } 103 107 108 private static LatLon getCenter(ImageryBounds bounds) { 109 List<Shape> shapes = bounds.getShapes(); 110 Projection proj = ProjectionRegistry.getProjection(); 111 return shapes != null && shapes.size() > 1 112 ? proj.eastNorth2latlon( 113 Geometry.getCentroidEN(shapes.get(0).getPoints().stream() 114 .map(CoordinateConversion::coorToLL) 115 .map(proj::latlon2eastNorth) 116 .collect(Collectors.toList()))) 117 : bounds.getCenter(); 118 } 119 104 120 private void checkEntry(ImageryInfo info) { 105 121 Logging.info("Checking "+ info); … … 121 137 ImageryBounds bounds = info.getBounds(); 122 138 // Some imagery sources do not define tiles at (0,0). So pickup Greenwich Royal Observatory for global sources 123 ICoordinate center = CoordinateConversion.llToCoor(bounds != null ? bounds.getCenter() : new LatLon(51.47810, -0.00170));139 ICoordinate center = CoordinateConversion.llToCoor(bounds != null ? getCenter(bounds) : new LatLon(51.47810, -0.00170)); 124 140 AbstractTileSource tileSource = getTileSource(info); 125 141 checkTileUrl(info, tileSource, center, info.getMinZoom());
Note:
See TracChangeset
for help on using the changeset viewer.