module Geos::GoogleMaps::Api2::CoordinateSequence
Public Instance Methods
Returns a Ruby Array of GLatLngs.
# File lib/geos/google_maps/api_2.rb, line 54 def to_g_lat_lng_api2(options = {}) klass = if options[:short_class] 'GLatLng' else 'google.maps.LatLng' end self.to_a.collect do |p| "new #{klass}(#{p[1]}, #{p[0]})" end end
Returns a new GPolygon. Note that this GPolygon just uses whatever coordinates are found in the sequence in order, so it might not make much sense at all.
The options Hash follows the Google Maps API arguments to the GPolygon constructor and include :stroke_color, :stroke_weight, :stroke_opacity, :fill_color, :fill_opacity and :options. 'null' is used in place of any unset options.
# File lib/geos/google_maps/api_2.rb, line 102 def to_g_polygon_api2(polygon_options = {}, options = {}) klass = if options[:short_class] 'GPolygon' else 'google.maps.Polygon' end poly_opts = if polygon_options[:polygon_options] Geos::Helper.camelize_keys(polygon_options[:polygon_options]) end args = [ (polygon_options[:stroke_color] ? "'#{Geos::Helper.escape_javascript(polygon_options[:stroke_color])}'" : 'null'), (polygon_options[:stroke_weight] || 'null'), (polygon_options[:stroke_opacity] || 'null'), (polygon_options[:fill_color] ? "'#{Geos::Helper.escape_javascript(polygon_options[:fill_color])}'" : 'null'), (polygon_options[:fill_opacity] || 'null'), (poly_opts ? poly_opts.to_json : 'null') ].join(', ') "new #{klass}([#{self.to_g_lat_lng_api2(options).join(', ')}], #{args})" end
Returns a new GPolyline. Note that this GPolyline just uses whatever coordinates are found in the sequence in order, so it might not make much sense at all.
The options Hash follows the Google Maps API arguments to the GPolyline constructor and include :color, :weight, :opacity and :options. 'null' is used in place of any unset options.
# File lib/geos/google_maps/api_2.rb, line 73 def to_g_polyline_api2(polyline_options = {}, options = {}) klass = if options[:short_class] 'GPolyline' else 'google.maps.Polyline' end poly_opts = if polyline_options[:polyline_options] Geos::Helper.camelize_keys(polyline_options[:polyline_options]) end args = [ (polyline_options[:color] ? "'#{Geos::Helper.escape_javascript(polyline_options[:color])}'" : 'null'), (polyline_options[:weight] || 'null'), (polyline_options[:opacity] || 'null'), (poly_opts ? poly_opts.to_json : 'null') ].join(', ') "new #{klass}([#{self.to_g_lat_lng(options).join(', ')}], #{args})" end