GRASS Programmer's Manual
6.4.2(2012)
|
00001 00017 #include <stdio.h> 00018 #include <grass/gis.h> 00019 00020 00030 int G__write_Cell_head(FILE * fd, 00031 const struct Cell_head *cellhd, int is_cellhd) 00032 { 00033 char buf[1024]; 00034 int fmt; 00035 00036 fmt = cellhd->proj; 00037 00038 fprintf(fd, "proj: %d\n", cellhd->proj); 00039 fprintf(fd, "zone: %d\n", cellhd->zone); 00040 00041 G_format_northing(cellhd->north, buf, fmt); 00042 fprintf(fd, "north: %s\n", buf); 00043 00044 G_format_northing(cellhd->south, buf, fmt); 00045 fprintf(fd, "south: %s\n", buf); 00046 00047 G_format_easting(cellhd->east, buf, fmt); 00048 fprintf(fd, "east: %s\n", buf); 00049 00050 G_format_easting(cellhd->west, buf, fmt); 00051 fprintf(fd, "west: %s\n", buf); 00052 00053 fprintf(fd, "cols: %d\n", cellhd->cols); 00054 fprintf(fd, "rows: %d\n", cellhd->rows); 00055 00056 G_format_resolution(cellhd->ew_res, buf, fmt); 00057 fprintf(fd, "e-w resol: %s\n", buf); 00058 00059 G_format_resolution(cellhd->ns_res, buf, fmt); 00060 fprintf(fd, "n-s resol: %s\n", buf); 00061 00062 if (is_cellhd) { 00063 fprintf(fd, "format: %d\n", cellhd->format); 00064 fprintf(fd, "compressed: %d\n", cellhd->compressed); 00065 } 00066 00067 return 1; 00068 } 00069 00070 00080 int G__write_Cell_head3(FILE * fd, 00081 const struct Cell_head *cellhd, int is_cellhd) 00082 { 00083 char buf[1024]; 00084 int fmt; 00085 00086 fmt = cellhd->proj; 00087 00088 G__write_Cell_head(fd, cellhd, is_cellhd); 00089 00090 fprintf(fd, "top: %g\n", cellhd->top); 00091 fprintf(fd, "bottom: %g\n", cellhd->bottom); 00092 00093 fprintf(fd, "cols3: %d\n", cellhd->cols3); 00094 fprintf(fd, "rows3: %d\n", cellhd->rows3); 00095 fprintf(fd, "depths: %d\n", cellhd->depths); 00096 00097 G_format_resolution(cellhd->ew_res3, buf, fmt); 00098 fprintf(fd, "e-w resol3: %s\n", buf); 00099 00100 G_format_resolution(cellhd->ns_res3, buf, fmt); 00101 fprintf(fd, "n-s resol3: %s\n", buf); 00102 00103 G_format_resolution(cellhd->tb_res, buf, -1); 00104 fprintf(fd, "t-b resol: %s\n", buf); 00105 00106 return 1; 00107 }