GMSURLTileLayer.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // GMSURLTileLayer.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 <GoogleMaps/GMSTileLayer.h>
  11. #if __has_feature(modules)
  12. @import GoogleMapsBase;
  13. #else
  14. #import <GoogleMapsBase/GoogleMapsBase.h>
  15. #endif
  16. @class NSURL;
  17. GMS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * |GMSTileURLConstructor| is a block taking |x|, |y| and |zoom|
  20. * and returning an NSURL, or nil to indicate no tile for that location.
  21. */
  22. typedef NSURL *GMS_NULLABLE_PTR (^GMSTileURLConstructor)(NSUInteger x, NSUInteger y,
  23. NSUInteger zoom);
  24. /**
  25. * GMSURLTileProvider fetches tiles based on the URLs returned from a
  26. * GMSTileURLConstructor. For example:
  27. * <pre>
  28. * GMSTileURLConstructor constructor = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
  29. * NSString *URLStr =
  30. * [NSString stringWithFormat:@"https://example.com/%d/%d/%d.png", x, y, zoom];
  31. * return [NSURL URLWithString:URLStr];
  32. * };
  33. * GMSTileLayer *layer =
  34. * [GMSURLTileLayer tileLayerWithURLConstructor:constructor];
  35. * layer.userAgent = @"SDK user agent";
  36. * layer.map = map;
  37. * </pre>
  38. *
  39. * GMSURLTileProvider may not be subclassed and should only be created via its
  40. * convenience constructor.
  41. */
  42. @interface GMSURLTileLayer : GMSTileLayer
  43. /** Convenience constructor. |constructor| must be non-nil. */
  44. + (instancetype)tileLayerWithURLConstructor:(GMSTileURLConstructor)constructor;
  45. /**
  46. * Specify the user agent to describe your application. If this is nil (the
  47. * default), the default iOS user agent is used for HTTP requests.
  48. */
  49. @property(nonatomic, copy) NSString *GMS_NULLABLE_PTR userAgent;
  50. @end
  51. GMS_ASSUME_NONNULL_END