Authored by Hal Mueller

Added deprecation log warnings. Registered RMMapContents for UIApplicationDidRec…

…eiveMemoryWarningNotification and cascaded didReceiveMemoryWarning calls to its components.
... ... @@ -107,6 +107,7 @@
{
LogMethod();
[cache didReceiveMemoryWarning];
[tileSource didReceiveMemoryWarning];
}
-(NSString*) uniqueTilecacheKey
... ...
... ... @@ -28,7 +28,7 @@
#import <Foundation/Foundation.h>
#import "RMTileImage.h"
/// a tile image loaded from a local file
/// RMTileImage subclass: a tile image loaded from a local file.
@interface RMFileTileImage : RMTileImage {
}
... ...
... ... @@ -34,7 +34,7 @@
/*! \struct RMLatLongBounds
\brief Specifies a rectangle by northwest and southeast corners.
\brief Specifies a rectangle by northwest and southeast corners, given as CLLocationCoordinate2D.
\deprecated Note: northWest and southEast will change to northeast and southwest (note spelling and corner changes) after 0.5 to keep right-handed coordinate system
*/
... ...
... ... @@ -142,6 +142,7 @@ enum {
- (id)initWithView: (UIView*) view;
- (id)initWithView: (UIView*) view
tilesource:(id<RMTileSource>)newTilesource;
/// designated initializer
- (id)initWithView:(UIView*)view
tilesource:(id<RMTileSource>)tilesource
centerLatLon:(CLLocationCoordinate2D)initialCenter
... ... @@ -150,15 +151,17 @@ enum {
minZoomLevel:(float)minZoomLevel
backgroundImage:(UIImage *)backgroundImage;
/// these next 3 initializers subject to removal at any moment after 0.5 is released
/// \deprecated subject to removal at any moment after 0.5 is released
- (id) initForView: (UIView*) view;
/// \deprecated subject to removal at any moment after 0.5 is released
- (id) initForView: (UIView*) view WithLocation:(CLLocationCoordinate2D)latlong;
// Designated initialiser
/// \deprecated subject to removal at any moment after 0.5 is released
- (id)initForView:(UIView*)view WithTileSource:(id<RMTileSource>)tileSource WithRenderer:(RMMapRenderer*)renderer LookingAt:(CLLocationCoordinate2D)latlong;
- (void)setFrame:(CGRect)frame;
- (void) didReceiveMemoryWarning;
- (void)handleMemoryWarningNotification:(NSNotification *)notification;
- (void)didReceiveMemoryWarning;
- (void)moveToLatLong: (CLLocationCoordinate2D)latlong;
- (void)moveToXYPoint: (RMXYPoint)aPoint;
... ...
... ... @@ -154,21 +154,28 @@
markerManager = [[RMMarkerManager alloc] initWithContents:self];
[newView setNeedsDisplay];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMemoryWarningNotification:)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
RMLog(@"Map contents initialised. view: %@ tileSource %@ renderer %@", newView, tileSource, renderer);
return self;
}
/// deprecated at any moment after release 0.5
/// deprecated at any moment after release 0.5
- (id) initForView: (UIView*) view
{
WarnDeprecated();
return [self initWithView:view];
}
/// deprecated at any moment after release 0.5
- (id) initForView: (UIView*) view WithLocation:(CLLocationCoordinate2D)latlong
{
WarnDeprecated();
LogMethod();
id<RMTileSource> _tileSource = [[RMOpenStreetMapsSource alloc] init];
RMMapRenderer *_renderer = [[RMCoreAnimationRenderer alloc] initWithContent:self];
... ... @@ -184,6 +191,7 @@
/// deprecated at any moment after release 0.5
- (id) initForView: (UIView*) view WithTileSource: (id<RMTileSource>)_tileSource WithRenderer: (RMMapRenderer*)_renderer LookingAt:(CLLocationCoordinate2D)latlong
{
WarnDeprecated();
LogMethod();
if (![super init])
return nil;
... ... @@ -231,6 +239,10 @@
markerManager = [[RMMarkerManager alloc] initWithContents:self];
[view setNeedsDisplay];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMemoryWarningNotification:)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
RMLog(@"Map contents initialised. view: %@ tileSource %@ renderer %@", view, tileSource, renderer);
... ... @@ -253,6 +265,7 @@
-(void) dealloc
{
LogMethod();
[[NSNotificationCenter defaultCenter] removeObserver:self];
[imagesOnScreen cancelLoading];
[self setRenderer:nil];
[imagesOnScreen release];
... ... @@ -269,6 +282,11 @@
[super dealloc];
}
- (void)handleMemoryWarningNotification:(NSNotification *)notification
{
[self didReceiveMemoryWarning];
}
- (void) didReceiveMemoryWarning
{
LogMethod();
... ...
... ... @@ -461,8 +461,9 @@
[delegate mapView:self didDragMarker:(RMMarker*)hit withEvent:event];
return;
} else if (_delegateHasDragMarkerPosition){
//This else portion only exists to maintain compatability with old versions. SHOULD be removed after .5 tarball
[delegate dragMarkerPosition:(RMMarker*)hit onMap:self position:[[[event allTouches] anyObject]locationInView:self]];
//This else portion only exists to maintain compatability with old versions. SHOULD be removed after .5 tarball
RMLog(@"WARNING: dragMarkerPosition:onMap:position: has been deprecated. Switch to didDragMarker:");
[delegate dragMarkerPosition:(RMMarker*)hit onMap:self position:[[[event allTouches] anyObject]locationInView:self]];
return;
}
}
... ... @@ -471,6 +472,7 @@
if ([hit isKindOfClass: [RMMarker class]]) {
if (_delegateHasDragMarkerPosition) {
RMLog(@"WARNING: dragMarkerPosition:onMap:position: has been deprecated. Switch to didDragMarker:");
[delegate dragMarkerPosition:(RMMarker*)hit onMap:self position:[[[event allTouches] anyObject]locationInView:self]];
return;
}
... ...
... ... @@ -32,6 +32,7 @@
+(RMTileImage*) bestProxyFor: (RMTile) t
{
WarnDeprecated();
return nil;
}
... ...
... ... @@ -28,7 +28,7 @@
#import <Foundation/Foundation.h>
#import "RMTileImage.h"
/// a tile image loaded from a URL
/// RMTileImage subclass: a tile image loaded from a URL.
@interface RMWebTileImage : RMTileImage {
/// Before image is completely loaded a proxy image can be used.
/// This will typically be a boilerplate image or a zoomed in or zoomed out version of another image.
... ...
... ... @@ -11,12 +11,13 @@
#if DEBUG
#define RMLog(args...) NSLog( @"%@", [NSString stringWithFormat: args])
#define LogMethod() NSLog(@"%s logged method call: -[%@ %s] (line %d)", _cmd, self, _cmd, __LINE__)
#define WarnDeprecated() NSLog(@"***** WARNING: %s deprecated method call: -[%@ %s] (line %d)", _cmd, self, _cmd, __LINE__)
#else
// DEBUG not defined:
#define RMLog(args...) // do nothing.
#define LogMethod()
#define WarnDeprecated()
#define NS_BLOCK_ASSERTIONS 1
#endif
... ...