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