Class: Kamelopard::Wait

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

Overview

Corresponds to a KML gx:Wait object

Instance Attribute Summary collapse

Attributes inherited from TourPrimitive

#standalone

Attributes inherited from Object

#comment, #kml_id, #master_only

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?

Constructor Details

#initialize(duration = 0, options = {}) ⇒ Wait

Returns a new instance of Wait.



1881
1882
1883
1884
# File 'lib/kamelopard/classes.rb', line 1881

def initialize(duration = 0, options = {})
    super options
    @duration = duration
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



1880
1881
1882
# File 'lib/kamelopard/classes.rb', line 1880

def duration
  @duration
end

Class Method Details

.parse(x) ⇒ Object

Accepts an XML node representing a gx:Wait KML object, and turns it into a Kamelopard::Wait object



1888
1889
1890
1891
1892
1893
1894
1895
# File 'lib/kamelopard/classes.rb', line 1888

def self.parse(x)
    dur = nil
    id = x.attributes['id'] if x.attributes? 'id'
    w.find('//gx:duration').each do |d|
        dur = d.children[0].to_s.to_f
        return Wait.new(dur, :id => id)
    end
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1897
1898
1899
1900
1901
1902
1903
1904
1905
# File 'lib/kamelopard/classes.rb', line 1897

def to_kml(elem = nil)
    k = XML::Node.new 'gx:Wait'
    super k
    d = XML::Node.new 'gx:duration'
    d << @duration.to_s
    k << d
    elem << k unless elem.nil?
    k
end