Class: VORuby::STC::V1_30::Double2Type
- Inherits:
-
STCBaseType
- Object
- STCBaseType
- VORuby::STC::V1_30::Double2Type
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
A vector of 2 doubles; components are now separated.
Instance Attribute Summary collapse
-
#c1 ⇒ Object
Returns the value of attribute c1.
-
#c2 ⇒ Object
Returns the value of attribute c2.
-
#gen_unit ⇒ Object
Returns the value of attribute gen_unit.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#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(c1, c2, options = {}) ⇒ Double2Type
constructor
A new instance of Double2Type.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods inherited from STCBaseType
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
#initialize(c1, c2, options = {}) ⇒ Double2Type
Returns a new instance of Double2Type.
671 672 673 674 675 |
# File 'lib/voruby/stc/1.30/stc.rb', line 671 def initialize(c1, c2, ={}) self.c1 = c1 self.c2 = c2 super() end |
Instance Attribute Details
#c1 ⇒ Object
Returns the value of attribute c1.
669 670 671 |
# File 'lib/voruby/stc/1.30/stc.rb', line 669 def c1 @c1 end |
#c2 ⇒ Object
Returns the value of attribute c2.
669 670 671 |
# File 'lib/voruby/stc/1.30/stc.rb', line 669 def c2 @c2 end |
#gen_unit ⇒ Object
Returns the value of attribute gen_unit.
669 670 671 |
# File 'lib/voruby/stc/1.30/stc.rb', line 669 def gen_unit @gen_unit end |
#unit ⇒ Object
Returns the value of attribute unit.
669 670 671 |
# File 'lib/voruby/stc/1.30/stc.rb', line 669 def unit @unit end |
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
669 670 671 |
# File 'lib/voruby/stc/1.30/stc.rb', line 669 def vel_time_unit @vel_time_unit end |
Class Method Details
.double2_from_xml(root) ⇒ Object
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 |
# File 'lib/voruby/stc/1.30/stc.rb', line 744 def self.double2_from_xml(root) c1_el = REXML::XPath.first(root, 'x:C1', {'x' => obj_ns.uri}) c2_el = REXML::XPath.first(root, 'x:C2', {'x' => obj_ns.uri}) = STCBaseType.stc_base_from_xml(root) unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') [:unit] = PosUnitType.new(unit.value) if 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 gen_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'gen_unit') [:gen_unit] = UnitType.new(gen_unit.value) if gen_unit [c1_el ? Double1Type.from_xml(c1_el) : nil, c2_el ? Double1Type.from_xml(c2_el) : nil, ] end |
.from_xml(xml) ⇒ Object
762 763 764 765 |
# File 'lib/voruby/stc/1.30/stc.rb', line 762 def self.from_xml(xml) root = element_from(xml) self.new(*double2_from_xml(root)) end |
Instance Method Details
#==(d) ⇒ Object
717 718 719 720 721 722 723 724 |
# File 'lib/voruby/stc/1.30/stc.rb', line 717 def ==(d) super(d) and self.c1 == d.c1 and self.c2 == d.c2 and self.unit == d.unit and self.vel_time_unit == d.vel_time_unit and self.gen_unit == d.gen_unit end |
#to_s ⇒ Object
740 741 742 |
# File 'lib/voruby/stc/1.30/stc.rb', line 740 def to_s "#{self.c1} #{self.c2}" end |
#to_xml(name = nil) ⇒ Object
726 727 728 729 730 731 732 733 734 735 736 737 738 |
# File 'lib/voruby/stc/1.30/stc.rb', line 726 def to_xml(name=nil) el = super(name) el.add_element(self.c1.to_xml('C1')) if self.c1 el.add_element(self.c2.to_xml('C2')) if self.c2 el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.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}:gen_unit"] = self.gen_unit.to_s if self.gen_unit collapse_namespaces(el) el end |