SAGA API  v9.5
geo_classes.cpp
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_classes.cpp //
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 #include "parameters.h"
54 
55 #include "geo_tools.h"
56 
57 
59 // //
60 // CSG_Point //
61 // //
63 
64 //---------------------------------------------------------
66 {
67  Assign(0., 0.);
68 }
69 
71 {
72  Assign(Point.x, Point.y);
73 }
74 
76 {
77  Assign(Point.x, Point.y);
78 }
79 
80 CSG_Point::CSG_Point(double _x, double _y)
81 {
82  Assign(_x, _y);
83 }
84 
85 //---------------------------------------------------------
86 void CSG_Point::Assign(double _x, double _y)
87 {
88  x = _x;
89  y = _y;
90 }
91 
92 void CSG_Point::Assign(const CSG_Point &Point)
93 {
94  x = Point.x;
95  y = Point.y;
96 }
97 
98 //---------------------------------------------------------
99 void CSG_Point::Add(const CSG_Point &Point)
100 {
101  x += Point.x;
102  y += Point.y;
103 }
104 
105 void CSG_Point::Subtract(const CSG_Point &Point)
106 {
107  x -= Point.x;
108  y -= Point.y;
109 }
110 
111 void CSG_Point::Multiply(const CSG_Point &Point)
112 {
113  x *= Point.x;
114  y *= Point.y;
115 }
116 
117 void CSG_Point::Multiply(double Value)
118 {
119  x *= Value;
120  y *= Value;
121 }
122 
123 void CSG_Point::Divide(double Value)
124 {
125  x /= Value;
126  y /= Value;
127 }
128 
129 //---------------------------------------------------------
130 double CSG_Point::Get_Length(void) const
131 {
132  return( sqrt(x*x + y*y) );
133 }
134 
135 
137 // //
139 
140 //---------------------------------------------------------
142 {
143  Assign(0., 0., 0.);
144 }
145 
147 {
148  Assign(Point.x, Point.y, Point.z);
149 }
150 
152 {
153  Assign(Point.x, Point.y, Point.z);
154 }
155 
156 CSG_Point_3D::CSG_Point_3D(double _x, double _y, double _z)
157 {
158  Assign(_x, _y, _z);
159 }
160 
161 //---------------------------------------------------------
162 void CSG_Point_3D::Assign(double _x, double _y, double _z)
163 {
164  x = _x;
165  y = _y;
166  z = _z;
167 }
168 
170 {
171  x = Point.x;
172  y = Point.y;
173  z = Point.z;
174 }
175 
176 //---------------------------------------------------------
177 void CSG_Point_3D::Add(const CSG_Point_3D &Point)
178 {
179  x += Point.x;
180  y += Point.y;
181  z += Point.z;
182 }
183 
185 {
186  x -= Point.x;
187  y -= Point.y;
188  z -= Point.z;
189 }
190 
192 {
193  x *= Point.x;
194  y *= Point.y;
195  z *= Point.z;
196 }
197 
198 void CSG_Point_3D::Multiply(double Value)
199 {
200  x *= Value;
201  y *= Value;
202  z *= Value;
203 }
204 
205 void CSG_Point_3D::Divide(double Value)
206 {
207  x /= Value;
208  y /= Value;
209  z /= Value;
210 }
211 
212 //---------------------------------------------------------
213 double CSG_Point_3D::Get_Length(void) const
214 {
215  return( sqrt(x*x + y*y + z*z) );
216 }
217 
218 
220 // //
222 
223 //---------------------------------------------------------
225 {
226  Assign(0., 0., 0., 0.);
227 }
228 
230 {
231  Assign(Point.x, Point.y, Point.z, Point.m);
232 }
233 
235 {
236  Assign(Point.x, Point.y, Point.z, Point.m);
237 }
238 
239 CSG_Point_4D::CSG_Point_4D(double _x, double _y, double _z, double _m)
240 {
241  Assign(_x, _y, _z, _m);
242 }
243 
244 //---------------------------------------------------------
245 void CSG_Point_4D::Assign(double _x, double _y, double _z, double _m)
246 {
247  x = _x;
248  y = _y;
249  z = _z;
250  m = _m;
251 }
252 
254 {
255  x = Point.x;
256  y = Point.y;
257  z = Point.z;
258  m = Point.m;
259 }
260 
261 //---------------------------------------------------------
262 void CSG_Point_4D::Add(const CSG_Point_4D &Point)
263 {
264  x += Point.x;
265  y += Point.y;
266  z += Point.z;
267  m += Point.m;
268 }
269 
271 {
272  x -= Point.x;
273  y -= Point.y;
274  z -= Point.z;
275  m -= Point.m;
276 }
277 
279 {
280  x *= Point.x;
281  y *= Point.y;
282  z *= Point.z;
283  m *= Point.m;
284 }
285 
286 void CSG_Point_4D::Multiply(double Value)
287 {
288  x *= Value;
289  y *= Value;
290  z *= Value;
291  m *= Value;
292 }
293 
294 void CSG_Point_4D::Divide(double Value)
295 {
296  x /= Value;
297  y /= Value;
298  z /= Value;
299  m /= Value;
300 }
301 
302 //---------------------------------------------------------
303 double CSG_Point_4D::Get_Length(void) const
304 {
305  return( sqrt(x*x + y*y + z*z + m*m) );
306 }
307 
308 
310 // //
311 // //
312 // //
314 
315 //---------------------------------------------------------
317 {
318  m_Points.Create(sizeof(TSG_Point), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
319 }
320 
322 {
323  m_Points.Create(sizeof(TSG_Point), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
324 
325  Assign(Points);
326 }
327 
329 {
330  m_Points.Create(sizeof(TSG_Point), nPoints, Growth);
331 }
332 
333 //---------------------------------------------------------
334 bool CSG_Points::Assign(const CSG_Points &Points)
335 {
336  if( m_Points.Set_Array(Points.m_Points.Get_Size()) )
337  {
338  if( m_Points.Get_Size() > 0 )
339  {
340  memcpy(m_Points.Get_Array(), Points.m_Points.Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
341  }
342 
343  return( true );
344  }
345 
346  return( false );
347 }
348 
349 //---------------------------------------------------------
350 bool CSG_Points::Add(double x, double y)
351 {
352  if( m_Points.Inc_Array() )
353  {
354  TSG_Point *Point = (TSG_Point *)m_Points.Get_Entry(m_Points.Get_Size() - 1);
355 
356  Point->x = x;
357  Point->y = y;
358 
359  return( true );
360  }
361 
362  return( false );
363 }
364 
365 
367 // //
368 // //
369 // //
371 
372 //---------------------------------------------------------
374 {
375  m_Lines.Create(0, TSG_Array_Growth::SG_ARRAY_GROWTH_0);
376 }
377 
379 {
380  m_Lines.Create(0, TSG_Array_Growth::SG_ARRAY_GROWTH_0);
381 
382  Create(Lines);
383 }
384 
385 bool CSG_Lines::Create(const CSG_Lines &Lines)
386 {
387  return( Assign(Lines) );
388 }
389 
391 {
392  m_Lines.Create(0, TSG_Array_Growth::SG_ARRAY_GROWTH_0);
393 
394  Create(nLines);
395 }
396 
398 {
399  return( Set_Count(nLines) );
400 }
401 
402 //---------------------------------------------------------
404 {
405  Destroy();
406 }
407 
408 //---------------------------------------------------------
410 {
411  return( Set_Count(0) );
412 }
413 
414 //---------------------------------------------------------
416 {
417  return( Set_Count(0) );
418 }
419 
420 //---------------------------------------------------------
421 bool CSG_Lines::Assign(const CSG_Lines &Lines)
422 {
423  if( Set_Count(Lines.Get_Count()) )
424  {
425  for(sLong i=0; i<Lines.Get_Count(); i++)
426  {
427  Get_Line(i).Assign(Lines[i]);
428  }
429 
430  return( true );
431  }
432 
433  return( false );
434 }
435 
436 //---------------------------------------------------------
438 {
439  Set_Count(Get_Count() + 1);
440 
441  return( Get_Line(Get_Count() - 1) );
442 }
443 
444 //---------------------------------------------------------
445 bool CSG_Lines::Add(const CSG_Points &Line)
446 {
447  Add().Assign(Line);
448 
449  return( true );
450 }
451 
452 //---------------------------------------------------------
453 bool CSG_Lines::Add(const CSG_Lines &Lines)
454 {
455  for(sLong i=0; i<Lines.Get_Count(); i++)
456  {
457  Add(Lines[i]);
458  }
459 
460  return( true );
461 }
462 
463 //---------------------------------------------------------
465 {
466  if( Index >= 0 && Index < m_Lines.Get_Size() )
467  {
468  delete((CSG_Points *)m_Lines[Index]);
469 
470  return( m_Lines.Del(Index) );
471  }
472 
473  return( false );
474 }
475 
476 //---------------------------------------------------------
478 {
479  if( new_Count < 0 )
480  {
481  new_Count = 0;
482  }
483 
484  sLong old_Count = m_Lines.Get_Size();
485 
486  if( new_Count > old_Count )
487  {
488  m_Lines.Set_Array(new_Count);
489 
490  for(sLong i=old_Count; i<new_Count; i++)
491  {
492  m_Lines[i] = new CSG_Points;
493  }
494  }
495  else if( new_Count < old_Count )
496  {
497  for(sLong i=new_Count; i<old_Count; i++)
498  {
499  delete((CSG_Points *)m_Lines[i]);
500  }
501 
502  m_Lines.Set_Array(new_Count);
503  }
504 
505  return( true );
506 }
507 
508 double CSG_Lines::Get_Length(void) const
509 {
510  double Length = 0.;
511 
512  for(sLong i=0; i<Get_Count(); i++)
513  {
514  Length += Get_Length(i);
515  }
516 
517  return( Length );
518 }
519 
520 double CSG_Lines::Get_Length(sLong Index) const
521 {
522  double Length = 0.;
523 
524  if( Index >= 0 && Index < Get_Count() )
525  {
526  const CSG_Points &Line = Get_Line(Index);
527 
528  if( Line.Get_Count() > 1 )
529  {
530  for(sLong i=0, j=1; j<Line.Get_Count(); i++, j++)
531  {
532  Length += SG_Get_Distance(Line[i], Line[j]);
533  }
534  }
535  }
536 
537  return( Length );
538 }
539 
540 
542 // //
543 // //
544 // //
546 
547 //---------------------------------------------------------
549 {
550  m_Points.Create(sizeof(TSG_Point_3D), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
551 }
552 
554 {
555  m_Points.Create(sizeof(CSG_Points_3D), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
556 
557  Assign(Points);
558 }
559 
561 {
562  m_Points.Create(sizeof(TSG_Point_3D), nPoints, Growth);
563 }
564 
565 //---------------------------------------------------------
567 {
568  if( m_Points.Set_Array(Points.m_Points.Get_Size()) )
569  {
570  if( m_Points.Get_Size() > 0 )
571  {
572  memcpy(m_Points.Get_Array(), Points.m_Points.Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
573  }
574 
575  return( true );
576  }
577 
578  return( false );
579 }
580 
581 //---------------------------------------------------------
582 bool CSG_Points_3D::Add(double x, double y, double z)
583 {
584  if( m_Points.Inc_Array() )
585  {
586  TSG_Point_3D *Point = (TSG_Point_3D *)m_Points.Get_Entry(m_Points.Get_Size() - 1);
587 
588  Point->x = x;
589  Point->y = y;
590  Point->z = z;
591 
592  return( true );
593  }
594 
595  return( false );
596 }
597 
598 
600 // //
601 // //
602 // //
604 
605 //---------------------------------------------------------
607 {
608  m_Points.Create(sizeof(TSG_Point_Int), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
609 }
610 
612 {
613  m_Points.Create(sizeof(TSG_Point_Int), 0, TSG_Array_Growth::SG_ARRAY_GROWTH_1);
614 
615  Assign(Points);
616 }
617 
619 {
620  m_Points.Create(sizeof(TSG_Point_Int), nPoints, Growth);
621 }
622 
623 //---------------------------------------------------------
625 {
626  if( m_Points.Set_Array(Points.m_Points.Get_Size()) )
627  {
628  if( m_Points.Get_Size() > 0 )
629  {
630  memcpy(m_Points.Get_Array(), Points.m_Points.Get_Array(), m_Points.Get_Size() * m_Points.Get_Value_Size());
631  }
632 
633  return( true );
634  }
635 
636  return( false );
637 }
638 
639 //---------------------------------------------------------
640 bool CSG_Points_Int::Add(int x, int y)
641 {
642  if( m_Points.Inc_Array() )
643  {
644  TSG_Point_Int *Point = (TSG_Point_Int *)m_Points.Get_Entry(m_Points.Get_Size() - 1);
645 
646  Point->x = x;
647  Point->y = y;
648 
649  return( true );
650  }
651 
652  return( false );
653 }
654 
655 
657 // //
658 // CSG_Rect //
659 // //
661 
662 //---------------------------------------------------------
664 {
665  Assign(0., 0., 0., 0.);
666 }
667 
669 {
670  Assign(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax);
671 }
672 
674 {
675  Assign(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax);
676 }
677 
679 {
680  Assign(A.x, A.y, B.x, B.y);
681 }
682 
683 CSG_Rect::CSG_Rect(double xMin, double yMin, double xMax, double yMax)
684 {
685  Assign(xMin, yMin, xMax, yMax);
686 }
687 
688 //---------------------------------------------------------
690 {}
691 
692 
694 // //
696 
697 //---------------------------------------------------------
698 bool CSG_Rect::Create(double _xMin, double _yMin, double _xMax, double _yMax)
699 {
700  xMin = _xMin < _xMax ? _xMin : _xMax;
701  xMax = _xMin < _xMax ? _xMax : _xMin;
702 
703  yMin = _yMin < _yMax ? _yMin : _yMax;
704  yMax = _yMin < _yMax ? _yMax : _yMin;
705 
706  return( xMin < xMax && yMin < yMax );
707 }
708 
709 //---------------------------------------------------------
710 bool CSG_Rect::Create(const CSG_Point &A, const CSG_Point &B)
711 {
712  return( Create(A.x, A.y, B.x, B.y) );
713 }
714 
715 //---------------------------------------------------------
716 bool CSG_Rect::Create(const CSG_Rect &Rect)
717 {
718  return( (Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax) );
719 }
720 
721 
723 // //
725 
726 //---------------------------------------------------------
727 CSG_Rect & CSG_Rect::Assign(double xMin, double yMin, double xMax, double yMax)
728 {
729  Create(xMin, yMin, xMax, yMax);
730 
731  return( *this );
732 }
733 
735 {
736  Create(A.x, A.y, B.x, B.y);
737 
738  return( *this );
739 }
740 
742 {
743  Create(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax);
744 
745  return( *this );
746 }
747 
748 //---------------------------------------------------------
749 CSG_Rect & CSG_Rect::Set_BottomLeft(double x, double y)
750 {
751  Assign(x, y, xMax, yMax);
752 
753  return( *this );
754 }
755 
757 {
758  Set_BottomLeft(Point.x, Point.y );
759 
760  return( *this );
761 }
762 
763 CSG_Rect & CSG_Rect::Set_TopRight(double x, double y)
764 {
765  Assign(xMin, yMin, x, y);
766 
767  return( *this );
768 }
769 
771 {
772  Set_TopRight(Point.x, Point.y );
773 
774  return( *this );
775 }
776 
777 //---------------------------------------------------------
778 CSG_Rect & CSG_Rect::Move(double dx, double dy)
779 {
780  xMin += dx; yMin += dy;
781  xMax += dx; yMax += dy;
782 
783  return( *this );
784 }
785 
787 {
788  return( Move(Point.x, Point.y) );
789 }
790 
791 //---------------------------------------------------------
792 CSG_Rect & CSG_Rect::Inflate(double dx, double dy, bool bPercent)
793 {
794  if( bPercent )
795  {
796  dx = (Get_XRange() * 0.01 * dx) / 2.;
797  dy = (Get_YRange() * 0.01 * dy) / 2.;
798  }
799 
800  Assign(
801  xMin - dx, yMin - dy,
802  xMax + dx, yMax + dy
803  );
804 
805  return( *this );
806 }
807 
808 CSG_Rect & CSG_Rect::Inflate(double d, bool bPercent)
809 {
810  return( Inflate(d, d, bPercent) );
811 }
812 
813 CSG_Rect & CSG_Rect::Deflate(double dx, double dy, bool bPercent)
814 {
815  return( Inflate(-dx, -dy, bPercent) );
816 }
817 
818 CSG_Rect & CSG_Rect::Deflate(double d, bool bPercent)
819 {
820  return( Deflate(d, d, bPercent) );
821 }
822 
823 //---------------------------------------------------------
824 CSG_Rect & CSG_Rect::Union(double x, double y)
825 {
826  if( xMin > x ) { xMin = x; } else if( xMax < x ) { xMax = x; }
827  if( yMin > y ) { yMin = y; } else if( yMax < y ) { yMax = y; }
828 
829  return( *this );
830 }
831 
832 //---------------------------------------------------------
834 {
835  if( xMin > Point.x ) { xMin = Point.x; } else if( xMax < Point.x ) { xMax = Point.x; }
836  if( yMin > Point.y ) { yMin = Point.y; } else if( yMax < Point.y ) { yMax = Point.y; }
837 
838  return( *this );
839 }
840 
841 //---------------------------------------------------------
843 {
844  if( xMin > Rect.Get_XMin() ) { xMin = Rect.Get_XMin(); }
845  if( yMin > Rect.Get_YMin() ) { yMin = Rect.Get_YMin(); }
846  if( xMax < Rect.Get_XMax() ) { xMax = Rect.Get_XMax(); }
847  if( yMax < Rect.Get_YMax() ) { yMax = Rect.Get_YMax(); }
848 
849  return( *this );
850 }
851 
852 
854 // //
856 
857 //---------------------------------------------------------
858 bool CSG_Rect::is_Equal(double xMin, double yMin, double xMax, double yMax, double epsilon) const
859 {
860  return( SG_Is_Equal(this->xMin, xMin, epsilon) && SG_Is_Equal(this->yMin, yMin, epsilon)
861  && SG_Is_Equal(this->xMax, xMax, epsilon) && SG_Is_Equal(this->yMax, yMax, epsilon) );
862 }
863 
864 bool CSG_Rect::is_Equal(const CSG_Rect &Rect, double epsilon) const
865 {
866  return( is_Equal(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax, epsilon) );
867 }
868 
869 //---------------------------------------------------------
870 bool CSG_Rect::Contains(double x, double y) const
871 {
872  return( xMin <= x && x <= xMax && yMin <= y && y <= yMax );
873 }
874 
875 bool CSG_Rect::Contains(const CSG_Point &Point) const
876 {
877  return( Contains(Point.x, Point.y) );
878 }
879 
880 //---------------------------------------------------------
882 {
883  if( xMax < Rect.Get_XMin() || Rect.Get_XMax() < xMin
884  || yMax < Rect.Get_YMin() || Rect.Get_YMax() < yMin )
885  {
886  return( INTERSECTION_None );
887  }
888 
889  if( is_Equal(Rect) )
890  {
891  return( INTERSECTION_Identical );
892  }
893 
894  if( Contains(Rect.Get_XMin(), Rect.Get_YMin())
895  && Contains(Rect.Get_XMax(), Rect.Get_YMax()) )
896  {
897  return( INTERSECTION_Contains );
898  }
899 
900  if( Rect.Contains(Get_XMin(), Get_YMin())
901  && Rect.Contains(Get_XMax(), Get_YMax()) )
902  {
903  return( INTERSECTION_Contained );
904  }
905 
906  return( INTERSECTION_Overlaps );
907 }
908 
909 //---------------------------------------------------------
910 bool CSG_Rect::Intersect(const CSG_Rect &Rect)
911 {
912  switch( Intersects(Rect) )
913  {
914  case INTERSECTION_None: default:
915  return( false );
916 
919  break;
920 
922  (*this) = Rect;
923  break;
924 
926  if( xMin < Rect.Get_XMin() ) { xMin = Rect.Get_XMin(); }
927  if( yMin < Rect.Get_YMin() ) { yMin = Rect.Get_YMin(); }
928  if( xMax > Rect.Get_XMax() ) { xMax = Rect.Get_XMax(); }
929  if( yMax > Rect.Get_YMax() ) { yMax = Rect.Get_YMax(); }
930  break;
931  }
932 
933  return( true );
934 }
935 
936 
938 // //
940 
941 //---------------------------------------------------------
943 {
944  m_nRects = 0; m_Rects = NULL;
945 }
946 
947 //---------------------------------------------------------
949 {
950  m_nRects = 0; m_Rects = NULL;
951 
952  Assign(Rects);
953 }
954 
955 //---------------------------------------------------------
957 {
958  Clear();
959 }
960 
961 //---------------------------------------------------------
963 {
964  if( m_Rects )
965  {
966  for(int i=0; i<m_nRects; i++)
967  {
968  delete(m_Rects[i]);
969  }
970 
971  SG_Free(m_Rects);
972  }
973 
974  m_nRects = 0;
975  m_Rects = NULL;
976 }
977 
978 //---------------------------------------------------------
979 bool CSG_Rects::Assign(const CSG_Rects &Rects)
980 {
981  Clear();
982 
983  for(int i=0; i<Rects.m_nRects; i++)
984  {
985  Add(*Rects.m_Rects[i]);
986  }
987 
988  return( true );
989 }
990 
991 //---------------------------------------------------------
993 {
994  Assign(Rects);
995 
996  return( *this );
997 }
998 
999 //---------------------------------------------------------
1000 bool CSG_Rects::Add(void)
1001 {
1002  return( Add(CSG_Rect()) );
1003 }
1004 
1005 //---------------------------------------------------------
1006 bool CSG_Rects::Add(double xMin, double yMin, double xMax, double yMax)
1007 {
1008  return( Add(CSG_Rect(xMin, yMin, xMax, yMax)) );
1009 }
1010 
1011 //---------------------------------------------------------
1012 bool CSG_Rects::Add(const CSG_Rect &Rect)
1013 {
1014  m_Rects = (CSG_Rect **)SG_Realloc(m_Rects, ((uLong)m_nRects + 1) * sizeof(CSG_Rect *));
1015  m_Rects[m_nRects] = new CSG_Rect(Rect);
1016  m_nRects++;
1017 
1018  return( true );
1019 }
1020 
1021 
1023 // //
1024 // CSG_Rect_Int //
1025 // //
1027 
1028 //---------------------------------------------------------
1030 {
1031  Create(0, 0, 0, 0);
1032 }
1033 
1035 {
1036  Create(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax);
1037 }
1038 
1040 {
1041  Create(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax);
1042 }
1043 
1045 {
1046  Create(A.x, A.y, B.x, B.y);
1047 }
1048 
1049 CSG_Rect_Int::CSG_Rect_Int(int xMin, int yMin, int xMax, int yMax)
1050 {
1051  Create(xMin, yMin, xMax, yMax);
1052 }
1053 
1054 //---------------------------------------------------------
1056 {}
1057 
1058 
1060 // //
1062 
1063 //---------------------------------------------------------
1064 bool CSG_Rect_Int::Create(int _xMin, int _yMin, int _xMax, int _yMax)
1065 {
1066  xMin = _xMin < _xMax ? _xMin : _xMax;
1067  xMax = _xMin < _xMax ? _xMax : _xMin;
1068 
1069  yMin = _yMin < _yMax ? _yMin : _yMax;
1070  yMax = _yMin < _yMax ? _yMax : _yMin;
1071 
1072  return( xMin < xMax && yMin < yMax );
1073 }
1074 
1075 //---------------------------------------------------------
1077 {
1078  return( Create(A.x, A.y, B.x, B.y) );
1079 }
1080 
1081 //---------------------------------------------------------
1083 {
1084  return( Create(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax) );
1085 }
1086 
1087 
1089 // //
1091 
1092 //---------------------------------------------------------
1093 CSG_Rect_Int & CSG_Rect_Int::Assign(int xMin, int yMin, int xMax, int yMax)
1094 {
1095  Create(xMin, yMin, xMax, yMax); return( *this );
1096 }
1097 
1099 {
1100  return( Assign(A.x, A.y, B.x, B.y) );
1101 }
1102 
1104 {
1105  return( Assign(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax) );
1106 }
1107 
1108 //---------------------------------------------------------
1110 {
1111  return( Assign(x, y, xMax, yMax) );
1112 }
1113 
1115 {
1116  return( Set_BottomLeft(Point.x, Point.y) );
1117 }
1118 
1120 {
1121  return( Assign(xMin, yMin, x, y) );
1122 }
1123 
1125 {
1126  return( Set_TopRight(Point.x, Point.y ) );
1127 }
1128 
1129 //---------------------------------------------------------
1131 {
1132  xMin += dx; yMin += dy;
1133  xMax += dx; yMax += dy;
1134 
1135  return( *this );
1136 }
1137 
1139 {
1140  return( Move(Point.x, Point.y) );
1141 }
1142 
1143 //---------------------------------------------------------
1145 {
1146  return( Assign(xMin - dx, yMin - dy, xMax + dx, yMax + dy) );
1147 }
1148 
1150 {
1151  return( Inflate(d, d) );
1152 }
1153 
1155 {
1156  return( Inflate(-dx, -dy) );
1157 }
1158 
1160 {
1161  return( Deflate(d, d) );
1162 }
1163 
1164 //---------------------------------------------------------
1166 {
1167  if( xMin > x ) { xMin = x; } else if( xMax < x ) { xMax = x; }
1168  if( yMin > y ) { yMin = y; } else if( yMax < y ) { yMax = y; }
1169 
1170  return( *this );
1171 }
1172 
1173 //---------------------------------------------------------
1175 {
1176  if( xMin > Point.x ) { xMin = Point.x; } else if( xMax < Point.x ) { xMax = Point.x; }
1177  if( yMin > Point.y ) { yMin = Point.y; } else if( yMax < Point.y ) { yMax = Point.y; }
1178 
1179  return( *this );
1180 }
1181 
1182 //---------------------------------------------------------
1184 {
1185  if( xMin > Rect.Get_XMin() ) { xMin = Rect.Get_XMin(); }
1186  if( yMin > Rect.Get_YMin() ) { yMin = Rect.Get_YMin(); }
1187  if( xMax < Rect.Get_XMax() ) { xMax = Rect.Get_XMax(); }
1188  if( yMax < Rect.Get_YMax() ) { yMax = Rect.Get_YMax(); }
1189 
1190  return( *this );
1191 }
1192 
1193 //---------------------------------------------------------
1195 {
1196  switch( Intersects(Rect) )
1197  {
1198  case INTERSECTION_None: default:
1199  return( false );
1200 
1203  break;
1204 
1205  case INTERSECTION_Contains:
1206  (*this) = Rect;
1207  break;
1208 
1209  case INTERSECTION_Overlaps:
1210  if( xMin < Rect.Get_XMin() ) { xMin = Rect.Get_XMin(); }
1211  if( yMin < Rect.Get_YMin() ) { yMin = Rect.Get_YMin(); }
1212  if( xMax > Rect.Get_XMax() ) { xMax = Rect.Get_XMax(); }
1213  if( yMax > Rect.Get_YMax() ) { yMax = Rect.Get_YMax(); }
1214  break;
1215  }
1216 
1217  return( true );
1218 }
1219 
1220 
1222 // //
1224 
1225 //---------------------------------------------------------
1226 bool CSG_Rect_Int::is_Equal(int xMin, int yMin, int xMax, int yMax) const
1227 {
1228  return( (this->xMin == xMin) && (this->yMin == yMin)
1229  && (this->xMax == xMax) && (this->yMax == yMax) );
1230 }
1231 
1232 bool CSG_Rect_Int::is_Equal(const CSG_Rect_Int &Rect) const
1233 {
1234  return( is_Equal(Rect.xMin, Rect.yMin, Rect.xMax, Rect.yMax) );
1235 }
1236 
1237 //---------------------------------------------------------
1238 bool CSG_Rect_Int::Contains(double x, double y) const
1239 {
1240  return( xMin <= x && x <= xMax && yMin <= y && y <= yMax );
1241 }
1242 
1243 bool CSG_Rect_Int::Contains(const TSG_Point_Int &Point) const
1244 {
1245  return( Contains(Point.x, Point.y) );
1246 }
1247 
1248 //---------------------------------------------------------
1250 {
1251  if( xMax < Rect.Get_XMin() || Rect.Get_XMax() < xMin
1252  || yMax < Rect.Get_YMin() || Rect.Get_YMax() < yMin )
1253  {
1254  return( INTERSECTION_None );
1255  }
1256 
1257  if( is_Equal(Rect) )
1258  {
1259  return( INTERSECTION_Identical );
1260  }
1261 
1262  if( Contains(Rect.Get_XMin(), Rect.Get_YMin())
1263  && Contains(Rect.Get_XMax(), Rect.Get_YMax()) )
1264  {
1265  return( INTERSECTION_Contains );
1266  }
1267 
1268  if( Rect.Contains(Get_XMin(), Get_YMin())
1269  && Rect.Contains(Get_XMax(), Get_YMax()) )
1270  {
1271  return( INTERSECTION_Contained );
1272  }
1273 
1274  return( INTERSECTION_Overlaps );
1275 }
1276 
1277 
1279 // //
1281 
1282 //---------------------------------------------------------
1284 {
1285  m_nRects = 0;
1286  m_Rects = NULL;
1287 }
1288 
1289 //---------------------------------------------------------
1291 {
1292  Clear();
1293 }
1294 
1295 //---------------------------------------------------------
1297 {
1298  if( m_Rects )
1299  {
1300  for(int i=0; i<m_nRects; i++)
1301  {
1302  delete(m_Rects[i]);
1303  }
1304 
1305  SG_Free(m_Rects);
1306  }
1307 
1308  m_nRects = 0;
1309  m_Rects = NULL;
1310 }
1311 
1312 //---------------------------------------------------------
1314 {
1315  Clear();
1316 
1317  for(int i=0; i<Rects.m_nRects; i++)
1318  {
1319  Add(*Rects.m_Rects[i]);
1320  }
1321 
1322  return( true );
1323 }
1324 
1325 //---------------------------------------------------------
1327 {
1328  Assign(Rects);
1329 
1330  return( *this );
1331 }
1332 
1333 //---------------------------------------------------------
1335 {
1336  return( Add(CSG_Rect_Int()) );
1337 }
1338 
1339 //---------------------------------------------------------
1340 bool CSG_Rects_Int::Add(int xMin, int yMin, int xMax, int yMax)
1341 {
1342  return( Add(CSG_Rect_Int(xMin, yMin, xMax, yMax)) );
1343 }
1344 
1345 //---------------------------------------------------------
1347 {
1348  m_Rects = (CSG_Rect_Int **)SG_Realloc(m_Rects, ((uLong)m_nRects + 1) * sizeof(CSG_Rect_Int *));
1349  m_Rects[m_nRects] = new CSG_Rect_Int(Rect);
1350  m_nRects++;
1351 
1352  return( true );
1353 }
1354 
1355 
1357 // //
1358 // //
1359 // //
1361 
1362 //---------------------------------------------------------
1364 {
1365  m_Weighting = SG_DISTWGHT_None;
1366 
1367  m_IDW_Power = 2.;
1368  m_IDW_bOffset = true;
1369 
1370  m_Bandwidth = 1.;
1371 }
1372 
1373 //---------------------------------------------------------
1375 {}
1376 
1377 //---------------------------------------------------------
1378 bool CSG_Distance_Weighting::Create_Parameters(CSG_Parameters &Parameters, const CSG_String &Parent, bool bIDW_Offset)
1379 {
1380  if( Add_Parameters(Parameters, Parent, bIDW_Offset) )
1381  {
1382  #define INIT_VALUE(id, val) if( Parameters(id) ) { Parameters(id)->Set_Value(val); Parameters(id)->Set_Default(val); }
1383 
1384  INIT_VALUE("DW_WEIGHTING" ,(int)m_Weighting );
1385  INIT_VALUE("DW_IDW_POWER" , m_IDW_Power );
1386  INIT_VALUE("DW_IDW_OFFSET", m_IDW_bOffset);
1387  INIT_VALUE("DW_BANDWIDTH" , m_Bandwidth );
1388 
1389  return( true );
1390  }
1391 
1392  return( false );
1393 }
1394 
1395 //---------------------------------------------------------
1396 bool CSG_Distance_Weighting::Add_Parameters(CSG_Parameters &Parameters, const CSG_String &Parent, bool bIDW_Offset)
1397 {
1398  Parameters.Add_Choice(Parent,
1399  "DW_WEIGHTING" , _TL("Weighting Function"),
1400  _TL(""),
1401  CSG_String::Format("%s|%s|%s|%s",
1402  _TL("no distance weighting"),
1403  _TL("inverse distance to a power"),
1404  _TL("exponential"),
1405  _TL("gaussian")
1406  ), 0
1407  );
1408 
1409  Parameters.Add_Double("DW_WEIGHTING",
1410  "DW_IDW_POWER" , _TL("Power"),
1411  _TL(""),
1412  2., 0., true
1413  );
1414 
1415  if( bIDW_Offset )
1416  {
1417  Parameters.Add_Bool ("DW_WEIGHTING",
1418  "DW_IDW_OFFSET" , _TL("Offset"),
1419  _TL("Calculates weights for distance plus one, avoiding division by zero for zero distances"),
1420  true
1421  );
1422  }
1423 
1424  Parameters.Add_Double("DW_WEIGHTING",
1425  "DW_BANDWIDTH" , _TL("Bandwidth"),
1426  _TL("Bandwidth for exponential and Gaussian weighting"),
1427  1., 0., true
1428  );
1429 
1430  return( true );
1431 }
1432 
1433 //---------------------------------------------------------
1435 {
1436  if( Parameters("DW_WEIGHTING") )
1437  {
1438  int Method = Parameters("DW_WEIGHTING")->asInt();
1439 
1440  Parameters.Set_Enabled("DW_IDW_OFFSET", Method == 1);
1441  Parameters.Set_Enabled("DW_IDW_POWER" , Method == 1);
1442  Parameters.Set_Enabled("DW_BANDWIDTH" , Method >= 2);
1443  }
1444 
1445  return( true );
1446 }
1447 
1448 //---------------------------------------------------------
1450 {
1451  if( Parameters("DW_WEIGHTING") )
1452  {
1453  switch( Parameters("DW_WEIGHTING")->asInt() )
1454  {
1455  case 0: Set_Weighting(SG_DISTWGHT_None ); break;
1456  case 1: Set_Weighting(SG_DISTWGHT_IDW ); break;
1457  case 2: Set_Weighting(SG_DISTWGHT_EXP ); break;
1458  case 3: Set_Weighting(SG_DISTWGHT_GAUSS); break;
1459  }
1460  }
1461 
1462  if( Parameters("DW_IDW_OFFSET") )
1463  {
1464  Set_IDW_Offset(Parameters("DW_IDW_OFFSET")->asBool ());
1465  }
1466 
1467  if( Parameters("DW_IDW_POWER" ) )
1468  {
1469  Set_IDW_Power (Parameters("DW_IDW_POWER" )->asDouble());
1470  }
1471 
1472  if( Parameters("DW_BANDWIDTH" ) )
1473  {
1474  Set_BandWidth (Parameters("DW_BANDWIDTH" )->asDouble());
1475  }
1476 
1477  return( true );
1478 }
1479 
1480 
1482 // //
1484 
1485 //---------------------------------------------------------
1487 {
1488  m_Weighting = Weighting;
1489 
1490  return( true );
1491 }
1492 
1493 //---------------------------------------------------------
1495 {
1496  if( Value <= 0. )
1497  {
1498  return( false );
1499  }
1500 
1501  m_IDW_Power = Value;
1502 
1503  return( true );
1504 }
1505 
1506 //---------------------------------------------------------
1508 {
1509  m_IDW_bOffset = bOn;
1510 
1511  return( true );
1512 }
1513 
1514 //---------------------------------------------------------
1516 {
1517  if( Value <= 0. )
1518  {
1519  return( false );
1520  }
1521 
1522  m_Bandwidth = Value;
1523 
1524  return( true );
1525 }
1526 
1527 
1529 // //
1530 // //
1531 // //
1533 
1534 //---------------------------------------------------------
CSG_Rects_Int::CSG_Rects_Int
CSG_Rects_Int(void)
Definition: geo_classes.cpp:1283
CSG_Rect
Definition: geo_tools.h:471
CSG_Array::Set_Array
bool Set_Array(sLong nValues, bool bShrink=true)
Definition: api_memory.cpp:310
CSG_Rect::Assign
CSG_Rect & Assign(double xMin, double yMin, double xMax, double yMax)
Definition: geo_classes.cpp:727
CSG_Points::Add
bool Add(double x, double y)
Definition: geo_classes.cpp:350
CSG_Rect::Deflate
CSG_Rect & Deflate(double d, bool bPercent=true)
Definition: geo_classes.cpp:818
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
CSG_Rect_Int::Contains
bool Contains(double x, double y) const
Definition: geo_classes.cpp:1238
CSG_Point_3D::Add
virtual void Add(const CSG_Point_3D &Point)
Definition: geo_classes.cpp:177
SSG_Rect_Int::yMax
int yMax
Definition: geo_tools.h:582
TSG_Array_Growth
TSG_Array_Growth
Definition: api_core.h:291
CSG_Rects_Int::Assign
bool Assign(const CSG_Rects_Int &Rects)
Definition: geo_classes.cpp:1313
CSG_Rects
Definition: geo_tools.h:545
CSG_Lines::Create
bool Create(const CSG_Lines &Lines)
Definition: geo_classes.cpp:385
CSG_Rect_Int::Get_YMin
int Get_YMin(void) const
Definition: geo_tools.h:621
CSG_Points_3D::CSG_Points_3D
CSG_Points_3D(void)
Definition: geo_classes.cpp:548
_TL
#define _TL(s)
Definition: api_core.h:1489
TSG_Distance_Weighting
TSG_Distance_Weighting
Definition: geo_tools.h:695
CSG_Array::Get_Size
sLong Get_Size(void) const
Definition: api_core.h:327
CSG_Distance_Weighting::Enable_Parameters
static bool Enable_Parameters(class CSG_Parameters &Parameters)
Definition: geo_classes.cpp:1434
CSG_Points_3D::Add
bool Add(double x, double y, double z)
Definition: geo_classes.cpp:582
SSG_Rect_Int::yMin
int yMin
Definition: geo_tools.h:582
CSG_Points_Int::Add
bool Add(int x, int y)
Definition: geo_classes.cpp:640
CSG_Point_3D::Get_Length
virtual double Get_Length(void) const
Definition: geo_classes.cpp:213
CSG_Point_3D::Subtract
virtual void Subtract(const CSG_Point_3D &Point)
Definition: geo_classes.cpp:184
CSG_Rect_Int::Get_XMax
int Get_XMax(void) const
Definition: geo_tools.h:620
CSG_Rect_Int::Inflate
CSG_Rect_Int & Inflate(int d)
Definition: geo_classes.cpp:1149
SG_DISTWGHT_EXP
@ SG_DISTWGHT_EXP
Definition: geo_tools.h:698
A
#define A
CSG_Point::Subtract
virtual void Subtract(const CSG_Point &Point)
Definition: geo_classes.cpp:105
CSG_Points_Int
Definition: geo_tools.h:425
CSG_Rect::Get_XMax
double Get_XMax(void) const
Definition: geo_tools.h:503
CSG_Array_Pointer::Get_Size
sLong Get_Size(void) const
Definition: api_core.h:381
CSG_Rects::~CSG_Rects
virtual ~CSG_Rects(void)
Definition: geo_classes.cpp:956
CSG_Rect::~CSG_Rect
~CSG_Rect(void)
Definition: geo_classes.cpp:689
CSG_Rect_Int::Set_TopRight
CSG_Rect_Int & Set_TopRight(int x, int y)
Definition: geo_classes.cpp:1119
CSG_Point::Get_Length
virtual double Get_Length(void) const
Definition: geo_classes.cpp:130
SG_DISTWGHT_GAUSS
@ SG_DISTWGHT_GAUSS
Definition: geo_tools.h:699
CSG_Point::Multiply
virtual void Multiply(const CSG_Point &Point)
Definition: geo_classes.cpp:111
CSG_Distance_Weighting::Set_IDW_Power
bool Set_IDW_Power(double Value)
Definition: geo_classes.cpp:1494
CSG_Point::Add
virtual void Add(const CSG_Point &Point)
Definition: geo_classes.cpp:99
SSG_Point_4D
Definition: geo_tools.h:357
SSG_Point_3D
Definition: geo_tools.h:264
INTERSECTION_Contains
@ INTERSECTION_Contains
Definition: geo_tools.h:106
CSG_Rect::Intersects
TSG_Intersection Intersects(const CSG_Rect &Rect) const
Definition: geo_classes.cpp:881
CSG_Lines::Destroy
bool Destroy(void)
Definition: geo_classes.cpp:409
SSG_Rect_Int
Definition: geo_tools.h:581
CSG_Lines::~CSG_Lines
virtual ~CSG_Lines(void)
Definition: geo_classes.cpp:403
CSG_Lines::Del
bool Del(sLong Index)
Definition: geo_classes.cpp:464
SSG_Point_3D::x
double x
Definition: geo_tools.h:265
CSG_Parameters::Add_Double
CSG_Parameter * Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
Definition: parameters.cpp:475
CSG_Lines::Set_Count
bool Set_Count(sLong nLines)
Definition: geo_classes.cpp:477
CSG_Rects::Clear
void Clear(void)
Definition: geo_classes.cpp:962
SSG_Rect::xMax
double xMax
Definition: geo_tools.h:465
CSG_Rects_Int::~CSG_Rects_Int
virtual ~CSG_Rects_Int(void)
Definition: geo_classes.cpp:1290
SG_Free
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
Definition: api_memory.cpp:83
CSG_Rect_Int::Assign
CSG_Rect_Int & Assign(int xMin, int yMin, int xMax, int yMax)
Definition: geo_classes.cpp:1093
CSG_Point::CSG_Point
CSG_Point(void)
Definition: geo_classes.cpp:65
SSG_Point
Definition: geo_tools.h:128
CSG_Distance_Weighting::CSG_Distance_Weighting
CSG_Distance_Weighting(void)
Definition: geo_classes.cpp:1363
CSG_Array_Pointer::Create
void ** Create(const CSG_Array_Pointer &Array)
Definition: api_memory.cpp:469
CSG_Rects_Int::Add
bool Add(void)
Definition: geo_classes.cpp:1334
CSG_Distance_Weighting::Set_Parameters
bool Set_Parameters(class CSG_Parameters &Parameters)
Definition: geo_classes.cpp:1449
SSG_Rect::xMin
double xMin
Definition: geo_tools.h:465
CSG_Rect::Contains
bool Contains(double x, double y) const
Definition: geo_classes.cpp:870
SSG_Rect
Definition: geo_tools.h:464
CSG_Rect::Intersect
bool Intersect(const CSG_Rect &Rect)
Definition: geo_classes.cpp:910
CSG_Point_4D::Assign
virtual void Assign(double x, double y, double z, double m)
Definition: geo_classes.cpp:245
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
CSG_Rect_Int::Union
CSG_Rect_Int & Union(int x, int y)
Definition: geo_classes.cpp:1165
CSG_Rect_Int::Set_BottomLeft
CSG_Rect_Int & Set_BottomLeft(int x, int y)
Definition: geo_classes.cpp:1109
CSG_Point
Definition: geo_tools.h:135
CSG_Rect_Int::Create
bool Create(int xMin, int yMin, int xMax, int yMax)
Definition: geo_classes.cpp:1064
CSG_Rect::Set_BottomLeft
CSG_Rect & Set_BottomLeft(double x, double y)
Definition: geo_classes.cpp:749
CSG_Array_Pointer::Del
bool Del(sLong Index)
Definition: api_memory.cpp:512
CSG_Rect::Get_YMin
double Get_YMin(void) const
Definition: geo_tools.h:504
CSG_Point_4D::Add
virtual void Add(const CSG_Point_4D &Point)
Definition: geo_classes.cpp:262
CSG_Point_4D::Subtract
virtual void Subtract(const CSG_Point_4D &Point)
Definition: geo_classes.cpp:270
CSG_Rect_Int::Move
CSG_Rect_Int & Move(int dx, int dy)
Definition: geo_classes.cpp:1130
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_Rects_Int::operator=
CSG_Rects_Int & operator=(const CSG_Rects_Int &Rects)
Definition: geo_classes.cpp:1326
INTERSECTION_None
@ INTERSECTION_None
Definition: geo_tools.h:102
CSG_Rect::Move
CSG_Rect & Move(double dx, double dy)
Definition: geo_classes.cpp:778
SSG_Point_4D::z
double z
Definition: geo_tools.h:358
CSG_Rects_Int::Clear
void Clear(void)
Definition: geo_classes.cpp:1296
CSG_Point_3D
Definition: geo_tools.h:271
CSG_Rect_Int::is_Equal
bool is_Equal(int xMin, int yMin, int xMax, int yMax) const
Definition: geo_classes.cpp:1226
CSG_Array::Get_Value_Size
size_t Get_Value_Size(void) const
Definition: api_core.h:326
SG_Get_Distance
double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
Definition: geo_functions.cpp:103
CSG_Point_4D
Definition: geo_tools.h:364
CSG_Point_4D::CSG_Point_4D
CSG_Point_4D(void)
Definition: geo_classes.cpp:224
CSG_Parameters::Set_Enabled
void Set_Enabled(bool bEnabled=true)
Definition: parameters.cpp:405
sLong
signed long long sLong
Definition: api_core.h:158
CSG_Distance_Weighting::Create_Parameters
bool Create_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
Definition: geo_classes.cpp:1378
CSG_Point::Assign
virtual void Assign(double x, double y)
Definition: geo_classes.cpp:86
CSG_Point_4D::Get_Length
virtual double Get_Length(void) const
Definition: geo_classes.cpp:303
SSG_Rect_Int::xMax
int xMax
Definition: geo_tools.h:582
CSG_Point_3D::Assign
virtual void Assign(double x, double y, double z)
Definition: geo_classes.cpp:162
CSG_Rects::CSG_Rects
CSG_Rects(void)
Definition: geo_classes.cpp:942
SSG_Rect_Int::xMin
int xMin
Definition: geo_tools.h:582
CSG_Distance_Weighting::Set_Weighting
bool Set_Weighting(TSG_Distance_Weighting Weighting)
Definition: geo_classes.cpp:1486
CSG_Rects::Assign
bool Assign(const CSG_Rects &Rects)
Definition: geo_classes.cpp:979
CSG_Rect_Int::Intersect
bool Intersect(const CSG_Rect_Int &Rect)
Definition: geo_classes.cpp:1194
CSG_Array::Create
void * Create(const CSG_Array &Array)
Definition: api_memory.cpp:250
CSG_Distance_Weighting::Set_IDW_Offset
bool Set_IDW_Offset(bool bOn=true)
Definition: geo_classes.cpp:1507
CSG_Lines::Get_Count
sLong Get_Count(void) const
Definition: geo_tools.h:239
INTERSECTION_Identical
@ INTERSECTION_Identical
Definition: geo_tools.h:103
CSG_Rect_Int::~CSG_Rect_Int
~CSG_Rect_Int(void)
Definition: geo_classes.cpp:1055
SSG_Rect::yMax
double yMax
Definition: geo_tools.h:465
CSG_Array::Get_Array
void * Get_Array(void) const
Definition: api_core.h:336
CSG_Lines::Add
CSG_Points & Add(void)
Definition: geo_classes.cpp:437
CSG_Rect::Union
CSG_Rect & Union(double x, double y)
Definition: geo_classes.cpp:824
CSG_Point_3D::CSG_Point_3D
CSG_Point_3D(void)
Definition: geo_classes.cpp:141
SG_Is_Equal
bool SG_Is_Equal(double a, double b, double epsilon)
Definition: geo_functions.cpp:64
CSG_Points
Definition: geo_tools.h:184
parameters.h
CSG_Lines::Assign
bool Assign(const CSG_Lines &Lines)
Definition: geo_classes.cpp:421
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
CSG_Points::CSG_Points
CSG_Points(void)
Definition: geo_classes.cpp:316
CSG_Lines::CSG_Lines
CSG_Lines(void)
Definition: geo_classes.cpp:373
CSG_Rect::CSG_Rect
CSG_Rect(void)
Definition: geo_classes.cpp:663
CSG_Points_Int::CSG_Points_Int
CSG_Points_Int(void)
Definition: geo_classes.cpp:606
SSG_Point_4D::y
double y
Definition: geo_tools.h:358
CSG_Point::Divide
virtual void Divide(double Value)
Definition: geo_classes.cpp:123
CSG_Array::Inc_Array
bool Inc_Array(sLong nValues=1)
Definition: api_memory.cpp:414
B
#define B
CSG_Rect::Set_TopRight
CSG_Rect & Set_TopRight(double x, double y)
Definition: geo_classes.cpp:763
CSG_String
Definition: api_core.h:563
CSG_Point_3D::Multiply
virtual void Multiply(const CSG_Point_3D &Point)
Definition: geo_classes.cpp:191
CSG_Rect::is_Equal
bool is_Equal(double xMin, double yMin, double xMax, double yMax, double epsilon=0.) const
Definition: geo_classes.cpp:858
CSG_Rects::Add
bool Add(void)
Definition: geo_classes.cpp:1000
SSG_Point_Int
Definition: geo_tools.h:418
CSG_Distance_Weighting::Add_Parameters
static bool Add_Parameters(class CSG_Parameters &Parameters, const CSG_String &Parent="", bool bIDW_Offset=false)
Definition: geo_classes.cpp:1396
CSG_Points_Int::Assign
bool Assign(const CSG_Points_Int &Points)
Definition: geo_classes.cpp:624
SSG_Point_3D::y
double y
Definition: geo_tools.h:265
SSG_Point::x
double x
Definition: geo_tools.h:129
SSG_Point_4D::x
double x
Definition: geo_tools.h:358
CSG_Rect::Create
bool Create(double xMin, double yMin, double xMax, double yMax)
Definition: geo_classes.cpp:698
CSG_Array_Pointer::Set_Array
bool Set_Array(sLong nValues, bool bShrink=true)
Definition: api_core.h:387
INIT_VALUE
#define INIT_VALUE(id, val)
CSG_Lines::Get_Length
double Get_Length(void) const
Definition: geo_classes.cpp:508
SSG_Rect::yMin
double yMin
Definition: geo_tools.h:465
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_Rects_Int
Definition: geo_tools.h:658
CSG_Point_4D::Divide
virtual void Divide(double Value)
Definition: geo_classes.cpp:294
CSG_Rect::Get_XMin
double Get_XMin(void) const
Definition: geo_tools.h:502
CSG_Rect::Inflate
CSG_Rect & Inflate(double d, bool bPercent=true)
Definition: geo_classes.cpp:808
CSG_Rect_Int::Deflate
CSG_Rect_Int & Deflate(int d)
Definition: geo_classes.cpp:1159
SSG_Point_Int::y
int y
Definition: geo_tools.h:419
SSG_Point::y
double y
Definition: geo_tools.h:129
CSG_Lines::Clear
bool Clear(void)
Definition: geo_classes.cpp:415
CSG_Rect_Int::CSG_Rect_Int
CSG_Rect_Int(void)
Definition: geo_classes.cpp:1029
SSG_Point_3D::z
double z
Definition: geo_tools.h:265
CSG_Lines::Get_Line
CSG_Points & Get_Line(sLong Index)
Definition: geo_tools.h:241
CSG_Point_4D::Multiply
virtual void Multiply(const CSG_Point_4D &Point)
Definition: geo_classes.cpp:278
CSG_Point_3D::Divide
virtual void Divide(double Value)
Definition: geo_classes.cpp:205
CSG_Points_3D::Assign
bool Assign(const CSG_Points_3D &Points)
Definition: geo_classes.cpp:566
CSG_Lines
Definition: geo_tools.h:216
INTERSECTION_Contained
@ INTERSECTION_Contained
Definition: geo_tools.h:105
CSG_Parameters
Definition: parameters.h:1690
SG_Realloc
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
Definition: api_memory.cpp:77
CSG_Distance_Weighting::~CSG_Distance_Weighting
virtual ~CSG_Distance_Weighting(void)
Definition: geo_classes.cpp:1374
SSG_Point_Int::x
int x
Definition: geo_tools.h:419
SG_DISTWGHT_None
@ SG_DISTWGHT_None
Definition: geo_tools.h:696
CSG_Rect_Int::Intersects
TSG_Intersection Intersects(const CSG_Rect_Int &Rect) const
Definition: geo_classes.cpp:1249
uLong
unsigned long long uLong
Definition: api_core.h:159
CSG_Points::Assign
bool Assign(const CSG_Points &Points)
Definition: geo_classes.cpp:334
INTERSECTION_Overlaps
@ INTERSECTION_Overlaps
Definition: geo_tools.h:104
CSG_Rect::Get_YRange
double Get_YRange(void) const
Definition: geo_tools.h:508
CSG_Array::Get_Entry
void * Get_Entry(sLong Index) const
Returns a pointer to the memory address of the requested variable. You have to type cast and derefere...
Definition: api_core.h:331
CSG_Parameters::Add_Bool
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
Definition: parameters.cpp:465
geo_tools.h
CSG_Rects::operator=
CSG_Rects & operator=(const CSG_Rects &Rects)
Definition: geo_classes.cpp:992
CSG_Distance_Weighting::Set_BandWidth
bool Set_BandWidth(double Value)
Definition: geo_classes.cpp:1515
CSG_Parameters::Add_Choice
CSG_Parameter * Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default=0)
Definition: parameters.cpp:533