GRASS Programmer's Manual
6.4.2(2012)
|
00001 #include <grass/G3d.h> 00002 #include "G3d_intern.h" 00003 00004 /*---------------------------------------------------------------------------*/ 00005 00006 00019 void G3d_getCoordsMap(G3D_Map * map, int *rows, int *cols, int *depths) 00020 { 00021 *rows = map->region.rows; 00022 *cols = map->region.cols; 00023 *depths = map->region.depths; 00024 } 00025 00026 /*---------------------------------------------------------------------------*/ 00027 00028 void G3d_getCoordsMapWindow(G3D_Map * map, int *rows, int *cols, int *depths) 00029 { 00030 *rows = map->window.rows; 00031 *cols = map->window.cols; 00032 *depths = map->window.depths; 00033 } 00034 00035 /*---------------------------------------------------------------------------*/ 00036 00037 00051 void G3d_getNofTilesMap(G3D_Map * map, int *nx, int *ny, int *nz) 00052 { 00053 *nx = map->nx; 00054 *ny = map->ny; 00055 *nz = map->nz; 00056 } 00057 00058 /*---------------------------------------------------------------------------*/ 00059 00060 00076 void 00077 G3d_getRegionMap(G3D_Map * map, double *north, double *south, double *east, 00078 double *west, double *top, double *bottom) 00079 { 00080 *north = map->region.north; 00081 *south = map->region.south; 00082 *east = map->region.east; 00083 *west = map->region.west; 00084 *top = map->region.top; 00085 *bottom = map->region.bottom; 00086 } 00087 00088 /*---------------------------------------------------------------------------*/ 00089 00090 void 00091 G3d_getWindowMap(G3D_Map * map, double *north, double *south, double *east, 00092 double *west, double *top, double *bottom) 00093 { 00094 *north = map->window.north; 00095 *south = map->window.south; 00096 *east = map->window.east; 00097 *west = map->window.west; 00098 *top = map->window.top; 00099 *bottom = map->window.bottom; 00100 } 00101 00102 /*---------------------------------------------------------------------------*/ 00103 00104 00115 void G3d_getRegionStructMap(G3D_Map * map, G3D_Region * region) 00116 { 00117 G3d_regionCopy(region, &(map->region)); 00118 } 00119 00120 /*---------------------------------------------------------------------------*/ 00121 00122 void G3d_getWindowStructMap(G3D_Map * map, G3D_Region * window) 00123 { 00124 G3d_regionCopy(window, &(map->window)); 00125 } 00126 00127 /*---------------------------------------------------------------------------*/ 00128 00129 00142 void G3d_getTileDimensionsMap(G3D_Map * map, int *x, int *y, int *z) 00143 { 00144 *x = map->tileX; 00145 *y = map->tileY; 00146 *z = map->tileZ; 00147 } 00148 00149 /*---------------------------------------------------------------------------*/ 00150 00151 00161 int G3d_tileTypeMap(G3D_Map * map) 00162 { 00163 return map->typeIntern; 00164 } 00165 00166 /*---------------------------------------------------------------------------*/ 00167 00168 00178 int G3d_fileTypeMap(G3D_Map * map) 00179 { 00180 return map->type; 00181 } 00182 00183 /*---------------------------------------------------------------------------*/ 00184 00185 00195 int G3d_tilePrecisionMap(G3D_Map * map) 00196 { 00197 return map->precision; 00198 } 00199 00200 /*---------------------------------------------------------------------------*/ 00201 00202 00212 int G3d_tileUseCacheMap(G3D_Map * map) 00213 { 00214 return map->useCache; 00215 } 00216 00217 00218 00228 void G3d_printHeader(G3D_Map * map) 00229 { 00230 double rangeMin, rangeMax; 00231 00232 printf("File %s open for %sing:\n", map->fileName, 00233 (map->operation == G3D_WRITE_DATA ? "writ" : 00234 (map->operation == G3D_READ_DATA ? "read" : "unknown"))); 00235 printf(" Fd = %d, Unit %s, Type: %s, ", map->data_fd, 00236 map->unit, 00237 (map->type == FCELL_TYPE ? "float" : 00238 (map->type == DCELL_TYPE ? "double" : "unknown"))); 00239 printf("Type intern: %s\n", 00240 (map->typeIntern == FCELL_TYPE ? "float" : 00241 (map->typeIntern == DCELL_TYPE ? "double" : "unknown"))); 00242 if (map->compression == G3D_NO_COMPRESSION) 00243 printf(" Compression: none\n"); 00244 else { 00245 printf(" Compression:%s%s Precision: %s", 00246 (map->useLzw ? " lzw," : ""), (map->useRle ? " rle," : ""), 00247 (map->precision == -1 ? "all bits used\n" : "using")); 00248 if (map->precision != -1) 00249 printf(" %d bits\n", map->precision); 00250 } 00251 00252 if (!map->useCache) 00253 printf(" Cache: none\n"); 00254 else { 00255 printf(" Cache: used%s\n", 00256 (map->operation == G3D_WRITE_DATA ? ", File Cache used" : "")); 00257 } 00258 00259 G3d_range_min_max(map, &rangeMin, &rangeMax); 00260 00261 printf(" Region: (%f %f) (%f %f) (%f %f)\n", 00262 map->region.south, map->region.north, map->region.west, 00263 map->region.east, map->region.bottom, map->region.top); 00264 printf(" (%d %d %d)\n", map->region.rows, map->region.cols, 00265 map->region.depths); 00266 printf(" Tile size (%d %d %d)\n", map->tileX, map->tileY, map->tileZ); 00267 printf(" Range ("); 00268 if (G3d_isNullValueNum(&rangeMin, DCELL_TYPE)) 00269 printf("NULL, "); 00270 else 00271 printf("%f, ", (double)rangeMin); 00272 if (G3d_isNullValueNum(&rangeMax, DCELL_TYPE)) 00273 printf("NULL)\n"); 00274 else 00275 printf("%f)\n", (double)rangeMax); 00276 fflush(stdout); 00277 }