2
/****************************************************************************
6
* AUTHOR(S): Michael Shapiro - CERL
8
* PURPOSE: Interactive tool used to draw and save vector features
9
* on a graphics monitor using a pointing device (mouse)
10
* and save to a raster map.
12
* COPYRIGHT: (C) 2006 by the GRASS Development Team
14
* This program is free software under the GNU General Public
15
* License (>=v2). Read the file COPYING that comes with GRASS
18
***************************************************************************/
20
#include <grass/gis.h>
21
#include <grass/raster.h>
22
#include <grass/glocale.h>
25
long get_cat(char *type)
31
fprintf(stdout, _("Enter the category number for this %s: "), type);
34
if (sscanf(buffer, "%ld", &cat) != 1)
41
char *get_label(long cat, struct Categories *labels)
43
static char buffer[1024];
46
fprintf(stdout, _("Enter a label for category %ld [%s] "),
47
cat, G_get_cat((CELL) cat, labels));
56
int get_category(FILE * fd, char *type, struct Categories *labels)
61
R_stabilize(); /* force out all graphics */
63
fprintf(stdout, "\n");
65
lbl = get_label(cat, labels);
66
fprintf(stdout, "%ld [%s]\n", cat,
67
*lbl ? lbl : G_get_cat((CELL) cat, labels));
68
} while (!G_yes(_("Look ok? "), 1));
70
G_set_cat((CELL) cat, lbl, labels);
72
fprintf(fd, "= %ld %s\n", cat, lbl);