Class: VORuby::STC::V1_30::AstroCoordAreaType

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

Overview

Astronomical area type.

Direct Known Subclasses

AstroCoordArea

Instance Attribute Summary collapse

Attributes inherited from CoordAreaType

#coord_intervals, #coord_system_id

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordAreaType

coord_area_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, coord_intervals, time_intervals, position_interval, velocity_intervals, spectral_intervals, redshift_intervals, options = {}) ⇒ AstroCoordAreaType

Returns a new instance of AstroCoordAreaType.



5037
5038
5039
5040
5041
5042
5043
5044
# File 'lib/voruby/stc/1.30/stc.rb', line 5037

def initialize(coord_system_id, coord_intervals, time_intervals, position_interval, velocity_intervals, spectral_intervals, redshift_intervals, options={})
  super(coord_system_id, coord_intervals, options)
  self.time_intervals = time_intervals
  self.position_interval = position_interval
  self.velocity_intervals = velocity_intervals
  self.spectral_intervals = spectral_intervals
  self.redshift_intervals = redshift_intervals
end

Instance Attribute Details

#position_intervalObject

Returns the value of attribute position_interval.



5034
5035
5036
# File 'lib/voruby/stc/1.30/stc.rb', line 5034

def position_interval
  @position_interval
end

#redshift_intervalsObject

Returns the value of attribute redshift_intervals.



5034
5035
5036
# File 'lib/voruby/stc/1.30/stc.rb', line 5034

def redshift_intervals
  @redshift_intervals
end

#spectral_intervalsObject

Returns the value of attribute spectral_intervals.



5034
5035
5036
# File 'lib/voruby/stc/1.30/stc.rb', line 5034

def spectral_intervals
  @spectral_intervals
end

#time_intervalsObject

Returns the value of attribute time_intervals.



5034
5035
5036
# File 'lib/voruby/stc/1.30/stc.rb', line 5034

def time_intervals
  @time_intervals
end

#velocity_intervalsObject

Returns the value of attribute velocity_intervals.



5034
5035
5036
# File 'lib/voruby/stc/1.30/stc.rb', line 5034

def velocity_intervals
  @velocity_intervals
end

Class Method Details

.from_xml(xml) ⇒ Object



5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
# File 'lib/voruby/stc/1.30/stc.rb', line 5105

def self.from_xml(xml)
  root = element_from(xml)
  
  csi, cis, options = CoordAreaType.coord_area_from_xml(root)
  
  tis = REXML::XPath.match(root, 'x:TimeInterval', {'x' => obj_ns.uri}).collect{ |e| TimeIntervalType.from_xml(e) }
  tis = nil if tis.size == 0
  
  vis = xml_to_obj(root, VelocityInterval)
  vis = nil if vis.size == 0
  
  sis = REXML::XPath.match(root, 'x:SpectralInterval', {'x' => obj_ns.uri}).collect{ |e| SpectralIntervalType.from_xml(e) }
  sis = nil if sis.size == 0
  
  ris = REXML::XPath.match(root, 'x:RedshiftInterval', {'x' => obj_ns.uri}).collect{ |e| RedshiftIntervalType.from_xml(e) }
  ris = nil if ris.size == 0
  
  self.new(
    csi,
    cis,
    tis, xml_to_obj(root, PositionInterval, true), vis, sis, ris,
    options
  )
end

Instance Method Details

#==(a) ⇒ Object



5083
5084
5085
5086
5087
5088
5089
5090
# File 'lib/voruby/stc/1.30/stc.rb', line 5083

def ==(a)
  super(a) and
  self.time_intervals == a.time_intervals and
  self.position_interval == a.position_interval and
  self.velocity_intervals == a.velocity_intervals and
  self.spectral_intervals == a.spectral_intervals and
  self.redshift_intervals == a.redshift_intervals
end

#to_xml(name = nil) ⇒ Object



5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
# File 'lib/voruby/stc/1.30/stc.rb', line 5092

def to_xml(name=nil)
  el = super(name)
  
  self.time_intervals.each{ |i| el.add_element(i.to_xml('TimeInterval')) } if self.time_intervals
  el.add_element(self.position_interval.to_xml) if self.position_interval
  self.velocity_intervals.each{ |i| el.add_element(i.to_xml) } if self.velocity_intervals
  self.spectral_intervals.each{ |i| el.add_element(i.to_xml('SpectralInterval')) } if self.spectral_intervals
  self.redshift_intervals.each{ |i| el.add_element(i.to_xml('RedshiftInterval')) } if self.redshift_intervals
  
  collapse_namespaces(el)
  el
end