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 TourPrimitive

#standalone

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?

Constructor Details

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

Returns a new instance of FlyTo.



1614
1615
1616
1617
1618
1619
# File 'lib/kamelopard/classes.rb', line 1614

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.



1612
1613
1614
# File 'lib/kamelopard/classes.rb', line 1612

def duration
  @duration
end

#modeObject

Returns the value of attribute mode.



1612
1613
1614
# File 'lib/kamelopard/classes.rb', line 1612

def mode
  @mode
end

#viewObject

Returns the value of attribute view.



1612
1613
1614
# File 'lib/kamelopard/classes.rb', line 1612

def view
  @view
end

Instance Method Details

#range=(range) ⇒ Object



1631
1632
1633
1634
1635
# File 'lib/kamelopard/classes.rb', line 1631

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

#to_kml(elem = nil) ⇒ Object



1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
# File 'lib/kamelopard/classes.rb', line 1637

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