GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mask_info.c
Go to the documentation of this file.
1 /*
2  *************************************************************
3  * char * G_mask_info ()
4  *
5  * returns a printable text of mask information
6  *
7  ************************************************************
8  * G__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 #include <grass/gis.h>
31 #include <grass/glocale.h>
32 char *G_mask_info(void)
33 {
34  static char text[200];
35  char name[GNAME_MAX];
36  char mapset[GMAPSET_MAX];
37 
38  switch (G__mask_info(name, mapset)) {
39  case 1:
40  sprintf(text, _("<%s> in mapset <%s>"), name, mapset);
41  break;
42  case -1:
43  strcpy(text, _("none"));
44  break;
45  default:
46  strcpy(text, _("not known"));
47  break;
48  }
49 
50  return text;
51 }
52 
53 int G__mask_info(char *name, char *mapset)
54 {
55  char rname[GNAME_MAX], rmapset[GMAPSET_MAX];
56 
57  strcpy(name, "MASK");
58  strcpy(mapset, G_mapset());
59 
60  if (!G_find_cell(name, mapset))
61  return -1;
62 
63  if (G_is_reclass(name, mapset, rname, rmapset) > 0) {
64  strcpy(name, rname);
65  strcpy(mapset, rmapset);
66  }
67 
68  return 1;
69 }
char * G_mapset(void)
current mapset name
Definition: mapset.c:31
char * G_mask_info(void)
Definition: mask_info.c:32
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
string name
Definition: render.py:1314
char * G_find_cell(char *name, const char *mapset)
find a raster map
Definition: find_cell.c:63
int G__mask_info(char *name, char *mapset)
Definition: mask_info.c:53
int G_is_reclass(const char *name, const char *mapset, char *rname, char *rmapset)
reclass file?
Definition: reclass.c:30