Authored by Hal Mueller

added Debug-build NSAsserts to verify tiles requested are within legal zoom range

@@ -33,6 +33,9 @@ @@ -33,6 +33,9 @@
33 33
34 -(NSString*) tileURL: (RMTile) tile 34 -(NSString*) tileURL: (RMTile) tile
35 { 35 {
  36 + NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)),
  37 + @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f",
  38 + self, tile.zoom, self.minZoom, self.maxZoom);
36 return [NSString stringWithFormat:@"http://a.tile.cloudmade.com/0199bdee456e59ce950b0156029d6934/2/%d/%d/%d/%d.png",[RMCloudMadeMapSource tileSideLength], tile.zoom, tile.x, tile.y]; 39 return [NSString stringWithFormat:@"http://a.tile.cloudmade.com/0199bdee456e59ce950b0156029d6934/2/%d/%d/%d/%d.png",[RMCloudMadeMapSource tileSideLength], tile.zoom, tile.x, tile.y];
37 } 40 }
38 41
@@ -31,8 +31,15 @@ @@ -31,8 +31,15 @@
31 31
32 -(NSString*) tileURL: (RMTile) tile 32 -(NSString*) tileURL: (RMTile) tile
33 { 33 {
  34 + NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)),
  35 + @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f",
  36 + self, tile.zoom, self.minZoom, self.maxZoom);
34 return [NSString stringWithFormat:@"http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.png", tile.zoom, tile.x, tile.y]; 37 return [NSString stringWithFormat:@"http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.png", tile.zoom, tile.x, tile.y];
35 } 38 }
36 39
  40 +-(NSString*) description
  41 +{
  42 + return @"OpenAerialMap";
  43 +}
37 44
38 @end 45 @end
@@ -31,6 +31,9 @@ @@ -31,6 +31,9 @@
31 31
32 -(NSString*) tileURL: (RMTile) tile 32 -(NSString*) tileURL: (RMTile) tile
33 { 33 {
  34 + NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)),
  35 + @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f",
  36 + self, tile.zoom, self.minZoom, self.maxZoom);
34 return [NSString stringWithFormat:@"http://tile.openstreetmap.org/%d/%d/%d.png", tile.zoom, tile.x, tile.y]; 37 return [NSString stringWithFormat:@"http://tile.openstreetmap.org/%d/%d/%d.png", tile.zoom, tile.x, tile.y];
35 } 38 }
36 39
@@ -38,6 +38,9 @@ @@ -38,6 +38,9 @@
38 38
39 -(NSString*) quadKeyForTile: (RMTile) tile 39 -(NSString*) quadKeyForTile: (RMTile) tile
40 { 40 {
  41 + NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)),
  42 + @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f",
  43 + self, tile.zoom, self.minZoom, self.maxZoom);
41 NSMutableString *quadKey = [NSMutableString string]; 44 NSMutableString *quadKey = [NSMutableString string];
42 for (int i = tile.zoom; i > 0; i--) 45 for (int i = tile.zoom; i > 0; i--)
43 { 46 {
@@ -691,7 +691,9 @@ @@ -691,7 +691,9 @@
691 GCC_ENABLE_FIX_AND_CONTINUE = NO; 691 GCC_ENABLE_FIX_AND_CONTINUE = NO;
692 GCC_PRECOMPILE_PREFIX_HEADER = YES; 692 GCC_PRECOMPILE_PREFIX_HEADER = YES;
693 GCC_PREFIX_HEADER = MapView_Prefix.pch; 693 GCC_PREFIX_HEADER = MapView_Prefix.pch;
694 - GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=0"; 694 + GCC_PREPROCESSOR_DEFINITIONS = (
  695 + "NS_BLOCK_ASSERTIONS=1",
  696 + );
695 HEADER_SEARCH_PATHS = ../Proj4; 697 HEADER_SEARCH_PATHS = ../Proj4;
696 PREBINDING = NO; 698 PREBINDING = NO;
697 PRODUCT_NAME = MapView; 699 PRODUCT_NAME = MapView;
@@ -17,5 +17,6 @@ @@ -17,5 +17,6 @@
17 17
18 #define RMLog(args...) // do nothing. 18 #define RMLog(args...) // do nothing.
19 #define LogMethod() 19 #define LogMethod()
  20 +#define NS_BLOCK_ASSERTIONS 1
20 #endif 21 #endif
21 22