GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-f8115df121
gis/set_window.c
Go to the documentation of this file.
1 /*!
2  \file lib/gis/set_window.c
3 
4  \brief GIS Library - Set window (map region)
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 #include <grass/glocale.h>
16 
17 #include "G.h"
18 
19 #include "gis_local_proto.h"
20 
21 /*!
22  \brief Get the current working window (region)
23 
24  The current working window values are returned in the structure
25  \p window.
26 
27  Previous calls to G_set_window() affects values returned by this function.
28  Previous calls to G_put_window() affects values returned by this function
29  only if the current working window is not initialized.
30 
31  \param[out] window pointer to window structure to be set
32 
33  \sa G_set_window(), G_get_window()
34  */
35 void G_get_set_window(struct Cell_head *window)
36 {
38  *window = G__.window;
39 }
40 
41 /*!
42  \brief Establishes \p window as the current working window (region).
43 
44  This function adjusts the \p window before setting the region
45  so you don't have to call G_adjust_Cell_head().
46 
47  \note Only the current process is affected.
48 
49  \param window window to become operative window
50 
51  \sa G_get_set_window(), G_put_window()
52  */
53 void G_set_window(struct Cell_head *window)
54 {
55  /* adjust window, check for valid window */
56  G_adjust_Cell_head(window, 0, 0);
57 
58  /* copy the window to the current window */
59  G__.window = *window;
60  G__.window_set = 1;
61 }
void G__init_window(void)
Initialize window (region).
void G_adjust_Cell_head(struct Cell_head *, int, int)
Adjust cell header.
Definition: adj_cellhd.c:51
void G_get_set_window(struct Cell_head *window)
Get the current working window (region)
void G_set_window(struct Cell_head *window)
Establishes window as the current working window (region).
2D/3D raster map header (used also for region)
Definition: gis.h:437
Definition: G.h:5
int window_set
Definition: G.h:7
struct Cell_head window
Definition: G.h:6