GMSPolyline.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // GMSPolyline.h
  3. // Google Maps SDK for iOS
  4. //
  5. // Copyright 2012 Google Inc.
  6. //
  7. // Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
  8. // Service: https://developers.google.com/maps/terms
  9. //
  10. #if __has_feature(modules)
  11. @import GoogleMapsBase;
  12. #else
  13. #import <GoogleMapsBase/GoogleMapsBase.h>
  14. #endif
  15. #import <GoogleMaps/GMSOverlay.h>
  16. @class GMSPath;
  17. GMS_ASSUME_NONNULL_BEGIN
  18. /** Describes the drawing style for one-dimensional entities such as polylines. */
  19. @interface GMSStrokeStyle : NSObject
  20. /** Creates a solid color stroke style. */
  21. + (instancetype)solidColor:(UIColor *)color;
  22. /** Creates a gradient stroke style interpolating from |fromColor| to |toColor|. */
  23. + (instancetype)gradientFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor;
  24. @end
  25. /** Describes the style for some region of a polyline. */
  26. @interface GMSStyleSpan : NSObject
  27. /**
  28. * Factory returning a solid color span of length one segment. Equivalent to
  29. * [GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:|color|] segments:1].
  30. */
  31. + (instancetype)spanWithColor:(UIColor *)color;
  32. /**
  33. * Factory returning a solid color span with a given number of segments. Equivalent to
  34. * [GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:|color|] segments:|segments|].
  35. */
  36. + (instancetype)spanWithColor:(UIColor *)color segments:(double)segments;
  37. /**
  38. * Factory returning a span with the given |style| of length one segment. Equivalent to
  39. * [GMSStyleSpan spanWithStyle:|style| segments:1].
  40. */
  41. + (instancetype)spanWithStyle:(GMSStrokeStyle *)style;
  42. /**
  43. * Factory returning a span with the given |style| and length in number of segments.
  44. * |segments| must be greater than 0 (i.e. can't be 0).
  45. */
  46. + (instancetype)spanWithStyle:(GMSStrokeStyle *)style segments:(double)segments;
  47. /** The style of this span. */
  48. @property(nonatomic, readonly) GMSStrokeStyle *style;
  49. /** The length of this span in number of segments. */
  50. @property(nonatomic, readonly) double segments;
  51. @end
  52. /**
  53. * GMSPolyline specifies the available options for a polyline that exists on the Earth's surface.
  54. * It is drawn as a physical line between the points specified in |path|.
  55. */
  56. @interface GMSPolyline : GMSOverlay
  57. /**
  58. * The path that describes this polyline.
  59. */
  60. @property(nonatomic, copy) GMSPath *GMS_NULLABLE_PTR path;
  61. /**
  62. * The width of the line in screen points. Defaults to 1.
  63. */
  64. @property(nonatomic, assign) CGFloat strokeWidth;
  65. /**
  66. * The UIColor used to render the polyline. Defaults to [UIColor blueColor].
  67. */
  68. @property(nonatomic, strong) UIColor *strokeColor;
  69. /** Whether this line should be rendered with geodesic correction. */
  70. @property(nonatomic, assign) BOOL geodesic;
  71. /**
  72. * Convenience constructor for GMSPolyline for a particular path. Other properties will have
  73. * default values.
  74. */
  75. + (instancetype)polylineWithPath:(GMSPath *GMS_NULLABLE_PTR)path;
  76. /**
  77. * An array containing GMSStyleSpan, the spans used to render this polyline.
  78. *
  79. * If this array contains fewer segments than the polyline itself, the final segment will be applied
  80. * over the remaining length. If this array is unset or empty, then |strokeColor| is used for the
  81. * entire line instead.
  82. */
  83. @property(nonatomic, copy) GMS_NSArrayOf(GMSStyleSpan *) * GMS_NULLABLE_PTR spans;
  84. @end
  85. GMS_ASSUME_NONNULL_END