Salome HOME
Porting SMESH module to Qt 4
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_DistrPreview.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/ or email : webmaster.salome@opencascade.com
19 //
20 // File   : StdMeshersGUI_DistrPreview.h
21 // Author : Open CASCADE S.A.S.
22 //
23
24 #ifndef STDMESHERSGUI_DISTRPREVIEW_H
25 #define STDMESHERSGUI_DISTRPREVIEW_H
26
27 // SMESH includes
28 #include "SMESH_StdMeshersGUI.hxx"
29
30 // Qwt includes
31 #include <qwt_plot.h>
32
33 // IDL includes
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
37
38 // OCCT includes
39 #include <ExprIntrp_GenExp.hxx>
40 #include <Expr_Array1OfNamedUnknown.hxx>
41 #include <TColStd_Array1OfReal.hxx>
42
43 class QwtPlotCurve;
44 class QwtPlotMarker;
45
46 class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrPreview : public QwtPlot
47 {
48   Q_OBJECT
49
50 public:
51   typedef enum { EXPONENT, CUT_NEGATIVE }  Conversion;
52
53   StdMeshersGUI_DistrPreview( QWidget*, StdMeshers::StdMeshers_NumberOfSegments_ptr );
54   virtual ~StdMeshersGUI_DistrPreview();
55
56   QString   function() const;
57   bool      isTableFunc() const;
58   void      tableFunc( SMESH::double_array& ) const;
59   int       pointsCount() const;
60   int       nbSeg() const;
61   bool      isDone() const;
62
63   bool      setParams( const QString&, const int, const int = 50, const bool = true );
64   bool      setParams( const SMESH::double_array&, const int, const bool = true );
65   void      setConversion( Conversion, const bool = true );
66
67 protected:
68   virtual   bool   init( const QString& );
69   virtual   double funcValue( const double, bool& );
70   virtual   bool   createTable( SMESH::double_array& );
71   virtual   bool   convert( double& ) const;
72             void   update();
73
74 private:
75   double calc( bool& );
76   void   showError();
77
78 private:
79   QString                   myFunction;
80   int                       myPoints, myNbSeg;
81   bool                      myIsTable;
82   Conversion                myConv;
83   SMESH::double_array       myTableFunc;
84   QwtPlotCurve*             myDensity;
85   QwtPlotCurve*             myDistr;
86   QwtPlotMarker*            myMsg;
87   Handle(ExprIntrp_GenExp)  myExpr;
88   Expr_Array1OfNamedUnknown myVars;
89   TColStd_Array1OfReal      myValues;
90   bool                      myIsDone;
91   StdMeshers::StdMeshers_NumberOfSegments_var  myHypo;
92 };
93
94 #endif // STDMESHERSGUI_DISTRPREVIEW_H