| 1 |
from Core import Coordinate |
|---|
| 2 |
from Geo import LinearProjection, MercatorProjection, Transformation |
|---|
| 3 |
|
|---|
| 4 |
import math |
|---|
| 5 |
|
|---|
| 6 |
ids = ('MICROSOFT_ROAD', 'MICROSOFT_AERIAL', 'MICROSOFT_HYBRID', |
|---|
| 7 |
'GOOGLE_ROAD', 'GOOGLE_AERIAL', 'GOOGLE_HYBRID', |
|---|
| 8 |
'YAHOO_ROAD', 'YAHOO_AERIAL', 'YAHOO_HYBRID', |
|---|
| 9 |
'BLUE_MARBLE', |
|---|
| 10 |
'OPEN_STREET_MAP') |
|---|
| 11 |
|
|---|
| 12 |
class IMapProvider: |
|---|
| 13 |
def __init__(self): |
|---|
| 14 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 15 |
|
|---|
| 16 |
def getTileUrls(self, coordinate): |
|---|
| 17 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 18 |
|
|---|
| 19 |
def getTileUrls(self, coordinate): |
|---|
| 20 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 21 |
|
|---|
| 22 |
def tileWidth(self): |
|---|
| 23 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 24 |
|
|---|
| 25 |
def tileHeight(self): |
|---|
| 26 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 27 |
|
|---|
| 28 |
def locationCoordinate(self, location): |
|---|
| 29 |
return self.projection.locationCoordinate(location) |
|---|
| 30 |
|
|---|
| 31 |
def coordinateLocation(self, location): |
|---|
| 32 |
return self.projection.coordinateLocation(location) |
|---|
| 33 |
|
|---|
| 34 |
def sourceCoordinate(self, coordinate): |
|---|
| 35 |
raise NotImplementedError("Abstract method not implemented by subclass.") |
|---|
| 36 |
|
|---|
| 37 |
def sourceCoordinate(self, coordinate): |
|---|
| 38 |
wrappedColumn = coordinate.column % math.pow(2, coordinate.zoom) |
|---|
| 39 |
|
|---|
| 40 |
while wrappedColumn < 0: |
|---|
| 41 |
wrappedColumn += math.pow(2, coordinate.zoom) |
|---|
| 42 |
|
|---|
| 43 |
return Coordinate(coordinate.row, wrappedColumn, coordinate.zoom) |
|---|