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

#include <grid.h>

Public Member Functions

 CSG_Grid_System (void)
 CSG_Grid_System (const CSG_Grid_System &System, int Precision=-1)
bool Create (const CSG_Grid_System &System, int Precision=-1)
 CSG_Grid_System (double Cellsize, const CSG_Rect &Extent, int Precision=-1)
bool Create (double Cellsize, const CSG_Rect &Extent, int Precision=-1)
 CSG_Grid_System (double Cellsize, double xMin, double yMin, double xMax, double yMax, int Precision=-1)
bool Create (double Cellsize, double xMin, double yMin, double xMax, double yMax, int Precision=-1)
 CSG_Grid_System (double Cellsize, double xMin, double yMin, int NX, int NY, int Precision=-1)
bool Create (double Cellsize, double xMin, double yMin, int NX, int NY, int Precision=-1)
 CSG_Grid_System (const CSG_String &System, int Precision=-1)
bool Create (const CSG_String &System, int Precision=-1)
 ~CSG_Grid_System (void)
bool Destroy (void)
bool Assign (const CSG_Grid_System &System)
bool Assign (double Cellsize, const CSG_Rect &Extent)
bool Assign (double Cellsize, double xMin, double yMin, double xMax, double yMax)
bool Assign (double Cellsize, double xMin, double yMin, int NX, int NY)
bool is_Valid (void) const
const SG_CharGet_Name (bool bShort=true)
const SG_CharasString (void)
double Get_Cellsize (void) const
double Get_Cellarea (void) const
int Get_NX (void) const
int Get_NY (void) const
sLong Get_NCells (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
CSG_Grid_Systemoperator= (const CSG_Grid_System &System)
bool operator== (const CSG_Grid_System *pSystem) const
bool operator!= (const CSG_Grid_System *pSystem) const
bool operator== (const CSG_Grid_System &System) const
bool operator!= (const CSG_Grid_System &System) const
bool is_Equal (const CSG_Grid_System &System) const
bool is_Equal (double Cellsize, const TSG_Rect &Extent) const
double Fit_xto_Grid_System (double x) const
 Aligns the world coordinate x to the rows of the grid system and returns it.
double Fit_yto_Grid_System (double y) const
 Aligns the world coordinate y to the columns of the grid system and returns it.
TSG_Point Fit_to_Grid_System (TSG_Point ptWorld) const
 Aligns the world coordinate ptWorld to the rows and columns of the grid system and returns it.
double Get_xGrid_to_World (int xGrid) const
double Get_yGrid_to_World (int yGrid) const
TSG_Point Get_Grid_to_World (int xGrid, int yGrid) const
int Get_xWorld_to_Grid (double xWorld) const
int Get_yWorld_to_Grid (double yWorld) const
bool Get_World_to_Grid (int &xGrid, int &yGrid, double xWorld, double yWorld) const
bool Get_World_to_Grid (int &xGrid, int &yGrid, TSG_Point ptWorld) const
bool Get_Neighbor_Pos (int Direction, int x, int y, int &xPos, int &yPos) const
int Get_xToSave (int Direction, int x) const
int Get_yToSave (int Direction, int y) const
int Get_xFromSave (int Direction, int x) const
int Get_yFromSave (int Direction, int y) const
bool is_InGrid (int x, int y) const
bool is_InGrid (int x, int y, int Rand) const
double Get_Length (int Direction) const
sLong Get_IndexFromRowCol (int x, int y) const
bool Get_RowColFromIndex (int &x, int &y, sLong i) const

Static Public Member Functions

static int Get_xTo (int Direction, int x=0)
static int Get_yTo (int Direction, int y=0)
static int Get_xFrom (int Direction, int x=0)
static int Get_yFrom (int Direction, int y=0)
static double Get_UnitLength (int Direction)
static int Set_Precision (int Decimals)
static int Get_Precision (void)

Detailed Description

CSG_Grid_System is used by the CSG_Grid class to provide information about the number of rows and columns, the cell size and the georeference, which define the grid. It offers various functions, which help when working with grids.

See also
CSG_Grid

Definition at line 219 of file grid.h.

Constructor & Destructor Documentation

◆ CSG_Grid_System() [1/6]

CSG_Grid_System::CSG_Grid_System ( void )

◆ CSG_Grid_System() [2/6]

CSG_Grid_System::CSG_Grid_System ( const CSG_Grid_System & System,
int Precision = -1 )

Definition at line 105 of file grid_system.cpp.

References Create(), and CSG_Grid_System().

◆ CSG_Grid_System() [3/6]

CSG_Grid_System::CSG_Grid_System ( double Cellsize,
const CSG_Rect & Extent,
int Precision = -1 )

Definition at line 111 of file grid_system.cpp.

References Create().

◆ CSG_Grid_System() [4/6]

CSG_Grid_System::CSG_Grid_System ( double Cellsize,
double xMin,
double yMin,
double xMax,
double yMax,
int Precision = -1 )

Definition at line 117 of file grid_system.cpp.

References Create().

◆ CSG_Grid_System() [5/6]

CSG_Grid_System::CSG_Grid_System ( double Cellsize,
double xMin,
double yMin,
int NX,
int NY,
int Precision = -1 )

Definition at line 123 of file grid_system.cpp.

References Create().

◆ CSG_Grid_System() [6/6]

CSG_Grid_System::CSG_Grid_System ( const CSG_String & System,
int Precision = -1 )

Definition at line 129 of file grid_system.cpp.

References Create().

◆ ~CSG_Grid_System()

CSG_Grid_System::~CSG_Grid_System ( void )

Definition at line 135 of file grid_system.cpp.

References Destroy().

Member Function Documentation

◆ Assign() [1/4]

bool CSG_Grid_System::Assign ( const CSG_Grid_System & System)

◆ Assign() [2/4]

bool CSG_Grid_System::Assign ( double Cellsize,
const CSG_Rect & Extent )

Definition at line 290 of file grid_system.cpp.

References Create().

◆ Assign() [3/4]

bool CSG_Grid_System::Assign ( double Cellsize,
double xMin,
double yMin,
double xMax,
double yMax )

Definition at line 293 of file grid_system.cpp.

References Create().

◆ Assign() [4/4]

bool CSG_Grid_System::Assign ( double Cellsize,
double xMin,
double yMin,
int NX,
int NY )

Definition at line 296 of file grid_system.cpp.

References Create().

◆ asString()

const SG_Char * CSG_Grid_System::asString ( void )

Definition at line 341 of file grid_system.cpp.

References SG_Char, and SG_Get_Significant_Decimals().

◆ Create() [1/5]

◆ Create() [2/5]

bool CSG_Grid_System::Create ( const CSG_String & System,
int Precision = -1 )

Tries to construct a grid system from a string that uses one of the formats provided by the Get_Name() function, i.e. "<double>; <int>x <int>y; <double>x <double>y" or "Cell size: <double>, Number of cells: <int>x/<int>y, Lower left corner: <double>x/<double>y"

Definition at line 235 of file grid_system.cpp.

References Create(), CSG_Strings::Get_Count(), and SG_String_Tokenize().

◆ Create() [3/5]

bool CSG_Grid_System::Create ( double Cellsize,
const CSG_Rect & Extent,
int Precision = -1 )

◆ Create() [4/5]

bool CSG_Grid_System::Create ( double Cellsize,
double xMin,
double yMin,
double xMax,
double yMax,
int Precision = -1 )

Definition at line 187 of file grid_system.cpp.

References Create().

◆ Create() [5/5]

bool CSG_Grid_System::Create ( double Cellsize,
double xMin,
double yMin,
int NX,
int NY,
int Precision = -1 )

Definition at line 193 of file grid_system.cpp.

References Destroy(), and SG_Get_Rounded().

◆ Destroy()

bool CSG_Grid_System::Destroy ( void )

◆ Fit_to_Grid_System()

TSG_Point CSG_Grid_System::Fit_to_Grid_System ( TSG_Point ptWorld) const
inline

Aligns the world coordinate ptWorld to the rows and columns of the grid system and returns it.

Definition at line 293 of file grid.h.

References Fit_xto_Grid_System(), Fit_yto_Grid_System(), SSG_Point::x, and SSG_Point::y.

◆ Fit_xto_Grid_System()

double CSG_Grid_System::Fit_xto_Grid_System ( double x) const
inline

Aligns the world coordinate x to the rows of the grid system and returns it.

Definition at line 287 of file grid.h.

References Get_XMin(), and Get_xWorld_to_Grid().

Referenced by Fit_to_Grid_System().

◆ Fit_yto_Grid_System()

double CSG_Grid_System::Fit_yto_Grid_System ( double y) const
inline

Aligns the world coordinate y to the columns of the grid system and returns it.

Definition at line 290 of file grid.h.

References Get_YMin(), and Get_yWorld_to_Grid().

Referenced by Fit_to_Grid_System().

◆ Get_Cellarea()

double CSG_Grid_System::Get_Cellarea ( void ) const
inline

Definition at line 256 of file grid.h.

◆ Get_Cellsize()

double CSG_Grid_System::Get_Cellsize ( void ) const
inline

Definition at line 255 of file grid.h.

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

◆ Get_Extent()

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

Definition at line 262 of file grid.h.

Referenced by CSG_Parameters_Grid_Target::Set_User_Defined().

◆ Get_Grid_to_World()

TSG_Point CSG_Grid_System::Get_Grid_to_World ( int xGrid,
int yGrid ) const
inline

Definition at line 306 of file grid.h.

References Get_xGrid_to_World(), Get_yGrid_to_World(), SSG_Point::x, and SSG_Point::y.

◆ Get_IndexFromRowCol()

sLong CSG_Grid_System::Get_IndexFromRowCol ( int x,
int y ) const
inline

Definition at line 383 of file grid.h.

◆ Get_Length()

double CSG_Grid_System::Get_Length ( int Direction) const
inline

Definition at line 377 of file grid.h.

◆ Get_Name()

const SG_Char * CSG_Grid_System::Get_Name ( bool bShort = true)

Definition at line 311 of file grid_system.cpp.

References _TL, is_Valid(), SG_Char, and SG_Get_Significant_Decimals().

◆ Get_NCells()

sLong CSG_Grid_System::Get_NCells ( void ) const
inline

Definition at line 260 of file grid.h.

◆ Get_Neighbor_Pos()

bool CSG_Grid_System::Get_Neighbor_Pos ( int Direction,
int x,
int y,
int & xPos,
int & yPos ) const
inline

Definition at line 333 of file grid.h.

References Get_xTo(), Get_yTo(), and is_InGrid().

◆ Get_NX()

int CSG_Grid_System::Get_NX ( void ) const
inline

Definition at line 258 of file grid.h.

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

◆ Get_NY()

int CSG_Grid_System::Get_NY ( void ) const
inline

Definition at line 259 of file grid.h.

Referenced by CSG_Grid::Create(), Create(), and CSG_Parameters_Grid_Target::Set_User_Defined().

◆ Get_Precision()

int CSG_Grid_System::Get_Precision ( void )
static

Get the default precision (number of decimals) used to store coordinates and cell sizes. A negative value indicates that this is ignored.

Definition at line 88 of file grid_system.cpp.

Referenced by CSG_Grid_File_Info::Save().

◆ Get_RowColFromIndex()

bool CSG_Grid_System::Get_RowColFromIndex ( int & x,
int & y,
sLong i ) const
inline

Definition at line 393 of file grid.h.

◆ Get_UnitLength()

double CSG_Grid_System::Get_UnitLength ( int Direction)
inlinestatic

Definition at line 378 of file grid.h.

◆ Get_World_to_Grid() [1/2]

bool CSG_Grid_System::Get_World_to_Grid ( int & xGrid,
int & yGrid,
double xWorld,
double yWorld ) const
inline

Definition at line 321 of file grid.h.

References Get_xWorld_to_Grid(), Get_yWorld_to_Grid(), and is_InGrid().

◆ Get_World_to_Grid() [2/2]

bool CSG_Grid_System::Get_World_to_Grid ( int & xGrid,
int & yGrid,
TSG_Point ptWorld ) const
inline

Definition at line 326 of file grid.h.

References Get_xWorld_to_Grid(), Get_yWorld_to_Grid(), is_InGrid(), SSG_Point::x, and SSG_Point::y.

◆ Get_xFrom()

int CSG_Grid_System::Get_xFrom ( int Direction,
int x = 0 )
inlinestatic

Definition at line 366 of file grid.h.

References Get_xTo().

Referenced by CSG_Tool_Grid::Get_xFrom(), and Get_xFromSave().

◆ Get_xFromSave()

int CSG_Grid_System::Get_xFromSave ( int Direction,
int x ) const
inline

Definition at line 371 of file grid.h.

References Get_xFrom().

◆ Get_xGrid_to_World()

double CSG_Grid_System::Get_xGrid_to_World ( int xGrid) const
inline

Definition at line 303 of file grid.h.

References Get_XMin().

Referenced by Get_Grid_to_World().

◆ Get_XMax()

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

Definition at line 265 of file grid.h.

◆ Get_XMin()

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

◆ Get_XRange()

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

Definition at line 266 of file grid.h.

◆ Get_xTo()

int CSG_Grid_System::Get_xTo ( int Direction,
int x = 0 )
inlinestatic

Definition at line 338 of file grid.h.

Referenced by Get_Neighbor_Pos(), Get_xFrom(), CSG_Tool_Grid::Get_xTo(), and Get_xToSave().

◆ Get_xToSave()

int CSG_Grid_System::Get_xToSave ( int Direction,
int x ) const
inline

Definition at line 369 of file grid.h.

References Get_xTo().

◆ Get_xWorld_to_Grid()

int CSG_Grid_System::Get_xWorld_to_Grid ( double xWorld) const
inline

◆ Get_yFrom()

int CSG_Grid_System::Get_yFrom ( int Direction,
int y = 0 )
inlinestatic

Definition at line 367 of file grid.h.

References Get_yTo().

Referenced by CSG_Tool_Grid::Get_yFrom(), and Get_yFromSave().

◆ Get_yFromSave()

int CSG_Grid_System::Get_yFromSave ( int Direction,
int y ) const
inline

Definition at line 372 of file grid.h.

References Get_yFrom().

◆ Get_yGrid_to_World()

double CSG_Grid_System::Get_yGrid_to_World ( int yGrid) const
inline

Definition at line 304 of file grid.h.

References Get_YMin().

Referenced by Get_Grid_to_World().

◆ Get_YMax()

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

Definition at line 269 of file grid.h.

◆ Get_YMin()

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

◆ Get_YRange()

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

Definition at line 270 of file grid.h.

◆ Get_yTo()

int CSG_Grid_System::Get_yTo ( int Direction,
int y = 0 )
inlinestatic

Definition at line 352 of file grid.h.

Referenced by Get_Neighbor_Pos(), Get_yFrom(), CSG_Tool_Grid::Get_yTo(), and Get_yToSave().

◆ Get_yToSave()

int CSG_Grid_System::Get_yToSave ( int Direction,
int y ) const
inline

Definition at line 370 of file grid.h.

References Get_yTo().

◆ Get_yWorld_to_Grid()

int CSG_Grid_System::Get_yWorld_to_Grid ( double yWorld) const
inline

◆ is_Equal() [1/2]

◆ is_Equal() [2/2]

bool CSG_Grid_System::is_Equal ( double Cellsize,
const TSG_Rect & Extent ) const

Definition at line 404 of file grid_system.cpp.

◆ is_InGrid() [1/2]

bool CSG_Grid_System::is_InGrid ( int x,
int y ) const
inline

Definition at line 374 of file grid.h.

Referenced by Get_Neighbor_Pos(), Get_World_to_Grid(), and Get_World_to_Grid().

◆ is_InGrid() [2/2]

bool CSG_Grid_System::is_InGrid ( int x,
int y,
int Rand ) const
inline

Definition at line 375 of file grid.h.

◆ is_Valid()

◆ operator!=() [1/2]

bool CSG_Grid_System::operator!= ( const CSG_Grid_System & System) const

Definition at line 382 of file grid_system.cpp.

References CSG_Grid_System(), and is_Equal().

◆ operator!=() [2/2]

bool CSG_Grid_System::operator!= ( const CSG_Grid_System * pSystem) const

Definition at line 371 of file grid_system.cpp.

References CSG_Grid_System(), and is_Equal().

◆ operator=()

CSG_Grid_System & CSG_Grid_System::operator= ( const CSG_Grid_System & System)

Definition at line 358 of file grid_system.cpp.

References Create(), and CSG_Grid_System().

◆ operator==() [1/2]

bool CSG_Grid_System::operator== ( const CSG_Grid_System & System) const

Definition at line 377 of file grid_system.cpp.

References CSG_Grid_System(), and is_Equal().

◆ operator==() [2/2]

bool CSG_Grid_System::operator== ( const CSG_Grid_System * pSystem) const

Definition at line 366 of file grid_system.cpp.

References CSG_Grid_System(), and is_Equal().

◆ Set_Precision()

int CSG_Grid_System::Set_Precision ( int Decimals)
static

Set the default precision given as number of decimals used to store coordinates and cell sizes. Ignored if set to a negative value.

Definition at line 75 of file grid_system.cpp.


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