GMSMapLayer.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // GMSMapLayer.h
  3. // Google Maps SDK for iOS
  4. //
  5. // Copyright 2013 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. #import <CoreLocation/CoreLocation.h>
  11. #import <QuartzCore/QuartzCore.h>
  12. #import <GoogleMaps/GMSCALayer.h>
  13. #if __has_feature(modules)
  14. @import GoogleMapsBase;
  15. #else
  16. #import <GoogleMapsBase/GoogleMapsBase.h>
  17. #endif
  18. GMS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * The following layer properties and constants describe the camera properties
  21. * that may be animated on the custom model layer of a GMSMapView with Core
  22. * Animation. For simple camera control and animation, please see the helper
  23. * methods in GMSMapView+Animation.h, and the camera object definition within
  24. * GMSCameraPosition.h.
  25. *
  26. * Changing layer properties triggers an implicit animation, e.g.:-
  27. * mapView_.layer.cameraBearing = 20;
  28. *
  29. * An explicit animation, replacing the implicit animation, may be added after
  30. * changing the property, e.g.-
  31. * CAMediaTimingFunction *curve = [CAMediaTimingFunction functionWithName:
  32. * kCAMediaTimingFunctionEaseInEaseOut];
  33. * CABasicAnimation *animation =
  34. * [CABasicAnimation animationWithKeyPath:kGMSLayerCameraBearingKey];
  35. * animation.duration = 2.0f;
  36. * animation.timingFunction = curve;
  37. * animation.toValue = @20;
  38. * [mapView_.layer addAnimation:animation forKey:kGMSLayerCameraBearingKey];
  39. *
  40. * To control several implicit animations, Core Animation's transaction support
  41. * may be used, e.g.-
  42. * [CATransaction begin];
  43. * [CATransaction setAnimationDuration:2.0f];
  44. * mapView_.layer.cameraBearing = 20;
  45. * mapView_.layer.cameraViewingAngle = 30;
  46. * [CATransaction commit];
  47. *
  48. * Note that these properties are not view-based. Please see "Animating View
  49. * and Layer Changes Together" in the View Programming Guide for iOS-
  50. * http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/AnimatingViews/AnimatingViews.html
  51. */
  52. /**
  53. * kGMSLayerCameraLatitudeKey ranges from [-85, 85], and values outside this
  54. * range will be clamped.
  55. */
  56. extern NSString *const kGMSLayerCameraLatitudeKey;
  57. /**
  58. * kGMSLayerCameraLongitudeKey ranges from [-180, 180), and values outside this
  59. * range will be wrapped to within this range.
  60. */
  61. extern NSString *const kGMSLayerCameraLongitudeKey;
  62. /**
  63. * kGMSLayerCameraBearingKey ranges from [0, 360), and values are wrapped.
  64. */
  65. extern NSString *const kGMSLayerCameraBearingKey;
  66. /**
  67. * kGMSLayerCameraZoomLevelKey ranges from [kGMSMinZoomLevel, kGMSMaxZoomLevel],
  68. * and values are clamped.
  69. */
  70. extern NSString *const kGMSLayerCameraZoomLevelKey;
  71. /**
  72. * kGMSLayerCameraViewingAngleKey ranges from zero (i.e., facing straight down)
  73. * and to between 30 and 45 degrees towards the horizon, depending on the model
  74. * zoom level.
  75. */
  76. extern NSString *const kGMSLayerCameraViewingAngleKey;
  77. /**
  78. * GMSMapLayer is a custom subclass of CALayer, provided as the layer class on
  79. * GMSMapView. This layer should not be instantiated directly. It provides
  80. * model access to the camera normally defined on GMSMapView.
  81. *
  82. * Modifying or animating these properties will typically interrupt any current
  83. * gesture on GMSMapView, e.g., a user's pan or rotation. Similarly, if a user
  84. * performs an enabled gesture during an animation, the animation will stop
  85. * 'in-place' (at the current presentation value).
  86. */
  87. @interface GMSMapLayer : GMSCALayer
  88. @property(nonatomic, assign) CLLocationDegrees cameraLatitude;
  89. @property(nonatomic, assign) CLLocationDegrees cameraLongitude;
  90. @property(nonatomic, assign) CLLocationDirection cameraBearing;
  91. @property(nonatomic, assign) float cameraZoomLevel;
  92. @property(nonatomic, assign) double cameraViewingAngle;
  93. @end
  94. GMS_ASSUME_NONNULL_END