Class: PlusCodes::CodeArea
- Inherits:
-
Object
- Object
- PlusCodes::CodeArea
- Defined in:
- lib/plus_codes/code_area.rb
Overview
- CodeArea
-
contains coordinates of a decoded Open Location Code(Plus+Codes).
The coordinates include the latitude and longitude of the lower left and upper right corners and the center of the bounding box for the area the code represents.
Instance Attribute Summary collapse
-
#latitude_center ⇒ Object
Returns the value of attribute latitude_center.
-
#latitude_height ⇒ Object
Returns the value of attribute latitude_height.
-
#longitude_center ⇒ Object
Returns the value of attribute longitude_center.
-
#longitude_width ⇒ Object
Returns the value of attribute longitude_width.
-
#south_latitude ⇒ Object
Returns the value of attribute south_latitude.
-
#west_longitude ⇒ Object
Returns the value of attribute west_longitude.
Instance Method Summary collapse
- #east_longitude ⇒ Object
-
#initialize(south_latitude, west_longitude, latitude_height, longitude_width) ⇒ CodeArea
constructor
Creates a [CodeArea].
- #north_latitude ⇒ Object
Constructor Details
#initialize(south_latitude, west_longitude, latitude_height, longitude_width) ⇒ CodeArea
Creates a [CodeArea].
20 21 22 23 24 25 26 27 |
# File 'lib/plus_codes/code_area.rb', line 20 def initialize(south_latitude, west_longitude, latitude_height, longitude_width) @south_latitude = south_latitude @west_longitude = west_longitude @latitude_height = latitude_height @longitude_width = longitude_width @latitude_center = south_latitude + latitude_height / 2.0 @longitude_center = west_longitude + longitude_width / 2.0 end |
Instance Attribute Details
#latitude_center ⇒ Object
Returns the value of attribute latitude_center.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def latitude_center @latitude_center end |
#latitude_height ⇒ Object
Returns the value of attribute latitude_height.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def latitude_height @latitude_height end |
#longitude_center ⇒ Object
Returns the value of attribute longitude_center.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def longitude_center @longitude_center end |
#longitude_width ⇒ Object
Returns the value of attribute longitude_width.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def longitude_width @longitude_width end |
#south_latitude ⇒ Object
Returns the value of attribute south_latitude.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def south_latitude @south_latitude end |
#west_longitude ⇒ Object
Returns the value of attribute west_longitude.
10 11 12 |
# File 'lib/plus_codes/code_area.rb', line 10 def west_longitude @west_longitude end |
Instance Method Details
#east_longitude ⇒ Object
33 34 35 |
# File 'lib/plus_codes/code_area.rb', line 33 def east_longitude @west_longitude + @longitude_width end |
#north_latitude ⇒ Object
29 30 31 |
# File 'lib/plus_codes/code_area.rb', line 29 def north_latitude @south_latitude + @latitude_height end |