Permalink
Browse files

Basic direction functionality added

  • Loading branch information...
1 parent bbfc9bc commit 77821351d5f5b0c536e5fbdf89a4c853162ffa96 jsimpson committed Apr 21, 2008
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/gm_plugin/map.rb
View
@@ -220,6 +220,19 @@ def declare_global_init(variable,name, options = {})
end
end
+ # Simple GDirections support
+ def directions(div, dir_points)
+ @init << "dir_div = document.getElementById('#{div}');"
+ @init << "directions = new GDirections(#{@variable}, dir_div);"
+ @init << "dir_point_array = new Array;"
+ dir_points.each do |d|
+ @init << "dir_point_array.push('#{d}');"
+ end
+ # Error Handling
+ @init << "GEvent.addListener(directions, 'error', handleErrors);"
+
+ @init << "directions.loadFromWaypoints(dir_point_array);"
+ end
#Outputs the initialization code for the map. By default, it outputs the script tags, performs the initialization in response to the onload event of the window and makes the map globally available. If you pass +true+ to the option key <tt>:full</tt>, the map will be setup in full screen, in which case it is not necessary (but not harmful) to set a size for the map div.
def to_html(options = {})
no_load = options[:no_load]

0 comments on commit 7782135

Please sign in to comment.