53#ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
54#define HEADER_INCLUDED__SAGA_API__geo_tools_H
90#define SG_IS_BETWEEN(a, x, b) (((a) <= (x) && (x) <= (b)) || ((b) <= (x) && (x) <= (a)))
162 virtual void Assign (
double x,
double y);
163 virtual void Assign (
const CSG_Point &Point);
165 virtual void Add (
const CSG_Point &Point);
166 virtual void Subtract (
const CSG_Point &Point);
167 virtual void Multiply (
const CSG_Point &Point);
169 virtual void Multiply (
double Value);
170 virtual void Divide (
double Value);
172 virtual double Get_Length (
void)
const;
176 virtual bool is_Equal (
double _x,
double _y,
double epsilon = 0.)
const
178 return( fabs(
x - _x) <= epsilon && fabs(
y - _y) <= epsilon );
191 bool Clear (
void) {
return( m_Points.Destroy() ); }
196 bool Add (
double x,
double y);
198 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
237 bool Del (
sLong Index);
239 bool Set_Count (
sLong nLines);
248 double Get_Length (
void)
const;
249 double Get_Length (
sLong Index)
const;
299 virtual void Assign (
double x,
double y,
double z);
306 virtual void Multiply (
double Value);
307 virtual void Divide (
double Value);
309 virtual double Get_Length (
void)
const;
313 virtual bool is_Equal (
double _x,
double _y,
double _z,
double epsilon = 0.)
const
315 return( fabs(
x - _x) <= epsilon && fabs(
y - _y) <= epsilon && fabs(
z - _z) <= epsilon );
328 bool Clear (
void) {
return( m_Points.Destroy() ); }
333 bool Add (
double x,
double y,
double z);
335 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
393 virtual void Assign (
double x,
double y,
double z,
double m);
400 virtual void Multiply (
double Value);
401 virtual void Divide (
double Value);
403 virtual double Get_Length (
void)
const;
407 virtual bool is_Equal (
double _x,
double _y,
double _z,
double _m,
double epsilon = 0.)
const
409 return( fabs(
x - _x) <= epsilon && fabs(
y - _y) <= epsilon && fabs(
z - _z) <= epsilon && fabs(
m - _m) <= epsilon );
434 bool Clear (
void) {
return( m_Points.Destroy() ); }
439 bool Add (
int x,
int y);
441 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
496 CSG_Rect & Assign (
double xMin,
double yMin,
double xMax,
double yMax);
500 CSG_Rect & Set_BottomLeft (
double x,
double y);
502 CSG_Rect & Set_TopRight (
double x,
double y);
523 CSG_Rect & Move (
double dx,
double dy);
526 CSG_Rect & Inflate (
double d,
bool bPercent =
true);
527 CSG_Rect & Deflate (
double d,
bool bPercent =
true);
528 CSG_Rect & Inflate (
double dx,
double dy,
bool bPercent =
true);
529 CSG_Rect & Deflate (
double dx,
double dy,
bool bPercent =
true);
531 CSG_Rect & Union (
double x,
double y);
534 bool Intersect (
const CSG_Rect &Rect);
536 bool is_Equal (
double xMin,
double yMin,
double xMax,
double yMax,
double epsilon = 0.)
const;
537 bool is_Equal (
const CSG_Rect &Rect ,
double epsilon = 0.)
const;
539 bool Contains (
double x,
double y)
const;
540 bool Contains (
const CSG_Point &Point)
const;
560 bool Add (
double xMin,
double yMin,
double xMax,
double yMax);
565 CSG_Rect & operator [] (
int Index) {
return( *m_Rects[Index] ); }
613 CSG_Rect_Int & Assign (
int xMin,
int yMin,
int xMax,
int yMax);
649 bool is_Equal (
int xMin,
int yMin,
int xMax,
int yMax)
const;
652 bool Contains (
double x,
double y)
const;
672 bool Add (
int xMin,
int yMin,
int xMax,
int yMax);
727 bool Set_IDW_Power (
double Value);
730 bool Set_IDW_Offset (
bool bOn =
true);
733 bool Set_BandWidth (
double Value);
743 switch( m_Weighting )
746 return( m_IDW_bOffset
747 ? pow(1. + Distance, -m_IDW_Power) : Distance > 0.
748 ? pow( Distance, -m_IDW_Power) : 0.
752 return( exp(-Distance / m_Bandwidth) );
755 Distance /= m_Bandwidth;
756 return( exp(-0.5 * Distance*Distance) );
768 double m_IDW_Power, m_Bandwidth;
841 bool Create (
const char *Definition);
845 bool Create (
const wchar_t *Definition);
853 bool Create (
int Code,
const SG_Char *Authority = NULL);
869 bool Set_GCS_WGS84 (
void);
871 static CSG_Projection Get_UTM_WGS84 (
int Zone,
bool bSouth =
false);
872 bool Set_UTM_WGS84 (
int Zone,
bool bSouth =
false);
883 CSG_String Get_Description (
bool bDetails =
false)
const;
899 int Get_EPSG (
void)
const {
return( m_Authority.CmpNoCase(
"EPSG") ? -1 : m_Code ); }
913 double Get_Unit_To_Meter (
void)
const;
924 CSG_String m_Name, m_Authority, m_PROJ, m_WKT2;
947 bool Create (
bool LoadCodeList =
true);
964 const SG_Char * Get_Projection (
int Code,
const SG_Char *Authority = NULL)
const;
989 bool m_bUseInternalDB =
true;
991 class CSG_Table *m_pProjections, *m_pPreferences;
994 void _On_Construction (
void);
1005 bool _Add_Preferences (
void);
1024 bool _Set_Dictionary (
void);
1025 bool _Set_Dictionary (
CSG_Table &Dictionary,
int Direction);
#define SAGA_API_DLL_EXPORT
SAGA_API_DLL_EXPORT CSG_String operator+(const char *A, const CSG_String &B)
CSG_Distance_Weighting(void)
static bool Add_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
double Get_IDW_Power(void) const
bool Create_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
static bool Enable_Parameters(class CSG_Parameters &Parameters)
bool Get_IDW_Offset(void) const
double Get_Weight(double Distance) const
bool Set_Parameters(class CSG_Parameters &Parameters)
double Get_BandWidth(void) const
TSG_Distance_Weighting Get_Weighting(void) const
CSG_Points & Get_Line(sLong Index)
sLong Get_Count(void) const
const CSG_Points & Get_Line(sLong Index) const
bool Create(const CSG_Lines &Lines)
bool Assign(const CSG_Lines &Lines)
virtual void Subtract(const CSG_Point_3D &Point)
virtual double Get_Distance(const CSG_Point_3D &Point) const
virtual ~CSG_Point_3D(void)
virtual void Assign(double x, double y, double z)
virtual void Multiply(const CSG_Point_3D &Point)
virtual bool is_Equal(const CSG_Point_3D &Point, double epsilon=0.) const
virtual TSG_Point_Type Get_Type(void) const
virtual bool is_Equal(double _x, double _y, double _z, double epsilon=0.) const
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 bool is_Equal(double _x, double _y, double _z, double _m, double epsilon=0.) const
virtual double Get_Distance(const CSG_Point_4D &Point) const
virtual void Add(const CSG_Point_4D &Point)
virtual TSG_Point_Type Get_Type(void) const
virtual bool is_Equal(const CSG_Point_4D &Point, double epsilon=0.) const
virtual void Divide(double Value)
virtual double Get_Length(void) const
virtual ~CSG_Point_4D(void)
virtual void Add(const CSG_Point &Point)
virtual bool is_Equal(double _x, double _y, double epsilon=0.) const
virtual TSG_Point_Type Get_Type(void) const
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 bool is_Equal(const CSG_Point &Point, double epsilon=0.) const
virtual double Get_Distance(const CSG_Point &Point) const
virtual double Get_Length(void) const
bool Set_Count(sLong nPoints)
bool Assign(const CSG_Points_3D &Points)
TSG_Point_3D * Get_Points(void) const
bool Add(const TSG_Point_3D &Point)
sLong Get_Count(void) const
sLong Get_Count(void) const
bool Add(const TSG_Point_Int &Point)
bool Assign(const CSG_Points_Int &Points)
bool Set_Count(sLong nPoints)
TSG_Point_Int * Get_Points(void) const
bool Set_Count(sLong nPoints)
TSG_Point * Get_Points(void) const
bool Assign(const CSG_Points &Points)
bool Add(const TSG_Point &Point)
sLong Get_Count(void) const
bool is_Geographic(void) const
const CSG_String & Get_Authority(void) const
friend class CSG_Projections
const CSG_String & Get_Name(void) const
bool is_Projection(void) const
const CSG_String & Get_Proj4(void) const
const CSG_String & Get_PROJ(void) const
ESG_CRS_Type Get_Type(void) const
const CSG_String & Get_WKT2(void) const
bool is_Equal(const CSG_Projection &Projection) const
bool Assign(const CSG_String &Definition)
bool Assign(const CSG_Projection &Projection)
int Get_Authority_ID(void) const
ESG_Projection_Unit Get_Unit(void) const
bool Assign(int Code, const SG_Char *Authority=NULL)
bool Create(const CSG_Projection &Projection)
bool is_Geocentric(void) const
const CSG_String & Get_WKT(void) const
bool is_Geodetic(void) const
bool Create(bool LoadCodeList=true)
bool Save(const CSG_String &File)
CSG_Projection Get_Projection(sLong Index) const
static bool Parse(const CSG_String &Definition, CSG_String *PROJ=NULL, CSG_String *WKT2=NULL, CSG_String *WKT1=NULL, CSG_String *JSON=NULL, CSG_String *ESRI=NULL)
sLong Get_Count(void) const
bool Add(const CSG_Projection &Projection)
bool Get_UseInternalDB(void) const
bool Load(const CSG_String &File, bool bAppend=false)
void Set_UseInternalDB(bool bUse=true)
friend class CSG_Projection
bool is_Equal(int xMin, int yMin, int xMax, int yMax) const
TSG_Point_Int Get_BottomRight(void) const
CSG_Rect_Int & Move(int dx, int dy)
int Get_YRange(void) const
double Get_Diameter(void) const
TSG_Point_Int Get_TopLeft(void) const
double Get_Area(void) const
CSG_Rect_Int & Assign(int xMin, int yMin, int xMax, int yMax)
int Get_XRange(void) const
bool Create(int xMin, int yMin, int xMax, int yMax)
bool Create(double xMin, double yMin, double xMax, double yMax)
double Get_Area(void) const
bool is_Equal(double xMin, double yMin, double xMax, double yMax, double epsilon=0.) const
double Get_YRange(void) const
CSG_Rect & Move(double dx, double dy)
double Get_YCenter(void) const
double Get_XMax(void) const
double Get_XRange(void) const
double Get_XMin(void) const
CSG_Point Get_TopLeft(void) const
double Get_YMin(void) const
double Get_XCenter(void) const
double Get_YMax(void) const
CSG_Point Get_BottomRight(void) const
double Get_Diameter(void) const
CSG_Point Get_Center(void) const
CSG_Rect & Assign(double xMin, double yMin, double xMax, double yMax)
CSG_Rect_Int & Get_Rect(int Index)
bool Assign(const CSG_Rects_Int &Rects)
int Get_Count(void) const
CSG_Rect & Get_Rect(int Index)
bool Assign(const CSG_Rects &Rects)
int Get_Count(void) const
CSG_Vector operator*(double Scalar, const CSG_Vector &Vector)