SAGA API  v9.6
grid.h File Reference
#include "table.h"
#include "grid_pyramid.h"

Go to the source code of this file.

Classes

class  CSG_Grid_System
 
class  CSG_Grid_File_Info
 
class  CSG_Grid
 
class  CSG_Grid_Stack
 
class  CSG_Grid_Cell_Addressor
 

Macros

#define GRID_FILE_KEY_TRUE   SG_T("TRUE")
 
#define GRID_FILE_KEY_FALSE   SG_T("FALSE")
 
#define SG_GRID_PTR_SAFE_SET_NODATA(g, x, y)   { if( g && g->is_InGrid(x, y, false) ) { g->Set_NoData(x, y ); } }
 
#define SG_GRID_PTR_SAFE_SET_VALUE(g, x, y, z)   { if( g && g->is_InGrid(x, y, false) ) { g->Set_Value (x, y, z); } }
 
#define SG_GRIDCELLADDR_PARM_SQUARE   0x01
 
#define SG_GRIDCELLADDR_PARM_CIRCLE   0x02
 
#define SG_GRIDCELLADDR_PARM_ANNULUS   0x04
 
#define SG_GRIDCELLADDR_PARM_SECTOR   0x08
 
#define SG_GRIDCELLADDR_PARM_SIZEDBL   0x10
 
#define SG_GRIDCELLADDR_PARM_MAPUNIT   0x20
 
#define SG_GRIDCELLADDR_PARM_WEIGHTING   0x40
 
#define SG_GRIDCELLADDR_PARM_DEFAULT   (SG_GRIDCELLADDR_PARM_SQUARE|SG_GRIDCELLADDR_PARM_CIRCLE)
 

Enumerations

enum  TSG_Grid_File_Format {
  GRID_FILE_FORMAT_Undefined = 0, GRID_FILE_FORMAT_Binary_old, GRID_FILE_FORMAT_Binary, GRID_FILE_FORMAT_ASCII,
  GRID_FILE_FORMAT_Compressed, GRID_FILE_FORMAT_GeoTIFF
}
 
enum  TSG_Grid_File_Key {
  GRID_FILE_KEY_NAME = 0, GRID_FILE_KEY_DESCRIPTION, GRID_FILE_KEY_UNITNAME, GRID_FILE_KEY_DATAFILE_NAME,
  GRID_FILE_KEY_DATAFILE_OFFSET, GRID_FILE_KEY_DATAFORMAT, GRID_FILE_KEY_BYTEORDER_BIG, GRID_FILE_KEY_POSITION_XMIN,
  GRID_FILE_KEY_POSITION_YMIN, GRID_FILE_KEY_CELLCOUNT_X, GRID_FILE_KEY_CELLCOUNT_Y, GRID_FILE_KEY_CELLSIZE,
  GRID_FILE_KEY_Z_FACTOR, GRID_FILE_KEY_Z_OFFSET, GRID_FILE_KEY_NODATA_VALUE, GRID_FILE_KEY_TOPTOBOTTOM,
  GRID_FILE_KEY_Count
}
 
enum  TSG_Grid_Resampling {
  GRID_RESAMPLING_NearestNeighbour = 0, GRID_RESAMPLING_Bilinear, GRID_RESAMPLING_BicubicSpline, GRID_RESAMPLING_BSpline,
  GRID_RESAMPLING_Mean_Nodes, GRID_RESAMPLING_Mean_Cells, GRID_RESAMPLING_Minimum, GRID_RESAMPLING_Maximum,
  GRID_RESAMPLING_Majority, GRID_RESAMPLING_Undefined
}
 
enum  TSG_Grid_Operation { GRID_OPERATION_Addition = 0, GRID_OPERATION_Subtraction, GRID_OPERATION_Multiplication, GRID_OPERATION_Division }
 

Functions

SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (void)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (const CSG_Grid &Grid)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (const char *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (const wchar_t *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (const CSG_String &File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (CSG_Grid *pGrid, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (const CSG_Grid_System &System, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
 
SAGA_API_DLL_EXPORT CSG_GridSG_Create_Grid (TSG_Data_Type Type, int NX, int NY, double Cellsize=0.0, double xMin=0.0, double yMin=0.0, bool bCached=false)
 
SAGA_API_DLL_EXPORT const SG_CharSG_Grid_Cache_Get_Directory (void)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Directory (const SG_Char *Directory)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Mode (int Mode)
 
SAGA_API_DLL_EXPORT int SG_Grid_Cache_Get_Mode (void)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold (int nBytes)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold_MB (double nMegabytes)
 
SAGA_API_DLL_EXPORT sLong SG_Grid_Cache_Get_Threshold (void)
 
SAGA_API_DLL_EXPORT double SG_Grid_Cache_Get_Threshold_MB (void)
 
SAGA_API_DLL_EXPORT bool SG_Grid_Set_File_Format_Default (int Format)
 
SAGA_API_DLL_EXPORT TSG_Grid_File_Format SG_Grid_Get_File_Format_Default (void)
 
SAGA_API_DLL_EXPORT CSG_String SG_Grid_Get_File_Extension_Default (void)
 

Variables

const SG_Char gSG_Grid_File_Key_Names [GRID_FILE_KEY_Count][32]
 

Detailed Description

Classes for raster data management.

See also
CSG_Data_Object
CSG_Grid_System
CSG_Grid

Definition in file grid.h.

Macro Definition Documentation

◆ GRID_FILE_KEY_FALSE

#define GRID_FILE_KEY_FALSE   SG_T("FALSE")

Definition at line 145 of file grid.h.

◆ GRID_FILE_KEY_TRUE

#define GRID_FILE_KEY_TRUE   SG_T("TRUE")

Definition at line 144 of file grid.h.

◆ SG_GRID_PTR_SAFE_SET_NODATA

#define SG_GRID_PTR_SAFE_SET_NODATA (   g,
  x,
 
)    { if( g && g->is_InGrid(x, y, false) ) { g->Set_NoData(x, y ); } }

Definition at line 988 of file grid.h.

◆ SG_GRID_PTR_SAFE_SET_VALUE

#define SG_GRID_PTR_SAFE_SET_VALUE (   g,
  x,
  y,
 
)    { if( g && g->is_InGrid(x, y, false) ) { g->Set_Value (x, y, z); } }

Definition at line 989 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_ANNULUS

#define SG_GRIDCELLADDR_PARM_ANNULUS   0x04

Definition at line 1094 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_CIRCLE

#define SG_GRIDCELLADDR_PARM_CIRCLE   0x02

Definition at line 1093 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_DEFAULT

#define SG_GRIDCELLADDR_PARM_DEFAULT   (SG_GRIDCELLADDR_PARM_SQUARE|SG_GRIDCELLADDR_PARM_CIRCLE)

Definition at line 1099 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_MAPUNIT

#define SG_GRIDCELLADDR_PARM_MAPUNIT   0x20

Definition at line 1097 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_SECTOR

#define SG_GRIDCELLADDR_PARM_SECTOR   0x08

Definition at line 1095 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_SIZEDBL

#define SG_GRIDCELLADDR_PARM_SIZEDBL   0x10

Definition at line 1096 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_SQUARE

#define SG_GRIDCELLADDR_PARM_SQUARE   0x01

Definition at line 1092 of file grid.h.

◆ SG_GRIDCELLADDR_PARM_WEIGHTING

#define SG_GRIDCELLADDR_PARM_WEIGHTING   0x40

Definition at line 1098 of file grid.h.

Enumeration Type Documentation

◆ TSG_Grid_File_Format

Enumerator
GRID_FILE_FORMAT_Undefined 
GRID_FILE_FORMAT_Binary_old 
GRID_FILE_FORMAT_Binary 
GRID_FILE_FORMAT_ASCII 
GRID_FILE_FORMAT_Compressed 
GRID_FILE_FORMAT_GeoTIFF 

Definition at line 88 of file grid.h.

◆ TSG_Grid_File_Key

Enumerator
GRID_FILE_KEY_NAME 
GRID_FILE_KEY_DESCRIPTION 
GRID_FILE_KEY_UNITNAME 
GRID_FILE_KEY_DATAFILE_NAME 
GRID_FILE_KEY_DATAFILE_OFFSET 
GRID_FILE_KEY_DATAFORMAT 
GRID_FILE_KEY_BYTEORDER_BIG 
GRID_FILE_KEY_POSITION_XMIN 
GRID_FILE_KEY_POSITION_YMIN 
GRID_FILE_KEY_CELLCOUNT_X 
GRID_FILE_KEY_CELLCOUNT_Y 
GRID_FILE_KEY_CELLSIZE 
GRID_FILE_KEY_Z_FACTOR 
GRID_FILE_KEY_Z_OFFSET 
GRID_FILE_KEY_NODATA_VALUE 
GRID_FILE_KEY_TOPTOBOTTOM 
GRID_FILE_KEY_Count 

Definition at line 100 of file grid.h.

◆ TSG_Grid_Operation

Enumerator
GRID_OPERATION_Addition 
GRID_OPERATION_Subtraction 
GRID_OPERATION_Multiplication 
GRID_OPERATION_Division 

Definition at line 173 of file grid.h.

◆ TSG_Grid_Resampling

Enumerator
GRID_RESAMPLING_NearestNeighbour 
GRID_RESAMPLING_Bilinear 
GRID_RESAMPLING_BicubicSpline 
GRID_RESAMPLING_BSpline 
GRID_RESAMPLING_Mean_Nodes 
GRID_RESAMPLING_Mean_Cells 
GRID_RESAMPLING_Minimum 
GRID_RESAMPLING_Maximum 
GRID_RESAMPLING_Majority 
GRID_RESAMPLING_Undefined 

Definition at line 155 of file grid.h.

Function Documentation

◆ SG_Create_Grid() [1/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( const char *  File,
TSG_Data_Type  Type = SG_DATATYPE_Undefined,
bool  bCached = false,
bool  bLoadData = true 
)

Safe grid construction

Definition at line 86 of file grid.cpp.

References SG_Create_Grid().

◆ SG_Create_Grid() [2/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( const CSG_Grid Grid)

Safe grid construction

Definition at line 78 of file grid.cpp.

References CSG_Grid::is_Valid().

◆ SG_Create_Grid() [3/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( const CSG_Grid_System System,
TSG_Data_Type  Type = SG_DATATYPE_Undefined,
bool  bCached = false 
)

Safe grid construction

Definition at line 104 of file grid.cpp.

References CSG_Grid::is_Valid().

◆ SG_Create_Grid() [4/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( const CSG_String File,
TSG_Data_Type  Type = SG_DATATYPE_Undefined,
bool  bCached = false,
bool  bLoadData = true 
)

Safe grid construction

Definition at line 88 of file grid.cpp.

References CSG_Grid::is_Valid().

◆ SG_Create_Grid() [5/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( const wchar_t *  File,
TSG_Data_Type  Type = SG_DATATYPE_Undefined,
bool  bCached = false,
bool  bLoadData = true 
)

Safe grid construction

Definition at line 87 of file grid.cpp.

References SG_Create_Grid().

◆ SG_Create_Grid() [6/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( CSG_Grid pGrid,
TSG_Data_Type  Type = SG_DATATYPE_Undefined,
bool  bCached = false 
)

Safe grid construction

Definition at line 96 of file grid.cpp.

References CSG_Grid::is_Valid().

◆ SG_Create_Grid() [7/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( TSG_Data_Type  Type,
int  NX,
int  NY,
double  Cellsize = 0.0,
double  xMin = 0.0,
double  yMin = 0.0,
bool  bCached = false 
)

Safe grid construction

Definition at line 112 of file grid.cpp.

References CSG_Grid::is_Valid().

◆ SG_Create_Grid() [8/8]

SAGA_API_DLL_EXPORT CSG_Grid* SG_Create_Grid ( void  )

◆ SG_Grid_Cache_Get_Directory()

SAGA_API_DLL_EXPORT const SG_Char* SG_Grid_Cache_Get_Directory ( void  )

Get default directory for grid caching

Definition at line 81 of file grid_memory.cpp.

References gSG_Grid_Cache_Directory.

◆ SG_Grid_Cache_Get_Mode()

SAGA_API_DLL_EXPORT int SG_Grid_Cache_Get_Mode ( void  )

Definition at line 110 of file grid_memory.cpp.

References gSG_Grid_Cache_Mode.

◆ SG_Grid_Cache_Get_Threshold()

SAGA_API_DLL_EXPORT sLong SG_Grid_Cache_Get_Threshold ( void  )

Definition at line 139 of file grid_memory.cpp.

References gSG_Grid_Cache_Threshold.

◆ SG_Grid_Cache_Get_Threshold_MB()

SAGA_API_DLL_EXPORT double SG_Grid_Cache_Get_Threshold_MB ( void  )

Definition at line 145 of file grid_memory.cpp.

References gSG_Grid_Cache_Threshold, and N_MEGABYTE_BYTES.

◆ SG_Grid_Cache_Set_Directory()

SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Directory ( const SG_Char Directory)

Set default directory for grid caching

Definition at line 87 of file grid_memory.cpp.

References gSG_Grid_Cache_Directory, and SG_Dir_Exists().

◆ SG_Grid_Cache_Set_Mode()

SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Mode ( int  Mode)

Definition at line 104 of file grid_memory.cpp.

References gSG_Grid_Cache_Mode.

◆ SG_Grid_Cache_Set_Threshold()

SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold ( int  nBytes)

Definition at line 124 of file grid_memory.cpp.

References gSG_Grid_Cache_Threshold.

Referenced by SG_Grid_Cache_Set_Threshold_MB().

◆ SG_Grid_Cache_Set_Threshold_MB()

SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold_MB ( double  nMegabytes)

Definition at line 133 of file grid_memory.cpp.

References N_MEGABYTE_BYTES, and SG_Grid_Cache_Set_Threshold().

◆ SG_Grid_Get_File_Extension_Default()

◆ SG_Grid_Get_File_Format_Default()

SAGA_API_DLL_EXPORT TSG_Grid_File_Format SG_Grid_Get_File_Format_Default ( void  )

Definition at line 123 of file grid_io.cpp.

References gSG_Grid_File_Format_Default.

◆ SG_Grid_Set_File_Format_Default()

Variable Documentation

◆ gSG_Grid_File_Key_Names

const SG_Char gSG_Grid_File_Key_Names[GRID_FILE_KEY_Count][32]
Initial value:
=
{
SG_T("NAME"),
SG_T("DESCRIPTION"),
SG_T("UNIT"),
SG_T("DATAFILE_NAME"),
SG_T("DATAFILE_OFFSET"),
SG_T("DATAFORMAT"),
SG_T("BYTEORDER_BIG"),
SG_T("POSITION_XMIN"),
SG_T("POSITION_YMIN"),
SG_T("CELLCOUNT_X"),
SG_T("CELLCOUNT_Y"),
SG_T("CELLSIZE"),
SG_T("Z_FACTOR"),
SG_T("Z_OFFSET"),
SG_T("NODATA_VALUE"),
}

Definition at line 123 of file grid.h.

SG_T
#define SG_T(s)
Definition: api_core.h:537