Class: Proj::Ellipsoid
- Inherits:
-
Object
- Object
- Proj::Ellipsoid
- Defined in:
- lib/ellipsoid.rb
Instance Attribute Summary collapse
-
#ell ⇒ Object
readonly
Returns the value of attribute ell.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(id, major, ell, name) ⇒ Ellipsoid
constructor
A new instance of Ellipsoid.
- #inspect ⇒ Object
- #to_s ⇒ Object
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
#ell ⇒ Object (readonly)
Returns the value of attribute ell.
3 4 5 |
# File 'lib/ellipsoid.rb', line 3 def ell @ell end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/ellipsoid.rb', line 3 def id @id end |
#major ⇒ Object (readonly)
Returns the value of attribute major.
3 4 5 |
# File 'lib/ellipsoid.rb', line 3 def major @major end |
#name ⇒ Object (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 |
.list ⇒ Object
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 |
#inspect ⇒ Object
38 39 40 |
# File 'lib/ellipsoid.rb', line 38 def inspect "#<#{self.class} id=\"#{id}\", major=\"#{major}\", ell=\"#{ell}\", name=\"#{name}\">" end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/ellipsoid.rb', line 34 def to_s self.id end |