|
SAGA API
v9.6
|
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;
175 virtual bool is_Equal (
double _x,
double _y,
double epsilon = 0.)
const
177 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon );
190 bool Clear (
void) {
return( m_Points.Destroy() ); }
195 bool Add (
double x,
double y);
197 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
205 const TSG_Point & operator [] (
sLong Index)
const {
return( Get_Points()[Index] ); }
225 bool Create (
sLong nLines);
236 bool Del (
sLong Index);
238 bool Set_Count (
sLong nLines);
247 double Get_Length (
void)
const;
248 double Get_Length (
sLong Index)
const;
282 virtual bool operator == (
const CSG_Point_3D &Point)
const {
return( is_Equal(Point) ); }
283 virtual bool operator != (
const CSG_Point_3D &Point)
const {
return( !is_Equal(Point) ); }
295 virtual CSG_Point_3D & operator *= (
double Value) { Multiply(Value);
return( *
this ); }
296 virtual CSG_Point_3D & operator /= (
double Value) { Divide (Value);
return( *
this ); }
298 virtual void Assign (
double x,
double y,
double z);
305 virtual void Multiply (
double Value);
306 virtual void Divide (
double Value);
308 virtual double Get_Length (
void)
const;
311 virtual bool is_Equal (
double _x,
double _y,
double _z,
double epsilon = 0.)
const
313 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon );
326 bool Clear (
void) {
return( m_Points.Destroy() ); }
331 bool Add (
double x,
double y,
double z);
333 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
375 virtual bool operator == (
const CSG_Point_4D &Point)
const {
return( is_Equal(Point) ); }
376 virtual bool operator != (
const CSG_Point_4D &Point)
const {
return( !is_Equal(Point) ); }
383 virtual CSG_Point_4D & operator *= (
double Value) { Multiply(Value);
return( *
this ); }
384 virtual CSG_Point_4D & operator /= (
double Value) { Divide (Value);
return( *
this ); }
391 virtual void Assign (
double x,
double y,
double z,
double m);
398 virtual void Multiply (
double Value);
399 virtual void Divide (
double Value);
401 virtual double Get_Length (
void)
const;
404 virtual bool is_Equal (
double _x,
double _y,
double _z,
double _m,
double epsilon = 0.)
const
406 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon && fabs(m - _m) <= epsilon );
431 bool Clear (
void) {
return( m_Points.Destroy() ); }
436 bool Add (
int x,
int y);
438 bool Del (
sLong Index) {
return( m_Points.Del_Entry(Index) ); }
477 CSG_Rect(
double xMin,
double yMin,
double xMax,
double yMax);
481 bool Create (
double xMin,
double yMin,
double xMax,
double yMax);
485 bool operator == (
const CSG_Rect &Rect)
const {
return( is_Equal(Rect) ); }
486 bool operator != (
const CSG_Rect &Rect)
const {
return( !is_Equal(Rect) ); }
493 CSG_Rect & Assign (
double xMin,
double yMin,
double xMax,
double yMax);
497 CSG_Rect & Set_BottomLeft (
double x,
double y);
499 CSG_Rect & Set_TopRight (
double x,
double y);
510 double Get_Area (
void)
const {
return( Get_XRange() * Get_YRange() ); }
511 double Get_Diameter (
void)
const {
return( sqrt(Get_XRange()*Get_XRange() + Get_YRange()*Get_YRange()) ); }
520 CSG_Rect & Move (
double dx,
double dy);
523 CSG_Rect & Inflate (
double d,
bool bPercent =
true);
524 CSG_Rect & Deflate (
double d,
bool bPercent =
true);
525 CSG_Rect & Inflate (
double dx,
double dy,
bool bPercent =
true);
526 CSG_Rect & Deflate (
double dx,
double dy,
bool bPercent =
true);
528 CSG_Rect & Union (
double x,
double y);
531 bool Intersect (
const CSG_Rect &Rect);
533 bool is_Equal (
double xMin,
double yMin,
double xMax,
double yMax,
double epsilon = 0.)
const;
534 bool is_Equal (
const CSG_Rect &Rect ,
double epsilon = 0.)
const;
536 bool Contains (
double x,
double y)
const;
537 bool Contains (
const CSG_Point &Point)
const;
557 bool Add (
double xMin,
double yMin,
double xMax,
double yMax);
562 CSG_Rect & operator [] (
int Index) {
return( *m_Rects[Index] ); }
598 bool Create (
int xMin,
int yMin,
int xMax,
int yMax);
602 bool operator == (
const CSG_Rect_Int &Rect)
const {
return( is_Equal(Rect) ); }
603 bool operator != (
const CSG_Rect_Int &Rect)
const {
return( !is_Equal(Rect) ); }
610 CSG_Rect_Int & Assign (
int xMin,
int yMin,
int xMax,
int yMax);
627 double Get_Area (
void)
const {
return( ((
double)Get_XRange() * (
double)Get_YRange()) ); }
628 double Get_Diameter (
void)
const {
double x = (double)xMax - xMin, y = (
double)yMax -
yMin;
return( sqrt(x*x + y*y) ); }
646 bool is_Equal (
int xMin,
int yMin,
int xMax,
int yMax)
const;
649 bool Contains (
double x,
double y)
const;
669 bool Add (
int xMin,
int yMin,
int xMax,
int yMax);
717 static bool Add_Parameters (
class CSG_Parameters &Parameters,
const CSG_String &Parent =
"",
bool bIDW_Offset =
false);
724 bool Set_IDW_Power (
double Value);
727 bool Set_IDW_Offset (
bool bOn =
true);
730 bool Set_BandWidth (
double Value);
740 switch( m_Weighting )
743 return( m_IDW_bOffset
744 ? pow(1. + Distance, -m_IDW_Power) : Distance > 0.
745 ? pow( Distance, -m_IDW_Power) : 0.
749 return( exp(-Distance / m_Bandwidth) );
752 Distance /= m_Bandwidth;
753 return( exp(-0.5 * Distance*Distance) );
765 double m_IDW_Power, m_Bandwidth;
781 WKT1, WKT2, PROJ, JSON, ESRI, CODE,
Undefined,
WKT = WKT1
787 Geographic, Geodetic, Geocentric, Projection,
Undefined
838 bool Create (
const char *Definition);
842 bool Create (
const wchar_t *Definition);
859 bool operator == (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
true ); }
860 bool operator != (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
false ); }
863 bool Set_GCS_WGS84 (
void);
865 static CSG_Projection Get_UTM_WGS84 (
int Zone,
bool bSouth =
false);
866 bool Set_UTM_WGS84 (
int Zone,
bool bSouth =
false);
877 CSG_String Get_Description (
bool bDetails =
false)
const;
893 int Get_EPSG (
void)
const {
return( m_Authority.CmpNoCase(
"EPSG") ? -1 : m_Code ); }
895 bool is_Geographic (
void)
const {
return( m_Type == ESG_CRS_Type::Geographic ); }
896 bool is_Geodetic (
void)
const {
return( m_Type == ESG_CRS_Type::Geodetic ); }
897 bool is_Geocentric (
void)
const {
return( m_Type == ESG_CRS_Type::Geocentric ); }
898 bool is_Projection (
void)
const {
return( m_Type == ESG_CRS_Type::Projection ); }
918 CSG_String m_Name, m_Authority, m_PROJ, m_WKT2;
941 bool Create (
bool LoadCodeList =
true);
954 sLong Get_Count (
void)
const;
958 const SG_Char * Get_Projection (
int Code,
const SG_Char *Authority = NULL)
const;
980 class CSG_Table *m_pProjections, *m_pPreferences;
994 bool _Add_Preferences (
void);
1013 bool _Set_Dictionary (
void);
1014 bool _Set_Dictionary (
CSG_Table &Dictionary,
int Direction);
1086 #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
sLong Get_Count(void) 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
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
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
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)
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)