Class: VORuby::STC::V1_10::Coords::ScalarCoordinate
- Inherits:
-
ScalarCoordinateType
- Object
- CoordinateType
- ScalarCoordinateType
- VORuby::STC::V1_10::Coords::ScalarCoordinate
- Includes:
- Coordinate
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
Generic scalar coordinate element
Instance Attribute Summary collapse
-
#unit ⇒ Object
Returns the value of attribute unit.
Attributes inherited from ScalarCoordinateType
#error, #pix_size, #resolution, #size, #value
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SerializableToXml
Methods inherited from ScalarCoordinateType
Methods inherited from CoordinateType
Constructor Details
This class inherits a constructor from VORuby::STC::V1_10::Coords::ScalarCoordinateType
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
1226 1227 1228 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1226 def unit @unit end |
Class Method Details
.from_xml(xml) ⇒ Object
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1243 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] = unit.value if unit [: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) ScalarCoordinate.new() end |
Instance Method Details
#==(c) ⇒ Object
1232 1233 1234 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1232 def ==(c) super(c) and self.unit == c.unit end |
#to_xml ⇒ Object
1236 1237 1238 1239 1240 1241 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1236 def to_xml el = super('ScalarCoordinate') el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit collapse_namespaces(el) el end |