Authored by Bald Mountain

Changes for setting frame size. Some bug fixes

... ... @@ -137,7 +137,7 @@
[marker setTextLabel:@"Hello"];
[markerManager addMarker:marker AtLatLong:[[mapView contents] mapCenter]];
[marker release];
NSLog(@"Center: Lat: %lf Lon: %lf", [mapView centerCoordinates].latitude, [mapView centerCoordinates].longitude);
NSLog(@"Center: Lat: %lf Lon: %lf", mapView.contents.mapCenter.latitude, mapView.contents.mapCenter.longitude);
// What did this do?
// [mapView setZoomBounds:0.0 maxZoom:17.0];
... ...
... ... @@ -120,6 +120,7 @@
-(void) dealloc
{
[imagesOnScreen cancelLoading];
[self setRenderer:nil];
[imagesOnScreen release];
[tileLoader release];
... ...
... ... @@ -65,5 +65,6 @@ typedef struct {
- (RMLatLongBounds) getScreenCoordinateBounds;
- (void)didReceiveMemoryWarning;
@end
... ...
... ... @@ -24,7 +24,6 @@
- (void)stopDeceleration;
@end
@implementation RMMapView (Internal)
BOOL delegateHasBeforeMapMove;
BOOL delegateHasAfterMapMove;
... ... @@ -43,9 +42,13 @@
@implementation RMMapView
@synthesize decelerationFactor;
- (RMMarkerManager*)markerManager
{
return contents.markerManager;
}
-(void) initValues:(CLLocationCoordinate2D)latlong
{
if(round(latlong.latitude) != 0 && round(latlong.longitude) != 0)
{
contents = [[RMMapContents alloc] initForView:self WithLocation:latlong];
... ... @@ -487,5 +490,25 @@
}
}
- (void)didReceiveMemoryWarning
{
CLLocationCoordinate2D coord = contents.mapCenter;
[contents release];
[self initValues:coord];
}
- (void)setFrame:(CGRect)frame
{
CGRect r = self.frame;
[super setFrame:frame];
// only change if the frame changes AND there is contents
if (!CGRectEqualToRect(r, frame) && contents) {
CLLocationCoordinate2D coord = contents.mapCenter;
float zoom = contents.zoom;
[contents release];
[self initValues:coord];
contents.zoom = zoom;
}
}
@end
... ...
... ... @@ -62,6 +62,7 @@
- (void) setXYBounds: (RMXYRect) bounds;
- (RMXYPoint) XYCenter;
- (void) setXYCenter: (RMXYPoint) aPoint;
- (void) setScreenBounds:(CGRect)rect;
- (CGRect) screenBounds;
@property (assign, readwrite) float scale;
... ...
... ... @@ -206,6 +206,11 @@
origin.y -= screenBounds.size.height * scale / 2;
}
- (void) setScreenBounds:(CGRect)rect;
{
screenBounds = rect;
}
-(CGRect) screenBounds
{
return screenBounds;
... ...
... ... @@ -69,10 +69,10 @@ NSString * const RMMapImageLoadingCancelledNotification = @"MapImageLoadingCance
// if (image)
// CGImageRelease(image);
[image release];
[layer release];
[dataPending release];
[lastUsedTime release];
[image release]; image = nil;
[layer release]; layer = nil;
[dataPending release]; dataPending = nil;
[lastUsedTime release]; lastUsedTime = nil;
[super dealloc];
}
... ...
... ... @@ -57,6 +57,8 @@
- (void) printDebuggingInformation;
- (void)cancelLoading;
@property (assign, nonatomic, readwrite) id delegate;
@property (retain, nonatomic, readwrite) id<RMTileSource> tileSource;
@end
... ...
... ... @@ -93,7 +93,8 @@
{
NSArray * imagelist = [images allObjects];
for (RMTileImage * img in imagelist) {
for (int i = 0; i < [images countForObject:img]; i++)
NSInteger count = [images countForObject:img];
for (int i = 0; i < count; i++)
[self removeTile: img.tile];
}
}
... ... @@ -275,4 +276,13 @@
NSLog(@"Biggest seam right: %f down: %f", biggestSeamRight, biggestSeamDown);
}
- (void)cancelLoading
{
for (RMTileImage *image in images)
{
[image cancelLoading];
}
}
@end
... ...