Authored by Obrand69

Added notification on new tile bounds

... ... @@ -125,6 +125,7 @@ enum {
- (void)zoomWithRMMercatorRectBounds:(RMXYRect)bounds;
- (CLLocationCoordinate2DBounds) getScreenCoordinateBounds;
- (CLLocationCoordinate2DBounds) getCoordinateBounds:(CGRect) rect;
@end
... ...
... ... @@ -563,9 +563,14 @@ static BOOL _performExpensiveOperations = YES;
- (CLLocationCoordinate2DBounds) getScreenCoordinateBounds
{
CLLocationCoordinate2DBounds bounds;
CGRect rect = [mercatorToScreenProjection screenBounds];
return [self getCoordinateBounds:rect];
}
- (CLLocationCoordinate2DBounds) getCoordinateBounds:(CGRect) rect
{
CLLocationCoordinate2DBounds bounds;
CGPoint northWest = rect.origin;
CGPoint southEast;
... ... @@ -585,4 +590,5 @@ static BOOL _performExpensiveOperations = YES;
}
@end
... ...
... ... @@ -17,6 +17,8 @@
#import "RMTileCache.h"
NSString * const RMMapNewTilesBoundsNotification = @"NewTilesBounds";
NSString* const RMMapImageRemovedFromScreenNotification = @"RMMapImageRemovedFromScreen";
NSString* const RMMapImageAddedToScreenNotification = @"RMMapImageAddedToScreen";
... ... @@ -98,6 +100,31 @@ NSString* const RMResumeExpensiveOperations = @"RMResumeExpensiveOperations";
RMTileImageSet *images = [content imagesOnScreen];
CGRect newLoadedBounds = [images addTiles:newTileRect ToDisplayIn:[content screenBounds]];
//NSLog(@"===> TILES LOADED. X:%lf Y:%lf WIDTH:%lf HEIGHT:%lf",newLoadedBounds.origin.x, newLoadedBounds.origin.y, newLoadedBounds.size.width, newLoadedBounds.size.height);
CLLocationCoordinate2DBounds locationBounds = [content getCoordinateBounds:newLoadedBounds];
//NSLog(@"===> AFTER CONVERSION - BOUNDS: NW Lat: %lf NW Lon:%lf SW Lat:%lf SW Lon:%lf",
// locationBounds.northWest.latitude,locationBounds.northWest.longitude,
// locationBounds.southEast.latitude, locationBounds.southEast.longitude);
CLLocation *NWLocation = [[CLLocation alloc] initWithLatitude:locationBounds.northWest.latitude longitude:locationBounds.northWest.longitude];
CLLocation *SELocation = [[CLLocation alloc] initWithLatitude:locationBounds.southEast.latitude longitude:locationBounds.southEast.longitude];
NSArray *keys = [NSArray arrayWithObjects:@"NWBounds", @"SEBounds", nil];
NSArray *objects = [NSArray arrayWithObjects:NWLocation, SELocation, nil];
NSDictionary *tilesBounds = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
[NWLocation release];
[SELocation release];
// Send notification
[[NSNotificationCenter defaultCenter] postNotificationName:RMMapNewTilesBoundsNotification
object:self
userInfo:tilesBounds];
if (!RMTileIsDummy(loadedTiles.origin.tile))
[images removeTiles:loadedTiles];
... ...
... ... @@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
0913410D0EC816EE0017BB92 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B83E65630E80E81C001663B6 /* CoreLocation.framework */; };
126693040EB76C0B00E002D5 /* RMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 126692A00EB75C0A00E002D5 /* RMConfiguration.m */; };
1296F56B0EB8849A00FF25E0 /* RMMarkerStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1296F55F0EB8743500FF25E0 /* RMMarkerStyle.h */; };
1296F56C0EB8849B00FF25E0 /* RMMarkerStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 1296F5600EB8743500FF25E0 /* RMMarkerStyle.m */; };
... ... @@ -255,6 +256,7 @@
B83E66C30E80F053001663B6 /* QuartzCore.framework in Frameworks */,
B8C9787B0E8BE130007D16AD /* libMapView.a in Frameworks */,
B8474BC30EB401AF006A0BC1 /* libsqlite3.dylib in Frameworks */,
0913410D0EC816EE0017BB92 /* CoreLocation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
... ...