Class: VORuby::STC::V1_30::TimeCoordinateType
- Inherits:
-
CoordinateType
- Object
- STCBaseType
- CoordinateType
- VORuby::STC::V1_30::TimeCoordinateType
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
Time coordinate type; sibling of BasicCoordinateType. Single Error, Resolution, Size, PixSize elements indicate definite values; pairs indicate ranges.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#coord_system_id ⇒ Object
Returns the value of attribute coord_system_id.
-
#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.
-
#time_instant ⇒ Object
Returns the value of attribute time_instant.
-
#unit ⇒ Object
Returns the value of attribute unit.
Attributes inherited from CoordinateType
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
- #==(c) ⇒ Object
-
#initialize(options = {}) ⇒ TimeCoordinateType
constructor
A new instance of TimeCoordinateType.
- #to_xml(name = nil) ⇒ Object
Methods inherited from CoordinateType
Methods inherited from STCBaseType
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ TimeCoordinateType
Returns a new instance of TimeCoordinateType.
1636 1637 1638 1639 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1636 def initialize(={}) [:unit] ||= TimeUnitType.new('s') super() end |
Instance Attribute Details
#coord_system_id ⇒ Object
Returns the value of attribute coord_system_id.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def coord_system_id @coord_system_id end |
#error ⇒ Object
Returns the value of attribute error.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def error @error end |
#pix_size ⇒ Object
Returns the value of attribute pix_size.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def pix_size @pix_size end |
#resolution ⇒ Object
Returns the value of attribute resolution.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def resolution @resolution end |
#size ⇒ Object
Returns the value of attribute size.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def size @size end |
#time_instant ⇒ Object
Returns the value of attribute time_instant.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def time_instant @time_instant end |
#unit ⇒ Object
Returns the value of attribute unit.
1633 1634 1635 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1633 def unit @unit end |
Class Method Details
.from_xml(xml) ⇒ Object
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1721 def self.from_xml(xml) root = element_from(xml) = CoordinateType.coordinate_from_xml(root) time_instant = REXML::XPath.first(root, 'x:TimeInstant', {'x' => obj_ns.uri}) [:time_instant] = AstronTimeType.from_xml(time_instant) if time_instant 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 coord_system_id = root.attributes.get_attribute_ns(obj_ns.uri, 'coord_system_id') [:coord_system_id] = IdRef.new(coord_system_id.value) if coord_system_id unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') [:unit] = TimeUnitType.new(unit.value) if unit self.new() end |
Instance Method Details
#==(c) ⇒ Object
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1694 def ==(c) super(c) and self.time_instant == c.time_instant and self.error == c.error and self.resolution == c.resolution and self.size == c.size and self.pix_size == c.pix_size and self.coord_system_id == c.coord_system_id and self.unit == c.unit end |
#to_xml(name = nil) ⇒ Object
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 |
# File 'lib/voruby/stc/1.30/stc.rb', line 1705 def to_xml(name=nil) el = super(name) el.add_element(self.time_instant.to_xml('TimeInstant')) if self.time_instant 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 el.attributes["#{obj_ns.prefix}:coord_system_id"] = self.coord_system_id.to_s if self.coord_system_id el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit collapse_namespaces(el) el end |