1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                     Tool Library                      //
9 //                     grid_analysis                     //
10 //                                                       //
11 //-------------------------------------------------------//
12 //                                                       //
13 //                  diversity_raos_q.h                   //
14 //                                                       //
15 //                 Copyright (C) 2019 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__diversity_raos_q_H
50 #define HEADER_INCLUDED__diversity_raos_q_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 CDiversity_Raos_Q_Classic : public CSG_Tool_Grid
71 {
72 public:
73 	CDiversity_Raos_Q_Classic(void);
74 
Get_MenuPath(void)75 	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("Diversity") );	}
76 
77 
78 protected:
79 
80 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
81 
82 	virtual bool				On_Execute				(void);
83 
84 
85 private:
86 
87 	CSG_Grid					*m_pValues;
88 
89 	CSG_Grid_Cell_Addressor		m_Kernel;
90 
91 
92 	bool						Get_Index				(int x, int y, int &Count, double &Index);
93 
94 };
95 
96 
97 ///////////////////////////////////////////////////////////
98 //														 //
99 //                                                       //
100 //														 //
101 ///////////////////////////////////////////////////////////
102 
103 //---------------------------------------------------------
104 class CDiversity_Raos_Q : public CSG_Tool_Grid
105 {
106 public:
107 	CDiversity_Raos_Q(void);
108 
Get_MenuPath(void)109 	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("Diversity") );	}
110 
111 
112 protected:
113 
114 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
115 
116 	virtual bool				On_Execute				(void);
117 
118 
119 private:
120 
121 	bool						m_bNormalize;
122 
123 	int							m_Distance;
124 
125 	double						m_Lambda;
126 
127 	CSG_Parameter_Grid_List		*m_pValues;
128 
129 	CSG_Grid_Cell_Addressor		m_Kernel;
130 
131 
132 	bool						Get_Values				(int x, int y, CSG_Vector &Values);
133 
134 	double						Get_Distance			(double *A, double *B);
135 
136 	bool						Get_Index				(int x, int y, int &Count, double &Index);
137 
138 };
139 
140 
141 ///////////////////////////////////////////////////////////
142 //														 //
143 //                                                       //
144 //														 //
145 ///////////////////////////////////////////////////////////
146 
147 //---------------------------------------------------------
148 #endif // #ifndef HEADER_INCLUDED__diversity_raos_q_H
149