1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                     Tool Library                      //
9 //                     climate_tools                     //
10 //                                                       //
11 //-------------------------------------------------------//
12 //                                                       //
13 //               grid_Levels_interpolation.h             //
14 //                                                       //
15 //                 Copyright (C) 2012 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__grid_Levels_interpolation_H
50 #define HEADER_INCLUDED__grid_Levels_interpolation_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 CGrid_Levels_Interpolation : public CSG_Tool_Grid
71 {
72 public:
73 	CGrid_Levels_Interpolation(void);
74 
Get_MenuPath(void)75 	virtual CSG_String			Get_MenuPath			(void)	{	return( _TL("Tools") );	}
76 
77 
78 protected:
79 
80 	virtual int					On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
81 
82 	bool						Initialize				(const CSG_Rect &Extent);
83 	bool						Finalize				(void);
84 
85 	bool						Get_Value				(double x, double y, double z, double &Value);
86 	bool						Get_Value				(const TSG_Point &p, double z, double &Value);
87 
88 
89 private:
90 
91 	bool						m_Linear_bSorted, m_Spline_bAll;
92 
93 	int							m_xSource, m_vMethod, m_Trend_Order;
94 
95 	TSG_Grid_Resampling			m_hMethod;
96 
97 	CSG_Table					*m_pXTable;
98 
99 	CSG_Grid					*m_Coeff;
100 
101 	CSG_Parameter_Grid_List		*m_pXGrids, *m_pVariables;
102 
103 
104 	double						Get_Variable			(double x, double y, int iLevel);
105 	bool						Get_Variable			(double x, double y, int iLevel, double &Variable);
106 	double						Get_Height				(double x, double y, int iLevel);
107 	bool						Get_Height				(double x, double y, int iLevel, double &Height);
108 
109 	bool						Get_Values				(double x, double y, double z, int &iLevel, CSG_Table &Values);
110 
111 	bool						Get_Linear				(double x, double y, double z, double &Value);
112 	bool						Get_Linear_Coeff		(double x, double y, double z, double Value[2], double Height[2]);
113 	bool						Get_Spline_All			(double x, double y, double z, double &Value);
114 	bool						Get_Spline				(double x, double y, double z, double &Value);
115 	bool						Get_Trend				(double x, double y, double z, double &Value);
116 	bool						Get_Trend_Coeff			(double x, double y, double z, double &Value);
117 
118 };
119 
120 
121 ///////////////////////////////////////////////////////////
122 //														 //
123 ///////////////////////////////////////////////////////////
124 
125 //---------------------------------------------------------
126 class CGrid_Levels_to_Surface : public CGrid_Levels_Interpolation
127 {
128 public:
129 	CGrid_Levels_to_Surface(void);
130 
131 
132 protected:
133 
134 	virtual bool				On_Execute				(void);
135 
136 };
137 
138 
139 ///////////////////////////////////////////////////////////
140 //														 //
141 ///////////////////////////////////////////////////////////
142 
143 //---------------------------------------------------------
144 class CGrid_Levels_to_Points : public CGrid_Levels_Interpolation
145 {
146 public:
147 	CGrid_Levels_to_Points(void);
148 
149 
150 protected:
151 
152 	virtual bool				On_Execute				(void);
153 
154 };
155 
156 
157 ///////////////////////////////////////////////////////////
158 //														 //
159 //														 //
160 //														 //
161 ///////////////////////////////////////////////////////////
162 
163 //---------------------------------------------------------
164 #endif // #ifndef HEADER_INCLUDED__grid_Levels_interpolation_H
165