132 return( sqrt(
x*
x +
y*
y) );
215 return( sqrt(
x*
x +
y*
y +
z*
z) );
305 return( sqrt(
x*
x +
y*
y +
z*
z +
m*
m) );
330 m_Points.Create(
sizeof(
TSG_Point), nPoints, Growth);
336 if( m_Points.Set_Array(Points.m_Points.
Get_Size()) )
338 if( m_Points.Get_Size() > 0 )
340 memcpy(m_Points.Get_Array(), Points.m_Points.
Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
352 if( m_Points.Inc_Array() )
466 if( Index >= 0 && Index < m_Lines.Get_Size() )
470 return( m_Lines.Del(Index) );
484 sLong old_Count = m_Lines.Get_Size();
486 if( new_Count > old_Count )
488 m_Lines.Set_Array(new_Count);
490 for(
sLong i=old_Count; i<new_Count; i++)
495 else if( new_Count < old_Count )
497 for(
sLong i=new_Count; i<old_Count; i++)
502 m_Lines.Set_Array(new_Count);
568 if( m_Points.Set_Array(Points.m_Points.
Get_Size()) )
570 if( m_Points.Get_Size() > 0 )
572 memcpy(m_Points.Get_Array(), Points.m_Points.
Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
584 if( m_Points.Inc_Array() )
626 if( m_Points.Set_Array(Points.m_Points.
Get_Size()) )
628 if( m_Points.Get_Size() > 0 )
630 memcpy(m_Points.Get_Array(), Points.m_Points.
Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
642 if( m_Points.Inc_Array() )
700 xMin = _xMin < _xMax ? _xMin : _xMax;
701 xMax = _xMin < _xMax ? _xMax : _xMin;
703 yMin = _yMin < _yMax ? _yMin : _yMax;
704 yMax = _yMin < _yMax ? _yMax : _yMin;
788 return(
Move(Point.
x, Point.
y) );
810 return(
Inflate(d, d, bPercent) );
815 return(
Inflate(-dx, -dy, bPercent) );
820 return(
Deflate(d, d, bPercent) );
944 m_nRects = 0; m_Rects = NULL;
950 m_nRects = 0; m_Rects = NULL;
966 for(
int i=0; i<m_nRects; i++)
983 for(
int i=0; i<Rects.m_nRects; i++)
985 Add(*Rects.m_Rects[i]);
1015 m_Rects[m_nRects] =
new CSG_Rect(Rect);
1066 xMin = _xMin < _xMax ? _xMin : _xMax;
1067 xMax = _xMin < _xMax ? _xMax : _xMin;
1069 yMin = _yMin < _yMax ? _yMin : _yMax;
1070 yMax = _yMin < _yMax ? _yMax : _yMin;
1140 return(
Move(Point.
x, Point.
y) );
1228 return( (this->xMin ==
xMin) && (this->yMin ==
yMin)
1229 && (this->xMax ==
xMax) && (this->yMax ==
yMax) );
1300 for(
int i=0; i<m_nRects; i++)
1317 for(
int i=0; i<Rects.m_nRects; i++)
1319 Add(*Rects.m_Rects[i]);
1368 m_IDW_bOffset =
true;
1382 #define INIT_VALUE(id, val) if( Parameters(id) ) { Parameters(id)->Set_Value(val); Parameters(id)->Set_Default(val); }
1384 INIT_VALUE(
"DW_WEIGHTING" ,(
int)m_Weighting );
1399 "DW_WEIGHTING" ,
_TL(
"Weighting Function"),
1402 _TL(
"no distance weighting"),
1403 _TL(
"inverse distance to a power"),
1410 "DW_IDW_POWER" ,
_TL(
"Power"),
1417 Parameters.
Add_Bool (
"DW_WEIGHTING",
1418 "DW_IDW_OFFSET" ,
_TL(
"Offset"),
1419 _TL(
"Calculates weights for distance plus one, avoiding division by zero for zero distances"),
1425 "DW_BANDWIDTH" ,
_TL(
"Bandwidth"),
1426 _TL(
"Bandwidth for exponential and Gaussian weighting"),
1436 if( Parameters(
"DW_WEIGHTING") )
1438 int Method = Parameters(
"DW_WEIGHTING")->asInt();
1440 Parameters.
Set_Enabled(
"DW_IDW_OFFSET", Method == 1);
1441 Parameters.
Set_Enabled(
"DW_IDW_POWER" , Method == 1);
1442 Parameters.
Set_Enabled(
"DW_BANDWIDTH" , Method >= 2);
1451 if( Parameters(
"DW_WEIGHTING") )
1453 switch( Parameters(
"DW_WEIGHTING")->asInt() )
1462 if( Parameters(
"DW_IDW_OFFSET") )
1467 if( Parameters(
"DW_IDW_POWER" ) )
1472 if( Parameters(
"DW_BANDWIDTH" ) )
1488 m_Weighting = Weighting;
1501 m_IDW_Power = Value;
1509 m_IDW_bOffset = bOn;
1522 m_Bandwidth = Value;
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
void * Get_Array(void) const
sLong Get_Size(void) const
bool Set_Weighting(TSG_Distance_Weighting Weighting)
virtual ~CSG_Distance_Weighting(void)
CSG_Distance_Weighting(void)
static bool Add_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
bool Set_IDW_Offset(bool bOn=true)
bool Set_BandWidth(double Value)
bool Create_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
static bool Enable_Parameters(class CSG_Parameters &Parameters)
bool Set_IDW_Power(double Value)
bool Set_Parameters(class CSG_Parameters &Parameters)
CSG_Points & Get_Line(sLong Index)
double Get_Length(void) const
sLong Get_Count(void) const
bool Create(const CSG_Lines &Lines)
bool Set_Count(sLong nLines)
bool Assign(const CSG_Lines &Lines)
CSG_Parameter * Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default=0)
void Set_Enabled(bool bEnabled=true)
CSG_Parameter * Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
virtual void Subtract(const CSG_Point_3D &Point)
virtual void Assign(double x, double y, double z)
virtual void Multiply(const CSG_Point_3D &Point)
virtual void Divide(double Value)
virtual double Get_Length(void) const
virtual void Add(const CSG_Point_3D &Point)
virtual void Subtract(const CSG_Point_4D &Point)
virtual void Assign(double x, double y, double z, double m)
virtual void Multiply(const CSG_Point_4D &Point)
virtual void Add(const CSG_Point_4D &Point)
virtual void Divide(double Value)
virtual double Get_Length(void) const
virtual void Add(const CSG_Point &Point)
virtual void Divide(double Value)
virtual void Assign(double x, double y)
virtual void Subtract(const CSG_Point &Point)
virtual void Multiply(const CSG_Point &Point)
virtual double Get_Length(void) const
bool Add(double x, double y, double z)
bool Assign(const CSG_Points_3D &Points)
bool Assign(const CSG_Points_Int &Points)
bool Assign(const CSG_Points &Points)
bool Add(double x, double y)
sLong Get_Count(void) const
bool is_Equal(int xMin, int yMin, int xMax, int yMax) const
CSG_Rect_Int & Set_BottomLeft(int x, int y)
CSG_Rect_Int & Union(int x, int y)
CSG_Rect_Int & Deflate(int d)
TSG_Intersection Intersects(const CSG_Rect_Int &Rect) const
CSG_Rect_Int & Move(int dx, int dy)
CSG_Rect_Int & Set_TopRight(int x, int y)
bool Contains(double x, double y) const
CSG_Rect_Int & Assign(int xMin, int yMin, int xMax, int yMax)
bool Intersect(const CSG_Rect_Int &Rect)
CSG_Rect_Int & Inflate(int d)
bool Create(int xMin, int yMin, int xMax, int yMax)
bool Create(double xMin, double yMin, double xMax, double yMax)
bool is_Equal(double xMin, double yMin, double xMax, double yMax, double epsilon=0.) const
bool Intersect(const CSG_Rect &Rect)
double Get_YRange(void) const
CSG_Rect & Union(double x, double y)
CSG_Rect & Set_TopRight(double x, double y)
CSG_Rect & Inflate(double d, bool bPercent=true)
CSG_Rect & Set_BottomLeft(double x, double y)
CSG_Rect & Deflate(double d, bool bPercent=true)
CSG_Rect & Move(double dx, double dy)
bool Contains(double x, double y) const
double Get_XMax(void) const
double Get_XRange(void) const
double Get_XMin(void) const
TSG_Intersection Intersects(const CSG_Rect &Rect) const
double Get_YMin(void) const
double Get_YMax(void) const
CSG_Rect & Assign(double xMin, double yMin, double xMax, double yMax)
bool Assign(const CSG_Rects_Int &Rects)
virtual ~CSG_Rects_Int(void)
CSG_Rects_Int & operator=(const CSG_Rects_Int &Rects)
bool Assign(const CSG_Rects &Rects)
CSG_Rects & operator=(const CSG_Rects &Rects)
static CSG_String Format(const char *Format,...)
#define INIT_VALUE(id, val)