Back to index

salome-smesh  6.5.0
SMESHGUI_GroupDlg.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_GroupDlg.h
00025 // Author : Natalia KOPNOVA, Open CASCADE S.A.S.
00026 //
00027 #ifndef SMESHGUI_GROUPDLG_H
00028 #define SMESHGUI_GROUPDLG_H
00029 
00030 // SMESH includes
00031 #include "SMESH_SMESHGUI.hxx"
00032 
00033 // Qt includes
00034 #include <QDialog>
00035 #include <QList>
00036 #include <QMap>
00037 
00038 // IDL includes
00039 #include <SALOMEconfig.h>
00040 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00041 #include CORBA_SERVER_HEADER(SMESH_Group)
00042 #include CORBA_SERVER_HEADER(SMESH_Filter)
00043 
00044 class QGroupBox;
00045 class QLabel;
00046 class QLineEdit;
00047 class QButtonGroup;
00048 class QListWidget;
00049 class QMenu;
00050 class QPushButton;
00051 class QToolButton;
00052 class QCheckBox;
00053 class QStackedWidget;
00054 class QAction;
00055 class SMESHGUI;
00056 class SMESH_Actor;
00057 class SMESHGUI_FilterDlg;
00058 class SMESHGUI_ShapeByMeshOp;
00059 class QtxColorButton;
00060 class SUIT_Operation;
00061 class SVTK_Selector;
00062 class SUIT_SelectionFilter;
00063 class LightApp_SelectionMgr;
00064 class SMESH_LogicalFilter;
00065 
00066 //=================================================================================
00067 // class    : SMESHGUI_GroupDlg
00068 // purpose  :
00069 //=================================================================================
00070 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog
00071 { 
00072   Q_OBJECT
00073 
00074 public:
00075   SMESHGUI_GroupDlg( SMESHGUI*,
00076                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
00077   SMESHGUI_GroupDlg( SMESHGUI*,
00078                      SMESH::SMESH_GroupBase_ptr,
00079                      const bool theIsConvert = false );
00080   ~SMESHGUI_GroupDlg();
00081   
00082   static QString                GetDefaultName( const QString& );
00083   
00084 public slots:
00085   void onAdd();
00086   void onRemove();
00087 
00088 private slots:
00089   void                          onTypeChanged( int );
00090   void                          onGrpTypeChanged( int );
00091   void                          onColorChanged( QColor );
00092   
00093   void                          onOK();
00094   void                          onClose();
00095   bool                          onApply();
00096   void                          onHelp();
00097   void                          onDeactivate();
00098   void                          onVisibilityChanged();
00099   
00100   void                          onListSelectionChanged();
00101   void                          onObjectSelectionChanged();
00102   
00103   void                          onSelectAll();
00104   void                          onSelectSubMesh( bool );
00105   void                          onSelectGroup( bool );
00106   void                          onSelectGeomGroup( bool );
00107   void                          setCurrentSelection();
00108   
00109   void                          setFilters();
00110   void                          onSort();
00111   
00112   void                          onNameChanged( const QString& );
00113   void                          onFilterAccepted();
00114   
00115   void                          onGeomPopup( QAction* );
00116   void                          onGeomSelectionButton( bool );
00117   
00118   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
00119   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
00120 
00121 private:
00122   void                          initDialog( bool );
00123   void                          init( SMESH::SMESH_Mesh_ptr );
00124   void                          init( SMESH::SMESH_GroupBase_ptr,
00125                                       const bool theIsConvert = false );
00126   void                          closeEvent( QCloseEvent* );
00127   void                          enterEvent( QEvent* );
00128   void                          hideEvent( QHideEvent* );   /* ESC key */
00129   void                          keyPressEvent( QKeyEvent* );
00130   void                          setSelectionMode( int );
00131   void                          updateButtons();
00132   void                          updateGeomPopup();
00133   bool                          SetAppropriateActor();
00134   void                          setShowEntityMode();
00135   void                          restoreShowEntityMode();
00136 
00137   bool                          IsActorVisible( SMESH_Actor* );
00138   
00139   void                          setGroupColor( const SALOMEDS::Color& );
00140   SALOMEDS::Color               getGroupColor() const;
00141   
00142   void                          setGroupQColor( const QColor& );
00143   QColor                        getGroupQColor() const;
00144   
00145   void                          setDefaultGroupColor();
00146 
00147   void                          setIsApplyAndClose( const bool theFlag );
00148   bool                          isApplyAndClose() const;
00149 
00150  private:
00151 
00152   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
00153   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
00154   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
00155   int                           myTypeId;                /* Current type id = radio button id */
00156   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
00157   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
00158   SVTK_Selector*                mySelector;
00159   
00160   QPushButton*                  myMeshGroupBtn;
00161   QLineEdit*                    myMeshGroupLine;
00162   
00163   QButtonGroup*                 myTypeGroup;
00164   QLineEdit*                    myName;
00165   QString                       myOldName;
00166   
00167   QButtonGroup*                 myGrpTypeGroup;
00168   
00169   QStackedWidget*               myWGStack;
00170   QCheckBox*                    mySelectAll;
00171   QCheckBox*                    myAllowElemsModif;
00172   QLabel*                       myElementsLab;
00173   QListWidget*                  myElements;
00174   QPushButton*                  myFilterBtn;
00175   QPushButton*                  myAddBtn;
00176   QPushButton*                  myRemoveBtn;
00177   QPushButton*                  mySortBtn;
00178   
00179   QGroupBox*                    mySelectBox;
00180   QCheckBox*                    mySelectSubMesh;
00181   QPushButton*                  mySubMeshBtn;
00182   QLineEdit*                    mySubMeshLine;
00183   QCheckBox*                    mySelectGroup;
00184   QPushButton*                  myGroupBtn;
00185   QLineEdit*                    myGroupLine;
00186   
00187   QtxColorButton*               myColorBtn;
00188   
00189   QCheckBox*                    mySelectGeomGroup;
00190   QToolButton*                  myGeomGroupBtn;
00191   QLineEdit*                    myGeomGroupLine;
00192   QMenu*                        myGeomPopup;
00193 
00194   QPushButton*                  myOKBtn;
00195   QPushButton*                  myApplyBtn;
00196   QPushButton*                  myCloseBtn;
00197   QPushButton*                  myHelpBtn;
00198   
00199   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
00200   
00201   SMESH::SMESH_Mesh_var         myMesh;
00202   QList<SMESH_Actor*>           myActorsList;
00203   SMESH::SMESH_Group_var        myGroup;
00204   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
00205   SMESH::SMESH_GroupOnFilter_var myGroupOnFilter;
00206   SMESH::Filter_var             myFilter;
00207   QList<int>                    myIdList;
00208   GEOM::ListOfGO_var            myGeomObjects;
00209   
00210   int                           mySelectionMode;
00211   //Handle(SMESH_TypeFilter)      myMeshFilter;
00212   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
00213   //Handle(SMESH_TypeFilter)      myGroupFilter;
00214   SUIT_SelectionFilter*         myMeshFilter;
00215   SMESH_LogicalFilter*          mySubMeshFilter;
00216   SMESH_LogicalFilter*          myGroupFilter;
00217   SUIT_SelectionFilter*         myGeomFilter;
00218   
00219   SMESHGUI_FilterDlg*           myFilterDlg;
00220   
00221   bool                          myCreate, myIsBusy;
00222   
00223   QString                       myHelpFileName;
00224   
00225   QMap<QAction*, int>           myActions;
00226 
00227   bool                          myNameChanged; //added by skl for IPAL19574
00228   int                           myNbChangesOfContents; // nb add's and remove's
00229 
00230   QString                       myObjectToSelect;
00231   bool                          myIsApplyAndClose;
00232 };
00233 
00234 #endif // SMESHGUI_GROUPDLG_H