GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
headerinfo.c
Go to the documentation of this file.
1 #include <grass/G3d.h>
2 #include "G3d_intern.h"
3 
4 /*---------------------------------------------------------------------------*/
5 
6 
19 void G3d_getCoordsMap(G3D_Map * map, int *rows, int *cols, int *depths)
20 {
21  *rows = map->region.rows;
22  *cols = map->region.cols;
23  *depths = map->region.depths;
24 }
25 
26 /*---------------------------------------------------------------------------*/
27 
28 void G3d_getCoordsMapWindow(G3D_Map * map, int *rows, int *cols, int *depths)
29 {
30  *rows = map->window.rows;
31  *cols = map->window.cols;
32  *depths = map->window.depths;
33 }
34 
35 /*---------------------------------------------------------------------------*/
36 
37 
51 void G3d_getNofTilesMap(G3D_Map * map, int *nx, int *ny, int *nz)
52 {
53  *nx = map->nx;
54  *ny = map->ny;
55  *nz = map->nz;
56 }
57 
58 /*---------------------------------------------------------------------------*/
59 
60 
76 void
77 G3d_getRegionMap(G3D_Map * map, double *north, double *south, double *east,
78  double *west, double *top, double *bottom)
79 {
80  *north = map->region.north;
81  *south = map->region.south;
82  *east = map->region.east;
83  *west = map->region.west;
84  *top = map->region.top;
85  *bottom = map->region.bottom;
86 }
87 
88 /*---------------------------------------------------------------------------*/
89 
90 void
91 G3d_getWindowMap(G3D_Map * map, double *north, double *south, double *east,
92  double *west, double *top, double *bottom)
93 {
94  *north = map->window.north;
95  *south = map->window.south;
96  *east = map->window.east;
97  *west = map->window.west;
98  *top = map->window.top;
99  *bottom = map->window.bottom;
100 }
101 
102 /*---------------------------------------------------------------------------*/
103 
104 
115 void G3d_getRegionStructMap(G3D_Map * map, G3D_Region * region)
116 {
117  G3d_regionCopy(region, &(map->region));
118 }
119 
120 /*---------------------------------------------------------------------------*/
121 
122 void G3d_getWindowStructMap(G3D_Map * map, G3D_Region * window)
123 {
124  G3d_regionCopy(window, &(map->window));
125 }
126 
127 /*---------------------------------------------------------------------------*/
128 
129 
142 void G3d_getTileDimensionsMap(G3D_Map * map, int *x, int *y, int *z)
143 {
144  *x = map->tileX;
145  *y = map->tileY;
146  *z = map->tileZ;
147 }
148 
149 /*---------------------------------------------------------------------------*/
150 
151 
161 int G3d_tileTypeMap(G3D_Map * map)
162 {
163  return map->typeIntern;
164 }
165 
166 /*---------------------------------------------------------------------------*/
167 
168 
178 int G3d_fileTypeMap(G3D_Map * map)
179 {
180  return map->type;
181 }
182 
183 /*---------------------------------------------------------------------------*/
184 
185 
195 int G3d_tilePrecisionMap(G3D_Map * map)
196 {
197  return map->precision;
198 }
199 
200 /*---------------------------------------------------------------------------*/
201 
202 
212 int G3d_tileUseCacheMap(G3D_Map * map)
213 {
214  return map->useCache;
215 }
216 
217 
218 
228 void G3d_printHeader(G3D_Map * map)
229 {
230  double rangeMin, rangeMax;
231 
232  printf("File %s open for %sing:\n", map->fileName,
233  (map->operation == G3D_WRITE_DATA ? "writ" :
234  (map->operation == G3D_READ_DATA ? "read" : "unknown")));
235  printf(" Fd = %d, Unit %s, Type: %s, ", map->data_fd,
236  map->unit,
237  (map->type == FCELL_TYPE ? "float" :
238  (map->type == DCELL_TYPE ? "double" : "unknown")));
239  printf("Type intern: %s\n",
240  (map->typeIntern == FCELL_TYPE ? "float" :
241  (map->typeIntern == DCELL_TYPE ? "double" : "unknown")));
242  if (map->compression == G3D_NO_COMPRESSION)
243  printf(" Compression: none\n");
244  else {
245  printf(" Compression:%s%s Precision: %s",
246  (map->useLzw ? " lzw," : ""), (map->useRle ? " rle," : ""),
247  (map->precision == -1 ? "all bits used\n" : "using"));
248  if (map->precision != -1)
249  printf(" %d bits\n", map->precision);
250  }
251 
252  if (!map->useCache)
253  printf(" Cache: none\n");
254  else {
255  printf(" Cache: used%s\n",
256  (map->operation == G3D_WRITE_DATA ? ", File Cache used" : ""));
257  }
258 
259  G3d_range_min_max(map, &rangeMin, &rangeMax);
260 
261  printf(" Region: (%f %f) (%f %f) (%f %f)\n",
262  map->region.south, map->region.north, map->region.west,
263  map->region.east, map->region.bottom, map->region.top);
264  printf(" (%d %d %d)\n", map->region.rows, map->region.cols,
265  map->region.depths);
266  printf(" Tile size (%d %d %d)\n", map->tileX, map->tileY, map->tileZ);
267  printf(" Range (");
268  if (G3d_isNullValueNum(&rangeMin, DCELL_TYPE))
269  printf("NULL, ");
270  else
271  printf("%f, ", (double)rangeMin);
272  if (G3d_isNullValueNum(&rangeMax, DCELL_TYPE))
273  printf("NULL)\n");
274  else
275  printf("%f)\n", (double)rangeMax);
276  fflush(stdout);
277 }
void G3d_getCoordsMapWindow(G3D_Map *map, int *rows, int *cols, int *depths)
Definition: headerinfo.c:28
void G3d_printHeader(G3D_Map *map)
Prints the header information of map.
Definition: headerinfo.c:228
void G3d_getTileDimensionsMap(G3D_Map *map, int *x, int *y, int *z)
Returns the tile dimensions used for map.
Definition: headerinfo.c:142
void G3d_getRegionStructMap(G3D_Map *map, G3D_Region *region)
Returns in region the region of map.
Definition: headerinfo.c:115
#define G3D_READ_DATA
Definition: G3d_intern.h:20
int G3d_isNullValueNum(const void *n, int type)
Definition: g3dnull.c:9
#define G3D_WRITE_DATA
Definition: G3d_intern.h:19
int y
Definition: plot.c:34
void G3d_getWindowStructMap(G3D_Map *map, G3D_Region *window)
Definition: headerinfo.c:122
void G3d_getRegionMap(G3D_Map *map, double *north, double *south, double *east, double *west, double *top, double *bottom)
Returns the size of the region.
Definition: headerinfo.c:77
void G3d_getNofTilesMap(G3D_Map *map, int *nx, int *ny, int *nz)
Returns the dimensions of the tile-cube used to tile the region of map. These numbers include partial...
Definition: headerinfo.c:51
void G3d_range_min_max(G3D_Map *map, double *min, double *max)
Returns in min and max the minimum and maximum values of the range.
Definition: g3drange.c:149
tuple window
Definition: tools.py:543
int G3d_tileUseCacheMap(G3D_Map *map)
Returns 1 if map uses cache, returns 0 otherwise.
Definition: headerinfo.c:212
int G3d_tilePrecisionMap(G3D_Map *map)
Returns the precision used to store map.
Definition: headerinfo.c:195
tuple cols
void G3d_getWindowMap(G3D_Map *map, double *north, double *south, double *east, double *west, double *top, double *bottom)
Definition: headerinfo.c:91
int G3d_fileTypeMap(G3D_Map *map)
Returns the type with which tiles of map are stored on file.
Definition: headerinfo.c:178
void G3d_regionCopy(G3D_Region *regionDest, G3D_Region *regionSrc)
Copies the values of regionSrc into regionDst. (The unfortunate order of parameters was chosen in ord...
Definition: g3dregion.c:213
int G3d_tileTypeMap(G3D_Map *map)
Returns the type in which tiles of map are stored in memory.
Definition: headerinfo.c:161
void G3d_getCoordsMap(G3D_Map *map, int *rows, int *cols, int *depths)
Returns the size of the region of map in cells.
Definition: headerinfo.c:19