Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_DistrPreview.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library 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 GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : StdMeshersGUI_DistrPreview.h
23 // Author : Open CASCADE S.A.S.
24 //
25 #ifndef STDMESHERSGUI_DISTRPREVIEW_H
26 #define STDMESHERSGUI_DISTRPREVIEW_H
27
28 // SMESH includes
29 #include "SMESH_StdMeshersGUI.hxx"
30
31 // Qwt includes
32 #include <qwt_plot.h>
33
34 // IDL includes
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
38
39 // OCCT includes
40 #include <ExprIntrp_GenExp.hxx>
41 #include <Expr_Array1OfNamedUnknown.hxx>
42 #include <TColStd_Array1OfReal.hxx>
43
44 class QwtPlotCurve;
45 class QwtPlotMarker;
46
47 class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrPreview : public QwtPlot
48 {
49   Q_OBJECT
50
51 public:
52   typedef enum { EXPONENT, CUT_NEGATIVE }  Conversion;
53
54   StdMeshersGUI_DistrPreview( QWidget*, StdMeshers::StdMeshers_NumberOfSegments_ptr );
55   virtual ~StdMeshersGUI_DistrPreview();
56
57   QString   function() const;
58   bool      isTableFunc() const;
59   void      tableFunc( SMESH::double_array& ) const;
60   int       pointsCount() const;
61   int       nbSeg() const;
62   bool      isDone() const;
63
64   bool      setParams( const QString&, const int, const int = 50, const bool = true );
65   bool      setParams( const SMESH::double_array&, const int, const bool = true );
66   void      setConversion( Conversion, const bool = true );
67
68 protected:
69   virtual   bool   init( const QString& );
70   virtual   double funcValue( const double, bool& );
71   virtual   bool   createTable( SMESH::double_array& );
72   virtual   bool   convert( double& ) const;
73             void   update();
74
75 private:
76   double calc( bool& );
77   void   showError();
78
79 private:
80   QString                   myFunction;
81   int                       myPoints, myNbSeg;
82   bool                      myIsTable;
83   Conversion                myConv;
84   SMESH::double_array       myTableFunc;
85   QwtPlotCurve*             myDensity;
86   QwtPlotCurve*             myDistr;
87   QwtPlotMarker*            myMsg;
88   Handle(ExprIntrp_GenExp)  myExpr;
89   Expr_Array1OfNamedUnknown myVars;
90   TColStd_Array1OfReal      myValues;
91   bool                      myIsDone;
92   StdMeshers::StdMeshers_NumberOfSegments_var  myHypo;
93 };
94
95 #endif // STDMESHERSGUI_DISTRPREVIEW_H