Class: MarsGeo::Point
- Inherits:
-
Object
- Object
- MarsGeo::Point
- Defined in:
- lib/mars_geo/point.rb
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lng ⇒ Object
Returns the value of attribute lng.
Instance Method Summary collapse
-
#initialize(lat, lng) ⇒ Point
constructor
A new instance of Point.
- #offset ⇒ Object
Constructor Details
#initialize(lat, lng) ⇒ Point
Returns a new instance of Point.
6 7 8 |
# File 'lib/mars_geo/point.rb', line 6 def initialize(lat,lng) self.lat, self.lng = lat, lng end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
3 4 5 |
# File 'lib/mars_geo/point.rb', line 3 def lat @lat end |
#lng ⇒ Object
Returns the value of attribute lng.
3 4 5 |
# File 'lib/mars_geo/point.rb', line 3 def lng @lng end |
Instance Method Details
#offset ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/mars_geo/point.rb', line 12 def offset temp_lat = self.lat * 3686400 temp_lng = self.lng * 3686400 converter = Converter.new hash_point = converter.wgtochina_lb(1,temp_lat.to_i,temp_lng.to_i,0,0,0) temp_lat = hash_point[:lat] / 3686400.0 temp_lng = hash_point[:lng] / 3686400.0 Point.new(temp_lat,temp_lng) end |