Class: VORuby::STC::V1_10::STC::AstroCoordAreaType

Inherits:
CoordAreaType
  • Object
show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Direct Known Subclasses

AstroCoordArea

Instance Attribute Summary

Attributes inherited from CoordAreaType

#coord_intervals, #coord_system_id, #id, #redshift_intervals, #spatial_interval, #spectral_intervals, #time_intervals, #vel_intervals

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordAreaType

#==, #initialize, #to_xml

Methods included from SerializableToXml

#element

Constructor Details

This class inherits a constructor from VORuby::STC::V1_10::STC::CoordAreaType

Class Method Details

.from_xml(xml) ⇒ Object



2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
# File 'lib/voruby/stc/1.10/stc.rb', line 2680

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :id => Id.new(root.attributes.get_attribute_ns(obj_ns.uri, 'ID').value),
    :coord_system_id => IdRef.new(root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id').value)
  }
  
  time_intervals = REXML::XPath.match(root, 'x:TimeInterval', {'x' => obj_ns.uri})
  options[:time_intervals] = TimeIntervalList.new(time_intervals.collect{ |i| TimeIntervalType.from_xml(i) }) if time_intervals
  
  options[:spatial_interval] = xml_to_obj(root, SpatialInterval, true)
  
  options[:vel_intervals] = xml_to_obj(root, VelInterval)
  options[:vel_intervals] = nil if options[:vel_intervals].size == 0
  
  spectral_intervals = REXML::XPath.match(root, 'x:SpectralInterval', {'x' => obj_ns.uri})
  options[:spectral_intervals] = SpectralIntervalList.new(spectral_intervals.collect{ |i| SpectralInterval.from_xml(i) }) if spectral_intervals
  options[:spectral_intervals] = nil if options[:spectral_intervals].size == 0
  
  redshift_intervals = REXML::XPath.match(root, 'x:RedshiftInterval', {'x' => obj_ns.uri})
  options[:redshift_intervals] = RedshiftIntervalList.new(redshift_intervals.collect{ |i| RedshiftInterval.from_xml(i) }) if redshift_intervals
  options[:redshift_intervals] = nil if options[:redshift_intervals].size == 0
  
  options[:coord_intervals] = xml_to_obj(root, CoordScalarInterval)
  options[:coord_intervals] = nil if options[:coord_intervals].size == 0
  
  self.new(options)
end

Instance Method Details

#coord_intervals=(is) ⇒ Object



2672
2673
2674
2675
2676
2677
2678
# File 'lib/voruby/stc/1.10/stc.rb', line 2672

def coord_intervals=(is)
  if is
    is = CoordScalarIntervalList.new(is) if is.class == Array
    raise_type_mismatch_error(is, CoordScalarIntervalList)
  end
  @coord_intervals = is
end