#!/usr/bin/env ruby # # Created by sjavey on 2007-07-10. # Copyright (c) 2007. All rights reserved. # # To run this program you must add /full-path.../note19/trunk to your RUBYLIB # environment variable. # require 'n19gpx/document' class GoogleMapGpx def initialize(gpxfile) @gpx = N19GPX::Document.new(gpxfile) @index = -1 @counter = -1 end def googleKey return "ABQIAAAAUnY6UsCW7it4ynNVu1Y5yBSxX2zfTXvgNqo-1Sb4KGdzxJeSsxSMxoquhxxH3JhZzsr1mB3ZxpioMA" end def boundsHtml str = < 100 or @counter == -1) @counter = 0 @index = @index +1 str = "\n\ttracks[#{@index}] = [];\n" str << "\ttrackVisible[#{@index}] = true;\n" str << "\ttrackOverlay[#{@index}] = null;\n" end @counter = @counter + 1 str << "\ttracks[#{@index}].push(new GLatLng(#{point.lat},#{point.lon}));\n" end def trackHtml(track) str = "" track.points.each { |point| str << addPoint(point) } return str; end def html @htmlHeader = < note19 Scripts
EOS end def tracksHtml str = "" @gpx.tracks.each {|track| str << trackHtml(track) } return str end def mapControl str = < #{mapTrackControl()} EOS end def mapTrackControl str = "\n" @gpx.tracks.each {|track| ts = < EOS str << ts } return str end def mapControlFunctions str = <