Class: VORuby::STC::V1_10::STC::CoordAreaType
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::STC::CoordAreaType
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/stc.rb
Overview
Generalized coordinate area type
Direct Known Subclasses
Instance Attribute Summary collapse
-
#coord_intervals ⇒ Object
Returns the value of attribute coord_intervals.
-
#coord_system_id ⇒ Object
Returns the value of attribute coord_system_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#redshift_intervals ⇒ Object
Returns the value of attribute redshift_intervals.
-
#spatial_interval ⇒ Object
Returns the value of attribute spatial_interval.
-
#spectral_intervals ⇒ Object
Returns the value of attribute spectral_intervals.
-
#time_intervals ⇒ Object
Returns the value of attribute time_intervals.
-
#vel_intervals ⇒ Object
Returns the value of attribute vel_intervals.
Class Method Summary collapse
Instance Method Summary collapse
- #==(a) ⇒ Object
-
#initialize(options = {}) ⇒ CoordAreaType
constructor
A new instance of CoordAreaType.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ CoordAreaType
Returns a new instance of CoordAreaType.
2543 2544 2545 2546 2547 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2543 def initialize(={}) raise_argument_required_error('id') if !.has_key?(:id) raise_argument_required_error('coord system id') if !.has_key?(:coord_system_id) .each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#coord_intervals ⇒ Object
Returns the value of attribute coord_intervals.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def coord_intervals @coord_intervals end |
#coord_system_id ⇒ Object
Returns the value of attribute coord_system_id.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def coord_system_id @coord_system_id end |
#id ⇒ Object
Returns the value of attribute id.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def id @id end |
#redshift_intervals ⇒ Object
Returns the value of attribute redshift_intervals.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def redshift_intervals @redshift_intervals end |
#spatial_interval ⇒ Object
Returns the value of attribute spatial_interval.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def spatial_interval @spatial_interval end |
#spectral_intervals ⇒ Object
Returns the value of attribute spectral_intervals.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def spectral_intervals @spectral_intervals end |
#time_intervals ⇒ Object
Returns the value of attribute time_intervals.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def time_intervals @time_intervals end |
#vel_intervals ⇒ Object
Returns the value of attribute vel_intervals.
2539 2540 2541 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2539 def vel_intervals @vel_intervals end |
Class Method Details
.from_xml(xml) ⇒ Object
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2640 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 and [: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 and [:redshift_intervals].size == 0 [:coord_intervals] = xml_to_obj(root, CoordInterval) [:coord_intervals] = nil if [:coord_intervals].size == 0 self.new() end |
Instance Method Details
#==(a) ⇒ Object
2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2612 def ==(a) self.time_intervals == a.time_intervals and self.spatial_interval == a.spatial_interval and self.vel_intervals == a.vel_intervals and self.spectral_intervals == a.spectral_intervals and self.redshift_intervals == a.redshift_intervals and self.coord_intervals == a.coord_intervals and self.id == a.id and self.coord_system_id == a.coord_system_id end |
#to_xml(name = nil) ⇒ Object
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2623 def to_xml(name=nil) el = element(name) el.attributes["#{obj_ns.prefix}:ID"] = self.id.to_s el.attributes["#{obj_ns.prefix}:coord_system_id"] = self.coord_system_id.to_s self.time_intervals.each { |i| el.add_element(i.to_xml('TimeInterval')) } if self.time_intervals el.add_element(self.spatial_interval.to_xml) if self.spatial_interval self.vel_intervals.each { |i| el.add_element(i.to_xml) } if self.vel_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 self.coord_intervals.each { |i| el.add_element(i.to_xml) } if self.coord_intervals collapse_namespaces(el) el end |