Class: VORuby::STC::V1_10::Coords::Velocity1D
- Inherits:
-
ScalarCoordinateType
- Object
- CoordinateType
- ScalarCoordinateType
- VORuby::STC::V1_10::Coords::Velocity1D
- Includes:
- Velocity
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
1-D Velocity coordinate
Instance Attribute Summary
Attributes included from Velocity
Attributes inherited from ScalarCoordinateType
#error, #pix_size, #resolution, #size, #value
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Velocity1D
constructor
A new instance of Velocity1D.
- #to_xml ⇒ Object
Methods included from Velocity
Methods included from SerializableToXml
Methods inherited from ScalarCoordinateType
Methods inherited from CoordinateType
Constructor Details
#initialize(options = {}) ⇒ Velocity1D
Returns a new instance of Velocity1D.
1572 1573 1574 1575 1576 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1572 def initialize(={}) raise_argument_required_error('unit') if !.has_key?(:unit) raise_argument_required_error('velocity time unit') if !.has_key?(:vel_time_unit) super() end |
Class Method Details
.from_xml(xml) ⇒ Object
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1598 def self.from_xml(xml) root = element_from(xml) = { :name => REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri}).text } unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') [:unit] = PosUnit.new(unit.value) vel_time_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'vel_time_unit') [:vel_time_unit] = VelTimeUnit.new(vel_time_unit.value) [:value] = xml_to_obj(root, CValue, true) [:error] = xml_to_obj(root, CError) [:resolution] = xml_to_obj(root, CResolution) [:size] = xml_to_obj(root, CSize) [:pix_size] = xml_to_obj(root, CPixSize) Velocity1D.new() end |
Instance Method Details
#to_xml ⇒ Object
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1578 def to_xml el = element() el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s el.attributes["#{obj_ns.prefix}:vel_time_unit"] = self.vel_time_unit.to_s name = REXML::Element.new("#{obj_ns.prefix}:Name") name.text = self.name el.add_element(name) el.add_element(self.value.to_xml) if self.value self.error.each { |e| el.add_element(e.to_xml) } if self.error self.resolution.each { |r| el.add_element(r.to_xml) } if self.resolution self.size.each { |s| el.add_element(s.to_xml) } if self.size self.pix_size.each { |p| el.add_element(p.to_xml) } if self.pix_size collapse_namespaces(el) el end |