Salome HOME
PAL10953. Use GUI to create hypothesis from a hypotheses set
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FunctionPreview.h
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20
21 #ifndef SMESHGUI_FUNCTION_PREVIEW_HEADER
22 #define SMESHGUI_FUNCTION_PREVIEW_HEADER
23
24 #include "qwt_plot.h"
25 #include <SALOMEconfig.h>
26 #include CORBA_SERVER_HEADER(SMESH_Mesh)
27 #include <ExprIntrp_GenExp.hxx>
28 #include <Expr_Array1OfNamedUnknown.hxx>
29 #include <TColStd_Array1OfReal.hxx>
30
31 class SMESHGUI_FunctionPreview : public QwtPlot
32 {
33   Q_OBJECT
34
35 public:
36   SMESHGUI_FunctionPreview( QWidget* );
37   virtual ~SMESHGUI_FunctionPreview();
38
39   QString   function() const;
40   bool      isTableFunc() const;
41   void      tableFunc( SMESH::double_array& ) const;
42   void      interval( double&, double& ) const;
43   int       pointsCount() const;
44   bool      isDone() const;
45
46   bool      setParams( const QString&, const double = 0.0, const double = 1.0, const int = 50, const bool = true );
47   bool      setParams( const SMESH::double_array&, const double = 0.0, const double = 1.0, const bool = true );
48   void      setIsExp( const bool, const bool = true );
49
50 protected:
51   virtual   bool   init( const QString& );
52   virtual   double funcValue( const double, bool& );
53   virtual   bool   createTable( SMESH::double_array& );
54   virtual   void   drawContents( QPainter* );
55
56 private:
57   double calc( bool& );
58
59 private:
60   QString              myFunction;
61   double               myXmin, myXmax;
62   int                  myPoints;
63   bool                 myIsTable;
64   bool                 myIsExp;
65   SMESH::double_array  myTableFunc;
66   long                 myCurve;
67   Handle(ExprIntrp_GenExp)  myExpr;
68   Expr_Array1OfNamedUnknown myVars;
69   TColStd_Array1OfReal  myValues;
70   bool                 myIsDone;
71 };
72
73 #endif