GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73600
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
get_window.c File Reference

GIS Library - Get window (i.e. GRASS region) More...

#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "G.h"
#include "gis_local_proto.h"
Include dependency graph for get_window.c:

Go to the source code of this file.

Functions

void G_get_window (struct Cell_head *window)
 Get the current region. More...
 
void G_get_default_window (struct Cell_head *window)
 Get the default region. More...
 
void G_get_element_window (struct Cell_head *window, const char *element, const char *name, const char *mapset)
 Get region for selected element (raster, vector, window, etc.) More...
 
void G_unset_window ()
 Unset current region. More...
 

Detailed Description

GIS Library - Get window (i.e. GRASS region)

(C) 2001-2009, 2011 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.

Author
Original author CERL

Definition in file get_window.c.

Function Documentation

void G_get_default_window ( struct Cell_head window)

Get the default region.

Reads the default region for the location into region. 3D values are set to defaults if not available in WIND file.

An error message is printed and exit() is called if there is a problem reading the default region.

Parameters
[out]windowpointer to Cell_head

Definition at line 93 of file get_window.c.

References G_get_element_window().

Referenced by G_make_mapset().

void G_get_element_window ( struct Cell_head window,
const char *  element,
const char *  name,
const char *  mapset 
)

Get region for selected element (raster, vector, window, etc.)

G_fatal_error() is called on error

Parameters
[out]windowpointer to Cell_head
elementelement type
nameelement name
mapsetmapset name

Definition at line 108 of file get_window.c.

References _, fclose(), G__read_Cell_head(), G_fatal_error(), G_fopen_old(), G_fseek(), G_ftell(), and G_zero().

Referenced by G_get_default_window(), and G_get_window().

void G_get_window ( struct Cell_head window)

Get the current region.

Reads the region as stored in the WIND file in the user's current mapset into region.

3D values are set to defaults if not available in WIND file. An error message is printed and exit() is called if there is a problem reading the region.

Note: GRASS applications that read or write raster maps should not use this routine since its use implies that the active module region will not be used. Programs that read or write raster map data (or vector data) can query the active module region using Rast_window_rows() and Rast_window_cols().

Parameters
[out]windowpointer to Cell_head

Definition at line 47 of file get_window.c.

References G__read_Cell_head_array(), G_free_tokens(), G_get_element_window(), G_initialize_done(), G_is_initialized(), G_mapset(), G_tokenize(), getenv(), G__::window, and G__::window_set.

Referenced by G__calloc(), G__init_window(), G__malloc(), G__realloc(), G_point_in_region(), P_set_dim(), P_set_regions(), Rast3d_read_window(), and Vect_write_ascii().

void G_unset_window ( )

Unset current region.

Definition at line 132 of file get_window.c.

References G__::window_set.