mask_info.c

Go to the documentation of this file.
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[50], mapset[50];
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 "gis.h"
00031 #include "glocale.h"
00032 char *
00033 G_mask_info ()
00034 {
00035     static char text[200];
00036     char name[50];
00037     char mapset[50];
00038 
00039     switch (G__mask_info (name, mapset))
00040     {
00041     case 1:
00042             sprintf (text, _("<%s> in mapset <%s>"), name, mapset);
00043             break;
00044     case -1:
00045             strcpy (text, _("none"));
00046             break;
00047     default:
00048             strcpy (text, _("not known"));
00049             break;
00050     }
00051 
00052     return text;
00053 }
00054 
00055 int G__mask_info (
00056     char *name,
00057     char *mapset)
00058 {
00059     char rname[50], rmapset[50];
00060 
00061     strcpy (name, "MASK");
00062     strcpy (mapset, G_mapset());
00063 
00064     if(!G_find_cell (name, mapset))
00065         return -1;
00066 
00067     if(G_is_reclass (name, mapset, rname, rmapset) > 0)
00068     {
00069         strcpy (name, rname);
00070         strcpy (mapset, rmapset);
00071     }
00072 
00073     return 1;
00074 }

Generated on Sat Jul 22 22:06:15 2006 for GRASS by  doxygen 1.4.7