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
@@ -36,7 +36,7 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
 
42
42
  module BasicGeometryCollectionMethods # :nodoc:
@@ -45,9 +45,9 @@ module RGeo
45
45
  def initialize(factory_, elements_)
46
46
  _set_factory(factory_)
47
47
  @elements = elements_.map do |elem_|
48
- elem_ = Features.cast(elem_, factory_)
48
+ elem_ = Feature.cast(elem_, factory_)
49
49
  unless elem_
50
- raise Errors::InvalidGeometry, "Could not cast #{elem_}"
50
+ raise Error::InvalidGeometry, "Could not cast #{elem_}"
51
51
  end
52
52
  elem_
53
53
  end
@@ -92,7 +92,7 @@ module RGeo
92
92
 
93
93
 
94
94
  def geometry_type
95
- Features::GeometryCollection
95
+ Feature::GeometryCollection
96
96
  end
97
97
 
98
98
 
@@ -110,9 +110,9 @@ module RGeo
110
110
  def initialize(factory_, elements_)
111
111
  _set_factory(factory_)
112
112
  @elements = elements_.map do |elem_|
113
- elem_ = Features.cast(elem_, factory_, Features::LineString, :keep_subtype)
113
+ elem_ = Feature.cast(elem_, factory_, Feature::LineString, :keep_subtype)
114
114
  unless elem_
115
- raise Errors::InvalidGeometry, "Could not cast #{elem_}"
115
+ raise Error::InvalidGeometry, "Could not cast #{elem_}"
116
116
  end
117
117
  elem_
118
118
  end
@@ -121,7 +121,7 @@ module RGeo
121
121
 
122
122
 
123
123
  def geometry_type
124
- Features::MultiLineString
124
+ Feature::MultiLineString
125
125
  end
126
126
 
127
127
 
@@ -166,9 +166,9 @@ module RGeo
166
166
  def initialize(factory_, elements_)
167
167
  _set_factory(factory_)
168
168
  @elements = elements_.map do |elem_|
169
- elem_ = Features.cast(elem_, factory_, Features::Point, :keep_subtype)
169
+ elem_ = Feature.cast(elem_, factory_, Feature::Point, :keep_subtype)
170
170
  unless elem_
171
- raise Errors::InvalidGeometry, "Could not cast #{elem_}"
171
+ raise Error::InvalidGeometry, "Could not cast #{elem_}"
172
172
  end
173
173
  elem_
174
174
  end
@@ -177,7 +177,7 @@ module RGeo
177
177
 
178
178
 
179
179
  def geometry_type
180
- Features::MultiPoint
180
+ Feature::MultiPoint
181
181
  end
182
182
 
183
183
 
@@ -195,9 +195,9 @@ module RGeo
195
195
  def initialize(factory_, elements_)
196
196
  _set_factory(factory_)
197
197
  @elements = elements_.map do |elem_|
198
- elem_ = Features.cast(elem_, factory_, Features::Polygon, :keep_subtype)
198
+ elem_ = Feature.cast(elem_, factory_, Feature::Polygon, :keep_subtype)
199
199
  unless elem_
200
- raise Errors::InvalidGeometry, "Could not cast #{elem_}"
200
+ raise Error::InvalidGeometry, "Could not cast #{elem_}"
201
201
  end
202
202
  elem_
203
203
  end
@@ -206,7 +206,7 @@ module RGeo
206
206
 
207
207
 
208
208
  def geometry_type
209
- Features::MultiPolygon
209
+ Feature::MultiPolygon
210
210
  end
211
211
 
212
212
 
@@ -36,12 +36,12 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
 
42
42
  module BasicGeometryMethods # :nodoc:
43
43
 
44
- include ::RGeo::Features::Type::Instance
44
+ include ::RGeo::Feature::Type::Instance
45
45
 
46
46
 
47
47
  def inspect # :nodoc:
@@ -36,7 +36,7 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
 
42
42
  module BasicLineStringMethods # :nodoc:
@@ -45,9 +45,9 @@ module RGeo
45
45
  def initialize(factory_, points_)
46
46
  _set_factory(factory_)
47
47
  @points = points_.map do |elem_|
48
- elem_ = Features.cast(elem_, factory_, Features::Point)
48
+ elem_ = Feature.cast(elem_, factory_, Feature::Point)
49
49
  unless elem_
50
- raise Errors::InvalidGeometry, "Could not cast #{elem_}"
50
+ raise Error::InvalidGeometry, "Could not cast #{elem_}"
51
51
  end
52
52
  elem_
53
53
  end
@@ -57,7 +57,7 @@ module RGeo
57
57
 
58
58
  def _validate_geometry
59
59
  if @points.size == 1
60
- raise Errors::InvalidGeometry, 'LineString cannot have 1 point'
60
+ raise Error::InvalidGeometry, 'LineString cannot have 1 point'
61
61
  end
62
62
  end
63
63
 
@@ -92,7 +92,7 @@ module RGeo
92
92
 
93
93
 
94
94
  def geometry_type
95
- Features::LineString
95
+ Feature::LineString
96
96
  end
97
97
 
98
98
 
@@ -141,13 +141,13 @@ module RGeo
141
141
 
142
142
  def initialize(factory_, start_, end_)
143
143
  _set_factory(factory_)
144
- cstart_ = Features.cast(start_, factory_, Features::Point)
144
+ cstart_ = Feature.cast(start_, factory_, Feature::Point)
145
145
  unless cstart_
146
- raise Errors::InvalidGeometry, "Could not cast start: #{start_}"
146
+ raise Error::InvalidGeometry, "Could not cast start: #{start_}"
147
147
  end
148
- cend_ = Features.cast(end_, factory_, Features::Point)
148
+ cend_ = Feature.cast(end_, factory_, Feature::Point)
149
149
  unless cend_
150
- raise Errors::InvalidGeometry, "Could not cast end: #{end_}"
150
+ raise Error::InvalidGeometry, "Could not cast end: #{end_}"
151
151
  end
152
152
  @points = [cstart_, cend_]
153
153
  _validate_geometry
@@ -157,13 +157,13 @@ module RGeo
157
157
  def _validate_geometry # :nodoc:
158
158
  super
159
159
  if @points.size > 2
160
- raise Errors::InvalidGeometry, 'Line must have 0 or 2 points'
160
+ raise Error::InvalidGeometry, 'Line must have 0 or 2 points'
161
161
  end
162
162
  end
163
163
 
164
164
 
165
165
  def geometry_type
166
- Features::Line
166
+ Feature::Line
167
167
  end
168
168
 
169
169
 
@@ -178,14 +178,14 @@ module RGeo
178
178
  if @points.size > 0
179
179
  @points << @points.first if @points.first != @points.last
180
180
  if !is_ring?
181
- raise Errors::InvalidGeometry, 'LinearRing failed ring test'
181
+ raise Error::InvalidGeometry, 'LinearRing failed ring test'
182
182
  end
183
183
  end
184
184
  end
185
185
 
186
186
 
187
187
  def geometry_type
188
- Features::LinearRing
188
+ Feature::LinearRing
189
189
  end
190
190
 
191
191
 
@@ -36,7 +36,7 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
 
42
42
  module BasicPointMethods # :nodoc:
@@ -86,7 +86,7 @@ module RGeo
86
86
 
87
87
 
88
88
  def geometry_type
89
- Features::Point
89
+ Feature::Point
90
90
  end
91
91
 
92
92
 
@@ -118,11 +118,11 @@ module RGeo
118
118
  def equals?(rhs_)
119
119
  return false unless rhs_.is_a?(self.class) && rhs_.factory == self.factory
120
120
  case rhs_
121
- when Features::Point
121
+ when Feature::Point
122
122
  rhs_.x == @x && rhs_.y == @y
123
- when Features::LineString
123
+ when Feature::LineString
124
124
  rhs_.num_points > 0 && rhs_.points.all?{ |elem_| equals?(elem_) }
125
- when Features::GeometryCollection
125
+ when Feature::GeometryCollection
126
126
  rhs_.num_geometries > 0 && rhs_.all?{ |elem_| equals?(elem_) }
127
127
  else
128
128
  false
@@ -36,7 +36,7 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
 
42
42
  module BasicPolygonMethods # :nodoc:
@@ -44,14 +44,14 @@ module RGeo
44
44
 
45
45
  def initialize(factory_, exterior_ring_, interior_rings_)
46
46
  _set_factory(factory_)
47
- @exterior_ring = Features.cast(exterior_ring_, factory_, Features::LinearRing)
47
+ @exterior_ring = Feature.cast(exterior_ring_, factory_, Feature::LinearRing)
48
48
  unless @exterior_ring
49
- raise Errors::InvalidGeometry, "Failed to cast exterior ring #{exterior_ring_}"
49
+ raise Error::InvalidGeometry, "Failed to cast exterior ring #{exterior_ring_}"
50
50
  end
51
51
  @interior_rings = (interior_rings_ || []).map do |elem_|
52
- elem_ = Features.cast(elem_, factory_, Features::LinearRing)
52
+ elem_ = Feature.cast(elem_, factory_, Feature::LinearRing)
53
53
  unless elem_
54
- raise Errors::InvalidGeometry, "Could not cast interior ring #{elem_}"
54
+ raise Error::InvalidGeometry, "Could not cast interior ring #{elem_}"
55
55
  end
56
56
  elem_
57
57
  end
@@ -94,7 +94,7 @@ module RGeo
94
94
 
95
95
 
96
96
  def geometry_type
97
- Features::Polygon
97
+ Feature::Polygon
98
98
  end
99
99
 
100
100
 
@@ -36,7 +36,7 @@
36
36
 
37
37
  module RGeo
38
38
 
39
- module ImplHelpers # :nodoc:
39
+ module ImplHelper # :nodoc:
40
40
 
41
41
  module Math # :nodoc:
42
42
 
@@ -54,7 +54,7 @@ end
54
54
 
55
55
 
56
56
  # Dependency files
57
- require 'rgeo/features'
57
+ require 'rgeo/feature'
58
58
 
59
59
  # Implementation files
60
60
  require 'rgeo/shapefile/reader'
@@ -163,7 +163,7 @@ module RGeo
163
163
  # srid and dimension settings in the input. The factory generator
164
164
  # should understand the configuration options
165
165
  # <tt>:support_z_coordinate</tt> and <tt>:support_m_coordinate</tt>.
166
- # See RGeo::Features::FactoryGenerator for more information.
166
+ # See RGeo::Feature::FactoryGenerator for more information.
167
167
  # If no generator is provided, the <tt>:default_factory</tt> is
168
168
  # used.
169
169
  # <tt>:srid</tt>::
@@ -611,7 +611,7 @@ module RGeo
611
611
  unless @assume_inner_follows_outer
612
612
  geos_factory_ = Geos.factory
613
613
  unless geos_factory_
614
- raise Errors::RGeoError, "GEOS is not available, but is required for correct interpretation of polygons in shapefiles."
614
+ raise Error::RGeoError, "GEOS is not available, but is required for correct interpretation of polygons in shapefiles."
615
615
  end
616
616
  end
617
617
 
@@ -763,7 +763,7 @@ module RGeo
763
763
  unless @assume_inner_follows_outer
764
764
  geos_factory_ = Geos.factory
765
765
  unless geos_factory_
766
- raise Errors::RGeoError, "GEOS is not available, but is required for correct interpretation of polygons in shapefiles."
766
+ raise Error::RGeoError, "GEOS is not available, but is required for correct interpretation of polygons in shapefiles."
767
767
  end
768
768
  end
769
769
 
data/lib/rgeo/wkrep.rb CHANGED
@@ -70,7 +70,7 @@ end
70
70
 
71
71
 
72
72
  # Dependency files
73
- require 'rgeo/features'
73
+ require 'rgeo/feature'
74
74
 
75
75
  # Implementation files
76
76
  require 'rgeo/wkrep/wkt_parser'
@@ -76,15 +76,15 @@ module RGeo
76
76
 
77
77
  # :stopdoc:
78
78
  TYPE_CODES = {
79
- Features::Point => 1,
80
- Features::LineString => 2,
81
- Features::LinearRing => 2,
82
- Features::Line => 2,
83
- Features::Polygon => 3,
84
- Features::MultiPoint => 4,
85
- Features::MultiLineString => 5,
86
- Features::MultiPolygon => 6,
87
- Features::GeometryCollection => 7,
79
+ Feature::Point => 1,
80
+ Feature::LineString => 2,
81
+ Feature::LinearRing => 2,
82
+ Feature::Line => 2,
83
+ Feature::Polygon => 3,
84
+ Feature::MultiPoint => 4,
85
+ Feature::MultiLineString => 5,
86
+ Feature::MultiPolygon => 6,
87
+ Feature::GeometryCollection => 7,
88
88
  }
89
89
  # :startdoc:
90
90
 
@@ -170,7 +170,7 @@ module RGeo
170
170
  type_ = obj_.geometry_type
171
171
  type_code_ = TYPE_CODES[type_]
172
172
  unless type_code_
173
- raise Errors::ParseError, "Unrecognized Geometry Type: #{type_}"
173
+ raise Error::ParseError, "Unrecognized Geometry Type: #{type_}"
174
174
  end
175
175
  emit_srid_ = false
176
176
  if @type_format == :ewkb
@@ -186,11 +186,11 @@ module RGeo
186
186
  end
187
187
  _emit_integer(type_code_)
188
188
  _emit_integer(obj_.srid) if emit_srid_
189
- if type_ == Features::Point
189
+ if type_ == Feature::Point
190
190
  _emit_doubles(_point_coords(obj_))
191
- elsif type_.subtype_of?(Features::LineString)
191
+ elsif type_.subtype_of?(Feature::LineString)
192
192
  _emit_line_string_coords(obj_)
193
- elsif type_ == Features::Polygon
193
+ elsif type_ == Feature::Polygon
194
194
  exterior_ring_ = obj_.exterior_ring
195
195
  if exterior_ring_.is_empty?
196
196
  _emit_integer(0)
@@ -199,16 +199,16 @@ module RGeo
199
199
  _emit_line_string_coords(exterior_ring_)
200
200
  obj_.interior_rings.each{ |r_| _emit_line_string_coords(r_) }
201
201
  end
202
- elsif type_ == Features::GeometryCollection
202
+ elsif type_ == Feature::GeometryCollection
203
203
  _emit_integer(obj_.num_geometries)
204
204
  obj_.each{ |g_| _generate_feature(g_) }
205
- elsif type_ == Features::MultiPoint
205
+ elsif type_ == Feature::MultiPoint
206
206
  _emit_integer(obj_.num_geometries)
207
207
  obj_.each{ |g_| _generate_feature(g_) }
208
- elsif type_ == Features::MultiLineString
208
+ elsif type_ == Feature::MultiLineString
209
209
  _emit_integer(obj_.num_geometries)
210
210
  obj_.each{ |g_| _generate_feature(g_) }
211
- elsif type_ == Features::MultiPolygon
211
+ elsif type_ == Feature::MultiPolygon
212
212
  _emit_integer(obj_.num_geometries)
213
213
  obj_.each{ |g_| _generate_feature(g_) }
214
214
  end
@@ -61,7 +61,7 @@ module RGeo
61
61
  # srid and dimension settings in the input. The factory generator
62
62
  # should understand the configuration options <tt>:srid</tt>,
63
63
  # <tt>:support_z_coordinate</tt>, and <tt>:support_m_coordinate</tt>.
64
- # See RGeo::Features::FactoryGenerator for more information.
64
+ # See RGeo::Feature::FactoryGenerator for more information.
65
65
  # If no generator is provided, the <tt>:default_factory</tt> is
66
66
  # used.
67
67
  # <tt>:support_ewkb</tt>::
@@ -174,7 +174,7 @@ module RGeo
174
174
  unless @ignore_extra_bytes
175
175
  bytes_ = _bytes_remaining
176
176
  if bytes_ > 0
177
- raise Errors::ParseError, "Found #{bytes_} extra bytes at the end of the stream."
177
+ raise Error::ParseError, "Found #{bytes_} extra bytes at the end of the stream."
178
178
  end
179
179
  end
180
180
  ensure
@@ -203,16 +203,16 @@ module RGeo
203
203
  end
204
204
  if contained_
205
205
  if contained_ != true && contained_ != type_code_
206
- raise Errors::ParseError, "Enclosed type=#{type_code_} is different from container constraint #{contained_}"
206
+ raise Error::ParseError, "Enclosed type=#{type_code_} is different from container constraint #{contained_}"
207
207
  end
208
208
  if has_z_ != @cur_has_z
209
- raise Errors::ParseError, "Enclosed hasZ=#{has_z_} is different from toplevel hasZ=#{@cur_has_z}"
209
+ raise Error::ParseError, "Enclosed hasZ=#{has_z_} is different from toplevel hasZ=#{@cur_has_z}"
210
210
  end
211
211
  if has_m_ != @cur_has_m
212
- raise Errors::ParseError, "Enclosed hasM=#{has_m_} is different from toplevel hasM=#{@cur_has_m}"
212
+ raise Error::ParseError, "Enclosed hasM=#{has_m_} is different from toplevel hasM=#{@cur_has_m}"
213
213
  end
214
214
  if srid_ && srid_ != @cur_srid
215
- raise Errors::ParseError, "Enclosed SRID #{srid_} is different from toplevel srid #{@cur_srid || '(unspecified)'}"
215
+ raise Error::ParseError, "Enclosed SRID #{srid_} is different from toplevel srid #{@cur_srid || '(unspecified)'}"
216
216
  end
217
217
  else
218
218
  @cur_has_z = has_z_
@@ -223,10 +223,10 @@ module RGeo
223
223
  @cur_factory = @factory_generator.call(:srid => @cur_srid, :support_z_coordinate => has_z_, :support_m_coordinate => has_m_)
224
224
  end
225
225
  if @cur_has_z && !@cur_factory.has_capability?(:z_coordinate)
226
- raise Errors::ParseError, "Data has Z coordinates but the factory doesn't have z_coordinate capability"
226
+ raise Error::ParseError, "Data has Z coordinates but the factory doesn't have z_coordinate capability"
227
227
  end
228
228
  if @cur_has_m && !@cur_factory.has_capability?(:m_coordinate)
229
- raise Errors::ParseError, "Data has M coordinates but the factory doesn't have m_coordinate capability"
229
+ raise Error::ParseError, "Data has M coordinates but the factory doesn't have m_coordinate capability"
230
230
  end
231
231
  end
232
232
  case type_code_
@@ -248,7 +248,7 @@ module RGeo
248
248
  when 7
249
249
  @cur_factory.collection((1.._get_integer(little_endian_)).map{ _parse_object(true) })
250
250
  else
251
- raise Errors::ParseError, "Unknown type value: #{type_code_}."
251
+ raise Error::ParseError, "Unknown type value: #{type_code_}."
252
252
  end
253
253
  end
254
254
 
@@ -279,7 +279,7 @@ module RGeo
279
279
 
280
280
  def _get_byte # :nodoc:
281
281
  if @_pos + 1 > @_len
282
- raise Errors::ParseError, "Not enough bytes left to fulfill 1 byte"
282
+ raise Error::ParseError, "Not enough bytes left to fulfill 1 byte"
283
283
  end
284
284
  str_ = @_data[@_pos, 1]
285
285
  @_pos += 1
@@ -289,7 +289,7 @@ module RGeo
289
289
 
290
290
  def _get_integer(little_endian_) # :nodoc:
291
291
  if @_pos + 4 > @_len
292
- raise Errors::ParseError, "Not enough bytes left to fulfill 1 integer"
292
+ raise Error::ParseError, "Not enough bytes left to fulfill 1 integer"
293
293
  end
294
294
  str_ = @_data[@_pos, 4]
295
295
  @_pos += 4
@@ -300,7 +300,7 @@ module RGeo
300
300
  def _get_doubles(little_endian_, count_) # :nodoc:
301
301
  len_ = 8 * count_
302
302
  if @_pos + len_ > @_len
303
- raise Errors::ParseError, "Not enough bytes left to fulfill #{count_} doubles"
303
+ raise Error::ParseError, "Not enough bytes left to fulfill #{count_} doubles"
304
304
  end
305
305
  str_ = @_data[@_pos, len_]
306
306
  @_pos += len_