Class: Tour

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

Overview

Corresponds to a KML gx:Tour object

Instance Attribute Summary collapse

Attributes inherited from KMLObject

#comment, #id

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, description = nil) ⇒ Tour

Returns a new instance of Tour.



1260
1261
1262
1263
1264
1265
# File 'lib/kamelopard/classes.rb', line 1260

def initialize(name = nil, description = nil)
    super()
    @name = name
    @description = description
    @items = []
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



1259
1260
1261
# File 'lib/kamelopard/classes.rb', line 1259

def description
  @description
end

#last_abs_viewObject

Returns the value of attribute last_abs_view.



1259
1260
1261
# File 'lib/kamelopard/classes.rb', line 1259

def last_abs_view
  @last_abs_view
end

#nameObject

Returns the value of attribute name.



1259
1260
1261
# File 'lib/kamelopard/classes.rb', line 1259

def name
  @name
end

Instance Method Details

#<<(a) ⇒ Object

Add another element to this Tour



1268
1269
1270
1271
# File 'lib/kamelopard/classes.rb', line 1268

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

#to_kml(indent = 0) ⇒ Object



1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
# File 'lib/kamelopard/classes.rb', line 1273

def to_kml(indent = 0)
    k = super + "#{ ' ' * indent }<gx:Tour id=\"#{ @id }\">\n"
    k << kml_array([
        [ @name, 'name', true ],
        [ @description, 'description', true ],
    ], indent + 4)
    k << "#{ ' ' * indent }    <gx:Playlist>\n";

    @items.map do |a| k << a.to_kml(indent + 8) << "\n" end

    k << "#{ ' ' * indent }    </gx:Playlist>\n"
    k << "#{ ' ' * indent }</gx:Tour>\n"
    k
end