GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
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 * SPDX-FileCopyrightText: 2001-2014 GRASS Development Team
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 *
9 * \author GRASS Development Team
10 *
11 * \date 1999-2014
12 */
13
14#include <grass/gis.h>
15
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 */
30int G_limit_east(double *east G_UNUSED, int proj G_UNUSED)
31{
32 return 1;
33}
34
35/**
36 * \brief Function not yet implemented...
37 *
38 * If the projection has absolute limits (like lat/lon), then
39 * this routine modifies the input coordinate to be within the
40 * limit.<br>
41 *
42 * <b>Note:</b> Function not yet implemented.
43 *
44 * \param[in] west
45 * \param[in] proj
46 * \return 1 no change
47 * \return 0 changed
48 */
49int G_limit_west(double *west G_UNUSED, int proj G_UNUSED)
50{
51 return 1;
52}
53
54/**
55 * \brief Limit north (y) coordinate
56 *
57 * If the projection has absolute limits (like lat/lon), then
58 * this routine modifies the input coordinate to be within the
59 * limit.<br>
60 *
61 * \param[in,out] north north coordinate
62 * \param[in] proj projection id
63 * \return 1 no change
64 * \return 0 changed
65 */
66int G_limit_north(double *north, int proj)
67{
68 if (proj == PROJECTION_LL) {
69 if (*north > 90.0) {
70 *north = 90.0;
71 return 0;
72 }
73 if (*north < -90) {
74 *north = -90;
75 return 0;
76 }
77 }
78
79 return 1;
80}
81
82/**
83 * \brief Limit south (y) coordinate
84 *
85 * If the projection has absolute limits (like lat/lon), then
86 * this routine modifies the input coordinate to be within the
87 * limit.<br>
88 *
89 * \param[in] south south coordinate
90 * \param[in] proj projection id
91 * \return 1 no change
92 * \return 0 changed
93 */
94int G_limit_south(double *south, int proj)
95{
96 if (proj == PROJECTION_LL) {
97 if (*south > 90.0) {
98 *south = 90.0;
99 return 0;
100 }
101 if (*south < -90) {
102 *south = -90;
103 return 0;
104 }
105 }
106
107 return 1;
108}
#define G_UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition gis.h:43
#define PROJECTION_LL
Projection code - Latitude-Longitude.
Definition gis.h:126
int G_limit_east(double *east, int proj)
Function not yet implemented...
Definition wind_limits.c:30
int G_limit_north(double *north, int proj)
Limit north (y) coordinate.
Definition wind_limits.c:66
int G_limit_south(double *south, int proj)
Limit south (y) coordinate.
Definition wind_limits.c:94
int G_limit_west(double *west, int proj)
Function not yet implemented...
Definition wind_limits.c:49