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 @@ @@ -239,7 +239,8 @@
239 [tileLoader zoomByFactor:zoomFactor near:pivot]; 239 [tileLoader zoomByFactor:zoomFactor near:pivot];
240 [overlay zoomByFactor:zoomFactor near:pivot]; 240 [overlay zoomByFactor:zoomFactor near:pivot];
241 [renderer setNeedsDisplay]; 241 [renderer setNeedsDisplay];
242 - }else 242 + }
  243 + else
243 { 244 {
244 if([self zoom] > [self maxZoom]) 245 if([self zoom] > [self maxZoom])
245 [self setZoom:[self maxZoom]]; 246 [self setZoom:[self maxZoom]];
@@ -577,18 +578,22 @@ static BOOL _performExpensiveOperations = YES; @@ -577,18 +578,22 @@ static BOOL _performExpensiveOperations = YES;
577 southEast.x = rect.origin.x + rect.size.width; 578 southEast.x = rect.origin.x + rect.size.width;
578 southEast.y = rect.origin.y + rect.size.height; 579 southEast.y = rect.origin.y + rect.size.height;
579 580
580 - NSLog(@"NortWest x:%lf y:%lf", northWest.x, northWest.y);  
581 - NSLog(@"SouthEast x:%lf y:%lf", southEast.x, southEast.y); 581 +// NSLog(@"NortWest x:%lf y:%lf", northWest.x, northWest.y);
  582 +// NSLog(@"SouthEast x:%lf y:%lf", southEast.x, southEast.y);
582 583
583 bounds.northWest = [self pixelToLatLong:northWest]; 584 bounds.northWest = [self pixelToLatLong:northWest];
584 bounds.southEast = [self pixelToLatLong:southEast]; 585 bounds.southEast = [self pixelToLatLong:southEast];
585 586
586 - NSLog(@"NortWest Lat:%lf Lon:%lf", bounds.northWest.latitude, bounds.northWest.longitude);  
587 - NSLog(@"SouthEast Lat:%lf Lon:%lf", bounds.southEast.latitude, bounds.southEast.longitude); 587 +// NSLog(@"NortWest Lat:%lf Lon:%lf", bounds.northWest.latitude, bounds.northWest.longitude);
  588 +// NSLog(@"SouthEast Lat:%lf Lon:%lf", bounds.southEast.latitude, bounds.southEast.longitude);
588 589
589 return bounds; 590 return bounds;
590 } 591 }
591 592
  593 +- (void) printDebuggingInformation
  594 +{
  595 + [imagesOnScreen printDebuggingInformation];
  596 +}
592 597
593 598
594 @end 599 @end
@@ -255,6 +255,8 @@ @@ -255,6 +255,8 @@
255 255
256 if (touch.tapCount == 2) 256 if (touch.tapCount == 2)
257 { 257 {
  258 +// [contents printDebuggingInformation];
  259 +
258 if (delegateHasDoubleTapOnMap) { 260 if (delegateHasDoubleTapOnMap) {
259 [delegate doubleTapOnMap: self]; 261 [delegate doubleTapOnMap: self];
260 } else { 262 } else {
@@ -262,7 +264,7 @@ @@ -262,7 +264,7 @@
262 // [contents zoomInToNextNativeZoom]; 264 // [contents zoomInToNextNativeZoom];
263 } 265 }
264 } 266 }
265 - 267 +
266 if (touch.tapCount == 1) 268 if (touch.tapCount == 1)
267 { 269 {
268 CALayer* hit = [contents.overlay hitTest:[touch locationInView:self]]; 270 CALayer* hit = [contents.overlay hitTest:[touch locationInView:self]];
@@ -53,25 +53,6 @@ RMTileRect RMTileRectRound(RMTileRect rect) @@ -53,25 +53,6 @@ RMTileRect RMTileRectRound(RMTileRect rect)
53 return rect; 53 return rect;
54 } 54 }
55 55
56 -int maxi(int a, int b)  
57 -{  
58 - return a > b ? a : b;  
59 -}  
60 -  
61 -int mini(int a, int b)  
62 -{  
63 - return a < b ? a : b;  
64 -}  
65 -  
66 -float maxf(float a, float b)  
67 -{  
68 - return a > b ? a : b;  
69 -}  
70 -  
71 -float minf(float a, float b)  
72 -{  
73 - return a < b ? a : b;  
74 -}  
75 /* 56 /*
76 // Calculate and return the intersection of two rectangles 57 // Calculate and return the intersection of two rectangles
77 TileRect TileRectIntersection(TileRect one, TileRect two) 58 TileRect TileRectIntersection(TileRect one, TileRect two)
@@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
55 55
56 - (void) drawRect:(CGRect) rect; 56 - (void) drawRect:(CGRect) rect;
57 57
  58 +- (void) printDebuggingInformation;
  59 +
58 @property (assign, nonatomic, readwrite) id delegate; 60 @property (assign, nonatomic, readwrite) id delegate;
59 @property (retain, nonatomic, readwrite) id<RMTileSource> tileSource; 61 @property (retain, nonatomic, readwrite) id<RMTileSource> tileSource;
60 @end 62 @end
@@ -152,6 +152,10 @@ @@ -152,6 +152,10 @@
152 // ... Should be the same as equivalent calculation for height. 152 // ... Should be the same as equivalent calculation for height.
153 float pixelsPerTile = bounds.size.width / rect.size.width; 153 float pixelsPerTile = bounds.size.width / rect.size.width;
154 154
  155 + // Until the proper root cause of the seam problem is discovered, I'm hacking around it with this
  156 + ////////////// HACKY FIX ////////////
  157 + pixelsPerTile += 0.2;
  158 +
155 CGRect screenLocation; 159 CGRect screenLocation;
156 screenLocation.size.width = pixelsPerTile; 160 screenLocation.size.width = pixelsPerTile;
157 screenLocation.size.height = pixelsPerTile; 161 screenLocation.size.height = pixelsPerTile;
@@ -231,4 +235,40 @@ @@ -231,4 +235,40 @@
231 } 235 }
232 } 236 }
233 237
  238 +- (void) printDebuggingInformation
  239 +{
  240 + float biggestSeamRight = 0.0f;
  241 + float biggestSeamDown = 0.0f;
  242 +
  243 + for (RMTileImage *image in images)
  244 + {
  245 + CGRect location = [image screenLocation];
  246 +/* NSLog(@"Image at %f, %f %f %f",
  247 + location.origin.x,
  248 + location.origin.y,
  249 + location.origin.x + location.size.width,
  250 + location.origin.y + location.size.height);
  251 +*/
  252 + float seamRight = INFINITY;
  253 + float seamDown = INFINITY;
  254 +
  255 + for (RMTileImage *other_image in images)
  256 + {
  257 + CGRect other_location = [other_image screenLocation];
  258 + if (other_location.origin.x > location.origin.x)
  259 + seamRight = MIN(seamRight, other_location.origin.x - (location.origin.x + location.size.width));
  260 + if (other_location.origin.y > location.origin.y)
  261 + seamDown = MIN(seamDown, other_location.origin.y - (location.origin.y + location.size.height));
  262 + }
  263 +
  264 + if (seamRight != INFINITY)
  265 + biggestSeamRight = MAX(biggestSeamRight, seamRight);
  266 +
  267 + if (seamDown != INFINITY)
  268 + biggestSeamDown = MAX(biggestSeamDown, seamDown);
  269 + }
  270 +
  271 + NSLog(@"Biggest seam right: %f down: %f", biggestSeamRight, biggestSeamDown);
  272 +}
  273 +
234 @end 274 @end