Class: VORuby::STC::V1_10::STC::TimeIntervalType

Inherits:
CoordIntervalType show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

The time interval needs to contain a start time or a stop time or both; it needs to refer to a coordinate system; boundaries may or may not be inclusive

Instance Attribute Summary collapse

Attributes inherited from CoordIntervalType

#hi_include, #lo_include

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordIntervalType

#fill_factor, #fill_factor=, #initialize

Methods included from SerializableToXml

#element

Constructor Details

This class inherits a constructor from VORuby::STC::V1_10::STC::CoordIntervalType

Instance Attribute Details

#start_timeObject

Returns the value of attribute start_time.



1749
1750
1751
# File 'lib/voruby/stc/1.10/stc.rb', line 1749

def start_time
  @start_time
end

#stop_timeObject

Returns the value of attribute stop_time.



1749
1750
1751
# File 'lib/voruby/stc/1.10/stc.rb', line 1749

def stop_time
  @stop_time
end

Class Method Details

.from_xml(xml) ⇒ Object



1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
# File 'lib/voruby/stc/1.10/stc.rb', line 1782

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {}
  
  lo_include = root.attributes.get_attribute_ns(obj_ns.uri, 'lo_include')
  options[:lo_include] = (lo_include.value == 'true' ? true : false) if lo_include
  
  hi_include = root.attributes.get_attribute_ns(obj_ns.uri, 'hi_include')
  options[:hi_include] = (hi_include.value == 'true' ? true : false) if hi_include
  
  fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor')
  options[:fill_factor] = Float(fill_factor.value) if fill_factor
  
  start_time = REXML::XPath.first(root, 'x:StartTime', {'x' => obj_ns.uri})
  options[:start_time] = AstronTime.from_xml(start_time) if start_time
  
  stop_time = REXML::XPath.first(root, 'x:StopTime', {'x' => obj_ns.uri})
  options[:stop_time] = AstronTime.from_xml(stop_time) if stop_time
  
  self.new(options)
end

Instance Method Details

#==(i) ⇒ Object



1776
1777
1778
1779
1780
# File 'lib/voruby/stc/1.10/stc.rb', line 1776

def ==(i)
  super(i) and
  self.start_time == i.start_time and
  self.stop_time == i.stop_time
end

#to_xml(name = nil) ⇒ Object



1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/voruby/stc/1.10/stc.rb', line 1763

def to_xml(name=nil)
  el = super(name)
  
  coords_ns = NAMESPACES['VORuby::STC::V1_10::Coords']
  el.add_namespace(coords_ns.prefix, coords_ns.uri)
  
  el.add_element(self.start_time.to_xml('StartTime', obj_ns('VORuby::STC::V1_10::STC'))) if self.start_time
  el.add_element(self.stop_time.to_xml('StopTime', obj_ns('VORuby::STC::V1_10::STC'))) if self.stop_time
  
  collapse_namespaces(el)
  el
end