module Geos::GoogleMaps::Api2::Geometry
Public Instance Methods
to_g_lat_lng_bounds_api2(options = {})
click to toggle source
Returns a new GLatLngBounds object with the proper GLatLngs in place for determining the geometry bounds.
# File lib/geos/google_maps/api_2.rb, line 10 def to_g_lat_lng_bounds_api2(options = {}) klass = if options[:short_class] 'GLatLngBounds' else 'google.maps.LatLngBounds' end "new #{klass}(#{self.lower_left.to_g_lat_lng_api2(options)}, #{self.upper_right.to_g_lat_lng_api2(options)})" end
to_g_lat_lng_bounds_string_api2(precision = 10)
click to toggle source
Returns a String in Google Maps' GLatLngBounds#toString() format.
# File lib/geos/google_maps/api_2.rb, line 21 def to_g_lat_lng_bounds_string_api2(precision = 10) "((#{self.lower_left.to_g_url_value(precision)}), (#{self.upper_right.to_g_url_value(precision)}))" end
to_g_marker_api2(marker_options = {}, options = {})
click to toggle source
Returns a new GMarker at the centroid of the geometry. The options Hash works the same as the Google Maps API GMarkerOptions class does, but allows for underscored Ruby-like options which are then converted to the appropriate camel-cased Javascript options.
# File lib/geos/google_maps/api_2.rb, line 39 def to_g_marker_api2(marker_options = {}, options = {}) klass = if options[:short_class] 'GMarker' else 'google.maps.Marker' end opts = Geos::Helper.camelize_keys(marker_options) "new #{klass}(#{self.centroid.to_g_lat_lng(options)}, #{opts.to_json})" end
to_g_polygon_api2(polygon_options = {}, options = {})
click to toggle source
Returns a new GPolygon.
# File lib/geos/google_maps/api_2.rb, line 31 def to_g_polygon_api2(polygon_options = {}, options = {}) self.coord_seq.to_g_polygon_api2(polygon_options, options) end
to_g_polyline_api2(polyline_options = {}, options = {})
click to toggle source
Returns a new GPolyline.
# File lib/geos/google_maps/api_2.rb, line 26 def to_g_polyline_api2(polyline_options = {}, options = {}) self.coord_seq.to_g_polyline_api2(polyline_options, options) end