GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
GIS Library - Window mapping functions. More...
Go to the source code of this file.
Macros | |
#define | alloc_index(n) (COLUMN_MAPPING *) G_malloc((n)*sizeof(COLUMN_MAPPING)) |
Functions | |
int | G__create_window_mapping (int fd) |
Create window mapping. More... | |
double | G_northing_to_row (double north, const struct Cell_head *window) |
Northing to row. More... | |
double | G_adjust_east_longitude (double east, double west) |
Adjust east longitude. More... | |
double | G_adjust_easting (double east, const struct Cell_head *window) |
Returns east larger than west. More... | |
double | G_easting_to_col (double east, const struct Cell_head *window) |
Easting to column. More... | |
double | G_row_to_northing (double row, const struct Cell_head *window) |
Row to northing. More... | |
double | G_col_to_easting (double col, const struct Cell_head *window) |
Column to easting. More... | |
int | G_window_rows (void) |
Number of rows in active window. More... | |
int | G_window_cols (void) |
Number of columns in active window. More... | |
int | G__init_window (void) |
Initialize window. More... | |
int | G_row_repeat_nomask (int fd, int row) |
Loops rows until mismatch?. More... | |
GIS Library - Window mapping functions.
(C) 2001-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file window_map.c.
#define alloc_index | ( | n | ) | (COLUMN_MAPPING *) G_malloc((n)*sizeof(COLUMN_MAPPING)) |
Definition at line 22 of file window_map.c.
Referenced by G__create_window_mapping().
Create window mapping.
Creates mapping from cell header into window. The boundaries and resolution of the two spaces do not have to be the same or aligned in any way.
[in] | fd | file descriptor |
Definition at line 36 of file window_map.c.
References alloc_index, fileinfo::C1, fileinfo::C2, fileinfo::cellhd, fileinfo::col_map, fd, G__::fileinfo, G__init_window(), G_debug(), G_free(), fileinfo::open_mode, OPEN_OLD, and G__::window.
Referenced by G__open_cell_old(), and G_set_window().
int G__init_window | ( | void | ) |
Initialize window.
Definition at line 320 of file window_map.c.
References G_get_window(), G__::window, and G__::window_set.
Referenced by G__create_window_mapping(), G__open_cell_old(), G_get_set_window(), G_window_cols(), and G_window_rows().
double G_adjust_east_longitude | ( | double | east, |
double | west | ||
) |
Adjust east longitude.
This routine returns an equivalent east that is larger, but no more than 360 larger than the west coordinate.
Note: This routine should be used only with latitude-longitude coordinates.
[in,out] | east | |
[in] | west |
Definition at line 149 of file window_map.c.
Referenced by G_adjust_easting().
double G_adjust_easting | ( | double | east, |
const struct Cell_head * | window | ||
) |
Returns east larger than west.
If the region projection is PROJECTION_LL, then this routine returns an equivalent east that is larger, but no more than 360 degrees larger, than the coordinate for the western edge of the region. Otherwise no adjustment is made and the original east is returned.
[in,out] | east | |
[in] | window |
Definition at line 174 of file window_map.c.
References G_adjust_east_longitude().
Referenced by G_easting_to_col(), G_plot_where_en(), G_plot_where_xy(), and G_site_in_region().
double G_col_to_easting | ( | double | col, |
const struct Cell_head * | window | ||
) |
Column to easting.
Converts a col relative to a window to an easting.
Note: col is a double:
[in] | col | |
[in] | window |
Definition at line 243 of file window_map.c.
Referenced by G_align_window().
double G_easting_to_col | ( | double | east, |
const struct Cell_head * | window | ||
) |
Easting to column.
Converts east relative to a window to a column.
Note: The result is a double. Casting it to an int will give the column number.
[in] | east | |
[in] | window |
Definition at line 198 of file window_map.c.
References G_adjust_easting().
Referenced by G_align_window(), G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), and G_get_raster_sample_nearest().
double G_northing_to_row | ( | double | north, |
const struct Cell_head * | window | ||
) |
Northing to row.
Converts a northing relative to a window to a row.
Note: The result is a double. Casting it to an integer will give the row number.
[in] | north | |
[in] | window |
Definition at line 129 of file window_map.c.
Referenced by G_align_window(), G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), and G_get_raster_sample_nearest().
Loops rows until mismatch?.
This routine works fine if the mask is not set. It may give incorrect results with a mask, since the mask row may have a different repeat value. The issue can be fixed by doing it for the mask as well and using the smaller value.
[in] | fd | file descriptor |
[in] | row | starting row |
Definition at line 344 of file window_map.c.
References fileinfo::C1, fileinfo::C2, count, fd, G__::fileinfo, and G__::window.
double G_row_to_northing | ( | double | row, |
const struct Cell_head * | window | ||
) |
Row to northing.
Converts a row relative to a window to a northing.
Note: row is a double:
[in] | row | |
[in] | window |
Definition at line 223 of file window_map.c.
Referenced by G_align_window().
int G_window_cols | ( | void | ) |
Number of columns in active window.
These routines return the number of rows and columns (respectively) in the active module region. Before raster maps can be read or written, it is necessary to known how many rows and columns are in the active region. For example:
Definition at line 306 of file window_map.c.
References G__init_window(), and G__::window.
Referenced by G_allocate_c_raster_buf(), G_allocate_cell_buf(), G_allocate_d_raster_buf(), G_allocate_f_raster_buf(), G_allocate_null_buf(), G_allocate_raster_buf(), G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), G_get_raster_sample_nearest(), G_zero_cell_buf(), G_zero_raster_buf(), and IL_output_2d().
int G_window_rows | ( | void | ) |
Number of rows in active window.
This routine returns the number of rows in the active module window. Before raster files can be read or written, it is necessary to known how many rows are in the active window. For example:
Definition at line 273 of file window_map.c.
References G__init_window(), and G__::window.
Referenced by G_get_raster_sample_bilinear(), G_get_raster_sample_cubic(), G_get_raster_sample_nearest(), and IL_output_2d().