Changeset 31573 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2015-09-21T02:20:19+02:00 (9 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r31541 r31573 457 457 Point p = tileSource.latLonToXY(lat, lon, zoom); 458 458 int y = p.y - center.y - getHeight() / 2; 459 if (checkOutside && (y < 0 || y > getHeight())) {460 return null;461 }462 return y;463 }464 465 /**466 * Calculates the position on the map of a given coordinate467 *468 * @param lat Latitude469 * @param offset Offset respect Latitude470 * @param checkOutside check if the point is outside the displayed area471 * @return Integer the radius in pixels472 * @deprecated use {@link #getLatOffset(double, double, double, boolean)}473 */474 @Deprecated475 public Integer getLatOffset(double lat, double offset, boolean checkOutside) {476 int y = tileSource.latToY(lat + offset, zoom);477 y -= center.y - getHeight() / 2;478 459 if (checkOutside && (y < 0 || y > getHeight())) { 479 460 return null; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r31522 r31573 18 18 19 19 /** 20 * Specifies the different mechanisms for detecting updated tiles21 * respectively only download newer tiles than those stored locally.22 *23 * <ul>24 * <li>{@link #IfNoneMatch} Server provides ETag header entry for all tiles25 * and <b>supports</b> conditional download via <code>If-None-Match</code>26 * header entry.</li>27 * <li>{@link #ETag} Server provides ETag header entry for all tiles but28 * <b>does not support</b> conditional download via29 * <code>If-None-Match</code> header entry.</li>30 * <li>{@link #IfModifiedSince} Server provides Last-Modified header entry31 * for all tiles and <b>supports</b> conditional download via32 * <code>If-Modified-Since</code> header entry.</li>33 * <li>{@link #LastModified} Server provides Last-Modified header entry for34 * all tiles but <b>does not support</b> conditional download via35 * <code>If-Modified-Since</code> header entry.</li>36 * <li>{@link #None} The server does not support any of the listed37 * mechanisms.</li>38 * </ul>39 *40 * @deprecated not used anymore41 */42 @Deprecated43 enum TileUpdate {44 IfNoneMatch, ETag, IfModifiedSince, LastModified, None45 }46 47 /**48 20 * Specifies the maximum zoom value. The number of zoom levels is [0.. 49 21 * {@link #getMaxZoom()}]. … … 62 34 */ 63 35 int getMinZoom(); 64 65 /**66 * @return The supported tile update mechanism67 * @see TileUpdate68 */69 TileUpdate getTileUpdate();70 36 71 37 /** … … 131 97 132 98 /** 133 * Transform longitude to pixelspace.134 * @param aLongitude longitude135 * @param aZoomlevel zoom level136 * @return [0..2^Zoomlevel*TILE_SIZE[137 * @deprecated use {@link #latLonToXY(double, double, int)} instead138 */139 @Deprecated140 int lonToX(double aLongitude, int aZoomlevel);141 142 /**143 * Transforms latitude to pixelspace.144 * @param aLat latitude145 * @param aZoomlevel zoom level146 * @return [0..2^Zoomlevel*TILE_SIZE[147 * @deprecated use {@link #latLonToXY(double, double, int)} instead148 */149 @Deprecated150 int latToY(double aLat, int aZoomlevel);151 152 /**153 99 * @param lon longitude 154 100 * @param lat latitude … … 166 112 167 113 /** 168 * Transforms pixel coordinate X to longitude169 * @param aX X coordinate170 * @param aZoomlevel zoom level171 * @return ]-180..180[172 * @deprecated use {@link #xyToLatLon(int, int, int)} instead173 */174 @Deprecated175 double XToLon(int aX, int aZoomlevel);176 177 /**178 * Transforms pixel coordinate Y to latitude.179 * @param aY Y coordinate180 * @param aZoomlevel zoom level181 * @return [MIN_LAT..MAX_LAT]182 * @deprecated use {@link #xyToLatLon(int, int, int)} instead183 */184 @Deprecated185 double YToLat(int aY, int aZoomlevel);186 187 /**188 114 * @param point point 189 115 * @param zoom zoom level … … 202 128 203 129 /** 204 * Transforms longitude to X tile coordinate.205 * @param lon longitude206 * @param zoom zoom level207 * @return [0..2^Zoomlevel[208 * @deprecated use {@link #latLonToTileXY(double, double, int)} instead209 */210 @Deprecated211 double lonToTileX(double lon, int zoom);212 213 /**214 * Transforms latitude to Y tile coordinate.215 * @param lat latitude216 * @param zoom zoom level217 * @return [0..2^Zoomlevel[218 * @deprecated use {@link #latLonToTileXY(double, double, int)} instead219 */220 @Deprecated221 double latToTileY(double lat, int zoom);222 223 /**224 130 * @param lon longitude 225 131 * @param lat latitude … … 236 142 */ 237 143 TileXY latLonToTileXY(ICoordinate point, int zoom); 238 239 /**240 * Transforms tile X coordinate to longitude.241 * @param x X coordinate242 * @param zoom zoom level243 * @return ]-180..180[244 * @deprecated use {@link #tileXYToLatLon(int, int, int)} instead245 */246 @Deprecated247 double tileXToLon(int x, int zoom);248 249 /**250 * Transforms tile Y coordinate to latitude.251 * @param y Y coordinate252 * @param zoom zoom level253 * @return [MIN_LAT..MAX_LAT]254 * @deprecated use {@link #tileXYToLatLon(int, int, int)} instead255 */256 @Deprecated257 double tileYToLat(int y, int zoom);258 144 259 145 /** -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractMapQuestTileSource.java
r30900 r31573 12 12 13 13 // MapQuest logo in base64: http://developer.mapquest.com/content/osm/mq_logo.png 14 private static final String LOGO_BASE64 = 14 private static final String LOGO_BASE64 = 15 15 "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJl"+ 16 16 "YWR5ccllPAAAAZtJREFUeNpi/P//P0PPcYf/DGSAEssDjIzdx+zJ0gwDLMQqVBWyZVAStGRgBMK33x8wnH62"+ … … 28 28 29 29 private static final int NUMBER_OF_SERVERS = 4; 30 30 31 31 private int SERVER_NUM = 1; 32 32 … … 40 40 SERVER_NUM = (SERVER_NUM % NUMBER_OF_SERVERS) + 1; 41 41 return url; 42 }43 44 @Override45 public TileUpdate getTileUpdate() {46 return TileUpdate.IfModifiedSince;47 42 } 48 43 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
r31438 r31573 129 129 130 130 @Override 131 public int lonToX(double lon, int zoom) {132 return (int) osmMercator.lonToX(lon, zoom);133 }134 135 @Override136 public int latToY(double lat, int zoom) {137 return (int) osmMercator.latToY(lat, zoom);138 }139 140 @Override141 131 public Point latLonToXY(double lat, double lon, int zoom) { 142 132 return new Point( … … 152 142 153 143 @Override 154 public double XToLon(int x, int zoom) {155 return osmMercator.xToLon(x, zoom);156 }157 158 @Override159 public double YToLat(int y, int zoom) {160 return osmMercator.yToLat(y, zoom);161 }162 163 @Override164 144 public ICoordinate xyToLatLon(Point point, int zoom) { 165 145 return xyToLatLon(point.x, point.y, zoom); … … 175 155 176 156 @Override 177 public double latToTileY(double lat, int zoom) {178 return osmMercator.latToY(lat, zoom) / tileSize;179 }180 181 @Override182 public double lonToTileX(double lon, int zoom) {183 return osmMercator.lonToX(lon, zoom) / tileSize;184 }185 186 @Override187 157 public TileXY latLonToTileXY(double lat, double lon, int zoom) { 188 158 return new TileXY( … … 195 165 public TileXY latLonToTileXY(ICoordinate point, int zoom) { 196 166 return latLonToTileXY(point.getLat(), point.getLon(), zoom); 197 }198 199 @Override200 public double tileYToLat(int y, int zoom) {201 return osmMercator.yToLat(y * tileSize, zoom);202 }203 204 @Override205 public double tileXToLon(int x, int zoom) {206 return osmMercator.xToLon(x * tileSize, zoom);207 167 } 208 168 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r31539 r31573 173 173 174 174 @Override 175 public TileUpdate getTileUpdate() {176 return TileUpdate.IfNoneMatch;177 }178 179 @Override180 175 public boolean requiresAttribution() { 181 176 return true; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
r31434 r31573 31 31 return url; 32 32 } 33 34 @Override35 public TileUpdate getTileUpdate() {36 return TileUpdate.IfNoneMatch;37 }38 33 } 39 34 … … 67 62 return 18; 68 63 } 69 70 @Override71 public TileUpdate getTileUpdate() {72 return TileUpdate.LastModified;73 }74 64 } 75 65 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
r31438 r31573 93 93 } 94 94 95 @Override96 public int latToY(double lat, int zoom) {97 return (int) (latToTileY(lat, zoom) * tileSize);98 }99 100 @Override101 public double YToLat(int y, int zoom) {102 return tileYToLat((double) y / tileSize, zoom);103 }104 105 @Override106 public double latToTileY(double lat, int zoom) {107 double tmp = Math.tan(Math.PI/4 * (1 + lat/90));108 double pow = Math.pow(Math.tan(Math.PI/4 + Math.asin(E * Math.sin(Math.toRadians(lat)))/2), E);109 110 return (EQUATOR/2 - (RADIUS_E * Math.log(tmp/pow))) * Math.pow(2.0, zoom) / EQUATOR;111 }112 113 @Override114 public double tileYToLat(int y, int zoom) {115 return tileYToLat((double) y, zoom);116 }117 118 95 /* 119 96 * To solve inverse formula latitude = f(y) we use -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
r31122 r31573 23 23 return (maxZoom == 0) ? super.getMaxZoom() : maxZoom; 24 24 } 25 26 @Override27 public TileUpdate getTileUpdate() {28 return TileUpdate.IfNoneMatch;29 }30 25 }
Note:
See TracChangeset
for help on using the changeset viewer.