SAGA API v9.10
Loading...
Searching...
No Matches
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//---------------------------------------------------------
70
71
73// //
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//---------------------------------------------------------
109
110//---------------------------------------------------------
118
119
121// //
122// //
123// //
125
126//---------------------------------------------------------
127typedef struct SSG_Point
128{
129 double x, y;
130}
132
133//---------------------------------------------------------
135{
136public:
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 virtual double Get_Distance (const CSG_Point &Point) const { CSG_Point d(*this - Point); return( d.Get_Length() ); }
174
175 virtual bool is_Equal (const CSG_Point &Point, double epsilon = 0.) const { return( is_Equal(Point.x, Point.y, epsilon) ); }
176 virtual bool is_Equal (double _x, double _y, double epsilon = 0.) const
177 {
178 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon );
179 }
180
181};
182
183//---------------------------------------------------------
185{
186public:
187 CSG_Points(void);
188 CSG_Points(const CSG_Points &Points);
190
191 bool Clear (void) { return( m_Points.Destroy() ); }
192
193 CSG_Points & operator = (const CSG_Points &Points) { Assign(Points); return( *this ); }
194 bool Assign (const CSG_Points &Points);
195
196 bool Add (double x, double y);
197 bool Add (const TSG_Point &Point) { return( Add(Point.x, Point.y) ); }
198 bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
199
200 bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
201 sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
202
203 TSG_Point * Get_Points (void) const { return( (TSG_Point *)m_Points.Get_Array() ); }
204
205 TSG_Point & operator [] (sLong Index) { return( Get_Points()[Index] ); }
206 const TSG_Point & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
207
208
209private:
210
211 CSG_Array m_Points;
212
213};
214
215//---------------------------------------------------------
217{
218public:
219 CSG_Lines(void);
220 virtual ~CSG_Lines(void);
221
222 CSG_Lines (const CSG_Lines &Lines);
223 bool Create (const CSG_Lines &Lines);
224
225 CSG_Lines (sLong nLines);
226 bool Create (sLong nLines);
227
228 bool Destroy (void);
229 bool Clear (void);
230
231 CSG_Lines & operator = (const CSG_Lines &Lines) { Assign(Lines); return( *this ); }
232 bool Assign (const CSG_Lines &Lines);
233
234 CSG_Points & Add (void);
235 bool Add (const CSG_Points &Line);
236 bool Add (const CSG_Lines &Lines);
237 bool Del (sLong Index);
238
239 bool Set_Count (sLong nLines);
240 sLong Get_Count (void) const { return( m_Lines.Get_Size() ); }
241
242 CSG_Points & Get_Line (sLong Index) { return( *((CSG_Points *)m_Lines[Index]) ); }
243 const CSG_Points & Get_Line (sLong Index) const { return( *((CSG_Points *)m_Lines[Index]) ); }
244
245 CSG_Points & operator [] (sLong Index) { return( Get_Line(Index) ); }
246 const CSG_Points & operator [] (sLong Index) const { return( Get_Line(Index) ); }
247
248 double Get_Length (void) const;
249 double Get_Length (sLong Index) const;
250
251
252private:
253
254 CSG_Array_Pointer m_Lines;
255
256};
257
258
260// //
262
263//---------------------------------------------------------
264typedef struct SSG_Point_3D
265{
266 double x, y, z;
267}
269
270//---------------------------------------------------------
272{
273public:
274 CSG_Point_3D(void);
275 CSG_Point_3D(const CSG_Point_3D &Point);
276 CSG_Point_3D(const TSG_Point_3D &Point);
277 CSG_Point_3D(double x, double y, double z);
278
279 virtual ~CSG_Point_3D(void) {}
280
281 virtual TSG_Point_Type Get_Type (void) const { return( TSG_Point_Type::SG_POINT_TYPE_3D ); }
282
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) ); }
285
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 virtual CSG_Point_3D operator - (const CSG_Point_3D &Point) const { return( CSG_Point_3D(x - Point.x, y - Point.y, z - Point.z) ); }
288
289 virtual CSG_Point_3D & operator = (const CSG_Point_3D &Point) { Assign (Point); return( *this ); }
290 virtual CSG_Point_3D & operator += (const CSG_Point_3D &Point) { Add (Point); return( *this ); }
291 virtual CSG_Point_3D & operator -= (const CSG_Point_3D &Point) { Subtract(Point); return( *this ); }
292 virtual CSG_Point_3D & operator *= (const CSG_Point_3D &Point) { Multiply(Point); return( *this ); }
293
294 CSG_Point_3D operator * (double Value) const { return( CSG_Point_3D(x * Value, y * Value, z * Value) ); }
295 CSG_Point_3D operator / (double Value) const { return( CSG_Point_3D(x / Value, y / Value, z / Value) ); }
296 virtual CSG_Point_3D & operator *= (double Value) { Multiply(Value); return( *this ); }
297 virtual CSG_Point_3D & operator /= (double Value) { Divide (Value); return( *this ); }
298
299 virtual void Assign (double x, double y, double z);
300 virtual void Assign (const CSG_Point_3D &Point);
301
302 virtual void Add (const CSG_Point_3D &Point);
303 virtual void Subtract (const CSG_Point_3D &Point);
304 virtual void Multiply (const CSG_Point_3D &Point);
305
306 virtual void Multiply (double Value);
307 virtual void Divide (double Value);
308
309 virtual double Get_Length (void) const;
310 virtual double Get_Distance (const CSG_Point_3D &Point) const { CSG_Point_3D d(*this - Point); return( d.Get_Length() ); }
311
312 virtual bool is_Equal (const CSG_Point_3D &Point , double epsilon = 0.) const { return( is_Equal(Point.x, Point.y, Point.y, epsilon) ); }
313 virtual bool is_Equal (double _x, double _y, double _z, double epsilon = 0.) const
314 {
315 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon );
316 }
317
318};
319
320//---------------------------------------------------------
322{
323public:
324 CSG_Points_3D(void);
325 CSG_Points_3D(const CSG_Points_3D &Points);
327
328 bool Clear (void) { return( m_Points.Destroy() ); }
329
330 CSG_Points_3D & operator = (const CSG_Points_3D &Points) { Assign(Points); return( *this ); }
331 bool Assign (const CSG_Points_3D &Points);
332
333 bool Add (double x, double y, double z);
334 bool Add (const TSG_Point_3D &Point) { return( Add(Point.x, Point.y, Point.z) ); }
335 bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
336
337 bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
338 sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
339
340 TSG_Point_3D * Get_Points (void) const { return( (TSG_Point_3D *)m_Points.Get_Array() ); }
341
342 TSG_Point_3D & operator [] (sLong Index) { return( Get_Points()[Index] ); }
343 const TSG_Point_3D & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
344
345
346private:
347
348 CSG_Array m_Points;
349
350};
351
352
354// //
356
357//---------------------------------------------------------
358typedef struct SSG_Point_4D
359{
360 double x, y, z, m;
361}
363
364//---------------------------------------------------------
366{
367public:
368 CSG_Point_4D(void);
369 CSG_Point_4D(const CSG_Point_4D &Point);
370 CSG_Point_4D(const TSG_Point_4D &Point);
371 CSG_Point_4D(double x, double y, double z, double m);
372
373 virtual ~CSG_Point_4D(void) {}
374
375 virtual TSG_Point_Type Get_Type (void) const { return( TSG_Point_Type::SG_POINT_TYPE_4D ); }
376
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) ); }
379
380 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) ); }
381 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) ); }
382
383 CSG_Point_4D operator * (double Value) const { return( CSG_Point_4D(x * Value, y * Value, z * Value, m * Value) ); }
384 CSG_Point_4D operator / (double Value) const { return( CSG_Point_4D(x / Value, y / Value, z / Value, m * Value) ); }
385 virtual CSG_Point_4D & operator *= (double Value) { Multiply(Value); return( *this ); }
386 virtual CSG_Point_4D & operator /= (double Value) { Divide (Value); return( *this ); }
387
388 virtual CSG_Point_4D & operator = (const CSG_Point_4D &Point) { Assign (Point); return( *this ); }
389 virtual CSG_Point_4D & operator += (const CSG_Point_4D &Point) { Add (Point); return( *this ); }
390 virtual CSG_Point_4D & operator -= (const CSG_Point_4D &Point) { Subtract(Point); return( *this ); }
391 virtual CSG_Point_4D & operator *= (const CSG_Point_4D &Point) { Multiply(Point); return( *this ); }
392
393 virtual void Assign (double x, double y, double z, double m);
394 virtual void Assign (const CSG_Point_4D &Point);
395
396 virtual void Add (const CSG_Point_4D &Point);
397 virtual void Subtract (const CSG_Point_4D &Point);
398 virtual void Multiply (const CSG_Point_4D &Point);
399
400 virtual void Multiply (double Value);
401 virtual void Divide (double Value);
402
403 virtual double Get_Length (void) const;
404 virtual double Get_Distance (const CSG_Point_4D &Point) const { CSG_Point_4D d(*this - Point); return( d.Get_Length() ); }
405
406 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) ); }
407 virtual bool is_Equal (double _x, double _y, double _z, double _m, double epsilon = 0.) const
408 {
409 return( fabs(x - _x) <= epsilon && fabs(y - _y) <= epsilon && fabs(z - _z) <= epsilon && fabs(m - _m) <= epsilon );
410 }
411
412};
413
414
416// //
418
419//---------------------------------------------------------
420typedef struct SSG_Point_Int
421{
422 int x, y;
423}
425
426//---------------------------------------------------------
428{
429public:
430 CSG_Points_Int(void);
431 CSG_Points_Int(const CSG_Points_Int &Points);
433
434 bool Clear (void) { return( m_Points.Destroy() ); }
435
436 CSG_Points_Int & operator = (const CSG_Points_Int &Points) { Assign(Points); return( *this ); }
437 bool Assign (const CSG_Points_Int &Points);
438
439 bool Add (int x, int y);
440 bool Add (const TSG_Point_Int &Point) { return( Add(Point.x, Point.y) ); }
441 bool Del (sLong Index) { return( m_Points.Del_Entry(Index) ); }
442
443 bool Set_Count (sLong nPoints) { return( m_Points.Set_Array(nPoints) ); }
444 sLong Get_Count (void) const { return( m_Points.Get_Size() ); }
445
446 TSG_Point_Int * Get_Points (void) const { return( (TSG_Point_Int *)m_Points.Get_Array() ); }
447
448 TSG_Point_Int & operator [] (sLong Index) { return( Get_Points()[Index] ); }
449 const TSG_Point_Int & operator [] (sLong Index) const { return( Get_Points()[Index] ); }
450
451
452private:
453
454 CSG_Array m_Points;
455
456};
457
458
460// //
461// //
462// //
464
465//---------------------------------------------------------
466typedef struct SSG_Rect
467{
468 double xMin, yMin, xMax, yMax;
469}
471
472//---------------------------------------------------------
474{
475public:
476 CSG_Rect(void);
477 CSG_Rect(const CSG_Rect &Rect);
478 CSG_Rect(const TSG_Rect &Rect);
479 CSG_Rect(const CSG_Point &A, const CSG_Point &B);
480 CSG_Rect(double xMin, double yMin, double xMax, double yMax);
481
482 ~CSG_Rect(void);
483
484 bool Create (double xMin, double yMin, double xMax, double yMax);
485 bool Create (const CSG_Point &A, const CSG_Point &B);
486 bool Create (const CSG_Rect &Rect);
487
488 bool operator == (const CSG_Rect &Rect) const { return( is_Equal(Rect) ); }
489 bool operator != (const CSG_Rect &Rect) const { return( !is_Equal(Rect) ); }
490
491 CSG_Rect & operator = (const CSG_Rect &Rect) { Assign(Rect); return( *this ); }
492
493 CSG_Rect & operator += (const CSG_Point &Point) { Move( Point.x, Point.y); return( *this ); }
494 CSG_Rect & operator -= (const CSG_Point &Point) { Move( -Point.x, -Point.y); return( *this ); }
495
496 CSG_Rect & Assign (double xMin, double yMin, double xMax, double yMax);
497 CSG_Rect & Assign (const CSG_Point &A, const CSG_Point &B);
498 CSG_Rect & Assign (const CSG_Rect &Rect);
499
500 CSG_Rect & Set_BottomLeft (double x, double y);
501 CSG_Rect & Set_BottomLeft (const CSG_Point &Point);
502 CSG_Rect & Set_TopRight (double x, double y);
503 CSG_Rect & Set_TopRight (const CSG_Point &Point);
504
505 double Get_XMin (void) const { return( xMin ); }
506 double Get_XMax (void) const { return( xMax ); }
507 double Get_YMin (void) const { return( yMin ); }
508 double Get_YMax (void) const { return( yMax ); }
509
510 double Get_XRange (void) const { return( xMax - xMin ); }
511 double Get_YRange (void) const { return( yMax - yMin ); }
512
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()) ); }
515
516 CSG_Point Get_TopLeft (void) const { return( CSG_Point(xMin, yMax) ); }
517 CSG_Point Get_BottomRight (void) const { return( CSG_Point(xMax, yMin) ); }
518
519 CSG_Point Get_Center (void) const { return( CSG_Point(Get_XCenter(), Get_YCenter()) ); }
520 double Get_XCenter (void) const { return( (xMin + xMax) / 2. ); }
521 double Get_YCenter (void) const { return( (yMin + yMax) / 2. ); }
522
523 CSG_Rect & Move (double dx, double dy);
524 CSG_Rect & Move (const CSG_Point &Point);
525
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);
530
531 CSG_Rect & Union (double x, double y);
532 CSG_Rect & Union (const CSG_Point &Point);
533 CSG_Rect & Union (const CSG_Rect &Rect);
534 bool Intersect (const CSG_Rect &Rect);
535
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;
538
539 bool Contains (double x, double y) const;
540 bool Contains (const CSG_Point &Point) const;
541
542 TSG_Intersection Intersects (const CSG_Rect &Rect) const;
543
544};
545
546//---------------------------------------------------------
548{
549public:
550 CSG_Rects(void);
551 CSG_Rects(const CSG_Rects &Rects);
552 virtual ~CSG_Rects(void);
553
554 void Clear (void);
555
556 CSG_Rects & operator = (const CSG_Rects &Rects);
557 bool Assign (const CSG_Rects &Rects);
558
559 bool Add (void);
560 bool Add (double xMin, double yMin, double xMax, double yMax);
561 bool Add (const CSG_Rect &Rect);
562
563 int Get_Count (void) const { return( m_nRects ); }
564
565 CSG_Rect & operator [] (int Index) { return( *m_Rects[Index] ); }
566 CSG_Rect & Get_Rect (int Index) { return( *m_Rects[Index] ); }
567
568
569private:
570
571 int m_nRects;
572
573 CSG_Rect **m_Rects;
574
575};
576
577
579// //
581
582//---------------------------------------------------------
583typedef struct SSG_Rect_Int
584{
586}
588
589//---------------------------------------------------------
591{
592public:
593 CSG_Rect_Int(void);
594 CSG_Rect_Int(const CSG_Rect_Int &Rect);
595 CSG_Rect_Int(const TSG_Rect_Int &Rect);
597 CSG_Rect_Int(int xMin, int yMin, int xMax, int yMax);
598
599 ~CSG_Rect_Int(void);
600
601 bool Create (int xMin, int yMin, int xMax, int yMax);
602 bool Create (const TSG_Point_Int &A, const TSG_Point_Int &B);
603 bool Create (const CSG_Rect_Int &Rect);
604
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) ); }
607
608 CSG_Rect_Int & operator = (const CSG_Rect_Int &Rect) { Assign(Rect); return( *this ); }
609
610 CSG_Rect_Int & operator += (const TSG_Point_Int &Point) { Move( Point.x, Point.y); return( *this ); }
611 CSG_Rect_Int & operator -= (const TSG_Point_Int &Point) { Move(-Point.x, -Point.y); return( *this ); }
612
613 CSG_Rect_Int & Assign (int xMin, int yMin, int xMax, int yMax);
614 CSG_Rect_Int & Assign (const TSG_Point_Int &A, const TSG_Point_Int &B);
615 CSG_Rect_Int & Assign (const CSG_Rect_Int &Rect);
616
617 CSG_Rect_Int & Set_BottomLeft (int x, int y);
618 CSG_Rect_Int & Set_BottomLeft (const TSG_Point_Int &Point);
619 CSG_Rect_Int & Set_TopRight (int x, int y);
620 CSG_Rect_Int & Set_TopRight (const TSG_Point_Int &Point);
621
622 int Get_XMin (void) const { return( xMin ); }
623 int Get_XMax (void) const { return( xMax ); }
624 int Get_YMin (void) const { return( yMin ); }
625 int Get_YMax (void) const { return( yMax ); }
626
627 int Get_XRange (void) const { return( xMax - xMin ); }
628 int Get_YRange (void) const { return( yMax - yMin ); }
629
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) ); }
632
633 TSG_Point_Int Get_TopLeft (void) const { TSG_Point_Int p; p.x = xMin; p.y = yMax; return( p ); }
634 TSG_Point_Int Get_BottomRight (void) const { TSG_Point_Int p; p.x = xMax; p.y = yMin; return( p ); }
635
636 CSG_Rect_Int & Move (int dx, int dy);
637 CSG_Rect_Int & Move (const TSG_Point_Int &Point);
638
639 CSG_Rect_Int & Inflate (int d);
640 CSG_Rect_Int & Deflate (int d);
641 CSG_Rect_Int & Inflate (int dx, int dy);
642 CSG_Rect_Int & Deflate (int dx, int dy);
643
644 CSG_Rect_Int & Union (int x, int y);
645 CSG_Rect_Int & Union (const TSG_Point_Int &Point);
646 CSG_Rect_Int & Union (const CSG_Rect_Int &Rect);
647 bool Intersect (const CSG_Rect_Int &Rect);
648
649 bool is_Equal (int xMin, int yMin, int xMax, int yMax) const;
650 bool is_Equal (const CSG_Rect_Int &Rect ) const;
651
652 bool Contains (double x, double y) const;
653 bool Contains (const TSG_Point_Int &Point) const;
654
655 TSG_Intersection Intersects (const CSG_Rect_Int &Rect) const;
656
657};
658
659//---------------------------------------------------------
661{
662public:
663 CSG_Rects_Int(void);
664 virtual ~CSG_Rects_Int(void);
665
666 void Clear (void);
667
668 CSG_Rects_Int & operator = (const CSG_Rects_Int &Rects);
669 bool Assign (const CSG_Rects_Int &Rects);
670
671 bool Add (void);
672 bool Add (int xMin, int yMin, int xMax, int yMax);
673 bool Add (const CSG_Rect_Int &Rect);
674
675 int Get_Count (void) const { return( m_nRects ); }
676
677 CSG_Rect_Int & operator [] (int Index) { return( *m_Rects[Index] ); }
678 CSG_Rect_Int & Get_Rect (int Index) { return( *m_Rects[Index] ); }
679
680
681private:
682
683 int m_nRects;
684
685 CSG_Rect_Int **m_Rects;
686
687};
688
689
691// //
692// //
693// //
695
696//---------------------------------------------------------
705
706
708// //
710
711//---------------------------------------------------------
713{
714public:
716 virtual ~CSG_Distance_Weighting(void);
717
718 static bool Enable_Parameters (class CSG_Parameters &Parameters);
719 bool Create_Parameters (class CSG_Parameters &Parameters, const CSG_String &Parent = "", bool bIDW_Offset = false);
720 static bool Add_Parameters (class CSG_Parameters &Parameters, const CSG_String &Parent = "", bool bIDW_Offset = false);
721 bool Set_Parameters (class CSG_Parameters &Parameters);
722
723 TSG_Distance_Weighting Get_Weighting (void) const { return( m_Weighting ); }
724 bool Set_Weighting (TSG_Distance_Weighting Weighting);
725
726 double Get_IDW_Power (void) const { return( m_IDW_Power ); }
727 bool Set_IDW_Power (double Value);
728
729 bool Get_IDW_Offset (void) const { return( m_IDW_bOffset ); }
730 bool Set_IDW_Offset (bool bOn = true);
731
732 double Get_BandWidth (void) const { return( m_Bandwidth ); }
733 bool Set_BandWidth (double Value);
734
735 //-----------------------------------------------------
736 double Get_Weight (double Distance) const
737 {
738 if( Distance < 0. )
739 {
740 return( 0. );
741 }
742
743 switch( m_Weighting )
744 {
745 case SG_DISTWGHT_IDW :
746 return( m_IDW_bOffset
747 ? pow(1. + Distance, -m_IDW_Power) : Distance > 0.
748 ? pow( Distance, -m_IDW_Power) : 0.
749 );
750
751 case SG_DISTWGHT_EXP :
752 return( exp(-Distance / m_Bandwidth) );
753
755 Distance /= m_Bandwidth;
756 return( exp(-0.5 * Distance*Distance) );
757
758 default: // case SG_DISTWGHT_None:
759 return( 1. );
760 }
761 }
762
763
764private:
765
766 bool m_IDW_bOffset;
767
768 double m_IDW_Power, m_Bandwidth;
769
770 TSG_Distance_Weighting m_Weighting;
771
772};
773
774
776// //
777// //
778// //
780
781//---------------------------------------------------------
786
787//---------------------------------------------------------
792
793//---------------------------------------------------------
819
820
822// //
824
825//---------------------------------------------------------
827{
828 friend class CSG_Projections;
829
830public:
831 CSG_Projection(void);
832 virtual ~CSG_Projection(void);
833
834 void Destroy (void);
835
837 bool Create (const CSG_Projection &Projection);
838 CSG_Projection & operator = (const CSG_Projection &Projection) { Create(Projection); return( *this ); }
839
840 CSG_Projection (const char *Definition);
841 bool Create (const char *Definition);
842 CSG_Projection & operator = (const char *Definition) { Create(Definition); return( *this ); }
843
844 CSG_Projection (const wchar_t *Definition);
845 bool Create (const wchar_t *Definition);
846 CSG_Projection & operator = (const wchar_t *Definition) { Create(Definition); return( *this ); }
847
848 CSG_Projection (const CSG_String &Definition);
849 bool Create (const CSG_String &Definition);
850 CSG_Projection & operator = (const CSG_String &Definition) { Create(Definition); return( *this ); }
851
852 CSG_Projection (int Code, const SG_Char *Authority = NULL);
853 bool Create (int Code, const SG_Char *Authority = NULL);
854 CSG_Projection & operator = (int Code) { Create(Code ); return( *this ); }
855
857 bool Create (const CSG_String &WKT2, const CSG_String &PROJ);
858
859 bool Assign (const CSG_Projection &Projection) { return( Create(Projection ) ); }
860 bool Assign (const CSG_String &Definition) { return( Create(Definition ) ); }
861 bool Assign (int Code, const SG_Char *Authority = NULL) { return( Create(Code, Authority ) ); }
862
863 bool is_Okay (void) const { return( m_Type != ESG_CRS_Type::Undefined ); }
864 bool is_Equal (const CSG_Projection &Projection) const;
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 ); }
867
868 static const CSG_Projection & Get_GCS_WGS84 (void);
869 bool Set_GCS_WGS84 (void);
870
871 static CSG_Projection Get_UTM_WGS84 (int Zone, bool bSouth = false);
872 bool Set_UTM_WGS84 (int Zone, bool bSouth = false);
873
874 bool Load (const CSG_String &File);
875 bool Save (const CSG_String &File, ESG_CRS_Format Format = ESG_CRS_Format::WKT) const;
876
877 bool Load (CSG_File &Stream);
878 bool Save (CSG_File &Stream , ESG_CRS_Format Format = ESG_CRS_Format::WKT) const;
879
880 bool Load (const CSG_MetaData &Projection);
881 bool Save ( CSG_MetaData &Projection) const;
882
883 CSG_String Get_Description (bool bDetails = false) const;
884
885 const CSG_String & Get_Name (void) const { return( m_Name ); }
886
887 const CSG_String & Get_WKT (void) const { return( m_WKT2 ); }
888 CSG_String Get_WKT1 (void) const;
889 const CSG_String & Get_WKT2 (void) const { return( m_WKT2 ); }
890 const CSG_String & Get_PROJ (void) const { return( m_PROJ ); }
891 CSG_String Get_JSON (void) const;
892 CSG_String Get_ESRI (void) const;
893 CSG_String Get_XML (void) const;
894 const CSG_String & Get_Authority (void) const { return( m_Authority ); }
895 int Get_Code (void) const { return( m_Code ); }
896
897 const CSG_String & Get_Proj4 (void) const { return( m_PROJ ); }
898 int Get_Authority_ID (void) const { return( m_Code ); }
899 int Get_EPSG (void) const { return( m_Authority.CmpNoCase("EPSG") ? -1 : m_Code ); }
900
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 ); }
905
906 ESG_CRS_Type Get_Type (void) const { return( m_Type ); }
907 CSG_String Get_Type_Identifier (void) const;
908 CSG_String Get_Type_Name (void) const;
909
910 ESG_Projection_Unit Get_Unit (void) const { return( m_Unit ); }
911 CSG_String Get_Unit_Identifier (void) const;
912 CSG_String Get_Unit_Name (void) const;
913 double Get_Unit_To_Meter (void) const;
914
915
916private:
917
918 int m_Code;
919
920 ESG_CRS_Type m_Type;
921
922 ESG_Projection_Unit m_Unit;
923
924 CSG_String m_Name, m_Authority, m_PROJ, m_WKT2;
925
926};
927
928
930// //
932
933//---------------------------------------------------------
937//---------------------------------------------------------
939{
940 friend class CSG_Projection;
941
942public:
943 CSG_Projections(void);
944 virtual ~CSG_Projections(void);
945
946 CSG_Projections (bool LoadCodeList);
947 bool Create (bool LoadCodeList = true);
948
949 void Destroy (void);
950
951 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);
952 static CSG_String Parse (const CSG_String &Definition, ESG_CRS_Format Format);
953
954 bool Load (const CSG_String &File, bool bAppend = false);
955 bool Save (const CSG_String &File);
956
957 bool Add (const CSG_Projection &Projection);
958 bool Add (const SG_Char *WKT, const SG_Char *Proj4, const SG_Char *Authority, int Authority_ID);
959
960 sLong Get_Count (void) const;
961
962 CSG_Projection operator [] (sLong Index) const { return( Get_Projection(Index) ); }
963 CSG_Projection Get_Projection (sLong Index) const;
964 const SG_Char * Get_Projection ( int Code, const SG_Char *Authority = NULL) const;
965 bool Get_Projection (CSG_Projection &Projection, int Code, const SG_Char *Authority = NULL) const;
966
967 bool Get_Preference (CSG_Projection &Projection, int Code, const CSG_String &Authority ) const;
968 bool Get_Preference (CSG_Projection &Projection , const CSG_String &Authority_Code ) const;
969
970 CSG_String Get_Names_List (ESG_CRS_Type Type = ESG_CRS_Type::Undefined, bool bAddSelect = true) const;
971
972 static ESG_CRS_Type Get_CRS_Type (const CSG_String &Identifier);
973 static CSG_String Get_CRS_Type_Identifier (ESG_CRS_Type Type);
974 static CSG_String Get_CRS_Type_Name (ESG_CRS_Type Type);
975
976 static ESG_Projection_Unit Get_Unit (const CSG_String &Identifier);
977 static const CSG_String Get_Unit_Identifier (ESG_Projection_Unit Unit);
978 static const CSG_String Get_Unit_Name (ESG_Projection_Unit Unit, bool bSimple = true);
979 static double Get_Unit_To_Meter (ESG_Projection_Unit Unit);
980
981 static CSG_String Convert_WKT2_to_XML (const CSG_String &WKT);
982
983 void Set_UseInternalDB (bool bUse = true) { m_bUseInternalDB = bUse; }
984 bool Get_UseInternalDB (void) const { return( m_bUseInternalDB ); }
985
986
987private:
988
989 bool m_bUseInternalDB = true;
990
991 class CSG_Table *m_pProjections, *m_pPreferences;
992
993
994 void _On_Construction (void);
995
996
997private:
998
999 CSG_Translator m_WKT1_to_Proj4, m_Proj4_to_WKT1, m_EPSG_to_Idx;
1000
1001 bool _Load (class CSG_Table *pTable, const CSG_String &File, bool bAppend = false) const;
1002
1003 static CSG_Projection _Get_Projection (class CSG_Table_Record *pProjection);
1004
1005 bool _Add_Preferences (void);
1006
1007 static CSG_MetaData _WKT2_to_MetaData (const CSG_String &WKT, bool bTrim);
1008 static bool _WKT2_to_MetaData (CSG_MetaData &MetaData, const CSG_String &WKT);
1009
1010 static CSG_MetaData _WKT1_to_MetaData (const CSG_String &WKT);
1011 static bool _WKT1_to_MetaData (CSG_MetaData &MetaData, const CSG_String &WKT);
1012
1013 bool _WKT1_to_Proj4 (CSG_String &Proj4, const CSG_String &WKT ) const;
1014 bool _WKT1_from_Proj4 (CSG_String &WKT , const CSG_String &Proj4) const;
1015 bool _WKT1_to_Proj4_Set_Datum (CSG_String &Proj4, const CSG_MetaData &WKT) const;
1016
1017 static bool _Proj4_Find_Parameter ( const CSG_String &Proj4, const CSG_String &Key);
1018 static bool _Proj4_Read_Parameter (CSG_String &Value, const CSG_String &Proj4, const CSG_String &Key);
1019 static bool _Proj4_Get_Ellipsoid (CSG_String &Value, const CSG_String &Proj4);
1020 static bool _Proj4_Get_Datum (CSG_String &Value, const CSG_String &Proj4);
1021 static bool _Proj4_Get_Prime_Meridian (CSG_String &Value, const CSG_String &Proj4);
1022 static bool _Proj4_Get_Unit (CSG_String &Value, const CSG_String &Proj4);
1023
1024 bool _Set_Dictionary (void);
1025 bool _Set_Dictionary (CSG_Table &Dictionary, int Direction);
1026
1027};
1028
1029//---------------------------------------------------------
1031
1032//---------------------------------------------------------
1033SAGA_API_DLL_EXPORT bool SG_Get_Projected (class CSG_Shapes *pSource, class CSG_Shapes *pTarget, const CSG_Projection &Target);
1034
1035SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Point &Point );
1036SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Rect &Rectangle);
1037
1038//---------------------------------------------------------
1040
1041
1043// //
1044// Functions //
1045// //
1047
1048//---------------------------------------------------------
1049SAGA_API_DLL_EXPORT bool SG_Is_Equal (double a, double b, double epsilon = 0.);
1050SAGA_API_DLL_EXPORT bool SG_Is_Equal (const TSG_Point &A, const TSG_Point &B, double epsilon = 0.);
1051
1052SAGA_API_DLL_EXPORT bool SG_Is_Between (double x, double a, double b, double epsilon = 0.);
1053SAGA_API_DLL_EXPORT bool SG_Is_Between (const TSG_Point &Point, const TSG_Point &Corner_A, const TSG_Point &Corner_B, double epsilon = 0.);
1054
1055//---------------------------------------------------------
1056SAGA_API_DLL_EXPORT double SG_Get_Length (double dx, double dy);
1057
1058SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by, bool bPolar);
1059SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point &A, const TSG_Point &B , bool bPolar);
1060
1061SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by);
1063
1064SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double az, double bx, double by, double bz);
1066
1067SAGA_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);
1068SAGA_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);
1069
1070SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double dx, double dy);
1071SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double ax, double ay, double bx, double by);
1074SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference (double a, double b);
1075SAGA_API_DLL_EXPORT bool SG_is_Angle_Between (double Angle, double Angle_Min, double Angle_Max, bool bCheckRange = true);
1076
1077SAGA_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);
1078SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion (TSG_Point &Crossing, const TSG_Point &a , const TSG_Point & b, const TSG_Rect &Region);
1079
1080SAGA_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.);
1081SAGA_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);
1082SAGA_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);
1083
1084SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle (TSG_Point Triangle[3], TSG_Point &Point, double &Radius);
1085
1086SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area (TSG_Point *Points, int nPoints);
1088
1089
1091// //
1092// //
1093// //
1095
1096//---------------------------------------------------------
1097#endif // #ifndef HEADER_INCLUDED__SAGA_API__geo_tools_H
TSG_Array_Growth
Definition api_core.h:291
signed long long sLong
Definition api_core.h:158
#define SAGA_API_DLL_EXPORT
Definition api_core.h:94
#define SG_Char
Definition api_core.h:536
SAGA_API_DLL_EXPORT CSG_String operator+(const char *A, const CSG_String &B)
static bool Add_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
double Get_IDW_Power(void) const
Definition geo_tools.h:726
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
Definition geo_tools.h:729
double Get_Weight(double Distance) const
Definition geo_tools.h:736
bool Set_Parameters(class CSG_Parameters &Parameters)
double Get_BandWidth(void) const
Definition geo_tools.h:732
TSG_Distance_Weighting Get_Weighting(void) const
Definition geo_tools.h:723
CSG_Points & Get_Line(sLong Index)
Definition geo_tools.h:242
CSG_Lines(void)
sLong Get_Count(void) const
Definition geo_tools.h:240
const CSG_Points & Get_Line(sLong Index) const
Definition geo_tools.h:243
bool Create(const CSG_Lines &Lines)
bool Destroy(void)
bool Clear(void)
bool Assign(const CSG_Lines &Lines)
virtual void Subtract(const CSG_Point_3D &Point)
virtual double Get_Distance(const CSG_Point_3D &Point) const
Definition geo_tools.h:310
virtual ~CSG_Point_3D(void)
Definition geo_tools.h:279
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
Definition geo_tools.h:312
virtual TSG_Point_Type Get_Type(void) const
Definition geo_tools.h:281
virtual bool is_Equal(double _x, double _y, double _z, double epsilon=0.) const
Definition geo_tools.h:313
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
Definition geo_tools.h:407
virtual double Get_Distance(const CSG_Point_4D &Point) const
Definition geo_tools.h:404
virtual void Add(const CSG_Point_4D &Point)
virtual TSG_Point_Type Get_Type(void) const
Definition geo_tools.h:375
virtual bool is_Equal(const CSG_Point_4D &Point, double epsilon=0.) const
Definition geo_tools.h:406
virtual void Divide(double Value)
virtual double Get_Length(void) const
virtual ~CSG_Point_4D(void)
Definition geo_tools.h:373
virtual void Add(const CSG_Point &Point)
virtual bool is_Equal(double _x, double _y, double epsilon=0.) const
Definition geo_tools.h:176
virtual TSG_Point_Type Get_Type(void) const
Definition geo_tools.h:144
CSG_Point(void)
virtual void Divide(double Value)
virtual void Assign(double x, double y)
virtual ~CSG_Point(void)
Definition geo_tools.h:142
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
Definition geo_tools.h:175
virtual double Get_Distance(const CSG_Point &Point) const
Definition geo_tools.h:173
virtual double Get_Length(void) const
bool Set_Count(sLong nPoints)
Definition geo_tools.h:337
bool Clear(void)
Definition geo_tools.h:328
bool Assign(const CSG_Points_3D &Points)
bool Del(sLong Index)
Definition geo_tools.h:335
TSG_Point_3D * Get_Points(void) const
Definition geo_tools.h:340
bool Add(const TSG_Point_3D &Point)
Definition geo_tools.h:334
sLong Get_Count(void) const
Definition geo_tools.h:338
bool Del(sLong Index)
Definition geo_tools.h:441
sLong Get_Count(void) const
Definition geo_tools.h:444
bool Add(const TSG_Point_Int &Point)
Definition geo_tools.h:440
bool Assign(const CSG_Points_Int &Points)
bool Clear(void)
Definition geo_tools.h:434
bool Set_Count(sLong nPoints)
Definition geo_tools.h:443
TSG_Point_Int * Get_Points(void) const
Definition geo_tools.h:446
bool Set_Count(sLong nPoints)
Definition geo_tools.h:200
bool Clear(void)
Definition geo_tools.h:191
TSG_Point * Get_Points(void) const
Definition geo_tools.h:203
bool Del(sLong Index)
Definition geo_tools.h:198
bool Assign(const CSG_Points &Points)
bool Add(const TSG_Point &Point)
Definition geo_tools.h:197
sLong Get_Count(void) const
Definition geo_tools.h:201
bool is_Geographic(void) const
Definition geo_tools.h:901
const CSG_String & Get_Authority(void) const
Definition geo_tools.h:894
friend class CSG_Projections
Definition geo_tools.h:828
const CSG_String & Get_Name(void) const
Definition geo_tools.h:885
bool is_Projection(void) const
Definition geo_tools.h:904
const CSG_String & Get_Proj4(void) const
Definition geo_tools.h:897
const CSG_String & Get_PROJ(void) const
Definition geo_tools.h:890
void Destroy(void)
int Get_Code(void) const
Definition geo_tools.h:895
ESG_CRS_Type Get_Type(void) const
Definition geo_tools.h:906
const CSG_String & Get_WKT2(void) const
Definition geo_tools.h:889
bool is_Equal(const CSG_Projection &Projection) const
bool Assign(const CSG_String &Definition)
Definition geo_tools.h:860
bool Assign(const CSG_Projection &Projection)
Definition geo_tools.h:859
int Get_Authority_ID(void) const
Definition geo_tools.h:898
ESG_Projection_Unit Get_Unit(void) const
Definition geo_tools.h:910
int Get_EPSG(void) const
Definition geo_tools.h:899
bool Assign(int Code, const SG_Char *Authority=NULL)
Definition geo_tools.h:861
bool Create(const CSG_Projection &Projection)
bool is_Geocentric(void) const
Definition geo_tools.h:903
bool is_Okay(void) const
Definition geo_tools.h:863
const CSG_String & Get_WKT(void) const
Definition geo_tools.h:887
bool is_Geodetic(void) const
Definition geo_tools.h:902
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)
void Destroy(void)
sLong Get_Count(void) const
bool Add(const CSG_Projection &Projection)
bool Get_UseInternalDB(void) const
Definition geo_tools.h:984
bool Load(const CSG_String &File, bool bAppend=false)
void Set_UseInternalDB(bool bUse=true)
Definition geo_tools.h:983
friend class CSG_Projection
Definition geo_tools.h:940
bool is_Equal(int xMin, int yMin, int xMax, int yMax) const
TSG_Point_Int Get_BottomRight(void) const
Definition geo_tools.h:634
int Get_YMin(void) const
Definition geo_tools.h:624
CSG_Rect_Int & Move(int dx, int dy)
int Get_YRange(void) const
Definition geo_tools.h:628
int Get_YMax(void) const
Definition geo_tools.h:625
double Get_Diameter(void) const
Definition geo_tools.h:631
TSG_Point_Int Get_TopLeft(void) const
Definition geo_tools.h:633
int Get_XMax(void) const
Definition geo_tools.h:623
double Get_Area(void) const
Definition geo_tools.h:630
CSG_Rect_Int & Assign(int xMin, int yMin, int xMax, int yMax)
int Get_XMin(void) const
Definition geo_tools.h:622
int Get_XRange(void) const
Definition geo_tools.h:627
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
Definition geo_tools.h:513
bool is_Equal(double xMin, double yMin, double xMax, double yMax, double epsilon=0.) const
double Get_YRange(void) const
Definition geo_tools.h:511
CSG_Rect(void)
CSG_Rect & Move(double dx, double dy)
double Get_YCenter(void) const
Definition geo_tools.h:521
double Get_XMax(void) const
Definition geo_tools.h:506
double Get_XRange(void) const
Definition geo_tools.h:510
double Get_XMin(void) const
Definition geo_tools.h:505
CSG_Point Get_TopLeft(void) const
Definition geo_tools.h:516
double Get_YMin(void) const
Definition geo_tools.h:507
double Get_XCenter(void) const
Definition geo_tools.h:520
double Get_YMax(void) const
Definition geo_tools.h:508
CSG_Point Get_BottomRight(void) const
Definition geo_tools.h:517
double Get_Diameter(void) const
Definition geo_tools.h:514
CSG_Point Get_Center(void) const
Definition geo_tools.h:519
CSG_Rect & Assign(double xMin, double yMin, double xMax, double yMax)
CSG_Rect_Int & Get_Rect(int Index)
Definition geo_tools.h:678
void Clear(void)
bool Assign(const CSG_Rects_Int &Rects)
int Get_Count(void) const
Definition geo_tools.h:675
bool Add(void)
CSG_Rects(void)
void Clear(void)
CSG_Rect & Get_Rect(int Index)
Definition geo_tools.h:566
bool Assign(const CSG_Rects &Rects)
int Get_Count(void) const
Definition geo_tools.h:563
#define B
#define A
SAGA_API_DLL_EXPORT double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle(TSG_Point Triangle[3], TSG_Point &Point, double &Radius)
SAGA_API_DLL_EXPORT bool SG_is_Angle_Between(double Angle, double Angle_Min, double Angle_Max, bool bCheckRange=true)
SAGA_API_DLL_EXPORT double SG_Get_Length(double dx, double dy)
ESG_CRS_Type
Definition geo_tools.h:789
struct SSG_Point TSG_Point
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)
TSG_Distance_Weighting
Definition geo_tools.h:698
@ SG_DISTWGHT_GAUSS
Definition geo_tools.h:702
@ SG_DISTWGHT_None
Definition geo_tools.h:699
@ SG_DISTWGHT_EXP
Definition geo_tools.h:701
@ SG_DISTWGHT_IDW
Definition geo_tools.h:700
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction(double dx, double dy)
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)
SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion(TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
struct SSG_Point_3D TSG_Point_3D
SAGA_API_DLL_EXPORT bool SG_Is_Equal(double a, double b, double epsilon=0.)
SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area(TSG_Point *Points, int nPoints)
SAGA_API_DLL_EXPORT bool SG_Grid_Get_Geographic_Coordinates(CSG_Grid *pGrid, CSG_Grid *pLon, CSG_Grid *pLat)
struct SSG_Point_4D TSG_Point_4D
SAGA_API_DLL_EXPORT CSG_Projections & SG_Get_Projections(void)
ESG_Projection_Unit
Definition geo_tools.h:795
SAGA_API_DLL_EXPORT bool SG_Is_Between(double x, double a, double b, double epsilon=0.)
struct SSG_Rect_Int TSG_Rect_Int
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)
struct SSG_Point_Int TSG_Point_Int
SAGA_API_DLL_EXPORT bool SG_Get_Projected(class CSG_Shapes *pSource, class CSG_Shapes *pTarget, const CSG_Projection &Target)
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.)
TSG_Point_Type
Definition geo_tools.h:112
ESG_CRS_Format
Definition geo_tools.h:783
TSG_Intersection
Definition geo_tools.h:101
@ INTERSECTION_Overlaps
Definition geo_tools.h:104
@ INTERSECTION_None
Definition geo_tools.h:102
@ INTERSECTION_Contains
Definition geo_tools.h:106
@ INTERSECTION_Identical
Definition geo_tools.h:103
@ INTERSECTION_Contained
Definition geo_tools.h:105
struct SSG_Rect TSG_Rect
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)
SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference(double a, double b)
CSG_Vector operator*(double Scalar, const CSG_Vector &Vector)
double x
Definition geo_tools.h:129
double y
Definition geo_tools.h:129
double xMin
Definition geo_tools.h:468
double xMax
Definition geo_tools.h:468
double yMin
Definition geo_tools.h:468
double yMax
Definition geo_tools.h:468