Skip to content

Commit

Permalink
Basic direction functionality added
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimpson authored and jsimpson committed Apr 21, 2008
1 parent bbfc9bc commit 7782135
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/gm_plugin/map.rb
Expand Up @@ -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]
Expand Down

0 comments on commit 7782135

Please sign in to comment.