GRASS GIS 7 Programmer's Manual
7.8.2(2019)-exported
window_map.c
Go to the documentation of this file.
1
/*!
2
\file lib/gis/window_map.c
3
4
\brief GIS Library - Window mapping functions.
5
6
(C) 2001-2009, 2011 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 Original author CERL
12
*/
13
14
#include <grass/gis.h>
15
16
#include "
G.h
"
17
18
/*!
19
\brief Adjust east longitude.
20
21
This routine returns an equivalent <i>east</i> that is at least as
22
large as the <i>west</i> coordinate.
23
24
<b>Note:</b> This routine should be used only with
25
latitude-longitude coordinates.
26
27
\param east east coordinate
28
\param west west coordinate
29
30
\return east coordinate
31
*/
32
double
G_adjust_east_longitude
(
double
east,
double
west)
33
{
34
double
shift;
35
36
shift = 0;
37
while
(east + shift < west)
38
shift += 360.0;
39
40
return
east + shift;
41
}
42
43
/*!
44
\brief Returns east not smaller than west.
45
46
If the region projection is <tt>PROJECTION_LL</tt>, then this
47
routine returns an equivalent <i>east</i> that is not smaller than
48
the coordinate for the western edge of the region and, if possible,
49
smaller than the coordinate for the eastern edge of the region.
50
Otherwise no adjustment is made and the original <i>east</i> is
51
returned.
52
53
\param east east coordinate
54
\param window pointer to Cell_head
55
56
\return east coordinate
57
*/
58
double
G_adjust_easting
(
double
east,
const
struct
Cell_head *window)
59
{
60
double
shift;
61
62
shift = 0;
63
if
(window->proj == PROJECTION_LL) {
64
while
(east + shift >= window->east)
65
shift -= 360.0;
66
while
(east + shift < window->west)
67
shift += 360.0;
68
}
69
70
return
east + shift;
71
}
72
73
/*!
74
\brief Initialize window (region).
75
*/
76
void
G__init_window
(
void
)
77
{
78
if
(
G_is_initialized
(&
G__
.
window_set
))
79
return
;
80
81
G_get_window
(&
G__
.
window
);
82
83
G_initialize_done
(&
G__
.
window_set
);
84
}
85
G_adjust_east_longitude
double G_adjust_east_longitude(double east, double west)
Adjust east longitude.
Definition:
window_map.c:32
G_get_window
void G_get_window(struct Cell_head *window)
Get the current region.
Definition:
get_window.c:47
G__::window_set
int window_set
Definition:
G.h:7
G_is_initialized
int G_is_initialized(int *p)
Definition:
counter.c:59
G_initialize_done
void G_initialize_done(int *p)
Definition:
counter.c:76
G.h
G__::window
struct Cell_head window
Definition:
G.h:6
G__
Definition:
G.h:4
G_adjust_easting
double G_adjust_easting(double east, const struct Cell_head *window)
Returns east not smaller than west.
Definition:
window_map.c:58
G__init_window
void G__init_window(void)
Initialize window (region).
Definition:
window_map.c:76
gis
window_map.c
Generated on Sat Jan 25 2020 17:06:53 for GRASS GIS 7 Programmer's Manual by
1.8.16