Ignore:
Timestamp:
2012-03-11T21:19:59+01:00 (13 years ago)
Author:
bastiK
Message:

move ntv2 to datum (see #7494)

File:
1 edited

Legend:

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

    r5040 r5073  
    2020 * Subclasses of AbstractProjection must set ellps and proj to a non-null value.
    2121 * In addition, either datum or nadgrid has to be initialized to some value.
    22  *
    23  * FIXME: nadgrids should probably be implemented as a Datum
    2422 */
    2523abstract public class AbstractProjection implements Projection {
     
    3230    protected double lon_0 = 0.0;   /* central meridian */
    3331    protected double k_0 = 1.0;     /* general scale factor */
    34     protected NTV2GridShiftFile nadgrids = null;
    35    
     32
    3633    public final Ellipsoid getEllipsoid() {
    3734        return ellps;
     
    6461    @Override
    6562    public EastNorth latlon2eastNorth(LatLon ll) {
    66         if (nadgrids != null) {
    67             NTV2GridShift gs = new NTV2GridShift(ll);
    68             nadgrids.gridShiftReverse(gs);
    69             ll = new LatLon(ll.lat()+gs.getLatShiftDegrees(), ll.lon()+gs.getLonShiftPositiveEastDegrees());
    70         } else {
    71             ll = datum.fromWGS84(ll);
    72         }
     63        ll = datum.fromWGS84(ll);
    7364        double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians(ll.lon() - lon_0));
    7465        return new EastNorth(ellps.a * k_0 * en[0] + x_0, ellps.a * k_0 * en[1] + y_0);
     
    7970        double[] latlon_rad = proj.invproject((en.east() - x_0) / ellps.a / k_0, (en.north() - y_0) / ellps.a / k_0);
    8071        LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), Math.toDegrees(latlon_rad[1]) + lon_0);
    81         if (nadgrids != null) {
    82             NTV2GridShift gs = new NTV2GridShift(ll);
    83             nadgrids.gridShiftForward(gs);
    84             ll = new LatLon(ll.lat()+gs.getLatShiftDegrees(), ll.lon()+gs.getLonShiftPositiveEastDegrees());
    85         } else {
    86             ll = datum.toWGS84(ll);
    87         }
    88         return ll;
     72        return datum.toWGS84(ll);
    8973    }
    9074
     
    9478        return 10;
    9579    }
    96    
     80
    9781    /**
    9882     * @return The EPSG Code of this CRS, null if it doesn't have one.
     
    10892        return "EPSG:" + getEpsgCode();
    10993    }
    110    
     94
    11195    protected static final double convertMinuteSecond(double minute, double second) {
    11296        return (minute/60.0) + (second/3600.0);
    11397    }
    114    
     98
    11599    protected static final double convertDegreeMinuteSecond(double degree, double minute, double second) {
    116100        return degree + convertMinuteSecond(minute, second);
Note: See TracChangeset for help on using the changeset viewer.