Class: VORuby::STC::V1_10::Coords::Velocity3D
- Inherits:
-
Vector3Coordinate
- Object
- CoordinateType
- Vector3Coordinate
- VORuby::STC::V1_10::Coords::Velocity3D
- Includes:
- Velocity
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
3-D Velocity coordinate
Instance Attribute Summary
Attributes included from Velocity
Attributes inherited from Vector3Coordinate
#error, #pix_size, #resolution, #size, #value
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Velocity3D
constructor
A new instance of Velocity3D.
- #to_xml ⇒ Object
Methods included from Velocity
Methods included from SerializableToXml
Methods inherited from Vector3Coordinate
Methods inherited from CoordinateType
Constructor Details
#initialize(options = {}) ⇒ Velocity3D
Returns a new instance of Velocity3D.
1672 1673 1674 1675 1676 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1672 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
1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1698 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, CValue3, true) [:error] = xml_to_obj(root, CError3) [:resolution] = xml_to_obj(root, CResolution3) [:size] = xml_to_obj(root, CSize3) [:pix_size] = xml_to_obj(root, CPixSize3) Velocity3D.new() end |
Instance Method Details
#to_xml ⇒ Object
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1678 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 |