GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Raster Library - Get mask information. More...
Go to the source code of this file.
Functions | |
char * | Rast_mask_info (void) |
Get a printable text with information about raster mask. More... | |
char * | Rast_mask_name (void) |
Retrieves the name of the raster mask to use. More... | |
bool | Rast_mask_status (char *name, char *mapset, bool *is_mask_reclass, char *reclass_name, char *reclass_mapset) |
Get raster mask status information. More... | |
int | Rast__mask_info (char *name, char *mapset) |
Get information about the current mask. More... | |
bool | Rast_mask_is_present (void) |
Check presence of 2D raster mask. More... | |
Raster Library - Get mask information.
(C) 1999-2024 by Vaclav Petras and 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 mask_info.c.
int Rast__mask_info | ( | char * | name, |
char * | mapset | ||
) |
Get information about the current mask.
Determines the status of the automatic masking and the name of the 2D raster which forms the mask. Typically, mask is raster called MASK in the current mapset, but when used with r.mask, it is usually a reclassed raster, and so when a MASK raster is present and it is a reclass raster, the name and mapset of the underlying reclassed raster are returned.
The name and mapset is written to the parameter which need to be defined with a sufficient size, least as char name[GNAME_MAX], mapset[GMAPSET_MAX]
.
When the masking is not active, -1 is returned and name and mapset are undefined. When the masking is active, 1 is returned and name and mapset will hold the name and mapset of the underlying raster.
[out] | name | Name of the raster map used as mask |
[out] | mapset | Name of the map's mapset |
Definition at line 143 of file mask_info.c.
References G_find_raster(), G_mapset(), G_strlcpy(), GMAPSET_MAX, GNAME_MAX, name, Rast_is_reclass(), and strcpy.
Referenced by Rast_mask_info(), and Rast_mask_status().
char* Rast_mask_info | ( | void | ) |
Get a printable text with information about raster mask.
Determines if 2D raster mask is present and returns textual information about the mask suitable for end-user display. The resulting text is translated. Caller is responsible for freeing the memory of the returned string.
Definition at line 31 of file mask_info.c.
References _, G_store(), GMAPSET_MAX, GNAME_MAX, name, Rast__mask_info(), and strcpy.
bool Rast_mask_is_present | ( | void | ) |
Check presence of 2D raster mask.
Definition at line 168 of file mask_info.c.
References G_find_raster(), G_mapset(), and NULL.
char* Rast_mask_name | ( | void | ) |
Retrieves the name of the raster mask to use.
The returned raster map name is fully qualified, i.e., in the form % "name@mapset".
The mask name is "MASK@<mapset>", where <mapset> is the current mapset.
The memory for the returned mask name is dynamically allocated using G_store(). It is the caller's responsibility to free the memory with G_free() when it is no longer needed.
Definition at line 67 of file mask_info.c.
References G_fully_qualified_name(), and G_mapset().
bool Rast_mask_status | ( | char * | name, |
char * | mapset, | ||
bool * | is_mask_reclass, | ||
char * | reclass_name, | ||
char * | reclass_mapset | ||
) |
Get raster mask status information.
is_mask_reclass is a pointer to a bool variable which will be set to true if mask raster is a reclass and false otherwise.
If you are not interested in the underlying reclassified raster map, pass NULL pointers for the three reclass parameters:
[out] | name | Name of the raster map used as mask |
[out] | mapset | Name of the mapset the raster is in |
[out] | is_mask_reclass | Will be set to true if mask raster is a reclass |
[out] | reclass_name | Name of the underlying reclassified raster map |
[out] | reclass_mapset | Name of the mapset the reclassified raster is in |
Definition at line 94 of file mask_info.c.
References G_mapset(), name, Rast__mask_info(), Rast_is_reclass(), and strcpy.