root/trunk/processing/sketches/modest_maps/Providers.pde

Revision 489, 1.0 kB (checked in by tom, 6 months ago)

moving processing libs around

Line 
1
2
3 String[] ids =  {
4   "MICROSOFT_ROAD", "MICROSOFT_AERIAL", "MICROSOFT_HYBRID",
5   "GOOGLE_ROAD",    "GOOGLE_AERIAL",    "GOOGLE_HYBRID",
6   "YAHOO_ROAD",     "YAHOO_AERIAL",     "YAHOO_HYBRID",
7   "BLUE_MARBLE",
8   "OPEN_STREET_MAP" };
9
10 abstract class AbstractMapProvider {
11
12   AbstractProjection projection;
13
14   AbstractMapProvider(AbstractProjection projection) {
15     this.projection = projection;
16   }
17
18   abstract String[] getTileUrls(Coordinate coordinate);
19
20   abstract int tileWidth();
21
22   abstract int tileHeight();
23
24   Coordinate locationCoordinate(Location location) {
25     return projection.locationCoordinate(location);
26   }
27
28   Location coordinateLocation(Coordinate coordinate) {
29     return projection.coordinateLocation(coordinate);
30   }
31
32   Coordinate sourceCoordinate(Coordinate coordinate) {
33     float wrappedColumn = coordinate.column % pow(2, coordinate.zoom);
34
35     while (wrappedColumn < 0) {
36       wrappedColumn += pow(2, coordinate.zoom);
37     }
38
39     return new Coordinate(coordinate.row, wrappedColumn, coordinate.zoom);
40   }
41
42 }
Note: See TracBrowser for help on using the browser.