Ticket #5681: Epsg3008-2.diff

File Epsg3008-2.diff, 1.7 KB (added by vetinari+osm@…, 11 years ago)

2nd diff against latest SVN

  • src/org/openstreetmap/josm/data/projection/Epsg3008.java

     
    55
    66import org.openstreetmap.josm.data.Bounds;
    77import org.openstreetmap.josm.data.coor.LatLon;
     8import org.openstreetmap.josm.data.coor.EastNorth;
    89
     10
    911/**
    1012 * SWEREF99 13 30 projection. Based on data from spatialreference.org.
    1113 * http://spatialreference.org/ref/epsg/3008/
     
    1517public class Epsg3008 extends TransverseMercator {
    1618
    1719    private final static double UTMScaleFactor = 1.0;
     20    private double UTMCentralMeridianRad;
     21    private double offsetEastMeters = 150000;
     22    private double offsetNorthMeters = 0;
    1823
     24
    1925    public Epsg3008()
    2026    {
    21         setProjectionParameters(13.5, 150000, 0);
     27        UTMCentralMeridianRad = Math.toRadians(13.5);
    2228    }
    2329
    2430    @Override public String toString() {
     
    4955                new LatLon(55.2, 12.1),     // new LatLon(-90.0, -180.0),
    5056                new LatLon(62.26, 14.65));  // new LatLon(90.0, 180.0));
    5157    }
     58
     59    @Override
     60    public EastNorth latlon2eastNorth(LatLon p) {
     61        EastNorth a = mapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridianRad);
     62        return new EastNorth(a.east() * UTMScaleFactor + offsetEastMeters, a.north() * UTMScaleFactor + offsetNorthMeters);
     63    }
     64
     65    @Override
     66    public LatLon eastNorth2latlon(EastNorth p) {
     67        return mapXYToLatLon((p.east() - offsetEastMeters)/UTMScaleFactor, (p.north() - offsetNorthMeters)/UTMScaleFactor, UTMCentralMeridianRad);
     68    }
     69
    5270}