8 #define G3D_NO_DEFAULT -10
10 #define G3D_COMPRESSION_DEFAULT G3D_COMPRESSION
11 #define G3D_USE_LZW_DEFAULT G3D_NO_LZW
12 #define G3D_USE_RLE_DEFAULT G3D_USE_RLE
13 #define G3D_PRECISION_DEFAULT G3D_MAX_PRECISION
14 #define G3D_CACHE_SIZE_DEFAULT 1000
15 #define G3D_CACHE_SIZE_MAX_DEFAULT 2000000
16 #define G3D_FILE_TYPE_DEFAULT DCELL_TYPE
17 #define G3D_TILE_X_DEFAULT 8
18 #define G3D_TILE_Y_DEFAULT 8
19 #define G3D_TILE_Z_DEFAULT 8
20 #define G3D_ERROR_FUN_DEFAULT G3d_skipError
21 #define G3D_UNIT_DEFAULT "none"
25 #define G3D_COMPRESSION_ENV_VAR_YES "G3D_USE_COMPRESSION"
26 #define G3D_COMPRESSION_ENV_VAR_NO "G3D_NO_COMPRESSION"
28 #define G3D_LZW_ENV_VAR_YES "G3D_USE_LZW"
29 #define G3D_LZW_ENV_VAR_NO "G3D_NO_LZW"
31 #define G3D_RLE_ENV_VAR_YES "G3D_USE_RLE"
32 #define G3D_RLE_ENV_VAR_NO "G3D_NO_RLE"
34 #define G3D_PRECISION_ENV_VAR "G3D_PRECISION"
35 #define G3D_PRECISION_ENV_VAR_MAX "G3D_MAX_PRECISION"
37 #define G3D_CACHE_SIZE_ENV_VAR "G3D_DEFAULT_CACHE_SIZE"
38 #define G3D_CACHE_SIZE_MAX_ENV_VAR "G3D_MAX_CACHE_SIZE"
40 #define G3D_FILE_FLOAT_ENV_VAR "G3D_WRITE_FLOAT"
41 #define G3D_FILE_DOUBLE_ENV_VAR "G3D_WRITE_DOUBLE"
43 #define G3D_TILE_DIM_X_ENV_VAR "G3D_TILE_DIMENSION_X"
44 #define G3D_TILE_DIM_Y_ENV_VAR "G3D_TILE_DIMENSION_Y"
45 #define G3D_TILE_DIM_Z_ENV_VAR "G3D_TILE_DIMENSION_Z"
47 #define G3D_FATAL_ERROR_ENV_VAR "G3D_USE_FATAL_ERROR"
48 #define G3D_PRINT_ERROR_ENV_VAR "G3D_USE_PRINT_ERROR"
50 #define G3D_DEFAULT_WINDOW3D "G3D_DEFAULT_WINDOW3D"
87 if ((doCompress != G3D_NO_COMPRESSION) && (doCompress != G3D_COMPRESSION))
88 G3d_fatalError(
"G3d_setCompressionMode: wrong value for doCompress.");
92 if (doCompress == G3D_NO_COMPRESSION)
95 if ((doLzw != G3D_NO_LZW) && (doLzw != G3D_USE_LZW))
98 if ((doRle != G3D_NO_RLE) && (doRle != G3D_USE_RLE))
102 G3d_fatalError(
"G3d_setCompressionMode: wrong value for precision.");
128 if (doCompress !=
NULL)
134 if (precision !=
NULL)
225 if ((type != FCELL_TYPE) && (type != DCELL_TYPE))
266 (
"G3d_setTileDimension: value for tile x environment variable out of range");
270 (
"G3d_setTileDimension: value for tile y environment variable out of range");
274 (
"G3d_setTileDimension: value for tile z environment variable out of range");
349 static int firstTime = 1;
350 const char *
value, *windowName;
411 (
"G3d_initDefaults: precision environment variable has invalid value");
416 (
"G3d_initDefaults: value for cache environment variable out of range");
446 (
"G3d_initDefaults: cache environment variable has invalid value");
450 (
"G3d_initDefaults: value for cache environment variable out of range");
464 (
"G3d_initDefaults: cache environment variable has invalid value");
468 (
"G3d_initDefaults: value for cache environment variable out of range");
482 (
"G3d_initDefaults: tile dimension x environment variable has invalid value");
486 (
"G3d_initDefaults: value for tile x environment variable out of range");
498 (
"G3d_initDefaults: tile dimension y environment variable has invalid value");
502 (
"G3d_initDefaults: value for tile y environment variable out of range");
514 (
"G3d_initDefaults: tile dimension z environment variable has invalid value");
518 (
"G3d_initDefaults: value for tile z environment variable out of range");
545 if (windowName ==
NULL) {
int g3d_do_rle_compression
#define G3D_ERROR_FUN_DEFAULT
#define G3D_USE_RLE_DEFAULT
char * G_store(const char *s)
Copy string to allocated memory.
void G3d_free(void *buf)
Same as free (ptr).
#define G3D_RLE_ENV_VAR_NO
int G3d_getCacheSize()
get cache size
#define G3D_PRINT_ERROR_ENV_VAR
void G3d_getCompressionMode(int *doCompress, int *doLzw, int *doRle, int *precision)
void G3d_setCompressionMode(int doCompress, int doLzw, int doRle, int precision)
doCompress should be one of G3D_NO_COMPRESSION and G3D_COMPRESSION, doRle should be either G3D_NO_RLE...
#define G3D_TILE_DIM_X_ENV_VAR
#define G3D_CACHE_SIZE_MAX_ENV_VAR
#define G3D_RLE_ENV_VAR_YES
#define G3D_TILE_X_DEFAULT
#define G3D_CACHE_SIZE_ENV_VAR
#define G3D_FILE_DOUBLE_ENV_VAR
#define G3D_FATAL_ERROR_ENV_VAR
void G3d_printError(const char *msg)
This function prints the error message msg to stderr and returns.
void G3d_setFileType(int type)
set G3d file type
#define G3D_CACHE_SIZE_DEFAULT
#define G3D_FILE_FLOAT_ENV_VAR
void G3d_setCacheLimit(int nBytes)
Set cache limit.
#define G3D_TILE_DIM_Z_ENV_VAR
int g3d_tile_dimension[3]
void G3d_getTileDimension(int *tileX, int *tileY, int *tileZ)
get Tile Dimension
int g3d_do_lzw_compression
void G3d_setWindow(G3D_Region *window)
Sets the default window used for every map opened later in the program. Can be used multiple times in...
#define G3D_LZW_ENV_VAR_YES
#define G3D_DEFAULT_WINDOW3D
#define G3D_TILE_Z_DEFAULT
char * G3d_getWindowParams(void)
void G3d_fatalError_noargs(const char *)
void G3d_setUnit(const char *unit)
set G3d unit
#define G3D_FILE_TYPE_DEFAULT
void(* g3d_error_fun)(const char *)
#define G3D_COMPRESSION_DEFAULT
void G3d_initDefaults(void)
Initializes the default values described in G3D Defaults. Applications have to use this function only...
#define G3D_COMPRESSION_ENV_VAR_YES
int G3d_readWindow(G3D_Region *window, const char *windowName)
Reads window from the file specified by windowName. The name is converted by the rules defined in win...
void G3d_setTileDimension(int tileX, int tileY, int tileZ)
set Tile Dimension
#define G3D_PRECISION_DEFAULT
#define G3D_PRECISION_ENV_VAR_MAX
#define G3D_COMPRESSION_ENV_VAR_NO
void G3d_setErrorFun(void(*fun)(const char *))
set error function
int G3d_getCacheLimit()
Get cache limit.
#define G3D_TILE_DIM_Y_ENV_VAR
#define G3D_PRECISION_ENV_VAR
void G3d_setCacheSize(int nTiles)
set cache size
void G3d_fatalError(const char *,...)
This function prints the error message msg, and terminates the program with an error status...
#define G3D_USE_LZW_DEFAULT
#define G3D_TILE_Y_DEFAULT
#define G3D_LZW_ENV_VAR_NO
#define G3D_CACHE_SIZE_MAX_DEFAULT
int G3d_getFileType()
get G3d file type