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

Go to the source code of this file.

Macros

#define RASTER3D_NO_DEFAULT   -10
 
#define RASTER3D_COMPRESSION_DEFAULT   RASTER3D_COMPRESSION
 
#define RASTER3D_PRECISION_DEFAULT   RASTER3D_MAX_PRECISION
 
#define RASTER3D_CACHE_SIZE_DEFAULT   1000
 
#define RASTER3D_CACHE_SIZE_MAX_DEFAULT   16777216
 
#define RASTER3D_FILE_TYPE_DEFAULT   DCELL_TYPE
 
#define RASTER3D_TILE_X_DEFAULT   16
 
#define RASTER3D_TILE_Y_DEFAULT   16
 
#define RASTER3D_TILE_Z_DEFAULT   8
 
#define RASTER3D_ERROR_FUN_DEFAULT   Rast3d_skip_error
 
#define RASTER3D_UNIT_DEFAULT   "none"
 
#define RASTER3D_VERTICAL_UNIT_DEFAULT   U_UNKNOWN
 
#define RASTER3D_COMPRESSION_ENV_VAR_YES   "RASTER3D_USE_COMPRESSION"
 Name of the environmental variable specifying that compression should be used. More...
 
#define RASTER3D_COMPRESSION_ENV_VAR_NO   "RASTER3D_NO_COMPRESSION"
 Name of the environmental variable specifying that compression should not be used. More...
 
#define RASTER3D_PRECISION_ENV_VAR   "RASTER3D_PRECISION"
 
#define RASTER3D_PRECISION_ENV_VAR_MAX   "RASTER3D_MAX_PRECISION"
 
#define RASTER3D_CACHE_SIZE_ENV_VAR   "RASTER3D_DEFAULT_CACHE_SIZE"
 
#define RASTER3D_CACHE_SIZE_MAX_ENV_VAR   "RASTER3D_MAX_CACHE_SIZE"
 
#define RASTER3D_FILE_FLOAT_ENV_VAR   "RASTER3D_WRITE_FLOAT"
 
#define RASTER3D_FILE_DOUBLE_ENV_VAR   "RASTER3D_WRITE_DOUBLE"
 
#define RASTER3D_TILE_DIM_X_ENV_VAR   "RASTER3D_TILE_DIMENSION_X"
 
#define RASTER3D_TILE_DIM_Y_ENV_VAR   "RASTER3D_TILE_DIMENSION_Y"
 
#define RASTER3D_TILE_DIM_Z_ENV_VAR   "RASTER3D_TILE_DIMENSION_Z"
 
#define RASTER3D_FATAL_ERROR_ENV_VAR   "RASTER3D_USE_FATAL_ERROR"
 
#define RASTER3D_PRINT_ERROR_ENV_VAR   "RASTER3D_USE_PRINT_ERROR"
 
#define RASTER3D_DEFAULT_WINDOW3D   "RASTER3D_DEFAULT_WINDOW3D"
 

Functions

void Rast3d_set_compression_mode (int doCompress, int precision)
 set compression mode More...
 
void Rast3d_get_compression_mode (int *doCompress, int *precision)
 Gets compression mode. More...
 
void Rast3d_set_cache_size (int nTiles)
 set cache size More...
 
int Rast3d_get_cache_size ()
 get cache size More...
 
void Rast3d_set_cache_limit (int nBytes)
 Set cache limit. More...
 
int Rast3d_get_cache_limit ()
 Get cache limit. More...
 
void Rast3d_set_file_type (int type)
 set G3d file type More...
 
int Rast3d_get_file_type ()
 get G3d file type More...
 
void Rast3d_set_tile_dimension (int tileX, int tileY, int tileZ)
 set Tile Dimension More...
 
void Rast3d_get_tile_dimension (int *tileX, int *tileY, int *tileZ)
 get Tile Dimension More...
 
void Rast3d_set_error_fun (void(*fun)(const char *))
 set error function More...
 
void Rast3d_init_defaults (void)
 Initializes the default values described in RASTER3D Defaults. Applications have to use this function only if they need to query the default values before the first file (either old or new) has been opened. More...
 

Variables

int g3d_version = RASTER3D_MAP_VERSION
 
int g3d_do_compression = RASTER3D_NO_DEFAULT
 
int g3d_precision = RASTER3D_NO_DEFAULT
 
int g3d_cache_default = RASTER3D_NO_DEFAULT
 
int g3d_cache_max = RASTER3D_NO_DEFAULT
 
int g3d_file_type = RASTER3D_NO_DEFAULT
 
int g3d_tile_dimension [3]
 
void(* g3d_error_fun )(const char *) = NULL
 
char * g3d_unit_default = NULL
 
int g3d_vertical_unit_default = U_UNDEFINED
 

Macro Definition Documentation

#define RASTER3D_CACHE_SIZE_DEFAULT   1000

Definition at line 12 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_CACHE_SIZE_ENV_VAR   "RASTER3D_DEFAULT_CACHE_SIZE"

Definition at line 47 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_CACHE_SIZE_MAX_DEFAULT   16777216

Definition at line 13 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_CACHE_SIZE_MAX_ENV_VAR   "RASTER3D_MAX_CACHE_SIZE"

Definition at line 48 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_COMPRESSION_DEFAULT   RASTER3D_COMPRESSION

Definition at line 10 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_COMPRESSION_ENV_VAR_NO   "RASTER3D_NO_COMPRESSION"

Name of the environmental variable specifying that compression should not be used.

See Also
RASTER3D_COMPRESSION_ENV_VAR_YES

Definition at line 42 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_COMPRESSION_ENV_VAR_YES   "RASTER3D_USE_COMPRESSION"

Name of the environmental variable specifying that compression should be used.

Setting the environmental variable to any value will cause that the compression will be used (set when calling Rast3d_init_defaults for the first time).

This environmental variable takes precedence before the environmental variable specified by RASTER3D_COMPRESSION_ENV_VAR_NO.

Definition at line 35 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_DEFAULT_WINDOW3D   "RASTER3D_DEFAULT_WINDOW3D"

Definition at line 60 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_ERROR_FUN_DEFAULT   Rast3d_skip_error

Definition at line 18 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_FATAL_ERROR_ENV_VAR   "RASTER3D_USE_FATAL_ERROR"

Definition at line 57 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_FILE_DOUBLE_ENV_VAR   "RASTER3D_WRITE_DOUBLE"

Definition at line 51 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_FILE_FLOAT_ENV_VAR   "RASTER3D_WRITE_FLOAT"

Definition at line 50 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_FILE_TYPE_DEFAULT   DCELL_TYPE

Definition at line 14 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_NO_DEFAULT   -10

Definition at line 8 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_PRECISION_DEFAULT   RASTER3D_MAX_PRECISION

Definition at line 11 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_PRECISION_ENV_VAR   "RASTER3D_PRECISION"

Definition at line 44 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_PRECISION_ENV_VAR_MAX   "RASTER3D_MAX_PRECISION"

Definition at line 45 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_PRINT_ERROR_ENV_VAR   "RASTER3D_USE_PRINT_ERROR"

Definition at line 58 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_DIM_X_ENV_VAR   "RASTER3D_TILE_DIMENSION_X"

Definition at line 53 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_DIM_Y_ENV_VAR   "RASTER3D_TILE_DIMENSION_Y"

Definition at line 54 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_DIM_Z_ENV_VAR   "RASTER3D_TILE_DIMENSION_Z"

Definition at line 55 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_X_DEFAULT   16

Definition at line 15 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_Y_DEFAULT   16

Definition at line 16 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_TILE_Z_DEFAULT   8

Definition at line 17 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_UNIT_DEFAULT   "none"

Definition at line 19 of file defaults.c.

Referenced by Rast3d_init_defaults().

#define RASTER3D_VERTICAL_UNIT_DEFAULT   U_UNKNOWN

Definition at line 20 of file defaults.c.

Referenced by Rast3d_init_defaults().

Function Documentation

int Rast3d_get_cache_limit ( )

Get cache limit.

Returns
int

Definition at line 195 of file defaults.c.

References g3d_cache_max.

int Rast3d_get_cache_size ( )

get cache size

Returns
int

Definition at line 163 of file defaults.c.

References g3d_cache_default.

void Rast3d_get_compression_mode ( int doCompress,
int precision 
)

Gets compression mode.

Parameters
doCompresspointer to the integer where the compression mode will be stored
precisionpointer to the integer where the precision mode will be stored
See Also
Rast3d_set_compression_mode, RASTER3D_COMPRESSION_ENV_VAR_YES, RASTER3D_COMPRESSION_ENV_VAR_YES

Definition at line 128 of file defaults.c.

References g3d_do_compression, g3d_precision, and NULL.

Referenced by Rast3d_change_precision(), Rast3d_get_standard3d_params(), and Rast3d_open_new_param().

void Rast3d_get_tile_dimension ( int tileX,
int tileY,
int tileZ 
)

get Tile Dimension

Parameters
tileX
tileY
tileZ
Returns
void

Definition at line 271 of file defaults.c.

References g3d_tile_dimension.

Referenced by Rast3d_change_precision(), Rast3d_change_type(), Rast3d_get_standard3d_params(), Rast3d_open_new_opt_tile_size(), Rast3d_open_new_param(), and Rast3d_retile().

void Rast3d_init_defaults ( void  )

Initializes the default values described in RASTER3D Defaults. Applications have to use this function only if they need to query the default values before the first file (either old or new) has been opened.

Returns
void

Definition at line 305 of file defaults.c.

References DCELL_TYPE, FCELL_TYPE, g3d_cache_default, g3d_cache_max, g3d_do_compression, g3d_error_fun, g3d_file_type, g3d_precision, g3d_tile_dimension, g3d_unit_default, g3d_vertical_unit_default, G_store(), getenv(), NULL, Rast3d_fatal_error(), Rast3d_fatal_error_noargs(), Rast3d_get_window_params(), Rast3d_print_error(), Rast3d_read_window(), Rast3d_set_window(), RASTER3D_CACHE_SIZE_DEFAULT, RASTER3D_CACHE_SIZE_ENV_VAR, RASTER3D_CACHE_SIZE_MAX_DEFAULT, RASTER3D_CACHE_SIZE_MAX_ENV_VAR, RASTER3D_COMPRESSION, RASTER3D_COMPRESSION_DEFAULT, RASTER3D_COMPRESSION_ENV_VAR_NO, RASTER3D_COMPRESSION_ENV_VAR_YES, RASTER3D_DEFAULT_WINDOW3D, RASTER3D_ERROR_FUN_DEFAULT, RASTER3D_FATAL_ERROR_ENV_VAR, RASTER3D_FILE_DOUBLE_ENV_VAR, RASTER3D_FILE_FLOAT_ENV_VAR, RASTER3D_FILE_TYPE_DEFAULT, RASTER3D_MAX_PRECISION, RASTER3D_NO_COMPRESSION, RASTER3D_NO_DEFAULT, RASTER3D_PRECISION_DEFAULT, RASTER3D_PRECISION_ENV_VAR, RASTER3D_PRECISION_ENV_VAR_MAX, RASTER3D_PRINT_ERROR_ENV_VAR, RASTER3D_TILE_DIM_X_ENV_VAR, RASTER3D_TILE_DIM_Y_ENV_VAR, RASTER3D_TILE_DIM_Z_ENV_VAR, RASTER3D_TILE_X_DEFAULT, RASTER3D_TILE_Y_DEFAULT, RASTER3D_TILE_Z_DEFAULT, RASTER3D_UNIT_DEFAULT, RASTER3D_VERTICAL_UNIT_DEFAULT, and U_UNDEFINED.

Referenced by GVL_libinit(), Rast3d_get_standard3d_params(), Rast3d_open_cell_new(), Rast3d_open_cell_old_no_header(), Rast3d_open_new_opt_tile_size(), and Rast3d_open_new_param().

void Rast3d_set_cache_limit ( int  nBytes)

Set cache limit.

Parameters
nBytes
Returns
void

Definition at line 178 of file defaults.c.

References g3d_cache_max, and Rast3d_fatal_error().

void Rast3d_set_cache_size ( int  nTiles)

set cache size

Parameters
nTiles
Returns
void

Definition at line 146 of file defaults.c.

References g3d_cache_default, and Rast3d_fatal_error().

void Rast3d_set_compression_mode ( int  doCompress,
int  precision 
)

set compression mode

doCompress should be one of RASTER3D_NO_COMPRESSION and RASTER3D_COMPRESSION. precision should be either RASTER3D_MAX_PRECISION or a positive integer.

Note
Note that older parameters doLzw and doRle (RASTER3D_NO_RLE or RASTER3D_USE_RLE) are no longer in the API.

Calls Rast3d_fatal_error() if a wrong parameter value is provided.

Parameters
doCompressspecifies if a compression should be performed
precisiona precision of compression

Definition at line 96 of file defaults.c.

References g3d_do_compression, g3d_precision, Rast3d_fatal_error(), RASTER3D_COMPRESSION, and RASTER3D_NO_COMPRESSION.

Referenced by Rast3d_change_precision(), and Rast3d_open_new_param().

void Rast3d_set_error_fun ( void(*)(const char *)  fun)

set error function

Parameters
fun
Returns
void

Definition at line 288 of file defaults.c.

References g3d_error_fun.

void Rast3d_set_file_type ( int  type)

set G3d file type

Parameters
type
Returns
void

Definition at line 210 of file defaults.c.

References DCELL_TYPE, FCELL_TYPE, g3d_file_type, and Rast3d_fatal_error().

Referenced by Rast3d_change_precision(), Rast3d_change_type(), Rast3d_open_new_opt_tile_size(), Rast3d_open_new_param(), and Rast3d_retile().

void Rast3d_set_tile_dimension ( int  tileX,
int  tileY,
int  tileZ 
)

set Tile Dimension

Parameters
tileX
tileY
tileZ
Returns
void

Definition at line 244 of file defaults.c.

References g3d_tile_dimension, and Rast3d_fatal_error().

Referenced by Rast3d_change_precision(), Rast3d_change_type(), Rast3d_open_new_opt_tile_size(), Rast3d_open_new_param(), and Rast3d_retile().

Variable Documentation

void(* g3d_error_fun)(const char *) = NULL

Definition at line 72 of file defaults.c.

Referenced by Rast3d_init_defaults(), and Rast3d_set_error_fun().

int g3d_tile_dimension[3]
Initial value:
=
{ RASTER3D_NO_DEFAULT, RASTER3D_NO_DEFAULT, RASTER3D_NO_DEFAULT }
#define RASTER3D_NO_DEFAULT
Definition: defaults.c:8

Definition at line 70 of file defaults.c.

Referenced by Rast3d_get_tile_dimension(), Rast3d_init_defaults(), Rast3d_open_cell_new(), and Rast3d_set_tile_dimension().

char* g3d_unit_default = NULL

Definition at line 73 of file defaults.c.

Referenced by Rast3d_init_defaults(), and Rast3d_open_cell_new().

int g3d_version = RASTER3D_MAP_VERSION

Definition at line 64 of file defaults.c.

int g3d_vertical_unit_default = U_UNDEFINED

Definition at line 74 of file defaults.c.

Referenced by Rast3d_init_defaults(), and Rast3d_open_cell_new().