ffi-gdal 1.0.0.beta3 → 1.0.0.beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +62 -0
  4. data/Gemfile +1 -1
  5. data/History.md +53 -28
  6. data/README.md +6 -0
  7. data/Rakefile +23 -1
  8. data/examples/extract_and_colorize.rb +21 -22
  9. data/examples/geometries.rb +2 -2
  10. data/examples/gridding.rb +106 -0
  11. data/examples/ogr_layer_to_layer.rb +1 -1
  12. data/examples/points.txt +127 -0
  13. data/examples/testing_gdal.rb +3 -4
  14. data/ffi-gdal.gemspec +3 -2
  15. data/lib/ext/error_symbols.rb +2 -57
  16. data/lib/ext/ffi_library_function_checks.rb +26 -0
  17. data/lib/ext/float_ext.rb +2 -2
  18. data/lib/ext/narray_ext.rb +2 -0
  19. data/lib/ext/numeric_as_data_type.rb +19 -0
  20. data/lib/ext/to_bool.rb +4 -4
  21. data/lib/ffi/cpl/conv.rb +132 -0
  22. data/lib/ffi/cpl/error.rb +67 -0
  23. data/lib/ffi/cpl/hash_set.rb +39 -0
  24. data/lib/ffi/cpl/http.rb +25 -0
  25. data/lib/ffi/cpl/http_result.rb +18 -0
  26. data/lib/ffi/cpl/list.rb +38 -0
  27. data/lib/ffi/cpl/mime_part.rb +11 -0
  28. data/lib/ffi/cpl/minixml.rb +47 -0
  29. data/lib/ffi/cpl/port.rb +23 -0
  30. data/lib/ffi/cpl/quad_tree.rb +51 -0
  31. data/lib/ffi/{ogr/ogr_envelope.rb → cpl/rect_obj.rb} +3 -3
  32. data/lib/ffi/cpl/string.rb +95 -0
  33. data/lib/ffi/cpl/vsi.rb +115 -0
  34. data/lib/ffi/cpl/xml_node.rb +6 -6
  35. data/lib/ffi/gdal/alg.rb +385 -0
  36. data/lib/ffi/gdal/{gdal_color_entry.rb → color_entry.rb} +1 -2
  37. data/lib/ffi/gdal/exceptions.rb +6 -0
  38. data/lib/ffi/gdal/{gdal_gcp.rb → gcp.rb} +1 -3
  39. data/lib/ffi/gdal/{gdal_h.rb → gdal.rb} +253 -252
  40. data/lib/ffi/gdal/grid.rb +58 -0
  41. data/lib/ffi/gdal/{gdal_grid_data_metrics_options.rb → grid_data_metrics_options.rb} +1 -2
  42. data/lib/ffi/gdal/{gdal_grid_inverse_distance_to_a_power_options.rb → grid_inverse_distance_to_a_power_options.rb} +1 -2
  43. data/lib/ffi/gdal/{gdal_grid_moving_average_options.rb → grid_moving_average_options.rb} +1 -2
  44. data/lib/ffi/gdal/{gdal_grid_nearest_neighbor_options.rb → grid_nearest_neighbor_options.rb} +1 -2
  45. data/lib/ffi/gdal/matching.rb +20 -0
  46. data/lib/ffi/gdal/{gdal_rpc_info.rb → rpc_info.rb} +1 -2
  47. data/lib/ffi/gdal/{gdal_transformer_info.rb → transformer_info.rb} +1 -2
  48. data/lib/ffi/gdal/version.rb +1 -1
  49. data/lib/ffi/gdal/vrt.rb +92 -0
  50. data/lib/ffi/gdal/{gdal_warp_options.rb → warp_options.rb} +8 -4
  51. data/lib/ffi/gdal/warper.rb +70 -0
  52. data/lib/ffi/gdal.rb +56 -69
  53. data/lib/ffi/ogr/api.rb +567 -0
  54. data/lib/ffi/ogr/{ogr_contour_writer_info.rb → contour_writer_info.rb} +2 -3
  55. data/lib/ffi/ogr/core.rb +181 -0
  56. data/lib/ffi/ogr/envelope.rb +12 -0
  57. data/lib/ffi/ogr/{ogr_envelope_3d.rb → envelope_3d.rb} +2 -2
  58. data/lib/ffi/ogr/featurestyle.rb +29 -0
  59. data/lib/ffi/ogr/field.rb +63 -0
  60. data/lib/ffi/ogr/geocoding.rb +30 -0
  61. data/lib/ffi/ogr/srs_api.rb +407 -0
  62. data/lib/ffi/ogr/style_param.rb +13 -0
  63. data/lib/ffi/ogr/{ogr_style_value.rb → style_value.rb} +4 -3
  64. data/lib/ffi/ogr.rb +7 -7
  65. data/lib/ffi-gdal.rb +7 -145
  66. data/lib/gdal/color_entry.rb +18 -14
  67. data/lib/gdal/color_entry_mixins/extensions.rb +32 -0
  68. data/lib/gdal/color_interpretation.rb +2 -2
  69. data/lib/gdal/color_table.rb +37 -32
  70. data/lib/gdal/color_table_mixins/extensions.rb +48 -0
  71. data/lib/gdal/cpl_error_handler.rb +119 -0
  72. data/lib/gdal/data_type.rb +7 -7
  73. data/lib/gdal/dataset.rb +131 -238
  74. data/lib/gdal/dataset_mixins/algorithm_methods.rb +182 -0
  75. data/lib/gdal/dataset_mixins/extensions.rb +542 -0
  76. data/lib/gdal/dataset_mixins/matching.rb +26 -0
  77. data/lib/gdal/driver.rb +68 -92
  78. data/lib/gdal/driver_mixins/extensions.rb +93 -0
  79. data/lib/gdal/exceptions.rb +32 -4
  80. data/lib/gdal/geo_transform.rb +63 -43
  81. data/lib/gdal/geo_transform_mixins/extensions.rb +57 -0
  82. data/lib/gdal/grid.rb +144 -0
  83. data/lib/gdal/grid_types/data_metrics_base.rb +14 -0
  84. data/lib/gdal/grid_types/inverse_distance_to_a_power.rb +19 -0
  85. data/lib/gdal/grid_types/metric_average_distance.rb +12 -0
  86. data/lib/gdal/grid_types/metric_average_distance_pts.rb +12 -0
  87. data/lib/gdal/grid_types/metric_count.rb +12 -0
  88. data/lib/gdal/grid_types/metric_maximum.rb +12 -0
  89. data/lib/gdal/grid_types/metric_minimum.rb +12 -0
  90. data/lib/gdal/grid_types/metric_range.rb +12 -0
  91. data/lib/gdal/grid_types/moving_average.rb +19 -0
  92. data/lib/gdal/grid_types/nearest_neighbor.rb +19 -0
  93. data/lib/gdal/grid_types.rb +22 -0
  94. data/lib/gdal/internal_helpers.rb +94 -0
  95. data/lib/gdal/major_object.rb +4 -7
  96. data/lib/gdal/options.rb +14 -7
  97. data/lib/gdal/raster_attribute_table.rb +38 -47
  98. data/lib/gdal/raster_attribute_table_mixins/extensions.rb +41 -0
  99. data/lib/gdal/raster_band.rb +193 -227
  100. data/lib/gdal/raster_band_classifier.rb +107 -0
  101. data/lib/gdal/raster_band_mixins/algorithm_methods.rb +292 -0
  102. data/lib/gdal/raster_band_mixins/extensions.rb +238 -0
  103. data/lib/gdal/rpc_info.rb +35 -0
  104. data/lib/gdal/transformer.rb +15 -0
  105. data/lib/gdal/transformers/approximate_transformer.rb +48 -0
  106. data/lib/gdal/transformers/base_general_image_projection_transformer.rb +45 -0
  107. data/lib/gdal/transformers/gcp_transformer.rb +55 -0
  108. data/lib/gdal/transformers/general_image_projection_transformer.rb +31 -0
  109. data/lib/gdal/transformers/general_image_projection_transformer2.rb +52 -0
  110. data/lib/gdal/transformers/general_image_projection_transformer3.rb +25 -0
  111. data/lib/gdal/transformers/geolocation_transformer.rb +42 -0
  112. data/lib/gdal/transformers/reprojection_transformer.rb +39 -0
  113. data/lib/gdal/transformers/rpc_transformer.rb +56 -0
  114. data/lib/gdal/transformers/tps_transformer.rb +40 -0
  115. data/lib/gdal/virtual_dataset.rb +96 -0
  116. data/lib/gdal/warp_operation.rb +20 -23
  117. data/lib/gdal.rb +17 -0
  118. data/lib/ogr/coordinate_transformation.rb +16 -41
  119. data/lib/ogr/data_source.rb +103 -58
  120. data/lib/ogr/data_source_extensions.rb +5 -6
  121. data/lib/ogr/data_source_mixins/capability_methods.rb +27 -0
  122. data/lib/ogr/driver.rb +61 -33
  123. data/lib/ogr/driver_mixins/capability_methods.rb +16 -0
  124. data/lib/ogr/envelope.rb +29 -18
  125. data/lib/ogr/envelope_extensions.rb +70 -49
  126. data/lib/ogr/error_handling.rb +46 -0
  127. data/lib/ogr/exceptions.rb +58 -12
  128. data/lib/ogr/feature.rb +334 -86
  129. data/lib/ogr/feature_definition.rb +94 -51
  130. data/lib/ogr/feature_definition_extensions.rb +36 -13
  131. data/lib/ogr/feature_extensions.rb +62 -11
  132. data/lib/ogr/field.rb +175 -54
  133. data/lib/ogr/field_definition.rb +110 -0
  134. data/lib/ogr/{field_extensions.rb → field_definition_extensions.rb} +4 -5
  135. data/lib/ogr/{geocoding_session.rb → geocoder.rb} +14 -13
  136. data/lib/ogr/geometries/geometry_collection.rb +13 -0
  137. data/lib/ogr/geometries/line_string.rb +35 -0
  138. data/lib/ogr/geometries/linear_ring.rb +11 -0
  139. data/lib/ogr/geometries/multi_line_string.rb +16 -0
  140. data/lib/ogr/geometries/multi_point.rb +14 -0
  141. data/lib/ogr/geometries/multi_polygon.rb +21 -0
  142. data/lib/ogr/geometries/none_geometry.rb +13 -0
  143. data/lib/ogr/geometries/point.rb +65 -0
  144. data/lib/ogr/geometries/point_extensions.rb +32 -0
  145. data/lib/ogr/geometries/polygon.rb +14 -0
  146. data/lib/ogr/geometries/unknown_geometry.rb +10 -0
  147. data/lib/ogr/geometry.rb +270 -242
  148. data/lib/ogr/geometry_extensions.rb +8 -9
  149. data/lib/ogr/geometry_field_definition.rb +99 -0
  150. data/lib/ogr/geometry_field_definition_extensions.rb +19 -0
  151. data/lib/ogr/geometry_types/container.rb +75 -0
  152. data/lib/ogr/geometry_types/curve.rb +25 -28
  153. data/lib/ogr/geometry_types/surface.rb +13 -4
  154. data/lib/ogr/internal_helpers.rb +57 -0
  155. data/lib/ogr/layer.rb +60 -181
  156. data/lib/ogr/layer_mixins/capability_methods.rb +102 -0
  157. data/lib/ogr/layer_mixins/extensions.rb +59 -0
  158. data/lib/ogr/layer_mixins/ogr_feature_methods.rb +127 -0
  159. data/lib/ogr/layer_mixins/ogr_field_methods.rb +143 -0
  160. data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +163 -0
  161. data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +89 -0
  162. data/lib/ogr/layer_mixins/ogr_sql_methods.rb +48 -0
  163. data/lib/ogr/spatial_reference.rb +108 -589
  164. data/lib/ogr/spatial_reference_extensions.rb +29 -3
  165. data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +494 -0
  166. data/lib/ogr/spatial_reference_mixins/exporters.rb +134 -0
  167. data/lib/ogr/spatial_reference_mixins/importers.rb +243 -0
  168. data/lib/ogr/spatial_reference_mixins/morphers.rb +25 -0
  169. data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +122 -0
  170. data/lib/ogr/spatial_reference_mixins/type_checks.rb +62 -0
  171. data/lib/ogr/style_table.rb +53 -5
  172. data/lib/ogr/style_table_extensions.rb +21 -5
  173. data/lib/ogr/style_tool.rb +118 -0
  174. data/lib/ogr.rb +8 -0
  175. data/spec/ffi-gdal_spec.rb +1 -2
  176. data/spec/integration/{color_table_info_spec.rb → gdal/color_table_info_spec.rb} +12 -12
  177. data/spec/integration/{dataset_info_spec.rb → gdal/dataset_info_spec.rb} +2 -6
  178. data/spec/integration/{driver_info_spec.rb → gdal/driver_info_spec.rb} +5 -5
  179. data/spec/integration/{geo_transform_info_spec.rb → gdal/geo_transform_info_spec.rb} +1 -14
  180. data/spec/integration/{raster_attribute_table_info_spec.rb → gdal/raster_attribute_table_info_spec.rb} +1 -2
  181. data/spec/integration/{raster_band_info_spec.rb → gdal/raster_band_info_spec.rb} +30 -42
  182. data/spec/integration/ogr/layer_spec.rb +97 -0
  183. data/spec/spec_helper.rb +94 -5
  184. data/spec/support/integration_help.rb +1 -0
  185. data/spec/support/shared_contexts.rb +26 -0
  186. data/spec/support/shared_examples/{major_object_examples.rb → gdal/major_object_examples.rb} +5 -5
  187. data/spec/support/shared_examples/ogr/a_25D_geometry.rb +7 -0
  188. data/spec/support/shared_examples/ogr/a_container_geometry.rb +47 -0
  189. data/spec/support/shared_examples/ogr/a_geometry.rb +404 -0
  190. data/spec/support/shared_examples/ogr/a_line_string.rb +16 -0
  191. data/spec/support/test_style_table.txt +3 -0
  192. data/spec/unit/ext/error_symbols_spec.rb +41 -53
  193. data/spec/unit/ext/numeric_as_data_type_spec.rb +113 -0
  194. data/spec/unit/ffi/gdal_spec.rb +70 -0
  195. data/spec/unit/gdal/color_entry_spec.rb +5 -0
  196. data/spec/unit/gdal/color_interpretation_spec.rb +5 -0
  197. data/spec/unit/gdal/{color_table_extensions_spec.rb → color_table_mixins/extensions_spec.rb} +3 -3
  198. data/spec/unit/gdal/color_table_spec.rb +14 -16
  199. data/spec/unit/gdal/data_type_spec.rb +10 -17
  200. data/spec/unit/gdal/dataset_spec.rb +4 -7
  201. data/spec/unit/gdal/driver_mixins/extensions_spec.rb +22 -0
  202. data/spec/unit/gdal/driver_spec.rb +49 -0
  203. data/spec/unit/gdal/environment_methods_spec.rb +6 -0
  204. data/spec/unit/gdal/geo_transform_spec.rb +276 -0
  205. data/spec/unit/gdal/grid_spec.rb +5 -0
  206. data/spec/unit/gdal/internal_helpers_spec.rb +112 -0
  207. data/spec/unit/gdal/major_object_spec.rb +6 -0
  208. data/spec/unit/gdal/options_spec.rb +5 -0
  209. data/spec/unit/gdal/raster_attribute_table_spec.rb +5 -0
  210. data/spec/unit/gdal/raster_band_classifier_spec.rb +134 -0
  211. data/spec/unit/gdal/raster_band_spec.rb +5 -0
  212. data/spec/unit/gdal/rpc_info_spec.rb +5 -0
  213. data/spec/unit/gdal/version_info_spec.rb +6 -0
  214. data/spec/unit/gdal/virtual_dataset_spec.rb +32 -0
  215. data/spec/unit/gdal/warp_operation_spec.rb +5 -0
  216. data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +30 -0
  217. data/spec/unit/ogr/data_source_spec.rb +209 -0
  218. data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +18 -0
  219. data/spec/unit/ogr/driver_spec.rb +150 -0
  220. data/spec/unit/ogr/envelope_spec.rb +322 -0
  221. data/spec/unit/ogr/feature_definition_spec.rb +313 -0
  222. data/spec/unit/ogr/feature_spec.rb +379 -0
  223. data/spec/unit/ogr/field_definition_spec.rb +135 -0
  224. data/spec/unit/ogr/field_spec.rb +193 -0
  225. data/spec/unit/ogr/geometries/geometry_collection_spec.rb +186 -0
  226. data/spec/unit/ogr/geometries/line_string_spec.rb +105 -0
  227. data/spec/unit/ogr/{linear_ring_spec.rb → geometries/linear_ring_spec.rb} +10 -31
  228. data/spec/unit/ogr/geometries/multi_line_string_spec.rb +14 -0
  229. data/spec/unit/ogr/geometries/multi_point_spec.rb +14 -0
  230. data/spec/unit/ogr/geometries/multi_polygon_spec.rb +41 -0
  231. data/spec/unit/ogr/geometries/none_geometry_spec.rb +12 -0
  232. data/spec/unit/ogr/{point_spec.rb → geometries/point_spec.rb} +19 -25
  233. data/spec/unit/ogr/geometries/polygon_spec.rb +17 -0
  234. data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +10 -0
  235. data/spec/unit/ogr/geometry_field_definition_spec.rb +87 -0
  236. data/spec/unit/ogr/geometry_spec.rb +542 -0
  237. data/spec/unit/ogr/internal_helpers_spec.rb +57 -0
  238. data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +88 -0
  239. data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +145 -0
  240. data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +432 -0
  241. data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +20 -0
  242. data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +42 -0
  243. data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +12 -0
  244. data/spec/unit/ogr/layer_spec.rb +66 -67
  245. data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +46 -0
  246. data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +139 -0
  247. data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +38 -0
  248. data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +36 -0
  249. data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +102 -0
  250. data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +157 -0
  251. data/spec/unit/ogr/spatial_reference_spec.rb +42 -0
  252. data/spec/unit/ogr/style_table_spec.rb +132 -0
  253. data/spec/unit/ogr/style_tool_spec.rb +157 -0
  254. data/spec/unit/version_info_spec.rb +1 -1
  255. metadata +285 -75
  256. data/lib/ffi/cpl/conv_h.rb +0 -143
  257. data/lib/ffi/cpl/error_h.rb +0 -63
  258. data/lib/ffi/cpl/minixml_h.rb +0 -14
  259. data/lib/ffi/cpl/string_h.rb +0 -81
  260. data/lib/ffi/cpl/vsi_h.rb +0 -112
  261. data/lib/ffi/gdal/alg_h.rb +0 -127
  262. data/lib/ffi/gdal/grid_h.rb +0 -51
  263. data/lib/ffi/gdal/warper_h.rb +0 -48
  264. data/lib/ffi/ogr/api_h.rb +0 -553
  265. data/lib/ffi/ogr/core_h.rb +0 -148
  266. data/lib/ffi/ogr/featurestyle_h.rb +0 -22
  267. data/lib/ffi/ogr/geocoding_h.rb +0 -21
  268. data/lib/ffi/ogr/ogr_field.rb +0 -50
  269. data/lib/ffi/ogr/ogr_style_param.rb +0 -12
  270. data/lib/ffi/ogr/srs_api_h.rb +0 -325
  271. data/lib/gdal/color_entry_extensions.rb +0 -30
  272. data/lib/gdal/color_table_extensions.rb +0 -47
  273. data/lib/gdal/dataset_extensions.rb +0 -496
  274. data/lib/gdal/driver_extensions.rb +0 -56
  275. data/lib/gdal/geo_transform_extensions.rb +0 -90
  276. data/lib/gdal/raster_attribute_table_extensions.rb +0 -40
  277. data/lib/gdal/raster_band_extensions.rb +0 -198
  278. data/lib/ogr/geometry_types/collection.rb +0 -45
  279. data/lib/ogr/layer_extensions.rb +0 -55
  280. data/lib/ogr/line_string.rb +0 -7
  281. data/lib/ogr/linear_ring.rb +0 -6
  282. data/lib/ogr/multi_line_string.rb +0 -9
  283. data/lib/ogr/multi_point.rb +0 -7
  284. data/lib/ogr/multi_polygon.rb +0 -14
  285. data/lib/ogr/point.rb +0 -89
  286. data/lib/ogr/polygon.rb +0 -9
@@ -1,60 +1,5 @@
1
- require_relative '../gdal/exceptions'
2
- require_relative '../ogr/exceptions'
3
-
1
+ require_relative '../ogr/error_handling'
4
2
 
5
3
  class ::Symbol
6
-
7
- # When FFI interfaces with a GDAL CPLError, it returns a Symbol that
8
- # maps to the CPLErr enum (see GDAL's cpl_error.h or cpl_error.rb docs). Since
9
- # many of the GDAL C API's functions return these symbols _and_ because the
10
- # symbols have some functional implications, this wrapping here is simply for
11
- # returning Ruby-esque values when the GDAL API returns one of these symbols.
12
- #
13
- # The optional params let you override behavior. Passing in a block instead
14
- # will call the block. Ex.
15
- #
16
- # cpl_err = GDALCopyDatasetFiles(@gdal_driver_handle, new_name, old_name)
17
- # cpl_err.to_ruby # returns the default value
18
- # cpl_err.to_ruby { raise 'Crap!' }
19
- def to_ruby(none: :none, debug: :debug, warning: :warning, failure: :failure, fatal: :fatal)
20
- case self
21
- when :CE_None then none
22
- when :CE_Debug then debug
23
- when :CE_Warning then warning
24
- when :CE_Failure then failure
25
- when :CE_Fatal then fatal
26
- when :OGRERR_NONE then none
27
- when :OGRERR_NOT_ENOUGH_DATA then fail(OGR::NotEnoughData)
28
- when :OGRERR_NOT_ENOUGH_MEMORY then fail(OGR::NotEnoughMemory)
29
- when :OGRERR_UNSUPPORTED_GEOMETRY_TYPE then fail(OGR::UnsupportedGeometryType)
30
- when :OGRERR_UNSUPPORTED_OPERATION then fail(OGR::UnsupportedOperation)
31
- when :OGRERR_CORRUPT_DATA then fail(OGR::CorruptData)
32
- when :OGRERR_FAILURE then fail(OGR::Failure)
33
- when :OGRERR_UNSUPPORTED_SRS then fail(OGR::UnsupportedSRS)
34
- when :OGRERR_INVALID_HANDLE then fail(OGR::InvalidHandle)
35
- else
36
- raise "Unknown CPLErr/OGRErr type: #{self}"
37
- end
38
- end
39
-
40
- def to_bool
41
- case self
42
- when :CE_None then true
43
- when :CE_Debug then true
44
- when :CE_Warning then false
45
- when :CE_Failure then raise GDAL::CPLErrFailure
46
- when :CE_Fatal then raise GDAL::CPLErrFailure
47
- when :OGRERR_NONE then true
48
- when :OGRERR_NOT_ENOUGH_DATA then fail(OGR::NotEnoughData)
49
- when :OGRERR_NOT_ENOUGH_MEMORY then fail(OGR::NotEnoughMemory)
50
- when :OGRERR_UNSUPPORTED_GEOMETRY_TYPE then fail(OGR::UnsupportedGeometryType)
51
- when :OGRERR_UNSUPPORTED_OPERATION then fail(OGR::UnsupportedOperation)
52
- when :OGRERR_CORRUPT_DATA then fail(OGR::CorruptData)
53
- when :OGRERR_FAILURE then fail(OGR::Failure)
54
- when :OGRERR_UNSUPPORTED_SRS then fail(OGR::UnsupportedSRS)
55
- when :OGRERR_INVALID_HANDLE then fail(OGR::InvalidHandle)
56
- else
57
- raise "Unknown CPLError type: #{self}"
58
- end
59
- end
4
+ include OGR::ErrorHandling
60
5
  end
@@ -0,0 +1,26 @@
1
+ require 'ffi'
2
+ require 'ffi/library'
3
+
4
+ module FFI
5
+ # Redefining #attach_function so we can avoid bombing out if a called method
6
+ # is not defined.
7
+ module Library
8
+ alias_method :old_attach_function, :attach_function
9
+
10
+ def attach_function(*args)
11
+ old_attach_function(*args)
12
+ rescue FFI::NotFoundError
13
+ @unsupported_gdal_functions ||= []
14
+
15
+ if $VERBOSE || ENV['VERBOSE']
16
+ warn "ffi-gdal warning: function '#{args.first}' is not available in this build of GDAL/OGR (v#{FFI::GDAL.GDALVersionInfo('RELEASE_NAME')})"
17
+ end
18
+
19
+ @unsupported_gdal_functions << args.first
20
+ end
21
+
22
+ def unsupported_gdal_functions
23
+ @unsupported_gdal_functions ||= []
24
+ end
25
+ end
26
+ end
data/lib/ext/float_ext.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  class Float
2
- # Converts a packed DMS value (DDDMMMSSS.SS) into decimal degress.
2
+ # Converts a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
3
3
  #
4
4
  # @return [Float]
5
- def to_decimal_degress
5
+ def to_decimal_degrees
6
6
  FFI::GDAL.GDALPackedDMSToDec(self)
7
7
  end
8
8
 
@@ -11,6 +11,8 @@ class NArray
11
11
  when 6 then :scomplex
12
12
  when 7 then :complex
13
13
  when 8 then :object
14
+ else
15
+ fail "Unknown typecode: #{typecode}"
14
16
  end
15
17
  end
16
18
  end
@@ -0,0 +1,19 @@
1
+ module NumericAsDataType
2
+ # @param data_type [FFI::GDAL::DataType]
3
+ def to_data_type(data_type)
4
+ case data_type
5
+ when :GDT_Byte, :GDT_UInt16, :GDT_Int16, :GDT_UInt32, :GDT_Int32
6
+ to_i
7
+ when :GDT_Float32, :GDT_Float64
8
+ to_f
9
+ when :GDT_CInt16, :GDT_CInt32, :GDT_CFloat32, :GDT_CFloat64
10
+ to_c
11
+ else
12
+ self
13
+ end
14
+ end
15
+ end
16
+
17
+ class Numeric
18
+ include NumericAsDataType
19
+ end
data/lib/ext/to_bool.rb CHANGED
@@ -2,14 +2,14 @@ class Fixnum
2
2
  def to_bool
3
3
  return true if self == 1
4
4
  return false if self == 0
5
- raise "Fixnum '#{self}' can't be converted to Boolean."
5
+ fail "Fixnum '#{self}' can't be converted to Boolean."
6
6
  end
7
7
  end
8
8
 
9
9
  class String
10
10
  def to_bool
11
- return true if self.to_i == 1
12
- return false if self.to_i == 0
13
- raise "String '#{self}' can't be converted to Boolean."
11
+ return true if to_i == 1
12
+ return false if to_i == 0
13
+ fail "String '#{self}' can't be converted to Boolean."
14
14
  end
15
15
  end
@@ -0,0 +1,132 @@
1
+ require 'ffi'
2
+ require_relative 'error'
3
+ require_relative 'port'
4
+ require_relative '../../ext/ffi_library_function_checks'
5
+
6
+ module FFI
7
+ module CPL
8
+ module Conv
9
+ extend ::FFI::Library
10
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
11
+
12
+ #-------------------------------------------------------------------------
13
+ # Functions
14
+ #-------------------------------------------------------------------------
15
+ callback :CPLFileFinder, %i[string string], :string
16
+
17
+ #---------
18
+ # Config
19
+ #---------
20
+ attach_function :CPLVerifyConfiguration, %i[], :void
21
+ attach_function :CPLGetConfigOption, %i[string string], :string
22
+ attach_function :CPLSetConfigOption, %i[string string], :void
23
+ attach_function :CPLSetThreadLocalConfigOption, %i[string string], :void
24
+ attach_function :CPLFreeConfig, %i[], :void
25
+
26
+ #---------
27
+ # Memory
28
+ #---------
29
+ attach_function :CPLMalloc, %i[size_t], :pointer
30
+ attach_function :CPLCalloc, %i[size_t size_t], :pointer
31
+ attach_function :CPLRealloc, %i[pointer size_t], :pointer
32
+
33
+ #---------
34
+ # Strings
35
+ #---------
36
+ attach_function :CPLStrdup, %i[string], :string
37
+ attach_function :CPLStrlwr, %i[string], :string
38
+ attach_function :CPLFGets, %i[string int pointer], :string
39
+ attach_function :CPLReadLine, %i[pointer], :string
40
+ attach_function :CPLReadLineL, %i[pointer], :string
41
+ attach_function :CPLReadLine2L, %i[pointer int pointer], :string
42
+ attach_function :CPLAtof, %i[string], :double
43
+ attach_function :CPLAtofDelim, %i[string char], :double
44
+ attach_function :CPLStrtod, %i[string pointer], :double
45
+ attach_function :CPLStrtodDelim, %i[string pointer char], :double
46
+ attach_function :CPLStrtof, %i[string pointer], :float
47
+ attach_function :CPLStrtofDelim, %i[string pointer char], :float
48
+ attach_function :CPLAtofM, %i[string], :double
49
+ attach_function :CPLScanString, %i[string int int int], :string
50
+ attach_function :CPLScanDouble, %i[string int], :double
51
+ attach_function :CPLScanLong, %i[string int], :long
52
+ attach_function :CPLScanLong, %i[string int], :ulong
53
+ attach_function :CPLScanUIntBig, %i[string int], Port.find_type(:GUIntBig)
54
+ attach_function :CPLScanPointer, %i[string int], :pointer
55
+ attach_function :CPLPrintString, %i[string string int], :int
56
+ attach_function :CPLPrintStringFill, %i[string string int], :int
57
+
58
+ #---------
59
+ # Numbers to strings
60
+ #---------
61
+ attach_function :CPLPrintInt32, [:string, Port.find_type(:GInt32), :int], :int
62
+ attach_function :CPLPrintUIntBig, [:string, Port.find_type(:GUIntBig), :int], :int
63
+ attach_function :CPLPrintDouble, %i[string string double string], :int
64
+ attach_function :CPLPrintTime, %i[string int string pointer string], :int
65
+ attach_function :CPLPrintPointer, %i[string pointer int], :int
66
+ attach_function :CPLGetSymbol, %i[string string], :pointer
67
+
68
+ #---------
69
+ # Files
70
+ #---------
71
+ attach_function :CPLGetExecPath, %i[string int], :int
72
+ attach_function :CPLGetPath, %i[string], :string
73
+ attach_function :CPLGetDirname, %i[string], :string
74
+ attach_function :CPLGetFilename, %i[string], :string
75
+ attach_function :CPLGetBasename, %i[string], :string
76
+ attach_function :CPLGetExtension, %i[string], :string
77
+ attach_function :CPLGetCurrentDir, [], :string
78
+ attach_function :CPLFormFilename, %i[string string string], :string
79
+ attach_function :CPLFormCIFilename, %i[string string string], :string
80
+ attach_function :CPLResetExtension, %i[string string], :string
81
+ attach_function :CPLProjectRelativeFilename, %i[string string], :string
82
+ attach_function :CPLIsFilenameRelative, %i[string], :int
83
+ attach_function :CPLExtractRelativePath, %i[string string pointer], :string
84
+ attach_function :CPLCleanTrailingSlash, %i[string], :string
85
+ attach_function :CPLCorrespondingPaths, %i[string string pointer], :pointer
86
+ attach_function :CPLCheckForFile, %i[string string], :int
87
+ attach_function :CPLGenerateTempFilename, %i[string], :string
88
+ attach_function :CPLFindFile, %i[string string], :string
89
+ attach_function :CPLDefaultFindFile, %i[string string], :string
90
+ attach_function :CPLPushFileFinder, %i[CPLFileFinder], :void
91
+ attach_function :CPLPopFileFinder, %i[], :CPLFileFinder
92
+ attach_function :CPLPushFinderLocation, %i[string], :void
93
+ attach_function :CPLPopFinderLocation, %i[], :void
94
+ attach_function :CPLFinderClean, %i[], :void
95
+ attach_function :CPLStat, %i[string pointer], :int
96
+ attach_function :CPLOpenShared, %i[string string int], :pointer
97
+ attach_function :CPLCloseShared, %i[pointer], :void
98
+ attach_function :CPLGetSharedList, %i[pointer], :pointer
99
+ attach_function :CPLDumpSharedList, %i[pointer], :void
100
+ attach_function :CPLCleanupSharedFileMutex, %i[], :void
101
+
102
+ attach_function :CPLDMSToDec, %i[string], :double
103
+ attach_function :CPLDecToDMS, %i[double string int], :string
104
+ attach_function :CPLPackedDMSToDec, %i[double], :double
105
+ attach_function :CPLDecToPackedDMS, %i[double], :string
106
+ attach_function :CPLStringToComplex, %i[string pointer pointer], :void
107
+ attach_function :CPLUnlinkTree, %i[string], :int
108
+ attach_function :CPLCopyFile, %i[string string], :int
109
+ attach_function :CPLMoveFile, %i[string string], :int
110
+
111
+ #---------
112
+ # Zip Files
113
+ #---------
114
+ attach_function :CPLCreateZip, %i[string pointer], :pointer
115
+ attach_function :CPLCreateFileInZip, %i[pointer string pointer], FFI::CPL::Error::CPLErr
116
+ attach_function :CPLWriteFileInZip, %i[pointer pointer int], FFI::CPL::Error::CPLErr
117
+ attach_function :CPLCloseFileInZip, %i[pointer], FFI::CPL::Error::CPLErr
118
+ attach_function :CPLCloseZip, %i[pointer], FFI::CPL::Error::CPLErr
119
+ attach_function :CPLZLibDeflate,
120
+ %i[pointer size_t int pointer size_t pointer],
121
+ :pointer
122
+ attach_function :CPLZLibInflate,
123
+ %i[pointer size_t pointer size_t pointer],
124
+ :pointer
125
+
126
+ attach_function :CPLValidateXML, %i[string string pointer], :int
127
+ attach_function :CPLsetlocale, %i[int string], :string
128
+
129
+ attach_function :CPLCleanupSetlocaleMutex, %i[], :void
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,67 @@
1
+ require_relative '../../ext/error_symbols'
2
+ require_relative '../../ext/ffi_library_function_checks'
3
+
4
+ module FFI
5
+ module CPL
6
+ module Error
7
+ extend ::FFI::Library
8
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
9
+
10
+ #------------------------------------------------------------------------
11
+ # Enums
12
+ #------------------------------------------------------------------------
13
+ CPLErr = enum :CE_None, 0,
14
+ :CE_Debug, 1,
15
+ :CE_Warning, 2,
16
+ :CE_Failure, 3,
17
+ :CE_Fatal, 4
18
+
19
+ callback :CPLErrorHandler, [CPLErr, :int, :string], :void
20
+
21
+ #------------------------------------------------------------------------
22
+ # Functions
23
+ #------------------------------------------------------------------------
24
+ attach_function :CPLError, [CPLErr, :int, :string], :void
25
+ attach_function :CPLErrorV, [CPLErr, :int, :string, :pointer], :void
26
+ attach_function :CPLEmergencyError, [], :void
27
+ attach_function :CPLErrorReset, [], :void
28
+
29
+ attach_function :CPLGetLastErrorNo, [], :int
30
+ attach_function :CPLGetLastErrorType, [], CPLErr
31
+ attach_function :CPLGetLastErrorMsg, [], :string
32
+
33
+ attach_function :CPLGetErrorHandlerUserData, [], :pointer
34
+ attach_function :CPLErrorSetState,
35
+ [CPLErr, :int, :string],
36
+ :void
37
+ attach_function :CPLCleanupErrorMutex, [], :void
38
+ attach_function :CPLLoggingErrorHandler,
39
+ [CPLErr, :int, :string],
40
+ :void
41
+ attach_function :CPLDefaultErrorHandler,
42
+ [CPLErr, :int, :string],
43
+ :void
44
+ attach_function :CPLQuietErrorHandler,
45
+ [CPLErr, :int, :string],
46
+ :void
47
+ attach_function :CPLTurnFailureIntoWarning, [:int], :void
48
+
49
+ attach_function :CPLSetErrorHandler,
50
+ [:CPLErrorHandler],
51
+ :CPLErrorHandler
52
+ attach_function :CPLSetErrorHandlerEx,
53
+ %i[CPLErrorHandler pointer],
54
+ :CPLErrorHandler
55
+ attach_function :CPLPushErrorHandler,
56
+ [:CPLErrorHandler],
57
+ :void
58
+ attach_function :CPLPushErrorHandlerEx,
59
+ %i[CPLErrorHandler pointer],
60
+ :void
61
+ attach_function :CPLPopErrorHandler, [], :void
62
+
63
+ attach_function :CPLDebug, %i[string string], :void
64
+ attach_function :_CPLAssert, %i[string string int], :void
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,39 @@
1
+ require 'ffi'
2
+ require_relative '../../ext/ffi_library_function_checks'
3
+
4
+ module FFI
5
+ module CPL
6
+ module HashSet
7
+ extend ::FFI::Library
8
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
9
+
10
+ #-------------------------------------------------------------------------
11
+ # Typedefs
12
+ #-------------------------------------------------------------------------
13
+ callback :CPLHashSetHashFunc, %i[pointer], :ulong
14
+ callback :CPLHashSetEqualFunc, %i[pointer pointer], :bool
15
+ callback :CPLHashSetFreeEltFunc, %i[pointer], :void
16
+ callback :CPLHashSetIterEltFunc, %i[pointer pointer], :int
17
+ typedef :pointer, :CPLHashSetH
18
+
19
+ #-------------------------------------------------------------------------
20
+ # Functions
21
+ #-------------------------------------------------------------------------
22
+ attach_function :CPLHashSetNew,
23
+ %i[CPLHashSetHashFunc CPLHashSetEqualFunc CPLHashSetFreeEltFunc],
24
+ :CPLHashSetH
25
+ attach_function :CPLHashSetDestroy, %i[CPLHashSetH], :void
26
+ attach_function :CPLHashSetSize, %i[CPLHashSetH], :int
27
+ attach_function :CPLHashSetForeach,
28
+ %i[CPLHashSetH CPLHashSetIterEltFunc pointer],
29
+ :void
30
+ attach_function :CPLHashSetInsert, %i[CPLHashSetH pointer], :bool
31
+ attach_function :CPLHashSetLookup, %i[CPLHashSetH pointer], :pointer
32
+ attach_function :CPLHashSetRemove, %i[CPLHashSetH pointer], :bool
33
+ attach_function :CPLHashSetHashPointer, %i[pointer], :ulong
34
+ attach_function :CPLHashSetEqualPointer, %i[pointer pointer], :bool
35
+ attach_function :CPLHashSetHashStr, %i[string], :ulong
36
+ attach_function :CPLHashSetEqualStr, %i[string string], :bool
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ require 'ffi'
2
+ require_relative 'http_result'
3
+ require_relative '../../ext/ffi_library_function_checks'
4
+
5
+ module FFI
6
+ module CPL
7
+ module HTTP
8
+ extend ::FFI::Library
9
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
10
+
11
+ #-------------------------------------------------------------------------
12
+ # Functions
13
+ #-------------------------------------------------------------------------
14
+ attach_function :CPLHTTPEnabled, [], :bool
15
+ attach_function :CPLHTTPFetch, %i[string pointer], HTTPResult.ptr
16
+ attach_function :CPLHTTPCleanup, [], :void
17
+ attach_function :CPLHTTPDestroyResult, [HTTPResult.ptr], :void
18
+ attach_function :CPLHTTPParseMultipartMime, [HTTPResult.ptr], :bool
19
+
20
+ attach_function :GOA2GetAuthorizationURL, %i[string], :string
21
+ attach_function :GOA2GetRefreshToken, %i[string string], :string
22
+ attach_function :GOA2GetAccessToken, %i[string string], :string
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ require 'ffi'
2
+ require_relative 'mime_part'
3
+
4
+ module FFI
5
+ module CPL
6
+ class HTTPResult < ::FFI::Struct
7
+ layout :status, :int,
8
+ :content_type, :string,
9
+ :error_buffer, :string,
10
+ :data_length, :int,
11
+ :data_alloc, :int,
12
+ :data, :pointer,
13
+ :headers, :pointer,
14
+ :mime_part_count, :int,
15
+ :mime_part, MIMEPart.ptr
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,38 @@
1
+ require 'ffi'
2
+
3
+ module FFI
4
+ module CPL
5
+ class List < ::FFI::Struct
6
+ layout :data, :pointer,
7
+ :next, List.ptr
8
+
9
+ module ListFunctions
10
+ def self.included(base)
11
+ base.extend(ClassMethods)
12
+ end
13
+
14
+ module ClassMethods
15
+ extend ::FFI::Library
16
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
17
+
18
+ #-------------------------------------------------------------------
19
+ # Functions
20
+ #-------------------------------------------------------------------
21
+ attach_function :CPLListAppend, [List.ptr, :pointer], List.ptr
22
+ attach_function :CPLListInsert, [List.ptr, :pointer, :int], List.ptr
23
+ attach_function :CPLListGetLast, [List.ptr], List.ptr
24
+ attach_function :CPLListGet, [List.ptr, :int], List.ptr
25
+ attach_function :CPLListCount, [List.ptr], :int
26
+
27
+ attach_function :CPLListRemove, [List.ptr, :int], List.ptr
28
+ attach_function :CPLListDestroy, [List.ptr], :void
29
+
30
+ attach_function :CPLListGetNext, [List.ptr], List.ptr
31
+ attach_function :CPLListGetData, [List.ptr], :pointer
32
+ end
33
+ end
34
+
35
+ include ListFunctions
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,11 @@
1
+ require 'ffi'
2
+
3
+ module FFI
4
+ module CPL
5
+ class MIMEPart < ::FFI::Struct
6
+ layout :headers, :pointer,
7
+ :data, :pointer,
8
+ :data_length, :int
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,47 @@
1
+ require 'ffi'
2
+ # require_relative 'xml_node'
3
+ require_relative '../../ext/ffi_library_function_checks'
4
+
5
+ module FFI
6
+ module CPL
7
+ autoload :MiniXML, __FILE__
8
+ autoload :XMLNode, File.expand_path('xml_node', __dir__)
9
+
10
+ module MiniXML
11
+ extend ::FFI::Library
12
+ ffi_lib [::FFI::CURRENT_PROCESS, ::FFI::GDAL.gdal_library_path]
13
+
14
+ #-------------------------------------------------------------------------
15
+ # Enums
16
+ #-------------------------------------------------------------------------
17
+ XMLNodeType = enum :CXT_Element, 0,
18
+ :CXT_Text, 1,
19
+ :CXT_Attribute, 2,
20
+ :CXT_Comment, 3,
21
+ :CXT_Literal, 4
22
+
23
+ #-------------------------------------------------------------------------
24
+ # Functions
25
+ #-------------------------------------------------------------------------
26
+ attach_function :CPLParseXMLString, %i[string], XMLNode.ptr
27
+ attach_function :CPLDestroyXMLNode, [XMLNode.ptr], :void
28
+ attach_function :CPLGetXMLNode, [XMLNode.ptr, :string], XMLNode.ptr
29
+ attach_function :CPLSearchXMLNode, [XMLNode.ptr, :string], XMLNode.ptr
30
+ attach_function :CPLGetXMLValue, [XMLNode.ptr, :string, :string], :string
31
+ attach_function :CPLCreateXMLNode, [XMLNode.ptr, XMLNode.ptr, :string], XMLNode.ptr
32
+ attach_function :CPLSerializeXMLTree, [XMLNode.ptr], :string
33
+ attach_function :CPLAddXMLChild, [XMLNode.ptr, XMLNode.ptr], :void
34
+ attach_function :CPLRemoveXMLChild, [XMLNode.ptr, XMLNode.ptr], :bool
35
+ attach_function :CPLAddXMLSibling, [XMLNode.ptr, XMLNode.ptr], :void
36
+ attach_function :CPLCreateXMLElementAndValue,
37
+ [XMLNode.ptr, :string, :string],
38
+ XMLNode.ptr
39
+ attach_function :CPLCloneXMLTree, [XMLNode.ptr], XMLNode.ptr
40
+ attach_function :CPLSetXMLValue, [XMLNode.ptr, :string, :string], :bool
41
+ attach_function :CPLStripXMLNamespace, [XMLNode.ptr, :string, :bool], :void
42
+ attach_function :CPLCleanXMLElementName, %i[string], :void
43
+ attach_function :CPLParseXMLFile, %i[string], XMLNode.ptr
44
+ attach_function :CPLSerializeXMLTreeToFile, [XMLNode.ptr, :string], :bool
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ require 'ffi'
2
+
3
+ module FFI
4
+ module CPL
5
+ module Port
6
+ extend ::FFI::Library
7
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
8
+
9
+ #------------------------------------------------------------------------
10
+ # Typedefs
11
+ #------------------------------------------------------------------------
12
+ typedef :int, :GInt32
13
+ typedef :uint, :GUInt32
14
+ typedef :short, :GInt16
15
+ typedef :ushort, :GUInt16
16
+ typedef :uchar, :GByte
17
+ typedef :int, :GBool
18
+ typedef :long_long, :GIntBig
19
+ typedef :ulong_long, :GUIntBig
20
+ typedef :GIntBig, :GPtrDiff_t
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ require 'ffi'
2
+ require_relative 'rect_obj'
3
+ require_relative '../../ext/ffi_library_function_checks'
4
+
5
+ module FFI
6
+ module CPL
7
+ module QuadTree
8
+ extend ::FFI::Library
9
+ ffi_lib [FFI::CURRENT_PROCESS, FFI::GDAL.gdal_library_path]
10
+
11
+ #-------------------------------------------------------------------------
12
+ # Typedefs
13
+ #-------------------------------------------------------------------------
14
+ callback :CPLQuadTreeGetBoundsFunc, [:pointer, RectObj.ptr], :void
15
+ callback :CPLQuadTreeForeachFunc, %i[pointer pointer], :int
16
+ callback :CPLQuadTreeDumpFeatureFunc, %i[pointer int pointer], :void
17
+
18
+ # Taking liberties here...
19
+ typedef :pointer, :CPLQuadTreeH
20
+
21
+ #-------------------------------------------------------------------------
22
+ # Functions
23
+ #-------------------------------------------------------------------------
24
+ attach_function :CPLQuadTreeCreate,
25
+ [RectObj.ptr, :CPLQuadTreeGetBoundsFunc],
26
+ :CPLQuadTreeH
27
+ attach_function :CPLQuadTreeDestroy, %i[CPLQuadTreeH], :void
28
+ attach_function :CPLQuadTreeSetBucketCapacity,
29
+ %i[CPLQuadTreeH int],
30
+ :void
31
+ attach_function :CPLQuadTreeGetAdvisedMaxDepth, %i[int], :int
32
+ attach_function :CPLQuadTreeSetMaxDepth, %i[CPLQuadTreeH int], :void
33
+ attach_function :CPLQuadTreeInsert, %i[CPLQuadTreeH pointer], :void
34
+ attach_function :CPLQuadTreeInsertWithBounds,
35
+ [:CPLQuadTreeH, :pointer, RectObj.ptr],
36
+ :void
37
+ attach_function :CPLQuadTreeSearch,
38
+ [:CPLQuadTreeH, RectObj.ptr, :pointer],
39
+ :void
40
+ attach_function :CPLQuadTreeForeach,
41
+ %i[CPLQuadTreeH CPLQuadTreeForeachFunc pointer],
42
+ :void
43
+ attach_function :CPLQuadTreeDump,
44
+ %i[CPLQuadTreeH CPLQuadTreeDumpFeatureFunc pointer],
45
+ :void
46
+ attach_function :CPLQuadTreeGetStats,
47
+ %i[CPLQuadTreeH pointer pointer pointer pointer],
48
+ :void
49
+ end
50
+ end
51
+ end
@@ -1,11 +1,11 @@
1
1
  require 'ffi'
2
2
 
3
3
  module FFI
4
- module GDAL
5
- class OGREnvelope < FFI::Struct
4
+ module CPL
5
+ class RectObj < ::FFI::Struct
6
6
  layout :min_x, :double,
7
- :max_x, :double,
8
7
  :min_y, :double,
8
+ :max_x, :double,
9
9
  :max_y, :double
10
10
  end
11
11
  end