Changeset 558
- Timestamp:
- 05/06/08 12:32:07 (7 months ago)
- Files:
-
- trunk/py/ModestMaps/Core.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/py/ModestMaps/Core.py
r317 r558 42 42 43 43 class Coordinate: 44 MAX_ZOOM = 2 044 MAX_ZOOM = 25 45 45 46 46 def __init__(self, row, column, zoom): … … 53 53 54 54 def copy(self): 55 return Coordinate(self.row, self.column, self.zoom)55 return self.__class__(self.row, self.column, self.zoom) 56 56 57 57 def container(self): 58 return Coordinate(math.floor(self.row), math.floor(self.column), self.zoom)58 return self.__class__(math.floor(self.row), math.floor(self.column), self.zoom) 59 59 60 60 def zoomTo(self, destination): 61 return Coordinate(self.row * math.pow(2, destination - self.zoom),62 self.column * math.pow(2, destination - self.zoom),63 destination)61 return self.__class__(self.row * math.pow(2, destination - self.zoom), 62 self.column * math.pow(2, destination - self.zoom), 63 destination) 64 64 65 65 def zoomBy(self, distance): 66 return Coordinate(self.row * math.pow(2, distance),67 self.column * math.pow(2, distance),68 self.zoom + distance)66 return self.__class__(self.row * math.pow(2, distance), 67 self.column * math.pow(2, distance), 68 self.zoom + distance) 69 69 70 70 def up(self, distance=1): 71 return Coordinate(self.row - distance, self.column, self.zoom)71 return self.__class__(self.row - distance, self.column, self.zoom) 72 72 73 73 def right(self, distance=1): 74 return Coordinate(self.row, self.column + distance, self.zoom)74 return self.__class__(self.row, self.column + distance, self.zoom) 75 75 76 76 def down(self, distance=1): 77 return Coordinate(self.row + distance, self.column, self.zoom)77 return self.__class__(self.row + distance, self.column, self.zoom) 78 78 79 79 def left(self, distance=1): 80 return Coordinate(self.row, self.column - distance, self.zoom)80 return self.__class__(self.row, self.column - distance, self.zoom) 81 81 82 82 if __name__ == '__main__':
