lib/gcmapper.rb in gcmapper-0.1 vs lib/gcmapper.rb in gcmapper-0.2
- old
+ new
@@ -9,10 +9,22 @@
module Gcmapper
def self.gcmap(route, args)
args[:terrain].nil? || args[:terrain] == false ? tr="wls" : tr="bm"
args[:width].nil? ? width="720" : width=args[:width]
args[:height].nil? ? height="360" : height=args[:height]
+ style = parse_styles(args)
+ url = "http://www.gcmap.com/map?P=#{route}%0d%0a&MS=#{tr}&MR=120&MX=#{width}x#{height}&PM=#{style}"
+ end
- url = "http://www.gcmap.com/map?P=#{route}%0d%0a&MS=#{tr}&MR=120&MX=#{width}x#{height}&PM=b:disc7%2b%22%25i%25+%28N%22"
+private
+ # disc + user code b:disc7%2b%25U
+ # disc + user_code + city b:disc7%2b\"%25U%25+%28N\"
+ # disc + airport_name b:disc7+%A
+
+ def self.parse_styles(args)
+ style = 'b:disc7%2b' #basic
+ args[:city] == false ? style += '%25U' : style += '"%25U%25+%28N"'
+ style = 'b:disc7+%A' if args[:airport_name] == true
+ return style
end
end