Changeset 36138 in osm for applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
- Timestamp:
- 2023-09-15T16:54:54+02:00 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
r35190 r36138 2 2 package org.openstreetmap.gui.jmapviewer.tilesources; 3 3 4 import java.awt.Point;5 4 import java.io.IOException; 6 5 import java.security.MessageDigest; … … 11 10 import java.util.Map.Entry; 12 11 import java.util.Set; 13 12 import java.util.logging.Level; 13 14 import org.openstreetmap.gui.jmapviewer.FeatureAdapter; 14 15 import org.openstreetmap.gui.jmapviewer.JMapViewer; 15 16 import org.openstreetmap.gui.jmapviewer.OsmMercator; 16 import org.openstreetmap.gui.jmapviewer.Tile;17 import org.openstreetmap.gui.jmapviewer.TileXY;18 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;19 17 20 18 /** … … 40 38 * @param info description of the Tile Source 41 39 */ 42 p ublicAbstractTMSTileSource(TileSourceInfo info) {40 protected AbstractTMSTileSource(TileSourceInfo info) { 43 41 this.name = info.getName(); 44 42 this.baseUrl = info.getUrl(); … … 90 88 91 89 /** 90 * Get the tile path after the URL 92 91 * @param zoom level of the tile 93 92 * @param tilex tile number in x axis 94 93 * @param tiley tile number in y axis 95 * @return String contain g path part of URL of the tile94 * @return String containing path part of URL of the tile 96 95 * @throws IOException when subclass cannot return the tile URL 97 96 */ … … 126 125 } 127 126 return tileSize; 128 }129 130 @Override131 public Point latLonToXY(ICoordinate point, int zoom) {132 return latLonToXY(point.getLat(), point.getLon(), zoom);133 }134 135 @Override136 public ICoordinate xyToLatLon(Point point, int zoom) {137 return xyToLatLon(point.x, point.y, zoom);138 }139 140 @Override141 public TileXY latLonToTileXY(ICoordinate point, int zoom) {142 return latLonToTileXY(point.getLat(), point.getLon(), zoom);143 }144 145 @Override146 public ICoordinate tileXYToLatLon(TileXY xy, int zoom) {147 return tileXYToLatLon(xy.getXIndex(), xy.getYIndex(), zoom);148 }149 150 @Override151 public ICoordinate tileXYToLatLon(Tile tile) {152 return tileXYToLatLon(tile.getXtile(), tile.getYtile(), tile.getZoom());153 127 } 154 128 … … 191 165 if (noTileChecksums != null && content != null) { 192 166 for (Entry<String, Set<String>> searchEntry: noTileChecksums.entrySet()) { 193 MessageDigest md = null;167 MessageDigest md; 194 168 try { 195 169 md = MessageDigest.getInstance(searchEntry.getKey()); 196 170 } catch (NoSuchAlgorithmException e) { 171 FeatureAdapter.getLogger(this.getClass()).log(Level.FINER, searchEntry.getKey() + " algorithm was not found", e); 197 172 break; 198 173 } … … 201 176 202 177 char[] hexChars = new char[len * 2]; 203 for (int i = 0, j = 0; i < len; i++) {204 final int v = byteDigest[i];178 int j = 0; 179 for (final int v : byteDigest) { 205 180 int vn = (v & 0xf0) >> 4; 206 hexChars[j++] = (char) (vn + (vn >= 10 ? 'a' -10 : '0'));181 hexChars[j++] = (char) (vn + (vn >= 10 ? 'a' - 10 : '0')); 207 182 vn = (v & 0xf); 208 hexChars[j++] = (char) (vn + (vn >= 10 ? 'a' -10 : '0'));183 hexChars[j++] = (char) (vn + (vn >= 10 ? 'a' - 10 : '0')); 209 184 } 210 185 for (String val: searchEntry.getValue()) {
Note:
See TracChangeset
for help on using the changeset viewer.