69 #pragma omp parallel for
70 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
88 #pragma omp parallel for
89 for(
int y=0; y<
Get_NY(); y++)
96 #pragma omp parallel for
97 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
106 m_Statistics.Invalidate();
133 bool bResult =
false;
136 if( m_System == pGrid->m_System )
138 #pragma omp parallel for
139 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
151 bResult =
true; bProgress =
false;
163 else switch( Method )
180 : _Assign_MeanValue (pGrid,
true , bProgress);
213 #pragma omp parallel for
214 for(
int x=0; x<
Get_NX(); x++)
218 if( pGrid->
Get_Value(px, py, z, Interpolation) )
233bool CSG_Grid::_Assign_ExtremeValue(
CSG_Grid *pGrid,
bool bMaximum,
bool bProgress)
250 int iy = (int)floor(py);
252 if( iy >= 0 && iy <
Get_NY() )
254 #pragma omp parallel for
255 for(
int x=0; x<pGrid->
Get_NX(); x++)
259 int ix = (int)floor(ax + x * d);
261 if( ix >= 0 && ix <
Get_NX() )
266 || (bMaximum ==
true && z >
asDouble(ix, iy))
267 || (bMaximum ==
false && z <
asDouble(ix, iy)) )
282bool CSG_Grid::_Assign_MeanValue(
CSG_Grid *pGrid,
bool bAreaProportional,
bool bProgress)
297 int ay = (int)(bAreaProportional ? floor(py ) : ceil (py ));
298 int by = (int)(bAreaProportional ? ceil (py + d) : floor(py + d));
301 #pragma omp parallel for
302 for(
int x=0; x<
Get_NX(); x++)
304 double px = ox + x * d;
306 int ax = (int)(bAreaProportional ? floor(px ) : ceil (px ));
307 int bx = (int)(bAreaProportional ? ceil (px + d) : floor(px + d));
309 CSG_Rect rMean(px, py, px + d, py + d); CSG_Simple_Statistics s;
311 for(
int iy=ay; iy<=by; iy++)
313 if( iy >= 0 && iy < pGrid->
Get_NY() )
315 for(
int ix=ax; ix<=bx; ix++)
319 if( bAreaProportional )
321 CSG_Rect r(ix - 0.5, iy - 0.5, ix + 0.5, iy + 0.5);
323 if( r.Intersect(rMean) )
359bool CSG_Grid::_Assign_Majority(
CSG_Grid *pGrid,
bool bProgress)
378 if( ay < pGrid->
Get_NY() && by > 0 )
380 if( ay < 0 ) { ay = 0; }
if( by > pGrid->
Get_NY() ) { by = pGrid->
Get_NY(); }
384 for(
int x=0; x<
Get_NX(); x++)
388 if( ax < pGrid->
Get_NX() && bx > 0 )
390 CSG_Unique_Number_Statistics s;
392 if( ax < 0 ) { ax = 0; }
if( bx > pGrid->
Get_NX() ) { bx = pGrid->
Get_NX(); }
394 for(
int iy=ay; iy<by; iy++)
for(
int ix=ax; ix<bx; ix++)
597 #pragma omp parallel for
598 for(
int y=0; y<
Get_NY(); y++)
602 for(
int x=0; x<
Get_NX(); x++)
608 if( Grid.
Get_Value(xWorld, yWorld, Value, Interpolation) )
664 #pragma omp parallel for
665 for(
int y=0; y<
Get_NY(); y++)
667 for(
int x=0; x<
Get_NX(); x++)
702 #pragma omp parallel for
703 for(
int y=0; y<
Get_NY(); y++)
705 for(
int x=0; x<
Get_NX(); x++)
721 #pragma omp parallel for
722 for(
int x=0; x<
Get_NX(); x++)
724 for(
int yA=0, yB=
Get_NY()-1; yA<yB; yA++, yB--)
739 #pragma omp parallel for
740 for(
int y=0; y<
Get_NY(); y++)
742 for(
int xA=0, xB=
Get_NX()-1; xA<xB; xA++, xB--)
767 #pragma omp parallel for
768 for(
int y=0; y<
Get_NY(); y++)
770 for(
int x=0; x<
Get_NX(); x++)
790 #pragma omp parallel for
791 for(
int y=0; y<
Get_NY(); y++)
793 for(
int x=0; x<
Get_NX(); x++)
816 #pragma omp parallel for
817 for(
int y=0; y<
Get_NY(); y++)
819 for(
int x=0; x<
Get_NX(); x++)
839 #pragma omp parallel for
840 for(
int y=0; y<
Get_NY(); y++)
842 for(
int x=0; x<
Get_NX(); x++)
883 double z =
asDouble(x, y), dzMax = 0.;
885 for(
int i=0; i<8; i++)
887 int ix = m_System.Get_xTo(i, x);
888 int iy = m_System.Get_yTo(i, y);
892 double dz = (z -
asDouble(ix, iy)) / m_System.Get_Length(i);
894 if( (!bDown || dz > 0.) && (Direction < 0 || dzMax < dz) )
925 for(
int i=0, iDir=0, ix, iy; i<4; i++, iDir+=2)
928 ix = m_System.Get_xTo (iDir, x),
929 iy = m_System.Get_yTo (iDir, y)) )
934 ix = m_System.Get_xFrom(iDir, x),
935 iy = m_System.Get_yFrom(iDir, y)) )
948 Slope = atan(sqrt(G*G + H*H));
974 for(
int i=0, iDir=0; i<4; i++, iDir+=2)
978 y +
Get_Cellsize() * m_System.Get_yTo (iDir), iz, Interpolation) )
984 y +
Get_Cellsize() * m_System.Get_yFrom(iDir), iz, Interpolation) )
997 Slope = atan(sqrt(G*G + H*H));
1019 return(
Get_Gradient(p.
x, p.
y, Incline, Azimuth, Interpolation) );
bool SG_UI_Process_Set_Ready(void)
bool SG_UI_Process_Set_Progress(int Position, int Range)
void Set_Update_Flag(bool bOn=true)
double Get_NoData_Value(bool bUpper=false) const
CSG_MetaData & Get_History(void)
virtual bool Set_NoData_Value(double Value)
CSG_Projection & Get_Projection(void)
class CSG_Grid * asGrid(bool bPolymorph=false) const
virtual CSG_Grid & operator*=(const CSG_Grid &Grid)
bool DeNormalise(double Minimum, double Maximum)
double Get_YMin(bool bCells=false) const
bool is_Cached(void) const
virtual CSG_Grid & operator+=(const CSG_Grid &Grid)
virtual CSG_Grid & Subtract(const CSG_Grid &Grid)
TSG_Intersection is_Intersecting(const CSG_Rect &Extent) const
double Get_XMin(bool bCells=false) const
virtual void Set_NoData(int x, int y)
virtual CSG_Grid operator-(const CSG_Grid &Grid) const
bool DeStandardise(double Mean, double StdDev)
virtual CSG_Grid & operator=(const CSG_Grid &Grid)
virtual CSG_Grid & Add(const CSG_Grid &Grid)
double Get_Cellsize(void) const
virtual void Mul_Value(int x, int y, double Value)
virtual bool is_NoData(int x, int y) const
int Get_Gradient_NeighborDir(int x, int y, bool bDown=true, bool bNoEdges=true) const
virtual CSG_Grid operator*(const CSG_Grid &Grid) const
virtual bool is_Valid(void) const
int Get_nLineBytes(void) const
const CSG_String & Get_Unit(void) const
virtual CSG_Grid & Divide(const CSG_Grid &Grid)
virtual double asDouble(sLong i, bool bScaled=true) const
virtual void Add_Value(int x, int y, double Value)
virtual CSG_Grid operator/(const CSG_Grid &Grid) const
virtual CSG_Grid operator+(const CSG_Grid &Grid) const
virtual bool Assign(double Value=0.)
virtual CSG_Grid & Multiply(const CSG_Grid &Grid)
double Get_Value(double x, double y, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, bool bByteWise=false) const
void Set_Unit(const CSG_String &Unit)
virtual const CSG_Rect & Get_Extent(void)
bool is_InGrid(int x, int y, bool bCheckNoData=true) const
virtual void Set_Value(sLong i, double Value, bool bScaled=true)
virtual CSG_Grid & operator/=(const CSG_Grid &Grid)
virtual CSG_Grid & operator-=(const CSG_Grid &Grid)
bool Get_Gradient(int x, int y, double &Slope, double &Aspect) const
sLong Get_Count(void) const
void Add_Value(double Value, double Weight=1.)
virtual bool Get_Majority(double &Value) const
@ GRID_OPERATION_Multiplication
@ GRID_OPERATION_Division
@ GRID_OPERATION_Addition
@ GRID_OPERATION_Subtraction