GMSMapLayer.h 3.6 KB

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