ffi-gdal 0.0.4 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Rakefile +12 -1
  4. data/TODO.md +11 -0
  5. data/ffi-gdal.gemspec +2 -2
  6. data/lib/ext/error_symbols.rb +59 -0
  7. data/lib/ext/float_ext.rb +15 -0
  8. data/lib/ext/narray_ext.rb +16 -0
  9. data/lib/ext/to_bool.rb +2 -0
  10. data/lib/ffi-gdal.rb +139 -4
  11. data/lib/ffi/{gdal/cpl_conv.rb → cpl/conv_h.rb} +2 -3
  12. data/lib/ffi/{gdal/cpl_error.rb → cpl/error_h.rb} +1 -25
  13. data/lib/ffi/cpl/minixml_h.rb +14 -0
  14. data/lib/ffi/{gdal/cpl_string.rb → cpl/string_h.rb} +0 -25
  15. data/lib/ffi/{gdal/cpl_vsi.rb → cpl/vsi_h.rb} +0 -0
  16. data/lib/ffi/cpl/xml_node.rb +13 -0
  17. data/lib/ffi/gdal.rb +57 -593
  18. data/lib/ffi/gdal/alg_h.rb +127 -0
  19. data/lib/ffi/gdal/gdal_grid_data_metrics_options.rb +14 -0
  20. data/lib/ffi/gdal/gdal_grid_inverse_distance_to_a_power_options.rb +19 -0
  21. data/lib/ffi/gdal/gdal_grid_moving_average_options.rb +14 -0
  22. data/lib/ffi/gdal/gdal_grid_nearest_neighbor_options.rb +13 -0
  23. data/lib/ffi/gdal/gdal_h.rb +683 -0
  24. data/lib/ffi/gdal/gdal_rpc_info.rb +27 -0
  25. data/lib/ffi/gdal/gdal_transformer_info.rb +14 -0
  26. data/lib/ffi/gdal/gdal_warp_options.rb +43 -0
  27. data/lib/ffi/gdal/grid_h.rb +51 -0
  28. data/lib/ffi/gdal/version.rb +1 -1
  29. data/lib/ffi/gdal/warper_h.rb +48 -0
  30. data/lib/ffi/ogr.rb +12 -0
  31. data/lib/ffi/ogr/api_h.rb +553 -0
  32. data/lib/ffi/ogr/core_h.rb +148 -0
  33. data/lib/ffi/ogr/featurestyle_h.rb +22 -0
  34. data/lib/ffi/ogr/geocoding_h.rb +21 -0
  35. data/lib/ffi/ogr/ogr_contour_writer_info.rb +14 -0
  36. data/lib/ffi/ogr/ogr_envelope.rb +12 -0
  37. data/lib/ffi/ogr/ogr_envelope_3d.rb +14 -0
  38. data/lib/ffi/ogr/ogr_field.rb +50 -0
  39. data/lib/ffi/ogr/ogr_style_param.rb +12 -0
  40. data/lib/ffi/ogr/ogr_style_value.rb +13 -0
  41. data/lib/ffi/ogr/srs_api_h.rb +325 -0
  42. data/lib/gdal/color_entry.rb +47 -0
  43. data/lib/gdal/color_entry_extensions.rb +30 -0
  44. data/lib/gdal/color_interpretation.rb +15 -0
  45. data/lib/gdal/color_table.rb +146 -0
  46. data/lib/gdal/color_table_extensions.rb +47 -0
  47. data/lib/gdal/color_table_types/cmyk.rb +25 -0
  48. data/lib/gdal/color_table_types/gray.rb +9 -0
  49. data/lib/gdal/color_table_types/hls.rb +21 -0
  50. data/lib/gdal/color_table_types/rgb.rb +25 -0
  51. data/lib/gdal/data_type.rb +38 -0
  52. data/lib/gdal/dataset.rb +437 -0
  53. data/lib/gdal/dataset_extensions.rb +496 -0
  54. data/lib/gdal/driver.rb +244 -0
  55. data/lib/gdal/driver_extensions.rb +56 -0
  56. data/lib/gdal/environment_methods.rb +43 -0
  57. data/lib/{ffi-gdal → gdal}/exceptions.rb +4 -1
  58. data/lib/gdal/geo_transform.rb +188 -0
  59. data/lib/gdal/geo_transform_extensions.rb +90 -0
  60. data/lib/gdal/logger.rb +7 -0
  61. data/lib/{ffi-gdal → gdal}/major_object.rb +15 -14
  62. data/lib/gdal/options.rb +49 -0
  63. data/lib/gdal/raster_attribute_table.rb +185 -0
  64. data/lib/gdal/raster_attribute_table_extensions.rb +40 -0
  65. data/lib/{ffi-gdal → gdal}/raster_band.rb +227 -99
  66. data/lib/gdal/raster_band_extensions.rb +198 -0
  67. data/lib/{ffi-gdal → gdal}/version_info.rb +8 -0
  68. data/lib/gdal/warp_operation.rb +96 -0
  69. data/lib/ogr/coordinate_transformation.rb +108 -0
  70. data/lib/ogr/data_source.rb +172 -0
  71. data/lib/ogr/data_source_extensions.rb +32 -0
  72. data/lib/ogr/driver.rb +119 -0
  73. data/lib/ogr/envelope.rb +80 -0
  74. data/lib/ogr/envelope_extensions.rb +92 -0
  75. data/lib/ogr/exceptions.rb +35 -0
  76. data/lib/ogr/feature.rb +212 -0
  77. data/lib/ogr/feature_definition.rb +120 -0
  78. data/lib/ogr/feature_definition_extensions.rb +36 -0
  79. data/lib/ogr/feature_extensions.rb +31 -0
  80. data/lib/ogr/field.rb +91 -0
  81. data/lib/ogr/field_extensions.rb +23 -0
  82. data/lib/ogr/geocoding_session.rb +84 -0
  83. data/lib/ogr/geometry.rb +617 -0
  84. data/lib/ogr/geometry_extensions.rb +60 -0
  85. data/lib/ogr/geometry_types/collection.rb +45 -0
  86. data/lib/ogr/geometry_types/curve.rb +120 -0
  87. data/lib/ogr/geometry_types/surface.rb +20 -0
  88. data/lib/ogr/layer.rb +226 -0
  89. data/lib/ogr/layer_extensions.rb +55 -0
  90. data/lib/ogr/line_string.rb +7 -0
  91. data/lib/ogr/linear_ring.rb +6 -0
  92. data/lib/ogr/multi_line_string.rb +9 -0
  93. data/lib/ogr/multi_point.rb +7 -0
  94. data/lib/ogr/multi_polygon.rb +14 -0
  95. data/lib/ogr/point.rb +89 -0
  96. data/lib/ogr/polygon.rb +9 -0
  97. data/lib/ogr/spatial_reference.rb +723 -0
  98. data/lib/ogr/spatial_reference_extensions.rb +32 -0
  99. data/lib/ogr/style_table.rb +17 -0
  100. data/lib/ogr/style_table_extensions.rb +16 -0
  101. data/spec/{ffi-gdal/integration → integration}/color_table_info_spec.rb +1 -1
  102. data/spec/{ffi-gdal/integration → integration}/dataset_info_spec.rb +0 -0
  103. data/spec/{ffi-gdal/integration → integration}/driver_info_spec.rb +1 -1
  104. data/spec/{ffi-gdal/integration → integration}/geo_transform_info_spec.rb +0 -0
  105. data/spec/{ffi-gdal/integration → integration}/raster_attribute_table_info_spec.rb +1 -1
  106. data/spec/{ffi-gdal/integration → integration}/raster_band_info_spec.rb +5 -5
  107. data/spec/spec_helper.rb +4 -1
  108. data/spec/support/shapefiles/states_21basic/states.prj +1 -0
  109. data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
  110. data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
  111. data/spec/support/shapefiles/states_21basic/states.shp +0 -0
  112. data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +1 -0
  113. data/spec/support/worldfiles/SR_50M/SR_50M.prj +1 -0
  114. data/spec/support/worldfiles/SR_50M/SR_50M.tfw +6 -0
  115. data/spec/{ext/cpl_error_symbols_spec.rb → unit/ext/error_symbols_spec.rb} +1 -1
  116. data/spec/unit/gdal/color_table_spec.rb +146 -0
  117. data/spec/unit/ogr/layer_spec.rb +97 -0
  118. data/spec/unit/ogr/linear_ring_spec.rb +111 -0
  119. data/spec/unit/ogr/point_spec.rb +321 -0
  120. data/spec/{ffi-gdal/unit → unit}/version_info_spec.rb +1 -1
  121. data/testing_gdal.rb +168 -0
  122. data/testing_gdalwarp.rb +91 -0
  123. data/testing_layer_to_layer.rb +35 -0
  124. data/testing_ndvi.rb +76 -0
  125. data/testing_nir.rb +77 -0
  126. data/testing_ogr.rb +63 -0
  127. metadata +167 -59
  128. data/lib/ext/cpl_error_symbols.rb +0 -37
  129. data/lib/ffi-gdal/color_table.rb +0 -59
  130. data/lib/ffi-gdal/dataset.rb +0 -359
  131. data/lib/ffi-gdal/driver.rb +0 -151
  132. data/lib/ffi-gdal/geo_transform.rb +0 -137
  133. data/lib/ffi-gdal/raster_attribute_table.rb +0 -78
  134. data/lib/ffi/gdal/ogr_api.rb +0 -21
  135. data/lib/ffi/gdal/ogr_core.rb +0 -195
  136. data/lib/ffi/gdal/ogr_srs_api.rb +0 -44
  137. data/meow.rb +0 -144
  138. data/rubby.rb +0 -224
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfa34b84ed0070848c6fde3721e8ef247a0c6ff9
4
- data.tar.gz: f458c3e3f8c0f9d4e3ff0381f75017b6e123e03e
3
+ metadata.gz: b085e002a7e05915f5335245a0a316090d927c38
4
+ data.tar.gz: c5e22d016ba55c3c421c03ad2e043befba56b8e6
5
5
  SHA512:
6
- metadata.gz: d337efd0962ecf22a455026cdafcf76ea97ab12b173d270763d5eb9bce592778b61ce43b72ea932b380b926a0f77dd5091bb834a42dc7d41780ec1a9d6668b7e
7
- data.tar.gz: dd9f8ecd705648a22a5a480b9b8f6e0a34a90eda87da49f95d9298b8989b1171f648878a32c12640d6103aa42cff788823cdb378f6caa8fb423b58f73b836d9d
6
+ metadata.gz: ebeace61156bee523ef19aa7d4babd67fc0274e85b105d9bf54b5086c886615bcee9532c1e5b238dd611bcaac2e6eb209276da046a99581511e35a8aeecbaed0
7
+ data.tar.gz: d0586998a7010b8f41d20018764f6daa06e0be1a3f563d5ad4e7dc6251ef7d2b5d38238e7b4d80203fff21f4eed4f11e1a14dbb9679e909927c9dcd049f9919f
data/.gitignore CHANGED
@@ -22,4 +22,10 @@ tmp
22
22
  mkmf.log
23
23
  .idea/
24
24
  spec/support/images
25
- tags
25
+ tags
26
+ *.sqlite
27
+ vendor/bundle
28
+ *.tif
29
+ *.xml
30
+ *.dbf
31
+ *.shx
data/Rakefile CHANGED
@@ -54,4 +54,15 @@ def files_and_dirs(in_dir, ftp)
54
54
  end
55
55
 
56
56
 
57
- RSpec::Core::RakeTask.new
57
+ namespace :spec do
58
+ RSpec::Core::RakeTask.new(:unit) do |t|
59
+ t.pattern = 'spec/unit/**/*_spec.rb'
60
+ end
61
+
62
+ RSpec::Core::RakeTask.new(:integration) do |t|
63
+ t.pattern = 'spec/integration/**/*_spec.rb'
64
+ end
65
+ end
66
+
67
+ task spec: 'spec:unit'
68
+ task default: 'spec:unit'
data/TODO.md ADDED
@@ -0,0 +1,11 @@
1
+ * Use autoload for C wrappers
2
+ * Documentation
3
+ * add more OGR::StyleTable
4
+ * normalize c_pointer instance variable names
5
+ * set attributes to instance variables
6
+ * more GDALDriver
7
+ * Finish MajorObject
8
+ * Make object attributes that behave like Hashes be hashes
9
+ * MajorObject#metadata
10
+ * ColorTable color entries
11
+ * Raster bands in a dataset
data/ffi-gdal.gemspec CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = %w[lib]
19
19
 
20
20
  spec.add_dependency 'ffi'
21
- spec.add_dependency 'log_switch'
21
+ spec.add_dependency 'log_switch', '~> 1.0.0'
22
22
  spec.add_dependency 'multi_xml'
23
23
  spec.add_dependency 'narray', '~> 0.6.0'
24
- spec.add_dependency 'ruby-progressbar'
25
24
  spec.add_development_dependency 'bundler', '~> 1.6'
26
25
  spec.add_development_dependency 'rake'
27
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
+ spec.add_development_dependency 'ruby-progressbar'
28
28
  end
@@ -0,0 +1,59 @@
1
+ require_relative '../gdal/exceptions'
2
+
3
+
4
+ class ::Symbol
5
+
6
+ # When FFI interfaces with a GDAL CPLError, it returns a Symbol that
7
+ # maps to the CPLErr enum (see GDAL's cpl_error.h or cpl_error.rb docs). Since
8
+ # many of the GDAL C API's functions return these symbols _and_ because the
9
+ # symbols have some functional implications, this wrapping here is simply for
10
+ # returning Ruby-esque values when the GDAL API returns one of these symbols.
11
+ #
12
+ # The optional params let you override behavior. Passing in a block instead
13
+ # will call the block. Ex.
14
+ #
15
+ # cpl_err = GDALCopyDatasetFiles(@gdal_driver_handle, new_name, old_name)
16
+ # cpl_err.to_ruby # returns the default value
17
+ # cpl_err.to_ruby { raise 'Crap!' }
18
+ def to_ruby(none: :none, debug: :debug, warning: :warning, failure: :failure, fatal: :fatal)
19
+ case self
20
+ when :CE_None then none
21
+ when :CE_Debug then debug
22
+ when :CE_Warning then warning
23
+ when :CE_Failure then failure
24
+ when :CE_Fatal then fatal
25
+ when :OGRERR_NONE then none
26
+ when :OGRERR_NOT_ENOUGH_DATA then fail(OGR::NotEnoughData)
27
+ when :OGRERR_NOT_ENOUGH_MEMORY then fail(OGR::NotEnoughMemory)
28
+ when :OGRERR_UNSUPPORTED_GEOMETRY_TYPE then fail(OGR::UnsupportedGeometryType)
29
+ when :OGRERR_UNSUPPORTED_OPERATION then fail(OGR::UnsupportedOperation)
30
+ when :OGRERR_CORRUPT_DATA then fail(OGR::CorruptData)
31
+ when :OGRERR_FAILURE then fail(OGR::Failure)
32
+ when :OGRERR_UNSUPPORTED_SRS then fail(OGR::UnsupportedSRS)
33
+ when :OGRERR_INVALID_HANDLE then fail(OGR::InvalidHandle)
34
+ else
35
+ raise "Unknown CPLErr/OGRErr type: #{self}"
36
+ end
37
+ end
38
+
39
+ def to_bool
40
+ case self
41
+ when :CE_None then true
42
+ when :CE_Debug then true
43
+ when :CE_Warning then false
44
+ when :CE_Failure then raise GDAL::CPLErrFailure
45
+ when :CE_Fatal then raise GDAL::CPLErrFailure
46
+ when :OGRERR_NONE then true
47
+ when :OGRERR_NOT_ENOUGH_DATA then fail(OGR::NotEnoughData)
48
+ when :OGRERR_NOT_ENOUGH_MEMORY then fail(OGR::NotEnoughMemory)
49
+ when :OGRERR_UNSUPPORTED_GEOMETRY_TYPE then fail(OGR::UnsupportedGeometryType)
50
+ when :OGRERR_UNSUPPORTED_OPERATION then fail(OGR::UnsupportedOperation)
51
+ when :OGRERR_CORRUPT_DATA then fail(OGR::CorruptData)
52
+ when :OGRERR_FAILURE then fail(OGR::Failure)
53
+ when :OGRERR_UNSUPPORTED_SRS then fail(OGR::UnsupportedSRS)
54
+ when :OGRERR_INVALID_HANDLE then fail(OGR::InvalidHandle)
55
+ else
56
+ raise "Unknown CPLError type: #{self}"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,15 @@
1
+ class Float
2
+ # Converts a packed DMS value (DDDMMMSSS.SS) into decimal degress.
3
+ #
4
+ # @return [Float]
5
+ def to_decimal_degress
6
+ FFI::GDAL.GDALPackedDMSToDec(self)
7
+ end
8
+
9
+ # Converts decimal degrees int a packed DMS value (DDDMMMSSS.SS).
10
+ #
11
+ # @return [Float]
12
+ def to_dms
13
+ FFI::GDAL.GDALDecToPackedDMS(self)
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require 'narray'
2
+
3
+ class NArray
4
+ def type
5
+ case typecode
6
+ when 1 then :byte
7
+ when 2 then :sint
8
+ when 3 then :int
9
+ when 4 then :sfloat
10
+ when 5 then :float
11
+ when 6 then :scomplex
12
+ when 7 then :complex
13
+ when 8 then :object
14
+ end
15
+ end
16
+ end
data/lib/ext/to_bool.rb CHANGED
@@ -2,6 +2,7 @@ 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
6
  end
6
7
  end
7
8
 
@@ -9,5 +10,6 @@ class String
9
10
  def to_bool
10
11
  return true if self.to_i == 1
11
12
  return false if self.to_i == 0
13
+ raise "String '#{self}' can't be converted to Boolean."
12
14
  end
13
15
  end
data/lib/ffi-gdal.rb CHANGED
@@ -1,12 +1,147 @@
1
1
  require 'log_switch'
2
- require_relative 'ffi-gdal/version_info'
2
+ require_relative 'ext/narray_ext'
3
+ require_relative 'gdal/version_info'
4
+ require_relative 'gdal/environment_methods'
3
5
 
4
6
  module GDAL
5
7
  extend VersionInfo
6
- extend LogSwitch
8
+ extend EnvironmentMethods
9
+
10
+ module Logger
11
+ include LogSwitch
12
+ end
13
+
14
+ autoload :ColorEntry,
15
+ File.expand_path('gdal/color_entry', __dir__)
16
+ autoload :ColorInterpretation,
17
+ File.expand_path('gdal/color_interpretation', __dir__)
18
+ autoload :ColorTable,
19
+ File.expand_path('gdal/color_table', __dir__)
20
+ autoload :DataType,
21
+ File.expand_path('gdal/data_type', __dir__)
22
+ autoload :Dataset,
23
+ File.expand_path('gdal/dataset', __dir__)
24
+ autoload :Driver,
25
+ File.expand_path('gdal/driver', __dir__)
26
+ autoload :GeoTransform,
27
+ File.expand_path('gdal/geo_transform', __dir__)
28
+ autoload :MajorObject,
29
+ File.expand_path('gdal/major_object', __dir__)
30
+ autoload :Options,
31
+ File.expand_path('gdal/options', __dir__)
32
+ autoload :RasterAttributeTable,
33
+ File.expand_path('gdal/raster_attribute_table', __dir__)
34
+ autoload :Utils,
35
+ File.expand_path('gdal/utils', __dir__)
36
+ autoload :WarpOperation,
37
+ File.expand_path('gdal/warp_operation', __dir__)
38
+
39
+ # Register all drivers!
40
+ FFI::GDAL.GDALAllRegister
41
+
42
+ # Internal factory method for returning a pointer from +variable+, which could
43
+ # be either of +klass+ class or a type of FFI::Pointer.
44
+ def self._pointer(klass, variable, warn_on_nil=true)
45
+ if variable.kind_of?(klass)
46
+ variable.c_pointer
47
+ elsif variable.kind_of? FFI::Pointer
48
+ variable
49
+ elsif warn_on_nil
50
+ Logger.log "<#{name}._pointer> #{variable.inspect} is not a valid #{klass} or FFI::Pointer."
51
+ Logger.log "<#{name}._pointer> Called at: #{caller(1, 1).first}"
52
+ else
53
+ nil
54
+ end
55
+ end
56
+
57
+ # @param data_type [FFI::GDAL::GDALDataType]
58
+ # @return [Symbol] The FFI Symbol that represents a data type.
59
+ def self._pointer_from_data_type(data_type, size=nil)
60
+ pointer_type = _gdal_data_type_to_ffi(data_type)
61
+
62
+ if size
63
+ FFI::MemoryPointer.new(pointer_type, size)
64
+ else
65
+ FFI::MemoryPointer.new(pointer_type)
66
+ end
67
+ end
68
+
69
+ # Maps GDAL DataTypes to FFI types.
70
+ #
71
+ # @param data_type [FFI::GDAL::GDALDataType]
72
+ def self._gdal_data_type_to_ffi(data_type)
73
+ case data_type
74
+ when :GDT_Byte then :uchar
75
+ when :GDT_UInt16 then :uint16
76
+ when :GDT_Int16 then :int16
77
+ when :GDT_UInt32 then :uint32
78
+ when :GDT_Int32 then :int32
79
+ when :GDT_Float32 then :float
80
+ when :GDT_Float64 then :double
81
+ else
82
+ :float
83
+ end
84
+ end
85
+
86
+ # Check to see if the function is supported in the version of GDAL that we're
87
+ # using.
88
+ #
89
+ # @param function_name [Symbol]
90
+ # @return [Boolean]
91
+ def self._supported?(function_name)
92
+ !FFI::GDAL.unsupported_gdal_functions.include?(function_name)
93
+ end
7
94
  end
8
95
 
9
- GDAL.log_class_name = true
96
+ module OGR
97
+ autoload :CoordinateTransformation,
98
+ File.expand_path('ogr/coordinate_transformation', __dir__)
99
+ autoload :DataSource,
100
+ File.expand_path('ogr/data_source', __dir__)
101
+ autoload :Driver,
102
+ File.expand_path('ogr/driver', __dir__)
103
+ autoload :Envelope,
104
+ File.expand_path('ogr/envelope', __dir__)
105
+ autoload :Feature,
106
+ File.expand_path('ogr/feature', __dir__)
107
+ autoload :FeatureDefinition,
108
+ File.expand_path('ogr/feature_definition', __dir__)
109
+ autoload :GeocodingSession,
110
+ File.expand_path('ogr/geocoding_session', __dir__)
111
+ autoload :Geometry,
112
+ File.expand_path('ogr/geometry', __dir__)
113
+ autoload :Layer,
114
+ File.expand_path('ogr/layer', __dir__)
115
+ autoload :LineString,
116
+ File.expand_path('ogr/line_string', __dir__)
117
+ autoload :LinearRing,
118
+ File.expand_path('ogr/linear_ring', __dir__)
119
+ autoload :MultiLineString,
120
+ File.expand_path('ogr/multi_line_string', __dir__)
121
+ autoload :MultiPoint,
122
+ File.expand_path('ogr/multi_point', __dir__)
123
+ autoload :MultiPolygon,
124
+ File.expand_path('ogr/multi_polygon', __dir__)
125
+ autoload :Point,
126
+ File.expand_path('ogr/point', __dir__)
127
+ autoload :Polygon,
128
+ File.expand_path('ogr/polygon', __dir__)
129
+ autoload :SpatialReference,
130
+ File.expand_path('ogr/spatial_reference', __dir__)
131
+ autoload :StyleTable,
132
+ File.expand_path('ogr/style_table', __dir__)
133
+
134
+ FFI::GDAL.OGRRegisterAll
135
+
136
+ def self._boolean_access_flag(flag)
137
+ case flag
138
+ when 'w' then true
139
+ when 'r' then false
140
+ else raise "Invalid access_flag '#{access_flag}'. Use 'r' or 'w'."
141
+ end
142
+ end
143
+ end
10
144
 
11
145
  require_relative 'ffi/gdal'
12
- require_relative 'ffi-gdal/dataset'
146
+ require_relative 'ffi/ogr'
147
+ require_relative 'ext/float_ext'
@@ -1,10 +1,9 @@
1
- require_relative 'cpl_error'
2
- require_relative 'cpl_vsi'
1
+ require_relative 'error_h'
2
+ require_relative 'vsi_h'
3
3
 
4
4
 
5
5
  module FFI
6
6
  module GDAL
7
-
8
7
  def CPLFree(pointer)
9
8
  extend CPLVSI
10
9
  VSIFree(pointer)
@@ -1,33 +1,9 @@
1
- require_relative '../../ext/cpl_error_symbols'
1
+ require_relative '../../ext/error_symbols'
2
2
 
3
3
 
4
4
  module FFI
5
5
  module GDAL
6
6
 
7
- #------------------------------------------------------------------------
8
- # Defines
9
- #------------------------------------------------------------------------
10
- None = 0
11
- AppDefined = 1
12
- OutOfMemory = 2
13
- FileIO = 3
14
- OpenFailed = 4
15
- IllegalArg = 5
16
- NotSupported = 6
17
- AssertionFailed = 7
18
- NoWriteAccess = 8
19
- UserInterrupt = 9
20
- ObjectNull = 10
21
-
22
- def cpla_assert(exp)
23
- end
24
- def validate_pointer_err(ce_failure)
25
- end
26
- def validate_pointer0(ptr, func)
27
- end
28
- def validate_pointer1(ptr, func, rc)
29
- end
30
-
31
7
  #------------------------------------------------------------------------
32
8
  # Enums
33
9
  #------------------------------------------------------------------------
@@ -0,0 +1,14 @@
1
+ module FFI
2
+ module GDAL
3
+ #--------------------------------------------------------------------------
4
+ # Enums
5
+ #--------------------------------------------------------------------------
6
+ CPLXMLNodeType = enum :CXT_Element, 0,
7
+ :CXT_Text, 1,
8
+ :CXT_Attribute, 2,
9
+ :CXT_Comment, 3,
10
+ :CXT_Literal, 4
11
+ end
12
+ end
13
+
14
+ require_relative 'xml_node'
@@ -1,31 +1,6 @@
1
1
  module FFI
2
2
  module GDAL
3
3
 
4
- #------------------------------------------------------------------------
5
- # Defines
6
- #------------------------------------------------------------------------
7
- CSLT_HONOURSTRINGS = 0x0001
8
- CSLT_ALLOWEMPTYTOKENS = 0x0002
9
- CSLT_PRESERVEQUOTES = 0x0004
10
- CSLT_PRESERVEESCAPES = 0x0008
11
- CSLT_STRIPLEADSPACES = 0x0010
12
- CSLT_STRIPENDSPACES = 0x0020
13
-
14
- CPLES_BackslashQuotable = 0
15
- CPLES_XML = 1
16
- CPLES_URL = 2
17
- CPLES_SQL = 3
18
- CPLES_CSV = 4
19
- CPLES_XML_BUT_QUOTES = 5
20
-
21
- CPL_ENC_LOCALE = ''
22
- CPL_ENC_UTF8 = 'UTF-8'
23
- CPL_ENC_UTF16 = 'UTF-16'
24
- CPL_ENC_UCS2 = 'UCS-2'
25
- CPL_ENC_UCS4 = 'UCS-4'
26
- CPL_ENC_ASCII = 'ASCII'
27
- CPL_ENC_ISO8859_1 = 'ISO-8859-1'
28
-
29
4
  typedef :string, :CPLString
30
5
 
31
6
  #------------------------------------------------------------------------
File without changes
@@ -0,0 +1,13 @@
1
+ require 'ffi'
2
+ require_relative 'minixml_h'
3
+
4
+ module FFI
5
+ module GDAL
6
+ class CPLXMLNode < FFI::Struct
7
+ layout :type, CPLXMLNodeType,
8
+ :value, :string,
9
+ :next, CPLXMLNode.ptr,
10
+ :child, CPLXMLNode.ptr
11
+ end
12
+ end
13
+ end