Changeset 3692 in josm


Ignore:
Timestamp:
2010-12-03T14:45:14+01:00 (14 years ago)
Author:
bastiK
Message:

applied #5681 (patch by Hanno Hecker) - fix to SWEREF99 / EPSG:3008 projection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Epsg3008.java

    r3690 r3692  
    66import org.openstreetmap.josm.data.Bounds;
    77import org.openstreetmap.josm.data.coor.LatLon;
     8import org.openstreetmap.josm.data.coor.EastNorth;
    89
    910/**
     
    1617
    1718    private final static double UTMScaleFactor = 1.0;
     19    private double UTMCentralMeridianRad;
     20    private double offsetEastMeters = 150000;
     21    private double offsetNorthMeters = 0;
    1822
    1923    public Epsg3008()
    2024    {
    21         setProjectionParameters(13.5, 150000, 0);
     25        UTMCentralMeridianRad = Math.toRadians(13.5);
    2226    }
    2327
     
    5054                new LatLon(62.26, 14.65));  // new LatLon(90.0, 180.0));
    5155    }
     56
     57    @Override
     58    public EastNorth latlon2eastNorth(LatLon p) {
     59        EastNorth a = mapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridianRad);
     60        return new EastNorth(a.east() * UTMScaleFactor + offsetEastMeters, a.north() * UTMScaleFactor + offsetNorthMeters);
     61    }
     62
     63    @Override
     64    public LatLon eastNorth2latlon(EastNorth p) {
     65        return mapXYToLatLon((p.east() - offsetEastMeters)/UTMScaleFactor, (p.north() - offsetNorthMeters)/UTMScaleFactor, UTMCentralMeridianRad);
     66    }
     67
    5268}
Note: See TracChangeset for help on using the changeset viewer.