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?, parse

Constructor Details

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

Returns a new instance of FlyTo.



1820
1821
1822
1823
1824
1825
# File 'lib/kamelopard/classes.rb', line 1820

def initialize(view = nil, options = {})
    @duration = 0
    @mode = Kamelopard::DocumentHolder.instance.current_document.flyto_mode
    super options
    self.view= view unless view.nil?
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



1818
1819
1820
# File 'lib/kamelopard/classes.rb', line 1818

def duration
  @duration
end

#modeObject

Returns the value of attribute mode.



1818
1819
1820
# File 'lib/kamelopard/classes.rb', line 1818

def mode
  @mode
end

#viewObject

Returns the value of attribute view.



1818
1819
1820
# File 'lib/kamelopard/classes.rb', line 1818

def view
  @view
end

Instance Method Details

#range=(range) ⇒ Object



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

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

#to_kml(elem = nil) ⇒ Object



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

def to_kml(elem = nil)
    k = XML::Node.new 'gx:FlyTo'
    super k

    #k.namespaces.namespace = XML::Namespaces.new(k, 'gx', 'http://www.google.com/kml/ext/2.2')
    Kamelopard.kml_array(k, [
        [ @duration, 'gx:duration' ],
        [ @mode, 'gx:flyToMode' ]
    ])
    @view.to_kml k unless @view.nil?
    elem << k unless elem.nil?
    k
end