Class: Proj::PjObjects

Inherits:
Object
  • Object
show all
Defined in:
lib/proj/pj_objects.rb

Instance Method Summary collapse

Constructor Details

#initialize(pointer, context) ⇒ PjObjects

Returns a new instance of PjObjects.



11
12
13
14
15
# 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

Instance Method Details

#[](index) ⇒ Object



30
31
32
33
# 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

#contextObject



21
22
23
# File 'lib/proj/pj_objects.rb', line 21

def context
  @context || Context.current
end

#countObject Also known as: size



25
26
27
# File 'lib/proj/pj_objects.rb', line 25

def count
  Api.proj_list_get_count(self)
end

#suggested_operation(direction, coord) ⇒ Integer

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

Parameters:

  • direction (PJ_DIRECTION)
    • Direction into which to transform the point.

  • coord (Coordinate)
    • Coordinate to transform

Returns:

  • (Integer)
    • Index of operation



41
42
43
# 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_ptrObject



17
18
19
# File 'lib/proj/pj_objects.rb', line 17

def to_ptr
  @pointer
end