ffi-gdal 1.0.0.beta3 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
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,12 +1,18 @@
1
1
  require 'ffi'
2
+ require_relative '../../ext/ffi_library_function_checks'
3
+ require_relative '../ogr/core'
4
+ require_relative '../ogr/srs_api'
5
+ require_relative 'color_entry'
2
6
 
3
7
  module FFI
4
8
  module GDAL
9
+ extend ::FFI::Library
10
+ ffi_lib [::FFI::CURRENT_PROCESS, ::FFI::GDAL.gdal_library_path]
5
11
 
6
- #-----------------------------------------------------------------
12
+ # ----------------------------------------------------------------
7
13
  # Enums
8
- #-----------------------------------------------------------------
9
- GDALDataType = enum :GDT_Unknown, 0,
14
+ # ----------------------------------------------------------------
15
+ DataType = enum :GDT_Unknown, 0,
10
16
  :GDT_Byte, 1,
11
17
  :GDT_UInt16, 2,
12
18
  :GDT_Int16, 3,
@@ -20,19 +26,19 @@ module FFI
20
26
  :GDT_CFloat64, 11,
21
27
  :GDT_TypeCount, 12
22
28
 
23
- GDALAsyncStatusType = enum :GARIO_PENDING, 0,
29
+ AsyncStatusType = enum :GARIO_PENDING, 0,
24
30
  :GARIO_UPDATE, 1,
25
31
  :GARIO_ERROR, 2,
26
32
  :GARIO_COMPLETE, 3,
27
33
  :GARIO_TypeCount, 4
28
34
 
29
- GDALAccess = enum :GA_ReadOnly, 0,
35
+ Access = enum :GA_ReadOnly, 0,
30
36
  :GA_Update, 1
31
37
 
32
- GDALRWFlag = enum :GF_Read, 0,
38
+ RWFlag = enum :GF_Read, 0,
33
39
  :GF_Write, 1
34
40
 
35
- GDALColorInterp = enum :GCI_Undefined, 0,
41
+ ColorInterp = enum :GCI_Undefined, 0,
36
42
  :GCI_GrayIndex, 1,
37
43
  :GCI_PaletteIndex, 2,
38
44
  :GCI_RedBand, 3,
@@ -51,16 +57,16 @@ module FFI
51
57
  :GCI_YCbCr_CrBand, 16,
52
58
  :GCI_Max, 16 # Seems wrong that this is also 16...
53
59
 
54
- GDALPaletteInterp = enum :GPI_Gray, 0,
60
+ PaletteInterp = enum :GPI_Gray, 0,
55
61
  :GPI_RGB, 1,
56
62
  :GPI_CMYK, 2,
57
63
  :GPI_HLS, 3
58
64
 
59
- GDALRATFieldType = enum :GFT_Integer,
65
+ RATFieldType = enum :GFT_Integer,
60
66
  :GFT_Real,
61
67
  :GFT_String
62
68
 
63
- GDALRATFieldUsage = enum :GFU_Generic, 0,
69
+ RATFieldUsage = enum :GFU_Generic, 0,
64
70
  :GFU_PixelCount, 1,
65
71
  :GFU_Name, 2,
66
72
  :GFU_Min, 3,
@@ -80,13 +86,13 @@ module FFI
80
86
  :GFU_AlphaMax, 17,
81
87
  :GFU_MaxCount
82
88
 
83
- GDALTileOrganization = enum :GTO_TIP,
89
+ TileOrganization = enum :GTO_TIP,
84
90
  :GTO_BIT,
85
91
  :GTO_BSQ
86
92
 
87
- #-----------------------------------------------------------------
93
+ # ----------------------------------------------------------------
88
94
  # typedefs
89
- #-----------------------------------------------------------------
95
+ # ----------------------------------------------------------------
90
96
  typedef :pointer, :GDALMajorObjectH
91
97
  typedef :pointer, :GDALDatasetH
92
98
  typedef :pointer, :GDALRasterBandH
@@ -98,40 +104,29 @@ module FFI
98
104
  # When using, make sure to return +true+ if the operation should continue;
99
105
  # +false+ if the user has cancelled.
100
106
  callback :GDALProgressFunc,
101
- [:double, :string, :pointer], # completion, message, progress_arg
107
+ %i[double string pointer], # completion, message, progress_arg
102
108
  :bool
103
109
 
104
110
  callback :GDALDerivedPixelFunc,
105
- [:pointer, :int, :pointer, :int, :int, GDALDataType, GDALDataType, :int, :int],
111
+ [:pointer, :int, :pointer, :int, :int, DataType, DataType, :int, :int],
106
112
  :int
107
- end
108
-
109
- end
110
-
111
- # These requires depend on ^^^
112
- require_relative 'alg_h'
113
- require_relative 'grid_h'
114
- require_relative 'warper_h'
115
-
116
- module FFI
117
- module GDAL
118
113
 
119
- #-----------------------------------------------------------------
114
+ # ----------------------------------------------------------------
120
115
  # functions
121
- #-----------------------------------------------------------------
116
+ # ----------------------------------------------------------------
122
117
  # AsyncStatus
123
- attach_function :GDALGetAsyncStatusTypeName, [GDALAsyncStatusType], :string
124
- attach_function :GDALGetAsyncStatusTypeByName, [:string], GDALAsyncStatusType
118
+ attach_function :GDALGetAsyncStatusTypeName, [AsyncStatusType], :string
119
+ attach_function :GDALGetAsyncStatusTypeByName, [:string], AsyncStatusType
125
120
 
126
- #~~~~~~~~~~~~~~~~~~~~
121
+ # ~~~~~~~~~~~~~~~~~~~
127
122
  # ColorInterpretation
128
- #~~~~~~~~~~~~~~~~~~~~
129
- attach_function :GDALGetColorInterpretationName, [GDALColorInterp], :string
130
- attach_function :GDALGetColorInterpretationByName, [:string], GDALColorInterp
123
+ # ~~~~~~~~~~~~~~~~~~~
124
+ attach_function :GDALGetColorInterpretationName, [ColorInterp], :string
125
+ attach_function :GDALGetColorInterpretationByName, [:string], ColorInterp
131
126
 
132
- #~~~~~~~~~~~~~~~~~~~~
127
+ # ~~~~~~~~~~~~~~~~~~~
133
128
  # Driver
134
- #~~~~~~~~~~~~~~~~~~~~
129
+ # ~~~~~~~~~~~~~~~~~~~
135
130
  attach_function :GDALAllRegister, [], :void
136
131
 
137
132
  # Class-level functions
@@ -139,16 +134,16 @@ module FFI
139
134
  attach_function :GDALGetDriverCount, [], :int
140
135
  attach_function :GDALIdentifyDriver, %i[string pointer], :GDALDriverH
141
136
  attach_function :GDALGetDriverByName, [:string], :GDALDriverH
142
- attach_function :GDALDestroyDriverManager, [:void], :void
137
+ attach_function :GDALDestroyDriverManager, [], :void
143
138
 
144
139
  # Instance-level functions
145
140
  attach_function :GDALCreate,
146
- [:GDALDriverH, :string, :int, :int, :int, GDALDataType, :pointer],
141
+ [:GDALDriverH, :string, :int, :int, :int, DataType, :pointer],
147
142
  :GDALDatasetH
148
143
  attach_function :GDALCreateCopy,
149
144
  %i[GDALDriverH string GDALDatasetH bool pointer GDALProgressFunc pointer],
150
145
  :GDALDatasetH
151
- attach_function :GDALValidateCreationOptions, %i[GDALDriverH pointer], CPLErr
146
+ attach_function :GDALValidateCreationOptions, %i[GDALDriverH pointer], FFI::CPL::Error::CPLErr
152
147
  attach_function :GDALGetDriverShortName, [:GDALDriverH], :string
153
148
  attach_function :GDALGetDriverLongName, [:GDALDriverH], :string
154
149
  attach_function :GDALGetDriverHelpTopic, [:GDALDriverH], :string
@@ -157,33 +152,33 @@ module FFI
157
152
  attach_function :GDALDestroyDriver, [:GDALDriverH], :void
158
153
  attach_function :GDALRegisterDriver, [:GDALDriverH], :int
159
154
  attach_function :GDALDeregisterDriver, [:GDALDriverH], :void
160
- attach_function :GDALDeleteDataset, [:GDALDriverH, :string], CPLErr
155
+ attach_function :GDALDeleteDataset, %i[GDALDriverH string], FFI::CPL::Error::CPLErr
161
156
  attach_function :GDALRenameDataset,
162
157
  %i[GDALDriverH string string],
163
- CPLErr
158
+ FFI::CPL::Error::CPLErr
164
159
  attach_function :GDALCopyDatasetFiles,
165
160
  %i[GDALDriverH string string],
166
- CPLErr
161
+ FFI::CPL::Error::CPLErr
167
162
 
168
- #~~~~~~~~~~~~~~~~~~~~
163
+ # ~~~~~~~~~~~~~~~~~~~
169
164
  # Dataset
170
- #~~~~~~~~~~~~~~~~~~~~
165
+ # ~~~~~~~~~~~~~~~~~~~
171
166
  # Class-level functions
172
- attach_function :GDALOpen, [:string, GDALAccess], :GDALDatasetH
167
+ attach_function :GDALOpen, [:string, Access], :GDALDatasetH
173
168
  attach_function :GDALOpenShared,
174
- [:string, GDALAccess],
169
+ [:string, Access],
175
170
  :GDALDatasetH
176
171
  attach_function :GDALOpenEx,
177
172
  %i[string uint string string string],
178
173
  :GDALDatasetH
179
174
  attach_function :GDALDumpOpenDatasets, [:pointer], :int
180
- attach_function :GDALGetOpenDatasets, [:pointer, :pointer], :void
175
+ attach_function :GDALGetOpenDatasets, %i[pointer pointer], :void
181
176
 
182
177
  # Instance-level functions
183
178
  attach_function :GDALClose, [:GDALDatasetH], :void
184
179
  attach_function :GDALGetDatasetDriver, [:GDALDatasetH], :GDALDriverH
185
180
  attach_function :GDALGetFileList, [:GDALDatasetH], :pointer
186
- attach_function :GDALGetInternalHandle, [:GDALDatasetH, :string], :pointer
181
+ attach_function :GDALGetInternalHandle, %i[GDALDatasetH string], :pointer
187
182
  attach_function :GDALReferenceDataset, [:GDALDatasetH], :int
188
183
  attach_function :GDALDereferenceDataset, [:GDALDatasetH], :int
189
184
 
@@ -193,14 +188,14 @@ module FFI
193
188
  attach_function :GDALGetRasterXSize, [:GDALDatasetH], :int
194
189
  attach_function :GDALGetRasterYSize, [:GDALDatasetH], :int
195
190
  attach_function :GDALGetRasterCount, [:GDALDatasetH], :int
196
- attach_function :GDALGetRasterBand, [:GDALDatasetH, :int], :GDALRasterBandH
191
+ attach_function :GDALGetRasterBand, %i[GDALDatasetH int], :GDALRasterBandH
197
192
  attach_function :GDALAddBand,
198
- [:GDALDatasetH, GDALDataType, :pointer],
199
- CPLErr
193
+ [:GDALDatasetH, DataType, :pointer],
194
+ FFI::CPL::Error::CPLErr
200
195
  attach_function :GDALBeginAsyncReader,
201
196
  [
202
197
  :GDALDatasetH,
203
- GDALRWFlag,
198
+ RWFlag,
204
199
  :int,
205
200
  :int,
206
201
  :int,
@@ -208,7 +203,7 @@ module FFI
208
203
  :pointer,
209
204
  :int,
210
205
  :int,
211
- GDALDataType,
206
+ DataType,
212
207
  :int,
213
208
  :pointer,
214
209
  :int,
@@ -217,13 +212,13 @@ module FFI
217
212
  ], :GDALAsyncReaderH
218
213
 
219
214
  attach_function :GDALEndAsyncReader,
220
- [:GDALDatasetH, :GDALAsyncReaderH],
215
+ %i[GDALDatasetH GDALAsyncReaderH],
221
216
  :void
222
217
 
223
218
  attach_function :GDALDatasetRasterIO,
224
219
  [
225
220
  :GDALDatasetH,
226
- GDALRWFlag,
221
+ RWFlag,
227
222
  :int,
228
223
  :int,
229
224
  :int,
@@ -231,13 +226,13 @@ module FFI
231
226
  :pointer,
232
227
  :int,
233
228
  :int,
234
- GDALDataType,
229
+ DataType,
235
230
  :int,
236
231
  :pointer,
237
232
  :int,
238
233
  :int,
239
234
  :int
240
- ], CPLErr
235
+ ], FFI::CPL::Error::CPLErr
241
236
 
242
237
  attach_function :GDALDatasetAdviseRead,
243
238
  [
@@ -248,93 +243,99 @@ module FFI
248
243
  :int,
249
244
  :int,
250
245
  :int,
251
- GDALDataType,
246
+ DataType,
252
247
  :int,
253
248
  :pointer,
254
249
  :pointer
255
- ], CPLErr
250
+ ], FFI::CPL::Error::CPLErr
256
251
 
257
- attach_function :GDALInitGCPs, [:int, :pointer], :void
258
- attach_function :GDALDeinitGCPs, [:int, :pointer], :void
259
- attach_function :GDALDuplicateGCPs, [:int, :pointer], :pointer
252
+ attach_function :GDALInitGCPs, %i[int pointer], :void
253
+ attach_function :GDALDeinitGCPs, %i[int pointer], :void
254
+ attach_function :GDALDuplicateGCPs, %i[int pointer], :pointer
260
255
  attach_function :GDALGCPsToGeoTransform,
261
- [:int, :pointer, :pointer, :int],
256
+ %i[int pointer pointer int],
262
257
  :int
263
258
  attach_function :GDALGetGCPCount, [:GDALDatasetH], :int
264
259
  attach_function :GDALGetGCPProjection, [:GDALDatasetH], :string
265
260
  attach_function :GDALGetGCPs, [:GDALDatasetH], :pointer
266
261
  attach_function :GDALSetGCPs,
267
- [:GDALDatasetH, :int, :pointer, :string],
268
- CPLErr
262
+ %i[GDALDatasetH int pointer string],
263
+ FFI::CPL::Error::CPLErr
269
264
 
270
265
  attach_function :GDALGetProjectionRef, [:GDALDatasetH], :string
271
- attach_function :GDALSetProjection, [:GDALDatasetH, :string], CPLErr
272
- attach_function :GDALGetGeoTransform, [:GDALDatasetH, :pointer], CPLErr
266
+ attach_function :GDALSetProjection, %i[GDALDatasetH string], FFI::CPL::Error::CPLErr
267
+ attach_function :GDALGetGeoTransform, %i[GDALDatasetH pointer], FFI::CPL::Error::CPLErr
273
268
  attach_function :GDALSetGeoTransform,
274
- [:GDALDatasetH, :pointer],
275
- CPLErr
269
+ %i[GDALDatasetH pointer],
270
+ FFI::CPL::Error::CPLErr
276
271
 
277
272
  attach_function :GDALBuildOverviews,
278
- [
279
- :GDALDatasetH,
280
- :string,
281
- :int,
282
- :pointer,
283
- :int,
284
- :pointer,
285
- :GDALProgressFunc,
286
- :pointer
287
- ], CPLErr
273
+ %i[
274
+ GDALDatasetH
275
+ string
276
+ int
277
+ pointer
278
+ int
279
+ pointer
280
+ GDALProgressFunc
281
+ pointer
282
+ ], FFI::CPL::Error::CPLErr
288
283
 
289
284
  # OGR datasets. Not found in v1.11.1
290
- attach_function :GDALDatasetGetLayerCount, [:GDALDatasetH], :int
291
- attach_function :GDALDatasetGetLayer, [:GDALDatasetH, :int], :OGRLayerH
292
- attach_function :GDALDatasetGetLayerByName, [:GDALDatasetH, :string], :OGRLayerH
293
- attach_function :GDALDatasetDeleteLayer, [:GDALDatasetH, :int], OGRErr
294
- attach_function :GDALDatasetCreateLayer,
295
- [:GDALDatasetH, :string, :OGRSpatialReferenceH, OGRwkbGeometryType, :pointer],
296
- :OGRLayerH
297
- attach_function :GDALDatasetCopyLayer,
298
- %i[GDALDatasetH OGRLayerH string pointer],
299
- :OGRLayerH
300
- attach_function :GDALDatasetTestCapability, [:GDALDatasetH, :string], :int
301
- attach_function :GDALDatasetExecuteSQL,
302
- [:GDALDatasetH, :string, :OGRGeometryH, :string],
303
- :OGRLayerH
304
- attach_function :GDALDatasetReleaseResultSet,
305
- %i[GDALDatasetH OGRLayerH],
306
- :void
307
- attach_function :GDALDatasetGetStyleTable, [:GDALDatasetH], :OGRStyleTableH
308
- attach_function :GDALDatasetSetStyleTableDirectly,
309
- %i[GDALDatasetH OGRStyleTableH],
310
- :void
311
- attach_function :GDALDatasetSetStyleTable,
312
- %i[GDALDatasetH OGRStyleTableH],
313
- :void
314
-
315
- attach_function :GDALCreateDatasetMaskBand, [:GDALDatasetH, :int], CPLErr
285
+ # attach_function :GDALDatasetGetLayerCount, [:GDALDatasetH], :int
286
+ # attach_function :GDALDatasetGetLayer, [:GDALDatasetH, :int], :OGRLayerH
287
+ # attach_function :GDALDatasetGetLayerByName, [:GDALDatasetH, :string], :OGRLayerH
288
+ # attach_function :GDALDatasetDeleteLayer, [:GDALDatasetH, :int], FFI::OGR::::OGRErr
289
+ # attach_function :GDALDatasetCreateLayer,
290
+ # [
291
+ # :GDALDatasetH,
292
+ # :string,
293
+ # FFI::OGR::SRSAPI.find_type(:OGRSpatialReferenceH),
294
+ # FFI::OGR::::OGRwkbGeometryType,
295
+ # :pointer
296
+ # ],
297
+ # :OGRLayerH
298
+ # attach_function :GDALDatasetCopyLayer,
299
+ # [:GDALDatasetH, :OGRLayerH, :string, :pointer],
300
+ # :OGRLayerH
301
+ # attach_function :GDALDatasetTestCapability, [:GDALDatasetH, :string], :int
302
+ # attach_function :GDALDatasetExecuteSQL,
303
+ # [:GDALDatasetH, :string, :OGRGeometryH, :string],
304
+ # :OGRLayerH
305
+ # attach_function :GDALDatasetReleaseResultSet,
306
+ # %i[GDALDatasetH OGRLayerH],
307
+ # :void
308
+ # attach_function :GDALDatasetGetStyleTable, [:GDALDatasetH], :OGRStyleTableH
309
+ # attach_function :GDALDatasetSetStyleTableDirectly,
310
+ # %i[GDALDatasetH OGRStyleTableH],
311
+ # :void
312
+ # attach_function :GDALDatasetSetStyleTable,
313
+ # %i[GDALDatasetH OGRStyleTableH],
314
+ # :void
315
+
316
+ attach_function :GDALCreateDatasetMaskBand, %i[GDALDatasetH int], FFI::CPL::Error::CPLErr
316
317
  attach_function :GDALDatasetCopyWholeRaster,
317
318
  %i[GDALDatasetH GDALDatasetH pointer GDALProgressFunc pointer],
318
- CPLErr
319
+ FFI::CPL::Error::CPLErr
319
320
 
320
- #~~~~~~~~~~~~~~~~~~~~
321
+ # ~~~~~~~~~~~~~~~~~~~
321
322
  # MajorObject
322
- #~~~~~~~~~~~~~~~~~~~~
323
+ # ~~~~~~~~~~~~~~~~~~~
323
324
  attach_function :GDALGetMetadataDomainList, [:GDALMajorObjectH], :pointer
324
325
  attach_function :GDALGetMetadata, %i[GDALMajorObjectH string], :pointer
325
- attach_function :GDALSetMetadata, %i[GDALMajorObjectH pointer string], CPLErr
326
+ attach_function :GDALSetMetadata, %i[GDALMajorObjectH pointer string], FFI::CPL::Error::CPLErr
326
327
  attach_function :GDALGetMetadataItem,
327
328
  %i[GDALMajorObjectH string string],
328
329
  :string
329
330
  attach_function :GDALSetMetadataItem,
330
331
  %i[GDALMajorObjectH string string string],
331
- CPLErr
332
+ FFI::CPL::Error::CPLErr
332
333
  attach_function :GDALGetDescription, [:GDALMajorObjectH], :string
333
334
  attach_function :GDALSetDescription, %i[GDALMajorObjectH string], :void
334
335
 
335
- #~~~~~~~~~~~~~~~~~~~~
336
+ # ~~~~~~~~~~~~~~~~~~~
336
337
  # GeoTransform
337
- #~~~~~~~~~~~~~~~~~~~~
338
+ # ~~~~~~~~~~~~~~~~~~~
338
339
  attach_function :GDALInvGeoTransform, %i[pointer pointer], :int
339
340
  attach_function :GDALApplyGeoTransform,
340
341
  %i[pointer double double pointer pointer],
@@ -343,36 +344,36 @@ module FFI
343
344
  %i[pointer pointer pointer],
344
345
  :void
345
346
 
346
- #-----------------
347
+ # ----------------
347
348
  # Raster functions
348
- #-----------------
349
+ # ----------------
349
350
  attach_function :GDALRasterBandCopyWholeRaster,
350
- [
351
- :GDALRasterBandH,
352
- :GDALRasterBandH,
353
- :pointer,
354
- :GDALProgressFunc,
355
- :pointer
356
- ], CPLErr
351
+ %i[
352
+ GDALRasterBandH
353
+ GDALRasterBandH
354
+ pointer
355
+ GDALProgressFunc
356
+ pointer
357
+ ], FFI::CPL::Error::CPLErr
357
358
  attach_function :GDALRegenerateOverviews,
358
- [
359
- :GDALRasterBandH,
360
- :int,
361
- :pointer,
362
- :string,
363
- :GDALProgressFunc,
364
- :pointer
365
- ], CPLErr
359
+ %i[
360
+ GDALRasterBandH
361
+ int
362
+ pointer
363
+ string
364
+ GDALProgressFunc
365
+ pointer
366
+ ], FFI::CPL::Error::CPLErr
366
367
  attach_function :GDALGetMaskBand, [:GDALRasterBandH], :GDALRasterBandH
367
368
  attach_function :GDALGetMaskFlags, [:GDALRasterBandH], :int
368
369
  attach_function :GDALCreateMaskBand,
369
- [:GDALRasterBandH, :int],
370
- CPLErr
370
+ %i[GDALRasterBandH int],
371
+ FFI::CPL::Error::CPLErr
371
372
 
372
- attach_function :GDALGetRasterDataType, [:GDALRasterBandH], GDALDataType
373
+ attach_function :GDALGetRasterDataType, [:GDALRasterBandH], DataType
373
374
  attach_function :GDALGetBlockSize,
374
- [:GDALRasterBandH, :pointer, :pointer],
375
- GDALDataType
375
+ %i[GDALRasterBandH pointer pointer],
376
+ DataType
376
377
 
377
378
  attach_function :GDALRasterAdviseRead,
378
379
  [
@@ -383,14 +384,14 @@ module FFI
383
384
  :int,
384
385
  :int,
385
386
  :int,
386
- GDALDataType,
387
+ DataType,
387
388
  :pointer
388
- ], CPLErr
389
+ ], FFI::CPL::Error::CPLErr
389
390
 
390
391
  attach_function :GDALRasterIO,
391
392
  [
392
393
  :GDALRasterBandH,
393
- GDALRWFlag,
394
+ RWFlag,
394
395
  :int,
395
396
  :int,
396
397
  :int,
@@ -398,138 +399,138 @@ module FFI
398
399
  :pointer,
399
400
  :int,
400
401
  :int,
401
- GDALDataType,
402
+ DataType,
402
403
  :int,
403
404
  :int
404
- ], CPLErr
405
+ ], FFI::CPL::Error::CPLErr
405
406
  attach_function :GDALReadBlock,
406
- [:GDALRasterBandH, :int, :int, :pointer],
407
- CPLErr
407
+ %i[GDALRasterBandH int int pointer],
408
+ FFI::CPL::Error::CPLErr
408
409
  attach_function :GDALWriteBlock,
409
- [:GDALRasterBandH, :int, :int, :pointer],
410
- CPLErr
410
+ %i[GDALRasterBandH int int pointer],
411
+ FFI::CPL::Error::CPLErr
411
412
  attach_function :GDALGetRasterBandXSize, [:GDALRasterBandH], :int
412
413
  attach_function :GDALGetRasterBandYSize, [:GDALRasterBandH], :int
413
- attach_function :GDALGetRasterAccess, [:GDALRasterBandH], GDALAccess
414
+ attach_function :GDALGetRasterAccess, [:GDALRasterBandH], Access
414
415
  attach_function :GDALGetBandNumber, [:GDALRasterBandH], :int
415
416
  attach_function :GDALGetBandDataset, [:GDALRasterBandH], :GDALDatasetH
416
417
  attach_function :GDALGetRasterColorInterpretation,
417
418
  [:GDALRasterBandH],
418
- GDALColorInterp
419
+ ColorInterp
419
420
  attach_function :GDALSetRasterColorInterpretation,
420
- [:GDALRasterBandH, GDALColorInterp],
421
- CPLErr
421
+ [:GDALRasterBandH, ColorInterp],
422
+ FFI::CPL::Error::CPLErr
422
423
  attach_function :GDALGetRasterColorTable,
423
424
  [:GDALRasterBandH],
424
425
  :GDALColorTableH
425
426
  attach_function :GDALSetRasterColorTable,
426
- [:GDALRasterBandH, :GDALColorTableH],
427
- CPLErr
427
+ %i[GDALRasterBandH GDALColorTableH],
428
+ FFI::CPL::Error::CPLErr
428
429
 
429
430
  attach_function :GDALHasArbitraryOverviews, [:GDALRasterBandH], :int
430
431
  attach_function :GDALGetOverviewCount, [:GDALRasterBandH], :int
431
- attach_function :GDALGetOverview, [:GDALRasterBandH, :int], :GDALRasterBandH
432
+ attach_function :GDALGetOverview, %i[GDALRasterBandH int], :GDALRasterBandH
432
433
  attach_function :GDALGetRasterNoDataValue,
433
- [:GDALRasterBandH, :pointer],
434
+ %i[GDALRasterBandH pointer],
434
435
  :double
435
436
  attach_function :GDALSetRasterNoDataValue,
436
- [:GDALRasterBandH, :double],
437
- CPLErr
437
+ %i[GDALRasterBandH double],
438
+ FFI::CPL::Error::CPLErr
438
439
  attach_function :GDALGetRasterCategoryNames,
439
440
  [:GDALRasterBandH],
440
441
  :pointer
441
442
  attach_function :GDALSetRasterCategoryNames,
442
- [:GDALRasterBandH, :pointer],
443
- CPLErr
443
+ %i[GDALRasterBandH pointer],
444
+ FFI::CPL::Error::CPLErr
444
445
  attach_function :GDALGetRasterMinimum,
445
- [:GDALRasterBandH, :pointer],
446
+ %i[GDALRasterBandH pointer],
446
447
  :double
447
448
  attach_function :GDALGetRasterMaximum,
448
- [:GDALRasterBandH, :pointer],
449
+ %i[GDALRasterBandH pointer],
449
450
  :double
450
451
  attach_function :GDALGetRasterStatistics,
451
- [:GDALRasterBandH, :bool, :bool, :pointer, :pointer, :pointer, :pointer],
452
- CPLErr
452
+ %i[GDALRasterBandH bool bool pointer pointer pointer pointer],
453
+ FFI::CPL::Error::CPLErr
453
454
  attach_function :GDALComputeRasterStatistics,
454
- [
455
- :GDALRasterBandH,
456
- :bool,
457
- :pointer,
458
- :pointer,
459
- :pointer,
460
- :pointer,
461
- :GDALProgressFunc,
462
- :pointer
463
- ], CPLErr
455
+ %i[
456
+ GDALRasterBandH
457
+ bool
458
+ pointer
459
+ pointer
460
+ pointer
461
+ pointer
462
+ GDALProgressFunc
463
+ pointer
464
+ ], FFI::CPL::Error::CPLErr
464
465
  attach_function :GDALSetRasterStatistics,
465
- [:GDALRasterBandH, :double, :double, :double, :double],
466
- CPLErr
466
+ %i[GDALRasterBandH double double double double],
467
+ FFI::CPL::Error::CPLErr
467
468
  attach_function :GDALGetRasterUnitType, [:GDALRasterBandH], :string
468
- attach_function :GDALSetRasterUnitType, [:GDALRasterBandH, :string], CPLErr
469
- attach_function :GDALGetRasterOffset, [:GDALRasterBandH, :pointer], :double
470
- attach_function :GDALSetRasterOffset, [:GDALRasterBandH, :double], CPLErr
471
- attach_function :GDALGetRasterScale, [:GDALRasterBandH, :pointer], :double
472
- attach_function :GDALSetRasterScale, [:GDALRasterBandH, :double], CPLErr
469
+ attach_function :GDALSetRasterUnitType, %i[GDALRasterBandH string], FFI::CPL::Error::CPLErr
470
+ attach_function :GDALGetRasterOffset, %i[GDALRasterBandH pointer], :double
471
+ attach_function :GDALSetRasterOffset, %i[GDALRasterBandH double], FFI::CPL::Error::CPLErr
472
+ attach_function :GDALGetRasterScale, %i[GDALRasterBandH pointer], :double
473
+ attach_function :GDALSetRasterScale, %i[GDALRasterBandH double], FFI::CPL::Error::CPLErr
473
474
  attach_function :GDALComputeRasterMinMax,
474
- [:GDALRasterBandH, :int, :pointer],
475
+ %i[GDALRasterBandH bool pointer],
475
476
  :void
476
- attach_function :GDALFlushRasterCache, [:GDALRasterBandH], CPLErr
477
+ attach_function :GDALFlushRasterCache, [:GDALRasterBandH], FFI::CPL::Error::CPLErr
477
478
  attach_function :GDALGetRasterHistogram,
478
- [
479
- :GDALRasterBandH,
480
- :double,
481
- :double,
482
- :int,
483
- :pointer,
484
- :bool,
485
- :bool,
486
- :GDALProgressFunc,
487
- :pointer
488
- ], CPLErr
479
+ %i[
480
+ GDALRasterBandH
481
+ double
482
+ double
483
+ int
484
+ pointer
485
+ bool
486
+ bool
487
+ GDALProgressFunc
488
+ pointer
489
+ ], FFI::CPL::Error::CPLErr
489
490
 
490
491
  attach_function :GDALGetDefaultHistogram,
491
- [
492
- :GDALRasterBandH,
493
- :pointer,
494
- :pointer,
495
- :pointer,
496
- :pointer,
497
- :bool,
498
- :GDALProgressFunc,
499
- :pointer
500
- ], CPLErr
492
+ %i[
493
+ GDALRasterBandH
494
+ pointer
495
+ pointer
496
+ pointer
497
+ pointer
498
+ bool
499
+ GDALProgressFunc
500
+ pointer
501
+ ], FFI::CPL::Error::CPLErr
501
502
  attach_function :GDALSetDefaultHistogram,
502
- [
503
- :GDALRasterBandH,
504
- :double,
505
- :double,
506
- :int,
507
- :pointer
508
- ], CPLErr
503
+ %i[
504
+ GDALRasterBandH
505
+ double
506
+ double
507
+ int
508
+ pointer
509
+ ], FFI::CPL::Error::CPLErr
509
510
 
510
511
  attach_function :GDALGetRandomRasterSample,
511
- [:GDALRasterBandH, :int, :pointer],
512
+ %i[GDALRasterBandH int pointer],
512
513
  :int
513
514
  attach_function :GDALGetRasterSampleOverview,
514
- [:GDALRasterBandH, :int],
515
+ %i[GDALRasterBandH int],
515
516
  :GDALRasterBandH
516
517
  attach_function :GDALFillRaster,
517
- [:GDALRasterBandH, :double, :double],
518
- CPLErr
518
+ %i[GDALRasterBandH double double],
519
+ FFI::CPL::Error::CPLErr
519
520
 
520
521
  attach_function :GDALGetDefaultRAT,
521
522
  [:GDALRasterBandH],
522
523
  :GDALRasterAttributeTableH
523
524
  attach_function :GDALSetDefaultRAT,
524
- [:GDALRasterBandH, :GDALRasterAttributeTableH],
525
- CPLErr
525
+ %i[GDALRasterBandH GDALRasterAttributeTableH],
526
+ FFI::CPL::Error::CPLErr
526
527
  attach_function :GDALAddDerivedBandPixelFunc,
527
- [:string, :GDALDerivedPixelFunc],
528
- CPLErr
528
+ %i[string GDALDerivedPixelFunc],
529
+ FFI::CPL::Error::CPLErr
529
530
 
530
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
531
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
531
532
  # Raster Attribute Table functions
532
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533
534
  # Class-level functions
534
535
  attach_function :GDALCreateRasterAttributeTable,
535
536
  [],
@@ -550,20 +551,20 @@ module FFI
550
551
  [:GDALRasterAttributeTableH],
551
552
  :int
552
553
  attach_function :GDALRATGetNameOfCol,
553
- [:GDALRasterAttributeTableH, :int],
554
+ %i[GDALRasterAttributeTableH int],
554
555
  :string
555
556
  attach_function :GDALRATGetUsageOfCol,
556
- [:GDALRasterAttributeTableH, :int],
557
- GDALRATFieldUsage
557
+ %i[GDALRasterAttributeTableH int],
558
+ RATFieldUsage
558
559
  attach_function :GDALRATGetTypeOfCol,
559
- [:GDALRasterAttributeTableH, :int],
560
- GDALRATFieldType
560
+ %i[GDALRasterAttributeTableH int],
561
+ RATFieldType
561
562
  attach_function :GDALRATGetColOfUsage,
562
- [:GDALRasterAttributeTableH, GDALRATFieldUsage],
563
+ [:GDALRasterAttributeTableH, RATFieldUsage],
563
564
  :int
564
565
  attach_function :GDALRATCreateColumn,
565
- [:GDALRasterAttributeTableH, :string, GDALRATFieldType, GDALRATFieldUsage],
566
- CPLErr
566
+ [:GDALRasterAttributeTableH, :string, RATFieldType, RATFieldUsage],
567
+ FFI::CPL::Error::CPLErr
567
568
 
568
569
  attach_function :GDALRATGetValueAsString,
569
570
  %i[GDALRasterAttributeTableH int int],
@@ -584,14 +585,14 @@ module FFI
584
585
  %i[GDALRasterAttributeTableH int int double],
585
586
  :void
586
587
  attach_function :GDALRATValuesIOAsDouble,
587
- [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
588
- CPLErr
588
+ [:GDALRasterAttributeTableH, RWFlag, :int, :int, :int, :pointer],
589
+ FFI::CPL::Error::CPLErr
589
590
  attach_function :GDALRATValuesIOAsInteger,
590
- [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
591
- CPLErr
591
+ [:GDALRasterAttributeTableH, RWFlag, :int, :int, :int, :pointer],
592
+ FFI::CPL::Error::CPLErr
592
593
  attach_function :GDALRATValuesIOAsString,
593
- [:GDALRasterAttributeTableH, GDALRWFlag, :int, :int, :int, :pointer],
594
- CPLErr
594
+ [:GDALRasterAttributeTableH, RWFlag, :int, :int, :int, :pointer],
595
+ FFI::CPL::Error::CPLErr
595
596
 
596
597
  attach_function :GDALRATGetRowCount,
597
598
  [:GDALRasterAttributeTableH],
@@ -614,52 +615,52 @@ module FFI
614
615
  :GDALColorTableH
615
616
  attach_function :GDALRATInitializeFromColorTable,
616
617
  %i[GDALRasterAttributeTableH GDALColorTableH],
617
- CPLErr
618
+ FFI::CPL::Error::CPLErr
618
619
 
619
620
  attach_function :GDALRATDumpReadable,
620
621
  %i[GDALRasterAttributeTableH pointer],
621
622
  :void
622
623
 
623
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
624
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
624
625
  # ColorTable functions
625
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626
627
  # Class-level functions
627
- attach_function :GDALCreateColorTable, [GDALPaletteInterp], :GDALColorTableH
628
+ attach_function :GDALCreateColorTable, [PaletteInterp], :GDALColorTableH
628
629
 
629
630
  # Instance-level functions
630
631
  attach_function :GDALDestroyColorTable, [:GDALColorTableH], :void
631
632
  attach_function :GDALCloneColorTable, [:GDALColorTableH], :GDALColorTableH
632
633
 
633
- attach_function :GDALGetPaletteInterpretation, [:GDALColorTableH], GDALPaletteInterp
634
+ attach_function :GDALGetPaletteInterpretation, [:GDALColorTableH], PaletteInterp
634
635
  attach_function :GDALGetColorEntryCount, [:GDALColorTableH], :int
635
- attach_function :GDALGetColorEntry, [:GDALColorTableH, :int], GDALColorEntry.ptr
636
- attach_function :GDALGetColorEntryAsRGB, [:GDALColorTableH, :int, GDALColorEntry], :int
637
- attach_function :GDALSetColorEntry, [:GDALColorTableH, :int, GDALColorEntry.ptr], :void
636
+ attach_function :GDALGetColorEntry, %i[GDALColorTableH int], FFI::GDAL::ColorEntry.ptr
637
+ attach_function :GDALGetColorEntryAsRGB, [:GDALColorTableH, :int, FFI::GDAL::ColorEntry], :int
638
+ attach_function :GDALSetColorEntry, [:GDALColorTableH, :int, FFI::GDAL::ColorEntry.ptr], :void
638
639
 
639
640
  attach_function :GDALCreateColorRamp,
640
- [:GDALColorTableH, :int, GDALColorEntry.ptr, :int, GDALColorEntry.ptr],
641
+ [:GDALColorTableH, :int, FFI::GDAL::ColorEntry.ptr, :int, FFI::GDAL::ColorEntry.ptr],
641
642
  :void
642
643
 
643
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644
645
  # PaletteInterp functions
645
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646
- attach_function :GDALGetPaletteInterpretationName, [GDALPaletteInterp], :string
646
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
647
+ attach_function :GDALGetPaletteInterpretationName, [PaletteInterp], :string
647
648
 
648
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649
650
  # General stuff
650
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
651
- attach_function :GDALGetDataTypeSize, [GDALDataType], :int
652
- attach_function :GDALDataTypeIsComplex, [GDALDataType], :bool
653
- attach_function :GDALGetDataTypeName, [GDALDataType], :string
654
- attach_function :GDALGetDataTypeByName, [:string], GDALDataType
655
- attach_function :GDALDataTypeUnion, [GDALDataType, GDALDataType], GDALDataType
651
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
652
+ attach_function :GDALGetDataTypeSize, [DataType], :int
653
+ attach_function :GDALDataTypeIsComplex, [DataType], :bool
654
+ attach_function :GDALGetDataTypeName, [DataType], :string
655
+ attach_function :GDALGetDataTypeByName, [:string], DataType
656
+ attach_function :GDALDataTypeUnion, [DataType, DataType], DataType
656
657
 
657
658
  attach_function :GDALSetCacheMax, %i[int], :void
658
- attach_function :GDALSetCacheMax64, %i[GIntBig], :void
659
+ attach_function :GDALSetCacheMax64, [CPL::Port.find_type(:GIntBig)], :void
659
660
  attach_function :GDALGetCacheMax, [], :int
660
- attach_function :GDALGetCacheMax64, [], :GIntBig
661
+ attach_function :GDALGetCacheMax64, [], CPL::Port.find_type(:GIntBig)
661
662
  attach_function :GDALGetCacheUsed, [], :int
662
- attach_function :GDALGetCacheUsed64, [], :GIntBig
663
+ attach_function :GDALGetCacheUsed64, [], CPL::Port.find_type(:GIntBig)
663
664
  attach_function :GDALFlushCacheBlock, [], :bool
664
665
 
665
666
  attach_function :GDALLoadWorldFile, %i[string pointer], :bool