Class: 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 KMLObject

#comment, #id

Instance Method Summary collapse

Constructor Details

#initialize(view = nil, range = nil, duration = 0, mode = :bounce) ⇒ FlyTo

Returns a new instance of FlyTo.



1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
# File 'lib/kamelopard/classes.rb', line 1146

def initialize(view = nil, range = nil, duration = 0, mode = :bounce)
    @duration = duration
    @mode = mode
    if view.kind_of? AbstractView then
        @view = view
    else
        @view = LookAt.new(view)
    end
    if view.respond_to? 'range' and not range.nil? then
        @view.range = range
    end
    super()
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



1144
1145
1146
# File 'lib/kamelopard/classes.rb', line 1144

def duration
  @duration
end

#modeObject

Returns the value of attribute mode.



1144
1145
1146
# File 'lib/kamelopard/classes.rb', line 1144

def mode
  @mode
end

#viewObject

Returns the value of attribute view.



1144
1145
1146
# File 'lib/kamelopard/classes.rb', line 1144

def view
  @view
end

Instance Method Details

#to_kml(indent = 0) ⇒ Object



1160
1161
1162
1163
1164
1165
1166
1167
1168
# File 'lib/kamelopard/classes.rb', line 1160

def to_kml(indent = 0)
    k = super + "#{ ' ' * indent }<gx:FlyTo>\n"
    k << kml_array([
        [ @duration, 'gx:duration', true ],
        [ @mode, 'gx:flyToMode', true ]
    ], indent + 4)
    k << @view.to_kml(indent + 4) unless @view.nil?
    k << "#{ ' ' * indent }</gx:FlyTo>\n"
end