rgeo 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +29 -0
  3. data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
  4. data/ext/geos_c_impl/coordinates.c +65 -0
  5. data/ext/geos_c_impl/coordinates.h +2 -0
  6. data/ext/geos_c_impl/extconf.rb +19 -43
  7. data/ext/geos_c_impl/geometry.c +24 -0
  8. data/ext/geos_c_impl/geometry_collection.c +99 -1
  9. data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
  10. data/ext/geos_c_impl/line_string.c +38 -0
  11. data/ext/geos_c_impl/mkmf.log +123 -0
  12. data/ext/geos_c_impl/point.c +27 -0
  13. data/ext/geos_c_impl/polygon.c +26 -0
  14. data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
  15. data/ext/proj4_c_impl/extconf.rb +32 -32
  16. data/ext/proj4_c_impl/mkmf.log +47 -0
  17. data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
  18. data/lib/rgeo.rb +10 -11
  19. data/lib/rgeo/cartesian.rb +7 -12
  20. data/lib/rgeo/cartesian/analysis.rb +13 -26
  21. data/lib/rgeo/cartesian/bounding_box.rb +45 -114
  22. data/lib/rgeo/cartesian/calculations.rb +3 -21
  23. data/lib/rgeo/cartesian/factory.rb +101 -122
  24. data/lib/rgeo/cartesian/feature_classes.rb +9 -59
  25. data/lib/rgeo/cartesian/feature_methods.rb +15 -45
  26. data/lib/rgeo/cartesian/interface.rb +6 -17
  27. data/lib/rgeo/coord_sys.rb +9 -15
  28. data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
  29. data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
  30. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
  31. data/lib/rgeo/coord_sys/proj4.rb +28 -67
  32. data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
  33. data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
  34. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
  35. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
  36. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
  37. data/lib/rgeo/error.rb +0 -6
  38. data/lib/rgeo/feature.rb +18 -23
  39. data/lib/rgeo/feature/curve.rb +0 -14
  40. data/lib/rgeo/feature/factory.rb +13 -38
  41. data/lib/rgeo/feature/factory_generator.rb +4 -16
  42. data/lib/rgeo/feature/geometry.rb +18 -60
  43. data/lib/rgeo/feature/geometry_collection.rb +3 -17
  44. data/lib/rgeo/feature/line.rb +0 -10
  45. data/lib/rgeo/feature/line_string.rb +1 -13
  46. data/lib/rgeo/feature/linear_ring.rb +0 -9
  47. data/lib/rgeo/feature/mixins.rb +11 -36
  48. data/lib/rgeo/feature/multi_curve.rb +0 -11
  49. data/lib/rgeo/feature/multi_line_string.rb +0 -9
  50. data/lib/rgeo/feature/multi_point.rb +0 -9
  51. data/lib/rgeo/feature/multi_polygon.rb +0 -9
  52. data/lib/rgeo/feature/multi_surface.rb +0 -12
  53. data/lib/rgeo/feature/point.rb +0 -13
  54. data/lib/rgeo/feature/polygon.rb +1 -14
  55. data/lib/rgeo/feature/surface.rb +0 -12
  56. data/lib/rgeo/feature/types.rb +19 -61
  57. data/lib/rgeo/geographic.rb +10 -15
  58. data/lib/rgeo/geographic/factory.rb +126 -147
  59. data/lib/rgeo/geographic/interface.rb +67 -81
  60. data/lib/rgeo/geographic/proj4_projector.rb +13 -37
  61. data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
  62. data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
  63. data/lib/rgeo/geographic/projected_window.rb +15 -67
  64. data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
  65. data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
  66. data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
  67. data/lib/rgeo/geographic/spherical_math.rb +26 -51
  68. data/lib/rgeo/geos.rb +23 -20
  69. data/lib/rgeo/geos/capi_factory.rb +125 -131
  70. data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
  71. data/lib/rgeo/geos/ffi_factory.rb +90 -143
  72. data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
  73. data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
  74. data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
  75. data/lib/rgeo/geos/interface.rb +4 -23
  76. data/lib/rgeo/geos/utils.rb +4 -19
  77. data/lib/rgeo/geos/zm_factory.rb +82 -131
  78. data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
  79. data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
  80. data/lib/rgeo/impl_helper.rb +8 -13
  81. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
  82. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
  83. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
  84. data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
  85. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
  86. data/lib/rgeo/impl_helper/math.rb +4 -10
  87. data/lib/rgeo/impl_helper/utils.rb +2 -10
  88. data/lib/rgeo/version.rb +1 -1
  89. data/lib/rgeo/wkrep.rb +4 -9
  90. data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
  91. data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
  92. data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
  93. data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
  94. data/lib/rgeo/yaml.rb +1 -7
  95. data/test/common/factory_tests.rb +4 -19
  96. data/test/common/geometry_collection_tests.rb +6 -39
  97. data/test/common/line_string_tests.rb +10 -39
  98. data/test/common/multi_line_string_tests.rb +10 -30
  99. data/test/common/multi_point_tests.rb +15 -34
  100. data/test/common/multi_polygon_tests.rb +26 -28
  101. data/test/common/point_tests.rb +37 -59
  102. data/test/common/polygon_tests.rb +16 -25
  103. data/test/coord_sys/tc_ogc_cs.rb +151 -186
  104. data/test/coord_sys/tc_proj4.rb +35 -60
  105. data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
  106. data/test/coord_sys/tc_sr_org.rb +11 -19
  107. data/test/coord_sys/tc_url_reader.rb +13 -23
  108. data/test/geos_capi/tc_factory.rb +7 -16
  109. data/test/geos_capi/tc_geometry_collection.rb +6 -14
  110. data/test/geos_capi/tc_line_string.rb +7 -15
  111. data/test/geos_capi/tc_misc.rb +26 -41
  112. data/test/geos_capi/tc_multi_line_string.rb +6 -14
  113. data/test/geos_capi/tc_multi_point.rb +7 -15
  114. data/test/geos_capi/tc_multi_polygon.rb +8 -18
  115. data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
  116. data/test/geos_capi/tc_point.rb +12 -26
  117. data/test/geos_capi/tc_polygon.rb +52 -17
  118. data/test/geos_capi/tc_zmfactory.rb +7 -18
  119. data/test/geos_ffi/tc_factory.rb +7 -16
  120. data/test/geos_ffi/tc_geometry_collection.rb +7 -15
  121. data/test/geos_ffi/tc_line_string.rb +7 -15
  122. data/test/geos_ffi/tc_misc.rb +8 -18
  123. data/test/geos_ffi/tc_multi_line_string.rb +7 -15
  124. data/test/geos_ffi/tc_multi_point.rb +8 -16
  125. data/test/geos_ffi/tc_multi_polygon.rb +9 -18
  126. data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
  127. data/test/geos_ffi/tc_point.rb +13 -28
  128. data/test/geos_ffi/tc_polygon.rb +7 -17
  129. data/test/geos_ffi/tc_zmfactory.rb +8 -19
  130. data/test/projected_geographic/tc_factory.rb +7 -15
  131. data/test/projected_geographic/tc_geometry_collection.rb +7 -15
  132. data/test/projected_geographic/tc_line_string.rb +7 -15
  133. data/test/projected_geographic/tc_multi_line_string.rb +7 -16
  134. data/test/projected_geographic/tc_multi_point.rb +8 -17
  135. data/test/projected_geographic/tc_multi_polygon.rb +8 -16
  136. data/test/projected_geographic/tc_point.rb +11 -23
  137. data/test/projected_geographic/tc_polygon.rb +7 -15
  138. data/test/simple_cartesian/tc_calculations.rb +6 -22
  139. data/test/simple_cartesian/tc_factory.rb +7 -16
  140. data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
  141. data/test/simple_cartesian/tc_line_string.rb +6 -15
  142. data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
  143. data/test/simple_cartesian/tc_multi_point.rb +7 -16
  144. data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
  145. data/test/simple_cartesian/tc_point.rb +10 -21
  146. data/test/simple_cartesian/tc_polygon.rb +6 -15
  147. data/test/simple_mercator/tc_factory.rb +6 -14
  148. data/test/simple_mercator/tc_geometry_collection.rb +6 -14
  149. data/test/simple_mercator/tc_line_string.rb +6 -14
  150. data/test/simple_mercator/tc_multi_line_string.rb +6 -15
  151. data/test/simple_mercator/tc_multi_point.rb +7 -16
  152. data/test/simple_mercator/tc_multi_polygon.rb +7 -15
  153. data/test/simple_mercator/tc_point.rb +11 -24
  154. data/test/simple_mercator/tc_polygon.rb +6 -14
  155. data/test/simple_mercator/tc_window.rb +10 -34
  156. data/test/spherical_geographic/tc_calculations.rb +5 -32
  157. data/test/spherical_geographic/tc_factory.rb +6 -15
  158. data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
  159. data/test/spherical_geographic/tc_line_string.rb +6 -15
  160. data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
  161. data/test/spherical_geographic/tc_multi_point.rb +7 -16
  162. data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
  163. data/test/spherical_geographic/tc_point.rb +10 -22
  164. data/test/spherical_geographic/tc_polygon.rb +6 -15
  165. data/test/tc_cartesian_analysis.rb +4 -16
  166. data/test/tc_cartesian_bbox.rb +7 -21
  167. data/test/tc_mixins.rb +8 -25
  168. data/test/tc_oneoff.rb +5 -13
  169. data/test/tc_types.rb +7 -16
  170. data/test/wkrep/tc_wkb_generator.rb +63 -97
  171. data/test/wkrep/tc_wkb_parser.rb +63 -100
  172. data/test/wkrep/tc_wkt_generator.rb +54 -92
  173. data/test/wkrep/tc_wkt_parser.rb +84 -133
  174. metadata +39 -9
  175. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
  176. data/test/coord_sys/tc_active_record_table.rb +0 -79
@@ -4,29 +4,21 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/polygon_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/polygon_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module SimpleMercator # :nodoc:
16
-
17
- class TestPolygon < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module SimpleMercator # :nodoc:
15
+ class TestPolygon < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
17
  @factory = ::RGeo::Geographic.simple_mercator_factory
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::PolygonTests
26
-
27
-
28
21
  end
29
-
30
22
  end
31
23
  end
32
24
  end
@@ -4,41 +4,33 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
7
+ require "test/unit"
8
+ require "rgeo"
10
9
 
11
10
  module RGeo
12
- module Tests # :nodoc:
13
- module SimpleMercator # :nodoc:
14
-
15
- class TestWindow < ::Test::Unit::TestCase # :nodoc:
16
-
17
-
11
+ module Tests # :nodoc:
12
+ module SimpleMercator # :nodoc:
13
+ class TestWindow < ::Test::Unit::TestCase # :nodoc:
18
14
  def setup
19
15
  @factory = ::RGeo::Geographic.simple_mercator_factory
20
16
  end
21
17
 
22
-
23
18
  def assert_close_enough(p1_, p2_)
24
19
  assert((p1_.x - p2_.x).abs < 0.00001 && (p1_.y - p2_.y).abs < 0.00001)
25
20
  end
26
21
 
27
-
28
22
  def assert_contains_approx(p_, mp_)
29
- assert(mp_.any?{ |q_| (p_.x - q_.x).abs < 0.00001 && (p_.y - q_.y).abs < 0.00001 })
23
+ assert(mp_.any? { |q_| (p_.x - q_.x).abs < 0.00001 && (p_.y - q_.y).abs < 0.00001 })
30
24
  end
31
25
 
32
-
33
26
  def test_limits
34
27
  limits_ = @factory.projection_limits_window
35
- assert_in_delta(-20037508, limits_.x_min, 1)
36
- assert_in_delta(-20037508, limits_.y_min, 1)
37
- assert_in_delta(20037508, limits_.x_max, 1)
38
- assert_in_delta(20037508, limits_.y_max, 1)
28
+ assert_in_delta(-20_037_508, limits_.x_min, 1)
29
+ assert_in_delta(-20_037_508, limits_.y_min, 1)
30
+ assert_in_delta(20_037_508, limits_.x_max, 1)
31
+ assert_in_delta(20_037_508, limits_.y_max, 1)
39
32
  end
40
33
 
41
-
42
34
  def test_limits_unprojected
43
35
  limits_ = @factory.projection_limits_window
44
36
  assert_close_enough(@factory.point(-180, -85.051129), limits_.sw_point)
@@ -48,7 +40,6 @@ module RGeo
48
40
  assert_close_enough(@factory.point(0, 0), limits_.center_point)
49
41
  end
50
42
 
51
-
52
43
  def test_center_point
53
44
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(-160, -30), @factory.point(170, 30))
54
45
  assert_close_enough(@factory.point(5, 0), window1_.center_point)
@@ -56,7 +47,6 @@ module RGeo
56
47
  assert_close_enough(@factory.point(175, 0), window2_.center_point)
57
48
  end
58
49
 
59
-
60
50
  def test_random_point
61
51
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(-170, 30), @factory.point(-160, 40))
62
52
  20.times { assert(window1_.contains_point?(window1_.random_point)) }
@@ -64,7 +54,6 @@ module RGeo
64
54
  20.times { assert(window2_.contains_point?(window2_.random_point)) }
65
55
  end
66
56
 
67
-
68
57
  def test_crosses_seam
69
58
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(-170, 30), @factory.point(170, 40))
70
59
  assert(!window1_.crosses_seam?)
@@ -72,7 +61,6 @@ module RGeo
72
61
  assert(window2_.crosses_seam?)
73
62
  end
74
63
 
75
-
76
64
  def test_degenerate
77
65
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(-20, 30), @factory.point(-10, 40))
78
66
  assert(!window1_.degenerate?)
@@ -82,7 +70,6 @@ module RGeo
82
70
  assert(window3_.degenerate?)
83
71
  end
84
72
 
85
-
86
73
  def test_contains_point
87
74
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(-170, 30), @factory.point(-160, 40))
88
75
  window2_ = Geographic::ProjectedWindow.for_corners(@factory.point(170, 30), @factory.point(-170, 40))
@@ -100,7 +87,6 @@ module RGeo
100
87
  assert(!window2_.contains_point?(point5_))
101
88
  end
102
89
 
103
-
104
90
  def test_noseam_contains_window
105
91
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(10, 10), @factory.point(30, 30))
106
92
  assert(window1_.contains_window?(Geographic::ProjectedWindow.for_corners(@factory.point(15, 15), @factory.point(25, 25))))
@@ -120,7 +106,6 @@ module RGeo
120
106
  assert(!window1_.contains_window?(Geographic::ProjectedWindow.for_corners(@factory.point(170, 35), @factory.point(-170, 40))))
121
107
  end
122
108
 
123
-
124
109
  def test_seam_contains_window
125
110
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(160, 10), @factory.point(-160, 30))
126
111
  assert(window1_.contains_window?(Geographic::ProjectedWindow.for_corners(@factory.point(175, 15), @factory.point(-175, 25))))
@@ -136,7 +121,6 @@ module RGeo
136
121
  assert(!window1_.contains_window?(Geographic::ProjectedWindow.for_corners(@factory.point(150, 15), @factory.point(-150, 25))))
137
122
  end
138
123
 
139
-
140
124
  def test_scaled_by
141
125
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(20, -20), @factory.point(50, 40))
142
126
  window1s_ = window1_.scaled_by(2, 1.5)
@@ -146,7 +130,6 @@ module RGeo
146
130
  assert(!window1s_.contains_point?(@factory.point(10, -35)))
147
131
  end
148
132
 
149
-
150
133
  def test_scaled_by_across_seam
151
134
  window1_ = Geographic::ProjectedWindow.for_corners(@factory.point(170, -20), @factory.point(-160, 40))
152
135
  window1s_ = window1_.scaled_by(2, 1.5)
@@ -156,7 +139,6 @@ module RGeo
156
139
  assert(!window1s_.contains_point?(@factory.point(-140, 45)))
157
140
  end
158
141
 
159
-
160
142
  def test_surrounding_point
161
143
  window1_ = Geographic::ProjectedWindow.surrounding_point(@factory.point(20, -20), 1)
162
144
  assert(window1_.contains_point?(@factory.point(20, -20)))
@@ -164,7 +146,6 @@ module RGeo
164
146
  assert(!window1_.contains_point?(@factory.point(19, -20)))
165
147
  end
166
148
 
167
-
168
149
  def test_bounding_1_point
169
150
  window1_ = Geographic::ProjectedWindow.bounding_points([@factory.point(20, -20)]).with_margin(1)
170
151
  assert(window1_.contains_point?(@factory.point(20, -20)))
@@ -172,7 +153,6 @@ module RGeo
172
153
  assert(!window1_.contains_point?(@factory.point(19, -20)))
173
154
  end
174
155
 
175
-
176
156
  def test_bounding_2_points
177
157
  window1_ = Geographic::ProjectedWindow.bounding_points([@factory.point(10, 10), @factory.point(30, 30)])
178
158
  assert(window1_.contains_point?(@factory.point(20, 20)))
@@ -180,7 +160,6 @@ module RGeo
180
160
  assert(!window1_.contains_point?(@factory.point(20, 35)))
181
161
  end
182
162
 
183
-
184
163
  def test_bounding_2_points_across_seam
185
164
  window1_ = Geographic::ProjectedWindow.bounding_points([@factory.point(-170, 10), @factory.point(170, 30)])
186
165
  assert(window1_.contains_point?(@factory.point(-174, 20)))
@@ -188,10 +167,7 @@ module RGeo
188
167
  assert(!window1_.contains_point?(@factory.point(160, 20)))
189
168
  assert(!window1_.contains_point?(@factory.point(-174, 35)))
190
169
  end
191
-
192
-
193
170
  end
194
-
195
171
  end
196
172
  end
197
173
  end
@@ -4,17 +4,13 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
7
+ require "test/unit"
8
+ require "rgeo"
10
9
 
11
10
  module RGeo
12
- module Tests # :nodoc:
13
- module SphericalGeographic # :nodoc:
14
-
15
- class TestCalculations < ::Test::Unit::TestCase # :nodoc:
16
-
17
-
11
+ module Tests # :nodoc:
12
+ module SphericalGeographic # :nodoc:
13
+ class TestCalculations < ::Test::Unit::TestCase # :nodoc:
18
14
  def assert_close_enough(v1_, v2_)
19
15
  diff_ = (v1_ - v2_).abs
20
16
  # denom_ = (v1_ + v2_).abs
@@ -22,14 +18,12 @@ module RGeo
22
18
  assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
23
19
  end
24
20
 
25
-
26
21
  def test_point_eql
27
22
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
28
23
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
29
24
  assert_equal(point1_, point2_)
30
25
  end
31
26
 
32
-
33
27
  def test_point_from_latlng
34
28
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.from_latlon(45, -45)
35
29
  assert_close_enough(0.5, point1_.x)
@@ -37,70 +31,60 @@ module RGeo
37
31
  assert_close_enough(::Math.sqrt(2) * 0.5, point1_.z)
38
32
  end
39
33
 
40
-
41
34
  def test_point_dot_one
42
35
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
43
36
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
44
37
  assert_close_enough(1.0, point1_ * point2_)
45
38
  end
46
39
 
47
-
48
40
  def test_point_dot_minusone
49
41
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
50
42
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, -1, -1)
51
43
  assert_close_enough(-1.0, point1_ * point2_)
52
44
  end
53
45
 
54
-
55
46
  def test_point_dot_zero
56
47
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
57
48
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
58
49
  assert_close_enough(0.0, point1_ * point2_)
59
50
  end
60
51
 
61
-
62
52
  def test_point_cross
63
53
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
64
54
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
65
55
  assert_close_enough(-1.0, (point1_ % point2_).z)
66
56
  end
67
57
 
68
-
69
58
  def test_point_cross_coincident
70
59
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
71
60
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
72
61
  assert_nil(point1_ % point2_)
73
62
  end
74
63
 
75
-
76
64
  def test_point_cross_opposite
77
65
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
78
66
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
79
67
  assert_nil(point1_ % point2_)
80
68
  end
81
69
 
82
-
83
70
  def test_distance_coincident
84
71
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
85
72
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
86
73
  assert_equal(0.0, point1_.dist_to_point(point2_))
87
74
  end
88
75
 
89
-
90
76
  def test_distance_opposite
91
77
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
92
78
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
93
79
  assert_close_enough(::Math::PI, point1_.dist_to_point(point2_))
94
80
  end
95
81
 
96
-
97
82
  def test_distance_right_angle
98
83
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
99
84
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -1, 0)
100
85
  assert_close_enough(::Math::PI / 2, point1_.dist_to_point(point2_))
101
86
  end
102
87
 
103
-
104
88
  def test_arc_axis
105
89
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
106
90
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
@@ -108,7 +92,6 @@ module RGeo
108
92
  assert_close_enough(-1.0, arc1_.axis.z)
109
93
  end
110
94
 
111
-
112
95
  def test_arc_axis2
113
96
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
114
97
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0)
@@ -116,7 +99,6 @@ module RGeo
116
99
  assert_close_enough(1.0, arc1_.axis.z)
117
100
  end
118
101
 
119
-
120
102
  def test_arc_intersects_point_off
121
103
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
122
104
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
@@ -125,7 +107,6 @@ module RGeo
125
107
  assert_equal(false, arc1_.contains_point?(point3_))
126
108
  end
127
109
 
128
-
129
110
  def test_arc_intersects_point_between
130
111
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
131
112
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
@@ -134,7 +115,6 @@ module RGeo
134
115
  assert_equal(true, arc1_.contains_point?(point3_))
135
116
  end
136
117
 
137
-
138
118
  def test_arc_intersects_point_endpoint
139
119
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
140
120
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
@@ -142,7 +122,6 @@ module RGeo
142
122
  assert_equal(true, arc1_.contains_point?(point1_))
143
123
  end
144
124
 
145
-
146
125
  def test_arc_intersects_arc_true
147
126
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
148
127
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
@@ -153,7 +132,6 @@ module RGeo
153
132
  assert_equal(true, arc1_.intersects_arc?(arc2_))
154
133
  end
155
134
 
156
-
157
135
  def test_arc_intersects_arc_parallel
158
136
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
159
137
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
@@ -164,7 +142,6 @@ module RGeo
164
142
  assert_equal(false, arc1_.intersects_arc?(arc2_))
165
143
  end
166
144
 
167
-
168
145
  def test_arc_intersects_arc_separated_tee
169
146
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
170
147
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
@@ -175,7 +152,6 @@ module RGeo
175
152
  assert_equal(false, arc1_.intersects_arc?(arc2_))
176
153
  end
177
154
 
178
-
179
155
  def test_arc_intersects_arc_connected_tee
180
156
  point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
181
157
  point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
@@ -185,10 +161,7 @@ module RGeo
185
161
  arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
186
162
  assert_equal(true, arc1_.intersects_arc?(arc2_))
187
163
  end
188
-
189
-
190
164
  end
191
-
192
165
  end
193
166
  end
194
167
  end
@@ -4,33 +4,24 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/factory_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/factory_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module SphericalGeographic # :nodoc:
16
-
17
- class TestFactory < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module SphericalGeographic # :nodoc:
15
+ class TestFactory < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
17
  @factory = ::RGeo::Geographic.spherical_factory
22
18
  @srid = 4055
23
19
  end
24
20
 
25
-
26
21
  include ::RGeo::Tests::Common::FactoryTests
27
22
 
28
-
29
23
  undef_method :test_srid_preserved_through_geom_operations
30
-
31
-
32
24
  end
33
-
34
25
  end
35
26
  end
36
27
  end
@@ -4,37 +4,28 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/geometry_collection_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module SphericalGeographic # :nodoc:
16
-
17
- class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module SphericalGeographic # :nodoc:
15
+ class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
20
16
  def create_factory
21
17
  @factory = ::RGeo::Geographic.spherical_factory
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::GeometryCollectionTests
26
21
 
27
-
28
22
  undef_method :test_fully_equal
29
23
  undef_method :test_geometrically_equal
30
24
  undef_method :test_empty_equal
31
25
  undef_method :test_not_equal
32
26
  undef_method :test_empty_collection_envelope
33
27
  undef_method :test_empty_collection_boundary
34
-
35
-
36
28
  end
37
-
38
29
  end
39
30
  end
40
31
  end