Ignore:
Timestamp:
2018-08-11T17:29:48+02:00 (6 years ago)
Author:
Don-vip
Message:

see #15229 - deprecate all Main methods related to projections. New ProjectionRegistry class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r13702 r14120  
    88import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.coor.EastNorth;
    1211import org.openstreetmap.josm.data.coor.LatLon;
     
    3433    @BeforeClass
    3534    public static void setUp() {
    36         Main.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid
     35        ProjectionRegistry.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid
    3736    }
    3837
     
    9796    public void testAlatlon2eastNorth() {
    9897        LatLon ll = new LatLon(46.518, 6.567);
    99         EastNorth en = Main.getProjection().latlon2eastNorth(ll);
     98        EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    10099        if (debug) {
    101100            System.out.println(en);
     
    105104
    106105        ll = new LatLon(47.78, 8.58);
    107         en = Main.getProjection().latlon2eastNorth(ll);
     106        en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    108107        if (debug) {
    109108            System.out.println(en);
     
    113112
    114113        ll = new LatLon(46.58, 10.48);
    115         en = Main.getProjection().latlon2eastNorth(ll);
     114        en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    116115        if (debug) {
    117116            System.out.println(en);
     
    121120
    122121        ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600);
    123         en = Main.getProjection().latlon2eastNorth(ll);
     122        en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    124123        if (debug) {
    125124            System.out.println(en);
     
    130129        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
    131130        ll = new LatLon(46.04412093223244, 8.730497366167727);
    132         en = Main.getProjection().latlon2eastNorth(ll);
     131        en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    133132        if (debug) {
    134133            System.out.println(en);
     
    144143    public void testBeastNorth2latlon() {
    145144        EastNorth en = new EastNorth(533112.13, 152227.35);
    146         LatLon ll = Main.getProjection().eastNorth2latlon(en);
     145        LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
    147146        if (debug) {
    148147            System.out.println(ll);
     
    152151
    153152        en = new EastNorth(685542.97, 292783.21);
    154         ll = Main.getProjection().eastNorth2latlon(en);
     153        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
    155154        if (debug) {
    156155            System.out.println(ll);
     
    160159
    161160        en = new EastNorth(833066.95, 163265.32);
    162         ll = Main.getProjection().eastNorth2latlon(en);
     161        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
    163162        if (debug) {
    164163            System.out.println(ll);
     
    168167
    169168        en = new EastNorth(600000.0, 200000.0);
    170         ll = Main.getProjection().eastNorth2latlon(en);
     169        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
    171170        if (debug) {
    172171            System.out.println(ll);
     
    177176        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
    178177        en = new EastNorth(700000.0, 100000.0);
    179         ll = Main.getProjection().eastNorth2latlon(en);
     178        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
    180179        if (debug) {
    181180            System.out.println(ll);
     
    191190    public void testCsendandreturn() {
    192191        EastNorth en = new EastNorth(533111.69, 152227.85);
    193         LatLon ll = Main.getProjection().eastNorth2latlon(en);
    194         EastNorth en2 = Main.getProjection().latlon2eastNorth(ll);
     192        LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     193        EastNorth en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    195194        if (debug) {
    196195            System.out.println(en.east() - en2.east());
     
    203202
    204203        en = new EastNorth(685544.16, 292782.91);
    205         ll = Main.getProjection().eastNorth2latlon(en);
    206         en2 = Main.getProjection().latlon2eastNorth(ll);
     204        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     205        en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    207206        if (debug) {
    208207            System.out.println(en.east() - en2.east());
     
    215214
    216215        en = new EastNorth(833068.04, 163265.39);
    217         ll = Main.getProjection().eastNorth2latlon(en);
    218         en2 = Main.getProjection().latlon2eastNorth(ll);
     216        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     217        en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    219218        if (debug) {
    220219            System.out.println(en.east() - en2.east());
     
    227226
    228227        en = new EastNorth(600000.0, 200000.0);
    229         ll = Main.getProjection().eastNorth2latlon(en);
    230         en2 = Main.getProjection().latlon2eastNorth(ll);
     228        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     229        en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    231230        if (debug) {
    232231            System.out.println(en.east() - en2.east());
     
    239238
    240239        en = new EastNorth(700000.0, 100000.0);
    241         ll = Main.getProjection().eastNorth2latlon(en);
    242         en2 = Main.getProjection().latlon2eastNorth(ll);
     240        ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     241        en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
    243242        if (debug) {
    244243            System.out.println(en.east() - en2.east());
Note: See TracChangeset for help on using the changeset viewer.