GRASS Programmer's Manual
6.4.2(2012)
|
00001 /* 00002 ************************************************************* 00003 * char * G_mask_info () 00004 * 00005 * returns a printable text of mask information 00006 * 00007 ************************************************************ 00008 * G__mask_info (name, mapset) 00009 * 00010 * char name[GNAME_MAX], mapset[GMAPSET_MAX]; 00011 * 00012 * function: 00013 * determine the status off the automatic masking 00014 * and the name of the cell file which forms the mask 00015 * 00016 * (the mask file is actually MASK in the current mapset, 00017 * but is usually a reclassed cell file, and the reclass 00018 * name and mapset are returned) 00019 * 00020 * returns: 00021 * -1 no masking (name, mapset undefined) 00022 * name, mapset are undefined 00023 * 00024 * 1 mask file present, masking on 00025 * name, mapset hold mask file name, mapset 00026 * 00027 ***************************************************************/ 00028 00029 #include <string.h> 00030 #include <grass/gis.h> 00031 #include <grass/glocale.h> 00032 char *G_mask_info(void) 00033 { 00034 static char text[200]; 00035 char name[GNAME_MAX]; 00036 char mapset[GMAPSET_MAX]; 00037 00038 switch (G__mask_info(name, mapset)) { 00039 case 1: 00040 sprintf(text, _("<%s> in mapset <%s>"), name, mapset); 00041 break; 00042 case -1: 00043 strcpy(text, _("none")); 00044 break; 00045 default: 00046 strcpy(text, _("not known")); 00047 break; 00048 } 00049 00050 return text; 00051 } 00052 00053 int G__mask_info(char *name, char *mapset) 00054 { 00055 char rname[GNAME_MAX], rmapset[GMAPSET_MAX]; 00056 00057 strcpy(name, "MASK"); 00058 strcpy(mapset, G_mapset()); 00059 00060 if (!G_find_cell(name, mapset)) 00061 return -1; 00062 00063 if (G_is_reclass(name, mapset, rname, rmapset) > 0) { 00064 strcpy(name, rname); 00065 strcpy(mapset, rmapset); 00066 } 00067 00068 return 1; 00069 }