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