GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
g3d/header.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <grass/G3d.h>
#include "G3d_intern.h"
Include dependency graph for g3d/header.c:

Go to the source code of this file.

Macros

#define G3D_HEADER_TILEX   "TileDimensionX"
 
#define G3D_HEADER_TILEY   "TileDimensionY"
 
#define G3D_HEADER_TILEZ   "TileDimensionZ"
 
#define G3D_HEADER_TYPE   "CellType"
 
#define G3D_HEADER_COMPRESSION   "useCompression"
 
#define G3D_HEADER_USERLE   "useRle"
 
#define G3D_HEADER_USELZW   "useLzw"
 
#define G3D_HEADER_PRECISION   "Precision"
 
#define G3D_HEADER_DATA_OFFSET   "nofHeaderBytes"
 
#define G3D_HEADER_USEXDR   "useXdr"
 
#define G3D_HEADER_HASINDEX   "hasIndex"
 
#define G3D_HEADER_UNIT   "Units"
 
#define RLE_STATUS_BYTES   2
 
#define XDR_MISUSE_BYTES   10
 

Functions

int G3d_readHeader (G3D_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 G3d_writeHeader (G3D_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 G3d_cacheSizeEncode (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 G3D_USE_CACHE_DEFAULT the function returns G3D_USE_CACHE_DEFAULT. If cacheCode is G3D_USE_CACHE_??? the function returns a value encoding G3D_USE_CACHE_??? and n. Here G3D_USE_CACHE_??? is one of G3D_USE_CACHE_X, G3D_USE_CACHE_Y, G3D_USE_CACHE_Z, G3D_USE_CACHE_XY, G3D_USE_CACHE_XZ, G3D_USE_CACHE_YZ, or G3D_USE_CACHE_XYZ, where e.g. G3D_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 G3D_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 G3d__computeCacheSize (G3D_Map *map, int cacheCode)
 
int G3d_fillHeader (G3D_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)
 

Variables

void * tmpCompress
 
int tmpCompressLength
 
void * xdr
 
int xdrLength
 

Macro Definition Documentation

#define G3D_HEADER_COMPRESSION   "useCompression"

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

#define G3D_HEADER_DATA_OFFSET   "nofHeaderBytes"

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

#define G3D_HEADER_HASINDEX   "hasIndex"

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

#define G3D_HEADER_PRECISION   "Precision"

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

#define G3D_HEADER_TILEX   "TileDimensionX"

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

#define G3D_HEADER_TILEY   "TileDimensionY"

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

#define G3D_HEADER_TILEZ   "TileDimensionZ"

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

#define G3D_HEADER_TYPE   "CellType"

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

#define G3D_HEADER_UNIT   "Units"

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

#define G3D_HEADER_USELZW   "useLzw"

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

#define G3D_HEADER_USERLE   "useRle"

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

#define G3D_HEADER_USEXDR   "useXdr"

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

#define RLE_STATUS_BYTES   2

Referenced by G3d_fillHeader().

#define XDR_MISUSE_BYTES   10

Referenced by G3d_fillHeader().

Function Documentation

int G3d__computeCacheSize ( G3D_Map *  map,
int  cacheCode 
)

Definition at line 239 of file g3d/header.c.

References g3d_cache_default, G3d_fatalError(), G3D_MAX, G3D_MIN, n, and tools::size.

Referenced by G3d_fillHeader(), and G3d_minUnlocked().

int G3d_cacheSizeEncode ( 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 G3D_USE_CACHE_DEFAULT the function returns G3D_USE_CACHE_DEFAULT. If cacheCode is G3D_USE_CACHE_??? the function returns a value encoding G3D_USE_CACHE_??? and n. Here G3D_USE_CACHE_??? is one of G3D_USE_CACHE_X, G3D_USE_CACHE_Y, G3D_USE_CACHE_Z, G3D_USE_CACHE_XY, G3D_USE_CACHE_XZ, G3D_USE_CACHE_YZ, or G3D_USE_CACHE_XYZ, where e.g. G3D_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 G3D_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 224 of file g3d/header.c.

References G3d_fatalError(), and n.

int G3d_fillHeader ( G3D_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 G3d_readHeader ( G3D_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 
)

Definition at line 112 of file g3d/header.c.

References G3d_error(), G3d_filename(), G_free_key_value(), G_read_key_value_file(), and R_OK.

Referenced by G3d_openCellOld().

int G3d_writeHeader ( G3D_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 
)

Variable Documentation

void* tmpCompress

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

Referenced by G3d_fillHeader().

int tmpCompressLength

Definition at line 13 of file g3d/header.c.

Referenced by G3d_fillHeader().

void* xdr

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

Referenced by G3d_initCopyFromXdr(), G3d_initCopyToXdr(), and G3d_initFpXdr().

int xdrLength

Definition at line 15 of file g3d/header.c.

Referenced by G3d_initFpXdr().