Authored by Thomas Rasch

o Added methods to hide/show individual tilesource layers

... ... @@ -242,6 +242,9 @@ typedef enum {
- (void)moveTileSourceAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource;
- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index;
#pragma mark - Cache
/// Clear all images from the #tileSource's caching system.
... ...
... ... @@ -1479,6 +1479,30 @@
[self setCenterProjectedPoint:centerPoint animated:NO];
}
- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource
{
NSArray *tileSources = [self tileSources];
for (NSUInteger i=0; i<[tileSources count]; ++i)
{
id <RMTileSource> currentTileSource = [tileSources objectAtIndex:i];
if (tileSource == currentTileSource)
{
[self setHidden:isHidden forTileSourceAtIndex:i];
break;
}
}
}
- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index
{
if (index >= [_tiledLayersSuperview.subviews count])
return;
((RMMapTiledLayerView *)[_tiledLayersSuperview.subviews objectAtIndex:index]).hidden = isHidden;
}
#pragma mark - Properties
- (UIView *)backgroundView
... ...
... ... @@ -9,6 +9,7 @@
#import "MainView.h"
#import "RMOpenStreetMapSource.h"
#import "RMOpenSeaMapLayer.h"
#import "RMMapView.h"
#import "RMMarker.h"
#import "RMCircle.h"
... ... @@ -111,6 +112,22 @@
[self updateInfo];
[self performSelector:@selector(addMarkers) withObject:nil afterDelay:0.5];
// double delayInSeconds = 5.0;
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
// [mapView addTileSource:[[[RMOpenSeaMapLayer alloc] init] autorelease]];
//
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
// [mapView setHidden:YES forTileSourceAtIndex:1];
//
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
// [mapView setHidden:NO forTileSourceAtIndex:1];
// });
// });
// });
}
- (void)didReceiveMemoryWarning
... ...