Class: Proj::Ellipsoid

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, major, ell, name) ⇒ Ellipsoid

Returns a new instance of Ellipsoid.



19
20
21
22
23
24
# File 'lib/ellipsoid.rb', line 19

def initialize(id, major, ell, name)
  @id = id
  @major = major
  @ell = ell
  @name = name
end

Instance Attribute Details

#ellObject (readonly)

Returns the value of attribute ell.



3
4
5
# File 'lib/ellipsoid.rb', line 3

def ell
  @ell
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ellipsoid.rb', line 3

def id
  @id
end

#majorObject (readonly)

Returns the value of attribute major.



3
4
5
# File 'lib/ellipsoid.rb', line 3

def major
  @major
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/ellipsoid.rb', line 3

def name
  @name
end

Class Method Details

.get(id) ⇒ Object



15
16
17
# File 'lib/ellipsoid.rb', line 15

def self.get(id)
  self.list.find {|ellipsoid| ellipsoid.id == id}
end

.listObject



5
6
7
8
9
10
11
12
13
# File 'lib/ellipsoid.rb', line 5

def self.list
  pointer_to_array = FFI::Pointer.new(Api::PJ_ELLPS, Api.proj_list_ellps)
  result = Array.new
  0.step do |i|
    ellipse_info = Api::PJ_ELLPS.new(pointer_to_array[i])
    break result if ellipse_info[:id].nil?
    result << self.new(ellipse_info[:id], ellipse_info[:major], ellipse_info[:ell], ellipse_info[:name])
  end
end

Instance Method Details

#<=>(other) ⇒ Object



26
27
28
# File 'lib/ellipsoid.rb', line 26

def <=>(other)
  self.id <=> other.id
end

#==(other) ⇒ Object



30
31
32
# File 'lib/ellipsoid.rb', line 30

def ==(other)
  self.id == other.id
end

#inspectObject



38
39
40
# File 'lib/ellipsoid.rb', line 38

def inspect
  "#<#{self.class} id=\"#{id}\", major=\"#{major}\", ell=\"#{ell}\", name=\"#{name}\">"
end

#to_sObject



34
35
36
# File 'lib/ellipsoid.rb', line 34

def to_s
  self.id
end