Class: Kamelopard::FlyTo

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

Overview

Cooresponds to KML’s gx:FlyTo object. The @view parameter needs to look like an AbstractView object

Instance Attribute Summary collapse

Attributes inherited from Object

#comment, #kml_id

Instance Method Summary collapse

Methods inherited from Object

#change

Constructor Details

#initialize(view = nil, options = {}) ⇒ FlyTo

Returns a new instance of FlyTo.



1284
1285
1286
1287
1288
1289
# File 'lib/kamelopard/classes.rb', line 1284

def initialize(view = nil, options = {})
    @duration = 0
    @mode = :bounce
    super options
    self.view= view unless view.nil?
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



1282
1283
1284
# File 'lib/kamelopard/classes.rb', line 1282

def duration
  @duration
end

#modeObject

Returns the value of attribute mode.



1282
1283
1284
# File 'lib/kamelopard/classes.rb', line 1282

def mode
  @mode
end

#viewObject

Returns the value of attribute view.



1282
1283
1284
# File 'lib/kamelopard/classes.rb', line 1282

def view
  @view
end

Instance Method Details

#range=(range) ⇒ Object



1299
1300
1301
1302
1303
# File 'lib/kamelopard/classes.rb', line 1299

def range=(range)
    if view.respond_to? 'range' and not range.nil? then
        @view.range = range
    end
end

#to_kml(elem = nil) ⇒ Object



1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
# File 'lib/kamelopard/classes.rb', line 1305

def to_kml(elem = nil)
    k = XML::Node.new 'gx:FlyTo'
    super k
    Kamelopard.kml_array(k, [
        [ @duration, 'gx:duration' ],
        [ @mode, 'gx:flyToMode' ]
    ])
    @view.to_kml k unless @view.nil?
    elem << k unless elem.nil?
    k
end