SAGA API  v9.5
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.0, double xMin=0.0, double yMin=0.0, bool bCached=false)
 
bool Create (TSG_Data_Type Type, int NX, int NY, double Cellsize=1.0, double xMin=0.0, double yMin=0.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.0, double Offset=0.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
 
void Assign_NoData (void)
 
virtual bool Assign (double Value=0.0)
 
virtual bool Assign (CSG_Data_Object *pObject)
 
virtual bool Assign (CSG_Grid *pGrid, TSG_Grid_Resampling Interpolation)
 
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, TSG_Grid_Resampling Interpolation) const
 
bool Get_Gradient (const TSG_Point &p, double &Slope, double &Aspect, TSG_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, TSG_Grid_Resampling Resampling=GRID_RESAMPLING_BSpline, bool bByteWise=false) const
 
double Get_Value (const TSG_Point &p, TSG_Grid_Resampling Resampling=GRID_RESAMPLING_BSpline, bool bByteWise=false) const
 
bool Get_Value (double x, double y, double &Value, TSG_Grid_Resampling Resampling=GRID_RESAMPLING_BSpline, bool bNoData=false, bool bByteWise=false) const
 
bool Get_Value (const TSG_Point &p, double &Value, TSG_Grid_Resampling Resampling=GRID_RESAMPLING_BSpline, 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). More...
 
int Get_Managed (void) const
 
bool Reload (void)
 If there is an associated file data can be reloaded with this command. More...
 
bool Delete (void)
 Deletes all files associated with this data object if possible. Works only with native SAGA files. Returns true on success. More...
 
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. More...
 
- 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 472 of file grid.h.

Constructor & Destructor Documentation

◆ CSG_Grid() [1/8]

CSG_Grid::CSG_Grid ( void  )

Default constructor.

Definition at line 131 of file grid.cpp.

References CSG_Table::_On_Construction().

◆ CSG_Grid() [2/8]

CSG_Grid::CSG_Grid ( const CSG_Grid Grid)

Copy constructor.

Definition at line 142 of file grid.cpp.

References CSG_Table::_On_Construction(), and Create().

◆ 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 155 of file grid.cpp.

References CSG_Table::_On_Construction(), and Create().

◆ 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 153 of file grid.cpp.

◆ 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 154 of file grid.cpp.

◆ 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 166 of file grid.cpp.

References CSG_Table::_On_Construction(), and Create().

◆ 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 177 of file grid.cpp.

References CSG_Table::_On_Construction(), and Create().

◆ CSG_Grid() [8/8]

CSG_Grid::CSG_Grid ( TSG_Data_Type  Type,
int  NX,
int  NY,
double  Cellsize = 1.0,
double  xMin = 0.0,
double  yMin = 0.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 191 of file grid.cpp.

References CSG_Table::_On_Construction(), and Create().

◆ ~CSG_Grid()

CSG_Grid::~CSG_Grid ( void  )
virtual

The destructor.

Definition at line 363 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 503 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

Referenced by CSG_Grids::Add().

◆ Add() [2/2]

CSG_Grid & CSG_Grid::Add ( double  Value)
virtual

Definition at line 508 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

◆ Add_Value() [1/2]

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

Definition at line 808 of file grid.h.

◆ Add_Value() [2/2]

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

Definition at line 809 of file grid.h.

◆ asByte() [1/2]

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

Definition at line 751 of file grid.h.

References SG_ROUND_TO_BYTE.

◆ asByte() [2/2]

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

Definition at line 752 of file grid.h.

References SG_ROUND_TO_BYTE.

◆ asChar() [1/2]

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

Definition at line 753 of file grid.h.

References SG_ROUND_TO_CHAR.

◆ asChar() [2/2]

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

Definition at line 754 of file grid.h.

References 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 761 of file grid.h.

◆ asFloat() [2/2]

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

Definition at line 762 of file grid.h.

◆ asInt() [1/2]

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

Definition at line 757 of file grid.h.

References SG_ROUND_TO_INT.

Referenced by CSG_Grid_Cell_Addressor::Enable_Parameters().

◆ asInt() [2/2]

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

Definition at line 758 of file grid.h.

References SG_ROUND_TO_INT.

◆ asLong() [1/2]

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

Definition at line 759 of file grid.h.

References SG_ROUND_TO_SLONG.

◆ asLong() [2/2]

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

Definition at line 760 of file grid.h.

References SG_ROUND_TO_SLONG.

◆ asShort() [1/2]

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

Definition at line 755 of file grid.h.

References SG_ROUND_TO_SHORT.

◆ asShort() [2/2]

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

Definition at line 756 of file grid.h.

References SG_ROUND_TO_SHORT.

◆ Assign() [1/3]

bool CSG_Grid::Assign ( CSG_Data_Object pObject)
virtual

◆ Assign() [2/3]

◆ Assign() [3/3]

◆ Assign_NoData()

void 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 309 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 310 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.0,
double  xMin = 0.0,
double  yMin = 0.0,
bool  bCached = false 
)

Definition at line 345 of file grid.cpp.

References Create(), and Destroy().

◆ DeNormalise()

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

Definition at line 825 of file grid_operation.cpp.

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

◆ DeStandardise()

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

Definition at line 874 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 371 of file grid.cpp.

References CSG_String::Clear(), CSG_Data_Object::Destroy(), CSG_Grid_System::Destroy(), and SG_DATATYPE_Undefined.

Referenced by Create(), CSG_Grids::Destroy(), and ~CSG_Grid().

◆ Divide() [1/2]

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

Definition at line 608 of file grid_operation.cpp.

References GRID_OPERATION_Division.

Referenced by CSG_Grids::Divide().

◆ Divide() [2/2]

CSG_Grid & CSG_Grid::Divide ( double  Value)
virtual

Definition at line 613 of file grid_operation.cpp.

References GRID_OPERATION_Division.

◆ Flip()

void CSG_Grid::Flip ( void  )

Definition at line 756 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 540 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 1034 of file grid.cpp.

References CSG_Simple_Statistics::Get_Count(), and 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 542 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 533 of file grid.h.

Referenced by Assign(), and is_Intersecting().

◆ Get_Gradient() [1/3]

bool CSG_Grid::Get_Gradient ( const TSG_Point p,
double &  Incline,
double &  Azimuth,
TSG_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 1056 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,
TSG_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 calulated in radians. Aspect is zero for the North direction and increases clockwise.

Definition at line 1007 of file grid_operation.cpp.

References Get_Cellsize(), Get_Value(), CSG_Grid_System::Get_xFrom(), CSG_Grid_System::Get_xTo(), CSG_Grid_System::Get_yFrom(), CSG_Grid_System::Get_yTo(), 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 958 of file grid_operation.cpp.

References asDouble(), Get_Cellsize(), CSG_Grid_System::Get_xFrom(), CSG_Grid_System::Get_xTo(), CSG_Grid_System::Get_yFrom(), CSG_Grid_System::Get_yTo(), 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 916 of file grid_operation.cpp.

References asDouble(), CSG_Grid_System::Get_Length(), CSG_Grid_System::Get_xTo(), CSG_Grid_System::Get_yTo(), and is_InGrid().

◆ Get_Histogram() [1/2]

◆ Get_Histogram() [2/2]

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

◆ Get_Max()

double CSG_Grid::Get_Max ( void  )

Definition at line 1013 of file grid.cpp.

References CSG_Simple_Statistics::Get_Maximum(), and CSG_Data_Object::Update().

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

◆ Get_Mean()

double CSG_Grid::Get_Mean ( void  )

Definition at line 1003 of file grid.cpp.

References CSG_Simple_Statistics::Get_Mean(), and CSG_Data_Object::Update().

Referenced by Standardise().

◆ Get_Memory_Size()

sLong CSG_Grid::Get_Memory_Size ( void  ) const
inline

Definition at line 601 of file grid.h.

◆ Get_Memory_Size_MB()

double CSG_Grid::Get_Memory_Size_MB ( void  ) const
inline

Definition at line 602 of file grid.h.

References N_MEGABYTE_BYTES.

◆ Get_Min()

double CSG_Grid::Get_Min ( void  )

◆ Get_NCells()

sLong CSG_Grid::Get_NCells ( void  ) const
inline

◆ Get_nLineBytes()

int CSG_Grid::Get_nLineBytes ( void  ) const
inline

Definition at line 522 of file grid.h.

Referenced by Assign().

◆ Get_NoData_Count()

sLong CSG_Grid::Get_NoData_Count ( void  )

◆ Get_nValueBytes()

int CSG_Grid::Get_nValueBytes ( void  ) const
inline

Definition at line 521 of file grid.h.

◆ 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 514 of file grid.h.

References SG_DATAOBJECT_TYPE_Grid.

Referenced by Assign().

◆ Get_Offset()

double CSG_Grid::Get_Offset ( void  ) const

◆ Get_Percentile()

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

Definition at line 1068 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 1018 of file grid.cpp.

References CSG_Simple_Statistics::Get_Range(), and CSG_Data_Object::Update().

Referenced by Invert(), and Normalise().

◆ Get_Row()

CSG_Vector CSG_Grid::Get_Row ( int  y) const

Definition at line 483 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 662 of file grid.h.

Referenced by Get_Quantile().

◆ 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 682 of file grid.h.

◆ Get_Sorted() [3/3]

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

Definition at line 677 of file grid.h.

◆ 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 1085 of file grid.cpp.

References CSG_Data_Object::Update().

Referenced by Get_Histogram().

◆ Get_StdDev()

double CSG_Grid::Get_StdDev ( void  )

Definition at line 1023 of file grid.cpp.

References CSG_Simple_Statistics::Get_StdDev(), and 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 525 of file grid.h.

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

◆ Get_Value() [1/4]

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

Definition at line 538 of file grid.cpp.

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

◆ Get_Value() [2/4]

double CSG_Grid::Get_Value ( const TSG_Point p,
TSG_Grid_Resampling  Resampling = GRID_RESAMPLING_BSpline,
bool  bByteWise = false 
) const

Definition at line 524 of file grid.cpp.

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

◆ Get_Value() [3/4]

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

◆ Get_Value() [4/4]

double CSG_Grid::Get_Value ( double  x,
double  y,
TSG_Grid_Resampling  Resampling = GRID_RESAMPLING_BSpline,
bool  bByteWise = false 
) const

Definition at line 531 of file grid.cpp.

References CSG_Data_Object::Get_NoData_Value().

Referenced by Get_Gradient(), and Get_Value().

◆ Get_Variance()

double CSG_Grid::Get_Variance ( void  )

Definition at line 1028 of file grid.cpp.

References CSG_Simple_Statistics::Get_Variance(), and CSG_Data_Object::Update().

◆ Get_XMax()

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

Definition at line 545 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 546 of file grid.h.

◆ Get_YMax()

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

Definition at line 549 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 548 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 550 of file grid.h.

◆ Invert()

void CSG_Grid::Invert ( void  )

◆ is_Cached()

bool CSG_Grid::is_Cached ( void  ) const
inline

Definition at line 605 of file grid.h.

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

◆ is_Compatible() [1/3]

bool CSG_Grid::is_Compatible ( const CSG_Grid_System System) const

Definition at line 465 of file grid.cpp.

◆ is_Compatible() [2/3]

bool CSG_Grid::is_Compatible ( CSG_Grid pGrid) const

Definition at line 460 of file grid.cpp.

References Get_System().

Referenced by 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 470 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 593 of file grid.h.

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 595 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 594 of file grid.h.

References CSG_Data_Object::Get_Extent().

◆ is_Intersecting() [1/3]

TSG_Intersection CSG_Grid::is_Intersecting ( const CSG_Rect Extent) const

Definition at line 444 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 449 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 454 of file grid.cpp.

References is_Intersecting().

◆ is_NoData() [1/2]

virtual bool CSG_Grid::is_NoData ( int  x,
int  y 
) const
inlinevirtual

◆ is_NoData() [2/2]

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

Definition at line 700 of file grid.h.

References CSG_Data_Object::is_NoData_Value().

◆ is_Scaled()

bool CSG_Grid::is_Scaled ( void  ) const
inline

Definition at line 559 of file grid.h.

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

◆ is_Valid()

◆ Mirror()

void CSG_Grid::Mirror ( void  )

Definition at line 774 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 811 of file grid.h.

◆ Mul_Value() [2/2]

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

Definition at line 812 of file grid.h.

◆ Multiply() [1/2]

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

Definition at line 573 of file grid_operation.cpp.

References GRID_OPERATION_Multiplication.

Referenced by CSG_Grids::Multiply().

◆ Multiply() [2/2]

CSG_Grid & CSG_Grid::Multiply ( double  Value)
virtual

Definition at line 578 of file grid_operation.cpp.

References 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 740 of file grid.h.

◆ operator*() [1/2]

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

Definition at line 549 of file grid_operation.cpp.

References GRID_OPERATION_Multiplication.

◆ operator*() [2/2]

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

Definition at line 556 of file grid_operation.cpp.

References GRID_OPERATION_Multiplication.

◆ operator*=() [1/2]

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

Definition at line 563 of file grid_operation.cpp.

References GRID_OPERATION_Multiplication.

◆ operator*=() [2/2]

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

Definition at line 568 of file grid_operation.cpp.

References GRID_OPERATION_Multiplication.

◆ operator+() [1/2]

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

Definition at line 479 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

◆ operator+() [2/2]

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

Definition at line 486 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

◆ operator+=() [1/2]

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

Definition at line 493 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

◆ operator+=() [2/2]

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

Definition at line 498 of file grid_operation.cpp.

References GRID_OPERATION_Addition.

◆ operator-() [1/2]

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

Definition at line 514 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.

◆ operator-() [2/2]

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

Definition at line 521 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.

◆ operator-=() [1/2]

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

Definition at line 528 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.

◆ operator-=() [2/2]

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

Definition at line 533 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.

◆ operator/() [1/2]

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

Definition at line 584 of file grid_operation.cpp.

References GRID_OPERATION_Division.

◆ operator/() [2/2]

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

Definition at line 591 of file grid_operation.cpp.

References GRID_OPERATION_Division.

◆ operator/=() [1/2]

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

Definition at line 598 of file grid_operation.cpp.

References GRID_OPERATION_Division.

◆ operator/=() [2/2]

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

Definition at line 603 of file grid_operation.cpp.

References GRID_OPERATION_Division.

◆ operator=() [1/2]

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

Definition at line 464 of file grid_operation.cpp.

References Assign(), and GRID_RESAMPLING_Undefined.

◆ operator=() [2/2]

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

Definition at line 471 of file grid_operation.cpp.

References Assign().

◆ Save() [1/3]

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

Implements CSG_Data_Object.

Definition at line 507 of file grid.h.

References Save().

Referenced by 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 508 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 650 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 636 of file grid.h.

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

Referenced by Create(), and Save().

◆ Set_NoData() [1/2]

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

Definition at line 702 of file grid.h.

References CSG_Data_Object::Get_NoData_Value().

Referenced by Assign().

◆ Set_NoData() [2/2]

virtual void CSG_Grid::Set_NoData ( sLong  i)
inlinevirtual

Definition at line 703 of file grid.h.

References CSG_Data_Object::Get_NoData_Value().

◆ Set_Row()

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

Definition at line 501 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.0,
double  Offset = 0.0 
)

Definition at line 398 of file grid.cpp.

References CSG_Data_Object::Set_Update_Flag().

Referenced by Create(), and CSG_Grids::Set_Scaling().

◆ Set_Unit()

void CSG_Grid::Set_Unit ( const CSG_String Unit)

Definition at line 392 of file grid.cpp.

Referenced by Assign(), Create(), and CSG_Grids::Set_Unit().

◆ 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 538 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.

Referenced by CSG_Grids::Subtract().

◆ Subtract() [2/2]

CSG_Grid & CSG_Grid::Subtract ( double  Value)
virtual

Definition at line 543 of file grid_operation.cpp.

References GRID_OPERATION_Subtraction.


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