Authored by Vladimir Vyskocil

Add moveTo* methods, move current point in RMPath without adding a visible trace.

@@ -78,6 +78,9 @@ @@ -78,6 +78,9 @@
78 @property (readwrite, assign) UIColor *lineColor; 78 @property (readwrite, assign) UIColor *lineColor;
79 @property (readwrite, assign) UIColor *fillColor; 79 @property (readwrite, assign) UIColor *fillColor;
80 80
  81 +- (void) moveToXY: (RMProjectedPoint) point;
  82 +- (void) moveToScreenPoint: (CGPoint) point;
  83 +- (void) moveToLatLong: (RMLatLong) point;
81 - (void) addLineToXY: (RMProjectedPoint) point; 84 - (void) addLineToXY: (RMProjectedPoint) point;
82 - (void) addLineToScreenPoint: (CGPoint) point; 85 - (void) addLineToScreenPoint: (CGPoint) point;
83 - (void) addLineToLatLong: (RMLatLong) point; 86 - (void) addLineToLatLong: (RMLatLong) point;
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 // RMLog(@"new anchor point %f %f", self.anchorPoint.x, self.anchorPoint.y); 113 // RMLog(@"new anchor point %f %f", self.anchorPoint.x, self.anchorPoint.y);
114 } 114 }
115 115
116 -- (void) addLineToXY: (RMProjectedPoint) point 116 +- (void) addPointToXY: (RMProjectedPoint) point withDrawing: (BOOL)isDrawing
117 { 117 {
118 // RMLog(@"addLineToXY %f %f", point.easting, point.northing); 118 // RMLog(@"addLineToXY %f %f", point.easting, point.northing);
119 119
@@ -136,13 +136,41 @@ @@ -136,13 +136,41 @@
136 point.easting = point.easting - origin.easting; 136 point.easting = point.easting - origin.easting;
137 point.northing = point.northing - origin.northing; 137 point.northing = point.northing - origin.northing;
138 138
139 - CGPathAddLineToPoint(path, NULL, point.easting, -point.northing);  
140 - 139 + if (isDrawing)
  140 + {
  141 + CGPathAddLineToPoint(path, NULL, point.easting, -point.northing);
  142 + } else {
  143 + CGPathMoveToPoint(path, NULL, point.easting, -point.northing);
  144 + }
141 [self recalculateGeometry]; 145 [self recalculateGeometry];
142 } 146 }
143 [self setNeedsDisplay]; 147 [self setNeedsDisplay];
144 } 148 }
145 149
  150 +- (void) moveToXY: (RMProjectedPoint) point
  151 +{
  152 + [self addPointToXY: point withDrawing: FALSE];
  153 +}
  154 +
  155 +- (void) moveToScreenPoint: (CGPoint) point
  156 +{
  157 + RMProjectedPoint mercator = [[contents mercatorToScreenProjection] projectScreenPointToXY: point];
  158 +
  159 + [self moveToXY: mercator];
  160 +}
  161 +
  162 +- (void) moveToLatLong: (RMLatLong) point
  163 +{
  164 + RMProjectedPoint mercator = [[contents projection] latLongToPoint:point];
  165 +
  166 + [self moveToXY:mercator];
  167 +}
  168 +
  169 +- (void) addLineToXY: (RMProjectedPoint) point
  170 +{
  171 + [self addPointToXY: point withDrawing: TRUE];
  172 +}
  173 +
146 - (void) addLineToScreenPoint: (CGPoint) point 174 - (void) addLineToScreenPoint: (CGPoint) point
147 { 175 {
148 RMProjectedPoint mercator = [[contents mercatorToScreenProjection] projectScreenPointToXY: point]; 176 RMProjectedPoint mercator = [[contents mercatorToScreenProjection] projectScreenPointToXY: point];