1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                     Tool Library                      //
9 //                     shapes_tools                      //
10 //                                                       //
11 //-------------------------------------------------------//
12 //                                                       //
13 //                   points_thinning.h                   //
14 //                                                       //
15 //                 Copyright (C) 2011 by                 //
16 //                      Olaf Conrad                      //
17 //                                                       //
18 //-------------------------------------------------------//
19 //                                                       //
20 // This file is part of 'SAGA - System for Automated     //
21 // Geoscientific Analyses'. SAGA is free software; you   //
22 // can redistribute it and/or modify it under the terms  //
23 // of the GNU General Public License as published by the //
24 // Free Software Foundation, either version 2 of the     //
25 // License, or (at your option) any later version.       //
26 //                                                       //
27 // SAGA is distributed in the hope that it will be       //
28 // useful, but WITHOUT ANY WARRANTY; without even the    //
29 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
30 // PARTICULAR PURPOSE. See the GNU General Public        //
31 // License for more details.                             //
32 //                                                       //
33 // You should have received a copy of the GNU General    //
34 // Public License along with this program; if not, see   //
35 // <http://www.gnu.org/licenses/>.                       //
36 //                                                       //
37 //-------------------------------------------------------//
38 //                                                       //
39 //    e-mail:     oconrad@saga-gis.org                   //
40 //                                                       //
41 //    contact:    Olaf Conrad                            //
42 //                Institute of Geography                 //
43 //                University of Hamburg                  //
44 //                Germany                                //
45 //                                                       //
46 ///////////////////////////////////////////////////////////
47 
48 //---------------------------------------------------------
49 #ifndef HEADER_INCLUDED__points_thinning_H
50 #define HEADER_INCLUDED__points_thinning_H
51 
52 
53 ///////////////////////////////////////////////////////////
54 //														 //
55 //														 //
56 //														 //
57 ///////////////////////////////////////////////////////////
58 
59 //---------------------------------------------------------
60 #include <saga_api/saga_api.h>
61 
62 
63 ///////////////////////////////////////////////////////////
64 //														 //
65 //														 //
66 //														 //
67 ///////////////////////////////////////////////////////////
68 
69 //---------------------------------------------------------
70 class CPoints_Thinning : public CSG_Tool
71 {
72 public:
73 	CPoints_Thinning(void);
74 
75 
76 protected:
77 
78 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
79 
80 	virtual bool				On_Execute				(void);
81 
82 
83 private:
84 
85 	int							m_Field;
86 
87 	double						m_Resolution;
88 
89 	CSG_Shapes					*m_pPoints, *m_pThinned;
90 
91 	CSG_PRQuadTree				m_QuadTree;
92 
93 	CSG_Grid_System				m_Raster[4];
94 
95 
96 	CSG_Rect					Get_Extent				(int Method);
97 
98 	void						Add_Point				(double x, double y, int Count, double Mean, double Minimum, double Maximum, double StdDev);
99 
100 	bool						Raster_Execute			(const CSG_Rect &Extent);
101 
102 	bool						QuadTree_Execute		(const CSG_Rect &Extent);
103 	void						QuadTree_Get_Points		(CSG_PRQuadTree_Item            *pItem);
104 	void						QuadTree_Add_Point		(CSG_PRQuadTree_Leaf            *pLeaf);
105 	void						QuadTree_Add_Point		(CSG_PRQuadTree_Node_Statistics *pNode);
106 
107 };
108 
109 
110 ///////////////////////////////////////////////////////////
111 //														 //
112 //														 //
113 //														 //
114 ///////////////////////////////////////////////////////////
115 
116 //---------------------------------------------------------
117 #endif // #ifndef HEADER_INCLUDED__points_thinning_H
118