Back to index

salome-smesh  6.5.0
StdMeshersGUI_DistrPreview.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : StdMeshersGUI_DistrPreview.h
00024 // Author : Open CASCADE S.A.S.
00025 //
00026 #ifndef STDMESHERSGUI_DISTRPREVIEW_H
00027 #define STDMESHERSGUI_DISTRPREVIEW_H
00028 
00029 // SMESH includes
00030 #include "SMESH_StdMeshersGUI.hxx"
00031 
00032 // Qwt includes
00033 #include <qwt_plot.h>
00034 
00035 // IDL includes
00036 #include <SALOMEconfig.h>
00037 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00038 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
00039 
00040 // OCCT includes
00041 #include <ExprIntrp_GenExp.hxx>
00042 #include <Expr_Array1OfNamedUnknown.hxx>
00043 #include <TColStd_Array1OfReal.hxx>
00044 
00045 class QwtPlotCurve;
00046 class QwtPlotMarker;
00047 
00048 class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrPreview : public QwtPlot
00049 {
00050   Q_OBJECT
00051 
00052 public:
00053   typedef enum { EXPONENT, CUT_NEGATIVE }  Conversion;
00054 
00055   StdMeshersGUI_DistrPreview( QWidget*, StdMeshers::StdMeshers_NumberOfSegments_ptr );
00056   virtual ~StdMeshersGUI_DistrPreview();
00057 
00058   QString   function() const;
00059   bool      isTableFunc() const;
00060   void      tableFunc( SMESH::double_array& ) const;
00061   int       pointsCount() const;
00062   int       nbSeg() const;
00063   bool      isDone() const;
00064 
00065   bool      setParams( const QString&, const int, const int = 50, const bool = true );
00066   bool      setParams( const SMESH::double_array&, const int, const bool = true );
00067   void      setConversion( Conversion, const bool = true );
00068 
00069 protected:
00070   virtual   bool   init( const QString& );
00071   virtual   double funcValue( const double, bool& );
00072   virtual   bool   createTable( SMESH::double_array& );
00073   virtual   bool   convert( double& ) const;
00074             void   update();
00075 
00076 private:
00077   double calc( bool& );
00078   void   showError();
00079 
00080 private:
00081   QString                   myFunction;
00082   int                       myPoints, myNbSeg;
00083   bool                      myIsTable;
00084   Conversion                myConv;
00085   SMESH::double_array       myTableFunc;
00086   QwtPlotCurve*             myDensity;
00087   QwtPlotCurve*             myDistr;
00088   QwtPlotMarker*            myMsg;
00089   Handle(ExprIntrp_GenExp)  myExpr;
00090   Expr_Array1OfNamedUnknown myVars;
00091   TColStd_Array1OfReal      myValues;
00092   bool                      myIsDone;
00093   StdMeshers::StdMeshers_NumberOfSegments_var  myHypo;
00094 };
00095 
00096 #endif // STDMESHERSGUI_DISTRPREVIEW_H