class Proj::PjObjects

Public Class Methods

finalize(pointer) click to toggle source

@!visibility private

# File lib/proj/pj_objects.rb, line 5
def self.finalize(pointer)
  proc do
    Api.proj_list_destroy(pointer)
  end
end
new(pointer, context) click to toggle source
# File lib/proj/pj_objects.rb, line 11
def initialize(pointer, context)
  @pointer = pointer
  @context = context
  ObjectSpace.define_finalizer(self, self.class.finalize(@pointer))
end

Public Instance Methods

[](index) click to toggle source
# File lib/proj/pj_objects.rb, line 30
def [](index)
  ptr = Api.proj_list_get(context, self, index)
  PjObject.create_object(ptr, self.context)
end
context() click to toggle source
# File lib/proj/pj_objects.rb, line 21
def context
  @context || Context.current
end
count() click to toggle source
# File lib/proj/pj_objects.rb, line 25
def count
  Api.proj_list_get_count(self)
end
Also aliased as: size
size()
Alias for: count
suggested_operation(direction, coord) click to toggle source

Returns the index of the operation that would be the most appropriate to transform the specified coordinates.

@param direction [PJ_DIRECTION] - Direction into which to transform the point. @param coord [Coordinate] - Coordinate to transform

@return [Integer] - Index of operation

# File lib/proj/pj_objects.rb, line 41
def suggested_operation(direction, coord)
  Api.proj_get_suggested_operation(self.context, self, direction, coord)
end
to_ptr() click to toggle source
# File lib/proj/pj_objects.rb, line 17
def to_ptr
  @pointer
end