GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
raster/cats.c File Reference

Raster Library - Raster categories management. More...

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

Go to the source code of this file.

Functions

int Rast_read_cats (const char *name, const char *mapset, struct Categories *pcats)
 Read raster category file. More...
 
int Rast_read_vector_cats (const char *name, const char *mapset, struct Categories *pcats)
 Read vector category file. More...
 
CELL Rast_get_max_c_cat (const char *name, const char *mapset)
 Get the max category number. More...
 
char * Rast_get_cats_title (const struct Categories *pcats)
 Get title from category structure struct. More...
 
char * Rast_get_c_cat (CELL *rast, struct Categories *pcats)
 Get a raster category label (CELL) More...
 
char * Rast_get_f_cat (FCELL *rast, struct Categories *pcats)
 Get a raster category label (FCELL) More...
 
char * Rast_get_d_cat (DCELL *rast, struct Categories *pcats)
 Get a raster category label (DCELL) More...
 
char * Rast_get_cat (void *rast, struct Categories *pcats, RASTER_MAP_TYPE data_type)
 Get a raster category label. More...
 
void Rast_unmark_cats (struct Categories *pcats)
 Sets marks for all categories to 0. More...
 
void Rast_mark_c_cats (const CELL *rast_row, int ncols, struct Categories *pcats)
 Looks up the category label for each raster value (CELL). More...
 
void Rast_mark_f_cats (const FCELL *rast_row, int ncols, struct Categories *pcats)
 Looks up the category label for each raster value (FCELL). More...
 
void Rast_mark_d_cats (const DCELL *rast_row, int ncols, struct Categories *pcats)
 Looks up the category label for each raster value (DCELL). More...
 
int Rast_mark_cats (const void *rast_row, int ncols, struct Categories *pcats, RASTER_MAP_TYPE data_type)
 Looks up the category label for each raster value (DCELL). More...
 
void Rast_rewind_cats (struct Categories *pcats)
 Rewind raster categories. More...
 
char * Rast_get_next_marked_d_cat (struct Categories *pcats, DCELL *rast1, DCELL *rast2, long *count)
 Get next marked raster categories (DCELL) More...
 
char * Rast_get_next_marked_c_cat (struct Categories *pcats, CELL *rast1, CELL *rast2, long *count)
 Get next marked raster categories (CELL) More...
 
char * Rast_get_next_marked_f_cat (struct Categories *pcats, FCELL *rast1, FCELL *rast2, long *count)
 Get next marked raster categories (FCELL) More...
 
char * Rast_get_next_marked_cat (struct Categories *pcats, void *rast1, void *rast2, long *count, RASTER_MAP_TYPE data_type)
 Get next marked raster categories. More...
 
int Rast_set_c_cat (const CELL *rast1, const CELL *rast2, const char *label, struct Categories *pcats)
 Set a raster category label (CELL) More...
 
int Rast_set_f_cat (const FCELL *rast1, const FCELL *rast2, const char *label, struct Categories *pcats)
 Set a raster category label (FCELL) More...
 
int Rast_set_d_cat (const DCELL *rast1, const DCELL *rast2, const char *label, struct Categories *pcats)
 Set a raster category label (DCELL) More...
 
int Rast_set_cat (const void *rast1, const void *rast2, const char *label, struct Categories *pcats, RASTER_MAP_TYPE data_type)
 Set a raster category label. More...
 
void Rast_write_cats (const char *name, struct Categories *cats)
 Write raster category file. More...
 
void Rast_write_vector_cats (const char *name, struct Categories *cats)
 Write vector category file. More...
 
char * Rast_get_ith_d_cat (const struct Categories *pcats, int i, DCELL *rast1, DCELL *rast2)
 Get category description (DCELL) More...
 
char * Rast_get_ith_f_cat (const struct Categories *pcats, int i, void *rast1, void *rast2)
 Get category description (FCELL) More...
 
char * Rast_get_ith_c_cat (const struct Categories *pcats, int i, void *rast1, void *rast2)
 Get category description (CELL) More...
 
char * Rast_get_ith_cat (const struct Categories *pcats, int i, void *rast1, void *rast2, RASTER_MAP_TYPE data_type)
 Get category description. More...
 
void Rast_init_cats (const char *title, struct Categories *pcats)
 Initialize category structure. More...
 
void Rast_set_cats_title (const char *title, struct Categories *pcats)
 Set title in category structure. More...
 
void Rast_set_cats_fmt (const char *fmt, double m1, double a1, double m2, double a2, struct Categories *pcats)
 Set category fmt (?) More...
 
void Rast_free_cats (struct Categories *pcats)
 Free category structure memory. More...
 
void Rast_copy_cats (struct Categories *pcats_to, const struct Categories *pcats_from)
 Copy raster categories. More...
 
int Rast_number_of_cats (struct Categories *pcats)
 Get number of raster categories. More...
 
int Rast_sort_cats (struct Categories *pcats)
 Sort categories. More...
 

Detailed Description

Raster Library - Raster categories management.

Code in this file works with category files. There are two formats: Pre 3.0 direct category encoding form:

2 categories Map Title Elevation: 1000.00 to 1005.00 feet Elevation: 1005.00 to 1010.00 feet Elevation: 1010.00 to 1015.00 feet

3.0 format

2 categories

Map Title Elevation: $1.2 to $2.2 feet ## Format Statement 5.0 1000 5.0 1005 ## Coefficients

The coefficient line can be followed by explicit category labels which override the format label generation. 0:no data 2: . 5: . ## explicit category labels 7: . explicit labels can be also of the form: 5.5:5:9 label description or 15:30 label description

In the format line $1 refers to the value num*5.0+1000 (ie, using the first 2 coefficients) $2 refers to the value num*5.0+1005 (ie, using the last 2 coefficients)

$1.2 will print $1 with 2 decimal places.

Also, the form $?xxx$yyy$ translates into yyy if the category is 1, xxx otherwise. The $yyy$ is optional. Thus

$1 meter$?s

will become: 1 meter (for category 1) 2 meters (for category 2), etc.

The format and coefficients above would be used to generate the following statement in creation of the format appropriate category string for category "num":

sprintf(buff,"Elevation: %.2f to %.2f feet", num*5.0+1000, num*5.0*1005)

Note: while both the format and coefficient lines must be present a blank line for the fmt will effectively suppress automatic label generation

Note: quant rules of Categories structures are heavily dependent on the fact that rules are stored in the same order they are entered. since i-th rule and i-th label are entered at the same time, we know that i-th rule maps fp range to i, thus we know for sure that cats.labels[i] corresponds to i-th quant rule

(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 raster/cats.c.

Function Documentation

◆ Rast_copy_cats()

void Rast_copy_cats ( struct Categories pcats_to,
const struct Categories pcats_from 
)

Copy raster categories.

Allocates NEW space for quant rules and labels n pcats_to and copies all info from pcats_from cats to pcats_to cats.

Parameters
pcats_topointer to destination Categories structure
pcats_frompointer to source Categories structure

Definition at line 1248 of file raster/cats.c.

References Categories::ncats, Rast_get_ith_d_cat(), Rast_init_cats(), Rast_set_d_cat(), and Categories::title.

Referenced by Rast_sort_cats().

◆ Rast_free_cats()

void Rast_free_cats ( struct Categories pcats)

Free category structure memory.

Todo:
To be removed, replaced by Rast_free_cats().

Frees memory allocated by Rast_read_cats(), Rast_init_cats() and Rast_set_c_cat().

Parameters
pcatspointer to Categories structure

Definition at line 1213 of file raster/cats.c.

References Categories::fmt, G_free(), Categories::labels, Categories::marks, Categories::nalloc, Categories::ncats, NULL, Categories::q, Rast_quant_free(), and Categories::title.

◆ Rast_get_c_cat()

char* Rast_get_c_cat ( CELL rast,
struct Categories pcats 
)

Get a raster category label (CELL)

This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.

Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.

Parameters
rastcell value
pcatspointer to Categories structure
Returns
pointer to category label
"" if category is not found

Definition at line 323 of file raster/cats.c.

References CELL_TYPE, and Rast_get_cat().

◆ Rast_get_cat()

char* Rast_get_cat ( void *  rast,
struct Categories pcats,
RASTER_MAP_TYPE  data_type 
)

Get a raster category label.

This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.

Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.

Parameters
rastcell value
pcatspointer to Categories structure
data_typemap type (CELL, FCELL, DCELL)
Returns
pointer to category label
"" if category is not found

Definition at line 396 of file raster/cats.c.

References l.

Referenced by Rast_get_c_cat(), Rast_get_d_cat(), and Rast_get_f_cat().

◆ Rast_get_cats_title()

char* Rast_get_cats_title ( const struct Categories pcats)

Get title from category structure struct.

Todo:
Remove from GIS Library, replace by Rast_get_c_cats_title().

Map layers store a one-line title in the category structure as well. This routine returns a pointer to the title contained in the cats structure. A legal pointer is always returned. If the map layer does not have a title, then a pointer to the empty string "" is returned.

Parameters
pcatspointer to Categories structure
Returns
title
"" if missing

Definition at line 299 of file raster/cats.c.

References Categories::title.

◆ Rast_get_d_cat()

char* Rast_get_d_cat ( DCELL rast,
struct Categories pcats 
)

Get a raster category label (DCELL)

This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.

Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.

Parameters
rastcell value
pcatspointer to Categories structure
Returns
pointer to category label
"" if category is not found

Definition at line 371 of file raster/cats.c.

References DCELL_TYPE, and Rast_get_cat().

◆ Rast_get_f_cat()

char* Rast_get_f_cat ( FCELL rast,
struct Categories pcats 
)

Get a raster category label (FCELL)

This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.

Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.

Parameters
rastcell value
pcatspointer to Categories structure
Returns
pointer to category label
"" if category is not found

Definition at line 347 of file raster/cats.c.

References FCELL_TYPE, and Rast_get_cat().

◆ Rast_get_ith_c_cat()

char* Rast_get_ith_c_cat ( const struct Categories pcats,
int  i,
void *  rast1,
void *  rast2 
)

Get category description (CELL)

Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.

Parameters
pcatspointer to Categories structure
iindex
rast1,rast2raster values (range)
Returns
"" on error
pointer to category description

Definition at line 1084 of file raster/cats.c.

References CELL_TYPE.

◆ Rast_get_ith_cat()

char* Rast_get_ith_cat ( const struct Categories pcats,
int  i,
void *  rast1,
void *  rast2,
RASTER_MAP_TYPE  data_type 
)

Get category description.

Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.

Parameters
pcatspointer to Categories structure
iindex
rast1,rast2raster values (range)
data_typemap type
Returns
"" on error
pointer to category description

Definition at line 1112 of file raster/cats.c.

◆ Rast_get_ith_d_cat()

char* Rast_get_ith_d_cat ( const struct Categories pcats,
int  i,
DCELL rast1,
DCELL rast2 
)

Get category description (DCELL)

Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.

Parameters
pcatspointer to Categories structure
iindex
rast1,rast2raster values (range)
Returns
"" on error
pointer to category description

Definition at line 1029 of file raster/cats.c.

References Categories::labels, Categories::ncats, Categories::q, Rast_quant_get_ith_rule(), and Rast_set_d_null_value().

Referenced by Rast3d_write_cats(), Rast_copy_cats(), Rast_get_next_marked_d_cat(), and Rast_set_d_cat().

◆ Rast_get_ith_f_cat()

char* Rast_get_ith_f_cat ( const struct Categories pcats,
int  i,
void *  rast1,
void *  rast2 
)

Get category description (FCELL)

Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.

Parameters
pcatspointer to Categories structure
iindex
rast1,rast2raster values (range)
Returns
"" on error
pointer to category description

Definition at line 1057 of file raster/cats.c.

References FCELL_TYPE.

◆ Rast_get_max_c_cat()

CELL Rast_get_max_c_cat ( const char *  name,
const char *  mapset 
)

Get the max category number.

Return the max category number of a raster map of type CELL.

Parameters
nameraster map name
mapsetmapset name
Returns
-1 on error
number of cats

Definition at line 171 of file raster/cats.c.

References max, min, Rast_get_range_min_max(), Rast_is_c_null_value, and Rast_read_range().

◆ Rast_get_next_marked_c_cat()

char* Rast_get_next_marked_c_cat ( struct Categories pcats,
CELL rast1,
CELL rast2,
long *  count 
)

Get next marked raster categories (CELL)

Parameters
pcatspointer to Categories structure
rast1,rast2cell values (raster range)
[out]countcount
Returns
NULL if not found
description if found

Definition at line 643 of file raster/cats.c.

References CELL_TYPE, and Rast_get_next_marked_cat().

◆ Rast_get_next_marked_cat()

char* Rast_get_next_marked_cat ( struct Categories pcats,
void *  rast1,
void *  rast2,
long *  count,
RASTER_MAP_TYPE  data_type 
)

Get next marked raster categories.

Parameters
pcatspointer to Categories structure
rast1,rast2cell values (raster range)
[out]countcount
data_typemap type
Returns
NULL if not found
description if found

Definition at line 676 of file raster/cats.c.

References Rast_get_next_marked_d_cat(), and Rast_set_d_value().

Referenced by Rast_get_next_marked_c_cat(), and Rast_get_next_marked_f_cat().

◆ Rast_get_next_marked_d_cat()

char* Rast_get_next_marked_d_cat ( struct Categories pcats,
DCELL rast1,
DCELL rast2,
long *  count 
)

Get next marked raster categories (DCELL)

Parameters
pcatspointer to Categories structure
rast1,rast2cell values (raster range)
[out]countcount
Returns
NULL if not found
description if found

Definition at line 603 of file raster/cats.c.

References G_debug(), Categories::last_marked_rule, Categories::marks, NULL, Categories::q, Rast_get_ith_d_cat(), and Rast_quant_nof_rules().

Referenced by Rast_get_next_marked_cat().

◆ Rast_get_next_marked_f_cat()

char* Rast_get_next_marked_f_cat ( struct Categories pcats,
FCELL rast1,
FCELL rast2,
long *  count 
)

Get next marked raster categories (FCELL)

Parameters
pcatspointer to Categories structure
rast1,rast2cell values (raster range)
[out]countcount
Returns
NULL if not found
description if found

Definition at line 659 of file raster/cats.c.

References FCELL_TYPE, and Rast_get_next_marked_cat().

◆ Rast_init_cats()

void Rast_init_cats ( const char *  title,
struct Categories pcats 
)

Initialize category structure.

To construct a new category file, the structure must first be initialized. This routine initializes the cats structure, and copies the title into the structure. The number of categories is set initially to n.

For example:

struct Categories cats;
Rast_init_cats ("", &cats);
Todo:
Eliminate pcats->num. Num has no meaning in new Categories structure and only stores (int) largets data value for backwards compatibility.
Parameters
titletitle
pcatspointer to Categories structure

Definition at line 1145 of file raster/cats.c.

References Categories::a1, Categories::a2, Categories::fmt, Categories::labels, Categories::last_marked_rule, Categories::m1, Categories::m2, Categories::nalloc, Categories::ncats, NULL, Categories::num, Categories::q, Rast_quant_init(), and Rast_set_cats_title().

Referenced by Rast_copy_cats().

◆ Rast_mark_c_cats()

void Rast_mark_c_cats ( const CELL rast_row,
int  ncols,
struct Categories pcats 
)

Looks up the category label for each raster value (CELL).

Looks up the category label for each raster value in the rast_row and updates the marks for labels found.

Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.

Parameters
rast_rowraster row to update stats
ncolsnumber of columns
pcatspointer to Categories structure

Definition at line 494 of file raster/cats.c.

◆ Rast_mark_cats()

int Rast_mark_cats ( const void *  rast_row,
int  ncols,
struct Categories pcats,
RASTER_MAP_TYPE  data_type 
)

Looks up the category label for each raster value (DCELL).

Looks up the category label for each raster value in the rast_row and updates the marks for labels found.

Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.

Parameters
rast_rowraster row to update stats
ncolsnumber of columns
pcatspointer to Categories structure
data_typemap type
Returns
-1 on error
1 on success

Definition at line 560 of file raster/cats.c.

◆ Rast_mark_d_cats()

void Rast_mark_d_cats ( const DCELL rast_row,
int  ncols,
struct Categories pcats 
)

Looks up the category label for each raster value (DCELL).

Looks up the category label for each raster value in the rast_row and updates the marks for labels found.

Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.

Parameters
rast_rowraster row to update stats
ncolsnumber of columns
pcatspointer to Categories structure

Definition at line 536 of file raster/cats.c.

◆ Rast_mark_f_cats()

void Rast_mark_f_cats ( const FCELL rast_row,
int  ncols,
struct Categories pcats 
)

Looks up the category label for each raster value (FCELL).

Looks up the category label for each raster value in the rast_row and updates the marks for labels found.

Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.

Parameters
rast_rowraster row to update stats
ncolsnumber of columns
pcatspointer to Categories structure

Definition at line 515 of file raster/cats.c.

◆ Rast_number_of_cats()

int Rast_number_of_cats ( struct Categories pcats)

Get number of raster categories.

Parameters
pcatspointer to Categories structure
Returns
number of categories

Definition at line 1269 of file raster/cats.c.

References Categories::ncats.

◆ Rast_read_cats()

int Rast_read_cats ( const char *  name,
const char *  mapset,
struct Categories pcats 
)

Read raster category file.

The category file for raster map name in mapset is read into the cats structure. If there is an error reading the category file, a diagnostic message is printed and -1 is returned. Otherwise, 0 is returned.

Parameters
nameraster map name
mapsetmapset name
[out]pcatspointer to Cats structure
Returns
-1 on error
0 on success

Definition at line 104 of file raster/cats.c.

Referenced by gsd_put_legend().

◆ Rast_read_vector_cats()

int Rast_read_vector_cats ( const char *  name,
const char *  mapset,
struct Categories pcats 
)

Read vector category file.

Note: This function works with old vector format.

Todo:
: To be moved to the vector library

The category file for vector map name in mapset is read into the cats structure. If there is an error reading the category file, a diagnostic message is printed and -1 is returned. Otherwise, 0 is returned.

Parameters
namevector map name
mapsetmapset name
[out]pcatspointer to Cats structure
Returns
-1 on error
0 on success

Definition at line 140 of file raster/cats.c.

◆ Rast_rewind_cats()

void Rast_rewind_cats ( struct Categories pcats)

Rewind raster categories.

After call to this function Rast_get_next_marked_cat() returns the first marked cat label.

Parameters
pcatspointer to Categories structure

Definition at line 588 of file raster/cats.c.

References Categories::last_marked_rule.

◆ Rast_set_c_cat()

int Rast_set_c_cat ( const CELL rast1,
const CELL rast2,
const char *  label,
struct Categories pcats 
)

Set a raster category label (CELL)

Adds the label for range rast1 through rast2 in category structure pcats.

Parameters
rast1,rast2raster values (range)
labelcategory label
pcatspointer to Categories structure
Returns
-1 on error
0 if null value detected
1 on success

Definition at line 770 of file raster/cats.c.

References CELL_TYPE, and Rast_set_cat().

◆ Rast_set_cat()

int Rast_set_cat ( const void *  rast1,
const void *  rast2,
const char *  label,
struct Categories pcats,
RASTER_MAP_TYPE  data_type 
)

Set a raster category label.

Adds the label for range rast1 through rast2 in category structure pcats.

Parameters
rast1,rast2raster values (range)
labelcategory label
pcatspointer to Categories structure
data_typemap type
Returns
-1 on error
0 if null value detected
1 on success

Definition at line 914 of file raster/cats.c.

References Rast_get_d_value(), and Rast_set_d_cat().

Referenced by Rast_set_c_cat(), and Rast_set_f_cat().

◆ Rast_set_cats_fmt()

void Rast_set_cats_fmt ( const char *  fmt,
double  m1,
double  a1,
double  m2,
double  a2,
struct Categories pcats 
)

Set category fmt (?)

Parameters
fmt
m1
a1
m2
a2
pcatspointer to Categories structure

Definition at line 1190 of file raster/cats.c.

◆ Rast_set_cats_title()

void Rast_set_cats_title ( const char *  title,
struct Categories pcats 
)

Set title in category structure.

Todo:
To be removed, replaced by Rast_set_cats_title().

The title is copied into the pcats structure.

Parameters
titletitle
pcatspointer to Categories structure

Definition at line 1171 of file raster/cats.c.

References G_newlines_to_spaces(), G_store(), G_strip(), NULL, and Categories::title.

Referenced by Rast_init_cats().

◆ Rast_set_d_cat()

int Rast_set_d_cat ( const DCELL rast1,
const DCELL rast2,
const char *  label,
struct Categories pcats 
)

Set a raster category label (DCELL)

Adds the label for range rast1 through rast2 in category structure pcats.

Parameters
rast1,rast2raster values (range)
labelcategory label
pcatspointer to Categories structure
Returns
-1 on error
0 if null value detected
1 on success

Definition at line 808 of file raster/cats.c.

References G_free(), G_malloc, G_newlines_to_spaces(), G_realloc, G_store(), G_strip(), Categories::labels, Categories::marks, Categories::nalloc, Categories::ncats, NULL, Categories::num, Categories::q, Rast_get_ith_d_cat(), Rast_is_d_null_value, and Rast_quant_add_rule().

Referenced by Rast_copy_cats(), and Rast_set_cat().

◆ Rast_set_f_cat()

int Rast_set_f_cat ( const FCELL rast1,
const FCELL rast2,
const char *  label,
struct Categories pcats 
)

Set a raster category label (FCELL)

Adds the label for range rast1 through rast2 in category structure pcats.

Parameters
rast1,rast2raster values (range)
labelcategory label
pcatspointer to Categories structure
Returns

Definition at line 788 of file raster/cats.c.

References FCELL_TYPE, and Rast_set_cat().

◆ Rast_sort_cats()

int Rast_sort_cats ( struct Categories pcats)

Sort categories.

Parameters
pcatspointer to Categories structure
Returns
-1 on error (nothing to sort)
0 on success

Definition at line 1282 of file raster/cats.c.

References G_debug(), Categories::ncats, and Rast_copy_cats().

◆ Rast_unmark_cats()

void Rast_unmark_cats ( struct Categories pcats)

Sets marks for all categories to 0.

This initializes Categories structure for subsequent calls to Rast_mark_cats() for each row of data, where non-zero mark for i-th label means that some of the cells in rast_row are labeled with i-th label and fall into i-th data range. These marks help determine from the Categories structure which labels were used and which weren't.

Parameters
pcatspointer to Categories structure

Definition at line 471 of file raster/cats.c.

References Categories::marks, and Categories::ncats.

◆ Rast_write_cats()

void Rast_write_cats ( const char *  name,
struct Categories cats 
)

Write raster category file.

Todo:
To be removed, replaced by Rast_write_cats().

Writes the category file for the raster map name in the current mapset from the cats structure.

Parameters
namemap name
catspointer to Categories structure
Returns
void

Definition at line 938 of file raster/cats.c.

◆ Rast_write_vector_cats()

void Rast_write_vector_cats ( const char *  name,
struct Categories cats 
)

Write vector category file.

Note: Used for only old vector format!

Todo:
Move to the vector library.
Parameters
namemap name
catspointer to Categories structure
Returns
void

Definition at line 955 of file raster/cats.c.