/MapView/Map/RMFoundation.h

http://github.com/route-me/route-me · C Header · 71 lines · 24 code · 9 blank · 38 comment · 0 complexity · 000a7d9901ce43eb1e507423055597e3 MD5 · raw file

  1. //
  2. // RMFoundation.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. #import <stdbool.h>
  28. /*! \struct RMProjectedPoint
  29. \brief coordinates, in projected meters, paralleling CGPoint */
  30. typedef struct {
  31. double easting, northing;
  32. } RMProjectedPoint;
  33. /*! \struct RMProjectedSize
  34. \brief width/height struct, in projected meters, paralleling CGSize */
  35. typedef struct {
  36. double width, height;
  37. } RMProjectedSize;
  38. /*! \struct RMProjectedRect
  39. \brief location and size, in projected meters, paralleling CGRect */
  40. typedef struct {
  41. RMProjectedPoint origin;
  42. RMProjectedSize size;
  43. } RMProjectedRect;
  44. /// \brief The function checks whether two passed projected points are equal.
  45. bool RMProjectedPointEqualToProjectedPoint(RMProjectedPoint point1, RMProjectedPoint point2);
  46. /// \brief The fuction returns true if the passed sizes are equal
  47. bool RMProjectedSizeEqualToProjectedSize(RMProjectedSize size1, RMProjectedSize size2);
  48. /// \brief The fuction returns true if the passed rects are equal
  49. bool RMProjectedRectEqualToProjectedRect(RMProjectedRect rect1, RMProjectedRect rect2);
  50. /// \brief The function returns true if passed rects intersect each other.
  51. bool RMProjectedRectInterectsProjectedRect(RMProjectedRect rect1, RMProjectedRect rect2);
  52. RMProjectedPoint RMScaleProjectedPointAboutPoint (RMProjectedPoint point, float factor, RMProjectedPoint pivot);
  53. RMProjectedRect RMScaleProjectedRectAboutPoint(RMProjectedRect rect, float factor, RMProjectedPoint pivot);
  54. RMProjectedPoint RMTranslateProjectedPointBy (RMProjectedPoint point, RMProjectedSize delta);
  55. RMProjectedRect RMTranslateProjectedRectBy (RMProjectedRect rect, RMProjectedSize delta);
  56. RMProjectedPoint RMMakeProjectedPoint (double easting, double northing);
  57. RMProjectedSize RMMakeProjectedSize(double width, double height);
  58. RMProjectedRect RMMakeProjectedRect (double easting, double northing, double width, double height);
  59. /// \brief The function returns the midpoint easting of the given rect.
  60. double RMProjectedRectGetMidEasting(RMProjectedRect rect);
  61. /// \brief The function returns the midpoint northing of the given rect.
  62. double RMProjectedRectGetMidNorthing(RMProjectedRect rect);