Class: VORuby::STC::V1_30::Double1Type
- Inherits:
-
Object
- Object
- VORuby::STC::V1_30::Double1Type
- Includes:
- STCReference
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
A double with referencing and units attributes
Direct Known Subclasses
Error, Error2Radius, Error3Radius, PixSize, Resolution, Resolution2Radius, Resolution3Radius, Size, Size2Radius, Size3Radius, Value
Instance Attribute Summary collapse
-
#gen_unit ⇒ Object
Returns the value of attribute gen_unit.
-
#pos_angle_unit ⇒ Object
Returns the value of attribute pos_angle_unit.
-
#pos_unit ⇒ Object
Returns the value of attribute pos_unit.
-
#spectral_unit ⇒ Object
Returns the value of attribute spectral_unit.
-
#time_unit ⇒ Object
Returns the value of attribute time_unit.
-
#value ⇒ Object
Returns the value of attribute value.
-
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
- #==(d) ⇒ Object
-
#initialize(value, options = {}) ⇒ Double1Type
constructor
A new instance of Double1Type.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
#initialize(value, options = {}) ⇒ Double1Type
Returns a new instance of Double1Type.
552 553 554 555 |
# File 'lib/voruby/stc/1.30/stc.rb', line 552 def initialize(value, ={}) self.value = value .each { |key, v| send("#{key}=", v) } end |
Instance Attribute Details
#gen_unit ⇒ Object
Returns the value of attribute gen_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def gen_unit @gen_unit end |
#pos_angle_unit ⇒ Object
Returns the value of attribute pos_angle_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def pos_angle_unit @pos_angle_unit end |
#pos_unit ⇒ Object
Returns the value of attribute pos_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def pos_unit @pos_unit end |
#spectral_unit ⇒ Object
Returns the value of attribute spectral_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def spectral_unit @spectral_unit end |
#time_unit ⇒ Object
Returns the value of attribute time_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def time_unit @time_unit end |
#value ⇒ Object
Returns the value of attribute value.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def value @value end |
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
549 550 551 |
# File 'lib/voruby/stc/1.30/stc.rb', line 549 def vel_time_unit @vel_time_unit end |
Class Method Details
.from_xml(xml) ⇒ Object
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/voruby/stc/1.30/stc.rb', line 640 def self.from_xml(xml) root = element_from(xml) = STCReference.stc_reference_from_xml(root) time_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'time_unit') [:time_unit] = TimeUnitType.new(time_unit.value) if time_unit pos_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'pos_unit') [:pos_unit] = PosUnitType.new(pos_unit.value) if pos_unit pos_angle_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'pos_angle_unit') [:pos_angle_unit] = AngleUnitType.new(pos_angle_unit.value) if pos_angle_unit vel_time_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'vel_time_unit') [:vel_time_unit] = VelTimeUnitType.new(vel_time_unit.value) if vel_time_unit spectral_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'spectral_unit') [:spectral_unit] = SpectralUnitType.new(spectral_unit.value) if spectral_unit gen_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'gen_unit') [:gen_unit] = UnitType.new(gen_unit.value) if gen_unit self.new(root.text ? Float(root.text) : nil, ) end |
Instance Method Details
#==(d) ⇒ Object
610 611 612 613 614 615 616 617 618 619 |
# File 'lib/voruby/stc/1.30/stc.rb', line 610 def ==(d) self.stc_reference_eq(d) and self.value == d.value and self.time_unit == d.time_unit and self.pos_unit == d.pos_unit and self.pos_angle_unit == d.pos_angle_unit and self.vel_time_unit == d.vel_time_unit and self.spectral_unit == d.spectral_unit and self.gen_unit == d.gen_unit end |
#to_s ⇒ Object
636 637 638 |
# File 'lib/voruby/stc/1.30/stc.rb', line 636 def to_s self.value.to_s end |
#to_xml(name = nil) ⇒ Object
621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/voruby/stc/1.30/stc.rb', line 621 def to_xml(name=nil) el = stc_reference_to_xml(element(name)) el.text = self.value.to_s if self.value el.attributes["#{obj_ns.prefix}:time_unit"] = self.time_unit.to_s if self.time_unit el.attributes["#{obj_ns.prefix}:pos_unit"] = self.pos_unit.to_s if self.pos_unit el.attributes["#{obj_ns.prefix}:pos_angle_unit"] = self.pos_angle_unit.to_s if self.pos_angle_unit el.attributes["#{obj_ns.prefix}:vel_time_unit"] = self.vel_time_unit.to_s if self.vel_time_unit el.attributes["#{obj_ns.prefix}:spectral_unit"] = self.spectral_unit.to_s if self.spectral_unit el.attributes["#{obj_ns.prefix}:gen_unit"] = self.gen_unit.to_s if self.gen_unit collapse_namespaces(el) el end |