Class: VORuby::VOTables::VOTable::Meta::CooSys
- Defined in:
- lib/voruby/votables/meta.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb
Overview
A class representing the standard VOTable COOSYS element.
Instance Attribute Summary collapse
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#equinox ⇒ Object
readonly
Returns the value of attribute equinox.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#system ⇒ Object
readonly
Returns the value of attribute system.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id = nil, equinox = nil, epoch = nil, system = Type::CoordSystemType.new('eq_FK5')) ⇒ CooSys
constructor
The system of the coordinate system (Type: Type::CoordSystemType).
- #to_s ⇒ Object
Constructor Details
#initialize(id = nil, equinox = nil, epoch = nil, system = Type::CoordSystemType.new('eq_FK5')) ⇒ CooSys
The system of the coordinate system (Type: Type::CoordSystemType).
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/voruby/votables/meta.rb', line 67 def initialize(id=nil, equinox=nil, epoch=nil, system=Type::CoordSystemType.new('eq_FK5')) raise "Coordinate system must define an ID" if !id @id = id Misc::TypeCheck.new(equinox, Type::AstroYear).check() if equinox @equinox = equinox Misc::TypeCheck.new(epoch, Type::AstroYear).check() if epoch @epoch = epoch Misc::TypeCheck.new(system, Type::CoordSystemType).check() if system @system = system end |
Instance Attribute Details
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
57 58 59 |
# File 'lib/voruby/votables/meta.rb', line 57 def epoch @epoch end |
#equinox ⇒ Object (readonly)
Returns the value of attribute equinox.
57 58 59 |
# File 'lib/voruby/votables/meta.rb', line 57 def equinox @equinox end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
57 58 59 |
# File 'lib/voruby/votables/meta.rb', line 57 def id @id end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
57 58 59 |
# File 'lib/voruby/votables/meta.rb', line 57 def system @system end |
Class Method Details
.from_soap_obj(mcoosystems) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/voruby/votables/transforms.rb', line 37 def self.from_soap_obj(mcoosystems) mcoosystems = [mcoosystems] if !mcoosystems.respond_to(:each) coosys = [] mcoosystems.each do |mcoosys| equinox_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'equinox') epoch_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'epoch') system_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'system') || 'eq_FK5' coosys.push(CooSys.new( VOTable::_find_attr_value(mcoosys.__xmlattr, 'ID'), (equinox_txt == nil)? nil: Type::AstroYear.new(equinox_txt), (epoch_txt == nil)? nil: Type::AstroYear.new(epoch_txt), Type::CoordSystemType.new(system_txt) )) end coosys end |
.from_xml(node) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/voruby/votables/rexml_parser.rb', line 31 def self.from_xml(node) id = node.attributes['ID'] equinox = Type::AstroYear.new(node.attributes['equinox']) if node.attributes['equinox'] epoch = Type::AstroYear.new(node.attributes['epoch']) if node.attributes['epoch'] system = Type::CoordSystemType.new(node.attributes['system']) if node.attributes['system'] return self.new(id, equinox, epoch, system) end |
Instance Method Details
#to_s ⇒ Object
82 83 84 |
# File 'lib/voruby/votables/meta.rb', line 82 def to_s "{id=#{@id};equinox=#{@equinox};epoch=#{@epoch};system=#{@system}}" end |