rgeo 0.1.19 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/History.rdoc +11 -0
  2. data/README.rdoc +23 -7
  3. data/Version +1 -1
  4. data/ext/geos_c_impl/factory.c +1 -1
  5. data/{lib/rgeo/geography/simple_mercator.rb → ext/proj4_c_impl/extconf.rb} +35 -30
  6. data/ext/proj4_c_impl/main.c +256 -0
  7. data/lib/rgeo.rb +54 -42
  8. data/lib/rgeo/active_record/arel_modifications.rb +2 -2
  9. data/lib/rgeo/active_record/base_modifications.rb +1 -1
  10. data/lib/rgeo/active_record/mysql_common.rb +12 -12
  11. data/lib/rgeo/all.rb +5 -4
  12. data/lib/rgeo/cartesian.rb +3 -2
  13. data/lib/rgeo/cartesian/bounding_box.rb +9 -9
  14. data/lib/rgeo/cartesian/factory.rb +30 -13
  15. data/lib/rgeo/cartesian/feature_classes.rb +33 -33
  16. data/lib/rgeo/cartesian/interface.rb +2 -2
  17. data/lib/rgeo/{geography/all.rb → coord_sys.rb} +22 -4
  18. data/lib/rgeo/coord_sys/proj4.rb +275 -0
  19. data/lib/rgeo/{errors.rb → error.rb} +5 -6
  20. data/lib/rgeo/{features.rb → feature.rb} +22 -20
  21. data/lib/rgeo/{features → feature}/curve.rb +6 -6
  22. data/lib/rgeo/{features → feature}/factory.rb +19 -3
  23. data/lib/rgeo/{features → feature}/factory_generator.rb +1 -1
  24. data/lib/rgeo/{features → feature}/geometry.rb +34 -34
  25. data/lib/rgeo/{features → feature}/geometry_collection.rb +4 -4
  26. data/lib/rgeo/{features → feature}/line.rb +1 -1
  27. data/lib/rgeo/{features → feature}/line_string.rb +4 -4
  28. data/lib/rgeo/{features → feature}/linear_ring.rb +1 -1
  29. data/lib/rgeo/{features → feature}/multi_curve.rb +3 -3
  30. data/lib/rgeo/{features → feature}/multi_line_string.rb +1 -1
  31. data/lib/rgeo/{features → feature}/multi_point.rb +1 -1
  32. data/lib/rgeo/{features → feature}/multi_polygon.rb +1 -1
  33. data/lib/rgeo/{features → feature}/multi_surface.rb +4 -4
  34. data/lib/rgeo/{features → feature}/point.rb +5 -5
  35. data/lib/rgeo/{features → feature}/polygon.rb +5 -5
  36. data/lib/rgeo/{features → feature}/surface.rb +4 -4
  37. data/lib/rgeo/feature/types.rb +301 -0
  38. data/lib/rgeo/geo_json.rb +1 -1
  39. data/lib/rgeo/geo_json/coder.rb +13 -13
  40. data/lib/rgeo/geo_json/interface.rb +2 -2
  41. data/lib/rgeo/geography.rb +33 -6
  42. data/lib/rgeo/geography/factory.rb +82 -39
  43. data/lib/rgeo/geography/interface.rb +135 -89
  44. data/lib/rgeo/geography/proj4_projector.rb +98 -0
  45. data/lib/rgeo/geography/projected_feature_classes.rb +213 -0
  46. data/lib/rgeo/geography/projected_feature_methods.rb +228 -0
  47. data/lib/rgeo/geography/projected_window.rb +7 -7
  48. data/lib/rgeo/geography/simple_mercator_projector.rb +133 -0
  49. data/lib/rgeo/geography/spherical_feature_classes.rb +212 -0
  50. data/lib/rgeo/geography/{simple_spherical/feature_methods.rb → spherical_feature_methods.rb} +39 -43
  51. data/lib/rgeo/geography/{simple_spherical/calculations.rb → spherical_math.rb} +7 -7
  52. data/lib/rgeo/geos.rb +1 -1
  53. data/lib/rgeo/geos/factory.rb +37 -19
  54. data/lib/rgeo/geos/impl_additions.rb +10 -11
  55. data/lib/rgeo/geos/interface.rb +1 -1
  56. data/lib/rgeo/geos/zm_factory.rb +15 -15
  57. data/lib/rgeo/geos/zm_impl.rb +10 -10
  58. data/lib/rgeo/{impl_helpers.rb → impl_helper.rb} +8 -8
  59. data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_collection_methods.rb +13 -13
  60. data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_methods.rb +2 -2
  61. data/lib/rgeo/{impl_helpers → impl_helper}/basic_line_string_methods.rb +13 -13
  62. data/lib/rgeo/{impl_helpers → impl_helper}/basic_point_methods.rb +5 -5
  63. data/lib/rgeo/{impl_helpers → impl_helper}/basic_polygon_methods.rb +6 -6
  64. data/lib/rgeo/{impl_helpers → impl_helper}/math.rb +1 -1
  65. data/lib/rgeo/shapefile.rb +1 -1
  66. data/lib/rgeo/shapefile/reader.rb +3 -3
  67. data/lib/rgeo/wkrep.rb +1 -1
  68. data/lib/rgeo/wkrep/wkb_generator.rb +17 -17
  69. data/lib/rgeo/wkrep/wkb_parser.rb +12 -12
  70. data/lib/rgeo/wkrep/wkt_generator.rb +8 -8
  71. data/lib/rgeo/wkrep/wkt_parser.rb +10 -10
  72. data/{tests → test}/active_record/readme.txt +0 -0
  73. data/{tests → test}/active_record/tc_mysqlspatial.rb +2 -2
  74. data/{tests → test}/common/geometry_collection_tests.rb +22 -22
  75. data/{tests → test}/common/line_string_tests.rb +20 -20
  76. data/{tests → test}/common/multi_line_string_tests.rb +19 -19
  77. data/{tests → test}/common/multi_point_tests.rb +17 -17
  78. data/{tests → test}/common/multi_polygon_tests.rb +16 -16
  79. data/{tests → test}/common/point_tests.rb +9 -9
  80. data/{tests → test}/common/polygon_tests.rb +9 -9
  81. data/test/coord_sys/tc_proj4.rb +111 -0
  82. data/{tests → test}/geos/tc_factory.rb +1 -1
  83. data/{tests → test}/geos/tc_geometry_collection.rb +1 -1
  84. data/{tests → test}/geos/tc_line_string.rb +0 -0
  85. data/{tests → test}/geos/tc_misc.rb +1 -1
  86. data/{tests → test}/geos/tc_multi_line_string.rb +1 -1
  87. data/{tests → test}/geos/tc_multi_point.rb +1 -1
  88. data/{tests → test}/geos/tc_multi_polygon.rb +1 -1
  89. data/{tests → test}/geos/tc_point.rb +1 -1
  90. data/{tests → test}/geos/tc_polygon.rb +0 -0
  91. data/{tests → test}/geos/tc_zmfactory.rb +2 -2
  92. data/test/projected_geography/tc_geometry_collection.rb +62 -0
  93. data/test/projected_geography/tc_line_string.rb +62 -0
  94. data/test/projected_geography/tc_multi_line_string.rb +62 -0
  95. data/test/projected_geography/tc_multi_point.rb +62 -0
  96. data/test/projected_geography/tc_multi_polygon.rb +63 -0
  97. data/test/projected_geography/tc_point.rb +93 -0
  98. data/test/projected_geography/tc_polygon.rb +62 -0
  99. data/{tests → test}/shapefile/shapelib_testcases/readme.txt +0 -0
  100. data/{tests → test}/shapefile/shapelib_testcases/test.dbf +0 -0
  101. data/{tests → test}/shapefile/shapelib_testcases/test.shp +0 -0
  102. data/{tests → test}/shapefile/shapelib_testcases/test.shx +0 -0
  103. data/{tests → test}/shapefile/shapelib_testcases/test0.shp +0 -0
  104. data/{tests → test}/shapefile/shapelib_testcases/test0.shx +0 -0
  105. data/{tests → test}/shapefile/shapelib_testcases/test1.shp +0 -0
  106. data/{tests → test}/shapefile/shapelib_testcases/test1.shx +0 -0
  107. data/{tests → test}/shapefile/shapelib_testcases/test10.shp +0 -0
  108. data/{tests → test}/shapefile/shapelib_testcases/test10.shx +0 -0
  109. data/{tests → test}/shapefile/shapelib_testcases/test11.shp +0 -0
  110. data/{tests → test}/shapefile/shapelib_testcases/test11.shx +0 -0
  111. data/{tests → test}/shapefile/shapelib_testcases/test12.shp +0 -0
  112. data/{tests → test}/shapefile/shapelib_testcases/test12.shx +0 -0
  113. data/{tests → test}/shapefile/shapelib_testcases/test13.shp +0 -0
  114. data/{tests → test}/shapefile/shapelib_testcases/test13.shx +0 -0
  115. data/{tests → test}/shapefile/shapelib_testcases/test2.shp +0 -0
  116. data/{tests → test}/shapefile/shapelib_testcases/test2.shx +0 -0
  117. data/{tests → test}/shapefile/shapelib_testcases/test3.shp +0 -0
  118. data/{tests → test}/shapefile/shapelib_testcases/test3.shx +0 -0
  119. data/{tests → test}/shapefile/shapelib_testcases/test4.shp +0 -0
  120. data/{tests → test}/shapefile/shapelib_testcases/test4.shx +0 -0
  121. data/{tests → test}/shapefile/shapelib_testcases/test5.shp +0 -0
  122. data/{tests → test}/shapefile/shapelib_testcases/test5.shx +0 -0
  123. data/{tests → test}/shapefile/shapelib_testcases/test6.shp +0 -0
  124. data/{tests → test}/shapefile/shapelib_testcases/test6.shx +0 -0
  125. data/{tests → test}/shapefile/shapelib_testcases/test7.shp +0 -0
  126. data/{tests → test}/shapefile/shapelib_testcases/test7.shx +0 -0
  127. data/{tests → test}/shapefile/shapelib_testcases/test8.shp +0 -0
  128. data/{tests → test}/shapefile/shapelib_testcases/test8.shx +0 -0
  129. data/{tests → test}/shapefile/shapelib_testcases/test9.shp +0 -0
  130. data/{tests → test}/shapefile/shapelib_testcases/test9.shx +0 -0
  131. data/{tests → test}/shapefile/tc_shapelib_tests.rb +17 -17
  132. data/{tests → test}/simple_cartesian/tc_calculations.rb +0 -0
  133. data/{tests → test}/simple_cartesian/tc_geometry_collection.rb +0 -0
  134. data/{tests → test}/simple_cartesian/tc_line_string.rb +0 -0
  135. data/{tests → test}/simple_cartesian/tc_multi_line_string.rb +0 -0
  136. data/{tests → test}/simple_cartesian/tc_multi_point.rb +0 -0
  137. data/{tests → test}/simple_cartesian/tc_multi_polygon.rb +0 -0
  138. data/{tests → test}/simple_cartesian/tc_point.rb +0 -0
  139. data/{tests → test}/simple_cartesian/tc_polygon.rb +0 -0
  140. data/{tests → test}/simple_mercator/tc_geometry_collection.rb +1 -1
  141. data/{tests → test}/simple_mercator/tc_line_string.rb +0 -0
  142. data/{tests → test}/simple_mercator/tc_multi_line_string.rb +1 -1
  143. data/{tests → test}/simple_mercator/tc_multi_point.rb +1 -1
  144. data/{tests → test}/simple_mercator/tc_multi_polygon.rb +1 -1
  145. data/{tests → test}/simple_mercator/tc_point.rb +2 -2
  146. data/{tests → test}/simple_mercator/tc_polygon.rb +0 -0
  147. data/{tests → test}/simple_mercator/tc_window.rb +1 -1
  148. data/test/spherical_geography/tc_calculations.rb +203 -0
  149. data/{tests/simple_spherical → test/spherical_geography}/tc_geometry_collection.rb +2 -2
  150. data/{tests/simple_spherical → test/spherical_geography}/tc_line_string.rb +2 -2
  151. data/{tests/simple_spherical → test/spherical_geography}/tc_multi_line_string.rb +2 -2
  152. data/{tests/simple_spherical → test/spherical_geography}/tc_multi_point.rb +2 -2
  153. data/{tests/simple_spherical → test/spherical_geography}/tc_multi_polygon.rb +3 -3
  154. data/{tests/simple_spherical → test/spherical_geography}/tc_point.rb +7 -7
  155. data/{tests/simple_spherical → test/spherical_geography}/tc_polygon.rb +2 -2
  156. data/{tests → test}/tc_cartesian_analysis.rb +0 -0
  157. data/{tests → test}/tc_geojson.rb +0 -0
  158. data/{tests → test}/tc_oneoff.rb +2 -1
  159. data/{tests → test}/wkrep/tc_wkb_generator.rb +0 -0
  160. data/{tests → test}/wkrep/tc_wkb_parser.rb +32 -32
  161. data/{tests → test}/wkrep/tc_wkt_generator.rb +0 -0
  162. data/{tests → test}/wkrep/tc_wkt_parser.rb +46 -46
  163. metadata +183 -164
  164. data/lib/rgeo/features/types.rb +0 -272
  165. data/lib/rgeo/geography/simple_mercator/feature_classes.rb +0 -279
  166. data/lib/rgeo/geography/simple_mercator/feature_methods.rb +0 -278
  167. data/lib/rgeo/geography/simple_mercator/projector.rb +0 -112
  168. data/lib/rgeo/geography/simple_spherical.rb +0 -68
  169. data/lib/rgeo/geography/simple_spherical/feature_classes.rb +0 -216
  170. data/tests/simple_spherical/tc_calculations.rb +0 -203
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -42,7 +42,7 @@ require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirn
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleMercator
45
+ module SimpleMercator # :nodoc:
46
46
 
47
47
  class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
48
48
 
File without changes
@@ -42,7 +42,7 @@ require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirnam
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleMercator
45
+ module SimpleMercator # :nodoc:
46
46
 
47
47
  class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
48
48
 
@@ -42,7 +42,7 @@ require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FI
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleMercator
45
+ module SimpleMercator # :nodoc:
46
46
 
47
47
  class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
@@ -42,7 +42,7 @@ require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleMercator
45
+ module SimpleMercator # :nodoc:
46
46
 
47
47
  class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
48
48
 
@@ -42,7 +42,7 @@ require ::File.expand_path('../common/point_tests.rb', ::File.dirname(__FILE__))
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleMercator
45
+ module SimpleMercator # :nodoc:
46
46
 
47
47
  class TestPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
@@ -82,7 +82,7 @@ module RGeo
82
82
  point2_ = @factory.point(11, 12)
83
83
  point3_ = @factory.point(13, 12)
84
84
  assert_in_delta(0, point1_.distance(point2_), 0.0001)
85
- assert_in_delta(217773, point1_.distance(point3_), 1)
85
+ assert_in_delta(222638, point1_.distance(point3_), 1)
86
86
  end
87
87
 
88
88
 
File without changes
@@ -40,7 +40,7 @@ require 'rgeo'
40
40
 
41
41
  module RGeo
42
42
  module Tests # :nodoc:
43
- module SimpleMercator
43
+ module SimpleMercator # :nodoc:
44
44
 
45
45
  class TestWindow < ::Test::Unit::TestCase # :nodoc:
46
46
 
@@ -0,0 +1,203 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for the internal calculations for simple spherical
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+ # Copyright 2010 Daniel Azuma
7
+ #
8
+ # All rights reserved.
9
+ #
10
+ # Redistribution and use in source and binary forms, with or without
11
+ # modification, are permitted provided that the following conditions are met:
12
+ #
13
+ # * Redistributions of source code must retain the above copyright notice,
14
+ # this list of conditions and the following disclaimer.
15
+ # * Redistributions in binary form must reproduce the above copyright notice,
16
+ # this list of conditions and the following disclaimer in the documentation
17
+ # and/or other materials provided with the distribution.
18
+ # * Neither the name of the copyright holder, nor the names of any other
19
+ # contributors to this software, may be used to endorse or promote products
20
+ # derived from this software without specific prior written permission.
21
+ #
22
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
+ # POSSIBILITY OF SUCH DAMAGE.
33
+ # -----------------------------------------------------------------------------
34
+ ;
35
+
36
+
37
+ require 'test/unit'
38
+ require 'rgeo'
39
+
40
+
41
+ module RGeo
42
+ module Tests # :nodoc:
43
+ module SphericalGeography # :nodoc:
44
+
45
+ class TestCalculations < ::Test::Unit::TestCase # :nodoc:
46
+
47
+
48
+ def assert_close_enough(v1_, v2_)
49
+ diff_ = (v1_ - v2_).abs
50
+ # denom_ = (v1_ + v2_).abs
51
+ # diff_ /= denom_ if denom_ > 0.01
52
+ assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
53
+ end
54
+
55
+
56
+ def test_point_eql
57
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
58
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
59
+ assert_equal(point1_, point2_)
60
+ end
61
+
62
+
63
+ def test_point_from_latlng
64
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.from_latlon(45, -45)
65
+ assert_close_enough(0.5, point1_.x)
66
+ assert_close_enough(-0.5, point1_.y)
67
+ assert_close_enough(::Math.sqrt(2) * 0.5, point1_.z)
68
+ end
69
+
70
+
71
+ def test_point_dot_one
72
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 1)
73
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 1)
74
+ assert_close_enough(1.0, point1_ * point2_)
75
+ end
76
+
77
+
78
+ def test_point_dot_minusone
79
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 1)
80
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(-1, -1, -1)
81
+ assert_close_enough(-1.0, point1_ * point2_)
82
+ end
83
+
84
+
85
+ def test_point_dot_zero
86
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 0)
87
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, -1, 0)
88
+ assert_close_enough(0.0, point1_ * point2_)
89
+ end
90
+
91
+
92
+ def test_point_cross
93
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 0)
94
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, -1, 0)
95
+ assert_close_enough(-1.0, (point1_ % point2_).z)
96
+ end
97
+
98
+
99
+ def test_point_cross_coincident
100
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
101
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
102
+ assert_nil(point1_ % point2_)
103
+ end
104
+
105
+
106
+ def test_point_cross_opposite
107
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
108
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(-1, 0, 0)
109
+ assert_nil(point1_ % point2_)
110
+ end
111
+
112
+
113
+ def test_arc_axis
114
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 1, 0)
115
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, -1, 0)
116
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
117
+ assert_close_enough(-1.0, arc1_.axis.z)
118
+ end
119
+
120
+
121
+ def test_arc_axis2
122
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
123
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000001, 0)
124
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
125
+ assert_close_enough(1.0, arc1_.axis.z)
126
+ end
127
+
128
+
129
+ def test_arc_intersects_point_off
130
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
131
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000002, 0)
132
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000001, 0.1)
133
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
134
+ assert_equal(false, arc1_.contains_point?(point3_))
135
+ end
136
+
137
+
138
+ def test_arc_intersects_point_between
139
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
140
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000002, 0)
141
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000001, 0)
142
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
143
+ assert_equal(true, arc1_.contains_point?(point3_))
144
+ end
145
+
146
+
147
+ def test_arc_intersects_point_endpoint
148
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0, 0)
149
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(1, 0.000002, 0)
150
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
151
+ assert_equal(true, arc1_.contains_point?(point1_))
152
+ end
153
+
154
+
155
+ def test_arc_intersects_arc_true
156
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, 0.1, 1)
157
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, -0.1, 1)
158
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(-0.1, 0, 1)
159
+ point4_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.1, 0, 1)
160
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
161
+ arc2_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point3_, point4_)
162
+ assert_equal(true, arc1_.intersects_arc?(arc2_))
163
+ end
164
+
165
+
166
+ def test_arc_intersects_arc_parallel
167
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, 0.1, 1)
168
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, -0.1, 1)
169
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.1, 0.1, 1)
170
+ point4_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.1, -0.1, 1)
171
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
172
+ arc2_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point3_, point4_)
173
+ assert_equal(false, arc1_.intersects_arc?(arc2_))
174
+ end
175
+
176
+
177
+ def test_arc_intersects_arc_separated_tee
178
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, 0.1, 1)
179
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, -0.1, 1)
180
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.1, 0, 1)
181
+ point4_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.2, 0, 1)
182
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
183
+ arc2_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point3_, point4_)
184
+ assert_equal(false, arc1_.intersects_arc?(arc2_))
185
+ end
186
+
187
+
188
+ def test_arc_intersects_arc_connected_tee
189
+ point1_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, 0.1, 1)
190
+ point2_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, -0.1, 1)
191
+ point3_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0, 0, 1)
192
+ point4_ = ::RGeo::Geography::SphericalMath::PointXYZ.new(0.1, 0, 1)
193
+ arc1_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point1_, point2_)
194
+ arc2_ = ::RGeo::Geography::SphericalMath::ArcXYZ.new(point3_, point4_)
195
+ assert_equal(true, arc1_.intersects_arc?(arc2_))
196
+ end
197
+
198
+
199
+ end
200
+
201
+ end
202
+ end
203
+ end
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirn
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- @factory = ::RGeo::Geography.simple_spherical
51
+ @factory = ::RGeo::Geography.spherical
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FI
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestLineString < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.simple_spherical
51
+ @factory = ::RGeo::Geography.spherical
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirnam
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- @factory = ::RGeo::Geography.simple_spherical
51
+ @factory = ::RGeo::Geography.spherical
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FI
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- @factory = ::RGeo::Geography.simple_spherical
51
+ @factory = ::RGeo::Geography.spherical
52
52
  end
53
53
 
54
54
 
@@ -42,14 +42,14 @@ require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factories
51
- @factory = ::RGeo::Geography.simple_spherical
52
- @lenient_factory = ::RGeo::Geography.simple_spherical(:lenient_multi_polygon_assertions => true)
51
+ @factory = ::RGeo::Geography.spherical
52
+ @lenient_factory = ::RGeo::Geography.spherical(:lenient_multi_polygon_assertions => true)
53
53
  end
54
54
 
55
55
 
@@ -42,16 +42,16 @@ require ::File.expand_path('../common/point_tests.rb', ::File.dirname(__FILE__))
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.simple_spherical
52
- @zfactory = ::RGeo::Geography.simple_spherical(:support_z_coordinate => true)
53
- @mfactory = ::RGeo::Geography.simple_spherical(:support_m_coordinate => true)
54
- @zmfactory = ::RGeo::Geography.simple_spherical(:support_z_coordinate => true, :support_m_coordinate => true)
51
+ @factory = ::RGeo::Geography.spherical
52
+ @zfactory = ::RGeo::Geography.spherical(:support_z_coordinate => true)
53
+ @mfactory = ::RGeo::Geography.spherical(:support_m_coordinate => true)
54
+ @zmfactory = ::RGeo::Geography.spherical(:support_z_coordinate => true, :support_m_coordinate => true)
55
55
  end
56
56
 
57
57
 
@@ -67,7 +67,7 @@ module RGeo
67
67
 
68
68
  def test_srid
69
69
  point_ = @factory.point(11, 12)
70
- assert_equal(4326, point_.srid)
70
+ assert_equal(4055, point_.srid)
71
71
  end
72
72
 
73
73
 
@@ -76,7 +76,7 @@ module RGeo
76
76
  point2_ = @factory.point(0, 10)
77
77
  point3_ = @factory.point(0, 40)
78
78
  assert_in_delta(0, point1_.distance(point2_), 0.0001)
79
- assert_in_delta(::Math::PI / 6.0 * ::RGeo::Geography::SimpleSpherical::RADIUS, point1_.distance(point3_), 0.0001)
79
+ assert_in_delta(::Math::PI / 6.0 * ::RGeo::Geography::SphericalMath::RADIUS, point1_.distance(point3_), 0.0001)
80
80
  end
81
81
 
82
82
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/polygon_tests.rb', ::File.dirname(__FILE__
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module SimpleSpherical # :nodoc:
45
+ module SphericalGeography # :nodoc:
46
46
 
47
47
  class TestPolygon < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.simple_spherical
51
+ @factory = ::RGeo::Geography.spherical
52
52
  end
53
53
 
54
54
 
File without changes
File without changes