Class: VORuby::STC::V1_30::AstroCoordsType

Inherits:
CoordsType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

The astronomical (STC) coordsType.

Direct Known Subclasses

AstroCoords

Instance Attribute Summary collapse

Attributes inherited from CoordsType

#coord_system_id, #coordinates

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordsType

coords_from_xml

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(coord_system_id, coordinates, options = {}) ⇒ AstroCoordsType

Returns a new instance of AstroCoordsType.



3544
3545
3546
# File 'lib/voruby/stc/1.30/stc.rb', line 3544

def initialize(coord_system_id, coordinates, options={})
  super(coord_system_id, coordinates, options)
end

Instance Attribute Details

#coord_fileObject

Returns the value of attribute coord_file.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def coord_file
  @coord_file
end

#orbitObject

Returns the value of attribute orbit.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def orbit
  @orbit
end

#positionObject

Returns the value of attribute position.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def position
  @position
end

#redshiftObject

Returns the value of attribute redshift.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def redshift
  @redshift
end

#spectralObject

Returns the value of attribute spectral.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def spectral
  @spectral
end

#timeObject

Returns the value of attribute time.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def time
  @time
end

#velocityObject

Returns the value of attribute velocity.



3541
3542
3543
# File 'lib/voruby/stc/1.30/stc.rb', line 3541

def velocity
  @velocity
end

Class Method Details

.from_xml(xml) ⇒ Object



3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
# File 'lib/voruby/stc/1.30/stc.rb', line 3611

def self.from_xml(xml)
  root = element_from(xml)
  
  csi, coordinates, options = CoordsType.coords_from_xml(root)
  
  options[:time] = xml_to_obj(root, Time, true)
  options[:position] = xml_to_obj(root, Position, true)
  options[:velocity] = xml_to_obj(root, Velocity, true)
  options[:spectral] = xml_to_obj(root, Spectral, true)
  options[:redshift] = xml_to_obj(root, Redshift, true)
  
  cfile = REXML::XPath.first(root, 'x:CoordFile', {'x' => obj_ns.uri})
  options[:coord_file] = AstroCoordsFileType.from_xml(cfile) if cfile
  
  orbit = REXML::XPath.first(root, 'x:Orbit', {'x' => obj_ns.uri})
  options[:orbit] = OrbitType.from_xml(orbit) if orbit
  
  self.new(csi, coordinates, options)
end

Instance Method Details

#==(c) ⇒ Object



3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
# File 'lib/voruby/stc/1.30/stc.rb', line 3585

def ==(c)
  super(c) and
  self.time == c.time and
  self.position == c.position and
  self.velocity == c.velocity and
  self.spectral == c.spectral and
  self.redshift == c.redshift and
  self.coord_file == c.coord_file and
  self.orbit == c.orbit
end

#to_xml(name = nil) ⇒ Object



3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
# File 'lib/voruby/stc/1.30/stc.rb', line 3596

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.time.to_xml) if self.time
  el.add_element(self.position.to_xml) if self.position
  el.add_element(self.velocity.to_xml) if self.velocity
  el.add_element(self.spectral.to_xml) if self.spectral
  el.add_element(self.redshift.to_xml) if self.redshift
  el.add_element(self.coord_file.to_xml('CoordFile')) if self.coord_file
  el.add_element(self.orbit.to_xml('Orbit')) if self.orbit
  
  collapse_namespaces(el)
  el
end