GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
gis/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 SPDX-FileCopyrightText: 2001-2009, 2011 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author Original author CERL
10 */
11
12#include <grass/gis.h>
13
14#include "G.h"
15
16/*!
17 \brief Adjust east longitude.
18
19 This routine returns an equivalent <i>east</i> that is at least as
20 large as the <i>west</i> coordinate.
21
22 <b>Note:</b> This routine should be used only with
23 latitude-longitude coordinates.
24
25 \param east east coordinate
26 \param west west coordinate
27
28 \return east coordinate
29 */
30double G_adjust_east_longitude(double east, double west)
31{
32 double shift;
33
34 shift = 0;
35 while (east + shift < west)
36 shift += 360.0;
37
38 return east + shift;
39}
40
41/*!
42 \brief Returns east not smaller than west.
43
44 If the region projection is <tt>PROJECTION_LL</tt>, then this
45 routine returns an equivalent <i>east</i> that is not smaller than
46 the coordinate for the western edge of the region and, if possible,
47 smaller than the coordinate for the eastern edge of the region.
48 Otherwise no adjustment is made and the original <i>east</i> is
49 returned.
50
51 \param east east coordinate
52 \param window pointer to Cell_head
53
54 \return east coordinate
55 */
56double G_adjust_easting(double east, const struct Cell_head *window)
57{
58 double shift;
59
60 shift = 0;
61 if (window->proj == PROJECTION_LL) {
62 while (east + shift >= window->east)
63 shift -= 360.0;
64 while (east + shift < window->west)
65 shift += 360.0;
66 }
67
68 return east + shift;
69}
70
71/*!
72 \brief Initialize window (region).
73 */
75{
77 return;
78
80
82}
int G_is_initialized(int *)
Definition counter.c:60
void G_initialize_done(int *)
Definition counter.c:77
void G_get_window(struct Cell_head *)
Get the current region.
Definition get_window.c:45
double G_adjust_east_longitude(double east, double west)
Adjust east longitude.
void G__init_window(void)
Initialize window (region).
double G_adjust_easting(double east, const struct Cell_head *window)
Returns east not smaller than west.
#define PROJECTION_LL
Projection code - Latitude-Longitude.
Definition gis.h:126
2D/3D raster map header (used also for region)
Definition gis.h:443
double east
Extent coordinates (east)
Definition gis.h:493
int proj
Projection code.
Definition gis.h:475
Definition G.h:11
int window_set
Definition G.h:13
struct Cell_head window
Definition G.h:12