Changeset 5230 in josm for trunk/src


Ignore:
Timestamp:
2012-05-11T17:11:04+02:00 (13 years ago)
Author:
bastiK
Message:

use standard parameter set for lambert projection

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

Legend:

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

    r5226 r5230  
    66import java.awt.GridBagLayout;
    77import java.awt.event.ActionListener;
    8 import java.io.InputStream;
    98import java.util.Collection;
    109import java.util.Collections;
     
    1413import javax.swing.JPanel;
    1514
    16 import org.openstreetmap.josm.Main;
    1715import org.openstreetmap.josm.data.Bounds;
    1816import org.openstreetmap.josm.data.coor.LatLon;
    1917import org.openstreetmap.josm.data.projection.datum.NTV2Datum;
    20 import org.openstreetmap.josm.data.projection.datum.NTV2GridShiftFile;
    2118import org.openstreetmap.josm.data.projection.datum.NTV2GridShiftFileWrapper;
    2219import org.openstreetmap.josm.data.projection.proj.LambertConformalConic;
     
    2926 * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy.
    3027 * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal)
     28 *
     29 * Source: http://professionnels.ign.fr/DISPLAY/000/526/700/5267002/transformation.pdf
    3130 * @author Pieren
    3231 */
    3332public class Lambert extends AbstractProjection implements ProjectionSubPrefs {
    34     /**
    35      * Lambert I, II, III, and IV projection exponents
    36      */
    37     private static final double n[] = { 0.7604059656, 0.7289686274, 0.6959127966, 0.6712679322 };
    38 
    39     /**
    40      * Lambert I, II, III, and IV projection constants
    41      */
    42     private static final double c[] = { 11603796.98, 11745793.39, 11947992.52, 12136281.99 };
     33
     34    /**
     35     * Lambert I, II, III, and IV latitude origin
     36     */
     37    private static final double lat_0s[] = { 49.5, 46.8, 44.1, 42.165 };
     38   
     39    /**
     40     * Lambert I, II, III, and IV latitude of first standard parallel
     41     */
     42    private static final double lat_1s[] = {
     43            convertDegreeMinuteSecond(48, 35, 54.682),
     44            convertDegreeMinuteSecond(45, 53, 56.108),
     45            convertDegreeMinuteSecond(43, 11, 57.449),
     46            convertDegreeMinuteSecond(41, 33, 37.396)};
     47   
     48    /**
     49     * Lambert I, II, III, and IV latitude of second standard parallel
     50     */
     51    private static final double lat_2s[] = {
     52            convertDegreeMinuteSecond(50, 23, 45.282),
     53            convertDegreeMinuteSecond(47, 41, 45.652),
     54            convertDegreeMinuteSecond(44, 59, 45.938),
     55            convertDegreeMinuteSecond(42, 46, 3.588)};
    4356
    4457    /**
     
    4659     */
    4760    private static final double x_0s[] = { 600000.0, 600000.0, 600000.0, 234.358 };
    48 
     61   
    4962    /**
    5063     * Lambert I, II, III, and IV false north
    5164     */
    52     private static final double y_fs[] = { 5657616.674, 6199695.768, 6791905.085, 7239161.542 };
    53 
     65    private static final double y_0s[] = { 200000.0, 200000.0, 200000.0, 185861.369 };
     66   
    5467    /**
    5568     * France is divided in 4 Lambert projection zones (1,2,3 + 4th for Corsica)
     
    87100        datum = new NTV2Datum("ntf_rgf93Grid", null, ellps, NTV2GridShiftFileWrapper.ntf_rgf93);
    88101        x_0 = x_0s[layoutZone];
     102        y_0 = y_0s[layoutZone];
    89103        lon_0 = 2.0 + 20.0 / 60 + 14.025 / 3600; // 0 grade Paris
    90104        if (proj == null) {
     
    95109            proj.initialize(new ProjParameters() {{
    96110                ellps = Lambert.this.ellps;
    97                 lcc_n = n[layoutZone];
    98                 lcc_F = c[layoutZone] / ellps.a;
    99                 lcc_r0 = y_fs[layoutZone] / ellps.a;
     111                lat_0 = lat_0s[layoutZone];
     112                lat_1 = lat_1s[layoutZone];
     113                lat_2 = lat_2s[layoutZone];
    100114            }});
    101115        } catch (ProjectionConfigurationException e) {
  • trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java

    r5066 r5230  
    6767        ellps = params.ellps;
    6868        e = ellps.e;
    69         if (params.lcc_n != null && params.lcc_F != null && params.lcc_r0 != null) {
    70             initializeDirect(params.lcc_n, params.lcc_F, params.lcc_r0);
     69        if (params.lat_0 == null)
     70            throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", "lat_0"));
     71        if (params.lat_1 != null && params.lat_2 != null) {
     72            initialize2SP(params.lat_0, params.lat_1, params.lat_2);
    7173        } else {
    72             if (params.lat_0 == null)
    73                 throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", "lat_0"));
    74             if (params.lat_1 != null && params.lat_2 != null) {
    75                 initialize2SP(params.lat_0, params.lat_1, params.lat_2);
    76             } else {
    77                 initialize1SP(params.lat_0);
    78             }
     74            initialize1SP(params.lat_0);
    7975        }
    8076    }
     
    117113        F  = m0 / (n * pow(t0, n));
    118114        r0 = F * pow(t0, n);
    119     }
    120 
    121     /**
    122      * Initialize LCC by providing the projection parameters directly.
    123      *
    124      * @param n see field n
    125      * @param F see field F
    126      * @param r0 see field r0
    127      */
    128     private void initializeDirect(double n, double F, double r0) {
    129         this.params = null;
    130         this.n = n;
    131         this.F = F;
    132         this.r0 = r0;
    133115    }
    134116
  • trunk/src/org/openstreetmap/josm/data/projection/proj/ProjParameters.java

    r5066 r5230  
    1515    public Double lat_2;
    1616
    17     /* for LambertConformalConic */
    18     public Double lcc_n;
    19     public Double lcc_F;
    20     public Double lcc_r0;
    21 
    2217}
Note: See TracChangeset for help on using the changeset viewer.