89 Create(pGrid, Grow, Generalisation, Grow_Type);
99 Create(pGrid, Grow, Start, nMaxLevels, Generalisation, Grow_Type);
118 if( pGrid && pGrid->
is_Valid() && Grow > 1.0 && (pGrid->
Get_NX() > Grow || pGrid->
Get_NY() > Grow) )
122 m_Grow_Type = Grow_Type;
126 m_Generalisation = Generalisation;
128 _Get_Next_Level(pGrid);
139 if( pGrid && pGrid->
is_Valid() && Grow > 0.0 && (pGrid->
Get_NX() > Grow || pGrid->
Get_NY() > Grow) )
143 m_Grow_Type = Grow_Type;
144 m_nMaxLevels = nMaxLevels;
147 m_Generalisation = Generalisation;
151 _Get_Next_Level(pGrid, Start);
155 _Get_Next_Level(pGrid);
169 for(
int i=0; i<m_nLevels; i++)
171 delete(m_pLevels[i]);
192bool CSG_Grid_Pyramid::_Get_Next_Level(
CSG_Grid *pGrid)
194 if( (m_nMaxLevels <= 0 || m_nLevels < m_nMaxLevels) )
199 switch( m_Grow_Type )
203 default: Cellsize = pGrid->
Get_Cellsize() * m_Grow;
break;
206 nx = (int)(1.5 + m_pGrid->Get_XRange() / Cellsize);
if( nx < 1 ) nx = 1;
207 ny = (int)(1.5 + m_pGrid->Get_YRange() / Cellsize);
if( ny < 1 ) ny = 1;
209 if( nx > 1 || ny > 1 )
216 m_pLevels = (CSG_Grid **)
SG_Realloc(m_pLevels, (m_nLevels + 1) *
sizeof(CSG_Grid *));
217 m_pLevels[m_nLevels++] = pNext;
219 _Get_Next_Level(pNext);
229bool CSG_Grid_Pyramid::_Get_Next_Level(
CSG_Grid *pGrid,
double Cellsize)
231 if( (m_nMaxLevels <= 0 || m_nLevels < m_nMaxLevels) )
235 nx = (int)(1.5 + m_pGrid->Get_XRange() / Cellsize);
if( nx < 1 ) nx = 1;
236 ny = (int)(1.5 + m_pGrid->Get_YRange() / Cellsize);
if( ny < 1 ) ny = 1;
238 if( nx > 1 || ny > 1 )
245 m_pLevels = (CSG_Grid **)
SG_Realloc(m_pLevels, (m_nLevels + 1) *
sizeof(CSG_Grid *));
246 m_pLevels[m_nLevels++] = pNext;
248 _Get_Next_Level(pNext);
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
double Get_NoData_Value(bool bUpper=false) const
virtual bool Set_NoData_Value(double Value)
virtual ~CSG_Grid_Pyramid(void)
bool Create(class CSG_Grid *pGrid, double Grow=2.0, TSG_Grid_Pyramid_Generalisation Generalisation=GRID_PYRAMID_Mean, TSG_Grid_Pyramid_Grow_Type Grow_Type=GRID_PYRAMID_Geometric)
double Get_YMin(bool bCells=false) const
double Get_XMin(bool bCells=false) const
double Get_Cellsize(void) const
virtual bool is_Valid(void) const
virtual bool Assign(double Value=0.)
CSG_Grid * SG_Create_Grid(void)
TSG_Grid_Pyramid_Generalisation
TSG_Grid_Pyramid_Grow_Type
@ GRID_PYRAMID_Arithmetic