Authored by Thomas Rasch

o performBatchOperations:

... ... @@ -49,6 +49,7 @@
CGMutablePathRef path;
CGRect pathBoundingBox;
BOOL ignorePathUpdates;
/// Width of the line, units unknown; pixels maybe?
float lineWidth;
... ... @@ -106,6 +107,9 @@
- (void)addLineToScreenPoint:(CGPoint)point;
- (void)addLineToLatLong:(CLLocationCoordinate2D)point;
// Change the path without recalculating the geometry (performance!)
- (void)performBatchOperations:(void (^)(RMPath *aPath))block;
/// This closes the path, connecting the last point to the first.
/// After this action, no further points can be added to the path.
/// There is no requirement that a path be closed.
... ...
... ... @@ -53,6 +53,7 @@
path = CGPathCreateMutable();
pathBoundingBox = CGRectZero;
ignorePathUpdates = NO;
lineWidth = kDefaultLineWidth;
drawingMode = kCGPathFillStroke;
... ... @@ -104,6 +105,8 @@
- (void)recalculateGeometry
{
if (ignorePathUpdates) return;
RMMercatorToScreenProjection *projection = [mapContents mercatorToScreenProjection];
float scale = [projection metersPerPixel];
float scaledLineWidth;
... ... @@ -228,6 +231,14 @@
[self addLineToXY:mercator];
}
- (void)performBatchOperations:(void (^)(RMPath *aPath))block
{
ignorePathUpdates = YES;
block(self);
ignorePathUpdates = NO;
[self recalculateGeometry];
}
- (void)drawInContext:(CGContextRef)theContext
{
renderedScale = [mapContents metersPerPixel];
... ...