Class: Kamelopard::TimeSpan

Inherits:
TimePrimitive show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s TimeSpan object. @begin and @end must be in a format KML understands.

Instance Attribute Summary collapse

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

#initialize(ts_begin = nil, ts_end = nil, options = {}) ⇒ TimeSpan

Returns a new instance of TimeSpan.



686
687
688
689
690
# File 'lib/kamelopard/classes.rb', line 686

def initialize(ts_begin = nil, ts_end = nil, options = {})
    super options
    @begin = ts_begin unless ts_begin.nil?
    @end = ts_end unless ts_end.nil?
end

Instance Attribute Details

#beginObject

XXX Evidence suggests this doesn’t support unbounded intervals. Fix that, if it’s true.



685
686
687
# File 'lib/kamelopard/classes.rb', line 685

def begin
  @begin
end

#endObject

XXX Evidence suggests this doesn’t support unbounded intervals. Fix that, if it’s true.



685
686
687
# File 'lib/kamelopard/classes.rb', line 685

def end
  @end
end

Instance Method Details

#to_kml(elem = nil, ns = nil) ⇒ Object



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
# File 'lib/kamelopard/classes.rb', line 692

def to_kml(elem = nil, ns = nil)
    prefix = ''
    prefix = ns + ':' unless ns.nil?

    k = XML::Node.new "#{prefix}TimeSpan"
    super(k)
    if not @begin.nil? then
        w = XML::Node.new 'begin'
        w << @begin
        k << w
    end
    if not @end.nil? then
        w = XML::Node.new 'end'
        w << @end
        k << w
    end
    elem << k unless elem.nil?
    k
end