Class: VORuby::STC::V1_30::TimeIntervalType

Inherits:
CoordIntervalType show all
Defined in:
lib/voruby/stc/1.30/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

#fill_factor, #frame_id, #hi_include, #lo_include

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordIntervalType

coord_interval_from_xml, #hi_include?, #lo_include?

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(start_time, stop_time, lo_include = true, hi_include = true, options = {}) ⇒ TimeIntervalType

Returns a new instance of TimeIntervalType.



3735
3736
3737
3738
3739
# File 'lib/voruby/stc/1.30/stc.rb', line 3735

def initialize(start_time, stop_time, lo_include=true, hi_include=true, options={})
  self.start_time = start_time
  self.stop_time = stop_time
  super(lo_include, hi_include, options)
end

Instance Attribute Details

#start_timeObject

Returns the value of attribute start_time.



3733
3734
3735
# File 'lib/voruby/stc/1.30/stc.rb', line 3733

def start_time
  @start_time
end

#stop_timeObject

Returns the value of attribute stop_time.



3733
3734
3735
# File 'lib/voruby/stc/1.30/stc.rb', line 3733

def stop_time
  @stop_time
end

Class Method Details

.from_xml(xml) ⇒ Object



3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
# File 'lib/voruby/stc/1.30/stc.rb', line 3769

def self.from_xml(xml)
  root = element_from(xml)
  
  start_time = REXML::XPath.first(root, 'x:StartTime', {'x' => obj_ns.uri})
  stop_time = REXML::XPath.first(root, 'x:StopTime', {'x' => obj_ns.uri})
  
  self.new(
    start_time ? AstronTimeType.from_xml(start_time) : nil,
    stop_time ? AstronTimeType.from_xml(stop_time) : nil,
    *CoordIntervalType.coord_interval_from_xml(root)
  )
end

Instance Method Details

#==(i) ⇒ Object



3753
3754
3755
3756
3757
# File 'lib/voruby/stc/1.30/stc.rb', line 3753

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

#to_xml(name = nil) ⇒ Object



3759
3760
3761
3762
3763
3764
3765
3766
3767
# File 'lib/voruby/stc/1.30/stc.rb', line 3759

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.start_time.to_xml('StartTime')) if self.start_time
  el.add_element(self.stop_time.to_xml('StopTime')) if self.stop_time
  
  collapse_namespaces(el)
  el
end