GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-38f5cf43d1
reclass.c File Reference

Raster Library - Check if raster map is reclassified. More...

#include <string.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
Include dependency graph for reclass.c:

Go to the source code of this file.

Functions

int Rast_is_reclass (const char *name, const char *mapset, char *rname, char *rmapset)
 Check if raster map is reclassified. More...
 
int Rast_is_reclassed_to (const char *name, const char *mapset, int *nrmaps, char ***rmaps)
 Get child reclass maps list. More...
 
int Rast_get_reclass (const char *name, const char *mapset, struct Reclass *reclass)
 Get reclass. More...
 
void Rast_free_reclass (struct Reclass *reclass)
 Free Reclass structure. More...
 
int Rast_put_reclass (const char *name, const struct Reclass *reclass)
 Put reclass. More...
 

Detailed Description

Raster Library - Check if raster map is reclassified.

(C) 2001-2009 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 reclass.c.

Function Documentation

◆ Rast_free_reclass()

void Rast_free_reclass ( struct Reclass reclass)

Free Reclass structure.

Parameters
reclasspointer to Reclass structure

Definition at line 183 of file reclass.c.

References G_free(), Reclass::mapset, Reclass::name, NULL, Reclass::num, RECLASS_TABLE, Reclass::table, and Reclass::type.

◆ Rast_get_reclass()

int Rast_get_reclass ( const char *  name,
const char *  mapset,
struct Reclass reclass 
)

Get reclass.

Parameters
namemap name
mapsetmapset name
[out]reclasspointer to Reclass structure
Returns
-1 on error
type code

Definition at line 140 of file reclass.c.

Referenced by Rast__open_old().

◆ Rast_is_reclass()

int Rast_is_reclass ( const char *  name,
const char *  mapset,
char *  rname,
char *  rmapset 
)

Check if raster map is reclassified.

This function determines if the raster map name in mapset is a reclass file. If it is, then the name and mapset of the referenced raster map are copied into the rname and rmapset buffers.

Parameters
namemap name
mapsetmapset name
[out]rnamename of reference map
[out]rmapsetmapset where reference map lives
Returns
1 if it is a reclass file
0 if it is not
-1 if there was a problem reading the raster header

Definition at line 43 of file reclass.c.

Referenced by Rast__mask_info(), Rast_get_cellhd(), and Rast_mask_status().

◆ Rast_is_reclassed_to()

int Rast_is_reclassed_to ( const char *  name,
const char *  mapset,
int *  nrmaps,
char ***  rmaps 
)

Get child reclass maps list.

This function generates a child reclass maps list from the cell_misc/reclassed_to file which stores this list. The cell_misc/reclassed_to file is written by Rast_put_reclass(). Rast_is_reclassed_to() is used by g.rename, g.remove and r.reclass to prevent accidentally deleting the parent map of a reclassed raster map.

Parameters
namemap name
mapsetmapset name
[out]nrmapsnumber of reference maps
[out]rmapsarray of names of reference maps
Returns
number of reference maps
-1 on error

Definition at line 79 of file reclass.c.

References G_fopen_old_misc(), G_malloc, G_realloc, l, name, and NULL.

◆ Rast_put_reclass()

int Rast_put_reclass ( const char *  name,
const struct Reclass reclass 
)

Put reclass.

Parameters
namemap name
reclasspointer to Reclass structure
Returns
-1 on error
1 on success

Definition at line 262 of file reclass.c.

References _, G_fatal_error(), GNAME_MAX, GPATH_MAX, Reclass::max, max, Reclass::min, min, Reclass::num, RECLASS_TABLE, and Reclass::type.