Back to index

salome-smesh  6.5.0
SMESHGUI_GroupOpDlg.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 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_GroupOpDlg.h
00025 // Author : Sergey LITONIN, Open CASCADE S.A.S.
00026 //
00027 #ifndef SMESHGUI_GROUPOPDLG_H
00028 #define SMESHGUI_GROUPOPDLG_H
00029 
00030 // SMESH includes
00031 #include "SMESH_SMESHGUI.hxx"
00032 
00033 // Qt includes
00034 #include <QDialog>
00035 
00036 // IDL includes
00037 #include <SALOMEconfig.h>
00038 #include CORBA_SERVER_HEADER(SMESH_Group)
00039 
00040 class QPushButton;
00041 class QtxColorButton;
00042 class QComboBox;
00043 class QListWidget;
00044 class QGroupBox;
00045 class QLineEdit;
00046 class SMESHGUI;
00047 class LightApp_SelectionMgr;
00048 class SVTK_Selector;
00049 
00050 /*
00051   Class       : SMESHGUI_GroupOpDlg
00052   Description : Perform boolean operations on groups
00053 */
00054 
00055 class SMESHGUI_EXPORT SMESHGUI_GroupOpDlg : public QDialog
00056 { 
00057   Q_OBJECT
00058     
00059 public:
00060   //enum { UNION, INTERSECT, CUT };
00061     
00062 public:
00063   SMESHGUI_GroupOpDlg( SMESHGUI* );
00064   virtual ~SMESHGUI_GroupOpDlg();
00065 
00066   void                      Init();
00067 
00068 protected slots:
00069 
00070   virtual bool              onApply();
00071   virtual void              onSelectionDone();
00072   virtual void              setVisible ( bool visible );
00073 
00074 protected:
00075 
00076   virtual void              reset();
00077 
00078   QString                   getName() const;
00079   void                      setName( const QString& theName );
00080 
00081   QGroupBox*                getArgGrp() const;
00082   void                      setHelpFileName( const QString& theFName );
00083   SMESHGUI*                 getSMESHGUI() const;
00084   bool                      isValid( const QList<SMESH::SMESH_GroupBase_var>& theListGrp );
00085   bool                      getSelectedGroups( QList<SMESH::SMESH_GroupBase_var>& theOutList,
00086                                                QStringList& theOutNames );
00087   SMESH::ListOfGroups*      convert( const QList<SMESH::SMESH_GroupBase_var>& );
00088 
00089   SALOMEDS::Color           getColor() const;
00090 
00091   void                      setIsApplyAndClose( const bool theFlag );
00092   bool                      isApplyAndClose() const;
00093 
00094 private:
00095   void                      closeEvent( QCloseEvent* );
00096   void                      enterEvent( QEvent* );            
00097   void                      keyPressEvent( QKeyEvent* );
00098   
00099 private slots:
00100   void                      onOk();
00101   void                      onClose();
00102   void                      onHelp();
00103 
00104   void                      onDeactivate();
00105 
00106 private:
00107   QWidget*                  createButtonFrame( QWidget* );
00108   QWidget*                  createMainFrame  ( QWidget* );
00109     
00110 private:
00111   QPushButton*              myOkBtn;
00112   QPushButton*              myApplyBtn;
00113   QPushButton*              myCloseBtn;
00114   QPushButton*              myHelpBtn;
00115   
00116   QLineEdit*                myNameEdit;
00117   QGroupBox*                myArgGrp;
00118   QtxColorButton*           myColorBtn;
00119   
00120   SMESHGUI*                 mySMESHGUI;
00121   LightApp_SelectionMgr*    mySelectionMgr;
00122   SVTK_Selector*            mySelector;
00123   
00124   QString                   myHelpFileName;
00125 
00126   bool                      myIsApplyAndClose;
00127 };
00128 
00129 /*
00130   Class       : SMESHGUI_UnionGroupsDlg
00131   Description : Perform union of several groups
00132 */
00133 
00134 class SMESHGUI_EXPORT SMESHGUI_UnionGroupsDlg : public SMESHGUI_GroupOpDlg
00135 { 
00136   Q_OBJECT
00137     
00138 public:
00139 
00140   SMESHGUI_UnionGroupsDlg( SMESHGUI* );
00141   virtual ~SMESHGUI_UnionGroupsDlg();
00142 
00143 protected slots:
00144   virtual bool                      onApply();
00145   virtual void                      onSelectionDone();
00146 
00147 protected:
00148   virtual void                      reset();
00149 
00150 private:
00151   QListWidget*                      myListWg;
00152   QList<SMESH::SMESH_GroupBase_var> myGroups;
00153 };
00154 
00155 /*
00156   Class       : SMESHGUI_IntersectGroupsDlg
00157   Description : Perform intersection of several groups
00158 */
00159 
00160 class SMESHGUI_EXPORT SMESHGUI_IntersectGroupsDlg : public SMESHGUI_GroupOpDlg
00161 { 
00162   Q_OBJECT
00163     
00164 public:
00165 
00166   SMESHGUI_IntersectGroupsDlg( SMESHGUI* );
00167   virtual ~SMESHGUI_IntersectGroupsDlg();
00168 
00169 protected slots:
00170   virtual bool                      onApply();
00171   virtual void                      onSelectionDone();
00172 
00173 protected:
00174   virtual void                      reset();
00175     
00176 private:
00177   QListWidget*                      myListWg;
00178   QList<SMESH::SMESH_GroupBase_var> myGroups;
00179 };
00180 
00181 /*
00182   Class       : SMESHGUI_CutGroupsDlg
00183   Description : Perform cut of several groups
00184 */
00185 
00186 class SMESHGUI_EXPORT SMESHGUI_CutGroupsDlg : public SMESHGUI_GroupOpDlg
00187 { 
00188   Q_OBJECT
00189     
00190 public:
00191 
00192   SMESHGUI_CutGroupsDlg( SMESHGUI* );
00193   virtual ~SMESHGUI_CutGroupsDlg();
00194 
00195 protected slots:
00196   virtual bool                      onApply();
00197   virtual void                      onSelectionDone();
00198 
00199 protected:
00200   virtual void                      reset();
00201 
00202 private:
00203   QPushButton*                      myBtn1;
00204   QPushButton*                      myBtn2;
00205   QListWidget*                      myListWg1;
00206   QListWidget*                      myListWg2;
00207   QList<SMESH::SMESH_GroupBase_var> myGroups1;
00208   QList<SMESH::SMESH_GroupBase_var> myGroups2;
00209 };
00210 
00211 /*
00212   Class       : SMESHGUI_DimGroupDlg
00213   Description : Dialog for creating groups of entities from existing 
00214                 groups of superior dimensions
00215 */
00216 
00217 class SMESHGUI_EXPORT SMESHGUI_DimGroupDlg : public SMESHGUI_GroupOpDlg
00218 { 
00219   Q_OBJECT
00220     
00221 public:
00222 
00223   SMESHGUI_DimGroupDlg( SMESHGUI* );
00224   virtual ~SMESHGUI_DimGroupDlg();
00225 
00226   SMESH::ElementType                getElementType() const;
00227   void                              setElementType( const SMESH::ElementType& theElemType );
00228 
00229 protected:
00230   virtual void                      reset();
00231 
00232 protected slots:
00233   virtual bool                      onApply();
00234   virtual void                      onSelectionDone();
00235 
00236 private:
00237   QComboBox*                        myCombo;
00238   QListWidget*                      myListWg;
00239   QList<SMESH::SMESH_GroupBase_var> myGroups;
00240 };
00241 
00242 #endif // SMESHGUI_GROUPOPDLG_H
00243 
00244