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