remove RMPath for good in favor of RMShape
Showing
4 changed files
with
0 additions
and
558 deletions
@@ -32,7 +32,6 @@ | @@ -32,7 +32,6 @@ | ||
32 | #import "RMFoundation.h" | 32 | #import "RMFoundation.h" |
33 | #import "RMProjection.h" | 33 | #import "RMProjection.h" |
34 | #import "RMMarker.h" | 34 | #import "RMMarker.h" |
35 | -#import "RMPath.h" | ||
36 | #import "RMCircle.h" | 35 | #import "RMCircle.h" |
37 | #import "RMShape.h" | 36 | #import "RMShape.h" |
38 | #import "RMAnnotation.h" | 37 | #import "RMAnnotation.h" |
MapView/Map/RMPath.h
deleted
100644 → 0
1 | -// | ||
2 | -// RMPath.h | ||
3 | -// | ||
4 | -// Copyright (c) 2008-2012, Route-Me Contributors | ||
5 | -// All rights reserved. | ||
6 | -// | ||
7 | -// Redistribution and use in source and binary forms, with or without | ||
8 | -// modification, are permitted provided that the following conditions are met: | ||
9 | -// | ||
10 | -// * Redistributions of source code must retain the above copyright notice, this | ||
11 | -// list of conditions and the following disclaimer. | ||
12 | -// * Redistributions in binary form must reproduce the above copyright notice, | ||
13 | -// this list of conditions and the following disclaimer in the documentation | ||
14 | -// and/or other materials provided with the distribution. | ||
15 | -// | ||
16 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
17 | -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
18 | -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
19 | -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
20 | -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
21 | -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
22 | -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
23 | -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
24 | -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
25 | -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
26 | -// POSSIBILITY OF SUCH DAMAGE. | ||
27 | - | ||
28 | -#import <UIKit/UIKit.h> | ||
29 | - | ||
30 | -#import "RMFoundation.h" | ||
31 | -#import "RMMapLayer.h" | ||
32 | - | ||
33 | -@class RMMapView; | ||
34 | - | ||
35 | -@interface RMPath : RMMapLayer | ||
36 | -{ | ||
37 | - BOOL isFirstPoint; | ||
38 | - | ||
39 | - // The color of the line, or the outline if a polygon | ||
40 | - UIColor *lineColor; | ||
41 | - // The color of polygon's fill. | ||
42 | - UIColor *fillColor; | ||
43 | - | ||
44 | - CGMutablePathRef path; | ||
45 | - CGRect pathBoundingBox; | ||
46 | - BOOL ignorePathUpdates; | ||
47 | - CGRect previousBounds; | ||
48 | - | ||
49 | - // Width of the line, in pixels | ||
50 | - float lineWidth; | ||
51 | - | ||
52 | - /*! Drawing mode of the path; Choices are | ||
53 | - kCGPathFill, | ||
54 | - kCGPathEOFill, | ||
55 | - kCGPathStroke, | ||
56 | - kCGPathFillStroke, | ||
57 | - kCGPathEOFillStroke */ | ||
58 | - CGPathDrawingMode drawingMode; | ||
59 | - | ||
60 | - // Line cap and join styles | ||
61 | - CGLineCap lineCap; | ||
62 | - CGLineJoin lineJoin; | ||
63 | - | ||
64 | - // Line dash style | ||
65 | - CGFloat *_lineDashLengths; | ||
66 | - CGFloat *_scaledLineDashLengths; | ||
67 | - size_t _lineDashCount; | ||
68 | - CGFloat lineDashPhase; | ||
69 | - | ||
70 | - // Line shadow | ||
71 | - CGFloat shadowBlur; | ||
72 | - CGSize shadowOffset; | ||
73 | - BOOL enableShadow; | ||
74 | - | ||
75 | - BOOL scaleLineWidth; | ||
76 | - BOOL scaleLineDash; // if YES line dashes will be scaled to keep a constant size if the layer is zoomed | ||
77 | - | ||
78 | - float renderedScale; | ||
79 | - RMMapView *mapView; | ||
80 | -} | ||
81 | - | ||
82 | -// DEPRECATED. Use RMShape instead. | ||
83 | -- (id)initWithView:(RMMapView *)aMapView __attribute__ ((deprecated)); | ||
84 | - | ||
85 | -@property (nonatomic, assign) CGPathDrawingMode drawingMode; | ||
86 | -@property (nonatomic, assign) CGLineCap lineCap; | ||
87 | -@property (nonatomic, assign) CGLineJoin lineJoin; | ||
88 | -@property (nonatomic, assign) NSArray *lineDashLengths; | ||
89 | -@property (nonatomic, assign) CGFloat lineDashPhase; | ||
90 | -@property (nonatomic, assign) BOOL scaleLineDash; | ||
91 | -@property (nonatomic, assign) float lineWidth; | ||
92 | -@property (nonatomic, assign) BOOL scaleLineWidth; | ||
93 | -@property (nonatomic, assign) CGFloat shadowBlur; | ||
94 | -@property (nonatomic, assign) CGSize shadowOffset; | ||
95 | -@property (nonatomic, assign) BOOL enableShadow; | ||
96 | -@property (nonatomic, retain) UIColor *lineColor; | ||
97 | -@property (nonatomic, retain) UIColor *fillColor; | ||
98 | -@property (nonatomic, readonly) CGRect pathBoundingBox; | ||
99 | - | ||
100 | -- (void)moveToProjectedPoint:(RMProjectedPoint)projectedPoint; | ||
101 | -- (void)moveToScreenPoint:(CGPoint)point; | ||
102 | -- (void)moveToCoordinate:(CLLocationCoordinate2D)coordinate; | ||
103 | - | ||
104 | -- (void)addLineToProjectedPoint:(RMProjectedPoint)projectedPoint; | ||
105 | -- (void)addLineToScreenPoint:(CGPoint)point; | ||
106 | -- (void)addLineToCoordinate:(CLLocationCoordinate2D)coordinate; | ||
107 | - | ||
108 | -// Change the path without recalculating the geometry (performance!) | ||
109 | -- (void)performBatchOperations:(void (^)(RMPath *aPath))block; | ||
110 | - | ||
111 | -// This closes the path, connecting the last point to the first. | ||
112 | -// After this action, no further points can be added to the path. | ||
113 | -// There is no requirement that a path be closed. | ||
114 | -- (void)closePath; | ||
115 | - | ||
116 | -@end |
MapView/Map/RMPath.m
deleted
100644 → 0
1 | -// | ||
2 | -// RMPath.m | ||
3 | -// | ||
4 | -// Copyright (c) 2008-2012, Route-Me Contributors | ||
5 | -// All rights reserved. | ||
6 | -// | ||
7 | -// Redistribution and use in source and binary forms, with or without | ||
8 | -// modification, are permitted provided that the following conditions are met: | ||
9 | -// | ||
10 | -// * Redistributions of source code must retain the above copyright notice, this | ||
11 | -// list of conditions and the following disclaimer. | ||
12 | -// * Redistributions in binary form must reproduce the above copyright notice, | ||
13 | -// this list of conditions and the following disclaimer in the documentation | ||
14 | -// and/or other materials provided with the distribution. | ||
15 | -// | ||
16 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
17 | -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
18 | -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
19 | -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
20 | -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
21 | -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
22 | -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
23 | -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
24 | -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
25 | -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
26 | -// POSSIBILITY OF SUCH DAMAGE. | ||
27 | - | ||
28 | -#import "RMPath.h" | ||
29 | -#import "RMPixel.h" | ||
30 | -#import "RMProjection.h" | ||
31 | -#import "RMMapView.h" | ||
32 | -#import "RMAnnotation.h" | ||
33 | - | ||
34 | -@implementation RMPath | ||
35 | - | ||
36 | -@synthesize scaleLineWidth; | ||
37 | -@synthesize lineDashPhase; | ||
38 | -@synthesize scaleLineDash; | ||
39 | -@synthesize shadowBlur; | ||
40 | -@synthesize shadowOffset; | ||
41 | -@synthesize enableShadow; | ||
42 | -@synthesize pathBoundingBox; | ||
43 | - | ||
44 | -#define kDefaultLineWidth 2.0 | ||
45 | - | ||
46 | -- (id)initWithView:(RMMapView *)aMapView | ||
47 | -{ | ||
48 | - if (!(self = [super init])) | ||
49 | - return nil; | ||
50 | - | ||
51 | - mapView = aMapView; | ||
52 | - | ||
53 | - path = CGPathCreateMutable(); | ||
54 | - pathBoundingBox = CGRectZero; | ||
55 | - ignorePathUpdates = NO; | ||
56 | - previousBounds = CGRectZero; | ||
57 | - | ||
58 | - lineWidth = kDefaultLineWidth; | ||
59 | - drawingMode = kCGPathFillStroke; | ||
60 | - lineCap = kCGLineCapButt; | ||
61 | - lineJoin = kCGLineJoinMiter; | ||
62 | - lineColor = [UIColor blackColor]; | ||
63 | - fillColor = [UIColor redColor]; | ||
64 | - | ||
65 | - _lineDashCount = 0; | ||
66 | - _lineDashLengths = NULL; | ||
67 | - _scaledLineDashLengths = NULL; | ||
68 | - lineDashPhase = 0.0; | ||
69 | - | ||
70 | - self.shadowBlur = 0.0; | ||
71 | - self.shadowOffset = CGSizeMake(0, 0); | ||
72 | - self.enableShadow = NO; | ||
73 | - | ||
74 | - self.masksToBounds = YES; | ||
75 | - | ||
76 | - scaleLineWidth = NO; | ||
77 | - scaleLineDash = NO; | ||
78 | - isFirstPoint = YES; | ||
79 | - | ||
80 | - if ([self respondsToSelector:@selector(setContentsScale:)]) | ||
81 | - [(id)self setValue:[[UIScreen mainScreen] valueForKey:@"scale"] forKey:@"contentsScale"]; | ||
82 | - | ||
83 | - return self; | ||
84 | -} | ||
85 | - | ||
86 | -- (void)dealloc | ||
87 | -{ | ||
88 | - mapView = nil; | ||
89 | - CGPathRelease(path); path = NULL; | ||
90 | - [self setLineDashLengths:nil]; | ||
91 | - [lineColor release]; lineColor = nil; | ||
92 | - [fillColor release]; fillColor = nil; | ||
93 | - [super dealloc]; | ||
94 | -} | ||
95 | - | ||
96 | -//- (id <CAAction>)actionForKey:(NSString *)key | ||
97 | -//{ | ||
98 | -// return nil; | ||
99 | -//} | ||
100 | - | ||
101 | -#pragma mark - | ||
102 | - | ||
103 | -- (void)recalculateGeometry | ||
104 | -{ | ||
105 | - if (ignorePathUpdates) | ||
106 | - return; | ||
107 | - | ||
108 | - CGPoint myPosition = self.annotation.position; | ||
109 | - | ||
110 | - float scale = [mapView metersPerPixel]; | ||
111 | - float scaledLineWidth; | ||
112 | - CGRect pixelBounds, screenBounds; | ||
113 | - float offset; | ||
114 | - const float outset = 100.0f; // provides a buffer off screen edges for when path is scaled or moved | ||
115 | - | ||
116 | - // The bounds are actually in mercators... | ||
117 | - /// \bug if "bounds are actually in mercators", shouldn't be using a CGRect | ||
118 | - scaledLineWidth = lineWidth; | ||
119 | - | ||
120 | - if (!scaleLineWidth) | ||
121 | - { | ||
122 | - renderedScale = [mapView metersPerPixel]; | ||
123 | - scaledLineWidth *= renderedScale; | ||
124 | - } | ||
125 | - | ||
126 | - CGRect boundsInMercators = CGPathGetBoundingBox(path); | ||
127 | - boundsInMercators = CGRectInset(boundsInMercators, -scaledLineWidth, -scaledLineWidth); | ||
128 | - pixelBounds = CGRectInset(boundsInMercators, -scaledLineWidth, -scaledLineWidth); | ||
129 | - pixelBounds = RMScaleCGRectAboutPoint(pixelBounds, 1.0f / scale, CGPointZero); | ||
130 | - | ||
131 | - // Clip bound rect to screen bounds. | ||
132 | - // If bounds are not clipped, they won't display when you zoom in too much. | ||
133 | - screenBounds = [mapView frame]; | ||
134 | - | ||
135 | - // Clip top | ||
136 | - offset = myPosition.y + pixelBounds.origin.y - screenBounds.origin.y + outset; | ||
137 | - if (offset < 0.0f) | ||
138 | - { | ||
139 | - pixelBounds.origin.y -= offset; | ||
140 | - pixelBounds.size.height += offset; | ||
141 | - } | ||
142 | - | ||
143 | - // Clip left | ||
144 | - offset = myPosition.x + pixelBounds.origin.x - screenBounds.origin.x + outset; | ||
145 | - if (offset < 0.0f) | ||
146 | - { | ||
147 | - pixelBounds.origin.x -= offset; | ||
148 | - pixelBounds.size.width += offset; | ||
149 | - } | ||
150 | - | ||
151 | - // Clip bottom | ||
152 | - offset = myPosition.y + pixelBounds.origin.y + pixelBounds.size.height - screenBounds.origin.y - screenBounds.size.height - outset; | ||
153 | - if (offset > 0.0f) | ||
154 | - { | ||
155 | - pixelBounds.size.height -= offset; | ||
156 | - } | ||
157 | - | ||
158 | - // Clip right | ||
159 | - offset = myPosition.x + pixelBounds.origin.x + pixelBounds.size.width - screenBounds.origin.x - screenBounds.size.width - outset; | ||
160 | - if (offset > 0.0f) | ||
161 | - { | ||
162 | - pixelBounds.size.width -= offset; | ||
163 | - } | ||
164 | - | ||
165 | - [super setPosition:myPosition]; | ||
166 | - self.bounds = pixelBounds; | ||
167 | - previousBounds = pixelBounds; | ||
168 | - | ||
169 | -// RMLog(@"x:%f y:%f screen bounds: %f %f %f %f", myPosition.x, myPosition.y, screenBounds.origin.x, screenBounds.origin.y, screenBounds.size.width, screenBounds.size.height); | ||
170 | -// RMLog(@"new bounds: %f %f %f %f", self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, self.bounds.size.height); | ||
171 | - | ||
172 | - pathBoundingBox = CGRectMake(myPosition.x + self.bounds.origin.x, myPosition.y + self.bounds.origin.y, self.bounds.size.width, self.bounds.size.height); | ||
173 | - self.anchorPoint = CGPointMake(-pixelBounds.origin.x / pixelBounds.size.width, -pixelBounds.origin.y / pixelBounds.size.height); | ||
174 | - | ||
175 | - [self setNeedsDisplay]; | ||
176 | -} | ||
177 | - | ||
178 | -- (void)drawInContext:(CGContextRef)theContext | ||
179 | -{ | ||
180 | - renderedScale = [mapView metersPerPixel]; | ||
181 | - CGFloat *dashLengths = _lineDashLengths; | ||
182 | - | ||
183 | - float scale = 1.0f / [mapView metersPerPixel]; | ||
184 | - | ||
185 | - float scaledLineWidth = lineWidth; | ||
186 | - if (!scaleLineWidth) | ||
187 | - scaledLineWidth *= renderedScale; | ||
188 | - | ||
189 | - // NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale); | ||
190 | - | ||
191 | - if (!scaleLineDash && _lineDashLengths) | ||
192 | - { | ||
193 | - dashLengths = _scaledLineDashLengths; | ||
194 | - | ||
195 | - for (size_t dashIndex=0; dashIndex<_lineDashCount; dashIndex++) | ||
196 | - dashLengths[dashIndex] = _lineDashLengths[dashIndex] * renderedScale; | ||
197 | - } | ||
198 | - | ||
199 | - CGContextScaleCTM(theContext, scale, scale); | ||
200 | - | ||
201 | - CGContextBeginPath(theContext); | ||
202 | - CGContextAddPath(theContext, path); | ||
203 | - | ||
204 | - CGContextSetLineWidth(theContext, scaledLineWidth); | ||
205 | - CGContextSetLineCap(theContext, lineCap); | ||
206 | - CGContextSetLineJoin(theContext, lineJoin); | ||
207 | - CGContextSetStrokeColorWithColor(theContext, [lineColor CGColor]); | ||
208 | - CGContextSetFillColorWithColor(theContext, [fillColor CGColor]); | ||
209 | - | ||
210 | - if (_lineDashLengths) | ||
211 | - CGContextSetLineDash(theContext, lineDashPhase, dashLengths, _lineDashCount); | ||
212 | - | ||
213 | - if (self.enableShadow) | ||
214 | - CGContextSetShadow(theContext, self.shadowOffset, self.shadowBlur); | ||
215 | - | ||
216 | - // according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary | ||
217 | - CGContextDrawPath(theContext, drawingMode); | ||
218 | -} | ||
219 | - | ||
220 | -#pragma mark - | ||
221 | - | ||
222 | -- (void)addPointToProjectedPoint:(RMProjectedPoint)point withDrawing:(BOOL)isDrawing | ||
223 | -{ | ||
224 | - // RMLog(@"addLineToXY %f %f", point.x, point.y); | ||
225 | - | ||
226 | - if (isFirstPoint) | ||
227 | - { | ||
228 | - isFirstPoint = FALSE; | ||
229 | - projectedLocation = point; | ||
230 | - | ||
231 | - self.position = [mapView projectedPointToPixel:projectedLocation]; | ||
232 | - // RMLog(@"screen position set to %f %f", self.position.x, self.position.y); | ||
233 | - CGPathMoveToPoint(path, NULL, 0.0f, 0.0f); | ||
234 | - } | ||
235 | - else | ||
236 | - { | ||
237 | - point.x = point.x - projectedLocation.x; | ||
238 | - point.y = point.y - projectedLocation.y; | ||
239 | - | ||
240 | - if (isDrawing) | ||
241 | - CGPathAddLineToPoint(path, NULL, point.x, -point.y); | ||
242 | - else | ||
243 | - CGPathMoveToPoint(path, NULL, point.x, -point.y); | ||
244 | - | ||
245 | - [self recalculateGeometry]; | ||
246 | - } | ||
247 | - | ||
248 | - [self setNeedsDisplay]; | ||
249 | -} | ||
250 | - | ||
251 | -- (void)moveToProjectedPoint:(RMProjectedPoint)projectedPoint | ||
252 | -{ | ||
253 | - [self addPointToProjectedPoint:projectedPoint withDrawing:NO]; | ||
254 | -} | ||
255 | - | ||
256 | -- (void)moveToScreenPoint:(CGPoint)point | ||
257 | -{ | ||
258 | - RMProjectedPoint mercator = [mapView pixelToProjectedPoint:point]; | ||
259 | - [self moveToProjectedPoint:mercator]; | ||
260 | -} | ||
261 | - | ||
262 | -- (void)moveToCoordinate:(CLLocationCoordinate2D)coordinate | ||
263 | -{ | ||
264 | - RMProjectedPoint mercator = [[mapView projection] coordinateToProjectedPoint:coordinate]; | ||
265 | - [self moveToProjectedPoint:mercator]; | ||
266 | -} | ||
267 | - | ||
268 | -- (void)addLineToProjectedPoint:(RMProjectedPoint)projectedPoint | ||
269 | -{ | ||
270 | - [self addPointToProjectedPoint:projectedPoint withDrawing:YES]; | ||
271 | -} | ||
272 | - | ||
273 | -- (void)addLineToScreenPoint:(CGPoint)point | ||
274 | -{ | ||
275 | - RMProjectedPoint mercator = [mapView pixelToProjectedPoint:point]; | ||
276 | - [self addLineToProjectedPoint:mercator]; | ||
277 | -} | ||
278 | - | ||
279 | -- (void)addLineToCoordinate:(CLLocationCoordinate2D)coordinate | ||
280 | -{ | ||
281 | - RMProjectedPoint mercator = [[mapView projection] coordinateToProjectedPoint:coordinate]; | ||
282 | - [self addLineToProjectedPoint:mercator]; | ||
283 | -} | ||
284 | - | ||
285 | -- (void)performBatchOperations:(void (^)(RMPath *aPath))block | ||
286 | -{ | ||
287 | - ignorePathUpdates = YES; | ||
288 | - block(self); | ||
289 | - ignorePathUpdates = NO; | ||
290 | - | ||
291 | - [self recalculateGeometry]; | ||
292 | -} | ||
293 | - | ||
294 | -#pragma mark - Accessors | ||
295 | - | ||
296 | -- (void)closePath | ||
297 | -{ | ||
298 | - CGPathCloseSubpath(path); | ||
299 | -} | ||
300 | - | ||
301 | -- (float)lineWidth | ||
302 | -{ | ||
303 | - return lineWidth; | ||
304 | -} | ||
305 | - | ||
306 | -- (void)setLineWidth:(float)newLineWidth | ||
307 | -{ | ||
308 | - lineWidth = newLineWidth; | ||
309 | - [self recalculateGeometry]; | ||
310 | -} | ||
311 | - | ||
312 | -- (CGPathDrawingMode)drawingMode | ||
313 | -{ | ||
314 | - return drawingMode; | ||
315 | -} | ||
316 | - | ||
317 | -- (void)setDrawingMode:(CGPathDrawingMode)newDrawingMode | ||
318 | -{ | ||
319 | - drawingMode = newDrawingMode; | ||
320 | - [self setNeedsDisplay]; | ||
321 | -} | ||
322 | - | ||
323 | -- (CGLineCap)lineCap | ||
324 | -{ | ||
325 | - return lineCap; | ||
326 | -} | ||
327 | - | ||
328 | -- (void)setLineCap:(CGLineCap)newLineCap | ||
329 | -{ | ||
330 | - lineCap = newLineCap; | ||
331 | - [self setNeedsDisplay]; | ||
332 | -} | ||
333 | - | ||
334 | -- (CGLineJoin)lineJoin | ||
335 | -{ | ||
336 | - return lineJoin; | ||
337 | -} | ||
338 | - | ||
339 | -- (void)setLineJoin:(CGLineJoin)newLineJoin | ||
340 | -{ | ||
341 | - lineJoin = newLineJoin; | ||
342 | - [self setNeedsDisplay]; | ||
343 | -} | ||
344 | - | ||
345 | -- (UIColor *)lineColor | ||
346 | -{ | ||
347 | - return lineColor; | ||
348 | -} | ||
349 | - | ||
350 | -- (void)setLineColor:(UIColor *)aLineColor | ||
351 | -{ | ||
352 | - if (lineColor != aLineColor) | ||
353 | - { | ||
354 | - [lineColor release]; | ||
355 | - lineColor = [aLineColor retain]; | ||
356 | - [self setNeedsDisplay]; | ||
357 | - } | ||
358 | -} | ||
359 | - | ||
360 | -- (UIColor *)fillColor | ||
361 | -{ | ||
362 | - return fillColor; | ||
363 | -} | ||
364 | - | ||
365 | -- (void)setFillColor:(UIColor *)aFillColor | ||
366 | -{ | ||
367 | - if (fillColor != aFillColor) | ||
368 | - { | ||
369 | - [fillColor release]; | ||
370 | - fillColor = [aFillColor retain]; | ||
371 | - [self setNeedsDisplay]; | ||
372 | - } | ||
373 | -} | ||
374 | - | ||
375 | -- (NSArray *)lineDashLengths | ||
376 | -{ | ||
377 | - NSMutableArray *lengths = [NSMutableArray arrayWithCapacity:_lineDashCount]; | ||
378 | - | ||
379 | - for (size_t dashIndex=0; dashIndex<_lineDashCount; dashIndex++) | ||
380 | - [lengths addObject:(id)[NSNumber numberWithFloat:_lineDashLengths[dashIndex]]]; | ||
381 | - | ||
382 | - return lengths; | ||
383 | -} | ||
384 | - | ||
385 | -- (void)setLineDashLengths:(NSArray *)lengths | ||
386 | -{ | ||
387 | - if (_lineDashLengths) | ||
388 | - { | ||
389 | - free(_lineDashLengths); | ||
390 | - _lineDashLengths = NULL; | ||
391 | - } | ||
392 | - | ||
393 | - if (_scaledLineDashLengths) | ||
394 | - { | ||
395 | - free(_scaledLineDashLengths); | ||
396 | - _scaledLineDashLengths = NULL; | ||
397 | - } | ||
398 | - | ||
399 | - _lineDashCount = [lengths count]; | ||
400 | - | ||
401 | - if (!_lineDashCount) | ||
402 | - return; | ||
403 | - | ||
404 | - _lineDashLengths = calloc(_lineDashCount, sizeof(CGFloat)); | ||
405 | - if (!scaleLineDash) | ||
406 | - _scaledLineDashLengths = calloc(_lineDashCount, sizeof(CGFloat)); | ||
407 | - | ||
408 | - NSEnumerator *lengthEnumerator = [lengths objectEnumerator]; | ||
409 | - id lenObj; | ||
410 | - size_t dashIndex = 0; | ||
411 | - | ||
412 | - while ((lenObj = [lengthEnumerator nextObject])) | ||
413 | - { | ||
414 | - if ([lenObj isKindOfClass:[NSNumber class]]) | ||
415 | - { | ||
416 | - _lineDashLengths[dashIndex] = [lenObj floatValue]; | ||
417 | - } | ||
418 | - else | ||
419 | - { | ||
420 | - _lineDashLengths[dashIndex] = 0.0; | ||
421 | - dashIndex++; | ||
422 | - } | ||
423 | - } | ||
424 | -} | ||
425 | - | ||
426 | -- (void)setPosition:(CGPoint)newPosition animated:(BOOL)animated | ||
427 | -{ | ||
428 | - if (CGPointEqualToPoint(newPosition, super.position) && CGRectEqualToRect(self.bounds, previousBounds)) return; | ||
429 | - | ||
430 | - [self recalculateGeometry]; | ||
431 | -} | ||
432 | - | ||
433 | -@end |
@@ -78,8 +78,6 @@ | @@ -78,8 +78,6 @@ | ||
78 | B8C974620E8A19E8007D16AD /* RMTileSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64EC0E80E73F001663B6 /* RMTileSource.h */; }; | 78 | B8C974620E8A19E8007D16AD /* RMTileSource.h in Headers */ = {isa = PBXBuildFile; fileRef = B83E64EC0E80E73F001663B6 /* RMTileSource.h */; }; |
79 | B8C9746B0E8A1A50007D16AD /* RMMapView.h in Headers */ = {isa = PBXBuildFile; fileRef = B8C974690E8A1A50007D16AD /* RMMapView.h */; }; | 79 | B8C9746B0E8A1A50007D16AD /* RMMapView.h in Headers */ = {isa = PBXBuildFile; fileRef = B8C974690E8A1A50007D16AD /* RMMapView.h */; }; |
80 | B8C9746C0E8A1A50007D16AD /* RMMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = B8C9746A0E8A1A50007D16AD /* RMMapView.m */; }; | 80 | B8C9746C0E8A1A50007D16AD /* RMMapView.m in Sources */ = {isa = PBXBuildFile; fileRef = B8C9746A0E8A1A50007D16AD /* RMMapView.m */; }; |
81 | - B8CEB1C50ED5A3480014C431 /* RMPath.h in Headers */ = {isa = PBXBuildFile; fileRef = B8CEB1C30ED5A3480014C431 /* RMPath.h */; }; | ||
82 | - B8CEB1C60ED5A3480014C431 /* RMPath.m in Sources */ = {isa = PBXBuildFile; fileRef = B8CEB1C40ED5A3480014C431 /* RMPath.m */; }; | ||
83 | B8F3FC610EA2B382004D8F85 /* RMMapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */; }; | 81 | B8F3FC610EA2B382004D8F85 /* RMMapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */; }; |
84 | B8F3FC640EA2E792004D8F85 /* RMMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F3FC620EA2E792004D8F85 /* RMMarker.h */; }; | 82 | B8F3FC640EA2E792004D8F85 /* RMMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F3FC620EA2E792004D8F85 /* RMMarker.h */; }; |
85 | B8F3FC650EA2E792004D8F85 /* RMMarker.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC630EA2E792004D8F85 /* RMMarker.m */; }; | 83 | B8F3FC650EA2E792004D8F85 /* RMMarker.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F3FC630EA2E792004D8F85 /* RMMarker.m */; }; |
@@ -224,8 +222,6 @@ | @@ -224,8 +222,6 @@ | ||
224 | B86F26AC0E87442C007A3773 /* RMMapLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapLayer.h; sourceTree = "<group>"; }; | 222 | B86F26AC0E87442C007A3773 /* RMMapLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapLayer.h; sourceTree = "<group>"; }; |
225 | B8C974690E8A1A50007D16AD /* RMMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapView.h; sourceTree = "<group>"; }; | 223 | B8C974690E8A1A50007D16AD /* RMMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapView.h; sourceTree = "<group>"; }; |
226 | B8C9746A0E8A1A50007D16AD /* RMMapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapView.m; sourceTree = "<group>"; }; | 224 | B8C9746A0E8A1A50007D16AD /* RMMapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapView.m; sourceTree = "<group>"; }; |
227 | - B8CEB1C30ED5A3480014C431 /* RMPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMPath.h; sourceTree = "<group>"; }; | ||
228 | - B8CEB1C40ED5A3480014C431 /* RMPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMPath.m; sourceTree = "<group>"; }; | ||
229 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapLayer.m; sourceTree = "<group>"; }; | 225 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapLayer.m; sourceTree = "<group>"; }; |
230 | B8F3FC620EA2E792004D8F85 /* RMMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMarker.h; sourceTree = "<group>"; }; | 226 | B8F3FC620EA2E792004D8F85 /* RMMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMarker.h; sourceTree = "<group>"; }; |
231 | B8F3FC630EA2E792004D8F85 /* RMMarker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMarker.m; sourceTree = "<group>"; }; | 227 | B8F3FC630EA2E792004D8F85 /* RMMarker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMarker.m; sourceTree = "<group>"; }; |
@@ -468,8 +464,6 @@ | @@ -468,8 +464,6 @@ | ||
468 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */, | 464 | B8F3FC600EA2B382004D8F85 /* RMMapLayer.m */, |
469 | B8F3FC620EA2E792004D8F85 /* RMMarker.h */, | 465 | B8F3FC620EA2E792004D8F85 /* RMMarker.h */, |
470 | B8F3FC630EA2E792004D8F85 /* RMMarker.m */, | 466 | B8F3FC630EA2E792004D8F85 /* RMMarker.m */, |
471 | - B8CEB1C30ED5A3480014C431 /* RMPath.h */, | ||
472 | - B8CEB1C40ED5A3480014C431 /* RMPath.m */, | ||
473 | 16F98C941590CFF000FF90CE /* RMShape.h */, | 467 | 16F98C941590CFF000FF90CE /* RMShape.h */, |
474 | 16F98C951590CFF000FF90CE /* RMShape.m */, | 468 | 16F98C951590CFF000FF90CE /* RMShape.m */, |
475 | 25757F4D1291C8640083D504 /* RMCircle.h */, | 469 | 25757F4D1291C8640083D504 /* RMCircle.h */, |
@@ -611,7 +605,6 @@ | @@ -611,7 +605,6 @@ | ||
611 | 23A0AAEB0EB90AA6003A4521 /* RMFoundation.h in Headers */, | 605 | 23A0AAEB0EB90AA6003A4521 /* RMFoundation.h in Headers */, |
612 | B8800FF20EC3A239003E9CDD /* RMMapViewDelegate.h in Headers */, | 606 | B8800FF20EC3A239003E9CDD /* RMMapViewDelegate.h in Headers */, |
613 | B8800FF30EC3A23D003E9CDD /* RMConfiguration.h in Headers */, | 607 | B8800FF30EC3A23D003E9CDD /* RMConfiguration.h in Headers */, |
614 | - B8CEB1C50ED5A3480014C431 /* RMPath.h in Headers */, | ||
615 | 96492C400FA8AD3400EBA6D2 /* RMGlobalConstants.h in Headers */, | 608 | 96492C400FA8AD3400EBA6D2 /* RMGlobalConstants.h in Headers */, |
616 | B1EB26C610B5D8E6009F8658 /* RMNotifications.h in Headers */, | 609 | B1EB26C610B5D8E6009F8658 /* RMNotifications.h in Headers */, |
617 | D1437B37122869E400888DAE /* RMDBMapSource.h in Headers */, | 610 | D1437B37122869E400888DAE /* RMDBMapSource.h in Headers */, |
@@ -764,7 +757,6 @@ | @@ -764,7 +757,6 @@ | ||
764 | B8474BA50EB40094006A0BC1 /* RMDatabaseCache.m in Sources */, | 757 | B8474BA50EB40094006A0BC1 /* RMDatabaseCache.m in Sources */, |
765 | 126693040EB76C0B00E002D5 /* RMConfiguration.m in Sources */, | 758 | 126693040EB76C0B00E002D5 /* RMConfiguration.m in Sources */, |
766 | 23A0AAE90EB90A99003A4521 /* RMFoundation.c in Sources */, | 759 | 23A0AAE90EB90A99003A4521 /* RMFoundation.c in Sources */, |
767 | - B8CEB1C60ED5A3480014C431 /* RMPath.m in Sources */, | ||
768 | D1437B36122869E400888DAE /* RMDBMapSource.m in Sources */, | 760 | D1437B36122869E400888DAE /* RMDBMapSource.m in Sources */, |
769 | 25757F501291C8640083D504 /* RMCircle.m in Sources */, | 761 | 25757F501291C8640083D504 /* RMCircle.m in Sources */, |
770 | 16EC85D3133CA6C300219947 /* RMAbstractMercatorTileSource.m in Sources */, | 762 | 16EC85D3133CA6C300219947 /* RMAbstractMercatorTileSource.m in Sources */, |
-
Please register or login to post a comment