Changeset 11660 in josm for trunk/test/unit
- Timestamp:
- 2017-03-04T03:09:43+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r10758 r11660 6 6 7 7 import org.junit.BeforeClass; 8 import org.junit. Ignore;8 import org.junit.Rule; 9 9 import org.junit.Test; 10 10 import org.openstreetmap.josm.Main; 11 11 import org.openstreetmap.josm.data.coor.EastNorth; 12 12 import org.openstreetmap.josm.data.coor.LatLon; 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 14 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 13 16 14 17 public class SwissGridTest { … … 19 22 * Setup test. 20 23 */ 24 @Rule 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 public JOSMTestRules test = new JOSMTestRules().platform(); 27 28 /** 29 * Setup test. 30 */ 21 31 @BeforeClass 22 32 public static void setUp() { … … 28 38 29 39 /** 30 * source: http ://www.swisstopo.admin.ch/internet/swisstopo/en/home/topics/survey/sys/refsys/switzerland.parsysrelated1.37696.downloadList.97912.DownloadFile.tmp/swissprojectionen.pdf40 * source: https://www.swisstopo.admin.ch/content/swisstopo-internet/en/topics/survey/reference-systems/projections/_jcr_content/contentPar/tabs/items/dokumente_publikatio/tabPar/downloadlist/downloadItems/463_1459341821844.download/refsyse.pdf 31 41 */ 32 42 ProjData[] data = { … … 56 66 } 57 67 58 private static final double EPSILON_APPROX = 1.5;59 68 private static final double EPSILON_ACCURATE = 0.05; 60 69 … … 72 81 73 82 @Test 74 public void testProjReferenceTestApprox() {75 projReferenceTest(EPSILON_APPROX);76 }77 78 @Test79 @Ignore("high accuracy of epsilon=" + EPSILON_ACCURATE + " is not met")80 83 public void testProjReferenceTestAccurate() { 81 // TODO make this test pass82 84 projReferenceTest(EPSILON_ACCURATE); 83 85 } … … 90 92 System.out.println(en); 91 93 } 92 assertTrue("Lausanne", Math.abs(en.east() - 53311 1.69) < 0.1);93 assertTrue("Lausanne", Math.abs(en.north() - 152227. 85) < 0.1);94 assertTrue("Lausanne", Math.abs(en.east() - 533112.13) < 0.1); 95 assertTrue("Lausanne", Math.abs(en.north() - 152227.35) < 0.1); 94 96 95 97 ll = new LatLon(47.78, 8.58); … … 98 100 System.out.println(en); 99 101 } 100 assertTrue("Schafouse", Math.abs(en.east() - 68554 4.16) < 0.1);101 assertTrue("Schafouse", Math.abs(en.north() - 29278 2.91) < 0.1);102 assertTrue("Schafouse", Math.abs(en.east() - 685542.97) < 0.1); 103 assertTrue("Schafouse", Math.abs(en.north() - 292783.21) < 0.1); 102 104 103 105 ll = new LatLon(46.58, 10.48); … … 106 108 System.out.println(en); 107 109 } 108 assertTrue("Grinson", Math.abs(en.east() - 83306 8.04) < 0.1);109 assertTrue("Grinson", Math.abs(en.north() - 163265.3 9) < 0.1);110 assertTrue("Grinson", Math.abs(en.east() - 833066.95) < 0.1); 111 assertTrue("Grinson", Math.abs(en.north() - 163265.32) < 0.1); 110 112 111 113 ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600); … … 117 119 assertTrue("Berne", Math.abs(en.north() - 200000.0) < 0.1); 118 120 119 ll = new LatLon(46.0 + 2.0 / 60 + 38.87 / 3600, 8.0 + 43.0 / 60 + 49.79 / 3600); 121 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 122 ll = new LatLon(46.04412093223244, 8.730497366167727); 120 123 en = Main.getProjection().latlon2eastNorth(ll); 121 124 if (debug) { … … 128 131 @Test 129 132 public void testBeastNorth2latlon() { 130 EastNorth en = new EastNorth(53311 1.69, 152227.85);133 EastNorth en = new EastNorth(533112.13, 152227.35); 131 134 LatLon ll = Main.getProjection().eastNorth2latlon(en); 132 135 if (debug) { … … 136 139 assertTrue("Lausanne", Math.abs(ll.lon() - 6.567) < 0.00001); 137 140 138 en = new EastNorth(68554 4.16, 292782.91);141 en = new EastNorth(685542.97, 292783.21); 139 142 ll = Main.getProjection().eastNorth2latlon(en); 140 143 if (debug) { … … 144 147 assertTrue("Schafouse", Math.abs(ll.lon() - 8.58) < 0.00001); 145 148 146 en = new EastNorth(83306 8.04, 163265.39);149 en = new EastNorth(833066.95, 163265.32); 147 150 ll = Main.getProjection().eastNorth2latlon(en); 148 151 if (debug) { … … 160 163 assertTrue("Berne", Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001); 161 164 165 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 162 166 en = new EastNorth(700000.0, 100000.0); 163 167 ll = Main.getProjection().eastNorth2latlon(en); … … 165 169 System.out.println(ll); 166 170 } 167 assertTrue("Ref", Math.abs(ll.lat() - (46.0 + 2.0 / 60 + 38.87 / 3600)) < 0.00001);168 assertTrue("Ref", Math.abs(ll.lon() - (8.0 + 43.0 / 60 + 49.79 / 3600)) < 0.00001);171 assertTrue("Ref", Math.abs(ll.lat() - 46.04412093223244) < 0.00001); 172 assertTrue("Ref", Math.abs(ll.lon() - 8.730497366167727) < 0.00001); 169 173 } 170 174
Note:
See TracChangeset
for help on using the changeset viewer.