Sha256: 0a09419a96942bd1a8e1ff741793adf6e5c290561cb832a820344e3f64f2ff05

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module GDAL
  module Transformers
    class ApproximateTransformer
      # @return [FFI::Function]
      def self.function
        FFI::GDAL::Alg::ApproxTransform
      end

      attr_reader :c_pointer

      # @param base_transformer [GDAL::Transformer]
      # @param max_error [Float] The maximum cartesian error in the "output" space
      #   that will be accepted in the linear approximation.
      def initialize(base_transformer, max_error)
        base_transformer_function = base_transformer.function
        transformer_arg_ptr = base_transformer.c_pointer

        @c_pointer = FFI::GDAL::Alg.GDALCreateApproxTransformer(
          base_transformer_function,
          transformer_arg_ptr,
          max_error
        )
      end

      def destroy!
        return unless @c_pointer

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

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

      # @param data [FFI::Pointer] Pointer to the data that is passed to
      #   #function.
      # @param own_flag [Boolean]
      def owns_subtransformer(data, own_flag)
        FFI::GDAL::Alg.GDALApproxTransformerOwnsSubtransformer(data, own_flag)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta15 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta14 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta13 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta12 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta11 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta10 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta9 lib/gdal/transformers/approximate_transformer.rb
ffi-gdal-1.0.0.beta8 lib/gdal/transformers/approximate_transformer.rb