MAOverlayPathRenderer.h.svn-base 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // MAOverlayPathRenderer.h
  3. // MAMapKit
  4. //
  5. // Created by AutoNavi.
  6. // Copyright (c) 2013年 Amap. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "MAOverlayRenderer.h"
  10. ///该类提供使用CGPathRef来绘制overlay,默认的操作是使用fill attributes, stroke attributes绘制当前path到context中, 可以使用该类的子类MACircleRenderer, MAPolylineRenderer, MAPolygonRenderer或者继承该类, 如果继承该类,需要重载-(void)createPath方法
  11. @interface MAOverlayPathRenderer : MAOverlayRenderer
  12. ///填充颜色,默认是[UIColor colorWithRed:0 green:1 blue:0 alpha:0.6]
  13. @property (strong) UIColor *fillColor;
  14. ///笔触颜色,默认是[UIColor colorWithRed:1 green:0 blue:0 alpha:0.6]
  15. @property (strong) UIColor *strokeColor;
  16. ///笔触宽度,默认是0
  17. @property CGFloat lineWidth;
  18. ///LineJoin,默认是kCGLineJoinRound
  19. @property CGLineJoin lineJoin;
  20. ///LineCap,默认是kCGLineCapRound
  21. @property CGLineCap lineCap;
  22. ///MiterLimit,默认是10.f
  23. @property CGFloat miterLimit;
  24. ///LineDashPhase,默认是0.f
  25. @property CGFloat lineDashPhase;
  26. ///LineDashPattern,默认是nil
  27. @property (copy) NSArray *lineDashPattern;
  28. ///当前的path
  29. @property CGPathRef path;
  30. /**
  31. * @brief 子类需要重载该方法并设置(self.path = newPath)
  32. */
  33. - (void)createPath;
  34. /**
  35. * @brief 释放当前path,调用之后 path == NULL
  36. */
  37. - (void)invalidatePath;
  38. /**
  39. * @brief 将当前的stroke attributes设置到指定的context
  40. * @param context 目标context
  41. * @param zoomScale 当前缩放比例值
  42. */
  43. - (void)applyStrokePropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
  44. /**
  45. * @brief 将当前的fill attributes设置到指定的context
  46. * @param context 目标context
  47. * @param zoomScale 当前缩放比例值
  48. */
  49. - (void)applyFillPropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
  50. /**
  51. * @brief 绘制path
  52. * @param path 要绘制的path
  53. * @param context 目标context
  54. */
  55. - (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context;
  56. /**
  57. * @brief 填充path
  58. * @param path 要绘制的path
  59. * @param context 目标context
  60. */
  61. - (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context;
  62. @end