/MapView/Map/RMLatLong.h

http://github.com/route-me/route-me · C Header · 89 lines · 23 code · 10 blank · 56 comment · 0 complexity · 4deb59a821698b599f65ffc9ad2278b0 MD5 · raw file

  1. //
  2. // RMLatLong.h
  3. //
  4. // Copyright (c) 2008-2009, Route-Me Contributors
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are met:
  9. //
  10. // * Redistributions of source code must retain the above copyright notice, this
  11. // list of conditions and the following disclaimer.
  12. // * Redistributions in binary form must reproduce the above copyright notice,
  13. // this list of conditions and the following disclaimer in the documentation
  14. // and/or other materials provided with the distribution.
  15. //
  16. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  20. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  26. // POSSIBILITY OF SUCH DAMAGE.
  27. #ifndef _RMLATLONG_H_
  28. #define _RMLATLONG_H_
  29. #import <TargetConditionals.h>
  30. #if TARGET_OS_IPHONE
  31. #import <CoreLocation/CoreLocation.h>
  32. #import "RMGlobalConstants.h"
  33. /*! \struct RMSphericalTrapezium
  34. \brief Specifies a spherical trapezium by northwest and southeast corners, each given as CLLocationCoordinate2D, similar to specifying the corners of a box.
  35. A spherical trapezium is the surface of a sphere or ellipsoid bounded by two meridians and two parallels. Note that in almost all cases, the lengths of the northern and southern sides of the box are different.
  36. */
  37. typedef struct {
  38. CLLocationCoordinate2D northeast;
  39. CLLocationCoordinate2D southwest;
  40. } RMSphericalTrapezium;
  41. #else
  42. /* From CoreLocation by Apple inc. Copyright 2008 Apple Computer, Inc. All rights reserved. */
  43. /*
  44. * CLLocationDegrees
  45. *
  46. * Discussion:
  47. * Type used to represent a latitude or longitude coordinate in degrees under the WGS 84 reference
  48. * frame. The degree can be positive (North and East) or negative (South and West).
  49. */
  50. typedef double CLLocationDegrees;
  51. /*
  52. * CLLocationCoordinate2D
  53. *
  54. * Discussion:
  55. * A structure that contains a geographical coordinate.
  56. *
  57. * Fields:
  58. * latitude:
  59. * The latitude in degrees.
  60. * longitude:
  61. * The longitude in degrees.
  62. */
  63. typedef struct {
  64. CLLocationDegrees latitude;
  65. CLLocationDegrees longitude;
  66. } CLLocationCoordinate2D;
  67. #endif
  68. /*! \struct RMLatLong
  69. \brief latitude/longitude of a point, in WGS-84 degrees
  70. */
  71. typedef CLLocationCoordinate2D RMLatLong;
  72. /// \bug magic numbers
  73. static const double kRMMinLatitude = -kMaxLat;
  74. static const double kRMMaxLatitude = kMaxLat;
  75. static const double kRMMinLongitude = -kMaxLong;
  76. static const double kRMMaxLongitude = kMaxLong;
  77. #endif