Sha256: df6950cf658afe13c96ec5bad07f5370bb7f5793fa7388142a9e0e8cd404e5a8

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

require_relative '../../ffi/gdal/alg'

module GDAL
  module Transformers
    class RPCTransformer
      # @return [FFI::Pointer]
      def self.function
        FFI::GDAL::Alg::RPCTransform
      end

      # @return [FFI::Pointer] C pointer to the C RPC transformer.
      attr_reader :c_pointer

      # @param rpc_info [GDAL::RPCInfo]
      # @param reversed [Boolean]
      # @param pixel_error_threshold [Float]
      # @param options [Hash]
      # @option options [Number] rpc_height A fixed hight offset to be applied to
      #   all points passed in.
      # @option options [Number] rpc_height_scale A factor used to multiply
      #   heights above ground.  Useful when elevation offsets of the DEM are not
      #   expressed in meters.
      # @option options [Number] rpc_dem Name of a GDAL dataset used to extract
      #   elevation offsets from.  This should be used in replacement of
      #   +rpc_height+.
      # @option options [Number] rpc_deminterpolation +near+, +bilinear+, or
      #   +cubic+.
      # @option options [Number] rpc_dem_missing_value Value of DEM height that
      #   must be unsed in case the DEM has a nodata value at the sampling point,
      #   or if its extent doesn't cover the requested coordinate.
      def initialize(rpc_info, pixel_error_threshold, reversed = false, **options)
        options_ptr = GDAL::Options.pointer(options)

        @c_pointer = FFI::GDAL::Alg.GDALCreateRPCTransformer(
          rpc_info,
          reversed,
          pixel_error_threshold,
          options_ptr)

        ObjectSpace.define_finalizer self, -> { destroy! }
      end

      def destroy!
        return unless @c_pointer

        FFI::GDAL::Alg.GDALDestroyRPCTransformer(@c_pointer)
        @c_pointer = nil
      end

      # @return [FFI::Pointer]
      def function
        self.class.function
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta5 lib/gdal/transformers/rpc_transformer.rb
ffi-gdal-1.0.0.beta4 lib/gdal/transformers/rpc_transformer.rb