| Class | Ym4r::GmPlugin::GPolyline |
| In: |
lib/gm_plugin/overlay.rb
|
| Parent: | Object |
| color | [RW] | |
| opacity | [RW] | |
| points | [RW] | |
| weight | [RW] |
Can take an array of GLatLng or an array of 2D arrays. A method to directly build a polyline from a GeoRuby linestring is provided in the helper.rb file.
# File lib/gm_plugin/overlay.rb, line 87
87: def initialize(points,color = nil,weight = nil,opacity = nil)
88: if !points.empty? and points[0].is_a?(Array)
89: @points = points.collect { |pt| GLatLng.new(pt) }
90: else
91: @points = points
92: end
93: @color = color
94: @weight = weight
95: @opacity = opacity
96: end
Creates a new polyline.
# File lib/gm_plugin/overlay.rb, line 98
98: def create
99: a = "new GPolyline(#{MappingObject.javascriptify_variable(points)}"
100: a << ",#{MappingObject.javascriptify_variable(@color)}" if @color
101: a << ",#{MappingObject.javascriptify_variable(@weight)}" if @weight
102: a << ",#{MappingObject.javascriptify_variable(@opacity)}" if @opacity
103: a << ")"
104: end