GRASS GIS 7 Programmer's Manual  7.2.0(2016)-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 larger, but
22  no more than 360 larger than 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  while (east > west + 360.0)
35  east -= 360.0;
36  while (east <= west)
37  east += 360.0;
38 
39  return east;
40 }
41 
42 /*!
43  \brief Returns east larger than west.
44 
45  If the region projection is <tt>PROJECTION_LL</tt>, then this
46  routine returns an equivalent <i>east</i> that is larger, but no
47  more than 360 degrees larger, than the coordinate for the western
48  edge of the region. Otherwise no adjustment is made and the original
49  <i>east</i> is returned.
50 
51  \param east east coordinate
52  \param window pointer to Cell_head
53 
54  \return east coordinate
55 */
56 double G_adjust_easting(double east, const struct Cell_head *window)
57 {
58  if (window->proj == PROJECTION_LL) {
59  east = G_adjust_east_longitude(east, window->west);
60  if (east > window->east && east == window->west + 360)
61  east = window->west;
62  }
63 
64  return east;
65 }
66 
67 /*!
68  \brief Initialize window (region).
69 */
70 void G__init_window(void)
71 {
73  return;
74 
76 
78 }
79 
void G_get_window(struct Cell_head *window)
Get the current region.
Definition: get_window.c:47
double G_adjust_east_longitude(double east, double west)
Adjust east longitude.
Definition: window_map.c:32
int G_is_initialized(int *p)
Definition: counter.c:59
void G_initialize_done(int *p)
Definition: counter.c:76
struct Cell_head window
Definition: G.h:6
Definition: G.h:4
void G__init_window(void)
Initialize window (region).
Definition: window_map.c:70
int window_set
Definition: G.h:7
double G_adjust_easting(double east, const struct Cell_head *window)
Returns east larger than west.
Definition: window_map.c:56