Class: Kamelopard::Tour

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

Overview

Corresponds to a KML gx:Tour object

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(name = nil, description = nil, no_wait = false) ⇒ Tour

Returns a new instance of Tour.



1829
1830
1831
1832
1833
1834
1835
1836
# File 'lib/kamelopard/classes.rb', line 1829

def initialize(name = nil, description = nil, no_wait = false)
    super()
    @name = name
    @description = description
    @playlist = []
    DocumentHolder.instance.current_document.tours << self
    Wait.new(0.1, :comment => "This wait is automatic, and helps prevent animation glitches") unless no_wait
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



1827
1828
1829
# File 'lib/kamelopard/classes.rb', line 1827

def description
  @description
end

#iconObject

Returns the value of attribute icon.



1827
1828
1829
# File 'lib/kamelopard/classes.rb', line 1827

def icon
  @icon
end

#last_abs_viewObject

Returns the value of attribute last_abs_view.



1827
1828
1829
# File 'lib/kamelopard/classes.rb', line 1827

def last_abs_view
  @last_abs_view
end

#nameObject

Returns the value of attribute name.



1827
1828
1829
# File 'lib/kamelopard/classes.rb', line 1827

def name
  @name
end

#playlistObject

Returns the value of attribute playlist.



1827
1828
1829
# File 'lib/kamelopard/classes.rb', line 1827

def playlist
  @playlist
end

Instance Method Details

#<<(a) ⇒ Object

Add another element to this Tour



1839
1840
1841
1842
# File 'lib/kamelopard/classes.rb', line 1839

def <<(a)
    @playlist << a
    @last_abs_view = a.view if a.kind_of? FlyTo
end

#to_kml(elem = nil) ⇒ Object



1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
# File 'lib/kamelopard/classes.rb', line 1844

def to_kml(elem = nil)
    k = XML::Node.new 'gx:Tour'
    super k
    Kamelopard.kml_array(k, [
        [ @name, 'name' ],
        [ @description, 'description' ],
    ])
    p = XML::Node.new 'gx:Playlist'
    @playlist.map do |a| a.to_kml p end
    k << p
    elem << k unless elem.nil?
    k
end