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,27 +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 GeosCAPI # :nodoc:
16
-
17
- class TestPolygon < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosCAPI # :nodoc:
15
+ class TestPolygon < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
17
  @factory = ::RGeo::Geos.factory
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::PolygonTests
26
21
 
27
-
28
22
  def test_intersection
29
23
  point1_ = @factory.point(0, 0)
30
24
  point2_ = @factory.point(0, 2)
@@ -36,7 +30,6 @@ module RGeo
36
30
  assert_equal(poly2_, poly3_)
37
31
  end
38
32
 
39
-
40
33
  def test_union
41
34
  point1_ = @factory.point(0, 0)
42
35
  point2_ = @factory.point(0, 2)
@@ -48,21 +41,63 @@ module RGeo
48
41
  assert_equal(poly1_, poly3_)
49
42
  end
50
43
 
51
-
52
44
  def test_simplify
53
45
  xys = [[0, 0], [5, 0], [10, 0], [10, 10], [5, 10.2], [0, 10], [0, 0]]
54
- points = xys.collect { |x,y| @factory.point(x, y) }
46
+ points = xys.collect { |x, y| @factory.point(x, y) }
55
47
  poly = @factory.polygon(@factory.linear_ring(points))
56
48
  simplified = poly.simplify(0.3)
57
49
  new_points = simplified.exterior_ring.points
58
50
  extra = new_points.reject { |p| [0, 10].include?(p.x) and [0, 10].include?(p.y) }
59
51
  assert_equal 5, new_points.length, "Closed ring of the square should have 5 points"
60
- assert_equal 0, extra.length , "Should only have x/y's on 0 and 10"
52
+ assert_equal 0, extra.length, "Should only have x/y's on 0 and 10"
61
53
  end
62
54
 
55
+ def test_buffer
56
+ polygon_coordinates = [[0.5527864045000421, 3.776393202250021],
57
+ [0.7763932022500211, 4.447213595499958],
58
+ [1.4472135954999579, 4.223606797749979],
59
+ [2.447213595499958, 2.223606797749979],
60
+ [2.223606797749979, 1.5527864045000421],
61
+ [1.5527864045000421, 1.776393202250021],
62
+ [0.5527864045000421, 3.776393202250021]]
63
+
64
+ points_arr = polygon_coordinates.map { |v| @factory.point(v[0], v[1]) }
65
+ outer_ring = @factory.linear_ring(points_arr)
66
+ polygon = @factory.polygon(outer_ring)
67
+
68
+ point1 = @factory.point(2, 2)
69
+ point2 = @factory.point(1, 4)
70
+ line_string = @factory.line_string([point1, point2])
71
+ polygon2 = line_string.buffer(0.5)
72
+
73
+ assert_equal polygon, polygon2
74
+ end
63
75
 
76
+ def test_buffer_with_style
77
+ polygon_coordinates = [[0.7316718427000253, 3.865835921350013],
78
+ [1.0, 4.3], [6.0, 4.3], [6.3, 4.3],
79
+ [6.3, 3.7], [1.4854101966249682, 3.7],
80
+ [2.2683281572999747, 2.134164078649987],
81
+ [2.4024922359499623, 1.8658359213500124],
82
+ [1.8658359213500126, 1.597507764050038],
83
+ [0.7316718427000253, 3.865835921350013]]
84
+
85
+ points_arr = polygon_coordinates.map { |v| @factory.point(v[0], v[1]) }
86
+ outer_ring = @factory.linear_ring(points_arr)
87
+ polygon = @factory.polygon(outer_ring)
88
+
89
+ point1 = @factory.point(2, 2)
90
+ point2 = @factory.point(1, 4)
91
+ point3 = @factory.point(6, 4)
92
+ line_string = @factory.line_string([point1, point2, point3])
93
+ buffered_line_string = line_string.buffer_with_style(0.3,
94
+ RGeo::Geos::CAP_FLAT,
95
+ RGeo::Geos::JOIN_ROUND,
96
+ 0.0)
97
+
98
+ assert_equal polygon, buffered_line_string
99
+ end
64
100
  end
65
-
66
101
  end
67
102
  end
68
103
  end if ::RGeo::Geos.capi_supported?
@@ -4,35 +4,28 @@
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 GeosCAPI # :nodoc:
16
-
17
- class TestZMFactory < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosCAPI # :nodoc:
15
+ class TestZMFactory < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
- @factory = ::RGeo::Geos.factory(:has_z_coordinate => true, :has_m_coordinate => true, :srid => 1000, :buffer_resolution => 2)
17
+ @factory = ::RGeo::Geos.factory(has_z_coordinate: true, has_m_coordinate: true, srid: 1000, buffer_resolution: 2)
22
18
  @srid = 1000
23
19
  end
24
20
 
25
-
26
21
  include ::RGeo::Tests::Common::FactoryTests
27
22
 
28
-
29
23
  def test_is_geos_factory
30
24
  assert_equal(true, ::RGeo::Geos.is_geos?(@factory))
31
25
  assert_equal(true, ::RGeo::Geos.is_capi_geos?(@factory))
32
26
  assert_equal(false, ::RGeo::Geos.is_ffi_geos?(@factory))
33
27
  end
34
28
 
35
-
36
29
  def test_factory_parts
37
30
  assert_equal(1000, @factory.srid)
38
31
  assert_equal(1000, @factory.z_factory.srid)
@@ -48,7 +41,6 @@ module RGeo
48
41
  assert(@factory.m_factory.property(:has_m_coordinate))
49
42
  end
50
43
 
51
-
52
44
  def test_4d_point
53
45
  point_ = @factory.point(1, 2, 3, 4)
54
46
  assert_equal(Feature::Point, point_.geometry_type)
@@ -59,10 +51,7 @@ module RGeo
59
51
  assert_nil(point_.m_geometry.z)
60
52
  assert_equal(4, point_.m_geometry.m)
61
53
  end
62
-
63
-
64
54
  end
65
-
66
55
  end
67
56
  end
68
57
  end if ::RGeo::Geos.capi_supported?
@@ -4,37 +4,28 @@
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 GeosFFI # :nodoc:
16
-
17
- class TestFactory < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestFactory < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
- @factory = ::RGeo::Geos.factory(:srid => 1000, :native_interface => :ffi)
17
+ @factory = ::RGeo::Geos.factory(srid: 1000, native_interface: :ffi)
22
18
  @srid = 1000
23
19
  end
24
20
 
25
-
26
21
  include ::RGeo::Tests::Common::FactoryTests
27
22
 
28
-
29
23
  def test_is_geos_factory
30
24
  assert_equal(true, ::RGeo::Geos.is_geos?(@factory))
31
25
  assert_equal(false, ::RGeo::Geos.is_capi_geos?(@factory))
32
26
  assert_equal(true, ::RGeo::Geos.is_ffi_geos?(@factory))
33
27
  end
34
-
35
-
36
28
  end
37
-
38
29
  end
39
30
  end
40
31
  end if ::RGeo::Geos.ffi_supported?
@@ -4,29 +4,21 @@
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 GeosFFI # :nodoc:
16
-
17
- class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
20
16
  def create_factory
21
- ::RGeo::Geos.factory(:native_interface => :ffi)
17
+ ::RGeo::Geos.factory(native_interface: :ffi)
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::GeometryCollectionTests
26
-
27
-
28
21
  end
29
-
30
22
  end
31
23
  end
32
24
  end if ::RGeo::Geos.ffi_supported?
@@ -4,29 +4,21 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/line_string_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module GeosFFI # :nodoc:
16
-
17
- class TestLineString < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestLineString < ::Test::Unit::TestCase # :nodoc:
20
16
  def setup
21
- @factory = ::RGeo::Geos.factory(:native_interface => :ffi)
17
+ @factory = ::RGeo::Geos.factory(native_interface: :ffi)
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::LineStringTests
26
-
27
-
28
21
  end
29
-
30
22
  end
31
23
  end
32
24
  end if ::RGeo::Geos.ffi_supported?
@@ -4,22 +4,17 @@
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 GeosFFI # :nodoc:
14
-
15
- class TestMisc < ::Test::Unit::TestCase # :nodoc:
16
-
17
-
11
+ module Tests # :nodoc:
12
+ module GeosFFI # :nodoc:
13
+ class TestMisc < ::Test::Unit::TestCase # :nodoc:
18
14
  def setup
19
- @factory = ::RGeo::Geos.factory(:srid => 4326, :native_interface => :ffi)
15
+ @factory = ::RGeo::Geos.factory(srid: 4326, native_interface: :ffi)
20
16
  end
21
17
 
22
-
23
18
  def test_empty_geometries_equal
24
19
  geom1_ = @factory.collection([])
25
20
  geom2_ = @factory.line_string([])
@@ -27,7 +22,6 @@ module RGeo
27
22
  assert(geom1_.equals?(geom2_))
28
23
  end
29
24
 
30
-
31
25
  def test_prepare
32
26
  p1_ = @factory.point(1, 2)
33
27
  p2_ = @factory.point(3, 4)
@@ -38,7 +32,6 @@ module RGeo
38
32
  assert_equal(true, polygon_.prepared?)
39
33
  end
40
34
 
41
-
42
35
  def test_auto_prepare
43
36
  p1_ = @factory.point(1, 2)
44
37
  p2_ = @factory.point(3, 4)
@@ -50,8 +43,8 @@ module RGeo
50
43
  polygon_.intersects?(p2_)
51
44
  assert_equal(true, polygon_.prepared?)
52
45
 
53
- factory_no_auto_prepare_ = ::RGeo::Geos.factory(:srid => 4326,
54
- :native_interface => :ffi, :auto_prepare => :disabled)
46
+ factory_no_auto_prepare_ = ::RGeo::Geos.factory(srid: 4326,
47
+ native_interface: :ffi, auto_prepare: :disabled)
55
48
  polygon2_ = factory_no_auto_prepare_.polygon(
56
49
  factory_no_auto_prepare_.linear_ring([p1_, p2_, p3_, p1_]))
57
50
  assert_equal(false, polygon2_.prepared?)
@@ -60,10 +53,7 @@ module RGeo
60
53
  polygon2_.intersects?(p2_)
61
54
  assert_equal(false, polygon2_.prepared?)
62
55
  end
63
-
64
-
65
56
  end
66
-
67
57
  end
68
58
  end
69
59
  end if ::RGeo::Geos.ffi_supported?
@@ -4,29 +4,21 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/multi_line_string_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module GeosFFI # :nodoc:
16
-
17
- class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
20
16
  def create_factory
21
- ::RGeo::Geos.factory(:native_interface => :ffi)
17
+ ::RGeo::Geos.factory(native_interface: :ffi)
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::MultiLineStringTests
26
-
27
-
28
21
  end
29
-
30
22
  end
31
23
  end
32
24
  end if ::RGeo::Geos.ffi_supported?
@@ -4,29 +4,21 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/multi_point_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module GeosFFI # :nodoc:
16
-
17
- class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
20
- def create_factory(opts_={})
21
- ::RGeo::Geos.factory(opts_.merge(:native_interface => :ffi))
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
16
+ def create_factory(opts_ = {})
17
+ ::RGeo::Geos.factory(opts_.merge(native_interface: :ffi))
22
18
  end
23
19
 
24
-
25
20
  include ::RGeo::Tests::Common::MultiPointTests
26
-
27
-
28
21
  end
29
-
30
22
  end
31
23
  end
32
24
  end if ::RGeo::Geos.ffi_supported?
@@ -4,39 +4,30 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
10
- require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__FILE__))
7
+ require "test/unit"
8
+ require "rgeo"
11
9
 
10
+ require ::File.expand_path("../common/multi_polygon_tests.rb", ::File.dirname(__FILE__))
12
11
 
13
12
  module RGeo
14
- module Tests # :nodoc:
15
- module GeosFFI # :nodoc:
16
-
17
- class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
18
-
19
-
13
+ module Tests # :nodoc:
14
+ module GeosFFI # :nodoc:
15
+ class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
20
16
  def create_factories
21
- @factory = ::RGeo::Geos.factory(:native_interface => :ffi)
22
- @lenient_factory = ::RGeo::Geos.factory(:lenient_multi_polygon_assertions => true,
23
- :native_interface => :ffi)
17
+ @factory = ::RGeo::Geos.factory(native_interface: :ffi)
18
+ @lenient_factory = ::RGeo::Geos.factory(lenient_multi_polygon_assertions: true,
19
+ native_interface: :ffi)
24
20
  end
25
21
 
26
-
27
22
  include ::RGeo::Tests::Common::MultiPolygonTests
28
23
 
29
-
30
24
  # Centroid of an empty should return an empty collection
31
25
  # rather than throw a weird exception out of ffi-geos
32
26
 
33
27
  def test_empty_centroid
34
28
  assert_equal(@factory.collection([]), @factory.multi_polygon([]).centroid)
35
29
  end
36
-
37
-
38
30
  end
39
-
40
31
  end
41
32
  end
42
33
  end if ::RGeo::Geos.ffi_supported?