1 /*
2 *************************************************************
3 * char * Rast_mask_info ()
4 *
5 * returns a printable text of mask information
6 *
7 ************************************************************
8 * Rast__mask_info (name, mapset)
9 *
10 * char name[GNAME_MAX], mapset[GMAPSET_MAX];
11 *
12 * function:
13 * determine the status off the automatic masking
14 * and the name of the cell file which forms the mask
15 *
16 * (the mask file is actually MASK in the current mapset,
17 * but is usually a reclassed cell file, and the reclass
18 * name and mapset are returned)
19 *
20 * returns:
21 * -1 no masking (name, mapset undefined)
22 * name, mapset are undefined
23 *
24 * 1 mask file present, masking on
25 * name, mapset hold mask file name, mapset
26 *
27 ***************************************************************/
28
29 #include <string.h>
30
31 #include <grass/gis.h>
32 #include <grass/raster.h>
33 #include <grass/glocale.h>
34
Rast_mask_info(void)35 char *Rast_mask_info(void)
36 {
37 char text[GNAME_MAX + GMAPSET_MAX + 16];
38 char name[GNAME_MAX];
39 char mapset[GMAPSET_MAX];
40
41 switch (Rast__mask_info(name, mapset)) {
42 case 1:
43 sprintf(text, _("<%s> in mapset <%s>"), name, mapset);
44 break;
45 case -1:
46 strcpy(text, _("none"));
47 break;
48 default:
49 strcpy(text, _("not known"));
50 break;
51 }
52
53 return G_store(text);
54 }
55
Rast__mask_info(char * name,char * mapset)56 int Rast__mask_info(char *name, char *mapset)
57 {
58 char rname[GNAME_MAX], rmapset[GMAPSET_MAX];
59
60 strcpy(name, "MASK");
61 strcpy(mapset, G_mapset());
62
63 if (!G_find_raster(name, mapset))
64 return -1;
65
66 if (Rast_is_reclass(name, mapset, rname, rmapset) > 0) {
67 strcpy(name, rname);
68 strcpy(mapset, rmapset);
69 }
70
71 return 1;
72 }
73