Class: VORuby::STC::V1_10::Coords::Position3D
- Inherits:
-
Vector3Coordinate
- Object
- CoordinateType
- Vector3Coordinate
- VORuby::STC::V1_10::Coords::Position3D
- Includes:
- Position
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Instance Attribute Summary collapse
-
#unit ⇒ Object
Returns the value of attribute unit.
Attributes inherited from Vector3Coordinate
#error, #pix_size, #resolution, #size, #value
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
- #==(p) ⇒ Object
-
#initialize(options = {}) ⇒ Position3D
constructor
A new instance of Position3D.
- #to_xml ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ Position3D
Returns a new instance of Position3D.
1492 1493 1494 1495 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1492 def initialize(={}) raise_argument_required_error('unit') if !.has_key?(:unit) super() end |
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
1490 1491 1492 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1490 def unit @unit end |
Class Method Details
.from_xml(xml) ⇒ Object
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1522 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) if unit [: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) Position3D.new() end |
Instance Method Details
#==(p) ⇒ Object
1539 1540 1541 1542 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1539 def ==(p) super(p) and self.unit == p.unit end |
#to_xml ⇒ Object
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1503 def to_xml el = element() el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit 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 |