Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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
21 #ifndef STD_MESHERS_GUI_DISTR_PREVIEW_HEADER
22 #define STD_MESHERS_GUI_DISTR_PREVIEW_HEADER
23
24 #include "SMESH_StdMeshersGUI.hxx"
25
26 #include <qwt_plot.h>
27 #include <SALOMEconfig.h>
28 #include CORBA_SERVER_HEADER(SMESH_Mesh)
29 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
30 #include <ExprIntrp_GenExp.hxx>
31 #include <Expr_Array1OfNamedUnknown.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33
34 class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrPreview : public QwtPlot
35 {
36   Q_OBJECT
37
38 public:
39   typedef enum { EXPONENT, CUT_NEGATIVE }  Conversion;
40
41   StdMeshersGUI_DistrPreview( QWidget*, StdMeshers::StdMeshers_NumberOfSegments_ptr );
42   virtual ~StdMeshersGUI_DistrPreview();
43
44   QString   function() const;
45   bool      isTableFunc() const;
46   void      tableFunc( SMESH::double_array& ) const;
47   int       pointsCount() const;
48   int       nbSeg() const;
49   bool      isDone() const;
50
51   bool      setParams( const QString&, const int, const int = 50, const bool = true );
52   bool      setParams( const SMESH::double_array&, const int, const bool = true );
53   void      setConversion( Conversion, const bool = true );
54
55 protected:
56   virtual   bool   init( const QString& );
57   virtual   double funcValue( const double, bool& );
58   virtual   bool   createTable( SMESH::double_array& );
59   virtual   bool   convert( double& ) const;
60             void   update();
61
62 private:
63   double calc( bool& );
64   void   showError();
65
66 private:
67   QString                   myFunction;
68   int                       myPoints, myNbSeg;
69   bool                      myIsTable;
70   Conversion                myConv;
71   SMESH::double_array       myTableFunc;
72   long                      myDensity, myDistr, myMsg;
73   Handle(ExprIntrp_GenExp)  myExpr;
74   Expr_Array1OfNamedUnknown myVars;
75   TColStd_Array1OfReal      myValues;
76   bool                      myIsDone;
77   StdMeshers::StdMeshers_NumberOfSegments_var  myHypo;
78 };
79
80 #endif