SAGA API v9.10
Loading...
Searching...
No Matches
CSG_Grid Class Reference

#include <grid.h>

Inheritance diagram for CSG_Grid:
CSG_Data_Object

Public Member Functions

 CSG_Grid (void)
 CSG_Grid (const CSG_Grid &Grid)
bool Create (const CSG_Grid &Grid)
 CSG_Grid (const CSG_String &File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
bool Create (const CSG_String &File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 CSG_Grid (const char *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
bool Create (const char *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 CSG_Grid (const wchar_t *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
bool Create (const wchar_t *File, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false, bool bLoadData=true)
 CSG_Grid (CSG_Grid *pGrid, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
bool Create (CSG_Grid *pGrid, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
 CSG_Grid (const CSG_Grid_System &System, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
bool Create (const CSG_Grid_System &System, TSG_Data_Type Type=SG_DATATYPE_Undefined, bool bCached=false)
 CSG_Grid (TSG_Data_Type Type, int NX, int NY, double Cellsize=1., double xMin=0., double yMin=0., bool bCached=false)
bool Create (TSG_Data_Type Type, int NX, int NY, double Cellsize=1., double xMin=0., double yMin=0., bool bCached=false)
virtual ~CSG_Grid (void)
virtual bool Destroy (void)
virtual bool Save (const char *File, int Format=0)
virtual bool Save (const wchar_t *File, int Format=0)
virtual bool Save (const CSG_String &File, int Format=0)
virtual TSG_Data_Object_Type Get_ObjectType (void) const
TSG_Data_Type Get_Type (void) const
int Get_nValueBytes (void) const
int Get_nLineBytes (void) const
void Set_Unit (const CSG_String &Unit)
const CSG_StringGet_Unit (void) const
const CSG_Grid_SystemGet_System (void) const
virtual const CSG_RectGet_Extent (void)
int Get_NX (void) const
int Get_NY (void) const
sLong Get_NCells (void) const
double Get_Cellsize (void) const
double Get_Cellarea (void) const
const CSG_RectGet_Extent (bool bCells=false) const
double Get_XMin (bool bCells=false) const
double Get_XMax (bool bCells=false) const
double Get_XRange (bool bCells=false) const
double Get_YMin (bool bCells=false) const
double Get_YMax (bool bCells=false) const
double Get_YRange (bool bCells=false) const
void Set_Scaling (double Scale=1., double Offset=0.)
double Get_Scaling (void) const
double Get_Offset (void) const
bool is_Scaled (void) const
double Get_Mean (void)
double Get_Min (void)
double Get_Max (void)
double Get_Range (void)
double Get_StdDev (void)
double Get_Variance (void)
double Get_Quantile (double Quantile, bool bFromHistogram=true)
double Get_Percentile (double Percentile, bool bFromHistogram=true)
const CSG_Simple_StatisticsGet_Statistics (void)
bool Get_Statistics (const CSG_Rect &rWorld, CSG_Simple_Statistics &Statistics, bool bHoldValues=false) const
const CSG_HistogramGet_Histogram (size_t nClasses=0)
bool Get_Histogram (const CSG_Rect &rWorld, CSG_Histogram &Histogram, size_t nClasses=0) const
sLong Get_Data_Count (void)
sLong Get_NoData_Count (void)
virtual bool is_Valid (void) const
TSG_Intersection is_Intersecting (const CSG_Rect &Extent) const
TSG_Intersection is_Intersecting (const TSG_Rect &Extent) const
TSG_Intersection is_Intersecting (double xMin, double yMin, double xMax, double yMax) const
bool is_Compatible (CSG_Grid *pGrid) const
bool is_Compatible (const CSG_Grid_System &System) const
bool is_Compatible (int NX, int NY, double Cellsize, double xMin, double yMin) const
bool is_InGrid (int x, int y, bool bCheckNoData=true) const
bool is_InGrid_byPos (double x, double y, bool bCheckNoData=true) const
bool is_InGrid_byPos (const TSG_Point &p, bool bCheckNoData=true) const
sLong Get_Memory_Size (void) const
double Get_Memory_Size_MB (void) const
bool Set_Cache (bool bOn)
bool is_Cached (void) const
bool Assign_NoData (void)
virtual bool Assign (double Value=0.)
virtual bool Assign (CSG_Data_Object *pObject, bool bProgress=false)
virtual bool Assign (CSG_Grid *pGrid, CSG_Grid_Resampling Method, bool bProgress=false)
void Flip (void)
void Mirror (void)
void Invert (void)
bool Normalise (void)
bool DeNormalise (double Minimum, double Maximum)
bool Standardise (void)
bool DeStandardise (double Mean, double StdDev)
int Get_Gradient_NeighborDir (int x, int y, bool bDown=true, bool bNoEdges=true) const
bool Get_Gradient (int x, int y, double &Slope, double &Aspect) const
bool Get_Gradient (double x, double y, double &Slope, double &Aspect, CSG_Grid_Resampling Interpolation) const
bool Get_Gradient (const TSG_Point &p, double &Slope, double &Aspect, CSG_Grid_Resampling Interpolation) const
virtual void Set_Modified (bool bModified=true)
bool Set_Index (bool bOn=true)
sLong Get_Sorted (sLong Position, bool bDown=true, bool bCheckNoData=true)
bool Get_Sorted (sLong Position, sLong &i, bool bDown=true, bool bCheckNoData=true)
bool Get_Sorted (sLong Position, int &x, int &y, bool bDown=true, bool bCheckNoData=true)
virtual bool is_NoData (int x, int y) const
virtual bool is_NoData (sLong i) const
virtual void Set_NoData (int x, int y)
virtual void Set_NoData (sLong i)
virtual CSG_Gridoperator= (const CSG_Grid &Grid)
virtual CSG_Gridoperator= (double Value)
virtual CSG_Grid operator+ (const CSG_Grid &Grid) const
virtual CSG_Grid operator+ (double Value) const
virtual CSG_Gridoperator+= (const CSG_Grid &Grid)
virtual CSG_Gridoperator+= (double Value)
virtual CSG_GridAdd (const CSG_Grid &Grid)
virtual CSG_GridAdd (double Value)
virtual CSG_Grid operator- (const CSG_Grid &Grid) const
virtual CSG_Grid operator- (double Value) const
virtual CSG_Gridoperator-= (const CSG_Grid &Grid)
virtual CSG_Gridoperator-= (double Value)
virtual CSG_GridSubtract (const CSG_Grid &Grid)
virtual CSG_GridSubtract (double Value)
virtual CSG_Grid operator* (const CSG_Grid &Grid) const
virtual CSG_Grid operator* (double Value) const
virtual CSG_Gridoperator*= (const CSG_Grid &Grid)
virtual CSG_Gridoperator*= (double Value)
virtual CSG_GridMultiply (const CSG_Grid &Grid)
virtual CSG_GridMultiply (double Value)
virtual CSG_Grid operator/ (const CSG_Grid &Grid) const
virtual CSG_Grid operator/ (double Value) const
virtual CSG_Gridoperator/= (const CSG_Grid &Grid)
virtual CSG_Gridoperator/= (double Value)
virtual CSG_GridDivide (const CSG_Grid &Grid)
virtual CSG_GridDivide (double Value)
virtual double operator() (int x, int y) const
double Get_Value (double x, double y, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bByteWise=false) const
double Get_Value (const TSG_Point &p, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bByteWise=false) const
bool Get_Value (double x, double y, double &Value, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bNoData=false, bool bByteWise=false) const
bool Get_Value (const TSG_Point &p, double &Value, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bNoData=false, bool bByteWise=false) const
virtual BYTE asByte (int x, int y, bool bScaled=true) const
virtual BYTE asByte (sLong i, bool bScaled=true) const
virtual char asChar (int x, int y, bool bScaled=true) const
virtual char asChar (sLong i, bool bScaled=true) const
virtual short asShort (int x, int y, bool bScaled=true) const
virtual short asShort (sLong i, bool bScaled=true) const
virtual int asInt (int x, int y, bool bScaled=true) const
virtual int asInt (sLong i, bool bScaled=true) const
virtual sLong asLong (int x, int y, bool bScaled=true) const
virtual sLong asLong (sLong i, bool bScaled=true) const
virtual float asFloat (int x, int y, bool bScaled=true) const
virtual float asFloat (sLong i, bool bScaled=true) const
virtual double asDouble (sLong i, bool bScaled=true) const
virtual double asDouble (int x, int y, bool bScaled=true) const
virtual void Add_Value (int x, int y, double Value)
virtual void Add_Value (sLong i, double Value)
virtual void Mul_Value (int x, int y, double Value)
virtual void Mul_Value (sLong i, double Value)
virtual void Set_Value (sLong i, double Value, bool bScaled=true)
virtual void Set_Value (int x, int y, double Value, bool bScaled=true)
CSG_Vector Get_Row (int y) const
bool Set_Row (int y, const CSG_Vector &Values)
Public Member Functions inherited from CSG_Data_Object
 CSG_Data_Object (void)
virtual ~CSG_Data_Object (void)
int Get_RefID (void) const
 Returns the object's reference id (unique).
int Get_Managed (void) const
bool Reload (void)
 If there is an associated file data can be reloaded with this command.
bool Delete (void)
 Deletes all files associated with this data object if possible. Works only with native SAGA files. Returns true on success.
void Set_File_Name (const CSG_String &FileName)
const SG_CharGet_File_Name (bool bNative=true) const
int Get_File_Type (void) const
bool is_File_Native (void) const
void Set_Name (const CSG_String &Name)
void Set_Name (const char *Name)
void Set_Name (const wchar_t *Name)
void Fmt_Name (const char *Format,...)
void Fmt_Name (const wchar_t *Format,...)
const SG_CharGet_Name (void) const
void Set_Description (const CSG_String &Description)
const SG_CharGet_Description (void) const
virtual bool is_Modified (void) const
bool Update (bool bForce=false)
CSG_Data_ObjectGet_Owner (void) const
void Set_Owner (CSG_Data_Object *pOwner)
CSG_MetaDataGet_MetaData (void) const
CSG_MetaDataGet_MetaData_DB (void) const
CSG_MetaDataGet_History (void)
const CSG_MetaDataGet_History (void) const
CSG_ProjectionGet_Projection (void)
const CSG_ProjectionGet_Projection (void) const
class CSG_TableasTable (bool bPolymorph=false) const
class CSG_ShapesasShapes (bool bPolymorph=false) const
class CSG_TINasTIN (bool bPolymorph=false) const
class CSG_PointCloudasPointCloud (bool bPolymorph=false) const
class CSG_GridasGrid (bool bPolymorph=false) const
class CSG_GridsasGrids (bool bPolymorph=false) const
virtual bool Set_NoData_Value (double Value)
virtual bool Set_NoData_Value_Range (double Lower, double Upper)
double Get_NoData_Value (bool bUpper=false) const
bool is_NoData_Value (double Value) const
bool Save_History_to_Model (const CSG_String &File) const
virtual bool Set_Max_Samples (sLong Max_Samples)
sLong Get_Max_Samples (void) const

Protected Member Functions

virtual bool On_Update (void)
virtual bool On_Reload (void)
virtual bool On_Delete (void)
Protected Member Functions inherited from CSG_Data_Object
void Set_File_Name (const CSG_String &FileName, bool bNative)
void Set_File_Type (int Type)
bool Load_MetaData (const CSG_String &FileName)
bool Load_MetaData (CSG_File &Stream)
bool Save_MetaData (const CSG_String &FileName)
bool Save_MetaData (CSG_File &Stream)
void Set_Update_Flag (bool bOn=true)
bool Get_Update_Flag (void)
virtual bool On_NoData_Changed (void)

Additional Inherited Members

Static Public Member Functions inherited from CSG_Data_Object
static void Track (bool Track=true, bool Offset=false)
 Activate/deactivate lifetime tracking (data object construction/destruction). Needs compiler flag WITH_LIFETIME_TRACKER being defined.
Protected Attributes inherited from CSG_Data_Object
CSG_Data_Objectm_pOwner

Detailed Description

CSG_Grid is the data object created for raster handling.

Definition at line 500 of file grid.h.

Constructor & Destructor Documentation

◆ CSG_Grid() [1/8]

◆ CSG_Grid() [2/8]

CSG_Grid::CSG_Grid ( const CSG_Grid & Grid)

Copy constructor.

Definition at line 147 of file grid.cpp.

References Create(), CSG_Data_Object::CSG_Data_Object(), and CSG_Grid().

◆ CSG_Grid() [3/8]

CSG_Grid::CSG_Grid ( const CSG_String & File,
TSG_Data_Type Type = SG_DATATYPE_Undefined,
bool bCached = false,
bool bLoadData = true )

Definition at line 160 of file grid.cpp.

References Create(), and CSG_Data_Object::CSG_Data_Object().

◆ CSG_Grid() [4/8]

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

Create a grid from file.

Definition at line 158 of file grid.cpp.

References CSG_Grid().

◆ CSG_Grid() [5/8]

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

Definition at line 159 of file grid.cpp.

References CSG_Grid().

◆ CSG_Grid() [6/8]

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

Create a grid similar to 'pGrid'.

Definition at line 171 of file grid.cpp.

References Create(), CSG_Data_Object::CSG_Data_Object(), and CSG_Grid().

◆ CSG_Grid() [7/8]

CSG_Grid::CSG_Grid ( const CSG_Grid_System & System,
TSG_Data_Type Type = SG_DATATYPE_Undefined,
bool bCached = false )

Create a grid using 'System'.

Definition at line 182 of file grid.cpp.

References Create(), and CSG_Data_Object::CSG_Data_Object().

◆ CSG_Grid() [8/8]

CSG_Grid::CSG_Grid ( TSG_Data_Type Type,
int NX,
int NY,
double Cellsize = 1.,
double xMin = 0.,
double yMin = 0.,
bool bCached = false )

Create a grid with specified parameters. This constructor initializes the grid's data space with 'NX' x 'NY' cells of the size indicated by 'Type'. If 'DX/DY' are equal or less zero then both will be set to 1.. 'xMin/yMin' specify the coordinates of the lower left corner of the grid.

Definition at line 196 of file grid.cpp.

References Create(), and CSG_Data_Object::CSG_Data_Object().

◆ ~CSG_Grid()

CSG_Grid::~CSG_Grid ( void )
virtual

The destructor.

Definition at line 371 of file grid.cpp.

References Destroy().

Member Function Documentation

◆ Add() [1/2]

CSG_Grid & CSG_Grid::Add ( const CSG_Grid & Grid)
virtual

Definition at line 464 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ Add() [2/2]

CSG_Grid & CSG_Grid::Add ( double Value)
virtual

Definition at line 469 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ Add_Value() [1/2]

virtual void CSG_Grid::Add_Value ( int x,
int y,
double Value )
inlinevirtual

Definition at line 836 of file grid.h.

References asDouble(), and Set_Value().

◆ Add_Value() [2/2]

virtual void CSG_Grid::Add_Value ( sLong i,
double Value )
inlinevirtual

Definition at line 837 of file grid.h.

References asDouble(), and Set_Value().

◆ asByte() [1/2]

virtual BYTE CSG_Grid::asByte ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 779 of file grid.h.

References asDouble(), and SG_ROUND_TO_BYTE.

◆ asByte() [2/2]

virtual BYTE CSG_Grid::asByte ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 780 of file grid.h.

References asDouble(), and SG_ROUND_TO_BYTE.

◆ asChar() [1/2]

virtual char CSG_Grid::asChar ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 781 of file grid.h.

References asDouble(), and SG_ROUND_TO_CHAR.

◆ asChar() [2/2]

virtual char CSG_Grid::asChar ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 782 of file grid.h.

References asDouble(), and SG_ROUND_TO_CHAR.

◆ asDouble() [1/2]

virtual double CSG_Grid::asDouble ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

◆ asDouble() [2/2]

◆ asFloat() [1/2]

virtual float CSG_Grid::asFloat ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 789 of file grid.h.

References asDouble().

◆ asFloat() [2/2]

virtual float CSG_Grid::asFloat ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 790 of file grid.h.

References asDouble().

◆ asInt() [1/2]

virtual int CSG_Grid::asInt ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 785 of file grid.h.

References asDouble(), and SG_ROUND_TO_INT.

◆ asInt() [2/2]

virtual int CSG_Grid::asInt ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 786 of file grid.h.

References asDouble(), and SG_ROUND_TO_INT.

◆ asLong() [1/2]

virtual sLong CSG_Grid::asLong ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 787 of file grid.h.

References asDouble(), and SG_ROUND_TO_SLONG.

◆ asLong() [2/2]

virtual sLong CSG_Grid::asLong ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 788 of file grid.h.

References asDouble(), and SG_ROUND_TO_SLONG.

◆ asShort() [1/2]

virtual short CSG_Grid::asShort ( int x,
int y,
bool bScaled = true ) const
inlinevirtual

Definition at line 783 of file grid.h.

References asDouble(), and SG_ROUND_TO_SHORT.

◆ asShort() [2/2]

virtual short CSG_Grid::asShort ( sLong i,
bool bScaled = true ) const
inlinevirtual

Definition at line 784 of file grid.h.

References asDouble(), and SG_ROUND_TO_SHORT.

◆ Assign() [1/3]

bool CSG_Grid::Assign ( CSG_Data_Object * pObject,
bool bProgress = false )
virtual

Reimplemented from CSG_Data_Object.

Definition at line 121 of file grid_operation.cpp.

References CSG_Data_Object::asGrid(), Assign(), CSG_Data_Object::CSG_Data_Object(), and Undefined.

◆ Assign() [2/3]

◆ Assign() [3/3]

◆ Assign_NoData()

bool CSG_Grid::Assign_NoData ( void )

◆ Create() [1/7]

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

Definition at line 317 of file grid.cpp.

References Create().

◆ Create() [2/7]

◆ Create() [3/7]

◆ Create() [4/7]

◆ Create() [5/7]

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

Definition at line 318 of file grid.cpp.

References Create().

◆ Create() [6/7]

◆ Create() [7/7]

bool CSG_Grid::Create ( TSG_Data_Type Type,
int NX,
int NY,
double Cellsize = 1.,
double xMin = 0.,
double yMin = 0.,
bool bCached = false )

Definition at line 353 of file grid.cpp.

References Create(), and Destroy().

◆ DeNormalise()

bool CSG_Grid::DeNormalise ( double Minimum,
double Maximum )

Definition at line 786 of file grid_operation.cpp.

References asDouble(), Get_NX(), Get_NY(), is_NoData(), is_Valid(), Maximum, Minimum, and Set_Value().

◆ DeStandardise()

bool CSG_Grid::DeStandardise ( double Mean,
double StdDev )

Definition at line 835 of file grid_operation.cpp.

References asDouble(), Get_NX(), Get_NY(), is_NoData(), is_Valid(), and Set_Value().

◆ Destroy()

bool CSG_Grid::Destroy ( void )
virtual

Destroys the data space of CSG_Grid.

Reimplemented from CSG_Data_Object.

Definition at line 379 of file grid.cpp.

References CSG_Data_Object::Destroy(), and SG_DATATYPE_Undefined.

Referenced by Create(), Create(), Create(), and ~CSG_Grid().

◆ Divide() [1/2]

CSG_Grid & CSG_Grid::Divide ( const CSG_Grid & Grid)
virtual

Definition at line 569 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ Divide() [2/2]

CSG_Grid & CSG_Grid::Divide ( double Value)
virtual

Definition at line 574 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ Flip()

void CSG_Grid::Flip ( void )

Definition at line 717 of file grid_operation.cpp.

References asDouble(), Get_NX(), Get_NY(), is_Valid(), and Set_Value().

◆ Get_Cellarea()

double CSG_Grid::Get_Cellarea ( void ) const
inline

Definition at line 568 of file grid.h.

◆ Get_Cellsize()

double CSG_Grid::Get_Cellsize ( void ) const
inline

◆ Get_Data_Count()

sLong CSG_Grid::Get_Data_Count ( void )

Definition at line 1048 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Get_Quantile().

◆ Get_Extent() [1/2]

const CSG_Rect & CSG_Grid::Get_Extent ( bool bCells = false) const
inline

Definition at line 570 of file grid.h.

◆ Get_Extent() [2/2]

virtual const CSG_Rect & CSG_Grid::Get_Extent ( void )
inlinevirtual

Implements CSG_Data_Object.

Definition at line 561 of file grid.h.

Referenced by Assign(), is_InGrid_byPos(), is_Intersecting(), and is_Intersecting().

◆ Get_Gradient() [1/3]

bool CSG_Grid::Get_Gradient ( const TSG_Point & p,
double & Incline,
double & Azimuth,
CSG_Grid_Resampling Interpolation ) const

Calculates the gradient for the given world coordinate. Calculation uses the formulas proposed by Zevenbergen & Thorne (1986). Slope and aspect values are calculated in radians. Aspect is zero for the North direction and increases clockwise.

Definition at line 1017 of file grid_operation.cpp.

References Get_Gradient(), SSG_Point::x, and SSG_Point::y.

◆ Get_Gradient() [2/3]

bool CSG_Grid::Get_Gradient ( double x,
double y,
double & Slope,
double & Aspect,
CSG_Grid_Resampling Interpolation ) const

Calculates the gradient for the given world coordinate. Calculation uses the formulas proposed by Zevenbergen & Thorne (1986). Slope and aspect values are calculated in radians. Aspect is zero for the North direction and increases clockwise.

Definition at line 968 of file grid_operation.cpp.

References Get_Cellsize(), Get_Value(), M_PI_090, M_PI_180, and M_PI_270.

◆ Get_Gradient() [3/3]

bool CSG_Grid::Get_Gradient ( int x,
int y,
double & Slope,
double & Aspect ) const

Calculates the gradient of a cell interpreting all grid cell values as elevation surface. Calculation uses the formulas proposed by Zevenbergen & Thorne (1986). Slope and aspect values are calculated in radians. Aspect is zero for the North direction and increases clockwise.

Definition at line 919 of file grid_operation.cpp.

References asDouble(), Get_Cellsize(), is_InGrid(), M_PI_090, M_PI_180, and M_PI_270.

Referenced by Get_Gradient().

◆ Get_Gradient_NeighborDir()

int CSG_Grid::Get_Gradient_NeighborDir ( int x,
int y,
bool bDown = true,
bool bNoEdges = true ) const

Returns the direction to which the downward gradient is steepest. This implements the Deterministic 8 (D8) algorithm for identifying a single flow direction based on elevation data. Direction is numbered clock-wise beginning with 0 for the North. If no direction can be identified result will be a -1. If 'bDown' is not true the cell that the direction is pointing to might have a higher value than the center cell. If 'bNoEdges' is true a -1 will be returned for all cells that are at the edge of the data area.

Definition at line 877 of file grid_operation.cpp.

References asDouble(), and is_InGrid().

◆ Get_Histogram() [1/2]

◆ Get_Histogram() [2/2]

const CSG_Histogram & CSG_Grid::Get_Histogram ( size_t nClasses = 0)

Returns the histogram for the whole data set. It is automatically updated if necessary.

Definition at line 1175 of file grid.cpp.

References CSG_Data_Object::Get_Max_Samples(), SG_GRID_HISTOGRAM_CLASSES_DEFAULT, and CSG_Data_Object::Update().

Referenced by Get_Quantile().

◆ Get_Max()

double CSG_Grid::Get_Max ( void )

Definition at line 1027 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Get_Quantile(), and Invert().

◆ Get_Mean()

double CSG_Grid::Get_Mean ( void )

Definition at line 1017 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Standardise().

◆ Get_Memory_Size()

sLong CSG_Grid::Get_Memory_Size ( void ) const
inline

Definition at line 629 of file grid.h.

References Get_NCells(), and Get_nValueBytes().

Referenced by Get_Memory_Size_MB().

◆ Get_Memory_Size_MB()

double CSG_Grid::Get_Memory_Size_MB ( void ) const
inline

Definition at line 630 of file grid.h.

References Get_Memory_Size(), and N_MEGABYTE_BYTES.

◆ Get_Min()

double CSG_Grid::Get_Min ( void )

Definition at line 1022 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Get_Quantile(), Invert(), and Normalise().

◆ Get_NCells()

sLong CSG_Grid::Get_NCells ( void ) const
inline

◆ Get_nLineBytes()

int CSG_Grid::Get_nLineBytes ( void ) const
inline

Definition at line 550 of file grid.h.

Referenced by Assign().

◆ Get_NoData_Count()

sLong CSG_Grid::Get_NoData_Count ( void )

Definition at line 1053 of file grid.cpp.

References Get_NCells(), and CSG_Data_Object::Update().

◆ Get_nValueBytes()

int CSG_Grid::Get_nValueBytes ( void ) const
inline

Definition at line 549 of file grid.h.

Referenced by Get_Memory_Size().

◆ Get_NX()

◆ Get_NY()

◆ Get_ObjectType()

virtual TSG_Data_Object_Type CSG_Grid::Get_ObjectType ( void ) const
inlinevirtual

Data object type information.

Implements CSG_Data_Object.

Definition at line 542 of file grid.h.

References SG_DATAOBJECT_TYPE_Grid.

◆ Get_Offset()

double CSG_Grid::Get_Offset ( void ) const

◆ Get_Percentile()

double CSG_Grid::Get_Percentile ( double Percentile,
bool bFromHistogram = true )

Definition at line 1082 of file grid.cpp.

References Get_Quantile().

◆ Get_Quantile()

double CSG_Grid::Get_Quantile ( double Quantile,
bool bFromHistogram = true )

◆ Get_Range()

double CSG_Grid::Get_Range ( void )

Definition at line 1032 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Invert(), and Normalise().

◆ Get_Row()

CSG_Vector CSG_Grid::Get_Row ( int y) const

Definition at line 491 of file grid.cpp.

References asDouble(), CSG_Vector::Create(), Get_NX(), and Get_NY().

◆ Get_Scaling()

double CSG_Grid::Get_Scaling ( void ) const

◆ Get_Sorted() [1/3]

sLong CSG_Grid::Get_Sorted ( sLong Position,
bool bDown = true,
bool bCheckNoData = true )
inline

Definition at line 690 of file grid.h.

References Get_NCells(), and is_NoData().

Referenced by Get_Quantile(), Get_Sorted(), and Get_Sorted().

◆ Get_Sorted() [2/3]

bool CSG_Grid::Get_Sorted ( sLong Position,
int & x,
int & y,
bool bDown = true,
bool bCheckNoData = true )
inline

Definition at line 710 of file grid.h.

References Get_NX(), and Get_Sorted().

◆ Get_Sorted() [3/3]

bool CSG_Grid::Get_Sorted ( sLong Position,
sLong & i,
bool bDown = true,
bool bCheckNoData = true )
inline

Definition at line 705 of file grid.h.

References Get_Sorted().

◆ Get_Statistics() [1/2]

bool CSG_Grid::Get_Statistics ( const CSG_Rect & rWorld,
CSG_Simple_Statistics & Statistics,
bool bHoldValues = false ) const

◆ Get_Statistics() [2/2]

const CSG_Simple_Statistics & CSG_Grid::Get_Statistics ( void )

Returns the statistics for the whole data set. It is automatically updated if necessary. Statistics give no access to parameters like quantiles that need values to be kept internally. Use Get_Quantile() function instead.

Definition at line 1099 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Get_Histogram().

◆ Get_StdDev()

double CSG_Grid::Get_StdDev ( void )

Definition at line 1037 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Standardise().

◆ Get_System()

◆ Get_Type()

◆ Get_Unit()

const CSG_String & CSG_Grid::Get_Unit ( void ) const
inline

Definition at line 553 of file grid.h.

Referenced by Assign(), Create(), and CSG_Grid_File_Info::Create().

◆ Get_Value() [1/4]

double CSG_Grid::Get_Value ( const TSG_Point & p,
CSG_Grid_Resampling Resampling = CSG_Grid_Resampling::Bicubic_2,
bool bByteWise = false ) const

Definition at line 532 of file grid.cpp.

References CSG_Data_Object::Get_NoData_Value(), Get_Value(), SSG_Point::x, and SSG_Point::y.

◆ Get_Value() [2/4]

bool CSG_Grid::Get_Value ( const TSG_Point & p,
double & Value,
CSG_Grid_Resampling Resampling = CSG_Grid_Resampling::Bicubic_2,
bool bNoData = false,
bool bByteWise = false ) const

Definition at line 546 of file grid.cpp.

References Get_Value(), SSG_Point::x, and SSG_Point::y.

◆ Get_Value() [3/4]

double CSG_Grid::Get_Value ( double x,
double y,
CSG_Grid_Resampling Resampling = CSG_Grid_Resampling::Bicubic_2,
bool bByteWise = false ) const

Definition at line 539 of file grid.cpp.

References CSG_Data_Object::Get_NoData_Value(), and Get_Value().

Referenced by Get_Gradient(), Get_Value(), Get_Value(), and Get_Value().

◆ Get_Value() [4/4]

bool CSG_Grid::Get_Value ( double x,
double y,
double & Value,
CSG_Grid_Resampling Resampling = CSG_Grid_Resampling::Bicubic_2,
bool bNoData = false,
bool bByteWise = false ) const

◆ Get_Variance()

double CSG_Grid::Get_Variance ( void )

Definition at line 1042 of file grid.cpp.

References CSG_Data_Object::Update().

◆ Get_XMax()

double CSG_Grid::Get_XMax ( bool bCells = false) const
inline

Definition at line 573 of file grid.h.

◆ Get_XMin()

double CSG_Grid::Get_XMin ( bool bCells = false) const
inline

◆ Get_XRange()

double CSG_Grid::Get_XRange ( bool bCells = false) const
inline

Definition at line 574 of file grid.h.

◆ Get_YMax()

double CSG_Grid::Get_YMax ( bool bCells = false) const
inline

Definition at line 577 of file grid.h.

Referenced by CSG_Grid_OGIS_Converter::to_WKBinary().

◆ Get_YMin()

double CSG_Grid::Get_YMin ( bool bCells = false) const
inline

Definition at line 576 of file grid.h.

Referenced by Assign(), CSG_Data_Manager::Get_Summary(), and Get_Value().

◆ Get_YRange()

double CSG_Grid::Get_YRange ( bool bCells = false) const
inline

Definition at line 578 of file grid.h.

◆ Invert()

void CSG_Grid::Invert ( void )

◆ is_Cached()

bool CSG_Grid::is_Cached ( void ) const
inline

Definition at line 633 of file grid.h.

Referenced by asDouble(), Assign(), is_Valid(), Set_Cache(), and Set_Value().

◆ is_Compatible() [1/3]

bool CSG_Grid::is_Compatible ( const CSG_Grid_System & System) const

Definition at line 473 of file grid.cpp.

◆ is_Compatible() [2/3]

bool CSG_Grid::is_Compatible ( CSG_Grid * pGrid) const

Definition at line 468 of file grid.cpp.

References CSG_Grid(), Get_System(), and is_Compatible().

Referenced by is_Compatible(), and is_Compatible().

◆ is_Compatible() [3/3]

bool CSG_Grid::is_Compatible ( int NX,
int NY,
double Cellsize,
double xMin,
double yMin ) const

Definition at line 478 of file grid.cpp.

References is_Compatible().

◆ is_InGrid()

bool CSG_Grid::is_InGrid ( int x,
int y,
bool bCheckNoData = true ) const
inline

Definition at line 621 of file grid.h.

References is_NoData().

Referenced by Get_Gradient(), Get_Gradient_NeighborDir(), and Get_Value().

◆ is_InGrid_byPos() [1/2]

bool CSG_Grid::is_InGrid_byPos ( const TSG_Point & p,
bool bCheckNoData = true ) const
inline

Definition at line 623 of file grid.h.

References is_InGrid_byPos(), SSG_Point::x, and SSG_Point::y.

Referenced by is_InGrid_byPos().

◆ is_InGrid_byPos() [2/2]

bool CSG_Grid::is_InGrid_byPos ( double x,
double y,
bool bCheckNoData = true ) const
inline

Definition at line 622 of file grid.h.

References Get_Extent(), and is_NoData().

◆ is_Intersecting() [1/3]

TSG_Intersection CSG_Grid::is_Intersecting ( const CSG_Rect & Extent) const

Definition at line 452 of file grid.cpp.

References Get_Extent().

Referenced by Assign(), and is_Intersecting().

◆ is_Intersecting() [2/3]

TSG_Intersection CSG_Grid::is_Intersecting ( const TSG_Rect & Extent) const

Definition at line 457 of file grid.cpp.

References Get_Extent().

◆ is_Intersecting() [3/3]

TSG_Intersection CSG_Grid::is_Intersecting ( double xMin,
double yMin,
double xMax,
double yMax ) const

Definition at line 462 of file grid.cpp.

References is_Intersecting().

◆ is_NoData() [1/2]

◆ is_NoData() [2/2]

virtual bool CSG_Grid::is_NoData ( sLong i) const
inlinevirtual

Definition at line 728 of file grid.h.

References asDouble(), and CSG_Data_Object::is_NoData_Value().

◆ is_Scaled()

bool CSG_Grid::is_Scaled ( void ) const
inline

Definition at line 587 of file grid.h.

Referenced by asDouble(), Get_Histogram(), Get_Statistics(), On_Update(), and Set_Value().

◆ is_Valid()

◆ Mirror()

void CSG_Grid::Mirror ( void )

Definition at line 735 of file grid_operation.cpp.

References asDouble(), Get_NX(), Get_NY(), is_Valid(), and Set_Value().

◆ Mul_Value() [1/2]

virtual void CSG_Grid::Mul_Value ( int x,
int y,
double Value )
inlinevirtual

Definition at line 839 of file grid.h.

References asDouble(), and Set_Value().

◆ Mul_Value() [2/2]

virtual void CSG_Grid::Mul_Value ( sLong i,
double Value )
inlinevirtual

Definition at line 840 of file grid.h.

References asDouble(), and Set_Value().

◆ Multiply() [1/2]

CSG_Grid & CSG_Grid::Multiply ( const CSG_Grid & Grid)
virtual

Definition at line 534 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ Multiply() [2/2]

CSG_Grid & CSG_Grid::Multiply ( double Value)
virtual

Definition at line 539 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ Normalise()

bool CSG_Grid::Normalise ( void )

◆ On_Delete()

bool CSG_Grid::On_Delete ( void )
protectedvirtual

◆ On_Reload()

bool CSG_Grid::On_Reload ( void )
protectedvirtual

Implements CSG_Data_Object.

Definition at line 74 of file grid_io.cpp.

References Create(), and CSG_Data_Object::Get_File_Name().

◆ On_Update()

◆ operator()()

virtual double CSG_Grid::operator() ( int x,
int y ) const
inlinevirtual

Definition at line 768 of file grid.h.

References asDouble().

◆ operator*() [1/2]

CSG_Grid CSG_Grid::operator* ( const CSG_Grid & Grid) const
virtual

Definition at line 510 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ operator*() [2/2]

CSG_Grid CSG_Grid::operator* ( double Value) const
virtual

Definition at line 517 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ operator*=() [1/2]

CSG_Grid & CSG_Grid::operator*= ( const CSG_Grid & Grid)
virtual

Definition at line 524 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ operator*=() [2/2]

CSG_Grid & CSG_Grid::operator*= ( double Value)
virtual

Definition at line 529 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Multiplication.

◆ operator+() [1/2]

CSG_Grid CSG_Grid::operator+ ( const CSG_Grid & Grid) const
virtual

Definition at line 440 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ operator+() [2/2]

CSG_Grid CSG_Grid::operator+ ( double Value) const
virtual

Definition at line 447 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ operator+=() [1/2]

CSG_Grid & CSG_Grid::operator+= ( const CSG_Grid & Grid)
virtual

Definition at line 454 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ operator+=() [2/2]

CSG_Grid & CSG_Grid::operator+= ( double Value)
virtual

Definition at line 459 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Addition.

◆ operator-() [1/2]

CSG_Grid CSG_Grid::operator- ( const CSG_Grid & Grid) const
virtual

Definition at line 475 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.

◆ operator-() [2/2]

CSG_Grid CSG_Grid::operator- ( double Value) const
virtual

Definition at line 482 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.

◆ operator-=() [1/2]

CSG_Grid & CSG_Grid::operator-= ( const CSG_Grid & Grid)
virtual

Definition at line 489 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.

◆ operator-=() [2/2]

CSG_Grid & CSG_Grid::operator-= ( double Value)
virtual

Definition at line 494 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.

◆ operator/() [1/2]

CSG_Grid CSG_Grid::operator/ ( const CSG_Grid & Grid) const
virtual

Definition at line 545 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ operator/() [2/2]

CSG_Grid CSG_Grid::operator/ ( double Value) const
virtual

Definition at line 552 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ operator/=() [1/2]

CSG_Grid & CSG_Grid::operator/= ( const CSG_Grid & Grid)
virtual

Definition at line 559 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ operator/=() [2/2]

CSG_Grid & CSG_Grid::operator/= ( double Value)
virtual

Definition at line 564 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Division.

◆ operator=() [1/2]

CSG_Grid & CSG_Grid::operator= ( const CSG_Grid & Grid)
virtual

Definition at line 425 of file grid_operation.cpp.

References CSG_Data_Object::asGrid(), Assign(), CSG_Grid(), and Undefined.

◆ operator=() [2/2]

CSG_Grid & CSG_Grid::operator= ( double Value)
virtual

Definition at line 432 of file grid_operation.cpp.

References Assign(), and CSG_Grid().

◆ Save() [1/3]

virtual bool CSG_Grid::Save ( const char * File,
int Format = 0 )
inlinevirtual

Implements CSG_Data_Object.

Definition at line 535 of file grid.h.

References Save().

Referenced by Save(), and Save().

◆ Save() [2/3]

◆ Save() [3/3]

virtual bool CSG_Grid::Save ( const wchar_t * File,
int Format = 0 )
inlinevirtual

Implements CSG_Data_Object.

Definition at line 536 of file grid.h.

References Save().

Referenced by Save().

◆ Set_Cache()

bool CSG_Grid::Set_Cache ( bool bOn)

◆ Set_Index()

bool CSG_Grid::Set_Index ( bool bOn = true)
inline

Definition at line 678 of file grid.h.

References SG_FREE_SAFE.

◆ Set_Modified()

virtual void CSG_Grid::Set_Modified ( bool bModified = true)
inlinevirtual

Reimplemented from CSG_Data_Object.

Definition at line 664 of file grid.h.

References CSG_Data_Object::Set_Modified(), and CSG_Data_Object::Set_Update_Flag().

Referenced by Create(), Save(), and Set_Value().

◆ Set_NoData() [1/2]

virtual void CSG_Grid::Set_NoData ( int x,
int y )
inlinevirtual

Definition at line 730 of file grid.h.

References CSG_Data_Object::Get_NoData_Value(), and Set_Value().

Referenced by Assign().

◆ Set_NoData() [2/2]

virtual void CSG_Grid::Set_NoData ( sLong i)
inlinevirtual

Definition at line 731 of file grid.h.

References CSG_Data_Object::Get_NoData_Value(), and Set_Value().

◆ Set_Row()

bool CSG_Grid::Set_Row ( int y,
const CSG_Vector & Values )

Definition at line 509 of file grid.cpp.

References CSG_Vector::Get_N(), Get_NX(), Get_NY(), and Set_Value().

◆ Set_Scaling()

void CSG_Grid::Set_Scaling ( double Scale = 1.,
double Offset = 0. )

Definition at line 406 of file grid.cpp.

References CSG_Data_Object::Set_Update_Flag().

Referenced by Create().

◆ Set_Unit()

void CSG_Grid::Set_Unit ( const CSG_String & Unit)

Definition at line 400 of file grid.cpp.

Referenced by Assign(), and Create().

◆ Set_Value() [1/2]

◆ Set_Value() [2/2]

virtual void CSG_Grid::Set_Value ( sLong i,
double Value,
bool bScaled = true )
inlinevirtual

◆ Standardise()

bool CSG_Grid::Standardise ( void )

◆ Subtract() [1/2]

CSG_Grid & CSG_Grid::Subtract ( const CSG_Grid & Grid)
virtual

Definition at line 499 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.

◆ Subtract() [2/2]

CSG_Grid & CSG_Grid::Subtract ( double Value)
virtual

Definition at line 504 of file grid_operation.cpp.

References CSG_Grid(), and GRID_OPERATION_Subtraction.


The documentation for this class was generated from the following files: