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,148 +0,0 @@
1
- module FFI
2
- module GDAL
3
-
4
- #------------------------------------------------------------------------
5
- # Enums
6
- #------------------------------------------------------------------------
7
- # The C API defines :OGRErr as a function that returns constants. I'm
8
- # taking the liberty to turn this into an enum.
9
- OGRErr = enum :OGRERR_NONE,
10
- :OGRERR_NOT_ENOUGH_DATA,
11
- :OGRERR_NOT_ENOUGH_MEMORY,
12
- :OGRERR_UNSUPPORTED_GEOMETRY_TYPE,
13
- :OGRERR_UNSUPPORTED_OPERATION,
14
- :OGRERR_CORRUPT_DATA,
15
- :OGRERR_FAILURE,
16
- :OGRERR_UNSUPPORTED_SRS,
17
- :OGRERR_INVALID_HANDLE
18
-
19
- OGRwkbGeometryType = enum :wkbUnknown, 0,
20
- :wkbPoint, 1,
21
- :wkbLineString, 2,
22
- :wkbPolygon, 3,
23
- :wkbMultiPoint, 4,
24
- :wkbMultiLineString, 5,
25
- :wkbMultiPolygon, 6,
26
- :wkbGeometryCollection, 7,
27
- :wkbNone, 100,
28
- :wkbLinearRing, 101,
29
- :wkbPoint25D, 0x80000001,
30
- :wkbLineString25D, 0x80000002,
31
- :wkbPolygon25D, 0x80000003,
32
- :wkbMultiPoint25D, 0x80000004,
33
- :wkbMultiLineString25D, 0x80000005,
34
- :wkbMultiPolygon25D, 0x80000006,
35
- :wkbGeometryCollection25D, 0x80000007
36
-
37
- OGRwkbVariant = enum :wkbVariantOgc, :wkbVariantIso
38
- OGRwkbByteOrder = enum :wkbXDR, 0,
39
- :wkbNDR, 1
40
-
41
- OGRFieldType = enum :OFTInteger, 0,
42
- :OFTIntegerList, 1,
43
- :OFTReal, 2,
44
- :OFTRealList, 3,
45
- :OFTString, 4,
46
- :OFTStringList, 5,
47
- :OFTWideString, 6,
48
- :OFTWideStringList, 7,
49
- :OFTBinary, 8,
50
- :OFTDate, 9,
51
- :OFTTime, 10,
52
- :OFTDateTime, 11,
53
- :OFTMaxType, 11
54
-
55
- OGRJustification = enum :OJUndefined, 0,
56
- :OJLeft, 1,
57
- :OJRight, 2
58
-
59
- OGRSTClassId = enum :OGRSTCNone, 0,
60
- :OGRSTCPen, 1,
61
- :OGRSTCBrush, 2,
62
- :OGRSTCSymbol, 3,
63
- :OGRSTCLabel, 4,
64
- :OGRSTCVector, 5
65
-
66
- OGRSTUnitId = enum :OGRSTUGround, 0,
67
- :OGRSTUPixel, 1,
68
- :OGRSTUPoints, 2,
69
- :OGRSTUMM, 3,
70
- :OGRSTUCM, 4,
71
- :OGRSTUInches, 5
72
-
73
- OGRSTPenParam = enum :OGRSTPenColor, 0,
74
- :OGRSTPenWidth, 1,
75
- :OGRSTPenPattern, 2,
76
- :OGRSTPenId, 3,
77
- :OGRSTPenPerOffset, 4,
78
- :OGRSTPenPerCap, 5,
79
- :OGRSTPenPerJoin, 6,
80
- :OGRSTPenPerPriority, 7,
81
- :OGRSTPenLast, 8
82
-
83
- OGRSTBrushParam = enum :OGRSTBrushFColor, 0,
84
- :OGRSTBrushBColor, 1,
85
- :OGRSTBrushId, 2,
86
- :OGRSTBrushAngle, 3,
87
- :OGRSTBrushSize, 4,
88
- :OGRSTBrushDx, 5,
89
- :OGRSTBrushDy, 6,
90
- :OGRSTBrushPriority, 7,
91
- :OGRSTBrushLast, 8
92
-
93
- OGRSTSymbolParam = enum :OGRSTSymbolId, 0,
94
- :OGRSTSymbolAngle, 1,
95
- :OGRSTSymbolColor, 2,
96
- :OGRSTSymbolSize, 3,
97
- :OGRSTSymbolDx, 4,
98
- :OGRSTSymbolDy, 5,
99
- :OGRSTSymbolStep, 6,
100
- :OGRSTSymbolPerp, 7,
101
- :OGRSTSymbolOffset, 8,
102
- :OGRSTSymbolPriority, 9,
103
- :OGRSTSymbolFontName, 10,
104
- :OGRSTSymbolOColor, 11,
105
- :OGRSTSymbolLast, 12
106
-
107
- OGRSTLabelParam = enum :OGRSTLabelFontName, 0,
108
- :OGRSTLabelSize, 1,
109
- :OGRSTLabelTextString, 2,
110
- :OGRSTLabelAngle, 3,
111
- :OGRSTLabelFColor, 4,
112
- :OGRSTLabelBColor, 5,
113
- :OGRSTLabelPlacement, 6,
114
- :OGRSTLabelAnchor, 7,
115
- :OGRSTLabelDx, 8,
116
- :OGRSTLabelDy, 9,
117
- :OGRSTLabelPerp, 10,
118
- :OGRSTLabelBold, 11,
119
- :OGRSTLabelItalic, 12,
120
- :OGRSTLabelUnderline, 13,
121
- :OGRSTLabelPriority, 14,
122
- :OGRSTLabelStrikeout, 15,
123
- :OGRSTLabelStretch, 16,
124
- :OGRSTLabelAdjHor, 17,
125
- :OGRSTLabelAdjVert, 18,
126
- :OGRSTLabelHColor, 19,
127
- :OGRSTLabelOColor, 20,
128
- :OGRSTLabelLast, 21
129
-
130
- #------------------------------------------------------------------------
131
- # Typedefs
132
- #------------------------------------------------------------------------
133
- typedef :int, :OGRBoolean
134
-
135
- #------------------------------------------------------------------------
136
- # Functions
137
- #------------------------------------------------------------------------
138
- attach_function :OGRMalloc, [:size_t], :pointer
139
- attach_function :OGRCalloc, [:size_t, :size_t], :pointer
140
- attach_function :OGRRealloc, [:pointer, :size_t], :pointer
141
- attach_function :OGRFree, [:pointer], :void
142
- attach_function :OGRGeometryTypeToName, [OGRwkbGeometryType], :string
143
- attach_function :OGRMergeGeometryTypes,
144
- [OGRwkbGeometryType, OGRwkbGeometryType],
145
- OGRwkbGeometryType
146
- attach_function :OGRParseDate, [:string, :pointer, :int], :int
147
- end
148
- end
@@ -1,22 +0,0 @@
1
- module FFI
2
- module GDAL
3
- autoload :OGRStyleParam,
4
- File.expand_path('ogr_style_param', __dir__)
5
- autoload :OGRStyleValue,
6
- File.expand_path('ogr_style_value', __dir__)
7
-
8
- #------------------------------------------------------------------------
9
- # Enums
10
- #------------------------------------------------------------------------
11
- OGRStyleType = enum :OGRSTypeString,
12
- :OGRSTypeDouble,
13
- :OGRSTypeInteger,
14
- :OGRSTypeBoolean
15
-
16
- #------------------------------------------------------------------------
17
- # Typedefs
18
- #------------------------------------------------------------------------
19
- OGRSType = OGRStyleType
20
- OGRStyleParamId = OGRStyleParam
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- module FFI
2
- module GDAL
3
- #------------------------------------------------------------------------
4
- # Typedefs
5
- #------------------------------------------------------------------------
6
- typedef :pointer, :OGRGeocodingSessionH
7
-
8
- #------------------------------------------------------------------------
9
- # Functions
10
- #------------------------------------------------------------------------
11
- attach_function :OGRGeocodeCreateSession, %i[pointer], :OGRGeocodingSessionH
12
- attach_function :OGRGeocodeDestroySession, %i[OGRGeocodingSessionH], :void
13
- attach_function :OGRGeocode,
14
- %i[OGRGeocodingSessionH string pointer pointer],
15
- :OGRLayerH
16
- attach_function :OGRGeocodeReverse,
17
- %i[OGRGeocodingSessionH double double pointer],
18
- :OGRLayerH
19
- attach_function :OGRGeocodeFreeResult, %i[OGRLayerH], :void
20
- end
21
- end
@@ -1,50 +0,0 @@
1
- module FFI
2
- module GDAL
3
- class IntegerList < FFI::Struct
4
- layout :count, :int,
5
- :list, :pointer
6
- end
7
-
8
- class RealList < FFI::Struct
9
- layout :count, :int,
10
- :list, :pointer
11
- end
12
-
13
- class StringList < FFI::Struct
14
- layout :count, :int,
15
- :list, :pointer
16
- end
17
-
18
- class Binary < FFI::Struct
19
- layout :count, :int,
20
- :list, :pointer
21
- end
22
-
23
- class Set < FFI::Struct
24
- layout :marker1, :int,
25
- :marker2, :int
26
- end
27
-
28
- class Date < FFI::Struct
29
- layout :year, :GInt16,
30
- :month, :GByte,
31
- :day, :GByte,
32
- :hour, :GByte,
33
- :minute, :GByte,
34
- :second, :GByte,
35
- :tz_flag, :GByte
36
- end
37
-
38
- class OGRField < FFI::Union
39
- layout :integer, :int,
40
- :real, :double,
41
- :string, :string,
42
- :integer_list, IntegerList,
43
- :real_list, RealList,
44
- :string_list, StringList,
45
- :binary, Binary,
46
- :set, Set,
47
- :date, Date
48
- end
49
- end
50
- end
@@ -1,12 +0,0 @@
1
- require 'ffi'
2
-
3
- module FFI
4
- module GDAL
5
- class OGRStyleParam < FFI::Struct
6
- layout :param, :int,
7
- :token, :string,
8
- :georef, :GBool,
9
- :type, OGRSType
10
- end
11
- end
12
- end
@@ -1,325 +0,0 @@
1
- module FFI
2
- module GDAL
3
-
4
- #------------------------------------------------------------------------
5
- # Enums
6
- #------------------------------------------------------------------------
7
- OGRAxisOrientation = enum :OAO_Other, 0,
8
- :OAO_North, 1,
9
- :OAO_South, 2,
10
- :OAO_East, 3,
11
- :OAO_West, 4,
12
- :OAO_Up, 5,
13
- :OAO_Down, 6
14
-
15
- OGRDatumType = enum :ODT_HD_Min, 1000,
16
- :ODT_HD_Other, 1000,
17
- :ODT_HD_Classic, 1001,
18
- :ODT_HD_Geocentric, 1002,
19
- :ODT_HD_Max, 1999,
20
- :ODT_VD_Min, 2000,
21
- :ODT_VD_Other, 2000,
22
- :ODT_VD_Orthometric, 2001,
23
- :ODT_VD_Ellipsoidal, 2002,
24
- :ODT_VD_AltitudeBarometric, 2003,
25
- :ODT_VD_Normal, 2004,
26
- :ODT_VD_GeoidModelDerived, 2005,
27
- :ODT_VD_Depth, 2006,
28
- :ODT_VD_Max, 2999,
29
- :ODT_LD_Min, 10000,
30
- :ODT_LD_Max, 32767
31
-
32
- #------------------------------------------------------------------------
33
- # Typedefs
34
- #------------------------------------------------------------------------
35
- typedef :pointer, :OGRSpatialReferenceH
36
- typedef :pointer, :OGRCoordinateTransformationH
37
-
38
- #------------------------------------------------------------------------
39
- # Functions
40
- #------------------------------------------------------------------------
41
- #~~~~~~~~~~~~~~
42
- # AxisOrientations
43
- #~~~~~~~~~~~~~~
44
- attach_function :OSRAxisEnumToName, [OGRAxisOrientation], :string
45
-
46
- #~~~~~~~~~~~~~~
47
- # SpatialReference
48
- #~~~~~~~~~~~~~~
49
- attach_function :OSRNewSpatialReference, %i[string], :OGRSpatialReferenceH
50
- attach_function :OSRCloneGeogCS, %i[OGRSpatialReferenceH], :OGRSpatialReferenceH
51
- attach_function :OSRClone, %i[OGRSpatialReferenceH], :OGRSpatialReferenceH
52
- attach_function :OSRDestroySpatialReference, %i[OGRSpatialReferenceH], :void
53
- attach_function :OSRReference, %i[OGRSpatialReferenceH], :int
54
- attach_function :OSRDereference, %i[OGRSpatialReferenceH], :int
55
- attach_function :OSRRelease, %i[OGRSpatialReferenceH], :void
56
-
57
- attach_function :OSRValidate, %i[OGRSpatialReferenceH], OGRErr
58
- attach_function :OSRFixupOrdering, %i[OGRSpatialReferenceH], OGRErr
59
- attach_function :OSRFixup, %i[OGRSpatialReferenceH], OGRErr
60
- attach_function :OSRStripCTParms, %i[OGRSpatialReferenceH], OGRErr
61
-
62
- attach_function :OSRImportFromEPSG, %i[OGRSpatialReferenceH int], OGRErr
63
- attach_function :OSRImportFromEPSGA, %i[OGRSpatialReferenceH int], OGRErr
64
- attach_function :OSRImportFromWkt, %i[OGRSpatialReferenceH pointer], OGRErr
65
- attach_function :OSRImportFromProj4, %i[OGRSpatialReferenceH string], OGRErr
66
- attach_function :OSRImportFromESRI, %i[OGRSpatialReferenceH pointer], OGRErr
67
- attach_function :OSRImportFromPCI,
68
- %i[OGRSpatialReferenceH string string pointer],
69
- OGRErr
70
- attach_function :OSRImportFromUSGS,
71
- %i[OGRSpatialReferenceH long long pointer long],
72
- OGRErr
73
- attach_function :OSRImportFromXML, %i[OGRSpatialReferenceH string], OGRErr
74
- attach_function :OSRImportFromMICoordSys, %i[OGRSpatialReferenceH string], OGRErr
75
- attach_function :OSRImportFromERM,
76
- %i[OGRSpatialReferenceH string string string],
77
- OGRErr
78
- attach_function :OSRImportFromUrl, %i[OGRSpatialReferenceH string], OGRErr
79
-
80
- attach_function :OSRExportToWkt, %i[OGRSpatialReferenceH pointer], OGRErr
81
- attach_function :OSRExportToPrettyWkt, %i[OGRSpatialReferenceH pointer bool], OGRErr
82
- attach_function :OSRExportToProj4, %i[OGRSpatialReferenceH pointer], OGRErr
83
- attach_function :OSRExportToPCI,
84
- %i[OGRSpatialReferenceH pointer pointer pointer],
85
- OGRErr
86
- attach_function :OSRExportToUSGS,
87
- %i[OGRSpatialReferenceH pointer pointer pointer pointer],
88
- OGRErr
89
- attach_function :OSRExportToXML, %i[OGRSpatialReferenceH pointer buffer_out], OGRErr
90
- attach_function :OSRExportToMICoordSys, %i[OGRSpatialReferenceH pointer], OGRErr
91
- attach_function :OSRExportToERM,
92
- %i[OGRSpatialReferenceH buffer_out buffer_out buffer_out],
93
- OGRErr
94
- attach_function :OSRMorphToESRI, %i[OGRSpatialReferenceH], OGRErr
95
- attach_function :OSRMorphFromESRI, %i[OGRSpatialReferenceH], OGRErr
96
-
97
- attach_function :OSRSetAttrValue, %i[OGRSpatialReferenceH string string], OGRErr
98
- attach_function :OSRGetAttrValue, %i[OGRSpatialReferenceH string int], :string
99
- attach_function :OSRSetAngularUnits, %i[OGRSpatialReferenceH string double], OGRErr
100
- attach_function :OSRGetAngularUnits, %i[OGRSpatialReferenceH pointer], :double
101
- attach_function :OSRSetLinearUnits, %i[OGRSpatialReferenceH string double], OGRErr
102
- attach_function :OSRGetLinearUnits, %i[OGRSpatialReferenceH pointer], :double
103
- attach_function :OSRSetTargetLinearUnits, %i[OGRSpatialReferenceH string string double], OGRErr
104
- attach_function :OSRGetTargetLinearUnits, %i[OGRSpatialReferenceH string pointer], :double
105
- attach_function :OSRGetPrimeMeridian, %i[OGRSpatialReferenceH pointer], :double
106
- attach_function :OSRSetLinearUnitsAndUpdateParameters,
107
- %i[OGRSpatialReferenceH string double],
108
- OGRErr
109
- attach_function :OSRGetSemiMajor, %i[OGRSpatialReferenceH pointer], :double
110
- attach_function :OSRGetSemiMinor, %i[OGRSpatialReferenceH pointer], :double
111
- attach_function :OSRGetInvFlattening, %i[OGRSpatialReferenceH pointer], :double
112
- attach_function :OSRSetAuthority,
113
- %i[OGRSpatialReferenceH string string int],
114
- OGRErr
115
- attach_function :OSRGetAuthorityCode, %i[OGRSpatialReferenceH string], :string
116
- attach_function :OSRGetAuthorityName, %i[OGRSpatialReferenceH string], :string
117
- attach_function :OSRSetProjection, %i[OGRSpatialReferenceH string], OGRErr
118
- attach_function :OSRSetProjParm, %i[OGRSpatialReferenceH string double], OGRErr
119
- attach_function :OSRGetProjParm,
120
- %i[OGRSpatialReferenceH string double pointer],
121
- :double
122
- attach_function :OSRSetNormProjParm, %i[OGRSpatialReferenceH string double], OGRErr
123
- attach_function :OSRGetNormProjParm,
124
- %i[OGRSpatialReferenceH string double pointer],
125
- :double
126
- attach_function :OSRSetUTM, %i[OGRSpatialReferenceH int int], OGRErr
127
- attach_function :OSRGetUTMZone, %i[OGRSpatialReferenceH pointer], :int
128
- attach_function :OSRSetStatePlane, %i[OGRSpatialReferenceH int int], OGRErr
129
- attach_function :OSRSetStatePlaneWithUnits,
130
- %i[OGRSpatialReferenceH int int string double],
131
- OGRErr
132
- attach_function :OSRAutoIdentifyEPSG, %i[OGRSpatialReferenceH], OGRErr
133
- attach_function :OSREPSGTreatsAsLatLong, %i[OGRSpatialReferenceH], :bool
134
- attach_function :OSREPSGTreatsAsNorthingEasting, %i[OGRSpatialReferenceH], :bool
135
- attach_function :OSRGetAxis,
136
- [:OGRSpatialReferenceH, :string, :int, :pointer],
137
- :string
138
-
139
- attach_function :OSRSetACEA,
140
- %i[OGRSpatialReferenceH double double double double double double],
141
- OGRErr
142
- attach_function :OSRSetAE,
143
- %i[OGRSpatialReferenceH double double double double],
144
- OGRErr
145
- attach_function :OSRSetBonne,
146
- %i[OGRSpatialReferenceH double double double double],
147
- OGRErr
148
- attach_function :OSRSetCEA,
149
- %i[OGRSpatialReferenceH double double double double],
150
- OGRErr
151
- attach_function :OSRSetCS,
152
- %i[OGRSpatialReferenceH double double double double],
153
- OGRErr
154
- attach_function :OSRSetEC,
155
- %i[OGRSpatialReferenceH double double double double double double],
156
- OGRErr
157
- attach_function :OSRSetEckert,
158
- %i[OGRSpatialReferenceH int double double double],
159
- OGRErr
160
- attach_function :OSRSetEckertIV,
161
- %i[OGRSpatialReferenceH double double double],
162
- OGRErr
163
- attach_function :OSRSetEckertVI,
164
- %i[OGRSpatialReferenceH double double double],
165
- OGRErr
166
- attach_function :OSRSetEquirectangular,
167
- %i[OGRSpatialReferenceH double double double double],
168
- OGRErr
169
- attach_function :OSRSetEquirectangular2,
170
- %i[OGRSpatialReferenceH double double double double double],
171
- OGRErr
172
- attach_function :OSRSetGS,
173
- %i[OGRSpatialReferenceH double double double],
174
- OGRErr
175
- attach_function :OSRSetGH,
176
- %i[OGRSpatialReferenceH double double double],
177
- OGRErr
178
- attach_function :OSRSetIGH,
179
- %i[OGRSpatialReferenceH],
180
- OGRErr
181
- attach_function :OSRSetGEOS,
182
- %i[OGRSpatialReferenceH double double double double],
183
- OGRErr
184
- attach_function :OSRSetGaussSchreiberTMercator,
185
- %i[OGRSpatialReferenceH double double double double double],
186
- OGRErr
187
- attach_function :OSRSetGnomonic,
188
- %i[OGRSpatialReferenceH double double double double],
189
- OGRErr
190
- attach_function :OSRSetOM,
191
- %i[OGRSpatialReferenceH double double double double double double double],
192
- OGRErr
193
- OGRErr
194
- attach_function :OSRSetHOM,
195
- %i[OGRSpatialReferenceH double double double double double double double],
196
- OGRErr
197
- attach_function :OSRSetHOM2PNO,
198
- %i[OGRSpatialReferenceH double double double double double double double double],
199
- OGRErr
200
- attach_function :OSRSetIWMPolyconic,
201
- %i[OGRSpatialReferenceH double double double double double],
202
- OGRErr
203
- attach_function :OSRSetKrovak,
204
- %i[OGRSpatialReferenceH double double double double double double double],
205
- OGRErr
206
- attach_function :OSRSetLAEA,
207
- %i[OGRSpatialReferenceH double double double double],
208
- OGRErr
209
- attach_function :OSRSetLCC,
210
- %i[OGRSpatialReferenceH double double double double double double],
211
- OGRErr
212
- attach_function :OSRSetLCC1SP,
213
- %i[OGRSpatialReferenceH double double double double double],
214
- OGRErr
215
- attach_function :OSRSetLCCB,
216
- %i[OGRSpatialReferenceH double double double double double double],
217
- OGRErr
218
- attach_function :OSRSetMC,
219
- %i[OGRSpatialReferenceH double double double double],
220
- OGRErr
221
- attach_function :OSRSetMercator,
222
- %i[OGRSpatialReferenceH double double double double double],
223
- OGRErr
224
- attach_function :OSRSetMollweide,
225
- %i[OGRSpatialReferenceH double double double],
226
- OGRErr
227
- attach_function :OSRSetNZMG,
228
- %i[OGRSpatialReferenceH double double double double],
229
- OGRErr
230
- attach_function :OSRSetOS,
231
- %i[OGRSpatialReferenceH double double double double double],
232
- OGRErr
233
- attach_function :OSRSetOrthographic,
234
- %i[OGRSpatialReferenceH double double double double],
235
- OGRErr
236
- attach_function :OSRSetPolyconic,
237
- %i[OGRSpatialReferenceH double double double double],
238
- OGRErr
239
- attach_function :OSRSetPS,
240
- %i[OGRSpatialReferenceH double double double double double],
241
- OGRErr
242
- attach_function :OSRSetRobinson,
243
- %i[OGRSpatialReferenceH double double double],
244
- OGRErr
245
- attach_function :OSRSetSinusoidal,
246
- %i[OGRSpatialReferenceH double double double],
247
- OGRErr
248
- attach_function :OSRSetStereographic,
249
- %i[OGRSpatialReferenceH double double double double double],
250
- OGRErr
251
- attach_function :OSRSetSOC,
252
- %i[OGRSpatialReferenceH double double double double],
253
- OGRErr
254
- attach_function :OSRSetTM,
255
- %i[OGRSpatialReferenceH double double double double double],
256
- OGRErr
257
- attach_function :OSRSetTMVariant,
258
- %i[OGRSpatialReferenceH string double double double double double],
259
- OGRErr
260
- attach_function :OSRSetTMG,
261
- %i[OGRSpatialReferenceH double double double double],
262
- OGRErr
263
- attach_function :OSRSetTMSO,
264
- %i[OGRSpatialReferenceH double double double double double],
265
- OGRErr
266
- attach_function :OSRSetVDG,
267
- %i[OGRSpatialReferenceH double double double],
268
- OGRErr
269
- attach_function :OSRSetWagner,
270
- %i[OGRSpatialReferenceH int double double],
271
- OGRErr
272
-
273
- attach_function :OSRIsGeographic, %i[OGRSpatialReferenceH], :bool
274
- attach_function :OSRIsLocal, %i[OGRSpatialReferenceH], :bool
275
- attach_function :OSRIsProjected, %i[OGRSpatialReferenceH], :bool
276
- attach_function :OSRIsCompound, %i[OGRSpatialReferenceH], :bool
277
- attach_function :OSRIsGeocentric, %i[OGRSpatialReferenceH], :bool
278
- attach_function :OSRIsVertical, %i[OGRSpatialReferenceH], :bool
279
- attach_function :OSRIsSameGeogCS, %i[OGRSpatialReferenceH OGRSpatialReferenceH], :bool
280
- attach_function :OSRIsSameVertCS, %i[OGRSpatialReferenceH OGRSpatialReferenceH], :bool
281
- attach_function :OSRIsSame, %i[OGRSpatialReferenceH OGRSpatialReferenceH], :bool
282
-
283
- attach_function :OSRSetLocalCS, %i[OGRSpatialReferenceH string], OGRErr
284
- attach_function :OSRSetProjCS, %i[OGRSpatialReferenceH string], OGRErr
285
- attach_function :OSRSetGeocCS, %i[OGRSpatialReferenceH string], OGRErr
286
- attach_function :OSRSetWellKnownGeocCS, %i[OGRSpatialReferenceH string], OGRErr
287
- attach_function :OSRSetFromUserInput, %i[OGRSpatialReferenceH string], OGRErr
288
- attach_function :OSRCopyGeogCSFrom, %i[OGRSpatialReferenceH OGRSpatialReferenceH], OGRErr
289
- attach_function :OSRSetTOWGS84,
290
- %i[OGRSpatialReferenceH double double double double double double double],
291
- OGRErr
292
- attach_function :OSRGetTOWGS84, %i[OGRSpatialReferenceH pointer int], OGRErr
293
- attach_function :OSRSetCompoundCS,
294
- %i[OGRSpatialReferenceH string OGRSpatialReferenceH OGRSpatialReferenceH],
295
- OGRErr
296
-
297
- attach_function :OSRCleanup, [], :void
298
-
299
- #~~~~~~~~~~~~~~
300
- # CoordinateTransformations
301
- #~~~~~~~~~~~~~~
302
- attach_function :OCTDestroyCoordinateTransformation,
303
- %i[OGRCoordinateTransformationH],
304
- :void
305
- attach_function :OCTNewCoordinateTransformation,
306
- %i[OGRSpatialReferenceH OGRSpatialReferenceH],
307
- :OGRCoordinateTransformationH
308
- attach_function :OCTTransform,
309
- %i[OGRCoordinateTransformationH int pointer pointer pointer],
310
- :bool
311
- attach_function :OCTTransformEx,
312
- %i[OGRCoordinateTransformationH int pointer pointer pointer pointer],
313
- :bool
314
- attach_function :OCTProj4Normalize, %i[string], :string
315
-
316
- #~~~~~~~~~~~~~~
317
- # Parameters
318
- #~~~~~~~~~~~~~~
319
- attach_function :OPTGetProjectionMethods, %i[], :pointer
320
- attach_function :OPTGetParameterList, %i[string pointer], :pointer
321
- attach_function :OPTGetParameterInfo,
322
- %i[string string pointer pointer pointer],
323
- :int
324
- end
325
- end
@@ -1,30 +0,0 @@
1
- require 'json'
2
-
3
- module GDAL
4
- module ColorEntryExtensions
5
-
6
- # @param include_fourth [Boolean] Turn off in case you don't want the fourth
7
- # color in the array.
8
- # @return [Array]
9
- def to_a(include_fourth=true)
10
- if include_fourth
11
- [color1, color2, color3, color4]
12
- else
13
- [color1, color2, color3]
14
- end
15
- end
16
-
17
- def as_json
18
- {
19
- color1: color1,
20
- color2: color2,
21
- color3: color3,
22
- color4: color4
23
- }
24
- end
25
-
26
- def to_json
27
- as_json.to_json
28
- end
29
- end
30
- end
@@ -1,47 +0,0 @@
1
- require 'json'
2
-
3
- module GDAL
4
- module ColorTableExtensions
5
-
6
- def color_entries_for(color_number)
7
- unless (1..4).to_a.include? color_number
8
- raise "Invalid ColorEntry number 'color#{color_number}'"
9
- end
10
-
11
- 0.upto(color_entry_count - 1).map do |i|
12
- color_entry(i).send("color#{color_number}".to_sym)
13
- end
14
- end
15
-
16
- # @return [Array<GDAL::ColorEntry>]
17
- def color_entries
18
- 0.upto(color_entry_count - 1).map do |i|
19
- color_entry(i)
20
- end
21
- end
22
-
23
- # Does the same as #color_entries, but calls #color_entry_as_rgb() instead
24
- # of #color_entry().
25
- #
26
- # @return [Array<GDAL::ColorEntry>]
27
- def color_entries_as_rgb
28
- 0.upto(color_entry_count - 1).map do |i|
29
- color_entry_as_rgb(i)
30
- end
31
- end
32
-
33
- # @return [Hash]
34
- def as_json
35
- {
36
- color_entry_count: color_entry_count,
37
- color_entries: color_entries.map(&:as_json),
38
- palette_interpretation: palette_interpretation,
39
- }
40
- end
41
-
42
- # @return [String]
43
- def to_json
44
- as_json.to_json
45
- end
46
- end
47
- end