GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72114
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
raster3d/header.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <grass/raster3d.h>
#include <grass/glocale.h>
#include "raster3d_intern.h"
Include dependency graph for raster3d/header.c:

Go to the source code of this file.

Macros

#define RASTER3D_HEADER_TILEX   "TileDimensionX"
 
#define RASTER3D_HEADER_TILEY   "TileDimensionY"
 
#define RASTER3D_HEADER_TILEZ   "TileDimensionZ"
 
#define RASTER3D_HEADER_TYPE   "CellType"
 
#define RASTER3D_HEADER_COMPRESSION   "useCompression"
 
#define RASTER3D_HEADER_USERLE   "useRle"
 
#define RASTER3D_HEADER_USELZW   "useLzw"
 
#define RASTER3D_HEADER_PRECISION   "Precision"
 
#define RASTER3D_HEADER_DATA_OFFSET   "nofHeaderBytes"
 
#define RASTER3D_HEADER_USEXDR   "useXdr"
 
#define RASTER3D_HEADER_HASINDEX   "hasIndex"
 
#define RASTER3D_HEADER_UNIT   "Units"
 
#define RASTER3D_HEADER_VERTICAL_UNIT   "VerticalUnits"
 
#define RASTER3D_HEADER_VERSION   "Version"
 
#define RLE_STATUS_BYTES   2
 
#define XDR_MISUSE_BYTES   10
 

Functions

int Rast3d_read_header (RASTER3D_Map *map, int *proj, int *zone, double *north, double *south, double *east, double *west, double *top, double *bottom, int *rows, int *cols, int *depths, double *ew_res, double *ns_res, double *tb_res, int *tileX, int *tileY, int *tileZ, int *type, int *compression, int *useRle, int *useLzw, int *precision, int *dataOffset, int *useXdr, int *hasIndex, char **unit, int *vertical_unit, int *version)
 
int Rast3d_write_header (RASTER3D_Map *map, int proj, int zone, double north, double south, double east, double west, double top, double bottom, int rows, int cols, int depths, double ew_res, double ns_res, double tb_res, int tileX, int tileY, int tileZ, int type, int compression, int useRle, int useLzw, int precision, int dataOffset, int useXdr, int hasIndex, char *unit, int vertical_unit, int version)
 
int Rast3d_rewrite_header (RASTER3D_Map *map)
 
int Rast3d_cache_size_encode (int cacheCode, int n)
 Returns a number which encodes multiplicity n of cacheCode. This value can be used to specify the size of the cache. If cacheCode is the size (in tiles) of the cache the function returns cacheCode * n. If cacheCode is RASTER3D_USE_CACHE_DEFAULT the function returns RASTER3D_USE_CACHE_DEFAULT. If cacheCode is RASTER3D_USE_CACHE_??? the function returns a value encoding RASTER3D_USE_CACHE_??? and n. Here RASTER3D_USE_CACHE_??? is one of RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y, RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ, RASTER3D_USE_CACHE_YZ, or RASTER3D_USE_CACHE_XYZ, where e.g. RASTER3D_USE_CACHE_X specifies that the cache should store as many tiles as there exist in one row along the x-axis of the tile cube, and RASTER3D_USE_CACHE_XY specifies that the cache should store as many tiles as there exist in one slice of the tile cube with constant Z coordinate. More...
 
int Rast3d__compute_cache_size (RASTER3D_Map *map, int cacheCode)
 
int Rast3d_fill_header (RASTER3D_Map *map, int operation, int compression, int useRle, int useLzw, int type, int precision, int cache, int hasIndex, int useXdr, int typeIntern, int nofHeaderBytes, int tileX, int tileY, int tileZ, int proj, int zone, double north, double south, double east, double west, double top, double bottom, int rows, int cols, int depths, double ew_res, double ns_res, double tb_res, char *unit, int vertical_unit, int version)
 

Variables

void * tmpCompress
 
int tmpCompressLength
 
void * xdr
 
int xdrLength
 

Macro Definition Documentation

#define RASTER3D_HEADER_COMPRESSION   "useCompression"

Definition at line 22 of file raster3d/header.c.

#define RASTER3D_HEADER_DATA_OFFSET   "nofHeaderBytes"

Definition at line 26 of file raster3d/header.c.

#define RASTER3D_HEADER_HASINDEX   "hasIndex"

Definition at line 28 of file raster3d/header.c.

#define RASTER3D_HEADER_PRECISION   "Precision"

Definition at line 25 of file raster3d/header.c.

#define RASTER3D_HEADER_TILEX   "TileDimensionX"

Definition at line 18 of file raster3d/header.c.

#define RASTER3D_HEADER_TILEY   "TileDimensionY"

Definition at line 19 of file raster3d/header.c.

#define RASTER3D_HEADER_TILEZ   "TileDimensionZ"

Definition at line 20 of file raster3d/header.c.

#define RASTER3D_HEADER_TYPE   "CellType"

Definition at line 21 of file raster3d/header.c.

#define RASTER3D_HEADER_UNIT   "Units"

Definition at line 29 of file raster3d/header.c.

#define RASTER3D_HEADER_USELZW   "useLzw"

Definition at line 24 of file raster3d/header.c.

#define RASTER3D_HEADER_USERLE   "useRle"

Definition at line 23 of file raster3d/header.c.

#define RASTER3D_HEADER_USEXDR   "useXdr"

Definition at line 27 of file raster3d/header.c.

#define RASTER3D_HEADER_VERSION   "Version"

Definition at line 31 of file raster3d/header.c.

#define RASTER3D_HEADER_VERTICAL_UNIT   "VerticalUnits"

Definition at line 30 of file raster3d/header.c.

#define RLE_STATUS_BYTES   2

Referenced by Rast3d_fill_header().

#define XDR_MISUSE_BYTES   10

Referenced by Rast3d_fill_header().

Function Documentation

int Rast3d_cache_size_encode ( int  cacheCode,
int  n 
)

Returns a number which encodes multiplicity n of cacheCode. This value can be used to specify the size of the cache. If cacheCode is the size (in tiles) of the cache the function returns cacheCode * n. If cacheCode is RASTER3D_USE_CACHE_DEFAULT the function returns RASTER3D_USE_CACHE_DEFAULT. If cacheCode is RASTER3D_USE_CACHE_??? the function returns a value encoding RASTER3D_USE_CACHE_??? and n. Here RASTER3D_USE_CACHE_??? is one of RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y, RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ, RASTER3D_USE_CACHE_YZ, or RASTER3D_USE_CACHE_XYZ, where e.g. RASTER3D_USE_CACHE_X specifies that the cache should store as many tiles as there exist in one row along the x-axis of the tile cube, and RASTER3D_USE_CACHE_XY specifies that the cache should store as many tiles as there exist in one slice of the tile cube with constant Z coordinate.

Parameters
cacheCode
n
Returns
int

Definition at line 251 of file raster3d/header.c.

References Rast3d_fatal_error(), RASTER3D_NO_CACHE, RASTER3D_USE_CACHE_DEFAULT, and RASTER3D_USE_CACHE_XYZ.

int Rast3d_fill_header ( RASTER3D_Map map,
int  operation,
int  compression,
int  useRle,
int  useLzw,
int  type,
int  precision,
int  cache,
int  hasIndex,
int  useXdr,
int  typeIntern,
int  nofHeaderBytes,
int  tileX,
int  tileY,
int  tileZ,
int  proj,
int  zone,
double  north,
double  south,
double  east,
double  west,
double  top,
double  bottom,
int  rows,
int  cols,
int  depths,
double  ew_res,
double  ns_res,
double  tb_res,
char *  unit,
int  vertical_unit,
int  version 
)

Definition at line 306 of file raster3d/header.c.

References RASTER3D_Region::bottom, RASTER3D_Map::cache, RASTER3D_Map::clipX, RASTER3D_Map::clipY, RASTER3D_Map::clipZ, RASTER3D_Region::cols, compression, RASTER3D_Map::compression, RASTER3D_Map::currentIndex, RASTER3D_Map::data, RASTER3D_Map::data_fd, DCELL_TYPE, RASTER3D_Region::depths, RASTER3D_Region::east, RASTER3D_Region::ew_res, FCELL_TYPE, RASTER3D_Map::fileEndPtr, g3d_cache_default, g3d_cache_max, G_store(), if(), RASTER3D_Region::north, RASTER3D_Region::ns_res, RASTER3D_Map::nTiles, NULL, RASTER3D_Map::numLengthExtern, RASTER3D_Map::numLengthIntern, RASTER3D_Map::nx, RASTER3D_Map::nxy, RASTER3D_Map::ny, RASTER3D_Map::nz, RASTER3D_Map::offset, RASTER3D_Map::operation, RASTER3D_Map::precision, RASTER3D_Region::proj, Rast3d__compute_cache_size(), Rast3d_adjust_region(), Rast3d_error(), Rast3d_extern_length(), Rast3d_fatal_error(), Rast3d_init_cache(), Rast3d_init_fp_xdr(), Rast3d_init_index(), Rast3d_length(), Rast3d_malloc(), Rast3d_realloc(), RASTER3D_MAX, RASTER3D_MIN, RASTER3D_NO_CACHE, RASTER3D_NO_COMPRESSION, RASTER3D_USE_CACHE_DEFAULT, RASTER3D_VALID_OPERATION, RASTER3D_VALID_XDR_OPTION, RASTER3D_Map::region, RLE_STATUS_BYTES, RASTER3D_Region::rows, RASTER3D_Region::south, RASTER3D_Region::tb_res, RASTER3D_Map::tileSize, RASTER3D_Map::tileX, RASTER3D_Map::tileXY, RASTER3D_Map::tileY, RASTER3D_Map::tileZ, tmpCompress, tmpCompressLength, RASTER3D_Region::top, RASTER3D_Map::type, RASTER3D_Map::typeIntern, RASTER3D_Map::unit, RASTER3D_Map::useCache, RASTER3D_Map::useLzw, RASTER3D_Map::useRle, RASTER3D_Map::useXdr, RASTER3D_Map::version, RASTER3D_Map::vertical_unit, RASTER3D_Region::west, XDR_MISUSE_BYTES, and RASTER3D_Region::zone.

Referenced by Rast3d_open_cell_new(), and Rast3d_open_cell_old().

int Rast3d_read_header ( RASTER3D_Map map,
int proj,
int zone,
double *  north,
double *  south,
double *  east,
double *  west,
double *  top,
double *  bottom,
int rows,
int cols,
int depths,
double *  ew_res,
double *  ns_res,
double *  tb_res,
int tileX,
int tileY,
int tileZ,
int type,
int compression,
int useRle,
int useLzw,
int precision,
int dataOffset,
int useXdr,
int hasIndex,
char **  unit,
int vertical_unit,
int version 
)
int Rast3d_write_header ( RASTER3D_Map map,
int  proj,
int  zone,
double  north,
double  south,
double  east,
double  west,
double  top,
double  bottom,
int  rows,
int  cols,
int  depths,
double  ew_res,
double  ns_res,
double  tb_res,
int  tileX,
int  tileY,
int  tileZ,
int  type,
int  compression,
int  useRle,
int  useLzw,
int  precision,
int  dataOffset,
int  useXdr,
int  hasIndex,
char *  unit,
int  vertical_unit,
int  version 
)

Variable Documentation

void* tmpCompress

Definition at line 11 of file raster3d/header.c.

Referenced by Rast3d_fill_header().

int tmpCompressLength

Definition at line 12 of file raster3d/header.c.

Referenced by Rast3d_fill_header().

void* xdr
int xdrLength

Definition at line 14 of file raster3d/header.c.

Referenced by Rast3d_init_fp_xdr().