Authored by Justin R. Miller

Merge branch 'upstream-develop' into develop

... ... @@ -87,7 +87,7 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (zoom == (short)ceilf(mapView.zoom))
if (zoom == (short)ceilf(mapView.adjustedZoomForRetinaDisplay))
{
int x = floor(rect.origin.x / rect.size.width),
y = floor(fabs(rect.origin.y / rect.size.height));
... ... @@ -103,7 +103,7 @@
}
else // Probably due to renderInContext:
{
zoom = (short)ceilf(mapView.zoom);
zoom = (short)ceilf(mapView.adjustedZoomForRetinaDisplay);
CGFloat rectSize = bounds.size.width / powf(2.0, (float)zoom);
int x1 = floor(rect.origin.x / rectSize),
... ...
... ... @@ -115,7 +115,8 @@ typedef enum {
@property (nonatomic, readonly) float screenScale;
@property (nonatomic, assign) NSUInteger boundingMask;
@property (nonatomic, assign) BOOL adjustTilesForRetinaDisplay;
@property (nonatomic, assign) BOOL adjustTilesForRetinaDisplay;
@property (nonatomic, readonly) float adjustedZoomForRetinaDisplay; // takes adjustTilesForRetinaDisplay and screen scale into account
@property (nonatomic, assign) float zoom; /// zoom level is clamped to range (minZoom, maxZoom)
@property (nonatomic, assign) float minZoom;
... ...
... ... @@ -135,11 +135,7 @@
tiledLayerView = nil;
overlayView = nil;
screenScale = 1.0;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
{
screenScale = [[[UIScreen mainScreen] valueForKey:@"scale"] floatValue];
}
screenScale = [UIScreen mainScreen].scale;
boundingMask = RMMapMinWidthBound;
adjustTilesForRetinaDisplay = NO;
... ... @@ -1394,6 +1390,14 @@
[self setCenterCoordinate:self.centerCoordinate animated:NO];
}
- (float)adjustedZoomForRetinaDisplay
{
if (!self.adjustTilesForRetinaDisplay && screenScale > 1.0)
return [self zoom] + 1.0;
return [self zoom];
}
- (RMProjection *)projection
{
return [[projection retain] autorelease];
... ...
... ... @@ -77,8 +77,8 @@
@synchronized (cachedClusterAnnotation)
{
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
[cachedClusterEnclosedAnnotations release]; cachedClusterEnclosedAnnotations = nil;
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
}
@synchronized (annotations)
... ... @@ -167,8 +167,8 @@
@synchronized (cachedClusterAnnotation)
{
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
[cachedClusterEnclosedAnnotations release]; cachedClusterEnclosedAnnotations = nil;
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
}
if (RMProjectedRectIntersectsProjectedRect(quadTreeBounds, northWestBoundingBox))
... ... @@ -418,8 +418,8 @@
{
@synchronized (cachedClusterAnnotation)
{
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
[cachedClusterEnclosedAnnotations release]; cachedClusterEnclosedAnnotations = nil;
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
}
enclosedAnnotations = [NSArray arrayWithArray:annotationsToCheck];
... ... @@ -435,8 +435,8 @@
{
if (cachedClusterAnnotation && [enclosedAnnotations count] != [cachedClusterEnclosedAnnotations count])
{
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
[cachedClusterEnclosedAnnotations release]; cachedClusterEnclosedAnnotations = nil;
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
}
}
... ... @@ -555,8 +555,8 @@
@synchronized (cachedClusterAnnotation)
{
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
[cachedClusterEnclosedAnnotations release]; cachedClusterEnclosedAnnotations = nil;
[cachedClusterAnnotation release]; cachedClusterAnnotation = nil;
}
[cachedEnclosedAnnotations release]; cachedEnclosedAnnotations = nil;
... ...
... ... @@ -15,32 +15,33 @@
- (void)viewDidLoad
{
NSLog(@"viewDidLoad");
NSLog(@"viewDidLoad");
[super viewDidLoad];
CLLocationCoordinate2D firstLocation;
firstLocation.latitude = 51.2795;
firstLocation.longitude = 1.082;
CLLocationCoordinate2D firstLocation;
firstLocation.latitude = 51.2795;
firstLocation.longitude = 1.082;
self.mapView = [[[RMMapView alloc] initWithFrame:CGRectMake(10, 20, 300, 340)] autorelease];
[mapView setBackgroundColor:[UIColor greenColor]];
[[self view] addSubview:mapView];
[[self view] sendSubviewToBack:mapView];
self.mapView = [[[RMMapView alloc] initWithFrame:CGRectMake(10, 20, 300, 340)] autorelease];
self.mapView.adjustTilesForRetinaDisplay = NO;
[self.mapView setBackgroundColor:[UIColor greenColor]];
[[self view] addSubview:mapView];
[[self view] sendSubviewToBack:mapView];
}
- (void)dealloc
{
[mapView removeFromSuperview];
self.mapView = nil;
[super dealloc];
self.mapView = nil;
[super dealloc];
}
- (IBAction)doTheTest:(id)sender
{
CLLocationCoordinate2D secondLocation;
secondLocation.latitude = -43.63;
secondLocation.longitude = 172.66;
[self.mapView setCenterCoordinate:secondLocation];
CLLocationCoordinate2D secondLocation;
secondLocation.latitude = -43.50;
secondLocation.longitude = 172.56;
[self.mapView setCenterCoordinate:secondLocation];
}
- (IBAction)takeSnapshot:(id)sender
... ...