GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
raster3d/window.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <grass/gis.h>
3 #include <grass/raster3d.h>
4 #include "raster3d_intern.h"
5 
6 /*---------------------------------------------------------------------------*/
7 
9 
10 /*---------------------------------------------------------------------------*/
11 
12 
13 /*!
14  * \brief
15  *
16  * Sets the window for <em>map</em> to <em>window</em>.
17  * Can be used multiple times for the same map.
18  *
19  * \param map
20  * \param window
21  * \return void
22  */
23 
25 {
26  Rast3d_region_copy(&(map->window), window);
28 }
29 
30 /*---------------------------------------------------------------------------*/
31 
32 
33 /*!
34  * \brief
35  *
36  * Sets the default window used for every map opened later in the program.
37  * Can be used multiple times in the same program.
38  *
39  * \param window
40  * \return void
41  */
42 
44 {
45  Rast3d_region_copy(&g3d_window, window);
46  Rast3d_adjust_region(&g3d_window);
47 }
48 
49 /*---------------------------------------------------------------------------*/
50 
51 
52 /*!
53  * \brief
54  *
55  * Stores the current default window in <em>window</em>.
56  *
57  * \param window
58  * \return void
59  */
60 
62 {
63  Rast3d_region_copy(window, &g3d_window);
64 }
65 
66 /*---------------------------------------------------------------------------*/
67 
69 {
70  return &g3d_window;
71 }
72 
73 
74 /*---------------------------------------------------------------------------*/
75 
76 
77 /*!
78  * \brief
79  *
80  * Returns 1 if window-coordinates <em>(north, east and top)</em> are
81  * inside the window of <em>map</em>. Returns 0 otherwise.
82  *
83  * \param map
84  * \param north
85  * \param east
86  * \param top
87  * \return int
88  */
89 
90 int Rast3d_isValidLocationWindow(RASTER3D_Map * map, double north, double east, double top)
91 {
92  return ((north >= map->window.south) && (north <= map->window.north) &&
93  (east >= map->window.west) && (east <= map->window.east) &&
94  (((top >= map->window.bottom) && (top <= map->window.top)) ||
95  ((top <= map->window.bottom) && (top >= map->window.top))));
96 }
RASTER3D_Region g3d_window
void Rast3d_region_copy(RASTER3D_Region *, RASTER3D_Region *)
Copies the values of regionSrc into regionDst.
Definition: region.c:207
double top
Definition: raster3d.h:52
double bottom
Definition: raster3d.h:52
void Rast3d_set_window(RASTER3D_Region *window)
Sets the default window used for every map opened later in the program. Can be used multiple times in...
double top
Extent coordinates (top) - 3D data.
Definition: gis.h:466
double north
Extent coordinates (north)
Definition: gis.h:458
double west
Definition: raster3d.h:51
void Rast3d_set_window_map(RASTER3D_Map *map, RASTER3D_Region *window)
Sets the window for map to window. Can be used multiple times for the same map.
RASTER3D_Region * Rast3d_window_ptr()
void Rast3d_get_window(RASTER3D_Region *window)
Stores the current default window in window.
void Rast3d_adjust_region(RASTER3D_Region *)
Computes an adjusts the resolutions in the region structure from the region boundaries and number of ...
Definition: region.c:151
double east
Extent coordinates (east)
Definition: gis.h:462
int Rast3d_isValidLocationWindow(RASTER3D_Map *map, double north, double east, double top)
Returns 1 if window-coordinates (north, east and top) are inside the window of map. Returns 0 otherwise.
double south
Definition: raster3d.h:50
RASTER3D_Region window
Definition: raster3d.h:87