Class: Kamelopard::LookAt

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

Overview

Corresponds to KML’s LookAt object

Instance Attribute Summary

Attributes inherited from AbstractView

#altitudeMode, #className, #heading, #point, #range, #tilt, #timespan, #timestamp, #viewerOptions

Attributes inherited from Object

#comment, #kml_id, #master_only

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractView

#[], #[]=, #altitude, #altitude=, #latitude, #latitude=, #longitude, #longitude=, #to_kml, #to_queries_txt

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, #to_kml

Constructor Details

#initialize(point = nil, options = {}) ⇒ LookAt

Returns a new instance of LookAt.



713
714
715
716
# File 'lib/kamelopard/classes.rb', line 713

def initialize(point = nil, options = {})
    super('LookAt', point, options)
    @range = 0 if @range.nil?
end

Class Method Details

.parse(la) ⇒ Object



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'lib/kamelopard/classes.rb', line 718

def self.parse(la)
    # TimePrimitive
#<!-- inherited from AbstractView element -->
#<TimePrimitive>...</TimePrimitive>  <!-- gx:TimeSpan or gx:TimeStamp -->
    # ViewerOptions
#<gx:ViewerOptions>
#<option> name=" " type="boolean">     <!-- name="streetview", "historicalimagery", "sunlight", or "groundnavigation" -->
#</option>
#</gx:ViewerOptions>
    fields = %w[
        longitude latitude altitude heading
        tilt range altitudeMode
        gx:TimeStamp gx:TimeSpan gx:ViewerOptions
    ]
    b = Kamelopard.xml_to_hash(la, fields)
    a = {}
    b.each do |k, v|
        if k == :altitudeMode
            a[k] = v.to_s.to_sym
        else
            a[k] = v.to_s.to_f
        end
    end
    return LookAt.new(
        Point.new( a[:longitude], a[:latitude], a[:altitude], :altitudeMode => a[:altitudeMode]),
        :heading => a[:heading],
        :tilt => a[:tilt],
        :range => a[:range])
end

Instance Method Details

#rollObject



748
749
750
751
# File 'lib/kamelopard/classes.rb', line 748

def roll
    # The roll element doesn't exist in LookAt objects
    raise "The roll element is part of Camera objects, not LookAt objects"
end

#roll=(a) ⇒ Object



753
754
755
756
# File 'lib/kamelopard/classes.rb', line 753

def roll=(a)
    # The roll element doesn't exist in LookAt objects
    raise "The roll element is part of Camera objects, not LookAt objects"
end