![Logo](saga_icon_64.png) |
SAGA API
v9.7
|
Go to the documentation of this file.
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)))
113 SG_POINT_TYPE_2D = 0,
146 virtual bool operator == (
const CSG_Point &Point)
const {
return( is_Equal(Point) ); }
147 virtual bool operator != (
const CSG_Point &Point)
const {
return( !is_Equal(Point) ); }
159 virtual CSG_Point & operator *= (
double Value) { Multiply(Value);
return( *
this ); }
160 virtual CSG_Point & operator /= (
double Value) { Divide (Value);
return( *
this ); }
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) ); }
206 const TSG_Point & operator [] (
sLong Index)
const {
return( Get_Points()[Index] ); }
226 bool Create (
sLong nLines);
237 bool Del (
sLong Index);
239 bool Set_Count (
sLong nLines);
248 double Get_Length (
void)
const;
249 double Get_Length (
sLong Index)
const;
283 virtual bool operator == (
const CSG_Point_3D &Point)
const {
return( is_Equal(Point) ); }
284 virtual bool operator != (
const CSG_Point_3D &Point)
const {
return( !is_Equal(Point) ); }
296 virtual CSG_Point_3D & operator *= (
double Value) { Multiply(Value);
return( *
this ); }
297 virtual CSG_Point_3D & operator /= (
double Value) { Divide (Value);
return( *
this ); }
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) ); }
377 virtual bool operator == (
const CSG_Point_4D &Point)
const {
return( is_Equal(Point) ); }
378 virtual bool operator != (
const CSG_Point_4D &Point)
const {
return( !is_Equal(Point) ); }
385 virtual CSG_Point_4D & operator *= (
double Value) { Multiply(Value);
return( *
this ); }
386 virtual CSG_Point_4D & operator /= (
double Value) { Divide (Value);
return( *
this ); }
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) ); }
480 CSG_Rect(
double xMin,
double yMin,
double xMax,
double yMax);
484 bool Create (
double xMin,
double yMin,
double xMax,
double yMax);
488 bool operator == (
const CSG_Rect &Rect)
const {
return( is_Equal(Rect) ); }
489 bool operator != (
const CSG_Rect &Rect)
const {
return( !is_Equal(Rect) ); }
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);
513 double Get_Area (
void)
const {
return( Get_XRange() * Get_YRange() ); }
514 double Get_Diameter (
void)
const {
return( sqrt(Get_XRange()*Get_XRange() + Get_YRange()*Get_YRange()) ); }
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] ); }
601 bool Create (
int xMin,
int yMin,
int xMax,
int yMax);
605 bool operator == (
const CSG_Rect_Int &Rect)
const {
return( is_Equal(Rect) ); }
606 bool operator != (
const CSG_Rect_Int &Rect)
const {
return( !is_Equal(Rect) ); }
613 CSG_Rect_Int & Assign (
int xMin,
int yMin,
int xMax,
int yMax);
630 double Get_Area (
void)
const {
return( ((
double)Get_XRange() * (
double)Get_YRange()) ); }
631 double Get_Diameter (
void)
const {
double x = (double)xMax - xMin, y = (
double)yMax -
yMin;
return( sqrt(x*x + y*y) ); }
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);
720 static bool Add_Parameters (
class CSG_Parameters &Parameters,
const CSG_String &Parent =
"",
bool bIDW_Offset =
false);
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;
784 WKT1, WKT2, PROJ, JSON, ESRI, CODE,
Undefined,
WKT = WKT1
790 Geographic, Geodetic, Geocentric, Projection,
Undefined
841 bool Create (
const char *Definition);
845 bool Create (
const wchar_t *Definition);
865 bool operator == (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
true ); }
866 bool operator != (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
false ); }
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 ); }
901 bool is_Geographic (
void)
const {
return( m_Type == ESG_CRS_Type::Geographic ); }
902 bool is_Geodetic (
void)
const {
return( m_Type == ESG_CRS_Type::Geodetic ); }
903 bool is_Geocentric (
void)
const {
return( m_Type == ESG_CRS_Type::Geocentric ); }
904 bool is_Projection (
void)
const {
return( m_Type == ESG_CRS_Type::Projection ); }
924 CSG_String m_Name, m_Authority, m_PROJ, m_WKT2;
947 bool Create (
bool LoadCodeList =
true);
960 sLong Get_Count (
void)
const;
964 const SG_Char * Get_Projection (
int Code,
const SG_Char *Authority = NULL)
const;
986 class CSG_Table *m_pProjections, *m_pPreferences;
1000 bool _Add_Preferences (
void);
1019 bool _Set_Dictionary (
void);
1020 bool _Set_Dictionary (
CSG_Table &Dictionary,
int Direction);
1092 #endif // #ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
virtual TSG_Point_Type Get_Type(void) const
bool Create(bool LoadCodeList=true)
bool Add(const TSG_Point_3D &Point)
bool Save(const CSG_String &File, ESG_CRS_Format Format=ESG_CRS_Format::WKT) const
bool Assign(const CSG_Projection &Projection)
TSG_Point_Int * Get_Points(void) const
virtual bool is_Equal(double _x, double _y, double _z, double _m, double epsilon=0.) const
virtual TSG_Point_Type Get_Type(void) const
virtual bool is_Equal(const CSG_Point_4D &Point, double epsilon=0.) const
virtual double Get_Length(void) const
sLong Get_Count(void) const
virtual double Get_Distance(const CSG_Point &Point) const
bool Assign(const CSG_String &Definition)
double Get_XMax(void) const
CSG_String Get_Unit_Name(void) const
ESG_Projection_Unit Get_Unit(void) const
CSG_Point Get_TopLeft(void) const
virtual double Get_Length(void) const
bool Set_Count(sLong nPoints)
int Get_Count(void) const
friend class CSG_Projection
int Get_XRange(void) const
sLong Get_Count(void) const
virtual TSG_Point_Type Get_Type(void) const
bool is_Geographic(void) const
virtual bool is_Equal(double _x, double _y, double _z, double epsilon=0.) const
static double Get_Unit_To_Meter(ESG_Projection_Unit Unit)
CSG_Rect & Get_Rect(int Index)
double Get_Area(void) const
const CSG_String & Get_WKT(void) const
friend class CSG_Projections
double Get_Weight(double Distance) const
TSG_Point_Int Get_TopLeft(void) const
double Get_Diameter(void) const
virtual ~CSG_Point_4D(void)
bool Add(const TSG_Point &Point)
double Get_XRange(void) const
double Get_YMin(void) const
bool Add(const TSG_Point_Int &Point)
int Get_Count(void) const
const CSG_String & Get_Name(void) const
sLong Get_Count(void) const
CSG_String Get_Unit_Identifier(void) const
virtual double Get_Distance(const CSG_Point_3D &Point) const
bool Load(const CSG_String &File, bool bAppend=false)
TSG_Point_Int Get_BottomRight(void) const
int Get_Authority_ID(void) const
const CSG_String & Get_Proj4(void) const
ESG_CRS_Type Get_Type(void) const
virtual double Get_Length(void) const
TSG_Point_3D * Get_Points(void) const
const CSG_Points & Get_Line(sLong Index) const
#define SAGA_API_DLL_EXPORT
double Get_BandWidth(void) const
sLong Get_Count(void) const
bool Load(const CSG_String &File)
virtual bool is_Equal(double _x, double _y, double epsilon=0.) const
const CSG_String & Get_PROJ(void) const
CSG_Point Get_BottomRight(void) const
double Get_Diameter(void) const
CSG_Rect_Int & Get_Rect(int Index)
bool Assign(int Code, const SG_Char *Authority=NULL)
bool Set_Count(sLong nPoints)
virtual ~CSG_Point_3D(void)
const CSG_String & Get_WKT2(void) const
double Get_IDW_Power(void) const
CSG_Point Get_Center(void) const
int Get_YRange(void) const
static const CSG_String Get_Unit_Name(ESG_Projection_Unit Unit, bool bSimple=true)
double Get_Unit_To_Meter(void) const
bool is_Projection(void) const
double Get_XCenter(void) const
double Get_YMax(void) const
virtual bool is_Equal(const CSG_Point_3D &Point, double epsilon=0.) const
double Get_XMin(void) const
static const CSG_String Get_Unit_Identifier(ESG_Projection_Unit Unit)
bool is_Geocentric(void) const
double Get_YCenter(void) const
bool is_Geodetic(void) const
CSG_Points & Get_Line(sLong Index)
virtual double Get_Distance(const CSG_Point_4D &Point) const
TSG_Point * Get_Points(void) const
bool Set_Count(sLong nPoints)
CSG_Vector operator*(double Scalar, const CSG_Vector &Vector)
bool Save(const CSG_String &File)
const CSG_String & Get_Authority(void) const
bool Create(const CSG_Projection &Projection)
virtual bool is_Equal(const CSG_Point &Point, double epsilon=0.) const
TSG_Distance_Weighting Get_Weighting(void) const
double Get_Area(void) const
double Get_YRange(void) const
bool Get_IDW_Offset(void) const
virtual void _On_Construction(void)
SAGA_API_DLL_EXPORT CSG_String operator+(const char *A, const CSG_String &B)