Changeset 5067 in josm for trunk/src


Ignore:
Timestamp:
2012-03-10T18:51:51+01:00 (13 years ago)
Author:
bastiK
Message:

extend options for ellipsoid, use formal definition instead of computed values

Location:
trunk/src/org/openstreetmap/josm/data/projection
Files:
3 edited

Legend:

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

    r4285 r5067  
    99
    1010import org.openstreetmap.josm.data.coor.LatLon;
     11import java.util.List;
     12import java.util.ArrayList;
    1113
    1214/**
     
    1517public class Ellipsoid {
    1618    /**
    17      * Clarke's ellipsoid (NTF system)
    18      */
    19     public static final Ellipsoid clarke = new Ellipsoid(6378249.2, 6356515.0);
     19     * Clarke 1880 IGN (French national geographic institute)
     20     */
     21    public static final Ellipsoid clarkeIGN = Ellipsoid.create_a_b(6378249.2, 6356515.0);
    2022    /**
    2123     * Hayford's ellipsoid 1909 (ED50 system)
    2224     * Proj.4 code: intl
    2325     */
    24     public static final Ellipsoid hayford =
    25         new Ellipsoid(6378388.0, 6356911.9461);
     26    public static final Ellipsoid hayford = Ellipsoid.create_a_rf(6378388.0, 297.0);
    2627    /**
    2728     * GRS80 ellipsoid
    2829     */
    29     public static final Ellipsoid GRS80 = new Ellipsoid(6378137.0, 6356752.3141);
     30    public static final Ellipsoid GRS80 = Ellipsoid.create_a_rf(6378137.0, 298.257222101);
    3031
    3132    /**
    3233     * WGS84 ellipsoid
    3334     */
    34     public static final Ellipsoid WGS84 = new Ellipsoid(6378137.0, 6356752.3142);
     35    public static final Ellipsoid WGS84 = Ellipsoid.create_a_rf(6378137.0, 298.257223563);
    3536
    3637    /**
    3738     * Bessel 1841 ellipsoid
    3839     */
    39     public static final Ellipsoid Bessel1841 = new Ellipsoid(6377397.155, 6356078.962822);
     40    public static final Ellipsoid Bessel1841 = Ellipsoid.create_a_rf(6377397.155, 299.1528128);
    4041
    4142    /**
     
    6263
    6364    /**
    64      * create a new ellipsoid and precompute its parameters
    65      *
    66      * @param a ellipsoid long axis (in meters)
    67      * @param b ellipsoid short axis (in meters)
    68      */
    69     public Ellipsoid(double a, double b) {
     65     * private constructur - use one of the create_* methods
     66     *
     67     * @param a semimajor radius of the ellipsoid axis
     68     * @param b semiminor radius of the ellipsoid axis
     69     * @param e first eccentricity of the ellipsoid ( = sqrt((a*a - b*b)/(a*a)))
     70     * @param e2 first eccentricity squared
     71     * @param eb2 square of the second eccentricity
     72     */
     73    private Ellipsoid(double a, double b, double e, double e2, double eb2) {
    7074        this.a = a;
    7175        this.b = b;
    72         e2 = (a*a - b*b) / (a*a);
    73         e = Math.sqrt(e2);
    74         eb2 = e2 / (1.0 - e2);
     76        this.e = e;
     77        this.e2 = e2;
     78        this.eb2 = eb2;
     79    }
     80
     81    /**
     82     * create a new ellipsoid
     83     *
     84     * @param a semimajor radius of the ellipsoid axis (in meters)
     85     * @param b semiminor radius of the ellipsoid axis (in meters)
     86     */
     87    public static Ellipsoid create_a_b(double a, double b) {
     88        double e2 = (a*a - b*b) / (a*a);
     89        double e = Math.sqrt(e2);
     90        double eb2 = e2 / (1.0 - e2);
     91        return new Ellipsoid(a, b, e, e2, eb2);
     92    }
     93
     94    /**
     95     * create a new ellipsoid
     96     *
     97     * @param a semimajor radius of the ellipsoid axis (in meters)
     98     * @param es first eccentricity squared
     99     */
     100    public static Ellipsoid create_a_es(double a, double es) {
     101        double b = a * Math.sqrt(1.0 - es);
     102        double e = Math.sqrt(es);
     103        double eb2 = es / (1.0 - es);
     104        return new Ellipsoid(a, b, e, es, eb2);
     105    }
     106
     107    /**
     108     * create a new ellipsoid
     109     *
     110     * @param a semimajor radius of the ellipsoid axis (in meters)
     111     * @param f flattening ( = (a - b) / a)
     112     */
     113    public static Ellipsoid create_a_f(double a, double f) {
     114        double b = a * (1.0 - f);
     115        double e2 = f * (2 - f);
     116        double e = Math.sqrt(e2);
     117        double eb2 = e2 / (1.0 - e2);
     118        return new Ellipsoid(a, b, e, e2, eb2);
     119    }
     120
     121    /**
     122     * create a new ellipsoid
     123     *
     124     * @param a semimajor radius of the ellipsoid axis (in meters)
     125     * @param rf inverse flattening
     126     */
     127    public static Ellipsoid create_a_rf(double a, double rf) {
     128        return create_a_f(a, 1.0 / rf);
    75129    }
    76130
  • trunk/src/org/openstreetmap/josm/data/projection/Lambert.java

    r5066 r5067  
    100100    private void updateParameters(final int layoutZone) {
    101101        this.layoutZone = layoutZone;
    102         ellps = Ellipsoid.clarke;
     102        ellps = Ellipsoid.clarkeIGN;
    103103        datum = null; // no datum needed, we have a shift file
    104104        nadgrids = ntf_rgf93Grid;
  • trunk/src/org/openstreetmap/josm/data/projection/UTM_France_DOM.java

    r5066 r5067  
    2424/**
    2525 * This class implements all projections for French departements in the Caribbean Sea and
    26  * Indian Ocean using the UTM transvers Mercator projection and specific geodesic settings (7 parameters transformation algorithm).
     26 * Indian Ocean using the UTM transvers Mercator projection and specific geodesic settings.
    2727 *
    2828 */
Note: See TracChangeset for help on using the changeset viewer.