Module: Geos::GoogleMaps::Api3::Geometry
- Includes:
- Geos::GoogleMaps::ApiCommon::Geometry
- Defined in:
- lib/geos/google_maps/api_3.rb
Instance Method Summary collapse
-
#to_g_geocoder_bounds_api3(precision = 6) ⇒ Object
Returns a bounds parameter for the Google Maps API 3 geocoder service.
-
#to_g_lat_lng_bounds_api3(options = {}) ⇒ Object
Returns a new LatLngBounds object with the proper LatLngs in place for determining the geometry bounds.
-
#to_g_lat_lng_bounds_string_api3(precision = 10) ⇒ Object
Returns a String in Google Maps’ LatLngBounds#toString() format.
-
#to_g_marker_api3(marker_options = {}, options = {}) ⇒ Object
Returns a new Marker at the centroid of the geometry.
-
#to_g_polygon_api3(polygon_options = {}, options = {}) ⇒ Object
Returns a new Polygon.
-
#to_g_polyline_api3(polyline_options = {}, options = {}) ⇒ Object
Returns a new Polyline.
Methods included from Geos::GoogleMaps::ApiCommon::Geometry
#to_g_json_point, #to_g_lat_lon_box, #to_g_url_value, #to_g_url_value_bounds
Instance Method Details
#to_g_geocoder_bounds_api3(precision = 6) ⇒ Object
Returns a bounds parameter for the Google Maps API 3 geocoder service.
38 39 40 |
# File 'lib/geos/google_maps/api_3.rb', line 38 def to_g_geocoder_bounds_api3(precision = 6) "#{self.lower_left.to_g_url_value(precision)}|#{self.upper_right.to_g_url_value(precision)}" end |
#to_g_lat_lng_bounds_api3(options = {}) ⇒ Object
Returns a new LatLngBounds object with the proper LatLngs in place for determining the geometry bounds.
33 34 35 |
# File 'lib/geos/google_maps/api_3.rb', line 33 def to_g_lat_lng_bounds_api3( = {}) "new google.maps.LatLngBounds(#{self.lower_left.to_g_lat_lng_api3()}, #{self.upper_right.to_g_lat_lng_api3()})" end |
#to_g_lat_lng_bounds_string_api3(precision = 10) ⇒ Object
Returns a String in Google Maps’ LatLngBounds#toString() format.
43 44 45 |
# File 'lib/geos/google_maps/api_3.rb', line 43 def to_g_lat_lng_bounds_string_api3(precision = 10) "((#{self.lower_left.to_g_url_value(precision)}), (#{self.upper_right.to_g_url_value(precision)}))" end |
#to_g_marker_api3(marker_options = {}, options = {}) ⇒ Object
Returns a new Marker at the centroid of the geometry. The options Hash works the same as the Google Maps API MarkerOptions class does, but allows for underscored Ruby-like options which are then converted to the appropriate camel-cased Javascript options.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/geos/google_maps/api_3.rb', line 61 def to_g_marker_api3( = {}, = {}) = { :escape => [], :lat_lng_options => {} }.merge() opts = Geos::Helper.camelize_keys() opts[:position] = self.centroid.to_g_lat_lng([:lat_lng_options]) json = Geos::Helper.escape_json(opts, Geos::GoogleMaps::Api3Constants::UNESCAPED_MARKER_OPTIONS - [:escape]) "new google.maps.Marker(#{json})" end |
#to_g_polygon_api3(polygon_options = {}, options = {}) ⇒ Object
Returns a new Polygon.
53 54 55 |
# File 'lib/geos/google_maps/api_3.rb', line 53 def to_g_polygon_api3( = {}, = {}) self.coord_seq.to_g_polygon_api3(, ) end |
#to_g_polyline_api3(polyline_options = {}, options = {}) ⇒ Object
Returns a new Polyline.
48 49 50 |
# File 'lib/geos/google_maps/api_3.rb', line 48 def to_g_polyline_api3( = {}, = {}) self.coord_seq.to_g_polyline_api3(, ) end |