Changeset 8510 in josm for trunk/test/unit/org/openstreetmap/josm/data/projection
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/projection
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
r6881 r8510 20 20 double maxErrLat = 0, maxErrLon = 0; 21 21 Ellipsoid ellips = Ellipsoid.WGS84; 22 for (int num =0; num<1000; ++num) {22 for (int num = 0; num < 1000; ++num) { 23 23 24 24 double lat = r.nextDouble() * 180.0 - 90.0; 25 25 double lon = r.nextDouble() * 360.0 - 180.0; 26 LatLon ll = new LatLon(lat, lon);26 LatLon ll = new LatLon(lat, lon); 27 27 28 for (int i =0; i<1000; ++i) {28 for (int i = 0; i < 1000; ++i) { 29 29 double[] cart = ellips.latLon2Cart(ll); 30 30 ll = ellips.cart2LatLon(cart); 31 31 32 if (!(Math.abs(lat - ll.lat()) <EPSILON && Math.abs(lon - ll.lon())<EPSILON)) {32 if (!(Math.abs(lat - ll.lat()) < EPSILON && Math.abs(lon - ll.lon()) < EPSILON)) { 33 33 String error = String.format("point: %s iterations: %s current: %s errorLat: %s errorLon %s", 34 34 new LatLon(lat, lon), i, ll, Math.abs(lat - ll.lat()), Math.abs(lon - ll.lon())); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r8509 r8510 65 65 prevData = readData(); 66 66 } 67 Map<String, TestData> prevCodesMap = new HashMap<>();67 Map<String, TestData> prevCodesMap = new HashMap<>(); 68 68 for (TestData data : prevData) { 69 69 prevCodesMap.put(data.code, data); … … 116 116 TestData next = new TestData(); 117 117 118 Pair<Double, Double> ll = readLine("ll", in.readLine());119 Pair<Double, Double> en = readLine("en", in.readLine());120 Pair<Double, Double> ll2 = readLine("ll2", in.readLine());118 Pair<Double, Double> ll = readLine("ll", in.readLine()); 119 Pair<Double, Double> en = readLine("en", in.readLine()); 120 Pair<Double, Double> ll2 = readLine("ll2", in.readLine()); 121 121 122 122 next.code = line; … … 131 131 } 132 132 133 private static Pair<Double, Double> readLine(String expectedName, String input) {133 private static Pair<Double, Double> readLine(String expectedName, String input) { 134 134 String[] fields = input.trim().split("[ ]+"); 135 135 if (fields.length != 3) throw new AssertionError(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r6881 r8510 28 28 } 29 29 30 for (int i =0; i<=3; ++i) {30 for (int i = 0; i <= 3; ++i) { 31 31 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(27561+i))); // Lambert 4 Zones France 32 32 } 33 33 34 for (int i =0; i<=4; ++i) {34 for (int i = 0; i <= 4; ++i) { 35 35 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(2176+i))); // PUWG Poland 36 36 } … … 38 38 testProj(Projections.getProjectionByCode("EPSG:21781")); // Swiss grid 39 39 40 for (int i =0; i<=60; ++i) {40 for (int i = 0; i <= 60; ++i) { 41 41 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(32601+i))); // UTM North 42 42 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(32701+i))); // UTM South … … 44 44 45 45 if (!"yes".equals(System.getProperty("suppressPermanentFailure"))) { 46 for (int i =0; i<=4; ++i) {46 for (int i = 0; i <= 4; ++i) { 47 47 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(2969+i))); // UTM France DOM 48 48 } 49 49 } 50 50 51 for (int i =0; i<=8; ++i) {51 for (int i = 0; i <= 8; ++i) { 52 52 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(3942+i))); // Lambert CC9 Zones France 53 53 } … … 65 65 66 66 text += String.format("*** %s %s%n", p.toString(), p.toCode()); 67 for (int num =0; num < 1000; ++num) {67 for (int num = 0; num < 1000; ++num) { 68 68 69 69 double lat = rand.nextDouble() * (b.getMax().lat() - b.getMin().lat()) + b.getMin().lat(); … … 72 72 LatLon ll = new LatLon(lat, lon); 73 73 74 for (int i =0; i<10; ++i) {74 for (int i = 0; i < 10; ++i) { 75 75 EastNorth en = p.latlon2eastNorth(ll); 76 76 ll = p.eastNorth2latlon(en); -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r8450 r8510 28 28 */ 29 29 ProjData[] data = { 30 new ProjData("Zimmerwald", d(7, 27,54.983506), d(46,52,37.540562), 947.149, 602030.680, 191775.030, 897.915),31 new ProjData("Chrischona", d(7, 40,6.983077), d(47,34, 1.385301), 504.935, 617306.300, 268507.300, 456.064),32 new ProjData("Pfaender", d(9, 47,3.697723), d(47,30,55.172797), 1089.372, 776668.105, 265372.681, 1042.624),33 new ProjData("La Givrine", d(6, 6,7.326361), d(46,27,14.690021), 1258.274, 497313.292, 145625.438, 1207.434),34 new ProjData("Monte Generoso", d(9, 1,16.389053), d(45,55,45.438020), 1685.027, 722758.810, 87649.670, 1636.600) };30 new ProjData("Zimmerwald", d(7, 27, 54.983506), d(46, 52, 37.540562), 947.149, 602030.680, 191775.030, 897.915), 31 new ProjData("Chrischona", d(7, 40, 6.983077), d(47, 34, 1.385301), 504.935, 617306.300, 268507.300, 456.064), 32 new ProjData("Pfaender", d(9, 47, 3.697723), d(47, 30, 55.172797), 1089.372, 776668.105, 265372.681, 1042.624), 33 new ProjData("La Givrine", d(6, 6, 7.326361), d(46, 27, 14.690021), 1258.274, 497313.292, 145625.438, 1207.434), 34 new ProjData("Monte Generoso", d(9, 1, 16.389053), d(45, 55, 45.438020), 1685.027, 722758.810, 87649.670, 1636.600) }; 35 35 36 36 private double d(double deg, double min, double sec) { … … 42 42 public LatLon ll; 43 43 public EastNorth en; 44 44 45 public ProjData(String name, double lon, double lat, double h1, double x, double y, double h2) { 45 46 this.name = name; … … 128 129 } 129 130 130 131 131 @Test 132 132 public void b_eastNorth2latlon_test() {
Note:
See TracChangeset
for help on using the changeset viewer.