Authored by Vladimir Vyskocil

Close issue : Issue 124: RMPath leaks and uses unnecesary memory

The unused points array is removed
... ... @@ -38,7 +38,7 @@
*/
@interface RMPath : RMMapLayer <RMMovingMapLayer>
{
NSMutableArray *points;
BOOL isFirstPoint;
/// This is the first point.
RMProjectedPoint projectedLocation;
... ...
... ... @@ -64,6 +64,7 @@
scaleLineWidth = NO;
enableDragging = YES;
enableRotation = YES;
isFirstPoint = YES;
return self;
}
... ... @@ -156,12 +157,10 @@
{
// RMLog(@"addLineToXY %f %f", point.x, point.y);
NSValue* value = [NSValue value:&point withObjCType:@encode(RMProjectedPoint)];
if (points == nil)
if(isFirstPoint)
{
points = [[NSMutableArray alloc] init];
[points addObject:value];
isFirstPoint = FALSE;
projectedLocation = point;
self.position = [[contents mercatorToScreenProjection] projectXYPoint: projectedLocation];
... ... @@ -170,8 +169,6 @@
}
else
{
[points addObject:value];
point.easting = point.easting - projectedLocation.easting;
point.northing = point.northing - projectedLocation.northing;
... ...