G3D Defaults

There are three methods to set default variables. First, the default can be set at compile time in g3ddefault.c. This value has lowest priority. Second, the default can be set via an environment variable. Third, the value can be set explicitly set at run time. This value has highest priority. There are also functions provided to query the value.

Topics

Cache Mode
Compression
Tiles
Windows
Setting the Units
Error Handling

Function Index


Cache Mode

Limiting the maximum cache size

The limit is specified in bytes. It is a limit on the size of cell-data stored in the cache and does not include the support structure.

Default G3D_CACHE_SIZE_MAX_DEFAULT. This is currently set to 2meg and can be changed at compilation time of the library.

Environment variable G3D_MAX_CACHE_SIZE.

void

G3d_setCacheLimit (nBytes)

int nBytes;
int

G3d_getCacheLimit ()

Setting the cache size

This value specifies the number of tiles stored in the cache. It is the value used if at opening time of a map G3D_USE_CACHE_DEFAULT is used for the cache mode. Any other value used at opening time will supersede the default value. A default value of 0 indicates that non-cache mode should be used by default.

Default G3D_CACHE_SIZE_DEFAULT. This is currently set to 1000 and can be changed at compilation time of the library.

Environment variable G3D_DEFAULT_CACHE_SIZE.

void

G3d_setCacheSize (nTiles)

int nTiles;
int

G3d_getCacheSize ()


Compression

Toggling compression mode

This value specifies whether compression should be used while writing a new map. It does not have any effect on old maps.

Default G3D_COMPRESSION_DEFAULT. This is set to G3D_COMPRESSION. This default should not be changed.

Environment variables G3D_USE_COMPRESSION and G3D_NO_COMPRESSION.

See functions G3d_setCompressionMode () and G3d_getCompressionMode ().

Toggling LZW compression

This value specifies whether LZW compression should be used (in addition to RLE and precision). Using LZW usually does not improve the compression significantly but increases I/O time.

Default G3D_USE_LZW_DEFAULT. This is currently set to G3D_NO_LZW and can be changed at compilation time of the library.

Environment variables G3D_USE_LZW and G3D_NO_LZW.

See functions G3d_setCompressionMode () and G3d_getCompressionMode ().

Toggling RLE compression

This value specifies whether RLE compression should be used (in addition to LZW and precision).

Default G3D_USE_RLE_DEFAULT. This is currently set to G3D_USE_RLE and can be changed at compilation time of the library.

Environment variables G3D_USE_RLE and G3D_NO_RLE.

See functions G3d_setCompressionMode () and G3d_getCompressionMode ().

Setting the precision

This number specifies how many mantissa bits should be used when writing a cell value. The minimum value is 0. The maximum value is 23 or G3D_MAX_PRECISION for type G3D_FLOAT, it is 52 or G3D_MAX_PRECISION for type G3D_DOUBLE.

Default G3D_PRECISION_DEFAULT. This is set to G3D_MAX_PRECISION. This default should not be changed.

Environment variables G3D_PRECISION and G3D_MAX_PRECISION..

void

G3d_setCompressionMode (doCompress, doLzw, doRle, precision)

int doCompress, doLzw, doRle, precision;
doCompress should be one of G3D_NO_COMPRESSION and G3D_COMPRESSION, doLzw should be either G3D_NO_LZW or G3D_USE_LZW, doRle should be either G3D_NO_RLE or G3D_USE_RLE, and precision should be either G3D_MAX_PRECISION or a positive integer.
void

G3d_getCompressionMode (doCompress, doLzw, doRle, precision)

int *doCompress, *doLzw, *doRle, *precision;

Tiles

Setting the tile dimensions

The dimensions are specified in number of cell.

Defaults G3D_TILE_X_DEFAULT, G3D_TILE_Y_DEFAULT, and G3D_TILE_Z_DEFAULT. These are currently set to 8 and can be changed at compilation time of the library.

Environment variables G3D_TILE_DIMENSION_X, G3D_TILE_DIMENSION_Y, and G3D_TILE_DIMENSION_Z.

void

G3d_setTileDimension (tileX, tileY, tileZ)

int tileX, tileY, tileZ;
void

G3d_getTileDimension (tileX, tileY, tileZ)

int *tileX, *tileY, *tileZ;

Setting the tile cell-value type

Specifies which type is used to write cell-values on file. This type can be chosen independently of the type used to store cell-values in memory.

Default G3D_FILE_TYPE_DEFAULT. This is set to G3D_DOUBLE. This default should not be changed.

Environment variables G3D_WRITE_FLOAT and G3D_WRITE_DOUBLE.

void

G3d_setFileType (type)

int type;
int

G3d_getFileType ()


Windows

Setting the window

The window is set from a 3d window file.

The default 3d window file is WIND3 located in the current mapset.

Possible choices for 3d window files are name which refers to a window file in the 3d window database located at windows3d of the current mapset; or file names which are identified by a leading "/" or "."; or fully qualified names, i.e. file@mapset which refer to window files in the 3d window database of mapset. Note, that names WIND3 and WIND3@mapset do not specify the default window name in the (current) mapset but rather a window file in the window database of the (current) mapset.

Environment variable G3D_DEFAULT_WINDOW3D.

See functions G3d_useWindowParams (), G3d_setWindow (), and G3d_setWindowMap ().


Setting the Units

Default "none".

No environment variable.

void

G3d_setUnit (unit)

char *unit;

Error Handling

Setting the error function

This variable specifies the function which is invoked when an error (not a fatal error) occurs. For example setting the error function to G3d_fatalError simplifies debugging with dbx and also might show errors which are missed because the application does not check the return value.

Default G3d_skipError.

Environment variables G3D_USE_FATAL_ERROR and G3D_USE_PRINT_ERROR.

void

G3d_setErrorFun (fun)

void (*fun)(char *);

The following 3 functions are possible choices for error functions.

void

G3d_skipError (msg)

char (*msg)(char *);
This function ignores the error.

void

G3d_printError (msg)

char (*msg)(char *);
This function prints the error message msg to stderr and returns.

void

G3d_fatalError (msg)

char (*msg)(char *);
This function prints the error message msg to stderr, flushes stdout and stderr, and terminates the program with a segementation fault.