Class: 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 KMLObject

#comment, #id

Instance Method Summary collapse

Constructor Details

#initialize(t_begin, t_end) ⇒ TimeSpan

Returns a new instance of TimeSpan.



497
498
499
500
501
# File 'lib/kamelopard/classes.rb', line 497

def initialize(t_begin, t_end)
    super()
    @begin = t_begin
    @end = t_end
end

Instance Attribute Details

#beginObject

Returns the value of attribute begin.



496
497
498
# File 'lib/kamelopard/classes.rb', line 496

def begin
  @begin
end

#endObject

Returns the value of attribute end.



496
497
498
# File 'lib/kamelopard/classes.rb', line 496

def end
  @end
end

Instance Method Details

#to_kml(indent = 0, ns = nil) ⇒ Object



503
504
505
506
507
508
509
510
511
512
# File 'lib/kamelopard/classes.rb', line 503

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

    k = super(indent + 4) + "#{ ' ' * indent }<#{ prefix }TimeSpan id=\"#{ @id }\">\n"
    k << "#{ ' ' * indent }    <begin>#{ @begin }</begin>\n" unless @begin.nil?
    k << "#{ ' ' * indent }    <end>#{ @end }</end>\n" unless @end.nil?
    k << "#{ ' ' * indent }</#{ prefix }TimeSpan>\n"
    k
end