Authored by Hal Mueller

fixed zoomInToNextNativeZoomAt:animated:/zoomOutToNextNativeZoomAt:animated: per…

… mailing list discussions, and Cocoaized some more internal method names
... ... @@ -82,19 +82,19 @@
return nil;
}
-(RMTileImage *) tileImage: (RMTile)tile
-(RMTileImage *)tileImage:(RMTile)tile
{
RMTileImage *image;
tile = [tileProjection normaliseTile:tile];
NSString *file = [self tileFile:tile];
if(file && [[NSFileManager defaultManager] fileExistsAtPath:file])
{
image = [RMTileImage imageWithTile:tile FromFile:file];
image = [RMTileImage imageForTile:tile fromFile:file];
} else {
image = [RMTileImage imageWithTile:tile FromURL:[self tileURL:tile]];
image = [RMTileImage imageForTile:tile withURL:[self tileURL:tile]];
}
return image;
... ... @@ -112,7 +112,7 @@
-(void) didReceiveMemoryWarning
{
LogMethod();
LogMethod();
}
-(NSString *)uniqueTilecacheKey
... ...
... ... @@ -158,7 +158,7 @@
}
RMTileImage *image = [RMTileImage imageWithTile:tile FromData:data];
RMTileImage *image = [RMTileImage imageForTile:tile withData:data];
// RMLog(@"DB cache hit for tile %d %d %d", tile.x, tile.y, tile.zoom);
return image;
}
... ...
... ... @@ -36,16 +36,16 @@
\bug lots of arbitrary-appearing \@synchronized blocks. Old mailing list traffic
claims they're needed, but no one seems to know why. If the #set ivar needs to be guarded,
should be done by \@synchronized(self) and not \@synchronized(set). Maybe the guarding
should be done by \@synchronized(self) and not \@synchronized(sublayers). Maybe the guarding
is needed because of Core Animation thread interactions.
*/
@interface RMLayerSet : RMMapLayer
@interface RMLayerCollection : RMMapLayer
{
/// This is the set of all sublayers, including those offscreen.
/// The actual collection of all sublayers, including those offscreen.
/// It is ordered back to front.
NSMutableArray *set;
NSMutableArray *sublayers;
/// We need this reference so we can access the projections...
/// Backpointer to map; we need this reference so we can access the projections...
RMMapContents *mapContents;
}
... ...
... ... @@ -25,18 +25,18 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#import "RMLayerSet.h"
#import "RMLayerCollection.h"
#import "RMMapContents.h"
#import "RMMercatorToScreenProjection.h"
@implementation RMLayerSet
@implementation RMLayerCollection
- (id)initForContents: (RMMapContents *)_contents
{
if (![super init])
return nil;
set = [[NSMutableArray alloc] init];
sublayers = [[NSMutableArray alloc] init];
mapContents = _contents;
self.masksToBounds = YES;
return self;
... ... @@ -44,8 +44,8 @@
- (void) dealloc
{
[set release];
set = nil;
[sublayers release];
sublayers = nil;
mapContents = nil;
[super dealloc];
}
... ... @@ -69,36 +69,36 @@
{
[self correctScreenPosition:layer];
}
@synchronized(set) {
[set removeAllObjects];
[set addObjectsFromArray:array];
@synchronized(sublayers) {
[sublayers removeAllObjects];
[sublayers addObjectsFromArray:array];
[super setSublayers:array];
}
}
- (void)addSublayer:(CALayer *)layer
{
@synchronized(set) {
@synchronized(sublayers) {
[self correctScreenPosition:layer];
[set addObject:layer];
[sublayers addObject:layer];
[super addSublayer:layer];
}
}
- (void)removeSublayer:(CALayer *)layer
{
@synchronized(set) {
[set removeObject:layer];
@synchronized(sublayers) {
[sublayers removeObject:layer];
[layer removeFromSuperlayer];
}
}
- (void)removeSublayers:(NSArray *)layers
{
@synchronized(set) {
@synchronized(sublayers) {
for(CALayer *aLayer in layers)
{
[set removeObject:aLayer];
[sublayers removeObject:aLayer];
[aLayer removeFromSuperlayer];
}
}
... ... @@ -106,29 +106,29 @@
- (void)insertSublayer:(CALayer *)layer above:(CALayer *)siblingLayer
{
@synchronized(set) {
@synchronized(sublayers) {
[self correctScreenPosition:layer];
NSUInteger index = [set indexOfObject:siblingLayer];
[set insertObject:layer atIndex:index + 1];
NSUInteger index = [sublayers indexOfObject:siblingLayer];
[sublayers insertObject:layer atIndex:index + 1];
[super insertSublayer:layer above:siblingLayer];
}
}
- (void)insertSublayer:(CALayer *)layer below:(CALayer *)siblingLayer
{
@synchronized(set) {
@synchronized(sublayers) {
[self correctScreenPosition:layer];
NSUInteger index = [set indexOfObject:siblingLayer];
[set insertObject:layer atIndex:index];
NSUInteger index = [sublayers indexOfObject:siblingLayer];
[sublayers insertObject:layer atIndex:index];
[super insertSublayer:layer below:siblingLayer];
}
}
- (void)insertSublayer:(CALayer *)layer atIndex:(unsigned)index
{
@synchronized(set) {
@synchronized(sublayers) {
[self correctScreenPosition:layer];
[set insertObject:layer atIndex:index];
[sublayers insertObject:layer atIndex:index];
/// \bug TODO: Fix this.
[super addSublayer:layer];
... ... @@ -149,8 +149,8 @@
- (void)moveBy: (CGSize) delta
{
@synchronized(set) {
for (id layer in set)
@synchronized(sublayers) {
for (id layer in sublayers)
{
if ([layer respondsToSelector:@selector(moveBy:)])
[layer moveBy:delta];
... ... @@ -162,8 +162,8 @@
- (void)zoomByFactor: (float) zoomFactor near:(CGPoint) center
{
@synchronized(set) {
for (id layer in set)
@synchronized(sublayers) {
for (id layer in sublayers)
{
if ([layer respondsToSelector:@selector(zoomByFactor:near:)])
[layer zoomByFactor:zoomFactor near:center];
... ... @@ -173,8 +173,8 @@
- (void) correctPositionOfAllSublayers
{
@synchronized(set) {
for (id layer in set)
@synchronized(sublayers) {
for (id layer in sublayers)
{
[self correctScreenPosition:layer];
}
... ... @@ -183,7 +183,7 @@
- (BOOL) hasSubLayer:(CALayer *)layer
{
return [set containsObject:layer];
return [sublayers containsObject:layer];
}
@end
... ...
... ... @@ -57,7 +57,7 @@ enum {
@class RMTileLoader;
@class RMMapRenderer;
@class RMMapLayer;
@class RMLayerSet;
@class RMLayerCollection;
@class RMMarker;
@protocol RMMercatorToTileProjection;
@protocol RMTileSource;
... ... @@ -89,7 +89,7 @@ enum {
/// subview for the image displayed while tiles are loading. Set its contents by providing your own "loading.png".
RMMapLayer *background;
/// subview for markers and paths
RMLayerSet *overlay;
RMLayerCollection *overlay;
/// (guess) the projection object to convert from latitude/longitude to meters.
/// Latlong is calculated dynamically from mercatorBounds.
... ... @@ -142,7 +142,7 @@ enum {
@property (readonly) CALayer *layer;
@property (retain, readwrite) RMMapLayer *background;
@property (retain, readwrite) RMLayerSet *overlay;
@property (retain, readwrite) RMLayerCollection *overlay;
@property (retain, readonly) RMMarkerManager *markerManager;
/// \bug probably shouldn't be retaining this delegate
@property (nonatomic, retain) id<RMTilesUpdateDelegate> tilesUpdateDelegate;
... ...
... ... @@ -42,7 +42,7 @@
#import "RMCoreAnimationRenderer.h"
#import "RMCachedTileSource.h"
#import "RMLayerSet.h"
#import "RMLayerCollection.h"
#import "RMMarkerManager.h"
#import "RMMarker.h"
... ... @@ -156,7 +156,7 @@
[self setBackground:theBackground];
[theBackground release];
RMLayerSet *theOverlay = [[RMLayerSet alloc] initForContents:self];
RMLayerCollection *theOverlay = [[RMLayerCollection alloc] initForContents:self];
[self setOverlay:theOverlay];
[theOverlay release];
... ... @@ -241,7 +241,7 @@
[self setBackground:theBackground];
[theBackground release];
RMLayerSet *theOverlay = [[RMLayerSet alloc] initForContents:self];
RMLayerCollection *theOverlay = [[RMLayerCollection alloc] initForContents:self];
[self setOverlay:theOverlay];
[theOverlay release];
... ... @@ -540,31 +540,24 @@
- (void)zoomInToNextNativeZoomAt:(CGPoint) pivot animated:(BOOL) animated
{
// Calculate rounded zoom
float newZoom = roundf([self zoom] + 1);
float newZoom = fmin(floorf([self zoom] + 1.0), [self maxZoom]);
//RMLog(@"[self minZoom] %f [self zoom] %f [self maxZoom] %f newzoom %f", [self minZoom], [self zoom], [self maxZoom], newZoom);
if (newZoom >= [self maxZoom])
return;
else
{
float factor = exp2f(newZoom - [self zoom]);
[self zoomByFactor:factor near:pivot animated:animated];
}
float factor = exp2f(newZoom - [self zoom]);
[self zoomByFactor:factor near:pivot animated:animated];
}
- (void)zoomOutToNextNativeZoomAt:(CGPoint) pivot animated:(BOOL) animated {
// Calculate rounded zoom
float newZoom = roundf([self zoom] - 1);
if (newZoom <= [self minZoom])
return;
else {
float factor = exp2f(newZoom - [self zoom]);
[self zoomByFactor:factor near:pivot animated:animated];
}
// Calculate rounded zoom
float newZoom = fmax(ceilf([self zoom] - 1.0), [self minZoom]);
//RMLog(@"[self minZoom] %f [self zoom] %f [self maxZoom] %f newzoom %f", [self minZoom], [self zoom], [self maxZoom], newZoom);
float factor = exp2f(newZoom - [self zoom]);
[self zoomByFactor:factor near:pivot animated:animated];
}
- (void)zoomOutToNextNativeZoomAt:(CGPoint) pivot {
[self zoomOutToNextNativeZoomAt: pivot animated: FALSE];
[self zoomOutToNextNativeZoomAt: pivot animated: FALSE];
}
... ... @@ -677,7 +670,7 @@
return [[background retain] autorelease];
}
- (void) setOverlay: (RMLayerSet*) aLayer
- (void) setOverlay: (RMLayerCollection*) aLayer
{
if (overlay == aLayer) return;
... ... @@ -711,7 +704,7 @@
[overlay addSublayer:testLayer];*/
}
- (RMLayerSet *)overlay
- (RMLayerCollection *)overlay
{
return [[overlay retain] autorelease];
}
... ...
... ... @@ -40,7 +40,6 @@
- (id)initWithContents:(RMMapContents *)mapContents;
- (void) addMarker: (RMMarker*)marker;
- (void) addMarker: (RMMarker*)marker AtLatLong:(CLLocationCoordinate2D)point;
- (void) removeMarkers;
- (void) hideAllMarkers;
... ...
... ... @@ -28,7 +28,7 @@
#import "RMMarkerManager.h"
#import "RMMercatorToScreenProjection.h"
#import "RMProjection.h"
#import "RMLayerSet.h"
#import "RMLayerCollection.h"
@implementation RMMarkerManager
... ... @@ -54,16 +54,12 @@
#pragma mark
#pragma mark Adding / Removing / Displaying Markers
- (void) addMarker: (RMMarker*)marker
{
[[contents overlay] addSublayer:marker];
}
/// place the (newly created) marker onto the map and take ownership of it
/// \bug should return the marker
- (void) addMarker: (RMMarker*)marker AtLatLong:(CLLocationCoordinate2D)point
{
[marker setProjectedLocation:[[contents projection]latLongToPoint:point]];
[self addMarker: marker];
[[contents overlay] addSublayer:marker];
}
/// \bug see http://code.google.com/p/route-me/issues/detail?id=75
... ...
... ... @@ -72,9 +72,9 @@ extern NSString * const RMMapImageLoadingCancelledNotification;
//- (id) increaseLoadingPriority;
//- (id) decreaseLoadingPriority;
+ (RMTileImage*)imageWithTile: (RMTile) tile FromURL: (NSString*)url;
+ (RMTileImage*)imageWithTile: (RMTile) tile FromFile: (NSString*)filename;
+ (RMTileImage*)imageWithTile: (RMTile) tile FromData: (NSData*)data;
+ (RMTileImage*)imageForTile: (RMTile) tile withURL: (NSString*)url;
+ (RMTileImage*)imageForTile: (RMTile) tile fromFile: (NSString*)filename;
+ (RMTileImage*)imageForTile: (RMTile) tile withData: (NSData*)data;
- (void)drawInRect:(CGRect)rect;
- (void)draw;
... ... @@ -86,7 +86,7 @@ extern NSString * const RMMapImageLoadingCancelledNotification;
- (void)cancelLoading;
- (void)setImageToData: (NSData*) data;
- (void)updateImageUsingData: (NSData*) data;
- (void)touch;
... ...
... ... @@ -128,20 +128,20 @@ NSString * const RMMapImageLoadingCancelledNotification = @"MapImageLoadingCance
[self drawInRect:screenLocation];
}
+ (RMTileImage*)imageWithTile: (RMTile) _tile FromURL: (NSString*)url
+ (RMTileImage*)imageForTile:(RMTile) _tile withURL: (NSString*)url
{
return [[[RMWebTileImage alloc] initWithTile:_tile FromURL:url] autorelease];
}
+ (RMTileImage*)imageWithTile: (RMTile) _tile FromFile: (NSString*)filename
+ (RMTileImage*)imageForTile:(RMTile) _tile fromFile: (NSString*)filename
{
return [[[RMFileTileImage alloc] initWithTile: _tile FromFile:filename] autorelease];
}
+ (RMTileImage*)imageWithTile: (RMTile) tile FromData: (NSData*)data
+ (RMTileImage*)imageForTile:(RMTile) tile withData: (NSData*)data
{
RMTileImage *image = [[RMTileImage alloc] initWithTile:tile];
[image setImageToData:data];
[image updateImageUsingData:data];
return [image autorelease];
}
... ... @@ -155,7 +155,7 @@ NSString * const RMMapImageLoadingCancelledNotification = @"MapImageLoadingCance
{
if (dataPending != nil)
{
[self setImageToData:dataPending];
[self updateImageUsingData:dataPending];
[dataPending release];
dataPending = nil;
... ... @@ -165,7 +165,7 @@ NSString * const RMMapImageLoadingCancelledNotification = @"MapImageLoadingCance
[[NSNotificationCenter defaultCenter] removeObserver:self name:RMResumeExpensiveOperations object:nil];
}
- (void)setImageToData: (NSData*) data
- (void)updateImageUsingData: (NSData*) data
{
if ([RMMapContents performExpensiveOperations] == NO)
{
... ...
... ... @@ -51,7 +51,7 @@ static RMTileImage *_loadingTile = nil;
RMTile t = RMTileDummy();
/// \bug magic string literals
NSString* file = [[NSBundle mainBundle] pathForResource:@"loading" ofType:@"png"];
_loadingTile = [[RMTileImage imageWithTile:t FromFile:file] retain];
_loadingTile = [[RMTileImage imageForTile:t fromFile:file] retain];
return _loadingTile;
// return nil;
}
... ...
... ... @@ -54,7 +54,7 @@
if (cachedData != nil)
{
// RMLog(@"Using cached image");
[self setImageToData:[cachedData data]];
[self updateImageUsingData:[cachedData data]];
}
else
{
... ... @@ -194,7 +194,7 @@ didReceiveResponse:(NSURLResponse *)response
- (void)connectionDidFinishLoading:(NSURLConnection *)_connection
{
[self setImageToData:data];
[self updateImageUsingData:data];
[data release];
data = nil;
... ...
... ... @@ -62,7 +62,7 @@
2BEC60370F8AC718008FB858 /* RMFoundation.c in Sources */ = {isa = PBXBuildFile; fileRef = 23A0AAE80EB90A99003A4521 /* RMFoundation.c */; };
2BEC60380F8AC71A008FB858 /* RMFractalTileProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64EA0E80E73F001663B6 /* RMFractalTileProjection.m */; };
2BEC60390F8AC71C008FB858 /* RMGeoHash.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C12D290F8A86CA00A894D2 /* RMGeoHash.m */; };
2BEC603A0F8AC71D008FB858 /* RMLayerSet.m in Sources */ = {isa = PBXBuildFile; fileRef = B8FA92180E9315EC003A9FE6 /* RMLayerSet.m */; };
2BEC603A0F8AC71D008FB858 /* RMLayerCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = B8FA92180E9315EC003A9FE6 /* RMLayerCollection.m */; };
2BEC603B0F8AC71E008FB858 /* RMMapContents.m in Sources */ = {isa = PBXBuildFile; fileRef = B8C974B70E8A280A007D16AD /* RMMapContents.m */; };
2BEC603C0F8AC71F008FB858 /* RMMapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */; };
2BEC603D0F8AC722008FB858 /* RMMapRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = B83E64CB0E80E73F001663B6 /* RMMapRenderer.m */; };
... ... @@ -173,8 +173,8 @@
B8F3FC610EA2B382004D8F85 /* RMMapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */; };
B8F3FC640EA2E792004D8F85 /* RMMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F3FC620EA2E792004D8F85 /* RMMarker.h */; };
B8F3FC650EA2E792004D8F85 /* RMMarker.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC630EA2E792004D8F85 /* RMMarker.m */; };
B8FA92190E9315EC003A9FE6 /* RMLayerSet.h in Headers */ = {isa = PBXBuildFile; fileRef = B8FA92170E9315EC003A9FE6 /* RMLayerSet.h */; };
B8FA921A0E9315EC003A9FE6 /* RMLayerSet.m in Sources */ = {isa = PBXBuildFile; fileRef = B8FA92180E9315EC003A9FE6 /* RMLayerSet.m */; };
B8FA92190E9315EC003A9FE6 /* RMLayerCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = B8FA92170E9315EC003A9FE6 /* RMLayerCollection.h */; };
B8FA921A0E9315EC003A9FE6 /* RMLayerCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = B8FA92180E9315EC003A9FE6 /* RMLayerCollection.m */; };
F5C12D2A0F8A86CA00A894D2 /* RMGeoHash.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C12D280F8A86CA00A894D2 /* RMGeoHash.h */; };
F5C12D2B0F8A86CA00A894D2 /* RMGeoHash.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C12D290F8A86CA00A894D2 /* RMGeoHash.m */; };
/* End PBXBuildFile section */
... ... @@ -326,8 +326,8 @@
B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapLayer.m; sourceTree = "<group>"; };
B8F3FC620EA2E792004D8F85 /* RMMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMarker.h; sourceTree = "<group>"; };
B8F3FC630EA2E792004D8F85 /* RMMarker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMarker.m; sourceTree = "<group>"; };
B8FA92170E9315EC003A9FE6 /* RMLayerSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMLayerSet.h; sourceTree = "<group>"; };
B8FA92180E9315EC003A9FE6 /* RMLayerSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMLayerSet.m; sourceTree = "<group>"; };
B8FA92170E9315EC003A9FE6 /* RMLayerCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMLayerCollection.h; sourceTree = "<group>"; };
B8FA92180E9315EC003A9FE6 /* RMLayerCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMLayerCollection.m; sourceTree = "<group>"; };
C7A967500E8412930031BA75 /* RMAbstractMercatorWebSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMAbstractMercatorWebSource.h; sourceTree = "<group>"; };
C7A967510E8412930031BA75 /* RMAbstractMercatorWebSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMAbstractMercatorWebSource.m; sourceTree = "<group>"; };
C7A9675C0E84134B0031BA75 /* RMVirtualEarthSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMVirtualEarthSource.h; sourceTree = "<group>"; };
... ... @@ -631,8 +631,8 @@
090C948C0EC23FCD003AEE25 /* RMMarkerManager.m */,
B86F26AC0E87442C007A3773 /* RMMapLayer.h */,
B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */,
B8FA92170E9315EC003A9FE6 /* RMLayerSet.h */,
B8FA92180E9315EC003A9FE6 /* RMLayerSet.m */,
B8FA92170E9315EC003A9FE6 /* RMLayerCollection.h */,
B8FA92180E9315EC003A9FE6 /* RMLayerCollection.m */,
B8F3FC620EA2E792004D8F85 /* RMMarker.h */,
B8F3FC630EA2E792004D8F85 /* RMMarker.m */,
B8CEB1C30ED5A3480014C431 /* RMPath.h */,
... ... @@ -722,7 +722,7 @@
B8C974B00E8A1F08007D16AD /* RMMercatorToTileProjection.h in Headers */,
B8C974B80E8A280A007D16AD /* RMMapContents.h in Headers */,
B8C974CA0E8A9C30007D16AD /* RMCachedTileSource.h in Headers */,
B8FA92190E9315EC003A9FE6 /* RMLayerSet.h in Headers */,
B8FA92190E9315EC003A9FE6 /* RMLayerCollection.h in Headers */,
B8F3FC640EA2E792004D8F85 /* RMMarker.h in Headers */,
B8474B9A0EB40094006A0BC1 /* FMDatabase.h in Headers */,
B8474B9C0EB40094006A0BC1 /* FMDatabaseAdditions.h in Headers */,
... ... @@ -892,7 +892,7 @@
2BEC60370F8AC718008FB858 /* RMFoundation.c in Sources */,
2BEC60380F8AC71A008FB858 /* RMFractalTileProjection.m in Sources */,
2BEC60390F8AC71C008FB858 /* RMGeoHash.m in Sources */,
2BEC603A0F8AC71D008FB858 /* RMLayerSet.m in Sources */,
2BEC603A0F8AC71D008FB858 /* RMLayerCollection.m in Sources */,
2BEC603B0F8AC71E008FB858 /* RMMapContents.m in Sources */,
2BEC603C0F8AC71F008FB858 /* RMMapLayer.m in Sources */,
2BEC603D0F8AC722008FB858 /* RMMapRenderer.m in Sources */,
... ... @@ -954,7 +954,7 @@
B8C9746C0E8A1A50007D16AD /* RMMapView.m in Sources */,
B8C974B90E8A280A007D16AD /* RMMapContents.m in Sources */,
B8C974CB0E8A9C30007D16AD /* RMCachedTileSource.m in Sources */,
B8FA921A0E9315EC003A9FE6 /* RMLayerSet.m in Sources */,
B8FA921A0E9315EC003A9FE6 /* RMLayerCollection.m in Sources */,
B8F3FC610EA2B382004D8F85 /* RMMapLayer.m in Sources */,
B8F3FC650EA2E792004D8F85 /* RMMarker.m in Sources */,
B8474B9B0EB40094006A0BC1 /* FMDatabase.m in Sources */,
... ...
... ... @@ -314,12 +314,17 @@
STAssertLessThanOrEqual(contentsMaxZoom, tilesourceMaxZoom, @"map's maxZoom exceeds tilesource's maxZoom");
STAssertLessThanOrEqual(contentsZoom, tilesourceMaxZoom, @"map's zoom exceeds tilesource's maxZoom");
double targetZoom = tilesourceMaxZoom + 0.5;
double targetZoom = tilesourceMaxZoom + 0.4;
[[mapView contents] setZoom:targetZoom]; // try to exceed tilesource limit
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, tilesourceMaxZoom, kAccuracyThreshold, @"map's zoom wrong after trying to exceed tilesource's maxZoom");
targetZoom = tilesourceMaxZoom - 1.5;
targetZoom = tilesourceMaxZoom + 0.5;
[[mapView contents] setZoom:targetZoom]; // try to exceed tilesource limit
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, tilesourceMaxZoom, kAccuracyThreshold, @"map's zoom wrong after trying to exceed tilesource's maxZoom");
targetZoom = tilesourceMaxZoom - 1.6;
[[mapView contents] setZoom:targetZoom];
CGPoint pivotPoint = CGPointMake(5., 5.);
[[mapView contents] zoomInToNextNativeZoomAt:pivotPoint];
... ... @@ -339,6 +344,26 @@
contentsZoom, tilesourceMaxZoom);
targetZoom = tilesourceMaxZoom - 1.5;
[[mapView contents] setZoom:targetZoom];
pivotPoint = CGPointMake(5., 5.);
[[mapView contents] zoomInToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, tilesourceMaxZoom - 1.0, kAccuracyThreshold,
@"map's zoom %f wrong after zoomInToNextNativeZoomAt: for maxZoom-1 %f",
contentsZoom, tilesourceMaxZoom);
[[mapView contents] zoomInToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, tilesourceMaxZoom, kAccuracyThreshold,
@"map's zoom [%f] wrong after zoomInToNextNativeZoomAt: for maxZoom %f (first)",
contentsZoom, tilesourceMaxZoom);
[[mapView contents] zoomInToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, tilesourceMaxZoom, kAccuracyThreshold,
@"map's zoom %f wrong after zoomInToNextNativeZoomAt: for maxZoom %f (second)",
contentsZoom, tilesourceMaxZoom);
double contentsMinZoom = 3.0;
[[mapView contents] setMinZoom:contentsMinZoom];
targetZoom = contentsMinZoom + 0.6;
... ... @@ -356,7 +381,29 @@
@"map's zoom %f wrong after second zoomOutToNextNativeZoomAt: for minZoom %f",
contentsZoom, contentsMinZoom);
contentsMinZoom = 3.0;
[[mapView contents] setMinZoom:contentsMinZoom];
targetZoom = contentsMinZoom + 1.6;
[[mapView contents] setZoom:targetZoom];
contentsZoom = [[mapView contents] zoom];
NSLog(@"zoom: %f minZoom: %f", contentsZoom, [[mapView contents] minZoom]);
[[mapView contents] zoomOutToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, contentsMinZoom+1.0, kAccuracyThreshold,
@"map's zoom %f wrong after first zoomOutToNextNativeZoomAt: for minZoom %f",
contentsZoom, contentsMinZoom);
[[mapView contents] zoomOutToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, contentsMinZoom, kAccuracyThreshold,
@"map's zoom %f wrong after second zoomOutToNextNativeZoomAt: for minZoom %f",
contentsZoom, contentsMinZoom);
[[mapView contents] zoomOutToNextNativeZoomAt:pivotPoint];
contentsZoom = [[mapView contents] zoom];
STAssertEqualsWithAccuracy(contentsZoom, contentsMinZoom, kAccuracyThreshold,
@"map's zoom %f wrong after second zoomOutToNextNativeZoomAt: for minZoom %f",
contentsZoom, contentsMinZoom);
}
@end
... ...