Class: GeoWeb::Coordinate

Inherits:
Point
  • Object
show all
Defined in:
lib/geoweb/coordinate.rb

Constant Summary collapse

MAX_ZOOM =
25

Instance Attribute Summary

Attributes inherited from Point

#x, #y, #z

Instance Method Summary collapse

Methods inherited from Point

#*, #+, #-, #/, #==, from_array, from_hash, #initialize, #round, #round!, #to_a, #to_hash, #to_s, #|

Constructor Details

This class inherits a constructor from GeoWeb::Point

Instance Method Details

#zoom_by(distance) ⇒ Object



18
19
20
21
22
# File 'lib/geoweb/coordinate.rb', line 18

def zoom_by(distance)
  self.class.new(self.x * 2 ** distance,
                 self.y * 2 ** distance,
                 self.z + distance)
end

#zoom_to(destination) ⇒ Object



12
13
14
15
16
# File 'lib/geoweb/coordinate.rb', line 12

def zoom_to(destination)
  self.class.new(self.x * 2 ** (destination - self.z),
                 self.y * 2 ** (destination - self.z),
                 destination)
end