#include <grass/gis.h>
#include <grass/glocale.h>
#include <stdlib.h>
Go to the source code of this file.
Defines | |
#define | LIST struct Histogram_list |
Functions | |
int | G_init_histogram (struct Histogram *histogram) |
initializes the histogram structure | |
int | G_read_histogram (char *name, char *mapset, struct Histogram *histogram) |
read the histogram information | |
int | G_write_histogram (char *name, struct Histogram *histogram) |
Writes the histogram information. | |
int | G_write_histogram_cs (char *name, struct Cell_stats *statf) |
Writes the histogram information to file. | |
int | G_make_histogram_cs (struct Cell_stats *statf, struct Histogram *histogram) |
int | G_get_histogram_num (struct Histogram *histogram) |
Sorts the histogram in ascending order by counts then category. | |
CELL | G_get_histogram_cat (int n, struct Histogram *histogram) |
Returns cat for the nth element in the histogram. | |
long | G_get_histogram_count (int n, struct Histogram *histogram) |
Returns count for the nth element in the histogram. | |
int | G_free_histogram (struct Histogram *histogram) |
frees the memory allocated for the histogram | |
int | G_sort_histogram (struct Histogram *histogram) |
Sorts the histogram. | |
int | G_sort_histogram_by_count (struct Histogram *histogram) |
Sorts the histogram by counts. | |
int | G_remove_histogram (char *name) |
Removes the histogram. | |
int | G_add_histogram (CELL cat, long count, struct Histogram *histogram) |
adds count to the histogram value for cat | |
int | G_set_histogram (CELL cat, long count, struct Histogram *histogram) |
sets the histogram value for cat to count | |
int | G_extend_histogram (CELL cat, long count, struct Histogram *histogram) |
int | G_zero_histogram (struct Histogram *histogram) |
#define LIST struct Histogram_list |
Definition at line 5 of file histogram.c.
Referenced by G_extend_histogram(), G_sort_histogram(), G_sort_histogram_by_count(), and G_write_histogram().
int G_add_histogram | ( | CELL | cat, | |
long | count, | |||
struct Histogram * | histogram | |||
) |
adds count to the histogram value for cat
adds count to the histogram value for cat
cat,: | category | |
count | ||
histogram,: | struct for histogram |
Definition at line 375 of file histogram.c.
References G_extend_histogram().
Referenced by G_make_histogram_cs().
int G_extend_histogram | ( | CELL | cat, | |
long | count, | |||
struct Histogram * | histogram | |||
) |
cat,: | category | |
count | ||
histogram,: | struct for histogram |
Definition at line 431 of file histogram.c.
References G_realloc(), and LIST.
Referenced by G_add_histogram(), G_read_histogram(), and G_set_histogram().
int G_free_histogram | ( | struct Histogram * | histogram | ) |
frees the memory allocated for the histogram
frees the memory allocated for the histogram
histogram,: | struct for histogram |
Definition at line 229 of file histogram.c.
References G_free(), and NULL.
Referenced by G_read_histogram().
CELL G_get_histogram_cat | ( | int | n, | |
struct Histogram * | histogram | |||
) |
Returns cat for the nth element in the histogram.
Returns cat for the nth element in the histogram
histogram,: | struct for histogram |
Definition at line 200 of file histogram.c.
Referenced by G_histogram_eq().
long G_get_histogram_count | ( | int | n, | |
struct Histogram * | histogram | |||
) |
Returns count for the nth element in the histogram.
Returns count for the nth element in the histogram
n,: | nth element | |
histogram,: | struct for histogram |
Definition at line 215 of file histogram.c.
Referenced by G_histogram_eq().
int G_get_histogram_num | ( | struct Histogram * | histogram | ) |
Sorts the histogram in ascending order by counts then category.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram,: | struct for histogram |
Definition at line 188 of file histogram.c.
Referenced by G_histogram_eq().
int G_init_histogram | ( | struct Histogram * | histogram | ) |
initializes the histogram structure
initializes the histogram structure for calls to G_set_histogram() and G_add_histogram()
histogram |
Definition at line 20 of file histogram.c.
References NULL.
Referenced by G_make_histogram_cs(), and G_read_histogram().
int G_make_histogram_cs | ( | struct Cell_stats * | statf, | |
struct Histogram * | histogram | |||
) |
\return |
Definition at line 163 of file histogram.c.
References G_add_histogram(), G_init_histogram(), G_next_cell_stat(), G_rewind_cell_stats(), and G_sort_histogram().
int G_read_histogram | ( | char * | name, | |
char * | mapset, | |||
struct Histogram * | histogram | |||
) |
read the histogram information
Reads the histogram information associated with map layer "map" in mapset "mapset" into the structure "histogram".
note: a warning message is printed if the file is missing or incorrect
name,: | name of map | |
mapset,: | mapset that map belongs to | |
histogram,: | struct for histogram |
Definition at line 44 of file histogram.c.
References G_extend_histogram(), G_find_file(), G_fopen_old(), G_free_histogram(), G_init_histogram(), G_sort_histogram(), G_warning(), and NULL.
int G_remove_histogram | ( | char * | name | ) |
Removes the histogram.
Removes the histogram information associated with map layer "name"
name,: | name of map |
Definition at line 355 of file histogram.c.
References G_remove().
int G_set_histogram | ( | CELL | cat, | |
long | count, | |||
struct Histogram * | histogram | |||
) |
sets the histogram value for cat to count
sets the histogram value for cat to count
cat,: | category | |
count | ||
histogram,: | struct for histogram |
Definition at line 404 of file histogram.c.
References G_extend_histogram().
int G_sort_histogram | ( | struct Histogram * | histogram | ) |
Sorts the histogram.
Sorts the histogram in ascending order by category, combining (by adding) elements that have the same category.
histogram,: | struct for histogram |
Definition at line 247 of file histogram.c.
Referenced by G_make_histogram_cs(), and G_read_histogram().
int G_sort_histogram_by_count | ( | struct Histogram * | histogram | ) |
Sorts the histogram by counts.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram,: | struct for histogram |
Definition at line 302 of file histogram.c.
References LIST.
int G_write_histogram | ( | char * | name, | |
struct Histogram * | histogram | |||
) |
Writes the histogram information.
Writes the histogram information associated with map layer "name"
name,: | name of map | |
histogram,: | struct for histogram |
Definition at line 106 of file histogram.c.
int G_write_histogram_cs | ( | char * | name, | |
struct Cell_stats * | statf | |||
) |
Writes the histogram information to file.
name,: | name of map | |
statf |
Definition at line 136 of file histogram.c.
References G_next_cell_stat(), G_rewind_cell_stats(), and NULL.
int G_zero_histogram | ( | struct Histogram * | histogram | ) |