class ADSB::Airplane

Attributes

address[R]

Public Class Methods

new(address) click to toggle source
# File lib/adsb2kml/airplane.rb, line 27
def initialize address
        @address = address
        @altitude = "0"
end

Public Instance Methods

icon(url) click to toggle source
# File lib/adsb2kml/airplane.rb, line 63
def icon url
        to_return = KML::Style.new(
                :id => @address + "_style",
                :icon_style => KML::IconStyle.new(
                        :heading => @track,
                        :icon => KML::Icon.new(
                                :href => url
                        ),
                        :scale => 1.4
                ),
                :label_style => KML::LabelStyle.new(
                        :scale => 0.4
                )
        )
end
info() click to toggle source
# File lib/adsb2kml/airplane.rb, line 23
def info
        return @@info
end
merge_with(airplane) click to toggle source
# File lib/adsb2kml/airplane.rb, line 32
def merge_with airplane
        if airplane.address != @address then
                return false
        end

        
        @@info.each do |x|
                if ! airplane.send(x).empty? then
                        send( x.to_s + "=" , airplane.send(x) )
                end
        end

        return true
end
placemark() click to toggle source
# File lib/adsb2kml/airplane.rb, line 47
def placemark
        to_return = KML::Placemark.new(
                :name => @address,
                :geometry => KML::Point.new(
                        :coordinates => {
                                :lat => @latitude,
                                :lng => @longitude,
                                :alt => @altitude
                        }
                ),
                :style_url => "#" + @address + "_style"
        )

        return to_return
end
time_diff() click to toggle source
# File lib/adsb2kml/airplane.rb, line 83
def time_diff
        return Time.now.to_i - @last_heard.to_i
end
to_cons() click to toggle source
# File lib/adsb2kml/airplane.rb, line 79
def to_cons
        return sprintf $STRING_FORMAT, @address, @latitude, @longitude, @altitude, @speed, @last_heard, time_diff, @track
end