GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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

◆ RASTER3D_CACHE_SIZE_DEFAULT

#define RASTER3D_CACHE_SIZE_DEFAULT   1000

Definition at line 12 of file defaults.c.

◆ RASTER3D_CACHE_SIZE_ENV_VAR

#define RASTER3D_CACHE_SIZE_ENV_VAR   "RASTER3D_DEFAULT_CACHE_SIZE"

Definition at line 47 of file defaults.c.

◆ RASTER3D_CACHE_SIZE_MAX_DEFAULT

#define RASTER3D_CACHE_SIZE_MAX_DEFAULT   16777216

Definition at line 13 of file defaults.c.

◆ RASTER3D_CACHE_SIZE_MAX_ENV_VAR

#define RASTER3D_CACHE_SIZE_MAX_ENV_VAR   "RASTER3D_MAX_CACHE_SIZE"

Definition at line 48 of file defaults.c.

◆ RASTER3D_COMPRESSION_DEFAULT

#define RASTER3D_COMPRESSION_DEFAULT   RASTER3D_COMPRESSION

Definition at line 10 of file defaults.c.

◆ RASTER3D_COMPRESSION_ENV_VAR_NO

#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.

◆ RASTER3D_COMPRESSION_ENV_VAR_YES

#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.

◆ RASTER3D_DEFAULT_WINDOW3D

#define RASTER3D_DEFAULT_WINDOW3D   "RASTER3D_DEFAULT_WINDOW3D"

Definition at line 60 of file defaults.c.

◆ RASTER3D_ERROR_FUN_DEFAULT

#define RASTER3D_ERROR_FUN_DEFAULT   Rast3d_skip_error

Definition at line 18 of file defaults.c.

◆ RASTER3D_FATAL_ERROR_ENV_VAR

#define RASTER3D_FATAL_ERROR_ENV_VAR   "RASTER3D_USE_FATAL_ERROR"

Definition at line 57 of file defaults.c.

◆ RASTER3D_FILE_DOUBLE_ENV_VAR

#define RASTER3D_FILE_DOUBLE_ENV_VAR   "RASTER3D_WRITE_DOUBLE"

Definition at line 51 of file defaults.c.

◆ RASTER3D_FILE_FLOAT_ENV_VAR

#define RASTER3D_FILE_FLOAT_ENV_VAR   "RASTER3D_WRITE_FLOAT"

Definition at line 50 of file defaults.c.

◆ RASTER3D_FILE_TYPE_DEFAULT

#define RASTER3D_FILE_TYPE_DEFAULT   DCELL_TYPE

Definition at line 14 of file defaults.c.

◆ RASTER3D_NO_DEFAULT

#define RASTER3D_NO_DEFAULT   -10

Definition at line 8 of file defaults.c.

◆ RASTER3D_PRECISION_DEFAULT

#define RASTER3D_PRECISION_DEFAULT   RASTER3D_MAX_PRECISION

Definition at line 11 of file defaults.c.

◆ RASTER3D_PRECISION_ENV_VAR

#define RASTER3D_PRECISION_ENV_VAR   "RASTER3D_PRECISION"

Definition at line 44 of file defaults.c.

◆ RASTER3D_PRECISION_ENV_VAR_MAX

#define RASTER3D_PRECISION_ENV_VAR_MAX   "RASTER3D_MAX_PRECISION"

Definition at line 45 of file defaults.c.

◆ RASTER3D_PRINT_ERROR_ENV_VAR

#define RASTER3D_PRINT_ERROR_ENV_VAR   "RASTER3D_USE_PRINT_ERROR"

Definition at line 58 of file defaults.c.

◆ RASTER3D_TILE_DIM_X_ENV_VAR

#define RASTER3D_TILE_DIM_X_ENV_VAR   "RASTER3D_TILE_DIMENSION_X"

Definition at line 53 of file defaults.c.

◆ RASTER3D_TILE_DIM_Y_ENV_VAR

#define RASTER3D_TILE_DIM_Y_ENV_VAR   "RASTER3D_TILE_DIMENSION_Y"

Definition at line 54 of file defaults.c.

◆ RASTER3D_TILE_DIM_Z_ENV_VAR

#define RASTER3D_TILE_DIM_Z_ENV_VAR   "RASTER3D_TILE_DIMENSION_Z"

Definition at line 55 of file defaults.c.

◆ RASTER3D_TILE_X_DEFAULT

#define RASTER3D_TILE_X_DEFAULT   16

Definition at line 15 of file defaults.c.

◆ RASTER3D_TILE_Y_DEFAULT

#define RASTER3D_TILE_Y_DEFAULT   16

Definition at line 16 of file defaults.c.

◆ RASTER3D_TILE_Z_DEFAULT

#define RASTER3D_TILE_Z_DEFAULT   8

Definition at line 17 of file defaults.c.

◆ RASTER3D_UNIT_DEFAULT

#define RASTER3D_UNIT_DEFAULT   "none"

Definition at line 19 of file defaults.c.

◆ RASTER3D_VERTICAL_UNIT_DEFAULT

#define RASTER3D_VERTICAL_UNIT_DEFAULT   U_UNKNOWN

Definition at line 20 of file defaults.c.

Function Documentation

◆ Rast3d_get_cache_limit()

int Rast3d_get_cache_limit ( void  )

Get cache limit.

Returns
int

Definition at line 195 of file defaults.c.

References g3d_cache_max.

◆ Rast3d_get_cache_size()

int Rast3d_get_cache_size ( void  )

get cache size

Returns
int

Definition at line 163 of file defaults.c.

References g3d_cache_default.

◆ Rast3d_get_compression_mode()

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.

◆ Rast3d_get_file_type()

int Rast3d_get_file_type ( void  )

get G3d file type

Returns
int

Definition at line 227 of file defaults.c.

References g3d_file_type.

◆ Rast3d_get_tile_dimension()

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.

◆ Rast3d_init_defaults()

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.

Referenced by GVL_libinit(), and Rast3d_open_cell_old_no_header().

◆ Rast3d_set_cache_limit()

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().

◆ Rast3d_set_cache_size()

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().

◆ Rast3d_set_compression_mode()

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.

◆ Rast3d_set_error_fun()

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.

◆ Rast3d_set_file_type()

void Rast3d_set_file_type ( int  type)

set G3d file type

Parameters
type
Returns
void

Definition at line 210 of file defaults.c.

◆ Rast3d_set_tile_dimension()

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().

Variable Documentation

◆ g3d_cache_default

int g3d_cache_default = RASTER3D_NO_DEFAULT

◆ g3d_cache_max

int g3d_cache_max = RASTER3D_NO_DEFAULT

Definition at line 68 of file defaults.c.

Referenced by Rast3d_get_cache_limit(), and Rast3d_set_cache_limit().

◆ g3d_do_compression

int g3d_do_compression = RASTER3D_NO_DEFAULT

Definition at line 65 of file defaults.c.

Referenced by Rast3d_get_compression_mode(), and Rast3d_set_compression_mode().

◆ g3d_error_fun

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

Definition at line 72 of file defaults.c.

Referenced by Rast3d_set_error_fun().

◆ g3d_file_type

int g3d_file_type = RASTER3D_NO_DEFAULT

Definition at line 69 of file defaults.c.

Referenced by Rast3d_get_file_type().

◆ g3d_precision

int g3d_precision = RASTER3D_NO_DEFAULT

Definition at line 66 of file defaults.c.

Referenced by Rast3d_get_compression_mode(), and Rast3d_set_compression_mode().

◆ g3d_tile_dimension

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(), and Rast3d_set_tile_dimension().

◆ g3d_unit_default

char* g3d_unit_default = NULL

Definition at line 73 of file defaults.c.

◆ g3d_version

int g3d_version = RASTER3D_MAP_VERSION

Definition at line 64 of file defaults.c.

◆ g3d_vertical_unit_default

int g3d_vertical_unit_default = U_UNDEFINED

Definition at line 74 of file defaults.c.