module Geos::GoogleMaps::Api3::GeometryCollection
Public Instance Methods
to_g_polygon_api3(polygon_options = {}, options = {})
click to toggle source
Returns a Ruby Array of Polygons for each geometry in the collection. If the :single option is set, a single Polygon
object will be returned with all of the geometries set in the Polygon's “path” attribute. You can also use to_g_polygon_single for the same effect.
# File lib/geos/google_maps/api_3.rb, line 192 def to_g_polygon_api3(polygon_options = {}, options = {}) if options[:single] self.to_g_polygon_single_api3(polygon_options, options) else self.collect do |p| p.to_g_polygon_api3(polygon_options, options) end end end
to_g_polygon_single_api3(polygon_options = {}, options = {})
click to toggle source
Behaves the same as to_g_polygon_api3
with the :single option set, where a single Google Maps Polygon
will be returned with all of the Polygons set in the Polygon's “path” attribute.
# File lib/geos/google_maps/api_3.rb, line 205 def to_g_polygon_single_api3(polygon_options = {}, options = {}) options = { :escape => [], :lat_lng_options => {} }.merge(options) opts = Geos::Helper.camelize_keys(polygon_options) opts[:paths] = %{[#{self.collect { |p| "[#{p.exterior_ring.coord_seq.to_g_lat_lng_api3(options[:lat_lng_options]).join(', ')}]" }.join(', ')}]} json = Geos::Helper.escape_json(opts, Geos::GoogleMaps::Api3Constants::UNESCAPED_POLY_OPTIONS - options[:escape]) "new google.maps.Polygon(#{json})" end
to_g_polyline_api3(polyline_options = {}, options = {})
click to toggle source
Returns a Ruby Array of Polylines for each geometry in the collection.
# File lib/geos/google_maps/api_3.rb, line 181 def to_g_polyline_api3(polyline_options = {}, options = {}) self.collect do |p| p.to_g_polyline_api3(polyline_options, options) end end
Also aliased as: to_g_polylines_api3