GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wr_cellhd.c
Go to the documentation of this file.
1 
17 #include <stdio.h>
18 #include <grass/gis.h>
19 
20 
31  const struct Cell_head *cellhd, int is_cellhd)
32 {
33  char buf[1024];
34  int fmt;
35 
36  fmt = cellhd->proj;
37 
38  fprintf(fd, "proj: %d\n", cellhd->proj);
39  fprintf(fd, "zone: %d\n", cellhd->zone);
40 
41  G_format_northing(cellhd->north, buf, fmt);
42  fprintf(fd, "north: %s\n", buf);
43 
44  G_format_northing(cellhd->south, buf, fmt);
45  fprintf(fd, "south: %s\n", buf);
46 
47  G_format_easting(cellhd->east, buf, fmt);
48  fprintf(fd, "east: %s\n", buf);
49 
50  G_format_easting(cellhd->west, buf, fmt);
51  fprintf(fd, "west: %s\n", buf);
52 
53  fprintf(fd, "cols: %d\n", cellhd->cols);
54  fprintf(fd, "rows: %d\n", cellhd->rows);
55 
56  G_format_resolution(cellhd->ew_res, buf, fmt);
57  fprintf(fd, "e-w resol: %s\n", buf);
58 
59  G_format_resolution(cellhd->ns_res, buf, fmt);
60  fprintf(fd, "n-s resol: %s\n", buf);
61 
62  if (is_cellhd) {
63  fprintf(fd, "format: %d\n", cellhd->format);
64  fprintf(fd, "compressed: %d\n", cellhd->compressed);
65  }
66 
67  return 1;
68 }
69 
70 
81  const struct Cell_head *cellhd, int is_cellhd)
82 {
83  char buf[1024];
84  int fmt;
85 
86  fmt = cellhd->proj;
87 
88  G__write_Cell_head(fd, cellhd, is_cellhd);
89 
90  fprintf(fd, "top: %.15f\n", cellhd->top);
91  fprintf(fd, "bottom: %.15f\n", cellhd->bottom);
92 
93  fprintf(fd, "cols3: %d\n", cellhd->cols3);
94  fprintf(fd, "rows3: %d\n", cellhd->rows3);
95  fprintf(fd, "depths: %d\n", cellhd->depths);
96 
97  G_format_resolution(cellhd->ew_res3, buf, fmt);
98  fprintf(fd, "e-w resol3: %s\n", buf);
99 
100  G_format_resolution(cellhd->ns_res3, buf, fmt);
101  fprintf(fd, "n-s resol3: %s\n", buf);
102 
103  G_format_resolution(cellhd->tb_res, buf, -1);
104  fprintf(fd, "t-b resol: %s\n", buf);
105 
106  return 1;
107 }
int G_format_resolution(double res, char *buf, int projection)
Resolution to ASCII.
Definition: wind_format.c:86
FILE * fd
Definition: g3dcolor.c:368
int G__write_Cell_head(FILE *fd, const struct Cell_head *cellhd, int is_cellhd)
Write cell header or window.
Definition: wr_cellhd.c:30
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
Definition: g3drange.c:62
int G_format_easting(double east, char *buf, int projection)
Easting to ASCII.
Definition: wind_format.c:61
int G_format_northing(double north, char *buf, int projection)
Northing to ASCII.
Definition: wind_format.c:36
int G__write_Cell_head3(FILE *fd, const struct Cell_head *cellhd, int is_cellhd)
Write 3D cell header or window.
Definition: wr_cellhd.c:80