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++)
98 #pragma omp parallel for
99 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
129 bool bResult =
false;
132 if( m_System == pGrid->m_System )
134 #pragma omp parallel for
135 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
147 bResult =
true; bProgress =
false;
159 else switch( Method )
176 : _Assign_MeanValue (pGrid,
true , bProgress);
209 #pragma omp parallel for
210 for(
int x=0; x<
Get_NX(); x++)
214 if( pGrid->
Get_Value(px, py, z, Interpolation) )
229bool CSG_Grid::_Assign_ExtremeValue(
CSG_Grid *pGrid,
bool bMaximum,
bool bProgress)
246 int iy = (int)floor(py);
248 if( iy >= 0 && iy <
Get_NY() )
250 #pragma omp parallel for
251 for(
int x=0; x<pGrid->
Get_NX(); x++)
255 int ix = (int)floor(ax + x * d);
257 if( ix >= 0 && ix <
Get_NX() )
262 || (bMaximum ==
true && z >
asDouble(ix, iy))
263 || (bMaximum ==
false && z <
asDouble(ix, iy)) )
278bool CSG_Grid::_Assign_MeanValue(
CSG_Grid *pGrid,
bool bAreaProportional,
bool bProgress)
293 int ay = (int)(bAreaProportional ? floor(py ) : ceil (py ));
294 int by = (int)(bAreaProportional ? ceil (py + d) : floor(py + d));
297 #pragma omp parallel for
298 for(
int x=0; x<
Get_NX(); x++)
300 double px = ox + x * d;
302 int ax = (int)(bAreaProportional ? floor(px ) : ceil (px ));
303 int bx = (int)(bAreaProportional ? ceil (px + d) : floor(px + d));
305 CSG_Rect rMean(px, py, px + d, py + d); CSG_Simple_Statistics s;
307 for(
int iy=ay; iy<=by; iy++)
309 if( iy >= 0 && iy < pGrid->
Get_NY() )
311 for(
int ix=ax; ix<=bx; ix++)
315 if( bAreaProportional )
317 CSG_Rect r(ix - 0.5, iy - 0.5, ix + 0.5, iy + 0.5);
319 if( r.Intersect(rMean) )
355bool CSG_Grid::_Assign_Majority(
CSG_Grid *pGrid,
bool bProgress)
374 if( ay < pGrid->
Get_NY() && by > 0 )
376 if( ay < 0 ) { ay = 0; }
if( by > pGrid->
Get_NY() ) { by = pGrid->
Get_NY(); }
380 for(
int x=0; x<
Get_NX(); x++)
384 if( ax < pGrid->
Get_NX() && bx > 0 )
386 CSG_Unique_Number_Statistics s;
388 if( ax < 0 ) { ax = 0; }
if( bx > pGrid->
Get_NX() ) { bx = pGrid->
Get_NX(); }
390 for(
int iy=ay; iy<by; iy++)
for(
int ix=ax; ix<bx; ix++)
593 #pragma omp parallel for
594 for(
int y=0; y<
Get_NY(); y++)
598 for(
int x=0; x<
Get_NX(); x++)
604 if( Grid.
Get_Value(xWorld, yWorld, Value, Interpolation) )
643 #pragma omp parallel for
644 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
674 #pragma omp parallel for
675 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
690 #pragma omp parallel for
691 for(
int x=0; x<
Get_NX(); x++)
for(
int yA=0, yB=
Get_NY()-1; yA<yB; yA++, yB--)
703 #pragma omp parallel for
704 for(
int y=0; y<
Get_NY(); y++)
for(
int xA=0, xB=
Get_NX()-1; xA<xB; xA++, xB--)
723 #pragma omp parallel for
724 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
743 #pragma omp parallel for
744 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
765 #pragma omp parallel for
766 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
785 #pragma omp parallel for
786 for(
int y=0; y<
Get_NY(); y++)
for(
int x=0; x<
Get_NX(); x++)
826 double z =
asDouble(x, y), dzMax = 0.;
828 for(
int i=0; i<8; i++)
830 int ix = m_System.Get_xTo(i, x), iy = m_System.Get_yTo(i, y);
834 double dz = (z -
asDouble(ix, iy)) / m_System.Get_Length(i);
836 if( (!bDown || dz > 0.) && (Direction < 0 || dzMax < dz) )
838 Direction = i; dzMax = dz;
866 for(
int i=0, iDir=0, ix, iy; i<4; i++, iDir+=2)
869 ix = m_System.Get_xTo (iDir, x),
870 iy = m_System.Get_yTo (iDir, y)) )
875 ix = m_System.Get_xFrom(iDir, x),
876 iy = m_System.Get_yFrom(iDir, y)) )
889 Slope = atan(sqrt(G*G + H*H));
915 for(
int i=0, iDir=0; i<4; i++, iDir+=2)
919 y +
Get_Cellsize() * m_System.Get_yTo (iDir), iz, Interpolation) )
925 y +
Get_Cellsize() * m_System.Get_yFrom(iDir), iz, Interpolation) )
938 Slope = atan(sqrt(G*G + H*H));
960 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)
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
virtual void Set_Modified(bool bModified=true)
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