Class Ym4r::GmPlugin::GPolygon
In: lib/gm_plugin/overlay.rb
Parent: Object

Polygon. Not documented yet in the Google Maps API

Methods

create   new  

Included Modules

MappingObject

Attributes

color  [RW] 
opacity  [RW] 
points  [RW] 
stroke_color  [RW] 
stroke_opacity  [RW] 
stroke_weight  [RW] 

Public Class methods

Can take an array of GLatLng or an array of 2D arrays. A method to directly build a polygon from a GeoRuby polygon is provided in the helper.rb file.

[Source]

     # File lib/gm_plugin/overlay.rb, line 140
140:       def initialize(points,stroke_color="#000000",stroke_weight=1,stroke_opacity=1.0,color="#ff0000",opacity=1.0)
141:         if !points.empty? and points[0].is_a?(Array)
142:           @points = points.collect { |pt| GLatLng.new(pt) }
143:         else
144:           @points = points
145:         end
146:         @stroke_color = stroke_color
147:         @stroke_weight = stroke_weight
148:         @stroke_opacity = stroke_opacity
149:         @color = color
150:         @opacity = opacity
151:       end

Public Instance methods

Creates a new polyline.

[Source]

     # File lib/gm_plugin/overlay.rb, line 154
154:       def create
155:         a = "new GPolygon(#{MappingObject.javascriptify_variable(points)}"
156:         a << ",#{MappingObject.javascriptify_variable(@stroke_color)}"
157:         a << ",#{MappingObject.javascriptify_variable(@stroke_weight)}"
158:         a << ",#{MappingObject.javascriptify_variable(@stroke_opacity)}"
159:         a << ",#{MappingObject.javascriptify_variable(@color)}"
160:         a << ",#{MappingObject.javascriptify_variable(@opacity)}"
161:         a << ")"
162:       end

[Validate]