1 
2 /*******************************************************************************
3     TableCalculator.h
4     Copyright (C) Victor Olaya
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA
19 *******************************************************************************/
20 
21 ///////////////////////////////////////////////////////////
22 //														 //
23 //														 //
24 //														 //
25 ///////////////////////////////////////////////////////////
26 
27 //---------------------------------------------------------
28 #include <saga_api/saga_api.h>
29 
30 
31 ///////////////////////////////////////////////////////////
32 //														 //
33 //														 //
34 //														 //
35 ///////////////////////////////////////////////////////////
36 
37 //---------------------------------------------------------
38 class CTable_Calculator_Base : public CSG_Tool
39 {
40 public:
41 	CTable_Calculator_Base(bool bShapes);
42 
43 
44 protected:
45 
46 	virtual int				On_Parameters_Enable	(CSG_Parameters *pParameters, CSG_Parameter *pParameter);
47 
48 	virtual bool			On_Execute				(void);
49 
50 
51 private:
52 
53 	bool					m_bNoData;
54 
55 	int						m_Result;
56 
57 	CSG_Array_Int			m_Values;
58 
59 	CSG_Formula				m_Formula;
60 
61 
62 	bool					Get_Value				(CSG_Table_Record *pRecord);
63 
64 	CSG_String				Get_Formula				(CSG_String Formula, CSG_Table *pTable, CSG_Array_Int &Values);
65 
66 };
67 
68 
69 ///////////////////////////////////////////////////////////
70 //														 //
71 ///////////////////////////////////////////////////////////
72 
73 //---------------------------------------------------------
74 class CTable_Calculator : public CTable_Calculator_Base
75 {
76 public:
CTable_Calculator(void)77 	CTable_Calculator(void) : CTable_Calculator_Base(false)	{}
78 
79 };
80 
81 
82 ///////////////////////////////////////////////////////////
83 //														 //
84 ///////////////////////////////////////////////////////////
85 
86 //---------------------------------------------------------
87 class CTable_Calculator_Shapes : public CTable_Calculator_Base
88 {
89 public:
CTable_Calculator_Shapes(void)90 	CTable_Calculator_Shapes(void) : CTable_Calculator_Base(true)	{}
91 
Get_MenuPath(void)92 	virtual CSG_String		Get_MenuPath		(void)	{	return( _TL("A:Shapes|Table") );	}
93 
94 };
95 
96 
97 ///////////////////////////////////////////////////////////
98 //														 //
99 //														 //
100 //														 //
101 ///////////////////////////////////////////////////////////
102 
103 //---------------------------------------------------------
104