Changeset 10992 in josm for trunk


Ignore:
Timestamp:
2016-09-11T02:27:03+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S00118 - Abstract class names should comply with a naming convention
sonar - squid:UndocumentedApi - Public types, methods and fields (API) should be documented with Javadoc
sonar - checkstyle:OverloadMethodsDeclarationOrderCheck - Overload Methods Declaration Order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java

    r10990 r10992  
    2020 * @author Wiktor Niesiobędzki
    2121 * @since 10990
    22  *
    2322 */
    24 public class AbstractWMSTileSource extends TMSTileSource {
     23public abstract class AbstractWMSTileSource extends TMSTileSource {
    2524
    2625    private EastNorth anchorPosition;
     
    3231    private static final float SCALE_DENOMINATOR_ZOOM_LEVEL_1 = 559082264.0287178f;
    3332
     33    /**
     34     * Constructs a new {@code AbstractWMSTileSource}.
     35     * @param info tile source info
     36     */
    3437    public AbstractWMSTileSource(TileSourceInfo info) {
    3538        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());
    3646    }
    3747
     
    4151    public void initProjection() {
    4252        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());
    5053    }
    5154
     
    97100    }
    98101
    99     @Override
    100     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 
    106102    private TileXY eastNorthToTileXY(EastNorth enPoint, int zoom) {
    107103        double scale = getDegreesPerTile(zoom);
     
    110106                (anchorPosition.north() - enPoint.north()) / scale
    111107                );
     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);
    112114    }
    113115
Note: See TracChangeset for help on using the changeset viewer.