Class: VORuby::STC::V1_10::STC::AstroCoordAreaType
- Inherits:
-
CoordAreaType
- Object
- CoordAreaType
- VORuby::STC::V1_10::STC::AstroCoordAreaType
- Defined in:
- lib/voruby/stc/1.10/stc.rb
Direct Known Subclasses
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
Methods included from SerializableToXml
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) = { :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}) [:time_intervals] = TimeIntervalList.new(time_intervals.collect{ |i| TimeIntervalType.from_xml(i) }) if time_intervals [:spatial_interval] = xml_to_obj(root, SpatialInterval, true) [:vel_intervals] = xml_to_obj(root, VelInterval) [:vel_intervals] = nil if [:vel_intervals].size == 0 spectral_intervals = REXML::XPath.match(root, 'x:SpectralInterval', {'x' => obj_ns.uri}) [:spectral_intervals] = SpectralIntervalList.new(spectral_intervals.collect{ |i| SpectralInterval.from_xml(i) }) if spectral_intervals [:spectral_intervals] = nil if [:spectral_intervals].size == 0 redshift_intervals = REXML::XPath.match(root, 'x:RedshiftInterval', {'x' => obj_ns.uri}) [:redshift_intervals] = RedshiftIntervalList.new(redshift_intervals.collect{ |i| RedshiftInterval.from_xml(i) }) if redshift_intervals [:redshift_intervals] = nil if [:redshift_intervals].size == 0 [:coord_intervals] = xml_to_obj(root, CoordScalarInterval) [:coord_intervals] = nil if [:coord_intervals].size == 0 self.new() 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 |