Class: Kamelopard::Track

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

Overview

Corresponds to Google Earth’s gx:Track extension to KML

Instance Attribute Summary collapse

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(options = {}) ⇒ Track

Returns a new instance of Track.



2605
2606
2607
2608
2609
2610
# File 'lib/kamelopard/classes.rb', line 2605

def initialize(options = {})
    @when = []
    @coord = []
    @angles = []
    super
end

Instance Attribute Details

#altitudeModeObject

Returns the value of attribute altitudeMode.



2604
2605
2606
# File 'lib/kamelopard/classes.rb', line 2604

def altitudeMode
  @altitudeMode
end

#anglesObject

Returns the value of attribute angles.



2604
2605
2606
# File 'lib/kamelopard/classes.rb', line 2604

def angles
  @angles
end

#coordObject

Returns the value of attribute coord.



2604
2605
2606
# File 'lib/kamelopard/classes.rb', line 2604

def coord
  @coord
end

#modelObject

Returns the value of attribute model.



2604
2605
2606
# File 'lib/kamelopard/classes.rb', line 2604

def model
  @model
end

#whenObject

Returns the value of attribute when.



2604
2605
2606
# File 'lib/kamelopard/classes.rb', line 2604

def when
  @when
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
# File 'lib/kamelopard/classes.rb', line 2612

def to_kml(elem = nil)
    e = XML::Node.new 'gx:Track'
    [
        [ @coord, 'gx:coord' ],
        [ @when, 'when' ],
        [ @angles, 'gx:angles' ],
    ].each do |a|
        a[0].each do |g|
            w = XML::Node.new a[1], g.to_s
            e << w
        end
    end
    elem << e unless elem.nil?
    e
end