geodesic_wgs84 1.32.11 → 1.32.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dfc25463144c1a96d0c3a050c5e512d8d743302
4
- data.tar.gz: 2fd502d57cda6615775e9a847b4aad6e57594f13
3
+ metadata.gz: 99b89d9bb56862dd37c16b95c46ddef1bd69267f
4
+ data.tar.gz: 08d962eaf9b23f25e0d55212bbbae2f31b746a3c
5
5
  SHA512:
6
- metadata.gz: 15dcdedbf79c9b7d81b67c0f50d68809bbd45b7fa5cb9017c2752729256be898a9a6fe1384500fc3a2e7e5673b4e22324fe9fe57fc796c495fcd8538e58e6472
7
- data.tar.gz: bd48201cfdbf377474f587b81d1399b54e93d2696b8b33976644973ea4d6870fc79bb4a3538bc8173d498938a0e3e1d48a05b2f699e90e37c6c18fe3ff2ce19e
6
+ metadata.gz: 6c36c98c1bef95b54a2b5fef593c75ef59cf04e02ca89d3768fab87fc643dce5b651f074e4c59d1bcff7f20057090128d8c0138375ba62869aff7f7f193794dd
7
+ data.tar.gz: 419cc35d4f3d48e858ddd1070859421c02b21a40c0babc9bd0c2fcdb71a8f5a7562abaf2b6f59a1bc80548c37326936e46f81cdd4e4fadee05ef56a302a5937c
@@ -107,45 +107,24 @@ wgs84_lat_lon(int argc, VALUE *argv, VALUE klass)
107
107
  if (argc == 2) {
108
108
  lat = wgs84_get_value(argv[0]);
109
109
  lon = wgs84_get_value(argv[1]);
110
- } else if (argc == 1 && TYPE(*argv) == T_ARRAY && RARRAY_LEN(*argv) == 2) {
111
- lat = wgs84_get_value(rb_ary_entry(*argv, 0));
112
- lon = wgs84_get_value(rb_ary_entry(*argv, 1));
113
- } else if (argc == 1 && !NIL_P(tmp = rb_check_array_type(*argv))) {
114
- lat = wgs84_get_value(rb_ary_entry(tmp, 0));
115
- lon = wgs84_get_value(rb_ary_entry(tmp, 1));
116
- } else {
110
+ return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
111
+ }
112
+
113
+ if (argc != 1) {
117
114
  rb_raise(rb_eArgError, "wrong number of arguments");
118
115
  return Qnil;
119
116
  }
120
117
 
121
- return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
122
- }
123
-
124
-
125
- static VALUE
126
- wgs84_lat_lon_dms(int argc, VALUE *argv, VALUE klass)
127
- {
128
- double lat, lon;
129
- char lat_buf[64], lon_buf[64];
130
- VALUE tmp;
131
-
132
- if (argc == 2) {
133
- lat = wgs84_get_value(argv[0]);
134
- lon = wgs84_get_value(argv[1]);
135
- } else if (argc == 1 && TYPE(*argv) == T_ARRAY && RARRAY_LEN(*argv) == 2) {
118
+ if (TYPE(*argv) == T_ARRAY && RARRAY_LEN(*argv) == 2) {
136
119
  lat = wgs84_get_value(rb_ary_entry(*argv, 0));
137
120
  lon = wgs84_get_value(rb_ary_entry(*argv, 1));
138
- } else if (argc == 1 && !NIL_P(tmp = rb_check_array_type(*argv))) {
139
- lat = wgs84_get_value(rb_ary_entry(tmp, 0));
140
- lon = wgs84_get_value(rb_ary_entry(tmp, 1));
141
- } else {
142
- rb_raise(rb_eArgError, "wrong number of arguments");
143
- return Qnil;
121
+ return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
144
122
  }
145
123
 
146
- wgs84_make_dms(lat, lat_buf);
147
- wgs84_make_dms(lon, lon_buf);
148
- return rb_ary_new3(2L, rb_str_new2(lat_buf), rb_str_new2(lon_buf));
124
+ tmp = rb_funcall(*argv, rb_intern("to_lat_lon"), 0);
125
+ lat = wgs84_get_value(rb_ary_entry(tmp, 0));
126
+ lon = wgs84_get_value(rb_ary_entry(tmp, 1));
127
+ return rb_ary_new3(2L, rb_float_new(lat), rb_float_new(lon));
149
128
  }
150
129
 
151
130
 
@@ -281,7 +260,6 @@ Init_geodesic_wgs84(void)
281
260
  rb_define_method(cWGS84, "as_deg", wgs84_as_deg, 1);
282
261
  rb_define_method(cWGS84, "as_dms", wgs84_as_dms, 1);
283
262
  rb_define_method(cWGS84, "lat_lon", wgs84_lat_lon, -1);
284
- rb_define_method(cWGS84, "lat_lon_dms", wgs84_lat_lon_dms, -1);
285
263
  rb_define_method(cWGS84, "distance", wgs84_distance, -1);
286
264
  rb_define_method(cWGS84, "average", wgs84_average, 2);
287
265
  rb_define_method(cWGS84, "center", wgs84_center, 2);
@@ -1,3 +1,3 @@
1
1
  module GeodesicWgs84
2
- VERSION = "1.32.11"
2
+ VERSION = "1.32.12"
3
3
  end
@@ -10,15 +10,15 @@ class TestGeodesicWgs84 < MiniTest::Test
10
10
  assert_equal 50.833833, @wgs84.as_deg(50.833833)
11
11
  end
12
12
 
13
- def test_dms_as_deg
13
+ def test_as_deg
14
14
  assert_equal 50.833833, @wgs84.as_deg("50 50 01.8")
15
15
  end
16
16
 
17
- def test_deg_as_dms
17
+ def test_deg_as
18
18
  assert_equal "50 50 1.8", @wgs84.as_dms(50.833833)
19
19
  end
20
20
 
21
- def test_dms_as_dms
21
+ def test_as
22
22
  assert_equal "50 50 1.8", @wgs84.as_dms("50 50 01.8")
23
23
  end
24
24
 
@@ -34,60 +34,56 @@ class TestGeodesicWgs84 < MiniTest::Test
34
34
  assert_equal [3.5, 4.123], @wgs84.lat_lon(["3.5", "4.123"])
35
35
  end
36
36
 
37
- def test_lat_lon_dms_string
38
- assert_equal ["50 50 1.8", "8 46 9.6"], @wgs84.lat_lon_dms("50 50 01.8", "08 46 09.6")
37
+ def test_lat_lon_alsfeld
38
+ assert_equal [50.751778, 9.251861], @wgs84.lat_lon("50 45 6.4", "9 15 6.7")
39
39
  end
40
40
 
41
- def test_lat_lon_dms_alsfeld
42
- assert_equal ["50 45 6.4", "9 15 6.7"], @wgs84.lat_lon_dms(50.751778, 9.251861)
41
+ def test_lat_lon_vilbel
42
+ assert_equal [50.192028, 8.734722], @wgs84.lat_lon("50 11 31.3", "8 44 5.0")
43
43
  end
44
44
 
45
- def test_lat_lon_dms_vilbel
46
- assert_equal ["50 11 31.3", "8 44 5.0"], @wgs84.lat_lon_dms(50.192028, 8.734722)
45
+ def test_lat_lon_butzbach
46
+ assert_equal [50.427417, 8.680056], @wgs84.lat_lon("50 25 38.7", "8 40 48.2")
47
47
  end
48
48
 
49
- def test_lat_lon_dms_butzbach
50
- assert_equal ["50 25 38.7", "8 40 48.2"], @wgs84.lat_lon_dms(50.427417, 8.680056)
49
+ def test_lat_lon_gilserberg
50
+ assert_equal [50.946111, 9.070972], @wgs84.lat_lon("50 56 46.0", "9 4 15.5")
51
51
  end
52
52
 
53
- def test_lat_lon_dms_gilserberg
54
- assert_equal ["50 56 46.0", "9 4 15.5"], @wgs84.lat_lon_dms(50.946111, 9.070972)
53
+ def test_lat_lon_gruenberg
54
+ assert_equal [50.609694, 8.904167], @wgs84.lat_lon("50 36 34.9", "8 54 15.0")
55
55
  end
56
56
 
57
- def test_lat_lon_dms_gruenberg
58
- assert_equal ["50 36 34.9", "8 54 15.0"], @wgs84.lat_lon_dms(50.609694, 8.904167)
57
+ def test_lat_lon_haiger
58
+ assert_equal [50.761806, 8.156833], @wgs84.lat_lon("50 45 42.5", "8 9 24.6")
59
59
  end
60
60
 
61
- def test_lat_lon_dms_haiger
62
- assert_equal ["50 45 42.5", "8 9 24.6"], @wgs84.lat_lon_dms(50.761806, 8.156833)
61
+ def test_lat_lon_herborn
62
+ assert_equal [50.670333, 8.258556], @wgs84.lat_lon("50 40 13.2", "8 15 30.8")
63
63
  end
64
64
 
65
- def test_lat_lon_dms_herborn
66
- assert_equal ["50 40 13.2", "8 15 30.8"], @wgs84.lat_lon_dms(50.670333, 8.258556)
65
+ def test_lat_lon_homberg
66
+ assert_equal [50.743639, 9.019222], @wgs84.lat_lon("50 44 37.1", "9 1 9.2")
67
67
  end
68
68
 
69
- def test_lat_lon_dms_homberg
70
- assert_equal ["50 44 37.1", "9 1 9.2"], @wgs84.lat_lon_dms(50.743639, 9.019222)
69
+ def test_lat_lon_limburg
70
+ assert_equal [50.405778, 8.082222], @wgs84.lat_lon("50 24 20.8", "8 4 56.0")
71
71
  end
72
72
 
73
- def test_lat_lon_dms_limburg
74
- assert_equal ["50 24 20.8", "8 4 56.0"], @wgs84.lat_lon_dms(50.405778, 8.082222)
73
+ def test_lat_lon_marburg
74
+ assert_equal [50.833833, 8.769333], @wgs84.lat_lon("50 50 1.8", "8 46 9.6")
75
75
  end
76
76
 
77
- def test_lat_lon_dms_marburg
78
- assert_equal ["50 50 1.8", "8 46 9.6"], @wgs84.lat_lon_dms(50.833833, 8.769333)
77
+ def test_lat_lon_pohlheim
78
+ assert_equal [50.536833, 8.7125], @wgs84.lat_lon("50 32 12.6", "8 42 45.0")
79
79
  end
80
80
 
81
- def test_lat_lon_dms_pohlheim
82
- assert_equal ["50 32 12.6", "8 42 45.0"], @wgs84.lat_lon_dms(50.536833, 8.7125)
81
+ def test_lat_lon_siegen
82
+ assert_equal [50.853028, 8.000667], @wgs84.lat_lon("50 51 10.9", "8 0 2.4")
83
83
  end
84
84
 
85
- def test_lat_lon_dms_siegen
86
- assert_equal ["50 51 10.9", "8 0 2.4"], @wgs84.lat_lon_dms(50.853028, 8.000667)
87
- end
88
-
89
- def test_lat_lon_dms_wetzlar
90
- assert_equal ["50 33 13.6", "8 29 32.2"], @wgs84.lat_lon_dms(50.553778, 8.492278)
85
+ def test_lat_lon_wetzlar
86
+ assert_equal [50.553778, 8.492278], @wgs84.lat_lon("50 33 13.6", "8 29 32.2")
91
87
  end
92
88
  end
93
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geodesic_wgs84
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.32.11
4
+ version: 1.32.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand