GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72636
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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.

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.

References _, fclose(), fd, G_warning(), Reclass::mapset, Reclass::name, NULL, RECLASS_TABLE, and Reclass::type.

Referenced by Rast__open_old().

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.

References fclose(), fd, and NULL.

Referenced by Rast__mask_info(), and Rast_get_cellhd().

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 fclose(), fd, G_fopen_old_misc(), l, and NULL.

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