Authored by Vladimir Vyskocil

Make RMPath class conform to RMMovingMapLayer protocol, let RMPath layers scroll…

… with the map in all cases.
... ... @@ -36,12 +36,12 @@
/*! \brief buggy, incomplete, untested; overlays paths/polygons on map
*/
@interface RMPath : RMMapLayer
@interface RMPath : RMMapLayer <RMMovingMapLayer>
{
NSMutableArray *points;
/// This is the first point.
RMProjectedPoint origin;
RMProjectedPoint projectedLocation;
/// The color of the line, or the outline if a polygon
UIColor *lineColor;
... ... @@ -67,6 +67,7 @@
RMMapContents *contents;
}
- (id) initWithContents: (RMMapContents*)aContents;
- (id) initForMap: (RMMapView*)map;
... ... @@ -74,7 +75,7 @@
@property float lineWidth;
@property BOOL scaleLineWidth;
@property (nonatomic, assign) RMProjectedPoint origin;
@property (nonatomic, assign) RMProjectedPoint projectedLocation;
@property (readwrite, assign) UIColor *lineColor;
@property (readwrite, assign) UIColor *fillColor;
... ...
... ... @@ -34,7 +34,8 @@
@implementation RMPath
@synthesize origin, scaleLineWidth;
@synthesize scaleLineWidth;
@synthesize projectedLocation;
#define kDefaultLineWidth 100
... ... @@ -110,7 +111,7 @@
// Clip bound rect to screen bounds.
// If bounds are not clipped, they won't display when you zoom in too much.
myPosition = [[contents mercatorToScreenProjection] projectXYPoint: origin];
myPosition = [[contents mercatorToScreenProjection] projectXYPoint: projectedLocation];
screenBounds = [contents screenBounds];
// Clip top
... ... @@ -155,9 +156,9 @@
{
points = [[NSMutableArray alloc] init];
[points addObject:value];
origin = point;
projectedLocation = point;
self.position = [[contents mercatorToScreenProjection] projectXYPoint: origin];
self.position = [[contents mercatorToScreenProjection] projectXYPoint: projectedLocation];
// RMLog(@"screen position set to %f %f", self.position.x, self.position.y);
CGPathMoveToPoint(path, NULL, 0.0f, 0.0f);
}
... ... @@ -165,8 +166,8 @@
{
[points addObject:value];
point.easting = point.easting - origin.easting;
point.northing = point.northing - origin.northing;
point.easting = point.easting - projectedLocation.easting;
point.northing = point.northing - projectedLocation.northing;
if (isDrawing)
{
... ...