GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-847944e18e
wind_limits.c
Go to the documentation of this file.
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 
16 #include <grass/gis.h>
17 
18 /**
19  * \brief Function not yet implemented...
20  *
21  * If the projection has absolute limits (like lat/lon), then
22  * this routine modifies the input coordinate to be within the
23  * limit.<br>
24  *
25  * <b>Note:</b> Function not yet implemented.
26  *
27  * \param[in] east
28  * \param[in] proj
29  * \return 1 no change
30  * \return 0 changed
31  */
32 
33 int G_limit_east(double *east UNUSED, int proj UNUSED)
34 {
35  return 1;
36 }
37 
38 /**
39  * \brief Function not yet implemented...
40  *
41  * If the projection has absolute limits (like lat/lon), then
42  * this routine modifies the input coordinate to be within the
43  * limit.<br>
44  *
45  * <b>Note:</b> Function not yet implemented.
46  *
47  * \param[in] west
48  * \param[in] proj
49  * \return 1 no change
50  * \return 0 changed
51  */
52 
53 int G_limit_west(double *west UNUSED, int proj UNUSED)
54 {
55  return 1;
56 }
57 
58 /**
59  * \brief Limit north (y) coordinate
60  *
61  * If the projection has absolute limits (like lat/lon), then
62  * this routine modifies the input coordinate to be within the
63  * limit.<br>
64  *
65  * \param[in,out] north north coordinate
66  * \param[in] proj projection id
67  * \return 1 no change
68  * \return 0 changed
69  */
70 
71 int G_limit_north(double *north, int proj)
72 {
73  if (proj == PROJECTION_LL) {
74  if (*north > 90.0) {
75  *north = 90.0;
76  return 0;
77  }
78  if (*north < -90) {
79  *north = -90;
80  return 0;
81  }
82  }
83 
84  return 1;
85 }
86 
87 /**
88  * \brief Limit south (y) coordinate
89  *
90  * If the projection has absolute limits (like lat/lon), then
91  * this routine modifies the input coordinate to be within the
92  * limit.<br>
93  *
94  * \param[in] south south coordinate
95  * \param[in] proj projection id
96  * \return 1 no change
97  * \return 0 changed
98  */
99 
100 int G_limit_south(double *south, int proj)
101 {
102  if (proj == PROJECTION_LL) {
103  if (*south > 90.0) {
104  *south = 90.0;
105  return 0;
106  }
107  if (*south < -90) {
108  *south = -90;
109  return 0;
110  }
111  }
112 
113  return 1;
114 }
#define PROJECTION_LL
Projection code - Latitude-Longitude.
Definition: gis.h:130
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47
int G_limit_west(double *west UNUSED, int proj UNUSED)
Function not yet implemented...
Definition: wind_limits.c:53
int G_limit_north(double *north, int proj)
Limit north (y) coordinate.
Definition: wind_limits.c:71
int G_limit_south(double *south, int proj)
Limit south (y) coordinate.
Definition: wind_limits.c:100
int G_limit_east(double *east UNUSED, int proj UNUSED)
Function not yet implemented...
Definition: wind_limits.c:33