Class: VORuby::STC::V1_30::AstroCoordSystemType

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

Overview

The astronomical coordinate system definition: spatial coordinate frame and reference position; time frame and reference position; the coordinate flavor; spectral frame and (optionally) Doppler frame; and the planetary ephemeris; an ID is required, since this is how coordinate elements are associated with their coordinate systems.

Direct Known Subclasses

AstroCoordSystem

Instance Attribute Summary collapse

Attributes inherited from CoordSysType

#coord_frames

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordSysType

coord_sys_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_frames, time_frame = nil, space_frame = nil, spectral_frame = nil, redshift_frame = nil, options = {}) ⇒ AstroCoordSystemType

Returns a new instance of AstroCoordSystemType.



7993
7994
7995
7996
7997
7998
7999
# File 'lib/voruby/stc/1.30/stc.rb', line 7993

def initialize(coord_frames, time_frame=nil, space_frame=nil, spectral_frame=nil, redshift_frame=nil, options={})
  super(coord_frames, options)
  self.time_frame = time_frame
  self.space_frame = space_frame
  self.spectral_frame = spectral_frame
  self.redshift_frame = redshift_frame
end

Instance Attribute Details

#redshift_frameObject

Returns the value of attribute redshift_frame.



7991
7992
7993
# File 'lib/voruby/stc/1.30/stc.rb', line 7991

def redshift_frame
  @redshift_frame
end

#space_frameObject

Returns the value of attribute space_frame.



7991
7992
7993
# File 'lib/voruby/stc/1.30/stc.rb', line 7991

def space_frame
  @space_frame
end

#spectral_frameObject

Returns the value of attribute spectral_frame.



7991
7992
7993
# File 'lib/voruby/stc/1.30/stc.rb', line 7991

def spectral_frame
  @spectral_frame
end

#time_frameObject

Returns the value of attribute time_frame.



7991
7992
7993
# File 'lib/voruby/stc/1.30/stc.rb', line 7991

def time_frame
  @time_frame
end

Class Method Details

.from_xml(xml) ⇒ Object



8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
# File 'lib/voruby/stc/1.30/stc.rb', line 8041

def self.from_xml(xml)
  root = element_from(xml)
  
  coord_frames, options = CoordSysType.coord_sys_from_xml(root)
   
  self.new(
    coord_frames ? (coord_frames.size == 0 ? nil : CoordFrameList.new(coord_frames)) : nil,
    xml_to_obj(root, TimeFrame, true),
    xml_to_obj(root, SpaceFrame, true),
    xml_to_obj(root, SpectralFrame, true),
    xml_to_obj(root, RedshiftFrame, true),
    options || {}
  )
end

Instance Method Details

#==(s) ⇒ Object



8021
8022
8023
8024
8025
8026
8027
# File 'lib/voruby/stc/1.30/stc.rb', line 8021

def ==(s)
  super(s) and
  self.time_frame == s.time_frame and
  self.space_frame == s.space_frame and
  self.spectral_frame == s.spectral_frame and
  self.redshift_frame == s.redshift_frame
end

#to_xml(name = nil) ⇒ Object



8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
# File 'lib/voruby/stc/1.30/stc.rb', line 8029

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.time_frame.to_xml) if self.time_frame
  el.add_element(self.space_frame.to_xml) if self.space_frame
  el.add_element(self.spectral_frame.to_xml) if self.spectral_frame
  el.add_element(self.redshift_frame.to_xml) if self.redshift_frame
  
  collapse_namespaces(el)
  el
end