Version: 6.3.1

src/SMESHGUI/SMESHGUI_Hypotheses.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_Hypotheses.h
00025 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
00026 //
00027 #ifndef SMESHGUI_HYPOTHESES_H
00028 #define SMESHGUI_HYPOTHESES_H
00029 
00030 // SMESH includes
00031 #include "SMESH_SMESHGUI.hxx"
00032 #include "SMESHGUI_HypothesesUtils.h"
00033 
00034 // Qt includes
00035 #include <QtxDialog.h>
00036 #include <QVariant>
00037 
00038 // IDL includes
00039 #include <SALOMEconfig.h>
00040 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
00041 
00042 class QEventLoop;
00043 
00047 class SMESHGUI_EXPORT SMESHGUI_GenericHypothesisCreator : public QObject
00048 {
00049   Q_OBJECT
00050 
00051 public:
00052   SMESHGUI_GenericHypothesisCreator( const QString& );
00053   virtual ~SMESHGUI_GenericHypothesisCreator();
00054 
00055   void                         create( SMESH::SMESH_Hypothesis_ptr,
00056                                        const QString&, QWidget*, QObject*, const QString& );
00057   void                         create( bool, const QString&, QWidget*, QObject*, const QString& );
00058   void                         edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
00059   void                         setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
00060 
00061   virtual bool                 checkParams( QString& ) const;
00062   virtual void                 onReject();
00063   virtual QString              helpPage() const;
00064 
00065   QString                      hypType() const;
00066   QString                      hypName() const;
00067   bool                         isCreation() const;
00068   
00069   QString                      getShapeEntry() const { return myShapeEntry; }
00070   void                         setShapeEntry( const QString& theEntry );
00071 
00072   QString                      getMainShapeEntry() const { return myMainShapeEntry; }
00073   void                         setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
00074 
00075 signals:
00076   void                         finished( int );
00077 
00078 protected:
00079   struct StdParam
00080   {
00081     QString   myName;
00082     QVariant  myValue;
00083     bool      isVariable;
00084     StdParam(){
00085       isVariable = false;
00086     }
00087   };
00088 
00089   typedef QList<StdParam>      ListOfStdParams;
00090   typedef QList<QWidget*>      ListOfWidgets;
00091 
00092   SMESH::SMESH_Hypothesis_var  hypothesis() const;
00093   SMESH::SMESH_Hypothesis_var  initParamsHypothesis(const bool strict=false) const;
00094   bool                         hasInitParamsHypothesis() const;
00095   const ListOfWidgets&         widgets() const;
00096   ListOfWidgets&               changeWidgets();
00097   QtxDialog*                   dlg() const;
00098 
00099   virtual QFrame*              buildFrame() = 0;
00100           QFrame*              buildStdFrame();
00101   virtual void                 retrieveParams() const = 0;
00102   virtual QString              storeParams() const = 0;
00103   virtual bool                 stdParams( ListOfStdParams& ) const;
00104   bool                         getStdParamFromDlg( ListOfStdParams& ) const;
00105   virtual QStringList          getVariablesFromDlg() const;
00106   static  QString              stdParamValues( const ListOfStdParams& );
00107   virtual void                 attuneStdWidget( QWidget*, const int ) const;
00108   virtual QWidget*             getCustomWidget( const StdParam&, 
00109                                                 QWidget*, const int ) const;
00110   virtual bool                 getParamFromCustomWidget( StdParam&, QWidget* ) const;
00111   virtual void                 valueChanged( QWidget* );
00112   virtual QString              caption() const;
00113   virtual QPixmap              icon() const;
00114   virtual QString              type() const;
00115 
00116 protected slots:
00117   virtual void                 onValueChanged();
00118 
00119 private slots:
00120   virtual void                 onDialogFinished( int );
00121 
00122 private:
00123   void                         editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject* obj, const QString& );
00124 
00125 private:
00126   SMESH::SMESH_Hypothesis_var  myHypo, myInitParamsHypo;
00127   QString                      myHypName;
00128   QString                      myHypType;
00129   ListOfWidgets                myParamWidgets;
00130   bool                         myIsCreate;
00131   QtxDialog*                   myDlg;
00132   QString                      myShapeEntry;
00133   QString                      myMainShapeEntry;
00134 };
00135 
00136 class SMESHGUI_HypothesisDlg : public QtxDialog
00137 {
00138   Q_OBJECT
00139 
00140 public:
00141   SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
00142   virtual ~SMESHGUI_HypothesisDlg();
00143 
00144   void setHIcon( const QPixmap& );
00145   void setCustomFrame( QFrame* );
00146   void setType( const QString& );
00147 
00148 protected slots:
00149   virtual void accept();
00150   virtual void reject();
00151   void onHelp(); 
00152 
00153 private:
00154   SMESHGUI_GenericHypothesisCreator* myCreator;
00155   QLabel *myIconLabel, *myTypeLabel;
00156   QString myHelpFileName;
00157 };
00158 
00162 class HypothesisData
00163 {
00164 public:
00165   HypothesisData( const QString&, const QString&, const QString&,
00166                   const QString&, const QString&, const QString&,
00167                   const QList<int>&, const bool,
00168                   const QStringList&, const QStringList&,
00169                   const QStringList&, const QStringList&,
00170                   const bool=true, const bool supportSub=false );
00171 
00172   QString TypeName;        
00173   QString PluginName;      
00174   QString ServerLibName;   
00175   QString ClientLibName;   
00176   QString Label;           
00177   QString IconId;          
00178   QList<int> Dim;          
00179   bool IsAux;              
00180   bool IsNeedGeometry;     
00181   bool IsSupportSubmeshes; 
00182 
00183   // for algorithm only: dependencies algo <-> algo and algo -> hypos
00184   QStringList NeededHypos;  
00185   QStringList OptionalHypos;
00186   QStringList InputTypes;   
00187   QStringList OutputTypes;  
00188 };
00189 
00195 class HypothesesSet
00196 {
00197 public:
00198   HypothesesSet( const QString& );
00199   HypothesesSet( const QString&, const QStringList&, const QStringList& );
00200 
00201   QString name() const;
00202   void set( bool, const QStringList& );
00203   int count( bool ) const;
00204 
00205   void setIsCustom( bool );
00206   bool getIsCustom() const;
00207   int maxDim() const;
00208 
00209   bool isAlgo() const;
00210 
00211   //this method sets internal index to -1, thus before any data access it is necessary to call next()
00212   void init( bool );
00213 
00214   bool more() const;
00215   void next();
00216   QString current() const;
00217 
00218 private:
00219   QStringList* list(bool) const;
00220   QStringList* list() const;
00221 
00222 private:
00223   QString     myHypoSetName;
00224   QStringList myHypoList, myAlgoList;
00225   bool myIsAlgo, myIsCustom;
00226   int myIndex;
00227 };
00228 
00229 #endif // SMESHGUI_HYPOTHESES_H
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS