MAOverlayPathRenderer.h 2.2 KB

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