- Timestamp:
- 2016-09-11T02:27:03+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java
r10990 r10992 20 20 * @author Wiktor Niesiobędzki 21 21 * @since 10990 22 *23 22 */ 24 public class AbstractWMSTileSource extends TMSTileSource {23 public abstract class AbstractWMSTileSource extends TMSTileSource { 25 24 26 25 private EastNorth anchorPosition; … … 32 31 private static final float SCALE_DENOMINATOR_ZOOM_LEVEL_1 = 559082264.0287178f; 33 32 33 /** 34 * Constructs a new {@code AbstractWMSTileSource}. 35 * @param info tile source info 36 */ 34 37 public AbstractWMSTileSource(TileSourceInfo info) { 35 38 super(info); 39 } 40 41 private void initAnchorPosition(Projection proj) { 42 Bounds worldBounds = proj.getWorldBoundsLatLon(); 43 EastNorth min = proj.latlon2eastNorth(worldBounds.getMin()); 44 EastNorth max = proj.latlon2eastNorth(worldBounds.getMax()); 45 this.anchorPosition = new EastNorth(min.east(), max.north()); 36 46 } 37 47 … … 41 51 public void initProjection() { 42 52 initProjection(Main.getProjection()); 43 }44 45 private void initAnchorPosition(Projection proj) {46 Bounds worldBounds = proj.getWorldBoundsLatLon();47 EastNorth min = proj.latlon2eastNorth(worldBounds.getMin());48 EastNorth max = proj.latlon2eastNorth(worldBounds.getMax());49 this.anchorPosition = new EastNorth(min.east(), max.north());50 53 } 51 54 … … 97 100 } 98 101 99 @Override100 public TileXY latLonToTileXY(double lat, double lon, int zoom) {101 Projection proj = Main.getProjection();102 EastNorth enPoint = proj.latlon2eastNorth(new LatLon(lat, lon));103 return eastNorthToTileXY(enPoint, zoom);104 }105 106 102 private TileXY eastNorthToTileXY(EastNorth enPoint, int zoom) { 107 103 double scale = getDegreesPerTile(zoom); … … 110 106 (anchorPosition.north() - enPoint.north()) / scale 111 107 ); 108 } 109 110 @Override 111 public TileXY latLonToTileXY(double lat, double lon, int zoom) { 112 EastNorth enPoint = Main.getProjection().latlon2eastNorth(new LatLon(lat, lon)); 113 return eastNorthToTileXY(enPoint, zoom); 112 114 } 113 115
Note:
See TracChangeset
for help on using the changeset viewer.