Back to index

salome-smesh  6.5.0
SMESHGUI_MeshPatternDlg.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   : SMESHGUI_MeshPatternDlg.h
00024 // Author : Sergey LITONIN, Open CASCADE S.A.S.
00025 //
00026 #ifndef SMESHGUI_MESHPATTERNDLG_H
00027 #define SMESHGUI_MESHPATTERNDLG_H
00028 
00029 // SMESH includes
00030 #include "SMESH_SMESHGUI.hxx"
00031 
00032 // Qt includes
00033 #include <QDialog>
00034 #include <QMap>
00035 
00036 // IDL includes
00037 #include <SALOMEconfig.h>
00038 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00039 #include CORBA_SERVER_HEADER(SMESH_Pattern)
00040 
00041 class QFrame;
00042 class QLineEdit;
00043 class QPushButton;
00044 class QRadioButton;
00045 class QCheckBox;
00046 class QButtonGroup;
00047 class QLabel;
00048 class SalomeApp_IntSpinBox;
00049 class vtkUnstructuredGrid;
00050 class SALOME_Actor;
00051 class SVTK_Selector;
00052 class LightApp_SelectionMgr;
00053 class SMESHGUI;
00054 class SMESHGUI_CreatePatternDlg;
00055 class SMESHGUI_PatternWidget;
00056 
00057 /*
00058   Class       : SMESHGUI_MeshPatternDlg
00059   Description : Dialog to specify filters for VTK viewer
00060 */
00061 
00062 class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog
00063 {
00064   Q_OBJECT
00065 
00066   // Pattern type
00067   enum { Type_2d, Type_3d };
00068 
00069   // selection input
00070   enum { Mesh, Object, Vertex1, Vertex2, Ids };
00071 
00072 public:
00073   SMESHGUI_MeshPatternDlg( SMESHGUI* );
00074   virtual ~SMESHGUI_MeshPatternDlg();
00075 
00076   void                                Init();
00077   
00078 private slots:
00079   void                                onOk();
00080   bool                                onApply();
00081   void                                onClose();
00082   void                                onHelp();
00083 
00084   void                                onDeactivate();
00085 
00086   void                                onSelectionDone();
00087   void                                onSelInputChanged();
00088 
00089   void                                onTypeChanged( int );
00090   void                                onModeToggled( bool );
00091   void                                onOpen();
00092   void                                onNew();
00093   void                                onReverse( bool );
00094   void                                onPreview( bool );
00095   void                                onOkCreationDlg();
00096   void                                onCloseCreationDlg();
00097   void                                onTextChanged( const QString& );
00098   void                                onNodeChanged( int );
00099 
00100 private:
00101   QWidget*                            createButtonFrame( QWidget* );
00102   QWidget*                            createMainFrame( QWidget* );
00103   void                                displayPreview();
00104   vtkUnstructuredGrid*                getGrid();
00105   void                                erasePreview();
00106   void                                updateWgState();
00107   bool                                loadFromFile( const QString& );
00108   void                                activateSelection();
00109   QStringList                         prepareFilters() const;
00110   QString                             autoExtension( const QString& ) const;
00111   void                                closeEvent( QCloseEvent* );
00112   void                                enterEvent( QEvent* );
00113   void                                keyPressEvent( QKeyEvent* );
00114   bool                                isValid( const bool = true );
00115   void                                resetSelInput();
00116   bool                                isRefine() const;
00117 
00118   bool                                getIds( QList<int>& ) const;
00119   int                                 getNode( bool = false ) const;
00120 
00121 private:
00122   QPushButton*                        myOkBtn;
00123   QPushButton*                        myApplyBtn;
00124   QPushButton*                        myCloseBtn;
00125   QPushButton*                        myHelpBtn;
00126 
00127   QButtonGroup*                       myTypeGrp;
00128   QRadioButton*                       mySwitch2d;
00129   QRadioButton*                       mySwitch3d;
00130 
00131   QCheckBox*                          myRefine;
00132 
00133   QFrame*                             myRefineGrp;
00134   SalomeApp_IntSpinBox*               myNode1;
00135   SalomeApp_IntSpinBox*               myNode2;
00136   QLabel*                             myNode2Lbl;
00137 
00138   QFrame*                             myGeomGrp;
00139   QMap<int, QPushButton*>             mySelBtn;
00140   QMap<int, QLineEdit*>               mySelEdit;
00141   QMap<int, QLabel*>                  mySelLbl;
00142 
00143   QLineEdit*                          myName;
00144   QPushButton*                        myOpenBtn;
00145   QPushButton*                        myNewBtn;
00146 
00147   QCheckBox*                          myReverseChk;
00148   QCheckBox*                          myCreatePolygonsChk;
00149   QCheckBox*                          myCreatePolyedrsChk;
00150   SMESHGUI_PatternWidget*             myPicture2d;
00151   QLabel*                             myPicture3d;
00152 
00153   QCheckBox*                          myPreviewChk;
00154 
00155   SMESHGUI*                           mySMESHGUI;
00156   SVTK_Selector*                      mySelector;
00157   LightApp_SelectionMgr*              mySelectionMgr;
00158   int                                 mySelInput;
00159   int                                 myNbPoints;
00160   int                                 myType;
00161   bool                                myIsCreateDlgOpen;
00162   bool                                myBusy;
00163 
00164   SMESH::SMESH_Mesh_var               myMesh;
00165   GEOM::GEOM_Object_var               myMeshShape;
00166   QMap<int, GEOM::GEOM_Object_var>    myGeomObj;
00167   
00168   SMESHGUI_CreatePatternDlg*          myCreationDlg;
00169   SMESH::SMESH_Pattern_var            myPattern;
00170   SALOME_Actor*                       myPreviewActor;
00171 
00172   QString                             myHelpFileName;
00173 };
00174 
00175 #endif // SMESHGUI_MESHPATTERNDLG_H