 |
SAGA API
v9.2
|
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 operator == (
const CSG_Rect &Rect)
const;
482 bool operator != (
const CSG_Rect &Rect)
const;
485 void operator += (
const CSG_Point &Point);
486 void operator -= (
const CSG_Point &Point);
488 void Assign (
double xMin,
double yMin,
double xMax,
double yMax);
492 void Set_BottomLeft (
double x,
double y);
493 void Set_BottomLeft (
const CSG_Point &Point);
494 void Set_TopRight (
double x,
double y);
495 void Set_TopRight (
const CSG_Point &Point);
497 bool is_Equal (
double xMin,
double yMin,
double xMax,
double yMax,
double epsilon = 0.)
const;
498 bool is_Equal (
const CSG_Rect &Rect ,
double epsilon = 0.)
const;
508 double Get_Area (
void)
const {
return( Get_XRange() * Get_YRange() ); }
509 double Get_Diameter (
void)
const {
return( sqrt(Get_XRange()*Get_XRange() + Get_YRange()*Get_YRange()) ); }
518 void Move (
double dx,
double dy);
521 void Inflate (
double d,
bool bPercent =
true);
522 void Deflate (
double d,
bool bPercent =
true);
523 void Inflate (
double dx,
double dy,
bool bPercent =
true);
524 void Deflate (
double dx,
double dy,
bool bPercent =
true);
526 void Union (
double x,
double y);
529 bool Intersect (
const CSG_Rect &Rect);
533 bool Contains (
double x,
double y)
const;
534 bool Contains (
const CSG_Point &Point)
const;
552 bool Add (
double xMin,
double yMin,
double xMax,
double yMax);
557 CSG_Rect & operator [] (
int Index) {
return( *m_Rects[Index] ); }
600 void Assign (
int xMin,
int yMin,
int xMax,
int yMax);
604 void Set_BottomLeft (
int x,
int y);
606 void Set_TopRight (
int x,
int y);
609 bool is_Equal (
int xMin,
int yMin,
int xMax,
int yMax)
const;
620 double Get_Area (
void)
const {
return( ((
double)Get_XRange() * (
double)Get_YRange()) ); }
621 double Get_Diameter (
void)
const {
double x = (double)xMax - xMin, y = (
double)yMax -
yMin;
return( sqrt(x*x + y*y) ); }
626 void Move (
int dx,
int dy);
629 void Inflate (
int d);
630 void Deflate (
int d);
631 void Inflate (
int dx,
int dy);
632 void Deflate (
int dx,
int dy);
634 void Union (
int x,
int y);
641 bool Contains (
double x,
double y)
const;
659 bool Add (
int xMin,
int yMin,
int xMax,
int yMax);
707 static bool Add_Parameters (
class CSG_Parameters &Parameters,
const CSG_String &Parent =
"",
bool bIDW_Offset =
false);
714 bool Set_IDW_Power (
double Value);
717 bool Set_IDW_Offset (
bool bOn =
true);
720 bool Set_BandWidth (
double Value);
730 switch( m_Weighting )
733 return( m_IDW_bOffset
734 ? pow(1. + Distance, -m_IDW_Power) : Distance > 0.
735 ? pow( Distance, -m_IDW_Power) : 0.
739 return( exp(-Distance / m_Bandwidth) );
742 Distance /= m_Bandwidth;
743 return( exp(-0.5 * Distance*Distance) );
755 double m_IDW_Power, m_Bandwidth;
848 bool Create (
int Authority_ID,
const SG_Char *Authority = NULL);
849 bool Assign (
int Authority_ID,
const SG_Char *Authority = NULL);
850 CSG_Projection & operator = (
int Authority_ID) { Assign(Authority_ID);
return( *
this ); }
863 bool operator == (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
true ); }
864 bool operator != (
const CSG_Projection &Projection)
const {
return( is_Equal(Projection) ==
false ); }
866 bool Set_GCS_WGS84 (
void);
867 bool Set_UTM_WGS84 (
int Zone,
bool bSouth =
false);
883 int Get_EPSG (
void)
const {
return( m_Authority.Cmp(
"EPSG") ? -1 : m_Authority_ID ); }
906 double m_Unit_To_Meter;
912 CSG_String m_Name, m_WKT, m_Proj4, m_Authority, m_Unit_Name;
936 bool Create (
bool bLoad_DB =
true);
943 bool Reset_Dictionary (
void);
944 bool Load_Dictionary (
const CSG_String &FileName);
945 bool Save_Dictionary (
const CSG_String &FileName);
947 bool Load_DB (
const CSG_String &FileName,
bool bAppend =
false);
950 sLong Get_Count (
void)
const;
958 bool Get_Projection (
CSG_Projection &Projection,
int EPSG_ID )
const;
968 bool EPSG_to_Proj4 (
CSG_String &Proj4,
int EPSG_Code)
const;
969 bool EPSG_to_WKT (
CSG_String &WKT ,
int EPSG_Code)
const;
972 static CSG_Projection Get_UTM_WGS84 (
int Zone,
bool bSouth =
false);
995 bool _Set_Dictionary (
CSG_Table &Dictionary,
int Direction);
1068 #endif // #ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
virtual TSG_Point_Type Get_Type(void) const
bool Add(const TSG_Point_3D &Point)
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 Create(bool bLoad_DB=true)
double Get_XMax(void) const
CSG_String Get_Unit_Name(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
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
TSG_Projection_Unit Get_Unit(void) const
virtual ~CSG_Point_4D(void)
bool Add(const TSG_Point &Point)
TSG_Projection_Type Get_Type(void) const
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
TSG_Point_Int Get_BottomRight(void) const
int Get_Authority_ID(void) const
const CSG_String & Get_Proj4(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
virtual bool is_Equal(double _x, double _y, double epsilon=0.) const
CSG_Point Get_BottomRight(void) const
CSG_String Get_Type_Name(void) const
double Get_Diameter(void) const
CSG_Rect_Int & Get_Rect(int Index)
bool Set_Count(sLong nPoints)
virtual ~CSG_Point_3D(void)
CSG_String Get_Type_Identifier(void) const
double Get_IDW_Power(void) const
CSG_Point Get_Center(void) const
int Get_YRange(void) const
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
bool is_Geocentric(void) const
double Get_YCenter(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)
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)