Class: VORuby::STC::V1_10::STC::PixelCoordAreaType

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

Direct Known Subclasses

PixelCoordArea

Defined Under Namespace

Classes: CoordScalarIntervalList

Instance Attribute Summary collapse

Attributes inherited from CoordAreaType

#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

#==, #to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ PixelCoordAreaType

Returns a new instance of PixelCoordAreaType.



2718
2719
2720
2721
# File 'lib/voruby/stc/1.10/stc.rb', line 2718

def initialize(options={})
  raise_argument_required_error('list of coordinate scalar intervals') if !options.has_key?(:coord_intervals)
  super(options)
end

Instance Attribute Details

#coord_intervalsObject

Returns the value of attribute coord_intervals.



2712
2713
2714
# File 'lib/voruby/stc/1.10/stc.rb', line 2712

def coord_intervals
  @coord_intervals
end

Class Method Details

.from_xml(xml) ⇒ Object



2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
# File 'lib/voruby/stc/1.10/stc.rb', line 2732

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[:time_intervals] = nil if time_intervals and options[:time_intervals].size == 0
  
  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 spectral_intervals and 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 redshift_intervals and 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