GMSCoordinateBounds.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // GMSCoordinateBounds.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 <GoogleMapsBase/GMSCompatabilityMacros.h>
  12. GMS_ASSUME_NONNULL_BEGIN
  13. /**
  14. * GMSCoordinateBounds represents a rectangular bounding box on the Earth's
  15. * surface. GMSCoordinateBounds is immutable and can't be modified after
  16. * construction.
  17. */
  18. @interface GMSCoordinateBounds : NSObject
  19. /** The North-East corner of these bounds. */
  20. @property(nonatomic, readonly) CLLocationCoordinate2D northEast;
  21. /** The South-West corner of these bounds. */
  22. @property(nonatomic, readonly) CLLocationCoordinate2D southWest;
  23. /**
  24. * Returns NO if this bounds does not contain any points.
  25. * For example, [[GMSCoordinateBounds alloc] init].valid == NO.
  26. * When an invalid bounds is expanded with valid coordinates via
  27. * includingCoordinate: or includingBounds:, the resulting bounds will be valid
  28. * but contain only the new coordinates.
  29. */
  30. @property(readonly, getter=isValid) BOOL valid;
  31. /**
  32. * Inits the northEast and southWest bounds corresponding
  33. * to the rectangular region defined by the two corners.
  34. *
  35. * It is ambiguous whether the longitude of the box
  36. * extends from |coord1| to |coord2| or vice-versa;
  37. * the box is constructed as the smaller of the two variants, eliminating the
  38. * ambiguity.
  39. */
  40. - (id)initWithCoordinate:(CLLocationCoordinate2D)coord1
  41. coordinate:(CLLocationCoordinate2D)coord2;
  42. /**
  43. * Returns a GMSCoordinateBounds representing
  44. * the current bounds extended to include the passed-in coordinate.
  45. * If the current bounds is invalid, the result is a valid bounds containing
  46. * only |coordinate|.
  47. */
  48. - (GMSCoordinateBounds *)includingCoordinate:(CLLocationCoordinate2D)coordinate;
  49. /**
  50. * Returns a GMSCoordinateBounds representing
  51. * the current bounds extended to include the entire other bounds.
  52. * If the current bounds is invalid, the result is a valid bounds equal
  53. * to |other|.
  54. */
  55. - (GMSCoordinateBounds *)includingBounds:(GMSCoordinateBounds *)other;
  56. /**
  57. * Returns YES if |coordinate| is contained within this bounds. This includes
  58. * points that lie exactly on the edge of the bounds.
  59. */
  60. - (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinate;
  61. /**
  62. * Returns YES if |other| overlaps with this bounds.
  63. * Two bounds are overlapping if there is at least one coordinate point
  64. * contained by both.
  65. */
  66. - (BOOL)intersectsBounds:(GMSCoordinateBounds *)other;
  67. @end
  68. GMS_ASSUME_NONNULL_END