Skip to content

Loading…

Add shadowOffset and shadowBlur properties to RMPath #146

Merged
merged 1 commit into from

1 participant

@vyskocil
Route Me member

Merged code from Mark Rabenhorst mrabenhorst@internationalmapping.com to allow shadow on RMPath

@vyskocil vyskocil merged commit 1ebd23b into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2011
  1. @vyskocil
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 15 deletions.
  1. +13 −8 MapView/Map/RMPath.h
  2. +12 −7 MapView/Map/RMPath.m
View
21 MapView/Map/RMPath.h
@@ -64,16 +64,19 @@
//Line cap and join styles
CGLineCap lineCap;
CGLineJoin lineJoin;
- //Line dash style
+ //Line dash style
CGFloat *_lineDashLengths;
- CGFloat *_scaledLineDashLengths;
- size_t _lineDashCount;
- CGFloat lineDashPhase;
-
+ CGFloat *_scaledLineDashLengths;
+ size_t _lineDashCount;
+ CGFloat lineDashPhase;
+ // Line shadow
+ CGFloat shadowBlur;
+ CGSize shadowOffset;
+
BOOL scaleLineWidth;
- /*! if YES line dashes will be scaled to keep a constant size if the layer is zoomed
- */
- BOOL scaleLineDash;
+ /*! if YES line dashes will be scaled to keep a constant size if the layer is zoomed
+ */
+ BOOL scaleLineDash;
BOOL enableDragging;
BOOL enableRotation;
@@ -93,6 +96,8 @@
@property BOOL scaleLineDash;
@property float lineWidth;
@property BOOL scaleLineWidth;
+@property CGFloat shadowBlur;
+@property CGSize shadowOffset;
@property (nonatomic, assign) RMProjectedPoint projectedLocation;
@property (assign) BOOL enableDragging;
@property (assign) BOOL enableRotation;
View
19 MapView/Map/RMPath.m
@@ -40,6 +40,8 @@ @implementation RMPath
@synthesize enableRotation;
@synthesize lineDashPhase;
@synthesize scaleLineDash;
+@synthesize shadowBlur;
+@synthesize shadowOffset;
#define kDefaultLineWidth 2
@@ -59,14 +61,16 @@ - (id) initWithContents: (RMMapContents*)aContents
lineColor = [UIColor blackColor];
fillColor = [UIColor redColor];
_lineDashCount = 0;
- _lineDashLengths = NULL;
- _scaledLineDashLengths = NULL;
- lineDashPhase = 0.0;
+ _lineDashLengths = NULL;
+ _scaledLineDashLengths = NULL;
+ lineDashPhase = 0.0;
+ shadowBlur = 0.0;
+ shadowOffset = CGSizeMake(0, 0);
self.masksToBounds = YES;
scaleLineWidth = NO;
- scaleLineDash = NO;
+ scaleLineDash = NO;
enableDragging = YES;
enableRotation = YES;
isFirstPoint = YES;
@@ -258,9 +262,10 @@ - (void)drawInContext:(CGContextRef)theContext
CGContextSetLineJoin(theContext, lineJoin);
CGContextSetStrokeColorWithColor(theContext, [lineColor CGColor]);
CGContextSetFillColorWithColor(theContext, [fillColor CGColor]);
- if(_lineDashLengths){
- CGContextSetLineDash(theContext, lineDashPhase, dashLengths, _lineDashCount);
- }
+ if(_lineDashLengths){
+ CGContextSetLineDash(theContext, lineDashPhase, dashLengths, _lineDashCount);
+ }
+ CGContextSetShadow(theContext, shadowOffset, shadowBlur);
// according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary
CGContextDrawPath(theContext, drawingMode);
Something went wrong with that request. Please try again.