Class: VORuby::STC::V1_30::BasicCoordinateType
- Inherits:
-
CoordinateType
- Object
- STCBaseType
- CoordinateType
- VORuby::STC::V1_30::BasicCoordinateType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Basic scalar coordinate type. Single Error, Resolution, Size, PixSize elements indicate definite values; pairs indicate ranges.
Direct Known Subclasses
PosVector1CoordinateType, RedshiftCoordinateType, ScalarCoordinateType, SpectralCoordinateType
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#pix_size ⇒ Object
Returns the value of attribute pix_size.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#size ⇒ Object
Returns the value of attribute size.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from CoordinateType
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from CoordinateType
Methods inherited from STCBaseType
#initialize, stc_base_from_xml
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
This class inherits a constructor from VORuby::STC::V1_30::STCBaseType
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
1501 1502 1503 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1501 def error @error end |
#pix_size ⇒ Object
Returns the value of attribute pix_size.
1501 1502 1503 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1501 def pix_size @pix_size end |
#resolution ⇒ Object
Returns the value of attribute resolution.
1501 1502 1503 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1501 def resolution @resolution end |
#size ⇒ Object
Returns the value of attribute size.
1501 1502 1503 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1501 def size @size end |
#value ⇒ Object
Returns the value of attribute value.
1501 1502 1503 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1501 def value @value end |
Class Method Details
.basic_coordinate_from_xml(root) ⇒ Object
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1562 def self.basic_coordinate_from_xml(root) = CoordinateType.coordinate_from_xml(root) value = REXML::XPath.first(root, 'x:Value', {'x' => obj_ns.uri}) [:value] = Value.from_xml(value) if value error = REXML::XPath.match(root, 'x:Error', {'x' => obj_ns.uri}) [:error] = ErrorList.new(error.collect{ |e| Error.from_xml(e) }) if error [:error] = nil if [:error].size == 0 resolution = REXML::XPath.match(root, 'x:Resolution', {'x' => obj_ns.uri}) [:resolution] = ResolutionList.new(resolution.collect{ |r| Resolution.from_xml(r) }) if resolution [:resolution] = nil if [:resolution].size == 0 size = REXML::XPath.match(root, 'x:Size', {'x' => obj_ns.uri}) [:size] = SizeList.new(size.collect{ |s| Size.from_xml(s) }) if size [:size] = nil if [:size].size == 0 pix_size = REXML::XPath.match(root, 'x:PixSize', {'x' => obj_ns.uri}) [:pix_size] = PixSizeList.new(pix_size.collect{ |p| PixSize.from_xml(p) }) if pix_size [:pix_size] = nil if [:pix_size].size == 0 end |
.from_xml(xml) ⇒ Object
1587 1588 1589 1590 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1587 def self.from_xml(xml) root = element_from(xml) self.new(basic_coordinate_from_xml(root)) end |
Instance Method Details
#==(c) ⇒ Object
1540 1541 1542 1543 1544 1545 1546 1547 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1540 def ==(c) super(c) and self.value == c.value and self.error == c.error and self.resolution == c.resolution and self.size == c.size and self.pix_size == c.pix_size end |
#to_xml(name = nil) ⇒ Object
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1549 def to_xml(name=nil) el = super(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 |