Changeset 14507 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r14273 r14507 335 335 if (this.layers.isEmpty()) 336 336 throw new IllegalArgumentException(tr("No layers defined by getCapabilities document: {0}", info.getUrl())); 337 } 338 339 /** 340 * Creates a tile source based on imagery info and initializes it with given projection. 341 * @param info imagery info 342 * @param projection projection to be used by this TileSource 343 * @throws IOException if any I/O error occurs 344 * @throws WMTSGetCapabilitiesException when document didn't contain any layers 345 * @throws IllegalArgumentException if any other error happens for the given imagery info 346 * @since 14507 347 */ 348 public WMTSTileSource(ImageryInfo info, Projection projection) throws IOException, WMTSGetCapabilitiesException { 349 this(info); 350 initProjection(projection); 337 351 } 338 352 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r14499 r14507 16 16 import org.junit.Rule; 17 17 import org.junit.Test; 18 import org.openstreetmap.gui.jmapviewer.TileXY; 19 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; 18 20 import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource; 19 21 import org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource; 20 22 import org.openstreetmap.gui.jmapviewer.tilesources.ScanexTileSource; 21 23 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 24 import org.openstreetmap.josm.data.coor.LatLon; 25 import org.openstreetmap.josm.data.imagery.CoordinateConversion; 22 26 import org.openstreetmap.josm.data.imagery.ImageryInfo; 27 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds; 23 28 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 24 29 import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource; … … 73 78 } 74 79 80 private void checkTileUrl(ImageryInfo info, AbstractTileSource tileSource, ICoordinate center, int zoom) 81 throws IOException { 82 TileXY xy = tileSource.latLonToTileXY(center, zoom); 83 checkUrl(info, tileSource.getTileUrl(zoom, xy.getXIndex(), xy.getYIndex())); 84 } 85 75 86 private void checkEntry(ImageryInfo info) { 76 87 Logging.info("Checking "+ info); … … 90 101 91 102 try { 92 getTileSource(info); 103 ImageryBounds bounds = info.getBounds(); 104 ICoordinate center = CoordinateConversion.llToCoor(bounds != null ? bounds.getCenter() : LatLon.ZERO); 105 AbstractTileSource tileSource = getTileSource(info); 106 checkTileUrl(info, tileSource, center, info.getMinZoom()); 107 checkTileUrl(info, tileSource, center, info.getMaxZoom()); 93 108 } catch (IOException | WMTSGetCapabilitiesException | IllegalArgumentException e) { 94 109 addError(info, e.toString()); … … 113 128 return new WMSEndpointTileSource(info, ProjectionRegistry.getProjection()); 114 129 case WMTS: 115 return new WMTSTileSource(info); 130 return new WMTSTileSource(info, ProjectionRegistry.getProjection()); 116 131 default: 117 132 throw new UnsupportedOperationException(info.toString());
Note:
See TracChangeset
for help on using the changeset viewer.