Authored by Thomas Rasch

o Fixes, improvements

... ... @@ -116,11 +116,12 @@
- (void)setLayer:(RMMapLayer *)aLayer
{
if (layer == aLayer) return;
if (layer != aLayer) {
[layer removeFromSuperlayer]; [layer release];
layer = [aLayer retain];
layer.position = self.position;
layer.annotation = self;
}
layer.position = self.position;
}
- (BOOL)isAnnotationWithinBounds:(CGRect)bounds
... ... @@ -139,4 +140,12 @@
return [self isAnnotationWithinBounds:screenBounds];
}
- (NSString *)description
{
if (self.hasBoundingBox)
return [NSString stringWithFormat:@"<%@: %@ @ (%.0f,%.0f) {(%.0f,%.0f) - (%.0f,%.0f)}>", NSStringFromClass([self class]), self.title, self.projectedLocation.easting, self.projectedLocation.northing, self.projectedBoundingBox.origin.easting, self.projectedBoundingBox.origin.northing, self.projectedBoundingBox.origin.easting + self.projectedBoundingBox.size.width, self.projectedBoundingBox.origin.northing + self.projectedBoundingBox.size.height];
else
return [NSString stringWithFormat:@"<%@: %@ @ (%.0f,%.0f)>", NSStringFromClass([self class]), self.title, self.projectedLocation.easting, self.projectedLocation.northing];
}
@end
... ...
... ... @@ -58,7 +58,7 @@
return self;
}
/// \bug why return nil for the "position" and "bounds" actionForKey? Does this do anything besides block Core Animation?
/// return nil for certain animation keys to block core animation
- (id <CAAction>)actionForKey:(NSString *)key
{
if ([key isEqualToString:@"position"] || [key isEqualToString:@"bounds"])
... ...
... ... @@ -52,9 +52,9 @@
#pragma mark --- begin constants ----
#define kDefaultDecelerationFactor .88f
#define kDefaultDecelerationFactor .80f
#define kMinDecelerationDelta 0.6f
#define kDecelerationTimerInterval 0.02f
#define kDecelerationTimerInterval 0.04f
#define kZoomAnimationStepTime 0.03f
#define kZoomAnimationAnimationTime 0.1f
... ... @@ -1088,9 +1088,8 @@
return;
[mercatorToScreenProjection setProjectedCenter:projectedPoint];
[self correctPositionOfAllAnnotations];
[tileLoader reload];
[overlay setNeedsDisplay];
[self correctPositionOfAllAnnotations];
}
- (RMProjectedRect)projectedBounds
... ... @@ -1101,6 +1100,8 @@
- (void)setProjectedBounds:(RMProjectedRect)boundsRect
{
[mercatorToScreenProjection setProjectedBounds:boundsRect];
[tileLoader reload];
[self correctPositionOfAllAnnotations];
}
- (RMTileRect)tileBounds
... ... @@ -1308,6 +1309,10 @@
CGRect screenBounds = [[self mercatorToScreenProjection] screenBounds];
CALayer *lastLayer = nil;
// Prevent blurry movements
[CATransaction begin];
[CATransaction setAnimationDuration:0];
@synchronized (annotations)
{
if (correctAllAnnotations)
... ... @@ -1329,21 +1334,23 @@
[visibleAnnotations addObject:annotation];
}
lastLayer = annotation.layer;
} else {
annotation.layer = nil;
[visibleAnnotations removeObject:annotation];
}
lastLayer = annotation.layer;
}
RMLog(@"%d annotations on screen, %d total", [[overlay sublayers] count], [annotations count]);
// RMLog(@"%d annotations on screen, %d total", [[overlay sublayers] count], [annotations count]);
} else {
for (RMAnnotation *annotation in visibleAnnotations)
{
[self correctScreenPosition:annotation];
}
RMLog(@"%d annotations corrected", [visibleAnnotations count]);
// RMLog(@"%d annotations corrected", [visibleAnnotations count]);
}
}
[CATransaction commit];
}
- (void)correctPositionOfAllAnnotations
... ...
... ... @@ -242,7 +242,7 @@
if (!scaleLineWidth) {
scaledLineWidth *= renderedScale;
}
//NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);
// NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);
if (!scaleLineDash && _lineDashLengths) {
dashLengths = _scaledLineDashLengths;
... ...