51#ifndef HEADER_INCLUDED__SAGA_API__grid_H 
   52#define HEADER_INCLUDED__SAGA_API__grid_H 
  128        SG_T(
"DATAFILE_NAME"),
 
  129        SG_T(
"DATAFILE_OFFSET"),
 
  131        SG_T(
"BYTEORDER_BIG"),
 
  132        SG_T(
"POSITION_XMIN"),
 
  133        SG_T(
"POSITION_YMIN"),
 
  139        SG_T(
"NODATA_VALUE"),
 
 
  144#define GRID_FILE_KEY_TRUE      SG_T("TRUE") 
  145#define GRID_FILE_KEY_FALSE     SG_T("FALSE") 
  179#define GRID_RESAMPLING_NearestNeighbour CSG_Grid_Resampling::NearestNeighbour 
  180#define GRID_RESAMPLING_Bilinear         CSG_Grid_Resampling::Bilinear 
  181#define GRID_RESAMPLING_BicubicSpline    CSG_Grid_Resampling::Bicubic_1 
  182#define GRID_RESAMPLING_BSpline          CSG_Grid_Resampling::Bicubic_2 
  183#define GRID_RESAMPLING_Mean_Nodes       CSG_Grid_Resampling::Mean_Nodes 
  184#define GRID_RESAMPLING_Mean_Cells       CSG_Grid_Resampling::Mean_Cells 
  185#define GRID_RESAMPLING_Minimum          CSG_Grid_Resampling::Minimum 
  186#define GRID_RESAMPLING_Maximum          CSG_Grid_Resampling::Maximum 
  187#define GRID_RESAMPLING_Majority         CSG_Grid_Resampling::Majority 
  188#define GRID_RESAMPLING_Undefined        CSG_Grid_Resampling::Undefined 
  189#define TSG_Grid_Resampling              CSG_Grid_Resampling 
  228        bool                                            Create                            (
double Cellsize, 
const CSG_Rect &Extent, 
int Precision = -1);
 
  230                                                                CSG_Grid_System          (
double Cellsize, 
double xMin, 
double yMin, 
double xMax, 
double yMax, 
int Precision = -1);
 
  231        bool                                            Create                            (
double Cellsize, 
double xMin, 
double yMin, 
double xMax, 
double yMax, 
int Precision = -1);
 
  233                                                                CSG_Grid_System          (
double Cellsize, 
double xMin, 
double yMin, 
int NX, 
int NY, 
int Precision = -1);
 
  234        bool                                            Create                            (
double Cellsize, 
double xMin, 
double yMin, 
int NX, 
int NY, 
int Precision = -1);
 
  246        bool                                            Assign                            (
double Cellsize, 
double xMin, 
double yMin, 
double xMax, 
double yMax);
 
  247        bool                                            Assign                            (
double Cellsize, 
double xMin, 
double yMin, 
int NX, 
int NY);
 
  258        int                                                     Get_NX                            (
void)
  const   {       
return( m_NX );                 }
 
  259        int                                                     Get_NY                            (
void)
  const   {       
return( m_NY );                 }
 
  262        const CSG_Rect &                        
Get_Extent                    (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells : m_Extent );   }
 
  264        double                                          Get_XMin                        (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_XMin  () : m_Extent.Get_XMin  () ); }
 
  265        double                                          Get_XMax                        (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_XMax  () : m_Extent.Get_XMax  () ); }
 
  266        double                                          Get_XRange                    (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_XRange() : m_Extent.Get_XRange() ); }
 
  268        double                                          Get_YMin                        (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_YMin  () : m_Extent.Get_YMin  () ); }
 
  269        double                                          Get_YMax                        (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_YMax  () : m_Extent.Get_YMax  () ); }
 
  270        double                                          Get_YRange                    (
bool bCells = 
false)
   const   {       
return( bCells ? m_Extent_Cells.Get_YRange() : m_Extent.Get_YRange() ); }
 
  282        bool                                            is_Equal                        (
double Cellsize, 
const TSG_Rect &Extent) 
const;
 
  340                static int      ix[8]   = { 0, 1, 1, 1, 0,-1,-1,-1 };
 
  349                return( x + ix[Direction] );
 
 
  354                static int      iy[8]   = { 1, 1, 0,-1,-1,-1, 0, 1 };
 
  363                return( y + iy[Direction] );
 
 
  369        int                                                     Get_xToSave                  (
int Direction, 
int x)
          const   {       
return( (x = 
Get_xTo  (Direction, x)) < 0 ? 0 : (x >= m_NX ? m_NX - 1 : x) );    }
 
  370        int                                                     Get_yToSave                  (
int Direction, 
int y)
          const   {       
return( (y = 
Get_yTo  (Direction, y)) < 0 ? 0 : (y >= m_NY ? m_NY - 1 : y) );    }
 
  371        int                                                     Get_xFromSave              (
int Direction, 
int x)
          const   {       
return( (x = 
Get_xFrom(Direction, x)) < 0 ? 0 : (x >= m_NX ? m_NX - 1 : x) );  }
 
  372        int                                                     Get_yFromSave              (
int Direction, 
int y)
          const   {       
return( (y = 
Get_yFrom(Direction, y)) < 0 ? 0 : (y >= m_NY ? m_NY - 1 : y) );  }
 
  374        bool                                            is_InGrid                      (
int x, 
int y)
                          const   {       
return( x >= 0    && x < m_NX        && y >= 0    && y < m_NY );                }
 
  375        bool                                            is_InGrid                      (
int x, 
int y, 
int Rand)
        const   {       
return( x >= Rand && x < m_NX - Rand && y >= Rand && y < m_NY - Rand ); }
 
  377        double                                          Get_Length                    (
int Direction)
                         const   {       
return( Direction % 2 ? m_Diagonal : m_Cellsize );      }
 
  378        static double                           Get_UnitLength            (
int Direction)                                         {       
return( Direction % 2 ? sqrt(2.)  : 1. );                       }
 
  380        static int                                      Set_Precision           (
int Decimals);
 
  381        static int                                      Get_Precision           (
void);
 
  387                        return( (
sLong)y * m_NX + x );
 
 
  413        double                                          m_Cellsize, m_Cellarea, m_Diagonal;
 
  419        static int                                      m_Precision;
 
 
  456        bool                                            Save                                        (
const CSG_File   &Stream, 
bool bBinary = 
true);
 
  482        void                                            _On_Construction                (
void);
 
 
  524                                                                        CSG_Grid                (
TSG_Data_Type Type, 
int NX, 
int NY, 
double Cellsize = 1., 
double xMin = 0., 
double yMin = 0., 
bool bCached = 
false);
 
  525        bool                                                    Create                    (
TSG_Data_Type Type, 
int NX, 
int NY, 
double Cellsize = 1., 
double xMin = 0., 
double yMin = 0., 
bool bCached = 
false);
 
  536        virtual bool                                    Save                        (
const wchar_t    *File, 
int Format = 0)        {       
return( 
Save(
CSG_String(File), Format) ); }
 
  537        virtual bool                                    Save                    (
const CSG_String &File, 
int Format = 0);
 
  563        int                                                             Get_NX                    (
void)
  const   {       
return( m_System.Get_NX() );            }
 
  564        int                                                             Get_NY                    (
void)
  const   {       
return( m_System.Get_NY() );            }
 
  567        double                                                  Get_Cellsize        (
void)
  const   {       
return( m_System.Get_Cellsize() );      }
 
  568        double                                                  Get_Cellarea        (
void)
  const   {       
return( m_System.Get_Cellarea() );      }
 
  572        double                                                  Get_XMin                (
bool bCells = 
false)
   const   {       
return( m_System.Get_XMin  (bCells) );  }
 
  573        double                                                  Get_XMax                (
bool bCells = 
false)
   const   {       
return( m_System.Get_XMax  (bCells) );  }
 
  574        double                                                  Get_XRange            (
bool bCells = 
false)
   const   {       
return( m_System.Get_XRange(bCells) );  }
 
  576        double                                                  Get_YMin                (
bool bCells = 
false)
   const   {       
return( m_System.Get_YMin  (bCells) );  }
 
  577        double                                                  Get_YMax                (
bool bCells = 
false)
   const   {       
return( m_System.Get_YMax  (bCells) );  }
 
  578        double                                                  Get_YRange            (
bool bCells = 
false)
   const   {       
return( m_System.Get_YRange(bCells) );  }
 
  584        void                                                    Set_Scaling                     (
double Scale = 1., 
double Offset = 0.);
 
  585        double                                                  Get_Scaling                     (
void)  
const;
 
  586        double                                                  Get_Offset                      (
void)  
const;
 
  587        bool                                                    is_Scaled                      (
void)
  const   {       
return( m_zScale != 1. || m_zOffset != 0. );    }
 
  589        double                                                  Get_Mean                        (
void);
 
  590        double                                                  Get_Min                         (
void);
 
  591        double                                                  Get_Max                         (
void);
 
  592        double                                                  Get_Range                       (
void);
 
  593        double                                                  Get_StdDev                      (
void);
 
  594        double                                                  Get_Variance            (
void);
 
  595        double                                                  Get_Quantile            (
double   Quantile, 
bool bFromHistogram = 
true);
 
  596        double                                                  Get_Percentile          (
double Percentile, 
bool bFromHistogram = 
true);
 
  604        sLong                                                      Get_Data_Count          (
void);
 
  605        sLong                                                      Get_NoData_Count        (
void);
 
  611        virtual bool                                    is_Valid                        (
void)  
const;
 
  615        TSG_Intersection                                is_Intersecting         (
double xMin, 
double yMin, 
double xMax, 
double yMax) 
const;
 
  617        bool                                                    is_Compatible           (
CSG_Grid *pGrid) 
const;
 
  619        bool                                                    is_Compatible           (
int NX, 
int NY, 
double Cellsize, 
double xMin, 
double yMin) 
const;
 
  621        bool                                                    is_InGrid                      (
int    x, 
int    y, 
bool bCheckNoData = 
true)
  const   {       
return( m_System.is_InGrid(x, y) && (!bCheckNoData || !
is_NoData(x, y)) );     }
 
  622        bool                                                    is_InGrid_byPos          (
double x, 
double y, 
bool bCheckNoData = 
true)
  const   {       
return( 
Get_Extent(
true).Contains(x, y) && (!bCheckNoData || !
is_NoData(m_System.Get_xWorld_to_Grid(x), m_System.Get_yWorld_to_Grid(y))) );  }
 
  632        bool                                                    Set_Cache                               (
bool bOn);
 
  633        bool                                                    is_Cached                              (
void)
          const   {       
return( m_Cache_Stream != NULL );       }
 
  639        bool                                                    Assign_NoData                           (
void);
 
  641        virtual bool                                    Assign                                          (
double Value = 0.);
 
  642        virtual bool                                    Assign                                          (
CSG_Data_Object *pObject                   , 
bool bProgress = 
false);
 
  649        bool                                                    Normalise                                       (
void);
 
  652        bool                                                    Standardise                                     (
void);
 
  653        bool                                                    DeStandardise                           (
double Mean, 
double StdDev);
 
  655        int                                                             Get_Gradient_NeighborDir        (
int x, 
int y, 
bool bDown = 
true, 
bool bNoEdges = 
true) 
const;
 
  656        bool                                                    Get_Gradient                            (
int x, 
int y      , 
double &Slope, 
double &Aspect)     
const;
 
  657        bool                                                    Get_Gradient                            (
double x, 
double y, 
double &Slope, 
double &Aspect, 
CSG_Grid_Resampling Interpolation)       
const;
 
  687                return( _Get_Index() );
 
 
  692                if( Position >= 0 && Position < 
Get_NCells() && _Get_Index() )
 
  694                        Position        = m_Index[bDown ? 
Get_NCells() - Position - 1 : Position];
 
  696                        if( !bCheckNoData || !
is_NoData(Position) )
 
 
  707                return( (i = 
Get_Sorted(Position, bDown, bCheckNoData)) >= 0 );
 
 
  710        bool                                                    Get_Sorted            (
sLong Position, 
int &x, 
int &y, 
bool bDown = 
true, 
bool bCheckNoData = 
true)
 
  712                if( (Position = 
Get_Sorted(Position, bDown, bCheckNoData)) >= 0 )
 
  714                        x       = (int)(Position % 
Get_NX());
 
  715                        y       = (int)(Position / 
Get_NX());
 
 
  738        virtual CSG_Grid &                              operator  =             (
double Value);
 
  743        virtual CSG_Grid &                              operator +=             (
double Value);
 
  745        virtual CSG_Grid &                              Add                             (
double Value);
 
  748        virtual CSG_Grid                                operator -              (
double Value)                  
const;
 
  750        virtual CSG_Grid &                              operator -=             (
double Value);
 
  752        virtual CSG_Grid &                              Subtract                (
double Value);
 
  757        virtual CSG_Grid &                              operator *=             (
double Value);
 
  759        virtual CSG_Grid &                              Multiply                (
double Value);
 
  762        virtual CSG_Grid                                operator /              (
double Value)                  
const;
 
  764        virtual CSG_Grid &                              operator /=             (
double Value);
 
  766        virtual CSG_Grid &                              Divide                  (
double Value);
 
  768        virtual double                                  operator ()             (
int x, 
int y)
 const    {       
return( 
asDouble(x, y) );       }
 
  789        virtual float                                   asFloat          (
int x, 
int y, 
bool bScaled = 
true)
 const       {       
return( (
float)          (
asDouble(x, y, bScaled)) );   }
 
  798        virtual double                                  asDouble(
int x, 
int y, 
bool bScaled = 
true)
 const 
  804                        Value   = _Cache_Get_Value(x, y);
 
  806                else switch( m_Type )
 
  815                        case SG_DATATYPE_Int   : Value = (double)((
int    **)m_Values)[y][x]; 
break;
 
  818                        case SG_DATATYPE_Bit   : Value = (double)(((BYTE  **)m_Values)[y][x / 8] & m_Bitmask[x % 8]) == 0 ? 0. : 1.; 
break;
 
  826                        Value   = m_zOffset + m_zScale * Value;
 
 
  848        virtual void                                    Set_Value(
int x, 
int y, 
double Value, 
bool bScaled = 
true)
 
  852                        Value   = (Value - m_zOffset) / m_zScale;
 
  857                        _Cache_Set_Value(x, y, Value);
 
  859                else switch( m_Type )
 
  872                                        ? ((BYTE  **)m_Values)[y][x / 8] |   m_Bitmask[x % 8]
 
  873                                        : ((BYTE  **)m_Values)[y][x / 8] & (~m_Bitmask[x % 8]);
 
 
  885        bool                                            Set_Row                                 (
int y, 
const CSG_Vector &Values);
 
  891        virtual bool                            On_Update                               (
void);
 
  892        virtual bool                            On_Reload                               (
void);
 
  893        virtual bool                            On_Delete                               (
void);
 
  901        bool                                            m_Cache_bTemp, m_Cache_bSwap, m_Cache_bFlip;
 
  903        size_t                                          m_nBytes_Value, m_nBytes_Line;
 
  905        sLong                                              *m_Index, m_Cache_Offset;
 
  907        double                                          m_zOffset, m_zScale;
 
  909        FILE                                            *m_Cache_Stream;
 
  923        static  BYTE                            m_Bitmask[8];
 
  927        void                                            _On_Construction                (
void);
 
  929        bool                                            _Set_Index                              (
void);
 
  930        bool                                            _Get_Index                              (
void)
 
  932                if( Get_Update_Flag() )
 
  937                return( m_Index || _Set_Index() );
 
  944        bool                                            _Memory_Create                  (
bool bCached);
 
  945        void                                            _Memory_Destroy                 (
void);
 
  947        bool                                            _Array_Create                   (
void);
 
  948        void                                            _Array_Destroy                  (
void);
 
  950        bool                                            _Cache_Check                    (
void);
 
  951        bool                                            _Cache_Create                   (
const CSG_String &File, 
TSG_Data_Type Data_Type, 
sLong Offset, 
bool bSwap, 
bool bFlip);
 
  952        bool                                            _Cache_Create                   (
void);
 
  953        bool                                            _Cache_Destroy                  (
bool bMemory_Restore);
 
  954        void                                            _Cache_Set_Value                (
int x, 
int y, 
double Value);
 
  955        double                                          _Cache_Get_Value                (
int x, 
int y)  
const;
 
  961        void                                            _Swap_Bytes                             (
char *Bytes, 
int nBytes)       
const;
 
  963        bool                                            _Load_External                  (
const CSG_String &File, 
bool bCached, 
bool bLoadData);
 
  964        bool                                            _Load_PGSQL                             (
const CSG_String &File, 
bool bCached, 
bool bLoadData);
 
  966        bool                                            _Load_Native                    (
const CSG_String &File, 
bool bCached, 
bool bLoadData);
 
  969        bool                                            _Load_Compressed                (
const CSG_String &File, 
bool bCached, 
bool bLoadData);
 
  970        bool                                            _Save_Compressed                (
const CSG_String &File);
 
  972        bool                                            _Load_Binary                    (CSG_File &Stream, 
TSG_Data_Type File_Type, 
bool bFlip, 
bool bSwapBytes);
 
  973        bool                                            _Save_Binary                    (CSG_File &Stream, 
TSG_Data_Type File_Type, 
bool bFlip, 
bool bSwapBytes);
 
  974        bool                                            _Load_ASCII                             (CSG_File &Stream, 
bool bCached, 
bool bFlip = 
false);
 
  975        bool                                            _Save_ASCII                             (CSG_File &Stream, 
bool bFlip = 
false);
 
  977        bool                                            _Load_Surfer                    (
const CSG_String &File, 
bool bCached, 
bool bLoadData);
 
  981        CSG_Grid &                                      _Operation_Arithmetic   (
const CSG_Grid &Grid, 
TSG_Grid_Operation Operation);
 
  984        bool                                            _Assign_Interpolated    (CSG_Grid *pSource, 
CSG_Grid_Resampling Interpolation, 
bool bProgress);
 
  985        bool                                            _Assign_MeanValue               (CSG_Grid *pSource, 
bool bAreaProportional           , 
bool bProgress);
 
  986        bool                                            _Assign_ExtremeValue    (CSG_Grid *pSource, 
bool bMaximum                    , 
bool bProgress);
 
  987        bool                                            _Assign_Majority                (CSG_Grid *pSource                                   , 
bool bProgress);
 
  993        bool                                            _Get_ValAtPos_NearestNeighbour  (
double &Value, 
int x, 
int y, 
double dx, 
double dy                )     
const;
 
  994        bool                                            _Get_ValAtPos_BiLinear                  (
double &Value, 
int x, 
int y, 
double dx, 
double dy, 
bool bByteWise)     
const;
 
  995        bool                                            _Get_ValAtPos_BiCubic_1                 (
double &Value, 
int x, 
int y, 
double dx, 
double dy, 
bool bByteWise)     
const;
 
  996        bool                                            _Get_ValAtPos_BiCubic_2                 (
double &Value, 
int x, 
int y, 
double dx, 
double dy, 
bool bByteWise)     
const;
 
  998        double                                          _Get_ValAtPos_BiCubic_1                 (
double dx, 
double dy, 
double z_xy[4][4])       
const;
 
  999        double                                          _Get_ValAtPos_BiCubic_2                 (
double dx, 
double dy, 
double z_xy[4][4])       
const;
 
 1001        bool                                            _Get_ValAtPos_Fill4x4Submatrix  (
int x, 
int y, 
double z_xy[4][4]   )    
const;
 
 1002        bool                                            _Get_ValAtPos_Fill4x4Submatrix  (
int x, 
int y, 
double z_xy[4][4][4])    
const;
 
 
 1014#define SG_GRID_PTR_SAFE_SET_NODATA(g, x, y)    { if( g && g->is_InGrid(x, y, false) ) { g->Set_NoData(x, y   ); } } 
 1015#define SG_GRID_PTR_SAFE_SET_VALUE(g, x, y, z)  { if( g && g->is_InGrid(x, y, false) ) { g->Set_Value (x, y, z); } } 
 1093        virtual bool                    Pop                          (
int &x, 
int &y)
 
 
 
 1118#define SG_GRIDCELLADDR_PARM_SQUARE             0x01 
 1119#define SG_GRIDCELLADDR_PARM_CIRCLE             0x02 
 1120#define SG_GRIDCELLADDR_PARM_ANNULUS    0x04 
 1121#define SG_GRIDCELLADDR_PARM_SECTOR             0x08 
 1122#define SG_GRIDCELLADDR_PARM_SIZEDBL    0x10 
 1123#define SG_GRIDCELLADDR_PARM_MAPUNIT    0x20 
 1124#define SG_GRIDCELLADDR_PARM_WEIGHTING  0x40 
 1125#define SG_GRIDCELLADDR_PARM_DEFAULT    (SG_GRIDCELLADDR_PARM_SQUARE|SG_GRIDCELLADDR_PARM_CIRCLE) 
 1151        bool                                            Set_Radius                      (
double Radius, 
bool bSquare = 
false);
 
 1152        bool                                            Set_Square                      (
double Radius);
 
 1153        bool                                            Set_Circle                      (
double Radius);
 
 1154        bool                                            Set_Annulus                     (
double Radius_Inner, 
double Radius_Outer);
 
 1155        bool                                            Set_Sector                      (
double Radius, 
double Direction, 
double Tolerance);
 
 1157        double                                          Get_Radius                    (
bool bOuter = 
true)
            const   {       
return( bOuter ? m_Radius : m_Radius_0 );       }
 
 1163        int                                                     Get_Count                      (
void)
                                          const   {       
return( (
int)m_Kernel.Get_Count() );    }
 
 1164        int                                                     Get_X                              (
int Index, 
int Offset = 0)
     const   {       
return( Index >= 0 && Index < m_Kernel.Get_Count() ? m_Kernel[Index].asInt   (0) + Offset : Offset );   }
 
 1165        int                                                     Get_Y                              (
int Index, 
int Offset = 0)
     const   {       
return( Index >= 0 && Index < m_Kernel.Get_Count() ? m_Kernel[Index].asInt   (1) + Offset : Offset );   }
 
 1166        double                                          Get_Distance                (
int Index                )
     const   {       
return( Index >= 0 && Index < m_Kernel.Get_Count() ? m_Kernel[Index].asDouble(2)          : -1.    );   }
 
 1167        double                                          Get_Weight                    (
int Index                )
     const   {       
return( Index >= 0 && Index < m_Kernel.Get_Count() ? m_Kernel[Index].asDouble(3)          :  0.    );   }
 
 1168        bool                                            Get_Values                    (
int Index, 
int &x, 
int &y, 
double &Distance, 
double &Weight, 
bool bOffset = 
false)
     const 
 1170                if( Index >= 0 && Index < m_Kernel.Get_Count() )
 
 1174                        x                       = bOffset ? x + Cell.
asInt(0) : Cell.
asInt(0);
 
 1175                        y                       = bOffset ? y + Cell.
asInt(1) : Cell.
asInt(1);
 
 
 1190        double                                          m_Radius, m_Radius_0, m_Direction, m_Tolerance;
 
 1197        bool                                            _Set_Kernel                     (
int Type, 
double Radius, 
double Radius_Inner, 
double Direction, 
double Tolerance);
 
 
#define SAGA_API_DLL_EXPORT
 
#define SG_FREE_SAFE(PTR)
 
SAGA_API_DLL_EXPORT CSG_String operator+(const char *A, const CSG_String &B)
 
bool is_NoData_Value(double Value) const
 
void Set_Update_Flag(bool bOn=true)
 
double Get_NoData_Value(bool bUpper=false) const
 
virtual void Set_Modified(bool bOn=true)
 
CSG_Distance_Weighting & Get_Weighting(void)
 
bool is_Sector(void) const
 
double Get_Radius(bool bOuter=true) const
 
double Get_Distance(int Index) const
 
double Get_Radius_Outer(void) const
 
bool Set_Circle(class CSG_Parameters &Parameters)
 
bool Set_Annulus(class CSG_Parameters &Parameters)
 
int Get_Count(void) const
 
int Get_X(int Index, int Offset=0) const
 
double Get_Weight(int Index) const
 
double Get_Direction(void) const
 
double Get_Tolerance(void) const
 
static bool Add_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", int Style=SG_GRIDCELLADDR_PARM_DEFAULT)
 
bool Set_Parameters(class CSG_Parameters &Parameters, int Type=0)
 
static bool Enable_Parameters(class CSG_Parameters &Parameters)
 
bool is_Square(void) const
 
double Get_Radius_Inner(void) const
 
bool is_Circle(void) const
 
bool Set_Sector(class CSG_Parameters &Parameters)
 
bool is_Annulus(void) const
 
bool Get_Values(int Index, int &x, int &y, double &Distance, double &Weight, bool bOffset=false) const
 
int Get_Y(int Index, int Offset=0) const
 
CSG_Grid_Cell_Addressor(void)
 
bool Set_Square(class CSG_Parameters &Parameters)
 
bool Save(const CSG_String &File, bool bBinary=true)
 
CSG_Projection m_Projection
 
bool Save_AUX_XML(const CSG_String &File)
 
bool Create(const CSG_Grid_File_Info &Info)
 
const TSG_Point_Int & operator[](size_t i) const
 
virtual bool Push(int x, int y)
 
virtual bool Pop(int &x, int &y)
 
bool is_InGrid(int x, int y, int Rand) const
 
int Get_yFromSave(int Direction, int y) const
 
double Get_XMin(bool bCells=false) const
 
bool Get_RowColFromIndex(int &x, int &y, sLong i) const
 
bool Get_World_to_Grid(int &xGrid, int &yGrid, TSG_Point ptWorld) const
 
double Get_YMin(bool bCells=false) const
 
TSG_Point Get_Grid_to_World(int xGrid, int yGrid) const
 
int Get_xWorld_to_Grid(double xWorld) const
 
double Get_XRange(bool bCells=false) const
 
bool Get_Neighbor_Pos(int Direction, int x, int y, int &xPos, int &yPos) const
 
double Get_Cellsize(void) const
 
const SG_Char * Get_Name(bool bShort=true)
 
double Fit_xto_Grid_System(double x) const
Aligns the world coordinate x to the rows of the grid system and returns it.
 
int Get_yWorld_to_Grid(double yWorld) const
 
double Get_Length(int Direction) const
 
double Get_YRange(bool bCells=false) const
 
double Get_YMax(bool bCells=false) const
 
bool Get_World_to_Grid(int &xGrid, int &yGrid, double xWorld, double yWorld) const
 
bool Assign(const CSG_Grid_System &System)
 
const SG_Char * asString(void)
 
double Fit_yto_Grid_System(double y) const
Aligns the world coordinate y to the columns of the grid system and returns it.
 
double Get_Cellarea(void) const
 
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.
 
static int Get_yTo(int Direction, int y=0)
 
static int Get_yFrom(int Direction, int y=0)
 
int Get_xToSave(int Direction, int x) const
 
static int Get_xTo(int Direction, int x=0)
 
sLong Get_NCells(void) const
 
const CSG_Rect & Get_Extent(bool bCells=false) const
 
double Get_XMax(bool bCells=false) const
 
sLong Get_IndexFromRowCol(int x, int y) const
 
static int Get_xFrom(int Direction, int x=0)
 
bool is_InGrid(int x, int y) const
 
static double Get_UnitLength(int Direction)
 
bool Create(const CSG_Grid_System &System, int Precision=-1)
 
double Get_yGrid_to_World(int yGrid) const
 
bool is_Valid(void) const
 
int Get_xFromSave(int Direction, int x) const
 
double Get_xGrid_to_World(int xGrid) const
 
int Get_yToSave(int Direction, int y) const
 
virtual int asInt(sLong i, bool bScaled=true) const
 
double Get_YMin(bool bCells=false) const
 
bool is_Cached(void) const
 
int Get_nValueBytes(void) const
 
double Get_XRange(bool bCells=false) const
 
bool Get_Sorted(sLong Position, int &x, int &y, bool bDown=true, bool bCheckNoData=true)
 
virtual bool Destroy(void)
 
double Get_YMax(bool bCells=false) const
 
virtual TSG_Data_Object_Type Get_ObjectType(void) const
 
bool Set_Index(bool bOn=true)
 
virtual int asInt(int x, int y, bool bScaled=true) const
 
double Get_Memory_Size_MB(void) const
 
double Get_XMin(bool bCells=false) const
 
double Get_YRange(bool bCells=false) const
 
virtual void Set_NoData(int x, int y)
 
virtual char asChar(int x, int y, bool bScaled=true) const
 
double Get_Cellsize(void) const
 
virtual bool is_NoData(sLong i) const
 
const CSG_Rect & Get_Extent(bool bCells=false) const
 
bool is_InGrid_byPos(const TSG_Point &p, bool bCheckNoData=true) const
 
virtual short asShort(int x, int y, bool bScaled=true) const
 
virtual void Mul_Value(int x, int y, double Value)
 
virtual bool is_NoData(int x, int y) const
 
virtual void Set_NoData(sLong i)
 
double Get_XMax(bool bCells=false) const
 
virtual void Set_Modified(bool bModified=true)
 
sLong Get_Sorted(sLong Position, bool bDown=true, bool bCheckNoData=true)
 
virtual float asFloat(sLong i, bool bScaled=true) const
 
virtual void Set_Value(int x, int y, double Value, bool bScaled=true)
 
virtual short asShort(sLong i, bool bScaled=true) const
 
int Get_nLineBytes(void) const
 
const CSG_String & Get_Unit(void) const
 
virtual double asDouble(sLong i, bool bScaled=true) const
 
virtual double asDouble(int x, int y, bool bScaled=true) const
 
bool is_InGrid_byPos(double x, double y, bool bCheckNoData=true) const
 
virtual void Add_Value(int x, int y, double Value)
 
virtual BYTE asByte(int x, int y, bool bScaled=true) const
 
sLong Get_Memory_Size(void) const
 
virtual sLong asLong(sLong i, bool bScaled=true) const
 
virtual sLong asLong(int x, int y, bool bScaled=true) const
 
virtual bool Save(const wchar_t *File, int Format=0)
 
virtual BYTE asByte(sLong i, bool bScaled=true) const
 
virtual bool Save(const char *File, int Format=0)
 
virtual float asFloat(int x, int y, bool bScaled=true) const
 
sLong Get_NCells(void) const
 
virtual void Add_Value(sLong i, double Value)
 
bool Create(const CSG_Grid &Grid)
 
const CSG_Grid_System & Get_System(void) const
 
virtual const CSG_Rect & Get_Extent(void)
 
bool Get_Sorted(sLong Position, sLong &i, bool bDown=true, bool bCheckNoData=true)
 
double Get_Cellarea(void) const
 
bool is_InGrid(int x, int y, bool bCheckNoData=true) const
 
bool is_Scaled(void) const
 
virtual void Set_Value(sLong i, double Value, bool bScaled=true)
 
virtual char asChar(sLong i, bool bScaled=true) const
 
virtual void Mul_Value(sLong i, double Value)
 
TSG_Data_Type Get_Type(void) const
 
void * Get_Record(size_t i) const
 
void * Get_Record_Pop(void)
 
void * Get_Record_Push(void)
 
CSG_Stack(size_t RecordSize)
 
double asDouble(int Field) const
 
int asInt(int Field) const
 
@ SG_DATAOBJECT_TYPE_Grid
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Mode(int Mode)
 
SAGA_API_DLL_EXPORT TSG_Grid_File_Format SG_Grid_Get_File_Format_Default(void)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold_MB(double nMegabytes)
 
SAGA_API_DLL_EXPORT double SG_Grid_Cache_Get_Threshold_MB(void)
 
SAGA_API_DLL_EXPORT bool SG_Grid_Set_File_Format_Default(int Format)
 
SAGA_API_DLL_EXPORT sLong SG_Grid_Cache_Get_Threshold(void)
 
SAGA_API_DLL_EXPORT int SG_Grid_Cache_Get_Mode(void)
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Threshold(int nBytes)
 
@ GRID_FILE_KEY_DATAFORMAT
 
@ GRID_FILE_KEY_CELLCOUNT_Y
 
@ GRID_FILE_KEY_DESCRIPTION
 
@ GRID_FILE_KEY_POSITION_YMIN
 
@ GRID_FILE_KEY_DATAFILE_OFFSET
 
@ GRID_FILE_KEY_NODATA_VALUE
 
@ GRID_FILE_KEY_BYTEORDER_BIG
 
@ GRID_FILE_KEY_POSITION_XMIN
 
@ GRID_FILE_KEY_DATAFILE_NAME
 
@ GRID_FILE_KEY_CELLCOUNT_X
 
@ GRID_FILE_KEY_TOPTOBOTTOM
 
SAGA_API_DLL_EXPORT CSG_String SG_Grid_Get_File_Extension_Default(void)
 
@ GRID_FILE_FORMAT_Compressed
 
@ GRID_FILE_FORMAT_Binary_old
 
@ GRID_FILE_FORMAT_GeoTIFF
 
@ GRID_FILE_FORMAT_Binary
 
@ GRID_FILE_FORMAT_Undefined
 
SAGA_API_DLL_EXPORT CSG_Grid * SG_Create_Grid(void)
 
@ GRID_OPERATION_Multiplication
 
@ GRID_OPERATION_Division
 
@ GRID_OPERATION_Addition
 
@ GRID_OPERATION_Subtraction
 
const SG_Char gSG_Grid_File_Key_Names[GRID_FILE_KEY_Count][32]
 
SAGA_API_DLL_EXPORT void SG_Grid_Cache_Set_Directory(const SG_Char *Directory)
 
#define SG_GRIDCELLADDR_PARM_DEFAULT
 
SAGA_API_DLL_EXPORT const SG_Char * SG_Grid_Cache_Get_Directory(void)
 
CSG_Vector operator*(double Scalar, const CSG_Vector &Vector)