class GDAL::WarpOperation

Attributes

c_pointer[R]

@return [FFI::Pointer]

Public Class Methods

new(warp_options) click to toggle source

@param warp_options [GDAL::WarpOptions]

# File lib/gdal/warp_operation.rb, line 18
def initialize(warp_options)
  pointer = FFI::GDAL::Warper.GDALCreateWarpOperation(warp_options.c_struct)

  raise GDAL::Error, "Unable to create warp operation" if pointer.null?

  @c_pointer = FFI::AutoPointer.new(pointer, WarpOperation.method(:release))
end
release(pointer) click to toggle source

@param pointer [FFI::Pointer]

# File lib/gdal/warp_operation.rb, line 8
def self.release(pointer)
  return unless pointer && !pointer.null?

  FFI::GDAL::Warper.GDALDestroyWarpOperation(pointer)
end

Public Instance Methods

chunk_and_warp_image(x_offset, y_offset, x_size, y_size) click to toggle source

@param x_offset [Integer] X offset of the destination image. @param y_offset [Integer] Y offset of the destination image. @param x_size [Integer] X size (width) of the destination image. @param y_size [Integer] Y size (height) of the destination image.

# File lib/gdal/warp_operation.rb, line 36
def chunk_and_warp_image(x_offset, y_offset, x_size, y_size)
  !!FFI::GDAL::Warper.GDALChunkAndWarpImage(@c_pointer,
                                            x_offset,
                                            y_offset,
                                            x_size,
                                            y_size)
end
chunk_and_warp_multi(x_offset, y_offset, x_size, y_size) click to toggle source

@param x_offset [Integer] X offset of the destination image. @param y_offset [Integer] Y offset of the destination image. @param x_size [Integer] X size (width) of the destination image. @param y_size [Integer] Y size (height) of the destination image.

# File lib/gdal/warp_operation.rb, line 48
def chunk_and_warp_multi(x_offset, y_offset, x_size, y_size)
  FFI::GDAL::Warper.GDALChunkAndWarpMulti(@c_pointer,
                                          x_offset,
                                          y_offset,
                                          x_size,
                                          y_size)
end
destroy!() click to toggle source
# File lib/gdal/warp_operation.rb, line 26
def destroy!
  WarpOperation.release(@c_pointer)

  @c_pointer = nil
end
warp_region(destination_x_offset, destination_y_offset, destination_x_size, destination_y_size, source_x_offset, source_y_offset, source_x_size, source_y_size) click to toggle source

@param destination_x_offset [Integer] X offset of the destination image. @param destination_y_offset [Integer] Y offset of the destination image. @param destination_x_size [Integer] X size (width) of the destination image. @param destination_y_size [Integer] Y size (height) of the destination image. @param source_x_offset [Integer] X offset of the source image. @param source_y_offset [Integer] Y offset of the source image. @param source_x_size [Integer] X size (width) of the source image. @param source_y_size [Integer] Y size (height) of the source image.

# File lib/gdal/warp_operation.rb, line 64
def warp_region(destination_x_offset, destination_y_offset,
  destination_x_size, destination_y_size,
  source_x_offset, source_y_offset,
  source_x_size, source_y_size)
  !!FFI::GDAL::Warper.GDALWarpRegion(@c_pointer,
                                     destination_x_offset,
                                     destination_y_offset,
                                     destination_x_size,
                                     destination_y_size,
                                     source_x_offset,
                                     source_y_offset,
                                     source_x_size,
                                     source_y_size)
end
warp_region_to_buffer(destination_x_offset, destination_y_offset, destination_x_size, destination_y_size, buffer, data_type, source_x_offset, source_y_offset, source_x_size, source_y_size) click to toggle source

@param destination_x_offset [Integer] X offset of the destination image. @param destination_y_offset [Integer] Y offset of the destination image. @param destination_x_size [Integer] X size (width) of the destination image. @param destination_y_size [Integer] Y size (height) of the destination image. @param buffer [FFI::Pointer] @param data_type [FFI::GDAL::DataType] @param source_x_offset [Integer] X offset of the source image. @param source_y_offset [Integer] Y offset of the source image. @param source_x_size [Integer] X size (width) of the source image. @param source_y_size [Integer] Y size (height) of the source image. rubocop:disable Metrics/ParameterLists

# File lib/gdal/warp_operation.rb, line 90
def warp_region_to_buffer(destination_x_offset, destination_y_offset,
  destination_x_size, destination_y_size,
  buffer, data_type,
  source_x_offset, source_y_offset,
  source_x_size, source_y_size)
  !!FFI::GDAL::Warper.GDALWarpRegionToBuffer(@c_pointer,
                                             destination_x_offset,
                                             destination_y_offset,
                                             destination_x_size,
                                             destination_y_size,
                                             buffer,
                                             data_type,
                                             source_x_offset,
                                             source_y_offset,
                                             source_x_size,
                                             source_y_size)
end