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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 19
9
- version: 0.1.19
8
+ - 20
9
+ version: 0.1.20
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Azuma
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-23 00:00:00 -08:00
17
+ date: 2010-11-30 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -113,6 +113,7 @@ executables: []
113
113
 
114
114
  extensions:
115
115
  - ext/geos_c_impl/extconf.rb
116
+ - ext/proj4_c_impl/extconf.rb
116
117
  extra_rdoc_files:
117
118
  - History.rdoc
118
119
  - README.rdoc
@@ -132,41 +133,41 @@ files:
132
133
  - lib/rgeo/cartesian/feature_methods.rb
133
134
  - lib/rgeo/cartesian/interface.rb
134
135
  - lib/rgeo/cartesian.rb
135
- - lib/rgeo/errors.rb
136
- - lib/rgeo/features/curve.rb
137
- - lib/rgeo/features/factory.rb
138
- - lib/rgeo/features/factory_generator.rb
139
- - lib/rgeo/features/geometry.rb
140
- - lib/rgeo/features/geometry_collection.rb
141
- - lib/rgeo/features/line.rb
142
- - lib/rgeo/features/line_string.rb
143
- - lib/rgeo/features/linear_ring.rb
144
- - lib/rgeo/features/multi_curve.rb
145
- - lib/rgeo/features/multi_line_string.rb
146
- - lib/rgeo/features/multi_point.rb
147
- - lib/rgeo/features/multi_polygon.rb
148
- - lib/rgeo/features/multi_surface.rb
149
- - lib/rgeo/features/point.rb
150
- - lib/rgeo/features/polygon.rb
151
- - lib/rgeo/features/surface.rb
152
- - lib/rgeo/features/types.rb
153
- - lib/rgeo/features.rb
136
+ - lib/rgeo/coord_sys/proj4.rb
137
+ - lib/rgeo/coord_sys.rb
138
+ - lib/rgeo/error.rb
139
+ - lib/rgeo/feature/curve.rb
140
+ - lib/rgeo/feature/factory.rb
141
+ - lib/rgeo/feature/factory_generator.rb
142
+ - lib/rgeo/feature/geometry.rb
143
+ - lib/rgeo/feature/geometry_collection.rb
144
+ - lib/rgeo/feature/line.rb
145
+ - lib/rgeo/feature/line_string.rb
146
+ - lib/rgeo/feature/linear_ring.rb
147
+ - lib/rgeo/feature/multi_curve.rb
148
+ - lib/rgeo/feature/multi_line_string.rb
149
+ - lib/rgeo/feature/multi_point.rb
150
+ - lib/rgeo/feature/multi_polygon.rb
151
+ - lib/rgeo/feature/multi_surface.rb
152
+ - lib/rgeo/feature/point.rb
153
+ - lib/rgeo/feature/polygon.rb
154
+ - lib/rgeo/feature/surface.rb
155
+ - lib/rgeo/feature/types.rb
156
+ - lib/rgeo/feature.rb
154
157
  - lib/rgeo/geo_json/coder.rb
155
158
  - lib/rgeo/geo_json/entities.rb
156
159
  - lib/rgeo/geo_json/interface.rb
157
160
  - lib/rgeo/geo_json.rb
158
- - lib/rgeo/geography/all.rb
159
161
  - lib/rgeo/geography/factory.rb
160
162
  - lib/rgeo/geography/interface.rb
163
+ - lib/rgeo/geography/proj4_projector.rb
164
+ - lib/rgeo/geography/projected_feature_classes.rb
165
+ - lib/rgeo/geography/projected_feature_methods.rb
161
166
  - lib/rgeo/geography/projected_window.rb
162
- - lib/rgeo/geography/simple_mercator/feature_classes.rb
163
- - lib/rgeo/geography/simple_mercator/feature_methods.rb
164
- - lib/rgeo/geography/simple_mercator/projector.rb
165
- - lib/rgeo/geography/simple_mercator.rb
166
- - lib/rgeo/geography/simple_spherical/calculations.rb
167
- - lib/rgeo/geography/simple_spherical/feature_classes.rb
168
- - lib/rgeo/geography/simple_spherical/feature_methods.rb
169
- - lib/rgeo/geography/simple_spherical.rb
167
+ - lib/rgeo/geography/simple_mercator_projector.rb
168
+ - lib/rgeo/geography/spherical_feature_classes.rb
169
+ - lib/rgeo/geography/spherical_feature_methods.rb
170
+ - lib/rgeo/geography/spherical_math.rb
170
171
  - lib/rgeo/geography.rb
171
172
  - lib/rgeo/geos/factory.rb
172
173
  - lib/rgeo/geos/impl_additions.rb
@@ -174,13 +175,13 @@ files:
174
175
  - lib/rgeo/geos/zm_factory.rb
175
176
  - lib/rgeo/geos/zm_impl.rb
176
177
  - lib/rgeo/geos.rb
177
- - lib/rgeo/impl_helpers/basic_geometry_collection_methods.rb
178
- - lib/rgeo/impl_helpers/basic_geometry_methods.rb
179
- - lib/rgeo/impl_helpers/basic_line_string_methods.rb
180
- - lib/rgeo/impl_helpers/basic_point_methods.rb
181
- - lib/rgeo/impl_helpers/basic_polygon_methods.rb
182
- - lib/rgeo/impl_helpers/math.rb
183
- - lib/rgeo/impl_helpers.rb
178
+ - lib/rgeo/impl_helper/basic_geometry_collection_methods.rb
179
+ - lib/rgeo/impl_helper/basic_geometry_methods.rb
180
+ - lib/rgeo/impl_helper/basic_line_string_methods.rb
181
+ - lib/rgeo/impl_helper/basic_point_methods.rb
182
+ - lib/rgeo/impl_helper/basic_polygon_methods.rb
183
+ - lib/rgeo/impl_helper/math.rb
184
+ - lib/rgeo/impl_helper.rb
184
185
  - lib/rgeo/shapefile/reader.rb
185
186
  - lib/rgeo/shapefile.rb
186
187
  - lib/rgeo/version.rb
@@ -192,90 +193,99 @@ files:
192
193
  - lib/rgeo.rb
193
194
  - History.rdoc
194
195
  - README.rdoc
195
- - tests/active_record/tc_mysqlspatial.rb
196
- - tests/common/geometry_collection_tests.rb
197
- - tests/common/line_string_tests.rb
198
- - tests/common/multi_line_string_tests.rb
199
- - tests/common/multi_point_tests.rb
200
- - tests/common/multi_polygon_tests.rb
201
- - tests/common/point_tests.rb
202
- - tests/common/polygon_tests.rb
203
- - tests/geos/tc_factory.rb
204
- - tests/geos/tc_geometry_collection.rb
205
- - tests/geos/tc_line_string.rb
206
- - tests/geos/tc_misc.rb
207
- - tests/geos/tc_multi_line_string.rb
208
- - tests/geos/tc_multi_point.rb
209
- - tests/geos/tc_multi_polygon.rb
210
- - tests/geos/tc_point.rb
211
- - tests/geos/tc_polygon.rb
212
- - tests/geos/tc_zmfactory.rb
213
- - tests/shapefile/tc_shapelib_tests.rb
214
- - tests/simple_cartesian/tc_calculations.rb
215
- - tests/simple_cartesian/tc_geometry_collection.rb
216
- - tests/simple_cartesian/tc_line_string.rb
217
- - tests/simple_cartesian/tc_multi_line_string.rb
218
- - tests/simple_cartesian/tc_multi_point.rb
219
- - tests/simple_cartesian/tc_multi_polygon.rb
220
- - tests/simple_cartesian/tc_point.rb
221
- - tests/simple_cartesian/tc_polygon.rb
222
- - tests/simple_mercator/tc_geometry_collection.rb
223
- - tests/simple_mercator/tc_line_string.rb
224
- - tests/simple_mercator/tc_multi_line_string.rb
225
- - tests/simple_mercator/tc_multi_point.rb
226
- - tests/simple_mercator/tc_multi_polygon.rb
227
- - tests/simple_mercator/tc_point.rb
228
- - tests/simple_mercator/tc_polygon.rb
229
- - tests/simple_mercator/tc_window.rb
230
- - tests/simple_spherical/tc_calculations.rb
231
- - tests/simple_spherical/tc_geometry_collection.rb
232
- - tests/simple_spherical/tc_line_string.rb
233
- - tests/simple_spherical/tc_multi_line_string.rb
234
- - tests/simple_spherical/tc_multi_point.rb
235
- - tests/simple_spherical/tc_multi_polygon.rb
236
- - tests/simple_spherical/tc_point.rb
237
- - tests/simple_spherical/tc_polygon.rb
238
- - tests/tc_cartesian_analysis.rb
239
- - tests/tc_geojson.rb
240
- - tests/tc_oneoff.rb
241
- - tests/wkrep/tc_wkb_generator.rb
242
- - tests/wkrep/tc_wkb_parser.rb
243
- - tests/wkrep/tc_wkt_generator.rb
244
- - tests/wkrep/tc_wkt_parser.rb
245
- - tests/active_record/readme.txt
246
- - tests/shapefile/shapelib_testcases/readme.txt
247
- - tests/shapefile/shapelib_testcases/test.shp
248
- - tests/shapefile/shapelib_testcases/test0.shp
249
- - tests/shapefile/shapelib_testcases/test1.shp
250
- - tests/shapefile/shapelib_testcases/test10.shp
251
- - tests/shapefile/shapelib_testcases/test11.shp
252
- - tests/shapefile/shapelib_testcases/test12.shp
253
- - tests/shapefile/shapelib_testcases/test13.shp
254
- - tests/shapefile/shapelib_testcases/test2.shp
255
- - tests/shapefile/shapelib_testcases/test3.shp
256
- - tests/shapefile/shapelib_testcases/test4.shp
257
- - tests/shapefile/shapelib_testcases/test5.shp
258
- - tests/shapefile/shapelib_testcases/test6.shp
259
- - tests/shapefile/shapelib_testcases/test7.shp
260
- - tests/shapefile/shapelib_testcases/test8.shp
261
- - tests/shapefile/shapelib_testcases/test9.shp
262
- - tests/shapefile/shapelib_testcases/test.shx
263
- - tests/shapefile/shapelib_testcases/test0.shx
264
- - tests/shapefile/shapelib_testcases/test1.shx
265
- - tests/shapefile/shapelib_testcases/test10.shx
266
- - tests/shapefile/shapelib_testcases/test11.shx
267
- - tests/shapefile/shapelib_testcases/test12.shx
268
- - tests/shapefile/shapelib_testcases/test13.shx
269
- - tests/shapefile/shapelib_testcases/test2.shx
270
- - tests/shapefile/shapelib_testcases/test3.shx
271
- - tests/shapefile/shapelib_testcases/test4.shx
272
- - tests/shapefile/shapelib_testcases/test5.shx
273
- - tests/shapefile/shapelib_testcases/test6.shx
274
- - tests/shapefile/shapelib_testcases/test7.shx
275
- - tests/shapefile/shapelib_testcases/test8.shx
276
- - tests/shapefile/shapelib_testcases/test9.shx
277
- - tests/shapefile/shapelib_testcases/test.dbf
196
+ - test/active_record/tc_mysqlspatial.rb
197
+ - test/common/geometry_collection_tests.rb
198
+ - test/common/line_string_tests.rb
199
+ - test/common/multi_line_string_tests.rb
200
+ - test/common/multi_point_tests.rb
201
+ - test/common/multi_polygon_tests.rb
202
+ - test/common/point_tests.rb
203
+ - test/common/polygon_tests.rb
204
+ - test/coord_sys/tc_proj4.rb
205
+ - test/geos/tc_factory.rb
206
+ - test/geos/tc_geometry_collection.rb
207
+ - test/geos/tc_line_string.rb
208
+ - test/geos/tc_misc.rb
209
+ - test/geos/tc_multi_line_string.rb
210
+ - test/geos/tc_multi_point.rb
211
+ - test/geos/tc_multi_polygon.rb
212
+ - test/geos/tc_point.rb
213
+ - test/geos/tc_polygon.rb
214
+ - test/geos/tc_zmfactory.rb
215
+ - test/projected_geography/tc_geometry_collection.rb
216
+ - test/projected_geography/tc_line_string.rb
217
+ - test/projected_geography/tc_multi_line_string.rb
218
+ - test/projected_geography/tc_multi_point.rb
219
+ - test/projected_geography/tc_multi_polygon.rb
220
+ - test/projected_geography/tc_point.rb
221
+ - test/projected_geography/tc_polygon.rb
222
+ - test/shapefile/tc_shapelib_tests.rb
223
+ - test/simple_cartesian/tc_calculations.rb
224
+ - test/simple_cartesian/tc_geometry_collection.rb
225
+ - test/simple_cartesian/tc_line_string.rb
226
+ - test/simple_cartesian/tc_multi_line_string.rb
227
+ - test/simple_cartesian/tc_multi_point.rb
228
+ - test/simple_cartesian/tc_multi_polygon.rb
229
+ - test/simple_cartesian/tc_point.rb
230
+ - test/simple_cartesian/tc_polygon.rb
231
+ - test/simple_mercator/tc_geometry_collection.rb
232
+ - test/simple_mercator/tc_line_string.rb
233
+ - test/simple_mercator/tc_multi_line_string.rb
234
+ - test/simple_mercator/tc_multi_point.rb
235
+ - test/simple_mercator/tc_multi_polygon.rb
236
+ - test/simple_mercator/tc_point.rb
237
+ - test/simple_mercator/tc_polygon.rb
238
+ - test/simple_mercator/tc_window.rb
239
+ - test/spherical_geography/tc_calculations.rb
240
+ - test/spherical_geography/tc_geometry_collection.rb
241
+ - test/spherical_geography/tc_line_string.rb
242
+ - test/spherical_geography/tc_multi_line_string.rb
243
+ - test/spherical_geography/tc_multi_point.rb
244
+ - test/spherical_geography/tc_multi_polygon.rb
245
+ - test/spherical_geography/tc_point.rb
246
+ - test/spherical_geography/tc_polygon.rb
247
+ - test/tc_cartesian_analysis.rb
248
+ - test/tc_geojson.rb
249
+ - test/tc_oneoff.rb
250
+ - test/wkrep/tc_wkb_generator.rb
251
+ - test/wkrep/tc_wkb_parser.rb
252
+ - test/wkrep/tc_wkt_generator.rb
253
+ - test/wkrep/tc_wkt_parser.rb
254
+ - test/active_record/readme.txt
255
+ - test/shapefile/shapelib_testcases/readme.txt
256
+ - test/shapefile/shapelib_testcases/test.shp
257
+ - test/shapefile/shapelib_testcases/test0.shp
258
+ - test/shapefile/shapelib_testcases/test1.shp
259
+ - test/shapefile/shapelib_testcases/test10.shp
260
+ - test/shapefile/shapelib_testcases/test11.shp
261
+ - test/shapefile/shapelib_testcases/test12.shp
262
+ - test/shapefile/shapelib_testcases/test13.shp
263
+ - test/shapefile/shapelib_testcases/test2.shp
264
+ - test/shapefile/shapelib_testcases/test3.shp
265
+ - test/shapefile/shapelib_testcases/test4.shp
266
+ - test/shapefile/shapelib_testcases/test5.shp
267
+ - test/shapefile/shapelib_testcases/test6.shp
268
+ - test/shapefile/shapelib_testcases/test7.shp
269
+ - test/shapefile/shapelib_testcases/test8.shp
270
+ - test/shapefile/shapelib_testcases/test9.shp
271
+ - test/shapefile/shapelib_testcases/test.shx
272
+ - test/shapefile/shapelib_testcases/test0.shx
273
+ - test/shapefile/shapelib_testcases/test1.shx
274
+ - test/shapefile/shapelib_testcases/test10.shx
275
+ - test/shapefile/shapelib_testcases/test11.shx
276
+ - test/shapefile/shapelib_testcases/test12.shx
277
+ - test/shapefile/shapelib_testcases/test13.shx
278
+ - test/shapefile/shapelib_testcases/test2.shx
279
+ - test/shapefile/shapelib_testcases/test3.shx
280
+ - test/shapefile/shapelib_testcases/test4.shx
281
+ - test/shapefile/shapelib_testcases/test5.shx
282
+ - test/shapefile/shapelib_testcases/test6.shx
283
+ - test/shapefile/shapelib_testcases/test7.shx
284
+ - test/shapefile/shapelib_testcases/test8.shx
285
+ - test/shapefile/shapelib_testcases/test9.shx
286
+ - test/shapefile/shapelib_testcases/test.dbf
278
287
  - ext/geos_c_impl/extconf.rb
288
+ - ext/proj4_c_impl/extconf.rb
279
289
  - ext/geos_c_impl/factory.c
280
290
  - ext/geos_c_impl/geometry.c
281
291
  - ext/geos_c_impl/geometry_collection.c
@@ -283,6 +293,7 @@ files:
283
293
  - ext/geos_c_impl/main.c
284
294
  - ext/geos_c_impl/point.c
285
295
  - ext/geos_c_impl/polygon.c
296
+ - ext/proj4_c_impl/main.c
286
297
  - ext/geos_c_impl/factory.h
287
298
  - ext/geos_c_impl/geometry.h
288
299
  - ext/geos_c_impl/geometry_collection.h
@@ -326,46 +337,54 @@ signing_key:
326
337
  specification_version: 3
327
338
  summary: RGeo is a spatial data library for Ruby.
328
339
  test_files:
329
- - tests/active_record/tc_mysqlspatial.rb
330
- - tests/geos/tc_factory.rb
331
- - tests/geos/tc_geometry_collection.rb
332
- - tests/geos/tc_line_string.rb
333
- - tests/geos/tc_misc.rb
334
- - tests/geos/tc_multi_line_string.rb
335
- - tests/geos/tc_multi_point.rb
336
- - tests/geos/tc_multi_polygon.rb
337
- - tests/geos/tc_point.rb
338
- - tests/geos/tc_polygon.rb
339
- - tests/geos/tc_zmfactory.rb
340
- - tests/shapefile/tc_shapelib_tests.rb
341
- - tests/simple_cartesian/tc_calculations.rb
342
- - tests/simple_cartesian/tc_geometry_collection.rb
343
- - tests/simple_cartesian/tc_line_string.rb
344
- - tests/simple_cartesian/tc_multi_line_string.rb
345
- - tests/simple_cartesian/tc_multi_point.rb
346
- - tests/simple_cartesian/tc_multi_polygon.rb
347
- - tests/simple_cartesian/tc_point.rb
348
- - tests/simple_cartesian/tc_polygon.rb
349
- - tests/simple_mercator/tc_geometry_collection.rb
350
- - tests/simple_mercator/tc_line_string.rb
351
- - tests/simple_mercator/tc_multi_line_string.rb
352
- - tests/simple_mercator/tc_multi_point.rb
353
- - tests/simple_mercator/tc_multi_polygon.rb
354
- - tests/simple_mercator/tc_point.rb
355
- - tests/simple_mercator/tc_polygon.rb
356
- - tests/simple_mercator/tc_window.rb
357
- - tests/simple_spherical/tc_calculations.rb
358
- - tests/simple_spherical/tc_geometry_collection.rb
359
- - tests/simple_spherical/tc_line_string.rb
360
- - tests/simple_spherical/tc_multi_line_string.rb
361
- - tests/simple_spherical/tc_multi_point.rb
362
- - tests/simple_spherical/tc_multi_polygon.rb
363
- - tests/simple_spherical/tc_point.rb
364
- - tests/simple_spherical/tc_polygon.rb
365
- - tests/tc_cartesian_analysis.rb
366
- - tests/tc_geojson.rb
367
- - tests/tc_oneoff.rb
368
- - tests/wkrep/tc_wkb_generator.rb
369
- - tests/wkrep/tc_wkb_parser.rb
370
- - tests/wkrep/tc_wkt_generator.rb
371
- - tests/wkrep/tc_wkt_parser.rb
340
+ - test/active_record/tc_mysqlspatial.rb
341
+ - test/coord_sys/tc_proj4.rb
342
+ - test/geos/tc_factory.rb
343
+ - test/geos/tc_geometry_collection.rb
344
+ - test/geos/tc_line_string.rb
345
+ - test/geos/tc_misc.rb
346
+ - test/geos/tc_multi_line_string.rb
347
+ - test/geos/tc_multi_point.rb
348
+ - test/geos/tc_multi_polygon.rb
349
+ - test/geos/tc_point.rb
350
+ - test/geos/tc_polygon.rb
351
+ - test/geos/tc_zmfactory.rb
352
+ - test/projected_geography/tc_geometry_collection.rb
353
+ - test/projected_geography/tc_line_string.rb
354
+ - test/projected_geography/tc_multi_line_string.rb
355
+ - test/projected_geography/tc_multi_point.rb
356
+ - test/projected_geography/tc_multi_polygon.rb
357
+ - test/projected_geography/tc_point.rb
358
+ - test/projected_geography/tc_polygon.rb
359
+ - test/shapefile/tc_shapelib_tests.rb
360
+ - test/simple_cartesian/tc_calculations.rb
361
+ - test/simple_cartesian/tc_geometry_collection.rb
362
+ - test/simple_cartesian/tc_line_string.rb
363
+ - test/simple_cartesian/tc_multi_line_string.rb
364
+ - test/simple_cartesian/tc_multi_point.rb
365
+ - test/simple_cartesian/tc_multi_polygon.rb
366
+ - test/simple_cartesian/tc_point.rb
367
+ - test/simple_cartesian/tc_polygon.rb
368
+ - test/simple_mercator/tc_geometry_collection.rb
369
+ - test/simple_mercator/tc_line_string.rb
370
+ - test/simple_mercator/tc_multi_line_string.rb
371
+ - test/simple_mercator/tc_multi_point.rb
372
+ - test/simple_mercator/tc_multi_polygon.rb
373
+ - test/simple_mercator/tc_point.rb
374
+ - test/simple_mercator/tc_polygon.rb
375
+ - test/simple_mercator/tc_window.rb
376
+ - test/spherical_geography/tc_calculations.rb
377
+ - test/spherical_geography/tc_geometry_collection.rb
378
+ - test/spherical_geography/tc_line_string.rb
379
+ - test/spherical_geography/tc_multi_line_string.rb
380
+ - test/spherical_geography/tc_multi_point.rb
381
+ - test/spherical_geography/tc_multi_polygon.rb
382
+ - test/spherical_geography/tc_point.rb
383
+ - test/spherical_geography/tc_polygon.rb
384
+ - test/tc_cartesian_analysis.rb
385
+ - test/tc_geojson.rb
386
+ - test/tc_oneoff.rb
387
+ - test/wkrep/tc_wkb_generator.rb
388
+ - test/wkrep/tc_wkb_parser.rb
389
+ - test/wkrep/tc_wkt_generator.rb
390
+ - test/wkrep/tc_wkt_parser.rb
@@ -1,272 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Feature type management and casting
4
- #
5
- # -----------------------------------------------------------------------------
6
- # Copyright 2010 Daniel Azuma
7
- #
8
- # All rights reserved.
9
- #
10
- # Redistribution and use in source and binary forms, with or without
11
- # modification, are permitted provided that the following conditions are met:
12
- #
13
- # * Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the following disclaimer.
15
- # * Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the following disclaimer in the documentation
17
- # and/or other materials provided with the distribution.
18
- # * Neither the name of the copyright holder, nor the names of any other
19
- # contributors to this software, may be used to endorse or promote products
20
- # derived from this software without specific prior written permission.
21
- #
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- # POSSIBILITY OF SUCH DAMAGE.
33
- # -----------------------------------------------------------------------------
34
- ;
35
-
36
-
37
- module RGeo
38
-
39
- module Features
40
-
41
-
42
- # These methods are available as module methods (not instance methods)
43
- # of the various feature types.
44
- # For example, you may determine whether a feature object is a
45
- # point by calling:
46
- #
47
- # ::RGeo::Features::Point.check_type(object)
48
- #
49
- # A corresponding === operator is provided so you can use the type
50
- # modules in a case-when clause.
51
- #
52
- # You may also use the presence of this module to determine whether
53
- # a particular object is a feature type:
54
- #
55
- # object.kind_of?(::RGeo::Features::Type)
56
-
57
- module Type
58
-
59
-
60
- # All geometry implementations MUST include this submodule.
61
- # This serves as a marker that may be used to test an object for
62
- # feature-ness.
63
-
64
- module Instance
65
- end
66
-
67
-
68
- # Returns true if the given object is this type or a subtype
69
- # thereof, or if it is a feature object whose geometry_type is
70
- # this type or a subtype thereof.
71
- #
72
- # Note that feature objects need not actually include this module.
73
-
74
- def check_type(rhs_)
75
- rhs_ = rhs_.geometry_type if rhs_.kind_of?(Instance)
76
- rhs_.kind_of?(Type) && (rhs_ == self || rhs_.include?(self))
77
- end
78
- alias_method :===, :check_type
79
-
80
-
81
- # Returns true if this type is the same type or a subtype of the
82
- # given type.
83
-
84
- def subtype_of?(type_)
85
- self == type_ || self.include?(type_)
86
- end
87
-
88
-
89
- # Returns the OpenGIS type name of this type.
90
-
91
- def type_name
92
- self.name.sub('RGeo::Features::', '')
93
- end
94
-
95
-
96
- end
97
-
98
-
99
- class << self
100
-
101
-
102
- # Cast the given object according to the given parameters.
103
- #
104
- # You may optionally pass a factory, a feature type, the value
105
- # <tt>:force_new</tt>, and the value <tt>:keep_subtype</tt> as the
106
- # parameters. You may also pass the parameters as a hash, with the
107
- # keys <tt>:factory</tt>, <tt>:type</tt>, <tt>:force_new</tt> and
108
- # <tt>:keep_subtype</tt>.
109
- #
110
- # The given object will be casted into the given factory and
111
- # feature type, if possible.
112
- # If the cast is not possible to accomplish, nil is returned.
113
- # If the factory or type is not provided, or is the same as the
114
- # object's current attribute, that attribute is not modified.
115
- #
116
- # Normally, casting to a particular type always casts strictly to
117
- # that type, even if the old type is a subtype of the new type.
118
- # You can cause cast to retain the subtype by passing
119
- # <tt>:keep_subtype</tt> as one of the parameters. For example,
120
- # casting a LinearRing to a LineString will normally yield a
121
- # LineString. However, if you specify <tt>:keep_subtype</tt>, the
122
- # casted object will remain a LinearRing. You cannot cast to a
123
- # non-instantiable type (such as Curve) without specifying
124
- # <tt>:keep_subtype</tt>.
125
- #
126
- # Normally, if neither the factory nor the type are set to be
127
- # modified, the original object is returned. However, you may cause
128
- # cast to return a duplicate of the original object by passing
129
- # <tt>:force_new</tt> as one of the parameters. This effectively
130
- # forces cast always to return either a new object or nil.
131
- #
132
- # RGeo provides a default casting algorithm. Individual feature
133
- # implementation factories may override this and customize the
134
- # casting behavior by defining the override_cast method. See
135
- # ::RGeo::Features::Factory#override_cast for more details.
136
-
137
- def cast(obj_, *params_)
138
- # Interpret params
139
- nfactory_ = factory_ = obj_.factory
140
- ntype_ = type_ = obj_.geometry_type
141
- force_new_ = nil
142
- keep_subtype_ = nil
143
- params_.each do |param_|
144
- case param_
145
- when Factory::Instance
146
- nfactory_ = param_
147
- when Geometry
148
- ntype_ = param_
149
- when :force_new
150
- force_new_ = param_
151
- when :keep_subtype
152
- keep_subtype_ = param_
153
- when ::Hash
154
- nfactory_ = param_[:factory] || nfactory_
155
- ntype_ = param_[:type] || ntype_
156
- force_new_ = param_[:force_new] if param_.include?(:force_new)
157
- keep_subtype_ = param_[:keep_subtype] if param_.include?(:keep_subtype)
158
- end
159
- end
160
-
161
- # Let the factory override
162
- if nfactory_.respond_to?(:override_cast)
163
- override_ = nfactory_.override_cast(obj_, ntype_, :keep_subtype => keep_subtype_, :force_new => force_new_)
164
- return override_ unless override_ == false
165
- end
166
-
167
- # Default algorithm
168
- ntype_ = type_ if keep_subtype_ && type_.include?(ntype_)
169
- if nfactory_ == factory_ && ntype_ == type_
170
- force_new_ ? obj_.dup : obj_
171
- elsif ntype_ == type_
172
- if type_ == Point
173
- extra_ = []
174
- if nfactory_.has_capability?(:z_coordinate)
175
- extra_ << (factory_.has_capability?(:z_coordinate) ? obj_.z : 0.0)
176
- end
177
- if nfactory_.has_capability?(:m_coordinate)
178
- extra_ << (factory_.has_capability?(:m_coordinate) ? obj_.m : 0.0)
179
- end
180
- nfactory_.point(obj_.x, obj_.y, *extra_)
181
- elsif type_ == Line
182
- nfactory_.line(obj_.start_point, obj_.end_point)
183
- elsif type_ == LinearRing
184
- nfactory_.linear_ring(obj_.points)
185
- elsif type_ == LineString
186
- nfactory_.line_string(obj_.points)
187
- elsif type_ == Polygon
188
- nfactory_.polygon(obj_.exterior_ring, obj_.interior_rings)
189
- elsif type_ == MultiPoint
190
- nfactory_.multi_point(obj_)
191
- elsif type_ == MultiLineString
192
- nfactory_.multi_line_string(obj_)
193
- elsif type_ == MultiPolygon
194
- nfactory_.multi_polygon(obj_)
195
- elsif type_ == GeometryCollection
196
- nfactory_.collection(obj_)
197
- else
198
- nil
199
- end
200
- else
201
- if ntype_ == Point && (type_ == MultiPoint || type_ == GeometryCollection) ||
202
- (ntype_ == Line || ntype_ == LineString || ntype_ == LinearRing) && (type_ == MultiLineString || type_ == GeometryCollection) ||
203
- ntype_ == Polygon && (type_ == MultiPolygon || type_ == GeometryCollection)
204
- then
205
- if obj_.num_geometries == 1
206
- cast(obj_.geometry_n(0), nfactory_, ntype_, keep_subtype_, force_new_)
207
- else
208
- nil
209
- end
210
- elsif ntype_ == Point
211
- nil
212
- elsif ntype_ == Line
213
- if type_ == LineString && obj_.num_points == 2
214
- nfactory_.line(obj_.point_n(0), obj_.point_n(1))
215
- else
216
- nil
217
- end
218
- elsif ntype_ == LinearRing
219
- if type_ == LineString
220
- nfactory_.linear_ring(obj_.points)
221
- else
222
- nil
223
- end
224
- elsif ntype_ == LineString
225
- if type_ == Line || type_ == LinearRing
226
- nfactory_.line_string(obj_.points)
227
- else
228
- nil
229
- end
230
- elsif ntype_ == MultiPoint
231
- if type_ == Point
232
- nfactory_.multi_point([obj_])
233
- elsif type_ == GeometryCollection
234
- nfactory_.multi_point(obj_)
235
- else
236
- nil
237
- end
238
- elsif ntype_ == MultiLineString
239
- if type_ == Line || type_ == LinearRing || type_ == LineString
240
- nfactory_.multi_line_string([obj_])
241
- elsif type_ == GeometryCollection
242
- nfactory_.multi_line_string(obj_)
243
- else
244
- nil
245
- end
246
- elsif ntype_ == MultiPolygon
247
- if type_ == Polygon
248
- nfactory_.multi_polygon([obj_])
249
- elsif type_ == GeometryCollection
250
- nfactory_.multi_polygon(obj_)
251
- else
252
- nil
253
- end
254
- elsif ntype_ == GeometryCollection
255
- if type_ == MultiPoint || type_ == MultiLineString || type_ == MultiPolygon
256
- nfactory_.collection(obj_)
257
- else
258
- nfactory_.collection([obj_])
259
- end
260
- else
261
- nil
262
- end
263
- end
264
- end
265
-
266
-
267
- end
268
-
269
-
270
- end
271
-
272
- end