MAOverlayPathView.h 2.2 KB

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