wind_limits.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*!
  2. * \file lib/gis/wind_limits.c
  3. *
  4. * \brief GIS Library - Projection limit functions.
  5. *
  6. * (C) 2001-2014 by the GRASS Development Team
  7. *
  8. * This program is free software under the GNU General Public License
  9. * (>=v2). Read the file COPYING that comes with GRASS for details.
  10. *
  11. * \author GRASS GIS Development Team
  12. *
  13. * \date 1999-2014
  14. */
  15. #include <grass/gis.h>
  16. /**
  17. * \brief Function not yet implemented...
  18. *
  19. * If the projection has absolute limits (like lat/lon), then
  20. * this routine modifies the input coordinate to be within the
  21. * limit.<br>
  22. *
  23. * <b>Note:</b> Function not yet implemented.
  24. *
  25. * \param[in] east
  26. * \param[in] proj
  27. * \return 1 no change
  28. * \return 0 changed
  29. */
  30. int G_limit_east(double *east, int proj)
  31. {
  32. return 1;
  33. }
  34. /**
  35. * \brief Function not yet implemented...
  36. *
  37. * If the projection has absolute limits (like lat/lon), then
  38. * this routine modifies the input coordinate to be within the
  39. * limit.<br>
  40. *
  41. * <b>Note:</b> Function not yet implemented.
  42. *
  43. * \param[in] west
  44. * \param[in] proj
  45. * \return 1 no change
  46. * \return 0 changed
  47. */
  48. int G_limit_west(double *west, int proj)
  49. {
  50. return 1;
  51. }
  52. /**
  53. * \brief Limit north (y) coordinate
  54. *
  55. * If the projection has absolute limits (like lat/lon), then
  56. * this routine modifies the input coordinate to be within the
  57. * limit.<br>
  58. *
  59. * \param[in,out] north north coordinate
  60. * \param[in] proj projection id
  61. * \return 1 no change
  62. * \return 0 changed
  63. */
  64. int G_limit_north(double *north, int proj)
  65. {
  66. if (proj == PROJECTION_LL) {
  67. if (*north > 90.0) {
  68. *north = 90.0;
  69. return 0;
  70. }
  71. if (*north < -90) {
  72. *north = -90;
  73. return 0;
  74. }
  75. }
  76. return 1;
  77. }
  78. /**
  79. * \brief Limit south (y) coordinate
  80. *
  81. * If the projection has absolute limits (like lat/lon), then
  82. * this routine modifies the input coordinate to be within the
  83. * limit.<br>
  84. *
  85. * \param[in] south south coordinate
  86. * \param[in] proj projection id
  87. * \return 1 no change
  88. * \return 0 changed
  89. */
  90. int G_limit_south(double *south, int proj)
  91. {
  92. if (proj == PROJECTION_LL) {
  93. if (*south > 90.0) {
  94. *south = 90.0;
  95. return 0;
  96. }
  97. if (*south < -90) {
  98. *south = -90;
  99. return 0;
  100. }
  101. }
  102. return 1;
  103. }