rgeo 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/ext/geos_c_impl/extconf.rb +1 -0
  3. data/ext/geos_c_impl/factory.c +10 -1
  4. data/ext/geos_c_impl/geometry.c +25 -3
  5. data/ext/geos_c_impl/line_string.c +1 -12
  6. data/ext/geos_c_impl/polygon.c +0 -3
  7. data/ext/geos_c_impl/preface.h +3 -0
  8. data/lib/rgeo.rb +0 -1
  9. data/lib/rgeo/feature/geometry.rb +17 -0
  10. data/lib/rgeo/feature/types.rb +4 -4
  11. data/lib/rgeo/geographic/projected_feature_methods.rb +1 -22
  12. data/lib/rgeo/geos/ffi_feature_methods.rb +5 -0
  13. data/lib/rgeo/geos/utils.rb +2 -0
  14. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +1 -0
  15. data/lib/rgeo/version.rb +1 -1
  16. metadata +11 -171
  17. data/lib/rgeo/yaml.rb +0 -23
  18. data/test/cartesian_analysis_test.rb +0 -65
  19. data/test/cartesian_bbox_test.rb +0 -123
  20. data/test/common/factory_tests.rb +0 -78
  21. data/test/common/geometry_collection_tests.rb +0 -237
  22. data/test/common/line_string_tests.rb +0 -330
  23. data/test/common/multi_line_string_tests.rb +0 -182
  24. data/test/common/multi_point_tests.rb +0 -200
  25. data/test/common/multi_polygon_tests.rb +0 -191
  26. data/test/common/point_tests.rb +0 -370
  27. data/test/common/polygon_tests.rb +0 -228
  28. data/test/coord_sys/ogc_cs_test.rb +0 -342
  29. data/test/coord_sys/proj4_srs_data_test.rb +0 -41
  30. data/test/coord_sys/proj4_test.rb +0 -150
  31. data/test/coord_sys/sr_org_test.rb +0 -32
  32. data/test/coord_sys/url_reader_test.rb +0 -42
  33. data/test/geos_capi/factory_test.rb +0 -31
  34. data/test/geos_capi/geometry_collection_test.rb +0 -24
  35. data/test/geos_capi/line_string_test.rb +0 -24
  36. data/test/geos_capi/misc_test.rb +0 -116
  37. data/test/geos_capi/multi_line_string_test.rb +0 -24
  38. data/test/geos_capi/multi_point_test.rb +0 -24
  39. data/test/geos_capi/multi_polygon_test.rb +0 -39
  40. data/test/geos_capi/parsing_unparsing_test.rb +0 -40
  41. data/test/geos_capi/point_test.rb +0 -72
  42. data/test/geos_capi/polygon_test.rb +0 -154
  43. data/test/geos_capi/zmfactory_test.rb +0 -57
  44. data/test/geos_ffi/factory_test.rb +0 -31
  45. data/test/geos_ffi/geometry_collection_test.rb +0 -24
  46. data/test/geos_ffi/line_string_test.rb +0 -24
  47. data/test/geos_ffi/misc_test.rb +0 -63
  48. data/test/geos_ffi/multi_line_string_test.rb +0 -24
  49. data/test/geos_ffi/multi_point_test.rb +0 -24
  50. data/test/geos_ffi/multi_polygon_test.rb +0 -33
  51. data/test/geos_ffi/parsing_unparsing_test.rb +0 -41
  52. data/test/geos_ffi/point_test.rb +0 -77
  53. data/test/geos_ffi/polygon_test.rb +0 -46
  54. data/test/geos_ffi/zmfactory_test.rb +0 -58
  55. data/test/mixins_test.rb +0 -141
  56. data/test/oneoff_test.rb +0 -26
  57. data/test/projected_geographic/factory_test.rb +0 -25
  58. data/test/projected_geographic/geometry_collection_test.rb +0 -24
  59. data/test/projected_geographic/line_string_test.rb +0 -24
  60. data/test/projected_geographic/multi_line_string_test.rb +0 -26
  61. data/test/projected_geographic/multi_point_test.rb +0 -30
  62. data/test/projected_geographic/multi_polygon_test.rb +0 -25
  63. data/test/projected_geographic/point_test.rb +0 -51
  64. data/test/projected_geographic/polygon_test.rb +0 -24
  65. data/test/simple_cartesian/calculations_test.rb +0 -99
  66. data/test/simple_cartesian/factory_test.rb +0 -27
  67. data/test/simple_cartesian/geometry_collection_test.rb +0 -30
  68. data/test/simple_cartesian/line_string_test.rb +0 -31
  69. data/test/simple_cartesian/multi_line_string_test.rb +0 -28
  70. data/test/simple_cartesian/multi_point_test.rb +0 -31
  71. data/test/simple_cartesian/multi_polygon_test.rb +0 -31
  72. data/test/simple_cartesian/point_test.rb +0 -50
  73. data/test/simple_cartesian/polygon_test.rb +0 -28
  74. data/test/simple_mercator/factory_test.rb +0 -25
  75. data/test/simple_mercator/geometry_collection_test.rb +0 -24
  76. data/test/simple_mercator/line_string_test.rb +0 -24
  77. data/test/simple_mercator/multi_line_string_test.rb +0 -26
  78. data/test/simple_mercator/multi_point_test.rb +0 -29
  79. data/test/simple_mercator/multi_polygon_test.rb +0 -25
  80. data/test/simple_mercator/point_test.rb +0 -55
  81. data/test/simple_mercator/polygon_test.rb +0 -24
  82. data/test/simple_mercator/window_test.rb +0 -173
  83. data/test/spherical_geographic/calculations_test.rb +0 -167
  84. data/test/spherical_geographic/factory_test.rb +0 -27
  85. data/test/spherical_geographic/geometry_collection_test.rb +0 -31
  86. data/test/spherical_geographic/line_string_test.rb +0 -31
  87. data/test/spherical_geographic/multi_line_string_test.rb +0 -29
  88. data/test/spherical_geographic/multi_point_test.rb +0 -31
  89. data/test/spherical_geographic/multi_polygon_test.rb +0 -31
  90. data/test/spherical_geographic/point_test.rb +0 -78
  91. data/test/spherical_geographic/polygon_test.rb +0 -28
  92. data/test/types_test.rb +0 -42
  93. data/test/wkrep/wkb_generator_test.rb +0 -185
  94. data/test/wkrep/wkb_parser_test.rb +0 -293
  95. data/test/wkrep/wkt_generator_test.rb +0 -294
  96. data/test/wkrep/wkt_parser_test.rb +0 -412
@@ -1,167 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the internal calculations for simple spherical
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- module RGeo
11
- module Tests # :nodoc:
12
- module SphericalGeographic # :nodoc:
13
- class TestCalculations < ::Test::Unit::TestCase # :nodoc:
14
- def assert_close_enough(v1_, v2_)
15
- diff_ = (v1_ - v2_).abs
16
- # denom_ = (v1_ + v2_).abs
17
- # diff_ /= denom_ if denom_ > 0.01
18
- assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
19
- end
20
-
21
- def test_point_eql
22
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
23
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
24
- assert_equal(point1_, point2_)
25
- end
26
-
27
- def test_point_from_latlng
28
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.from_latlon(45, -45)
29
- assert_close_enough(0.5, point1_.x)
30
- assert_close_enough(-0.5, point1_.y)
31
- assert_close_enough(::Math.sqrt(2) * 0.5, point1_.z)
32
- end
33
-
34
- def test_point_dot_one
35
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
36
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
37
- assert_close_enough(1.0, point1_ * point2_)
38
- end
39
-
40
- def test_point_dot_minusone
41
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
42
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, -1, -1)
43
- assert_close_enough(-1.0, point1_ * point2_)
44
- end
45
-
46
- def test_point_dot_zero
47
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
48
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
49
- assert_close_enough(0.0, point1_ * point2_)
50
- end
51
-
52
- def test_point_cross
53
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
54
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
55
- assert_close_enough(-1.0, (point1_ % point2_).z)
56
- end
57
-
58
- def test_point_cross_coincident
59
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
60
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
61
- assert_nil(point1_ % point2_)
62
- end
63
-
64
- def test_point_cross_opposite
65
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
66
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
67
- assert_nil(point1_ % point2_)
68
- end
69
-
70
- def test_distance_coincident
71
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
72
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
73
- assert_equal(0.0, point1_.dist_to_point(point2_))
74
- end
75
-
76
- def test_distance_opposite
77
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
78
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
79
- assert_close_enough(::Math::PI, point1_.dist_to_point(point2_))
80
- end
81
-
82
- def test_distance_right_angle
83
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
84
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -1, 0)
85
- assert_close_enough(::Math::PI / 2, point1_.dist_to_point(point2_))
86
- end
87
-
88
- def test_arc_axis
89
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
90
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
91
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
92
- assert_close_enough(-1.0, arc1_.axis.z)
93
- end
94
-
95
- def test_arc_axis2
96
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
97
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0)
98
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
99
- assert_close_enough(1.0, arc1_.axis.z)
100
- end
101
-
102
- def test_arc_intersects_point_off
103
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
104
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
105
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0.1)
106
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
107
- assert_equal(false, arc1_.contains_point?(point3_))
108
- end
109
-
110
- def test_arc_intersects_point_between
111
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
112
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
113
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0)
114
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
115
- assert_equal(true, arc1_.contains_point?(point3_))
116
- end
117
-
118
- def test_arc_intersects_point_endpoint
119
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
120
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
121
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
122
- assert_equal(true, arc1_.contains_point?(point1_))
123
- end
124
-
125
- def test_arc_intersects_arc_true
126
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
127
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
128
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-0.1, 0, 1)
129
- point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
130
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
131
- arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
132
- assert_equal(true, arc1_.intersects_arc?(arc2_))
133
- end
134
-
135
- def test_arc_intersects_arc_parallel
136
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
137
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
138
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0.1, 1)
139
- point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, -0.1, 1)
140
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
141
- arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
142
- assert_equal(false, arc1_.intersects_arc?(arc2_))
143
- end
144
-
145
- def test_arc_intersects_arc_separated_tee
146
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
147
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
148
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
149
- point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.2, 0, 1)
150
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
151
- arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
152
- assert_equal(false, arc1_.intersects_arc?(arc2_))
153
- end
154
-
155
- def test_arc_intersects_arc_connected_tee
156
- point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
157
- point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
158
- point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0, 1)
159
- point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
160
- arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
161
- arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
162
- assert_equal(true, arc1_.intersects_arc?(arc2_))
163
- end
164
- end
165
- end
166
- end
167
- end
@@ -1,27 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS factory
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/factory_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestFactory < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- @srid = 4055
19
- end
20
-
21
- include ::RGeo::Tests::Common::FactoryTests
22
-
23
- undef_method :test_srid_preserved_through_geom_operations
24
- end
25
- end
26
- end
27
- end
@@ -1,31 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical geometry collection implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/geometry_collection_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- end
19
-
20
- include ::RGeo::Tests::Common::GeometryCollectionTests
21
-
22
- undef_method :test_fully_equal
23
- undef_method :test_geometrically_equal
24
- undef_method :test_empty_equal
25
- undef_method :test_not_equal
26
- undef_method :test_empty_collection_envelope
27
- undef_method :test_empty_collection_boundary
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical line string implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/line_string_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestLineString < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- end
19
-
20
- include ::RGeo::Tests::Common::LineStringTests
21
-
22
- undef_method :test_fully_equal
23
- undef_method :test_geometrically_equal_but_different_type
24
- undef_method :test_geometrically_equal_but_different_type2
25
- undef_method :test_geometrically_equal_but_different_overlap
26
- undef_method :test_empty_equal
27
- undef_method :test_not_equal
28
- end
29
- end
30
- end
31
- end
@@ -1,29 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical multi line string implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_line_string_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- end
19
-
20
- include ::RGeo::Tests::Common::MultiLineStringTests
21
-
22
- undef_method :test_fully_equal
23
- undef_method :test_geometrically_equal
24
- undef_method :test_not_equal
25
- undef_method :test_length
26
- end
27
- end
28
- end
29
- end
@@ -1,31 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical multi point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_point_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory(opts_ = {})
17
- @factory = ::RGeo::Geographic.spherical_factory(opts_)
18
- end
19
-
20
- include ::RGeo::Tests::Common::MultiPointTests
21
-
22
- undef_method :test_fully_equal
23
- undef_method :test_geometrically_equal
24
- undef_method :test_not_equal
25
- undef_method :test_union
26
- undef_method :test_difference
27
- undef_method :test_intersection
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical multi polygon implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_polygon_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
16
- def create_factories
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- @lenient_factory = ::RGeo::Geographic.spherical_factory(lenient_multi_polygon_assertions: true)
19
- end
20
-
21
- include ::RGeo::Tests::Common::MultiPolygonTests
22
-
23
- undef_method :test_creation_wrong_type
24
- undef_method :test_creation_overlapping
25
- undef_method :test_creation_connected
26
- undef_method :test_equal
27
- undef_method :test_not_equal
28
- end
29
- end
30
- end
31
- end
@@ -1,78 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/point_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestPoint < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geographic.spherical_factory(buffer_resolution: 8)
18
- @zfactory = ::RGeo::Geographic.spherical_factory(has_z_coordinate: true)
19
- @mfactory = ::RGeo::Geographic.spherical_factory(has_m_coordinate: true)
20
- @zmfactory = ::RGeo::Geographic.spherical_factory(has_z_coordinate: true, has_m_coordinate: true)
21
- end
22
-
23
- include ::RGeo::Tests::Common::PointTests
24
-
25
- def test_latlon
26
- point_ = @factory.point(21, -22)
27
- assert_equal(21, point_.longitude)
28
- assert_equal(-22, point_.latitude)
29
- end
30
-
31
- def test_antimeridian_positive
32
- point_ = @factory.point(180, 85)
33
- assert_equal(180, point_.longitude)
34
- assert_equal(85, point_.latitude)
35
- end
36
-
37
- def test_antimeridian_netagive
38
- point_ = @factory.point(-180, -85)
39
- assert_equal(-180, point_.longitude)
40
- assert_equal(-85, point_.latitude)
41
- end
42
-
43
- def test_srid
44
- point_ = @factory.point(11, 12)
45
- assert_equal(4055, point_.srid)
46
- end
47
-
48
- def test_distance
49
- point1_ = @factory.point(0, 10)
50
- point2_ = @factory.point(0, 10)
51
- point3_ = @factory.point(0, 40)
52
- assert_in_delta(0, point1_.distance(point2_), 0.0001)
53
- assert_in_delta(::Math::PI / 6.0 * ::RGeo::Geographic::SphericalMath::RADIUS, point1_.distance(point3_), 0.0001)
54
- end
55
-
56
- def test_floating_point_perturbation
57
- # A naive way of wrapping longitudes to [-180,180] might cause
58
- # perturbation due to floating point errors. Make sure this
59
- # doesn't happen.
60
- point_ = @factory.point(-98.747534, 38.057583)
61
- assert_equal(-98.747534, point_.x)
62
- end
63
-
64
- undef_method :test_disjoint
65
- undef_method :test_intersects
66
- undef_method :test_touches
67
- undef_method :test_crosses
68
- undef_method :test_within
69
- undef_method :test_contains
70
- undef_method :test_overlaps
71
- undef_method :test_intersection
72
- undef_method :test_union
73
- undef_method :test_difference
74
- undef_method :test_sym_difference
75
- end
76
- end
77
- end
78
- end
@@ -1,28 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the simple spherical polygon implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/polygon_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module SphericalGeographic # :nodoc:
15
- class TestPolygon < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geographic.spherical_factory
18
- end
19
-
20
- include ::RGeo::Tests::Common::PolygonTests
21
-
22
- undef_method :test_fully_equal
23
- undef_method :test_geometrically_equal_but_ordered_different
24
- undef_method :test_geometrically_equal_but_different_directions
25
- end
26
- end
27
- end
28
- end