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
@@ -180,22 +180,22 @@ module RGeo
180
180
  tag_ << ' M'
181
181
  end
182
182
  end
183
- if type_ == Features::Point
183
+ if type_ == Feature::Point
184
184
  tag_ + _generate_point(obj_)
185
- elsif type_.subtype_of?(Features::LineString)
185
+ elsif type_.subtype_of?(Feature::LineString)
186
186
  tag_ + _generate_line_string(obj_)
187
- elsif type_ == Features::Polygon
187
+ elsif type_ == Feature::Polygon
188
188
  tag_ + _generate_polygon(obj_)
189
- elsif type_ == Features::GeometryCollection
189
+ elsif type_ == Feature::GeometryCollection
190
190
  tag_ + _generate_geometry_collection(obj_)
191
- elsif type_ == Features::MultiPoint
191
+ elsif type_ == Feature::MultiPoint
192
192
  tag_ + _generate_multi_point(obj_)
193
- elsif type_ == Features::MultiLineString
193
+ elsif type_ == Feature::MultiLineString
194
194
  tag_ + _generate_multi_line_string(obj_)
195
- elsif type_ == Features::MultiPolygon
195
+ elsif type_ == Feature::MultiPolygon
196
196
  tag_ + _generate_multi_polygon(obj_)
197
197
  else
198
- raise Errors::ParseError, "Unrecognized geometry type: #{type_}"
198
+ raise Error::ParseError, "Unrecognized geometry type: #{type_}"
199
199
  end
200
200
  end
201
201
 
@@ -64,7 +64,7 @@ module RGeo
64
64
  # srid and dimension settings in the input. The factory generator
65
65
  # should understand the configuration options <tt>:srid</tt>,
66
66
  # <tt>:support_z_coordinate</tt>, and <tt>:support_m_coordinate</tt>.
67
- # See RGeo::Features::FactoryGenerator for more information.
67
+ # See RGeo::Feature::FactoryGenerator for more information.
68
68
  # If no generator is provided, the <tt>:default_factory</tt> is
69
69
  # used.
70
70
  # <tt>:support_ewkt</tt>::
@@ -192,7 +192,7 @@ module RGeo
192
192
  _start_scanner(str_)
193
193
  obj_ = _parse_type_tag(false)
194
194
  if @cur_token && !@ignore_extra_tokens
195
- raise Errors::ParseError, "Extra tokens beginning with #{@cur_token.inspect}."
195
+ raise Error::ParseError, "Extra tokens beginning with #{@cur_token.inspect}."
196
196
  end
197
197
  ensure
198
198
  _clean_scanner
@@ -203,10 +203,10 @@ module RGeo
203
203
 
204
204
  def _check_factory_support # :nodoc:
205
205
  if @cur_expect_z && !@cur_factory_support_z
206
- raise Errors::ParseError, "Geometry calls for Z coordinate but factory doesn't support it."
206
+ raise Error::ParseError, "Geometry calls for Z coordinate but factory doesn't support it."
207
207
  end
208
208
  if @cur_expect_m && !@cur_factory_support_m
209
- raise Errors::ParseError, "Geometry calls for M coordinate but factory doesn't support it."
209
+ raise Error::ParseError, "Geometry calls for M coordinate but factory doesn't support it."
210
210
  end
211
211
  end
212
212
 
@@ -245,13 +245,13 @@ module RGeo
245
245
  if @cur_expect_z.nil?
246
246
  @cur_expect_z = expect_z_
247
247
  elsif expect_z_ != @cur_expect_z
248
- raise Errors::ParseError, "Surrounding collection has Z but contained geometry doesn't."
248
+ raise Error::ParseError, "Surrounding collection has Z but contained geometry doesn't."
249
249
  end
250
250
  expect_m_ = zm_[-1,1] == 'm' ? true : false
251
251
  if @cur_expect_m.nil?
252
252
  @cur_expect_m = expect_m_
253
253
  else expect_m_ != @cur_expect_m
254
- raise Errors::ParseError, "Surrounding collection has M but contained geometry doesn't."
254
+ raise Error::ParseError, "Surrounding collection has M but contained geometry doesn't."
255
255
  end
256
256
  if creating_expectation_
257
257
  if @cur_factory
@@ -277,7 +277,7 @@ module RGeo
277
277
  when 'multipolygon'
278
278
  _parse_multi_polygon
279
279
  else
280
- raise Errors::ParseError, "Unknown type tag: #{type_.inspect}."
280
+ raise Error::ParseError, "Unknown type tag: #{type_.inspect}."
281
281
  end
282
282
  end
283
283
 
@@ -301,7 +301,7 @@ module RGeo
301
301
  @cur_expect_m = num_extras_ > 0 && (!@cur_factory || @cur_factory_support_m) ? true : false
302
302
  num_extras_ -= 1 if @cur_expect_m
303
303
  if num_extras_ > 0
304
- raise Errors::ParseError, "Found #{extra_.size+2} coordinates, which is too many for this factory."
304
+ raise Error::ParseError, "Found #{extra_.size+2} coordinates, which is too many for this factory."
305
305
  end
306
306
  _ensure_factory
307
307
  else
@@ -461,7 +461,7 @@ module RGeo
461
461
 
462
462
  def _expect_token_type(type_) # :nodoc:
463
463
  unless type_ === @cur_token
464
- raise Errors::ParseError, "#{type_.inspect} expected but #{@cur_token.inspect} found."
464
+ raise Error::ParseError, "#{type_.inspect} expected but #{@cur_token.inspect} found."
465
465
  end
466
466
  end
467
467
 
@@ -481,7 +481,7 @@ module RGeo
481
481
  when ']',')'
482
482
  @cur_token = :end
483
483
  else
484
- raise Errors::ParseError, "Bad token: #{token_.inspect}"
484
+ raise Error::ParseError, "Bad token: #{token_.inspect}"
485
485
  end
486
486
  else
487
487
  @cur_token = nil
File without changes
@@ -111,7 +111,7 @@ if ::File.exists?(::File.dirname(__FILE__)+'/database.yml')
111
111
  klass_.connection.create_table(:spatial_test) do |t_|
112
112
  t_.column 'latlon', :geometry
113
113
  end
114
- assert_equal(::RGeo::Features::Geometry, klass_.columns.last.geometric_type)
114
+ assert_equal(::RGeo::Feature::Geometry, klass_.columns.last.geometric_type)
115
115
  assert(klass_.cached_attributes.include?('latlon'))
116
116
  end
117
117
 
@@ -121,7 +121,7 @@ if ::File.exists?(::File.dirname(__FILE__)+'/database.yml')
121
121
  klass_.connection.create_table(:spatial_test) do |t_|
122
122
  t_.column 'latlon', :point
123
123
  end
124
- assert_equal(::RGeo::Features::Point, klass_.columns.last.geometric_type)
124
+ assert_equal(::RGeo::Feature::Point, klass_.columns.last.geometric_type)
125
125
  assert(klass_.cached_attributes.include?('latlon'))
126
126
  end
127
127
 
@@ -59,8 +59,8 @@ module RGeo
59
59
  def test_creation_simple
60
60
  geom_ = @factory.collection([@point1, @line1])
61
61
  assert_not_nil(geom_)
62
- assert(::RGeo::Features::GeometryCollection === geom_)
63
- assert_equal(::RGeo::Features::GeometryCollection, geom_.geometry_type)
62
+ assert(::RGeo::Feature::GeometryCollection === geom_)
63
+ assert_equal(::RGeo::Feature::GeometryCollection, geom_.geometry_type)
64
64
  assert_equal(2, geom_.num_geometries)
65
65
  assert(@point1.eql?(geom_[0]))
66
66
  assert(@line1.eql?(geom_[1]))
@@ -70,8 +70,8 @@ module RGeo
70
70
  def test_creation_empty
71
71
  geom_ = @factory.collection([])
72
72
  assert_not_nil(geom_)
73
- assert(::RGeo::Features::GeometryCollection === geom_)
74
- assert_equal(::RGeo::Features::GeometryCollection, geom_.geometry_type)
73
+ assert(::RGeo::Feature::GeometryCollection === geom_)
74
+ assert_equal(::RGeo::Feature::GeometryCollection, geom_.geometry_type)
75
75
  assert_equal(0, geom_.num_geometries)
76
76
  assert_equal([], geom_.to_a)
77
77
  end
@@ -80,8 +80,8 @@ module RGeo
80
80
  def test_creation_save_klass
81
81
  geom_ = @factory.collection([@point1, @line3])
82
82
  assert_not_nil(geom_)
83
- assert(::RGeo::Features::GeometryCollection === geom_)
84
- assert_equal(::RGeo::Features::GeometryCollection, geom_.geometry_type)
83
+ assert(::RGeo::Feature::GeometryCollection === geom_)
84
+ assert_equal(::RGeo::Feature::GeometryCollection, geom_.geometry_type)
85
85
  assert_equal(2, geom_.num_geometries)
86
86
  assert(geom_[1].eql?(@line3))
87
87
  end
@@ -91,8 +91,8 @@ module RGeo
91
91
  geom1_ = @factory.collection([@point1, @line1])
92
92
  geom2_ = @factory.collection([@point2, geom1_])
93
93
  assert_not_nil(geom2_)
94
- assert(::RGeo::Features::GeometryCollection === geom2_)
95
- assert_equal(::RGeo::Features::GeometryCollection, geom2_.geometry_type)
94
+ assert(::RGeo::Feature::GeometryCollection === geom2_)
95
+ assert_equal(::RGeo::Feature::GeometryCollection, geom2_.geometry_type)
96
96
  assert_equal(2, geom2_.num_geometries)
97
97
  assert(geom2_[1].eql?(geom1_))
98
98
  end
@@ -103,10 +103,10 @@ module RGeo
103
103
  geom2_ = @factory.collection([@point2, geom1_])
104
104
  ::GC.start
105
105
  assert_not_nil(geom2_)
106
- assert(::RGeo::Features::GeometryCollection === geom2_)
107
- assert_equal(::RGeo::Features::GeometryCollection, geom2_.geometry_type)
106
+ assert(::RGeo::Feature::GeometryCollection === geom2_)
107
+ assert_equal(::RGeo::Feature::GeometryCollection, geom2_.geometry_type)
108
108
  assert_equal(2, geom2_.num_geometries)
109
- assert_equal(::RGeo::Features::Line, geom2_[1][1].geometry_type)
109
+ assert_equal(::RGeo::Feature::Line, geom2_[1][1].geometry_type)
110
110
  end
111
111
 
112
112
 
@@ -160,7 +160,7 @@ module RGeo
160
160
  geom1_ = @factory.collection([@point1, @line1])
161
161
  geom2_ = geom1_.clone
162
162
  assert(geom1_.eql?(geom2_))
163
- assert_equal(::RGeo::Features::GeometryCollection, geom2_.geometry_type)
163
+ assert_equal(::RGeo::Feature::GeometryCollection, geom2_.geometry_type)
164
164
  assert_equal(2, geom2_.num_geometries)
165
165
  assert(@point1.eql?(geom2_[0]))
166
166
  assert(@line1.eql?(geom2_[1]))
@@ -169,15 +169,15 @@ module RGeo
169
169
 
170
170
  def test_type_check
171
171
  geom1_ = @factory.collection([@point1, @line1])
172
- assert(::RGeo::Features::Geometry.check_type(geom1_))
173
- assert(!::RGeo::Features::Point.check_type(geom1_))
174
- assert(::RGeo::Features::GeometryCollection.check_type(geom1_))
175
- assert(!::RGeo::Features::MultiPoint.check_type(geom1_))
172
+ assert(::RGeo::Feature::Geometry.check_type(geom1_))
173
+ assert(!::RGeo::Feature::Point.check_type(geom1_))
174
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom1_))
175
+ assert(!::RGeo::Feature::MultiPoint.check_type(geom1_))
176
176
  geom2_ = @factory.collection([@point1, @point2])
177
- assert(::RGeo::Features::Geometry.check_type(geom2_))
178
- assert(!::RGeo::Features::Point.check_type(geom2_))
179
- assert(::RGeo::Features::GeometryCollection.check_type(geom2_))
180
- assert(!::RGeo::Features::MultiPoint.check_type(geom2_))
177
+ assert(::RGeo::Feature::Geometry.check_type(geom2_))
178
+ assert(!::RGeo::Feature::Point.check_type(geom2_))
179
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom2_))
180
+ assert(!::RGeo::Feature::MultiPoint.check_type(geom2_))
181
181
  end
182
182
 
183
183
 
@@ -218,7 +218,7 @@ module RGeo
218
218
  def test_empty_collection_envelope
219
219
  empty_ = @factory.collection([])
220
220
  envelope_ = empty_.envelope
221
- assert_equal(Features::GeometryCollection, envelope_.geometry_type)
221
+ assert_equal(Feature::GeometryCollection, envelope_.geometry_type)
222
222
  assert_equal(0, envelope_.num_geometries)
223
223
  end
224
224
 
@@ -226,7 +226,7 @@ module RGeo
226
226
  def test_empty_collection_boundary
227
227
  empty_ = @factory.collection([])
228
228
  boundary_ = empty_.boundary
229
- assert_equal(Features::GeometryCollection, boundary_.geometry_type)
229
+ assert_equal(Feature::GeometryCollection, boundary_.geometry_type)
230
230
  assert_equal(0, boundary_.num_geometries)
231
231
  end
232
232
 
@@ -49,7 +49,7 @@ module RGeo
49
49
  point2_ = @factory.point(0, 1)
50
50
  line1_ = @factory.line_string([point1_, point2_])
51
51
  assert_not_nil(line1_)
52
- assert_equal(::RGeo::Features::LineString, line1_.geometry_type)
52
+ assert_equal(::RGeo::Feature::LineString, line1_.geometry_type)
53
53
  assert_equal(2, line1_.num_points)
54
54
  assert_equal(point1_, line1_.point_n(0))
55
55
  assert_equal(point2_, line1_.point_n(1))
@@ -64,7 +64,7 @@ module RGeo
64
64
  point3_ = @factory.point(1, 0)
65
65
  line2_ = @factory.line_string([point1_, point2_, point3_])
66
66
  assert_not_nil(line2_)
67
- assert_equal(::RGeo::Features::LineString, line2_.geometry_type)
67
+ assert_equal(::RGeo::Feature::LineString, line2_.geometry_type)
68
68
  assert_equal(3, line2_.num_points)
69
69
  assert_equal(point1_, line2_.point_n(0))
70
70
  assert_equal(point2_, line2_.point_n(1))
@@ -79,7 +79,7 @@ module RGeo
79
79
  point1_ = @factory.point(0, 0)
80
80
  line3_ = @factory.line_string([point1_, point1_])
81
81
  assert_not_nil(line3_)
82
- assert_equal(::RGeo::Features::LineString, line3_.geometry_type)
82
+ assert_equal(::RGeo::Feature::LineString, line3_.geometry_type)
83
83
  assert_equal(2, line3_.num_points)
84
84
  assert_equal(point1_, line3_.point_n(0))
85
85
  assert_equal(point1_, line3_.point_n(1))
@@ -91,7 +91,7 @@ module RGeo
91
91
  def test_creation_points_empty
92
92
  line4_ = @factory.line_string([])
93
93
  assert_not_nil(line4_)
94
- assert_equal(::RGeo::Features::LineString, line4_.geometry_type)
94
+ assert_equal(::RGeo::Feature::LineString, line4_.geometry_type)
95
95
  assert_equal(0, line4_.num_points)
96
96
  assert_nil(line4_.start_point)
97
97
  assert_nil(line4_.end_point)
@@ -104,10 +104,10 @@ module RGeo
104
104
  point3_ = @factory.point(1, 1)
105
105
  line1_ = @factory.line_string([point1_, point2_, point3_])
106
106
  assert_not_nil(line1_)
107
- assert(::RGeo::Features::LineString === line1_)
108
- assert(!(::RGeo::Features::LinearRing === line1_))
109
- assert(!(::RGeo::Features::Line === line1_))
110
- assert_equal(::RGeo::Features::LineString, line1_.geometry_type)
107
+ assert(::RGeo::Feature::LineString === line1_)
108
+ assert(!(::RGeo::Feature::LinearRing === line1_))
109
+ assert(!(::RGeo::Feature::Line === line1_))
110
+ assert_equal(::RGeo::Feature::LineString, line1_.geometry_type)
111
111
  end
112
112
 
113
113
 
@@ -118,14 +118,14 @@ module RGeo
118
118
  line1_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
119
119
  assert_not_nil(line1_)
120
120
  assert(line1_.is_ring?)
121
- assert(::RGeo::Features::LinearRing === line1_)
122
- assert_equal(::RGeo::Features::LinearRing, line1_.geometry_type)
121
+ assert(::RGeo::Feature::LinearRing === line1_)
122
+ assert_equal(::RGeo::Feature::LinearRing, line1_.geometry_type)
123
123
  line2_ = @factory.linear_ring([point1_, point2_, point3_])
124
124
  assert_not_nil(line2_)
125
125
  assert(line2_.is_ring?)
126
- assert(::RGeo::Features::LinearRing === line2_)
126
+ assert(::RGeo::Feature::LinearRing === line2_)
127
127
  assert_equal(4, line2_.num_points)
128
- assert_equal(::RGeo::Features::LinearRing, line2_.geometry_type)
128
+ assert_equal(::RGeo::Feature::LinearRing, line2_.geometry_type)
129
129
  end
130
130
 
131
131
 
@@ -134,8 +134,8 @@ module RGeo
134
134
  point2_ = @factory.point(0, 1)
135
135
  line1_ = @factory.line(point1_, point2_)
136
136
  assert_not_nil(line1_)
137
- assert(::RGeo::Features::Line === line1_)
138
- assert_equal(::RGeo::Features::Line, line1_.geometry_type)
137
+ assert(::RGeo::Feature::Line === line1_)
138
+ assert_equal(::RGeo::Feature::Line, line1_.geometry_type)
139
139
  end
140
140
 
141
141
 
@@ -254,12 +254,12 @@ module RGeo
254
254
  point1_ = @factory.point(0, 0)
255
255
  point2_ = @factory.point(0, 1)
256
256
  line_ = @factory.line_string([point1_, point2_])
257
- assert(::RGeo::Features::Geometry.check_type(line_))
258
- assert(!::RGeo::Features::Point.check_type(line_))
259
- assert(!::RGeo::Features::GeometryCollection.check_type(line_))
260
- assert(::RGeo::Features::Curve.check_type(line_))
261
- assert(::RGeo::Features::LineString.check_type(line_))
262
- assert(!::RGeo::Features::LinearRing.check_type(line_))
257
+ assert(::RGeo::Feature::Geometry.check_type(line_))
258
+ assert(!::RGeo::Feature::Point.check_type(line_))
259
+ assert(!::RGeo::Feature::GeometryCollection.check_type(line_))
260
+ assert(::RGeo::Feature::Curve.check_type(line_))
261
+ assert(::RGeo::Feature::LineString.check_type(line_))
262
+ assert(!::RGeo::Feature::LinearRing.check_type(line_))
263
263
  end
264
264
 
265
265
 
@@ -61,8 +61,8 @@ module RGeo
61
61
  def test_creation_simple
62
62
  geom_ = @factory.multi_line_string([@linestring1, @linestring2])
63
63
  assert_not_nil(geom_)
64
- assert(::RGeo::Features::MultiLineString === geom_)
65
- assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
64
+ assert(::RGeo::Feature::MultiLineString === geom_)
65
+ assert_equal(::RGeo::Feature::MultiLineString, geom_.geometry_type)
66
66
  assert_equal(2, geom_.num_geometries)
67
67
  assert(@linestring1.eql?(geom_[0]))
68
68
  assert(@linestring2.eql?(geom_[1]))
@@ -72,8 +72,8 @@ module RGeo
72
72
  def test_creation_empty
73
73
  geom_ = @factory.multi_line_string([])
74
74
  assert_not_nil(geom_)
75
- assert(::RGeo::Features::MultiLineString === geom_)
76
- assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
75
+ assert(::RGeo::Feature::MultiLineString === geom_)
76
+ assert_equal(::RGeo::Feature::MultiLineString, geom_.geometry_type)
77
77
  assert_equal(0, geom_.num_geometries)
78
78
  assert_equal([], geom_.to_a)
79
79
  end
@@ -82,8 +82,8 @@ module RGeo
82
82
  def test_creation_save_types
83
83
  geom_ = @factory.multi_line_string([@linestring1, @linearring1, @line1])
84
84
  assert_not_nil(geom_)
85
- assert(::RGeo::Features::MultiLineString === geom_)
86
- assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
85
+ assert(::RGeo::Feature::MultiLineString === geom_)
86
+ assert_equal(::RGeo::Feature::MultiLineString, geom_.geometry_type)
87
87
  assert_equal(3, geom_.num_geometries)
88
88
  assert(geom_[1].eql?(@linearring1))
89
89
  assert(geom_[2].eql?(@line1))
@@ -95,7 +95,7 @@ module RGeo
95
95
  mls2_ = @factory.multi_line_string([@linearring1])
96
96
  geom_ = @factory.multi_line_string([@linestring1, @linestring2, mls1_, mls2_])
97
97
  assert_not_nil(geom_)
98
- assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
98
+ assert_equal(::RGeo::Feature::MultiLineString, geom_.geometry_type)
99
99
  assert_equal(4, geom_.num_geometries)
100
100
  assert(@linestring1.eql?(geom_[0]))
101
101
  assert(@linestring2.eql?(geom_[1]))
@@ -137,7 +137,7 @@ module RGeo
137
137
 
138
138
  def test_wkt_creation_empty
139
139
  parsed_geom_ = @factory.parse_wkt('MULTILINESTRING EMPTY')
140
- assert_equal(::RGeo::Features::MultiLineString, parsed_geom_.geometry_type)
140
+ assert_equal(::RGeo::Feature::MultiLineString, parsed_geom_.geometry_type)
141
141
  assert_equal(0, parsed_geom_.num_geometries)
142
142
  assert_equal([], parsed_geom_.to_a)
143
143
  end
@@ -147,7 +147,7 @@ module RGeo
147
147
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
148
148
  geom2_ = geom1_.clone
149
149
  assert(geom1_.eql?(geom2_))
150
- assert_equal(::RGeo::Features::MultiLineString, geom2_.geometry_type)
150
+ assert_equal(::RGeo::Feature::MultiLineString, geom2_.geometry_type)
151
151
  assert_equal(2, geom2_.num_geometries)
152
152
  assert(@linestring1.eql?(geom2_[0]))
153
153
  assert(@linestring2.eql?(geom2_[1]))
@@ -156,17 +156,17 @@ module RGeo
156
156
 
157
157
  def test_type_check
158
158
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
159
- assert(::RGeo::Features::Geometry.check_type(geom1_))
160
- assert(!::RGeo::Features::LineString.check_type(geom1_))
161
- assert(::RGeo::Features::GeometryCollection.check_type(geom1_))
162
- assert(!::RGeo::Features::MultiPoint.check_type(geom1_))
163
- assert(::RGeo::Features::MultiLineString.check_type(geom1_))
159
+ assert(::RGeo::Feature::Geometry.check_type(geom1_))
160
+ assert(!::RGeo::Feature::LineString.check_type(geom1_))
161
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom1_))
162
+ assert(!::RGeo::Feature::MultiPoint.check_type(geom1_))
163
+ assert(::RGeo::Feature::MultiLineString.check_type(geom1_))
164
164
  geom2_ = @factory.multi_line_string([])
165
- assert(::RGeo::Features::Geometry.check_type(geom2_))
166
- assert(!::RGeo::Features::LineString.check_type(geom2_))
167
- assert(::RGeo::Features::GeometryCollection.check_type(geom2_))
168
- assert(!::RGeo::Features::MultiPoint.check_type(geom2_))
169
- assert(::RGeo::Features::MultiLineString.check_type(geom2_))
165
+ assert(::RGeo::Feature::Geometry.check_type(geom2_))
166
+ assert(!::RGeo::Feature::LineString.check_type(geom2_))
167
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom2_))
168
+ assert(!::RGeo::Feature::MultiPoint.check_type(geom2_))
169
+ assert(::RGeo::Feature::MultiLineString.check_type(geom2_))
170
170
  end
171
171
 
172
172
 
@@ -57,8 +57,8 @@ module RGeo
57
57
  def test_creation_simple
58
58
  geom_ = @factory.multi_point([@point1, @point2])
59
59
  assert_not_nil(geom_)
60
- assert(::RGeo::Features::MultiPoint === geom_)
61
- assert_equal(::RGeo::Features::MultiPoint, geom_.geometry_type)
60
+ assert(::RGeo::Feature::MultiPoint === geom_)
61
+ assert_equal(::RGeo::Feature::MultiPoint, geom_.geometry_type)
62
62
  assert_equal(2, geom_.num_geometries)
63
63
  assert(@point1.eql?(geom_[0]))
64
64
  assert(@point2.eql?(geom_[1]))
@@ -68,8 +68,8 @@ module RGeo
68
68
  def test_creation_empty
69
69
  geom_ = @factory.multi_point([])
70
70
  assert_not_nil(geom_)
71
- assert(::RGeo::Features::MultiPoint === geom_)
72
- assert_equal(::RGeo::Features::MultiPoint, geom_.geometry_type)
71
+ assert(::RGeo::Feature::MultiPoint === geom_)
72
+ assert_equal(::RGeo::Feature::MultiPoint, geom_.geometry_type)
73
73
  assert_equal(0, geom_.num_geometries)
74
74
  assert_equal([], geom_.to_a)
75
75
  end
@@ -80,7 +80,7 @@ module RGeo
80
80
  mp2_ = @factory.multi_point([@point4])
81
81
  geom_ = @factory.multi_point([@point1, @point2, mp1_, mp2_])
82
82
  assert_not_nil(geom_)
83
- assert_equal(::RGeo::Features::MultiPoint, geom_.geometry_type)
83
+ assert_equal(::RGeo::Feature::MultiPoint, geom_.geometry_type)
84
84
  assert_equal(4, geom_.num_geometries)
85
85
  assert(@point1.eql?(geom_[0]))
86
86
  assert(@point2.eql?(geom_[1]))
@@ -129,7 +129,7 @@ module RGeo
129
129
 
130
130
  def test_wkt_creation_empty
131
131
  parsed_geom_ = @factory.parse_wkt('MULTIPOINT EMPTY')
132
- assert(::RGeo::Features::MultiPoint === parsed_geom_)
132
+ assert(::RGeo::Feature::MultiPoint === parsed_geom_)
133
133
  assert_equal(0, parsed_geom_.num_geometries)
134
134
  assert_equal([], parsed_geom_.to_a)
135
135
  end
@@ -139,7 +139,7 @@ module RGeo
139
139
  geom1_ = @factory.multi_point([@point1, @point2])
140
140
  geom2_ = geom1_.clone
141
141
  assert(geom1_.eql?(geom2_))
142
- assert_equal(::RGeo::Features::MultiPoint, geom2_.geometry_type)
142
+ assert_equal(::RGeo::Feature::MultiPoint, geom2_.geometry_type)
143
143
  assert_equal(2, geom2_.num_geometries)
144
144
  assert(@point1.eql?(geom2_[0]))
145
145
  assert(@point2.eql?(geom2_[1]))
@@ -148,17 +148,17 @@ module RGeo
148
148
 
149
149
  def test_type_check
150
150
  geom1_ = @factory.multi_point([@point1, @point2])
151
- assert(::RGeo::Features::Geometry.check_type(geom1_))
152
- assert(!::RGeo::Features::Point.check_type(geom1_))
153
- assert(::RGeo::Features::GeometryCollection.check_type(geom1_))
154
- assert(::RGeo::Features::MultiPoint.check_type(geom1_))
155
- assert(!::RGeo::Features::MultiLineString.check_type(geom1_))
151
+ assert(::RGeo::Feature::Geometry.check_type(geom1_))
152
+ assert(!::RGeo::Feature::Point.check_type(geom1_))
153
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom1_))
154
+ assert(::RGeo::Feature::MultiPoint.check_type(geom1_))
155
+ assert(!::RGeo::Feature::MultiLineString.check_type(geom1_))
156
156
  geom2_ = @factory.multi_point([])
157
- assert(::RGeo::Features::Geometry.check_type(geom2_))
158
- assert(!::RGeo::Features::Point.check_type(geom2_))
159
- assert(::RGeo::Features::GeometryCollection.check_type(geom2_))
160
- assert(::RGeo::Features::MultiPoint.check_type(geom2_))
161
- assert(!::RGeo::Features::MultiLineString.check_type(geom2_))
157
+ assert(::RGeo::Feature::Geometry.check_type(geom2_))
158
+ assert(!::RGeo::Feature::Point.check_type(geom2_))
159
+ assert(::RGeo::Feature::GeometryCollection.check_type(geom2_))
160
+ assert(::RGeo::Feature::MultiPoint.check_type(geom2_))
161
+ assert(!::RGeo::Feature::MultiLineString.check_type(geom2_))
162
162
  end
163
163
 
164
164