Class: Warpaint::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/warpaint/renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(networks, track_points) ⇒ Renderer

Returns a new instance of Renderer.



5
6
7
8
# File 'lib/warpaint/renderer.rb', line 5

def initialize(networks, track_points)
  @networks = networks
  @track_points = track_points
end

Instance Method Details

#render_to(f) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/warpaint/renderer.rb', line 10

def render_to(f)
  overlay = Kamel::Overlay.new
  overlay.name = "Wireless Networks"
  @networks.each do |time, access_point|
    time_point_pair = @track_points.closest_to(time)
    trackpoint = time_point_pair[1]

    overlay.placemark!(
      :name        => access_point[:essid],
      :description => "This is an access point",
      :location    => { :lng => trackpoint[:lon], :lat => trackpoint[:lat] },
      :icon        => "http://a.yfrog.com/img861/7242/hjvc.png"
    )
  end

  f.write(overlay.to_kml)
end