-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTLMapTilesetOSM.m
49 lines (39 loc) · 1.18 KB
/
TLMapTilesetOSM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// TLMapTilesetOSM.m
// TileMap
//
// Created by Nathan Vander Wilt on 10/1/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "TLMapTilesetOSM.h"
#import "NSIndexPath+TLMapTileAdditions.h"
#import "TLMapSimpleLayer.h"
#import "TLMapProjection.h"
@implementation TLMapTilesetOSM
@synthesize projection;
@synthesize bounds;
- (NSUInteger)levelsOfDetail { return 16; }
- (NSUInteger)tileHeight { return 256; }
- (NSUInteger)tileWidth { return 256; }
- (NSUInteger)simultaneousFetchLimit { return 2; }
- (id)init {
self = [super init];
if (self) {
projection = [TLMapProjection new];
bounds = [TLMapSimpleLayer fakeProjectShape:[TLMapSimpleLayer worldBounds]
withProjection:projection];
}
return self;
}
- (void)dealloc {
[projection release];
[super dealloc];
}
- (NSURL*)urlForTile:(NSIndexPath*)tilePath {
NSURL* baseURL = [NSURL URLWithString:@"http://tile.openstreetmap.org/"];
//NSURL* baseURL = [NSURL URLWithString:@"http://example.com"];
NSString* path = [NSString stringWithFormat:@"%u/%u/%u.png",
[tilePath tl_detailLevel], [tilePath tl_column], [tilePath tl_row]];
return [NSURL URLWithString:path relativeToURL:baseURL];
}
@end