module Geos::GoogleMaps::Api3::CoordinateSequence
Public Instance Methods
Returns a Ruby Array of LatLngs.
# File lib/geos/google_maps/api_3.rb, line 79 def to_g_lat_lng_api3(options = {}) self.to_a.collect do |p| "new google.maps.LatLng(#{p[1]}, #{p[0]})" end end
Returns a new Polygon
. Note that this Polygon
just uses whatever coordinates are found in the sequence in order, so it might not make much sense at all.
The polygon_options Hash follows the Google Maps API arguments to the Polyline constructor and include :clickable, :geodesic, :map, etc. See the Google Maps API documentation for details.
The options Hash allows you to specify if certain arguments should be escaped on output. Usually the options in UNESCAPED_POLY_OPTIONS are escaped, but if for some reason you want some other options to be escaped, pass them along in options. The options Hash also passes along options to to_g_lat_lng_api3.
# File lib/geos/google_maps/api_3.rb, line 124 def to_g_polygon_api3(polygon_options = {}, options = {}) options = { :escape => [], :lat_lng_options => {} }.merge(options) opts = Geos::Helper.camelize_keys(polygon_options) opts[:paths] = "[#{self.to_g_lat_lng_api3(options[:lat_lng_options]).join(', ')}]" json = Geos::Helper.escape_json(opts, Geos::GoogleMaps::Api3Constants::UNESCAPED_POLY_OPTIONS - options[:escape]) "new google.maps.Polygon(#{json})" end
Returns a new Polyline. Note that this Polyline just uses whatever coordinates are found in the sequence in order, so it might not make much sense at all.
The polyline_options Hash follows the Google Maps API arguments to the Polyline constructor and include :clickable, :geodesic, :map, etc. See the Google Maps API documentation for details.
The options Hash allows you to specify if certain arguments should be escaped on output. Usually the options in UNESCAPED_POLY_OPTIONS are escaped, but if for some reason you want some other options to be escaped, pass them along in options. The options Hash also passes along options to to_g_lat_lng_api3.
# File lib/geos/google_maps/api_3.rb, line 98 def to_g_polyline_api3(polyline_options = {}, options = {}) options = { :escape => [], :lat_lng_options => {} }.merge(options) opts = Geos::Helper.camelize_keys(polyline_options) opts[:path] = "[#{self.to_g_lat_lng_api3(options[:lat_lng_options]).join(', ')}]" json = Geos::Helper.escape_json(opts, Geos::GoogleMaps::Api3Constants::UNESCAPED_POLY_OPTIONS - options[:escape]) "new google.maps.Polyline(#{json})" end