SAGA API  v9.5
geo_tools.h
Go to the documentation of this file.
1 
3 // //
4 // SAGA //
5 // //
6 // System for Automated Geoscientific Analyses //
7 // //
8 // Application Programming Interface //
9 // //
10 // Library: SAGA_API //
11 // //
12 //-------------------------------------------------------//
13 // //
14 // geo_tools.h //
15 // //
16 // Copyright (C) 2005 by Olaf Conrad //
17 // //
18 //-------------------------------------------------------//
19 // //
20 // This file is part of 'SAGA - System for Automated //
21 // Geoscientific Analyses'. //
22 // //
23 // This library is free software; you can redistribute //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free //
26 // Software Foundation, either version 2.1 of the //
27 // License, or (at your option) any later version. //
28 // //
29 // This library is distributed in the hope that it will //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details. //
34 // //
35 // You should have received a copy of the GNU Lesser //
36 // General Public License along with this program; if //
37 // not, see <http://www.gnu.org/licenses/>. //
38 // //
39 //-------------------------------------------------------//
40 // //
41 // contact: Olaf Conrad //
42 // Institute of Geography //
43 // University of Goettingen //
44 // Goldschmidtstr. 5 //
45 // 37077 Goettingen //
46 // Germany //
47 // //
48 // e-mail: oconrad@saga-gis.org //
49 // //
51 
52 //---------------------------------------------------------
53 #ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
54 #define HEADER_INCLUDED__SAGA_API__geo_tools_H
55 
56 
58 // //
59 // //
60 // //
62 
63 //---------------------------------------------------------
72 // //
74 // //
75 // //
77 
78 //---------------------------------------------------------
79 #include "api_core.h"
80 #include "metadata.h"
81 
82 
84 // //
85 // //
86 // //
88 
89 //---------------------------------------------------------
90 #define SG_IS_BETWEEN(a, x, b) (((a) <= (x) && (x) <= (b)) || ((b) <= (x) && (x) <= (a)))
91 
92 
94 // //
95 // //
96 // //
98 
99 //---------------------------------------------------------
100 typedef enum
101 {
107 }
109 
110 //---------------------------------------------------------
111 enum class TSG_Point_Type
112 {
113  SG_POINT_TYPE_2D = 0,
114  SG_POINT_TYPE_3D,
115  SG_POINT_TYPE_4D,
117 };
118 
119 
121 // //
122 // //
123 // //
125 
126 //---------------------------------------------------------
127 typedef struct SSG_Point
128 {
129  double x, y;
130 }
132 
133 //---------------------------------------------------------
135 {
136 public:
137  CSG_Point(void);
138  CSG_Point(const CSG_Point &Point);
139  CSG_Point(const TSG_Point &Point);
140  CSG_Point(double x, double y);
141 
142  virtual ~CSG_Point(void) {}
143 
144  virtual TSG_Point_Type Get_Type (void) const { return( TSG_Point_Type::SG_POINT_TYPE_2D ); }
145 
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) ); }
148 
149  virtual CSG_Point operator + (const CSG_Point &Point) const { return( CSG_Point(x + Point.x, y + Point.y) ); }
150  virtual CSG_Point operator - (const CSG_Point &Point) const { return( CSG_Point(x - Point.x, y - Point.y) ); }
151 
152  virtual CSG_Point & operator = (const CSG_Point &Point) { Assign (Point); return( *this ); }
153  virtual CSG_Point & operator += (const CSG_Point &Point) { Add (Point); return( *this ); }
154  virtual CSG_Point & operator -= (const CSG_Point &Point) { Subtract(Point); return( *this ); }
155  virtual CSG_Point & operator *= (const CSG_Point &Point) { Multiply(Point); return( *this ); }
156 
157  CSG_Point operator * (double Value) const { return( CSG_Point(x * Value, y * Value) ); }
158  CSG_Point operator / (double Value) const { return( CSG_Point(x / Value, y / Value) ); }
159  virtual CSG_Point & operator *= (double Value) { Multiply(Value); return( *this ); }
160  virtual CSG_Point & operator /= (double Value) { Divide (Value); return( *this ); }
161 
162  virtual void Assign (double x, double y);
163  virtual void Assign (const CSG_Point &Point);
164 
165  virtual void Add (const CSG_Point &Point);
166  virtual void Subtract (const CSG_Point &Point);
167  virtual void Multiply (const CSG_Point &Point);
168 
169  virtual void Multiply (double Value);
170  virtual void Divide (double Value);
171 
172  virtual double Get_Length (void) const;
173 
174  virtual bool is_Equal (const CSG_Point &Point, double epsilon = 0.) const { return( is_Equal(Point.x, Point.y, epsilon) ); }
175  virtual bool is_Equal (double _x, double _y, double epsilon = 0.) const
176  {
177  return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon );
178  }
179 
180 };
181 
182 //---------------------------------------------------------
184 {
185 public:
186  CSG_Points(void);
187  CSG_Points(const CSG_Points &Points);
188  CSG_Points(sLong nPoints, TSG_Array_Growth Growth = TSG_Array_Growth::SG_ARRAY_GROWTH_1);
189 
190  bool Clear (void) { return( m_Points.Destroy() ); }
191 
192  CSG_Points & operator = (const CSG_Points &Points) { Assign(Points); return( *this ); }
193  bool Assign (const CSG_Points &Points);
194 
195  bool Add (double x, double y);
196  bool Add (const TSG_Point &Point) { return( Add(Point.x, Point.y) ); }
197  bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
198 
199  bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
200  sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
201 
202  TSG_Point * Get_Points (void) const { return( (TSG_Point *)m_Points.Get_Array() ); }
203 
204  TSG_Point & operator [] (sLong Index) { return( Get_Points()[Index] ); }
205  const TSG_Point & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
206 
207 
208 private:
209 
210  CSG_Array m_Points;
211 
212 };
213 
214 //---------------------------------------------------------
216 {
217 public:
218  CSG_Lines(void);
219  virtual ~CSG_Lines(void);
220 
221  CSG_Lines (const CSG_Lines &Lines);
222  bool Create (const CSG_Lines &Lines);
223 
224  CSG_Lines (sLong nLines);
225  bool Create (sLong nLines);
226 
227  bool Destroy (void);
228  bool Clear (void);
229 
230  CSG_Lines & operator = (const CSG_Lines &Lines) { Assign(Lines); return( *this ); }
231  bool Assign (const CSG_Lines &Lines);
232 
233  CSG_Points & Add (void);
234  bool Add (const CSG_Points &Line);
235  bool Add (const CSG_Lines &Lines);
236  bool Del (sLong Index);
237 
238  bool Set_Count (sLong nLines);
239  sLong Get_Count (void) const { return( m_Lines.Get_Size() ); }
240 
241  CSG_Points & Get_Line (sLong Index) { return( *((CSG_Points *)m_Lines[Index]) ); }
242  const CSG_Points & Get_Line (sLong Index) const { return( *((CSG_Points *)m_Lines[Index]) ); }
243 
244  CSG_Points & operator [] (sLong Index) { return( Get_Line(Index) ); }
245  const CSG_Points & operator [] (sLong Index) const { return( Get_Line(Index) ); }
246 
247  double Get_Length (void) const;
248  double Get_Length (sLong Index) const;
249 
250 
251 private:
252 
253  CSG_Array_Pointer m_Lines;
254 
255 };
256 
257 
259 // //
261 
262 //---------------------------------------------------------
263 typedef struct SSG_Point_3D
264 {
265  double x, y, z;
266 }
268 
269 //---------------------------------------------------------
271 {
272 public:
273  CSG_Point_3D(void);
274  CSG_Point_3D(const CSG_Point_3D &Point);
275  CSG_Point_3D(const TSG_Point_3D &Point);
276  CSG_Point_3D(double x, double y, double z);
277 
278  virtual ~CSG_Point_3D(void) {}
279 
280  virtual TSG_Point_Type Get_Type (void) const { return( TSG_Point_Type::SG_POINT_TYPE_3D ); }
281 
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) ); }
284 
285  virtual CSG_Point_3D operator + (const CSG_Point_3D &Point) const { return( CSG_Point_3D(x + Point.x, y + Point.y, z + Point.z) ); }
286  virtual CSG_Point_3D operator - (const CSG_Point_3D &Point) const { return( CSG_Point_3D(x - Point.x, y - Point.y, z - Point.z) ); }
287 
288  virtual CSG_Point_3D & operator = (const CSG_Point_3D &Point) { Assign (Point); return( *this ); }
289  virtual CSG_Point_3D & operator += (const CSG_Point_3D &Point) { Add (Point); return( *this ); }
290  virtual CSG_Point_3D & operator -= (const CSG_Point_3D &Point) { Subtract(Point); return( *this ); }
291  virtual CSG_Point_3D & operator *= (const CSG_Point_3D &Point) { Multiply(Point); return( *this ); }
292 
293  CSG_Point_3D operator * (double Value) const { return( CSG_Point_3D(x * Value, y * Value, z * Value) ); }
294  CSG_Point_3D operator / (double Value) const { return( CSG_Point_3D(x / Value, y / Value, z / Value) ); }
295  virtual CSG_Point_3D & operator *= (double Value) { Multiply(Value); return( *this ); }
296  virtual CSG_Point_3D & operator /= (double Value) { Divide (Value); return( *this ); }
297 
298  virtual void Assign (double x, double y, double z);
299  virtual void Assign (const CSG_Point_3D &Point);
300 
301  virtual void Add (const CSG_Point_3D &Point);
302  virtual void Subtract (const CSG_Point_3D &Point);
303  virtual void Multiply (const CSG_Point_3D &Point);
304 
305  virtual void Multiply (double Value);
306  virtual void Divide (double Value);
307 
308  virtual double Get_Length (void) const;
309 
310  virtual bool is_Equal (const CSG_Point_3D &Point , double epsilon = 0.) const { return( is_Equal(Point.x, Point.y, Point.y, epsilon) ); }
311  virtual bool is_Equal (double _x, double _y, double _z, double epsilon = 0.) const
312  {
313  return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon );
314  }
315 
316 };
317 
318 //---------------------------------------------------------
320 {
321 public:
322  CSG_Points_3D(void);
323  CSG_Points_3D(const CSG_Points_3D &Points);
324  CSG_Points_3D(sLong nPoints, TSG_Array_Growth Growth = TSG_Array_Growth::SG_ARRAY_GROWTH_1);
325 
326  bool Clear (void) { return( m_Points.Destroy() ); }
327 
328  CSG_Points_3D & operator = (const CSG_Points_3D &Points) { Assign(Points); return( *this ); }
329  bool Assign (const CSG_Points_3D &Points);
330 
331  bool Add (double x, double y, double z);
332  bool Add (const TSG_Point_3D &Point) { return( Add(Point.x, Point.y, Point.z) ); }
333  bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
334 
335  bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
336  sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
337 
338  TSG_Point_3D * Get_Points (void) const { return( (TSG_Point_3D *)m_Points.Get_Array() ); }
339 
340  TSG_Point_3D & operator [] (sLong Index) { return( Get_Points()[Index] ); }
341  const TSG_Point_3D & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
342 
343 
344 private:
345 
346  CSG_Array m_Points;
347 
348 };
349 
350 
352 // //
354 
355 //---------------------------------------------------------
356 typedef struct SSG_Point_4D
357 {
358  double x, y, z, m;
359 }
361 
362 //---------------------------------------------------------
364 {
365 public:
366  CSG_Point_4D(void);
367  CSG_Point_4D(const CSG_Point_4D &Point);
368  CSG_Point_4D(const TSG_Point_4D &Point);
369  CSG_Point_4D(double x, double y, double z, double m);
370 
371  virtual ~CSG_Point_4D(void) {}
372 
373  virtual TSG_Point_Type Get_Type (void) const { return( TSG_Point_Type::SG_POINT_TYPE_4D ); }
374 
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) ); }
377 
378  virtual CSG_Point_4D operator + (const CSG_Point_4D &Point) const { return( CSG_Point_4D(x + Point.x, y + Point.y, z + Point.z, m + Point.m) ); }
379  virtual CSG_Point_4D operator - (const CSG_Point_4D &Point) const { return( CSG_Point_4D(x - Point.x, y - Point.y, z - Point.z, m - Point.m) ); }
380 
381  CSG_Point_4D operator * (double Value) const { return( CSG_Point_4D(x * Value, y * Value, z * Value, m * Value) ); }
382  CSG_Point_4D operator / (double Value) const { return( CSG_Point_4D(x / Value, y / Value, z / Value, m * Value) ); }
383  virtual CSG_Point_4D & operator *= (double Value) { Multiply(Value); return( *this ); }
384  virtual CSG_Point_4D & operator /= (double Value) { Divide (Value); return( *this ); }
385 
386  virtual CSG_Point_4D & operator = (const CSG_Point_4D &Point) { Assign (Point); return( *this ); }
387  virtual CSG_Point_4D & operator += (const CSG_Point_4D &Point) { Add (Point); return( *this ); }
388  virtual CSG_Point_4D & operator -= (const CSG_Point_4D &Point) { Subtract(Point); return( *this ); }
389  virtual CSG_Point_4D & operator *= (const CSG_Point_4D &Point) { Multiply(Point); return( *this ); }
390 
391  virtual void Assign (double x, double y, double z, double m);
392  virtual void Assign (const CSG_Point_4D &Point);
393 
394  virtual void Add (const CSG_Point_4D &Point);
395  virtual void Subtract (const CSG_Point_4D &Point);
396  virtual void Multiply (const CSG_Point_4D &Point);
397 
398  virtual void Multiply (double Value);
399  virtual void Divide (double Value);
400 
401  virtual double Get_Length (void) const;
402 
403  virtual bool is_Equal (const CSG_Point_4D &Point , double epsilon = 0.) const { return( is_Equal(Point.x, Point.y, Point.y, Point.m, epsilon) ); }
404  virtual bool is_Equal (double _x, double _y, double _z, double _m, double epsilon = 0.) const
405  {
406  return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon && fabs(m - _m) <= epsilon );
407  }
408 
409 };
410 
411 
413 // //
415 
416 //---------------------------------------------------------
417 typedef struct SSG_Point_Int
418 {
419  int x, y;
420 }
422 
423 //---------------------------------------------------------
425 {
426 public:
427  CSG_Points_Int(void);
428  CSG_Points_Int(const CSG_Points_Int &Points);
429  CSG_Points_Int(sLong nPoints, TSG_Array_Growth Growth = TSG_Array_Growth::SG_ARRAY_GROWTH_1);
430 
431  bool Clear (void) { return( m_Points.Destroy() ); }
432 
433  CSG_Points_Int & operator = (const CSG_Points_Int &Points) { Assign(Points); return( *this ); }
434  bool Assign (const CSG_Points_Int &Points);
435 
436  bool Add (int x, int y);
437  bool Add (const TSG_Point_Int &Point) { return( Add(Point.x, Point.y) ); }
438  bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
439 
440  bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
441  sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
442 
443  TSG_Point_Int * Get_Points (void) const { return( (TSG_Point_Int *)m_Points.Get_Array() ); }
444 
445  TSG_Point_Int & operator [] (sLong Index) { return( Get_Points()[Index] ); }
446  const TSG_Point_Int & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
447 
448 
449 private:
450 
451  CSG_Array m_Points;
452 
453 };
454 
455 
457 // //
458 // //
459 // //
461 
462 //---------------------------------------------------------
463 typedef struct SSG_Rect
464 {
465  double xMin, yMin, xMax, yMax;
466 }
468 
469 //---------------------------------------------------------
471 {
472 public:
473  CSG_Rect(void);
474  CSG_Rect(const CSG_Rect &Rect);
475  CSG_Rect(const TSG_Rect &Rect);
476  CSG_Rect(const CSG_Point &A, const CSG_Point &B);
477  CSG_Rect(double xMin, double yMin, double xMax, double yMax);
478 
479  ~CSG_Rect(void);
480 
481  bool Create (double xMin, double yMin, double xMax, double yMax);
482  bool Create (const CSG_Point &A, const CSG_Point &B);
483  bool Create (const CSG_Rect &Rect);
484 
485  bool operator == (const CSG_Rect &Rect) const { return( is_Equal(Rect) ); }
486  bool operator != (const CSG_Rect &Rect) const { return( !is_Equal(Rect) ); }
487 
488  CSG_Rect & operator = (const CSG_Rect &Rect) { Assign(Rect); return( *this ); }
489 
490  CSG_Rect & operator += (const CSG_Point &Point) { Move( Point.x, Point.y); return( *this ); }
491  CSG_Rect & operator -= (const CSG_Point &Point) { Move( -Point.x, -Point.y); return( *this ); }
492 
493  CSG_Rect & Assign (double xMin, double yMin, double xMax, double yMax);
494  CSG_Rect & Assign (const CSG_Point &A, const CSG_Point &B);
495  CSG_Rect & Assign (const CSG_Rect &Rect);
496 
497  CSG_Rect & Set_BottomLeft (double x, double y);
498  CSG_Rect & Set_BottomLeft (const CSG_Point &Point);
499  CSG_Rect & Set_TopRight (double x, double y);
500  CSG_Rect & Set_TopRight (const CSG_Point &Point);
501 
502  double Get_XMin (void) const { return( xMin ); }
503  double Get_XMax (void) const { return( xMax ); }
504  double Get_YMin (void) const { return( yMin ); }
505  double Get_YMax (void) const { return( yMax ); }
506 
507  double Get_XRange (void) const { return( xMax - xMin ); }
508  double Get_YRange (void) const { return( yMax - yMin ); }
509 
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()) ); }
512 
513  CSG_Point Get_TopLeft (void) const { return( CSG_Point(xMin, yMax) ); }
514  CSG_Point Get_BottomRight (void) const { return( CSG_Point(xMax, yMin) ); }
515 
516  CSG_Point Get_Center (void) const { return( CSG_Point(Get_XCenter(), Get_YCenter()) ); }
517  double Get_XCenter (void) const { return( (xMin + xMax) / 2. ); }
518  double Get_YCenter (void) const { return( (yMin + yMax) / 2. ); }
519 
520  CSG_Rect & Move (double dx, double dy);
521  CSG_Rect & Move (const CSG_Point &Point);
522 
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);
527 
528  CSG_Rect & Union (double x, double y);
529  CSG_Rect & Union (const CSG_Point &Point);
530  CSG_Rect & Union (const CSG_Rect &Rect);
531  bool Intersect (const CSG_Rect &Rect);
532 
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;
535 
536  bool Contains (double x, double y) const;
537  bool Contains (const CSG_Point &Point) const;
538 
539  TSG_Intersection Intersects (const CSG_Rect &Rect) const;
540 
541 };
542 
543 //---------------------------------------------------------
545 {
546 public:
547  CSG_Rects(void);
548  CSG_Rects(const CSG_Rects &Rects);
549  virtual ~CSG_Rects(void);
550 
551  void Clear (void);
552 
553  CSG_Rects & operator = (const CSG_Rects &Rects);
554  bool Assign (const CSG_Rects &Rects);
555 
556  bool Add (void);
557  bool Add (double xMin, double yMin, double xMax, double yMax);
558  bool Add (const CSG_Rect &Rect);
559 
560  int Get_Count (void) const { return( m_nRects ); }
561 
562  CSG_Rect & operator [] (int Index) { return( *m_Rects[Index] ); }
563  CSG_Rect & Get_Rect (int Index) { return( *m_Rects[Index] ); }
564 
565 
566 private:
567 
568  int m_nRects;
569 
570  CSG_Rect **m_Rects;
571 
572 };
573 
574 
576 // //
578 
579 //---------------------------------------------------------
580 typedef struct SSG_Rect_Int
581 {
582  int xMin, yMin, xMax, yMax;
583 }
585 
586 //---------------------------------------------------------
588 {
589 public:
590  CSG_Rect_Int(void);
591  CSG_Rect_Int(const CSG_Rect_Int &Rect);
592  CSG_Rect_Int(const TSG_Rect_Int &Rect);
593  CSG_Rect_Int(const TSG_Point_Int &A, const TSG_Point_Int &B);
594  CSG_Rect_Int(int xMin, int yMin, int xMax, int yMax);
595 
596  ~CSG_Rect_Int(void);
597 
598  bool Create (int xMin, int yMin, int xMax, int yMax);
599  bool Create (const TSG_Point_Int &A, const TSG_Point_Int &B);
600  bool Create (const CSG_Rect_Int &Rect);
601 
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) ); }
604 
605  CSG_Rect_Int & operator = (const CSG_Rect_Int &Rect) { Assign(Rect); return( *this ); }
606 
607  CSG_Rect_Int & operator += (const TSG_Point_Int &Point) { Move( Point.x, Point.y); return( *this ); }
608  CSG_Rect_Int & operator -= (const TSG_Point_Int &Point) { Move(-Point.x, -Point.y); return( *this ); }
609 
610  CSG_Rect_Int & Assign (int xMin, int yMin, int xMax, int yMax);
611  CSG_Rect_Int & Assign (const TSG_Point_Int &A, const TSG_Point_Int &B);
612  CSG_Rect_Int & Assign (const CSG_Rect_Int &Rect);
613 
614  CSG_Rect_Int & Set_BottomLeft (int x, int y);
615  CSG_Rect_Int & Set_BottomLeft (const TSG_Point_Int &Point);
616  CSG_Rect_Int & Set_TopRight (int x, int y);
617  CSG_Rect_Int & Set_TopRight (const TSG_Point_Int &Point);
618 
619  int Get_XMin (void) const { return( xMin ); }
620  int Get_XMax (void) const { return( xMax ); }
621  int Get_YMin (void) const { return( yMin ); }
622  int Get_YMax (void) const { return( yMax ); }
623 
624  int Get_XRange (void) const { return( xMax - xMin ); }
625  int Get_YRange (void) const { return( yMax - yMin ); }
626 
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) ); }
629 
630  TSG_Point_Int Get_TopLeft (void) const { TSG_Point_Int p; p.x = xMin; p.y = yMax; return( p ); }
631  TSG_Point_Int Get_BottomRight (void) const { TSG_Point_Int p; p.x = xMax; p.y = yMin; return( p ); }
632 
633  CSG_Rect_Int & Move (int dx, int dy);
634  CSG_Rect_Int & Move (const TSG_Point_Int &Point);
635 
636  CSG_Rect_Int & Inflate (int d);
637  CSG_Rect_Int & Deflate (int d);
638  CSG_Rect_Int & Inflate (int dx, int dy);
639  CSG_Rect_Int & Deflate (int dx, int dy);
640 
641  CSG_Rect_Int & Union (int x, int y);
642  CSG_Rect_Int & Union (const TSG_Point_Int &Point);
643  CSG_Rect_Int & Union (const CSG_Rect_Int &Rect);
644  bool Intersect (const CSG_Rect_Int &Rect);
645 
646  bool is_Equal (int xMin, int yMin, int xMax, int yMax) const;
647  bool is_Equal (const CSG_Rect_Int &Rect ) const;
648 
649  bool Contains (double x, double y) const;
650  bool Contains (const TSG_Point_Int &Point) const;
651 
652  TSG_Intersection Intersects (const CSG_Rect_Int &Rect) const;
653 
654 };
655 
656 //---------------------------------------------------------
658 {
659 public:
660  CSG_Rects_Int(void);
661  virtual ~CSG_Rects_Int(void);
662 
663  void Clear (void);
664 
665  CSG_Rects_Int & operator = (const CSG_Rects_Int &Rects);
666  bool Assign (const CSG_Rects_Int &Rects);
667 
668  bool Add (void);
669  bool Add (int xMin, int yMin, int xMax, int yMax);
670  bool Add (const CSG_Rect_Int &Rect);
671 
672  int Get_Count (void) const { return( m_nRects ); }
673 
674  CSG_Rect_Int & operator [] (int Index) { return( *m_Rects[Index] ); }
675  CSG_Rect_Int & Get_Rect (int Index) { return( *m_Rects[Index] ); }
676 
677 
678 private:
679 
680  int m_nRects;
681 
682  CSG_Rect_Int **m_Rects;
683 
684 };
685 
686 
688 // //
689 // //
690 // //
692 
693 //---------------------------------------------------------
694 typedef enum
695 {
700 }
702 
703 
705 // //
707 
708 //---------------------------------------------------------
710 {
711 public:
713  virtual ~CSG_Distance_Weighting(void);
714 
715  static bool Enable_Parameters (class CSG_Parameters &Parameters);
716  bool Create_Parameters (class CSG_Parameters &Parameters, const CSG_String &Parent = "", bool bIDW_Offset = false);
717  static bool Add_Parameters (class CSG_Parameters &Parameters, const CSG_String &Parent = "", bool bIDW_Offset = false);
718  bool Set_Parameters (class CSG_Parameters &Parameters);
719 
720  TSG_Distance_Weighting Get_Weighting (void) const { return( m_Weighting ); }
721  bool Set_Weighting (TSG_Distance_Weighting Weighting);
722 
723  double Get_IDW_Power (void) const { return( m_IDW_Power ); }
724  bool Set_IDW_Power (double Value);
725 
726  bool Get_IDW_Offset (void) const { return( m_IDW_bOffset ); }
727  bool Set_IDW_Offset (bool bOn = true);
728 
729  double Get_BandWidth (void) const { return( m_Bandwidth ); }
730  bool Set_BandWidth (double Value);
731 
732  //-----------------------------------------------------
733  double Get_Weight (double Distance) const
734  {
735  if( Distance < 0. )
736  {
737  return( 0. );
738  }
739 
740  switch( m_Weighting )
741  {
742  case SG_DISTWGHT_IDW :
743  return( m_IDW_bOffset
744  ? pow(1. + Distance, -m_IDW_Power) : Distance > 0.
745  ? pow( Distance, -m_IDW_Power) : 0.
746  );
747 
748  case SG_DISTWGHT_EXP :
749  return( exp(-Distance / m_Bandwidth) );
750 
751  case SG_DISTWGHT_GAUSS:
752  Distance /= m_Bandwidth;
753  return( exp(-0.5 * Distance*Distance) );
754 
755  default: // case SG_DISTWGHT_None:
756  return( 1. );
757  }
758  }
759 
760 
761 private:
762 
763  bool m_IDW_bOffset;
764 
765  double m_IDW_Power, m_Bandwidth;
766 
767  TSG_Distance_Weighting m_Weighting;
768 
769 };
770 
771 
773 // //
774 // //
775 // //
777 
778 //---------------------------------------------------------
779 enum class ESG_CRS_Format
780 {
781  WKT1, WKT2, PROJ, ESRI, CODE, Undefined, WKT = WKT1
782 };
783 
784 //---------------------------------------------------------
785 enum class ESG_CRS_Type
786 {
787  Geographic, Geocentric, Projection, Undefined
788 };
789 
790 //---------------------------------------------------------
792 {
793  Kilometer,
794  Meter,
795  Decimeter,
796  Centimeter,
797  Millimeter,
798  Int_Nautical_Mile,
799  Int_Inch,
800  Int_Foot,
801  Int_Yard,
802  Int_Statute_Mile,
803  Int_Fathom,
804  Int_Chain,
805  Int_Link,
806  US_Inch,
807  US_Foot,
808  US_Yard,
809  US_Chain,
810  US_Statute_Mile,
811  Indian_Yard,
812  Indian_Foot,
813  Indian_Chain,
814  Undefined, First = Kilometer
815 };
816 
817 
819 // //
821 
822 //---------------------------------------------------------
824 {
825  friend class CSG_Projections;
826 
827 public:
828  CSG_Projection(void);
829  virtual ~CSG_Projection(void);
830 
831  void Destroy (void);
832 
833  CSG_Projection (const CSG_Projection &Projection);
834  bool Create (const CSG_Projection &Projection);
835  CSG_Projection & operator = (const CSG_Projection &Projection) { Create(Projection); return( *this ); }
836 
837  CSG_Projection (const char *Definition);
838  bool Create (const char *Definition);
839  CSG_Projection & operator = (const char *Definition) { Create(Definition); return( *this ); }
840 
841  CSG_Projection (const wchar_t *Definition);
842  bool Create (const wchar_t *Definition);
843  CSG_Projection & operator = (const wchar_t *Definition) { Create(Definition); return( *this ); }
844 
845  CSG_Projection (const CSG_String &Definition);
846  bool Create (const CSG_String &Definition);
847  CSG_Projection & operator = (const CSG_String &Definition) { Create(Definition); return( *this ); }
848 
849  CSG_Projection (int Code, const SG_Char *Authority = NULL);
850  bool Create (int Code, const SG_Char *Authority = NULL);
851  CSG_Projection & operator = (int Code) { Create(Code ); return( *this ); }
852 
853  bool Assign (const CSG_Projection &Projection) { return( Create(Projection ) ); }
854  bool Assign (const CSG_String &Definition) { return( Create(Definition ) ); }
855  bool Assign (int Code, const SG_Char *Authority = NULL) { return( Create(Code, Authority ) ); }
856 
857  bool is_Okay (void) const { return( m_Type != ESG_CRS_Type::Undefined ); }
858  bool is_Equal (const CSG_Projection &Projection) const;
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 ); }
861 
862  static const CSG_Projection & Get_GCS_WGS84 (void);
863  bool Set_GCS_WGS84 (void);
864 
865  static CSG_Projection Get_UTM_WGS84 (int Zone, bool bSouth = false);
866  bool Set_UTM_WGS84 (int Zone, bool bSouth = false);
867 
868  bool Load (const CSG_String &File);
869  bool Save (const CSG_String &File, ESG_CRS_Format Format = ESG_CRS_Format::WKT) const;
870 
871  bool Load (CSG_File &Stream);
872  bool Save (CSG_File &Stream , ESG_CRS_Format Format = ESG_CRS_Format::WKT) const;
873 
874  bool Load (const CSG_MetaData &Projection);
875  bool Save ( CSG_MetaData &Projection) const;
876 
877  CSG_String Get_Description (bool bDetails = false) const;
878 
879  const CSG_String & Get_Name (void) const { return( m_Name ); }
880 
881  const CSG_String & Get_WKT (void) const { return( m_WKT1 ); }
882  const CSG_String & Get_WKT1 (void) const { return( m_WKT1 ); }
883  const CSG_String & Get_WKT2 (void) const { return( m_WKT2 ); }
884  const CSG_String & Get_PROJ (void) const { return( m_PROJ ); }
885  const CSG_String & Get_ESRI (void) const { return( m_ESRI ); }
886  const CSG_String & Get_Authority (void) const { return( m_Authority ); }
887  int Get_Code (void) const { return( m_Code ); }
888 
889  const CSG_String & Get_Proj4 (void) const { return( m_PROJ ); }
890  int Get_Authority_ID (void) const { return( m_Code ); }
891  int Get_EPSG (void) const { return( m_Authority.CmpNoCase("EPSG") ? -1 : m_Code ); }
892 
893  bool is_Geographic (void) const { return( m_Type == ESG_CRS_Type::Geographic ); }
894  bool is_Geocentric (void) const { return( m_Type == ESG_CRS_Type::Geocentric ); }
895  bool is_Projection (void) const { return( m_Type == ESG_CRS_Type::Projection ); }
896 
897  ESG_CRS_Type Get_Type (void) const { return( m_Type ); }
898  CSG_String Get_Type_Identifier (void) const;
899  CSG_String Get_Type_Name (void) const;
900 
901  ESG_Projection_Unit Get_Unit (void) const { return( m_Unit ); }
902  CSG_String Get_Unit_Identifier (void) const;
903  CSG_String Get_Unit_Name (void) const;
904  double Get_Unit_To_Meter (void) const;
905 
906 
907 private:
908 
909  int m_Code;
910 
911  ESG_CRS_Type m_Type;
912 
913  ESG_Projection_Unit m_Unit;
914 
915  CSG_String m_Name, m_Authority, m_PROJ, m_WKT1, m_WKT2, m_ESRI;
916 
917 
918 };
919 
920 
922 // //
924 
925 //---------------------------------------------------------
929 //---------------------------------------------------------
931 {
932  friend class CSG_Projection;
933 
934 public:
935  CSG_Projections(void);
936  virtual ~CSG_Projections(void);
937 
938  CSG_Projections (bool LoadDefault);
939  bool Create (bool LoadDefault = true);
940 
941  CSG_Projections (const CSG_String &File);
942  bool Create (const CSG_String &File);
943 
944  void Destroy (void);
945 
946  static bool Parse (const CSG_String &Definition, CSG_String *WKT1 = NULL, CSG_String *WKT2 = NULL, CSG_String *PROJ = NULL, CSG_String *ESRI = NULL);
947 
948  bool Load (const CSG_String &File, bool bAppend = false);
949  bool Save (const CSG_String &File);
950 
951  bool Add (const CSG_Projection &Projection);
952  bool Add (const SG_Char *WKT, const SG_Char *Proj4, const SG_Char *Authority, int Authority_ID);
953 
954  sLong Get_Count (void) const;
955 
956  CSG_Projection operator [] (sLong Index) const { return( Get_Projection(Index) ); }
957  CSG_Projection Get_Projection (sLong Index) const;
958  const SG_Char * Get_Projection ( int Code, const SG_Char *Authority = NULL) const;
959  bool Get_Projection (CSG_Projection &Projection, int Code, const SG_Char *Authority = NULL) const;
960 
961  CSG_String Get_Names_List (ESG_CRS_Type Type = ESG_CRS_Type::Undefined, bool bAddSelect = true) const;
962 
963  static ESG_CRS_Type Get_CRS_Type (const CSG_String &Identifier);
964  static CSG_String Get_CRS_Type_Identifier (ESG_CRS_Type Type);
965  static CSG_String Get_CRS_Type_Name (ESG_CRS_Type Type);
966 
967  static ESG_Projection_Unit Get_Unit (const CSG_String &Identifier);
969  static const CSG_String Get_Unit_Name (ESG_Projection_Unit Unit, bool bSimple = true);
970  static double Get_Unit_To_Meter (ESG_Projection_Unit Unit);
971 
972 
973 private:
974 
975  class CSG_Table *m_pProjections;
976 
977 
978  void _On_Construction (void);
979 
980 
981 private:
982 
983  CSG_Translator m_WKT_to_Proj4, m_Proj4_to_WKT, m_EPSG_to_Idx;
984 
985 
986  static CSG_MetaData _WKT_to_MetaData (const CSG_String &WKT);
987  static bool _WKT_to_MetaData (CSG_MetaData &MetaData, const CSG_String &WKT);
988 
989  bool _WKT_to_Proj4 (CSG_String &Proj4, const CSG_String &WKT ) const;
990  bool _WKT_from_Proj4 (CSG_String &WKT , const CSG_String &Proj4) const;
991  bool _WKT_to_Proj4_Set_Datum (CSG_String &Proj4, const CSG_MetaData &WKT) const;
992 
993  static bool _Proj4_Find_Parameter ( const CSG_String &Proj4, const CSG_String &Key);
994  static bool _Proj4_Read_Parameter (CSG_String &Value, const CSG_String &Proj4, const CSG_String &Key);
995  static bool _Proj4_Get_Ellipsoid (CSG_String &Value, const CSG_String &Proj4);
996  static bool _Proj4_Get_Datum (CSG_String &Value, const CSG_String &Proj4);
997  static bool _Proj4_Get_Prime_Meridian (CSG_String &Value, const CSG_String &Proj4);
998  static bool _Proj4_Get_Unit (CSG_String &Value, const CSG_String &Proj4);
999 
1000  bool _EPSG_to_Proj4 (CSG_String &Proj4, int EPSG_Code) const;
1001  bool _EPSG_to_WKT (CSG_String &WKT , int EPSG_Code) const;
1002 
1003  bool _Set_Dictionary (void);
1004  bool _Set_Dictionary (CSG_Table &Dictionary, int Direction);
1005 
1006 };
1007 
1008 //---------------------------------------------------------
1010 
1011 //---------------------------------------------------------
1012 SAGA_API_DLL_EXPORT bool SG_Get_Projected (class CSG_Shapes *pSource, class CSG_Shapes *pTarget, const CSG_Projection &Target);
1013 
1014 SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Point &Point );
1015 SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Rect &Rectangle);
1016 
1017 //---------------------------------------------------------
1019 
1020 
1022 // //
1023 // Functions //
1024 // //
1026 
1027 //---------------------------------------------------------
1028 SAGA_API_DLL_EXPORT bool SG_Is_Equal (double a, double b, double epsilon = 0.);
1029 SAGA_API_DLL_EXPORT bool SG_Is_Equal (const TSG_Point &A, const TSG_Point &B, double epsilon = 0.);
1030 
1031 SAGA_API_DLL_EXPORT bool SG_Is_Between (double x, double a, double b, double epsilon = 0.);
1032 SAGA_API_DLL_EXPORT bool SG_Is_Between (const TSG_Point &Point, const TSG_Point &Corner_A, const TSG_Point &Corner_B, double epsilon = 0.);
1033 
1034 //---------------------------------------------------------
1035 SAGA_API_DLL_EXPORT double SG_Get_Length (double dx, double dy);
1036 
1037 SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by, bool bPolar);
1038 SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point &A, const TSG_Point &B , bool bPolar);
1039 
1040 SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by);
1041 SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point &A, const TSG_Point &B);
1042 
1043 SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double az, double bx, double by, double bz);
1045 
1046 SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar (double aLon, double aLat, double bLon, double bLat, double a = 6378137., double e = 298.257223563, bool bDegree = true);
1047 SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar (const TSG_Point &A , const TSG_Point &B , double a = 6378137., double e = 298.257223563, bool bDegree = true);
1048 
1049 SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double dx, double dy);
1050 SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double ax, double ay, double bx, double by);
1053 SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference (double a, double b);
1054 SAGA_API_DLL_EXPORT bool SG_is_Angle_Between (double Angle, double Angle_Min, double Angle_Max, bool bCheckRange = true);
1055 
1056 SAGA_API_DLL_EXPORT bool SG_Get_Crossing (TSG_Point &Crossing, const TSG_Point &a1, const TSG_Point &a2, const TSG_Point &b1, const TSG_Point &b2, bool bExactMatch = true);
1057 SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion (TSG_Point &Crossing, const TSG_Point &a , const TSG_Point & b, const TSG_Rect &Region);
1058 
1059 SAGA_API_DLL_EXPORT bool SG_Is_Point_On_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch = false, double Epsilon = 0.);
1060 SAGA_API_DLL_EXPORT double SG_Get_Distance_To_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch = true);
1061 SAGA_API_DLL_EXPORT double SG_Get_Nearest_Point_On_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, TSG_Point &Line_Point, bool bExactMatch = true);
1062 
1063 SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle (TSG_Point Triangle[3], TSG_Point &Point, double &Radius);
1064 
1065 SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area (TSG_Point *Points, int nPoints);
1066 SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area (const CSG_Points &Points);
1067 
1068 
1070 // //
1071 // //
1072 // //
1074 
1075 //---------------------------------------------------------
1076 #endif // #ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
SG_Get_Distance_To_Line
SAGA_API_DLL_EXPORT double SG_Get_Distance_To_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch=true)
Definition: geo_functions.cpp:413
CSG_Rect
Definition: geo_tools.h:471
CSG_Point::Get_Type
virtual TSG_Point_Type Get_Type(void) const
Definition: geo_tools.h:144
CSG_Points_3D::Add
bool Add(const TSG_Point_3D &Point)
Definition: geo_tools.h:332
CSG_Translator
Definition: api_core.h:1433
CSG_Point::~CSG_Point
virtual ~CSG_Point(void)
Definition: geo_tools.h:142
CSG_Projection::Save
bool Save(const CSG_String &File, ESG_CRS_Format Format=ESG_CRS_Format::WKT) const
Definition: projections.cpp:229
CSG_Rect_Int::Get_XMin
int Get_XMin(void) const
Definition: geo_tools.h:619
TSG_Intersection
TSG_Intersection
Definition: geo_tools.h:101
CSG_Points_3D
Definition: geo_tools.h:320
SG_Get_Length
SAGA_API_DLL_EXPORT double SG_Get_Length(double dx, double dy)
Definition: geo_functions.cpp:97
SSG_Rect_Int::yMax
int yMax
Definition: geo_tools.h:582
TSG_Array_Growth
TSG_Array_Growth
Definition: api_core.h:291
CSG_Rects
Definition: geo_tools.h:545
CSG_Rect_Int::Get_YMin
int Get_YMin(void) const
Definition: geo_tools.h:621
TSG_Distance_Weighting
TSG_Distance_Weighting
Definition: geo_tools.h:695
CSG_Projection::Assign
bool Assign(const CSG_Projection &Projection)
Definition: geo_tools.h:853
TSG_Rect_Int
struct SSG_Rect_Int TSG_Rect_Int
CSG_Points_Int::Get_Points
TSG_Point_Int * Get_Points(void) const
Definition: geo_tools.h:443
SG_Get_Angle_Of_Direction
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction(double dx, double dy)
Definition: geo_functions.cpp:216
SSG_Rect_Int::yMin
int yMin
Definition: geo_tools.h:582
CSG_Point_4D::is_Equal
virtual bool is_Equal(double _x, double _y, double _z, double _m, double epsilon=0.) const
Definition: geo_tools.h:404
CSG_Point_4D::Get_Type
virtual TSG_Point_Type Get_Type(void) const
Definition: geo_tools.h:373
SG_Get_Angle_Difference
SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference(double a, double b)
Definition: geo_functions.cpp:247
CSG_Point_4D::is_Equal
virtual bool is_Equal(const CSG_Point_4D &Point, double epsilon=0.) const
Definition: geo_tools.h:403
CSG_Projection::Get_ESRI
const CSG_String & Get_ESRI(void) const
Definition: geo_tools.h:885
CSG_Rect_Int::Get_XMax
int Get_XMax(void) const
Definition: geo_tools.h:620
CSG_Points_Int::Get_Count
sLong Get_Count(void) const
Definition: geo_tools.h:441
SG_DISTWGHT_EXP
@ SG_DISTWGHT_EXP
Definition: geo_tools.h:698
CSG_Points_Int::Clear
bool Clear(void)
Definition: geo_tools.h:431
A
#define A
CSG_Projection::Assign
bool Assign(const CSG_String &Definition)
Definition: geo_tools.h:854
CSG_Points_Int
Definition: geo_tools.h:425
CSG_Rect::Get_XMax
double Get_XMax(void) const
Definition: geo_tools.h:503
CSG_Projection::Get_Unit_Name
CSG_String Get_Unit_Name(void) const
Definition: projections.cpp:520
SG_Get_Crossing
SAGA_API_DLL_EXPORT bool SG_Get_Crossing(TSG_Point &Crossing, const TSG_Point &a1, const TSG_Point &a2, const TSG_Point &b1, const TSG_Point &b2, bool bExactMatch=true)
Definition: geo_functions.cpp:280
CSG_Projection::Get_Unit
ESG_Projection_Unit Get_Unit(void) const
Definition: geo_tools.h:901
CSG_Rect::Get_TopLeft
CSG_Point Get_TopLeft(void) const
Definition: geo_tools.h:513
SG_Get_Crossing_InRegion
SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion(TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
Definition: geo_functions.cpp:342
SG_DISTWGHT_GAUSS
@ SG_DISTWGHT_GAUSS
Definition: geo_tools.h:699
CSG_Points_3D::Set_Count
bool Set_Count(sLong nPoints)
Definition: geo_tools.h:335
CSG_Rects::Get_Count
int Get_Count(void) const
Definition: geo_tools.h:560
CSG_Projections::CSG_Projection
friend class CSG_Projection
Definition: geo_tools.h:932
CSG_Rect_Int::Get_XRange
int Get_XRange(void) const
Definition: geo_tools.h:624
SSG_Point_4D
Definition: geo_tools.h:357
SSG_Point_3D
Definition: geo_tools.h:264
SG_Get_Distance
SAGA_API_DLL_EXPORT double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
Definition: geo_functions.cpp:103
CSG_Projection::is_Okay
bool is_Okay(void) const
Definition: geo_tools.h:857
INTERSECTION_Contains
@ INTERSECTION_Contains
Definition: geo_tools.h:106
CSG_Points_3D::Get_Count
sLong Get_Count(void) const
Definition: geo_tools.h:336
SSG_Rect_Int
Definition: geo_tools.h:581
CSG_Point_3D::Get_Type
virtual TSG_Point_Type Get_Type(void) const
Definition: geo_tools.h:280
SSG_Point_3D::x
double x
Definition: geo_tools.h:265
CSG_Projection::is_Geographic
bool is_Geographic(void) const
Definition: geo_tools.h:893
CSG_Point_3D::is_Equal
virtual bool is_Equal(double _x, double _y, double _z, double epsilon=0.) const
Definition: geo_tools.h:311
SG_Is_Between
SAGA_API_DLL_EXPORT bool SG_Is_Between(double x, double a, double b, double epsilon=0.)
Definition: geo_functions.cpp:77
SSG_Rect::xMax
double xMax
Definition: geo_tools.h:465
CSG_Projections::Get_Unit_To_Meter
static double Get_Unit_To_Meter(ESG_Projection_Unit Unit)
Definition: projections.cpp:1903
api_core.h
ESG_CRS_Format::WKT1
@ WKT1
ESG_Projection_Unit
ESG_Projection_Unit
Definition: geo_tools.h:792
CSG_Rects::Get_Rect
CSG_Rect & Get_Rect(int Index)
Definition: geo_tools.h:563
CSG_Rect::Get_Area
double Get_Area(void) const
Definition: geo_tools.h:510
ESG_CRS_Type::Geographic
@ Geographic
CSG_Projection::Get_WKT
const CSG_String & Get_WKT(void) const
Definition: geo_tools.h:881
CSG_Projection::CSG_Projections
friend class CSG_Projections
Definition: geo_tools.h:825
SSG_Point
Definition: geo_tools.h:128
CSG_Distance_Weighting::Get_Weight
double Get_Weight(double Distance) const
Definition: geo_tools.h:733
CSG_Points_3D::Clear
bool Clear(void)
Definition: geo_tools.h:326
CSG_Projection::Get_EPSG
int Get_EPSG(void) const
Definition: geo_tools.h:891
CSG_Rect_Int::Get_TopLeft
TSG_Point_Int Get_TopLeft(void) const
Definition: geo_tools.h:630
CSG_Projection::Destroy
void Destroy(void)
Definition: projections.cpp:201
TSG_Point_3D
struct SSG_Point_3D TSG_Point_3D
CSG_Rect_Int::Get_Diameter
double Get_Diameter(void) const
Definition: geo_tools.h:628
CSG_File
Definition: api_core.h:1124
CSG_Point_4D::~CSG_Point_4D
virtual ~CSG_Point_4D(void)
Definition: geo_tools.h:371
SSG_Rect::xMin
double xMin
Definition: geo_tools.h:465
CSG_Projection::Get_WKT1
const CSG_String & Get_WKT1(void) const
Definition: geo_tools.h:882
SSG_Rect
Definition: geo_tools.h:464
SG_Get_Polygon_Area
SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area(TSG_Point *Points, int nPoints)
Definition: geo_functions.cpp:514
CSG_Points::Add
bool Add(const TSG_Point &Point)
Definition: geo_tools.h:196
SG_Get_Triangle_CircumCircle
SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle(TSG_Point Triangle[3], TSG_Point &Point, double &Radius)
Definition: geo_functions.cpp:465
CSG_Projections::Create
bool Create(bool LoadDefault=true)
Definition: projections.cpp:641
CSG_Rect_Int
Definition: geo_tools.h:588
SG_DISTWGHT_IDW
@ SG_DISTWGHT_IDW
Definition: geo_tools.h:697
CSG_Rect::Get_XRange
double Get_XRange(void) const
Definition: geo_tools.h:507
SG_Get_Distance_Polar
SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar(double aLon, double aLat, double bLon, double bLat, double a=6378137., double e=298.257223563, bool bDegree=true)
Definition: geo_functions.cpp:157
ESG_Projection_Unit::Kilometer
@ Kilometer
CSG_Point
Definition: geo_tools.h:135
CSG_Rect::Get_YMin
double Get_YMin(void) const
Definition: geo_tools.h:504
CSG_Points_Int::Add
bool Add(const TSG_Point_Int &Point)
Definition: geo_tools.h:437
CSG_Rects_Int::Get_Count
int Get_Count(void) const
Definition: geo_tools.h:672
CSG_Projection::Get_Name
const CSG_String & Get_Name(void) const
Definition: geo_tools.h:879
CSG_Points::Get_Count
sLong Get_Count(void) const
Definition: geo_tools.h:200
SSG_Point_4D::m
double m
Definition: geo_tools.h:358
CSG_Projection::Get_Unit_Identifier
CSG_String Get_Unit_Identifier(void) const
Definition: projections.cpp:514
INTERSECTION_None
@ INTERSECTION_None
Definition: geo_tools.h:102
SSG_Point_4D::z
double z
Definition: geo_tools.h:358
CSG_Point_3D
Definition: geo_tools.h:271
CSG_Point_4D
Definition: geo_tools.h:364
sLong
signed long long sLong
Definition: api_core.h:158
CSG_Projections::Load
bool Load(const CSG_String &File, bool bAppend=false)
Definition: projections.cpp:809
CSG_Rect_Int::Get_BottomRight
TSG_Point_Int Get_BottomRight(void) const
Definition: geo_tools.h:631
CSG_Projection::Get_Authority_ID
int Get_Authority_ID(void) const
Definition: geo_tools.h:890
CSG_Distance_Weighting
Definition: geo_tools.h:710
CSG_Projection::Get_Proj4
const CSG_String & Get_Proj4(void) const
Definition: geo_tools.h:889
TSG_Point_Int
struct SSG_Point_Int TSG_Point_Int
CSG_Projection::Get_Type
ESG_CRS_Type Get_Type(void) const
Definition: geo_tools.h:897
SSG_Rect_Int::xMax
int xMax
Definition: geo_tools.h:582
CSG_Points_3D::Get_Points
TSG_Point_3D * Get_Points(void) const
Definition: geo_tools.h:338
CSG_Lines::Get_Line
const CSG_Points & Get_Line(sLong Index) const
Definition: geo_tools.h:242
SSG_Rect_Int::xMin
int xMin
Definition: geo_tools.h:582
SAGA_API_DLL_EXPORT
#define SAGA_API_DLL_EXPORT
Definition: api_core.h:94
CSG_Distance_Weighting::Get_BandWidth
double Get_BandWidth(void) const
Definition: geo_tools.h:729
CSG_Lines::Get_Count
sLong Get_Count(void) const
Definition: geo_tools.h:239
INTERSECTION_Identical
@ INTERSECTION_Identical
Definition: geo_tools.h:103
SG_Get_Projections
SAGA_API_DLL_EXPORT CSG_Projections & SG_Get_Projections(void)
Definition: projections.cpp:69
SSG_Rect::yMax
double yMax
Definition: geo_tools.h:465
CSG_Projection::Load
bool Load(const CSG_String &File)
Definition: projections.cpp:221
TSG_Point_4D
struct SSG_Point_4D TSG_Point_4D
SG_is_Angle_Between
SAGA_API_DLL_EXPORT bool SG_is_Angle_Between(double Angle, double Angle_Min, double Angle_Max, bool bCheckRange=true)
Definition: geo_functions.cpp:257
ESG_CRS_Format
ESG_CRS_Format
Definition: geo_tools.h:780
CSG_Point::is_Equal
virtual bool is_Equal(double _x, double _y, double epsilon=0.) const
Definition: geo_tools.h:175
CSG_Points
Definition: geo_tools.h:184
CSG_Projection::Get_PROJ
const CSG_String & Get_PROJ(void) const
Definition: geo_tools.h:884
CSG_Rect::Get_BottomRight
CSG_Point Get_BottomRight(void) const
Definition: geo_tools.h:514
CSG_Projection
Definition: geo_tools.h:824
CSG_Table
Definition: table.h:283
CSG_Rect::Get_Diameter
double Get_Diameter(void) const
Definition: geo_tools.h:511
SSG_Point_4D::y
double y
Definition: geo_tools.h:358
CSG_Rects_Int::Get_Rect
CSG_Rect_Int & Get_Rect(int Index)
Definition: geo_tools.h:675
CSG_Points_3D::Del
bool Del(sLong Index)
Definition: geo_tools.h:333
CSG_Projection::Assign
bool Assign(int Code, const SG_Char *Authority=NULL)
Definition: geo_tools.h:855
SG_Char
#define SG_Char
Definition: api_core.h:536
CSG_Array
Definition: api_core.h:308
B
#define B
CSG_Points_Int::Set_Count
bool Set_Count(sLong nPoints)
Definition: geo_tools.h:440
ESG_CRS_Type
ESG_CRS_Type
Definition: geo_tools.h:786
CSG_String
Definition: api_core.h:563
CSG_Array_Pointer
Definition: api_core.h:368
CSG_Point_3D::~CSG_Point_3D
virtual ~CSG_Point_3D(void)
Definition: geo_tools.h:278
CSG_Projection::Get_WKT2
const CSG_String & Get_WKT2(void) const
Definition: geo_tools.h:883
SSG_Point_Int
Definition: geo_tools.h:418
CSG_MetaData
Definition: metadata.h:88
CSG_Projection::Get_Code
int Get_Code(void) const
Definition: geo_tools.h:887
CSG_Distance_Weighting::Get_IDW_Power
double Get_IDW_Power(void) const
Definition: geo_tools.h:723
TSG_Rect
struct SSG_Rect TSG_Rect
CSG_Rect::Get_Center
CSG_Point Get_Center(void) const
Definition: geo_tools.h:516
CSG_Rect_Int::Get_YRange
int Get_YRange(void) const
Definition: geo_tools.h:625
SSG_Point_3D::y
double y
Definition: geo_tools.h:265
SG_Is_Point_On_Line
SAGA_API_DLL_EXPORT bool SG_Is_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch=false, double Epsilon=0.)
Definition: geo_functions.cpp:394
CSG_Points_Int::Del
bool Del(sLong Index)
Definition: geo_tools.h:438
metadata.h
TSG_Point_Type::SG_POINT_TYPE_2D
@ SG_POINT_TYPE_2D
SSG_Point::x
double x
Definition: geo_tools.h:129
CSG_Projections::Get_Unit_Name
static const CSG_String Get_Unit_Name(ESG_Projection_Unit Unit, bool bSimple=true)
Definition: projections.cpp:1873
SSG_Point_4D::x
double x
Definition: geo_tools.h:358
CSG_Projection::Get_Unit_To_Meter
double Get_Unit_To_Meter(void) const
Definition: projections.cpp:526
CSG_Projection::is_Projection
bool is_Projection(void) const
Definition: geo_tools.h:895
SSG_Rect::yMin
double yMin
Definition: geo_tools.h:465
CSG_Rect::Get_XCenter
double Get_XCenter(void) const
Definition: geo_tools.h:517
CSG_Rect::Get_YMax
double Get_YMax(void) const
Definition: geo_tools.h:505
CSG_Rect_Int::Get_YMax
int Get_YMax(void) const
Definition: geo_tools.h:622
CSG_Point_3D::is_Equal
virtual bool is_Equal(const CSG_Point_3D &Point, double epsilon=0.) const
Definition: geo_tools.h:310
CSG_Rects_Int
Definition: geo_tools.h:658
CSG_Rect::Get_XMin
double Get_XMin(void) const
Definition: geo_tools.h:502
SSG_Point_Int::y
int y
Definition: geo_tools.h:419
SSG_Point::y
double y
Definition: geo_tools.h:129
CSG_Grid
Definition: grid.h:473
SSG_Point_3D::z
double z
Definition: geo_tools.h:265
CSG_Projections::Get_Unit_Identifier
static const CSG_String Get_Unit_Identifier(ESG_Projection_Unit Unit)
Definition: projections.cpp:1843
CSG_Projection::is_Geocentric
bool is_Geocentric(void) const
Definition: geo_tools.h:894
CSG_Rect::Get_YCenter
double Get_YCenter(void) const
Definition: geo_tools.h:518
CSG_Lines::Get_Line
CSG_Points & Get_Line(sLong Index)
Definition: geo_tools.h:241
CSG_Shapes
Definition: shapes.h:775
CSG_Lines
Definition: geo_tools.h:216
TSG_Point
struct SSG_Point TSG_Point
CSG_Points::Get_Points
TSG_Point * Get_Points(void) const
Definition: geo_tools.h:202
CSG_Projections::Destroy
void Destroy(void)
Definition: projections.cpp:701
CSG_Points::Set_Count
bool Set_Count(sLong nPoints)
Definition: geo_tools.h:199
CSG_Points::Clear
bool Clear(void)
Definition: geo_tools.h:190
INTERSECTION_Contained
@ INTERSECTION_Contained
Definition: geo_tools.h:105
CSG_Parameters
Definition: parameters.h:1690
SG_Get_Nearest_Point_On_Line
SAGA_API_DLL_EXPORT double SG_Get_Nearest_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, TSG_Point &Line_Point, bool bExactMatch=true)
Definition: geo_functions.cpp:421
operator*
CSG_Vector operator*(double Scalar, const CSG_Vector &Vector)
Definition: mat_matrix.cpp:579
CSG_Projections::Save
bool Save(const CSG_String &File)
Definition: projections.cpp:834
CSG_Projection::Get_Authority
const CSG_String & Get_Authority(void) const
Definition: geo_tools.h:886
SG_Is_Equal
SAGA_API_DLL_EXPORT bool SG_Is_Equal(double a, double b, double epsilon=0.)
Definition: geo_functions.cpp:64
CSG_Projection::Create
bool Create(const CSG_Projection &Projection)
Definition: projections.cpp:96
SSG_Point_Int::x
int x
Definition: geo_tools.h:419
TSG_Point_Type
TSG_Point_Type
Definition: geo_tools.h:112
CSG_Point::is_Equal
virtual bool is_Equal(const CSG_Point &Point, double epsilon=0.) const
Definition: geo_tools.h:174
SG_DISTWGHT_None
@ SG_DISTWGHT_None
Definition: geo_tools.h:696
SG_Get_Projected
SAGA_API_DLL_EXPORT bool SG_Get_Projected(class CSG_Shapes *pSource, class CSG_Shapes *pTarget, const CSG_Projection &Target)
Definition: projections.cpp:2267
INTERSECTION_Overlaps
@ INTERSECTION_Overlaps
Definition: geo_tools.h:104
CSG_Distance_Weighting::Get_Weighting
TSG_Distance_Weighting Get_Weighting(void) const
Definition: geo_tools.h:720
CSG_Rect_Int::Get_Area
double Get_Area(void) const
Definition: geo_tools.h:627
CSG_Rect::Get_YRange
double Get_YRange(void) const
Definition: geo_tools.h:508
CSG_Points::Del
bool Del(sLong Index)
Definition: geo_tools.h:197
CSG_Projections
Definition: geo_tools.h:931
SG_Grid_Get_Geographic_Coordinates
SAGA_API_DLL_EXPORT bool SG_Grid_Get_Geographic_Coordinates(CSG_Grid *pGrid, CSG_Grid *pLon, CSG_Grid *pLat)
Definition: projections.cpp:2381
CSG_Distance_Weighting::Get_IDW_Offset
bool Get_IDW_Offset(void) const
Definition: geo_tools.h:726
CSG_Table::_On_Construction
virtual void _On_Construction(void)
Definition: table.cpp:302
operator+
SAGA_API_DLL_EXPORT CSG_String operator+(const char *A, const CSG_String &B)
Definition: api_string.cpp:473