Authored by Joseph G

Added some debugging code to search for the seam problem and put in an interum solution to fix it.

It doesn't fix it properly, but it does a pretty good job.
... ... @@ -239,7 +239,8 @@
[tileLoader zoomByFactor:zoomFactor near:pivot];
[overlay zoomByFactor:zoomFactor near:pivot];
[renderer setNeedsDisplay];
}else
}
else
{
if([self zoom] > [self maxZoom])
[self setZoom:[self maxZoom]];
... ... @@ -577,18 +578,22 @@ static BOOL _performExpensiveOperations = YES;
southEast.x = rect.origin.x + rect.size.width;
southEast.y = rect.origin.y + rect.size.height;
NSLog(@"NortWest x:%lf y:%lf", northWest.x, northWest.y);
NSLog(@"SouthEast x:%lf y:%lf", southEast.x, southEast.y);
// NSLog(@"NortWest x:%lf y:%lf", northWest.x, northWest.y);
// NSLog(@"SouthEast x:%lf y:%lf", southEast.x, southEast.y);
bounds.northWest = [self pixelToLatLong:northWest];
bounds.southEast = [self pixelToLatLong:southEast];
NSLog(@"NortWest Lat:%lf Lon:%lf", bounds.northWest.latitude, bounds.northWest.longitude);
NSLog(@"SouthEast Lat:%lf Lon:%lf", bounds.southEast.latitude, bounds.southEast.longitude);
// NSLog(@"NortWest Lat:%lf Lon:%lf", bounds.northWest.latitude, bounds.northWest.longitude);
// NSLog(@"SouthEast Lat:%lf Lon:%lf", bounds.southEast.latitude, bounds.southEast.longitude);
return bounds;
}
- (void) printDebuggingInformation
{
[imagesOnScreen printDebuggingInformation];
}
@end
... ...
... ... @@ -255,6 +255,8 @@
if (touch.tapCount == 2)
{
// [contents printDebuggingInformation];
if (delegateHasDoubleTapOnMap) {
[delegate doubleTapOnMap: self];
} else {
... ...
... ... @@ -53,25 +53,6 @@ RMTileRect RMTileRectRound(RMTileRect rect)
return rect;
}
int maxi(int a, int b)
{
return a > b ? a : b;
}
int mini(int a, int b)
{
return a < b ? a : b;
}
float maxf(float a, float b)
{
return a > b ? a : b;
}
float minf(float a, float b)
{
return a < b ? a : b;
}
/*
// Calculate and return the intersection of two rectangles
TileRect TileRectIntersection(TileRect one, TileRect two)
... ...
... ... @@ -55,6 +55,8 @@
- (void) drawRect:(CGRect) rect;
- (void) printDebuggingInformation;
@property (assign, nonatomic, readwrite) id delegate;
@property (retain, nonatomic, readwrite) id<RMTileSource> tileSource;
@end
... ...
... ... @@ -152,6 +152,10 @@
// ... Should be the same as equivalent calculation for height.
float pixelsPerTile = bounds.size.width / rect.size.width;
// Until the proper root cause of the seam problem is discovered, I'm hacking around it with this
////////////// HACKY FIX ////////////
pixelsPerTile += 0.2;
CGRect screenLocation;
screenLocation.size.width = pixelsPerTile;
screenLocation.size.height = pixelsPerTile;
... ... @@ -231,4 +235,40 @@
}
}
- (void) printDebuggingInformation
{
float biggestSeamRight = 0.0f;
float biggestSeamDown = 0.0f;
for (RMTileImage *image in images)
{
CGRect location = [image screenLocation];
/* NSLog(@"Image at %f, %f %f %f",
location.origin.x,
location.origin.y,
location.origin.x + location.size.width,
location.origin.y + location.size.height);
*/
float seamRight = INFINITY;
float seamDown = INFINITY;
for (RMTileImage *other_image in images)
{
CGRect other_location = [other_image screenLocation];
if (other_location.origin.x > location.origin.x)
seamRight = MIN(seamRight, other_location.origin.x - (location.origin.x + location.size.width));
if (other_location.origin.y > location.origin.y)
seamDown = MIN(seamDown, other_location.origin.y - (location.origin.y + location.size.height));
}
if (seamRight != INFINITY)
biggestSeamRight = MAX(biggestSeamRight, seamRight);
if (seamDown != INFINITY)
biggestSeamDown = MAX(biggestSeamDown, seamDown);
}
NSLog(@"Biggest seam right: %f down: %f", biggestSeamRight, biggestSeamDown);
}
@end
... ...