class MapPath

A path line to draw on the map. Initialize and set attributes.

Attributes

color[RW]

Color of the path, either as a 24-bit (example: color=0xFFFFCC), a 32-bit hexadecimal value (example: color=0xFFFFCCFF), or from the set {black, brown, green, purple, yellow, blue, gray, orange, red, white} When a 32-bit hex value is specified, the last two characters specify the 8-bit alpha transparency value. This value varies between 00 (completely transparent) and FF (completely opaque).

points[RW]

MapPositions for each point on the line

weight[RW]

Thickness of the path line in pixels, defaults to 5

Public Class Methods

new(attrs={}) click to toggle source

Pass an optional hash of arguments

# File lib/googlestaticmap.rb, line 292
def initialize(attrs={})
  @points = []
  attrs.each {|k,v| self.send("#{k}=".to_sym,v)}
end

Public Instance Methods

to_s() click to toggle source
# File lib/googlestaticmap.rb, line 297
def to_s
  raise Exception.new("Need more than one point for the path") unless @points && @points.length > 1
  attrs = GoogleStaticMapHelpers.safe_instance_variables(self, ["points"])
  s = attrs.to_a.sort_by {|x| x[0]}.collect {|k| "#{k[0]}:#{CGI.escape(k[1].to_s)}"}.join(MAP_SEPARATOR)
  s << MAP_SEPARATOR << @points.join(MAP_SEPARATOR)
end