Back to index

salome-smesh  6.5.0
SMESHGUI_CreatePatternDlg.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_CreatePatternDlg.h
00024 // Author : Sergey LITONIN, Open CASCADE S.A.S.
00025 //
00026 #ifndef SMESHGUI_CREATEPATTERNDLG_H
00027 #define SMESHGUI_CREATEPATTERNDLG_H
00028 
00029 // SMESH includes
00030 #include "SMESH_SMESHGUI.hxx"
00031 
00032 // Qt includes
00033 #include <QDialog>
00034 
00035 // IDL includes
00036 #include <SALOMEconfig.h>
00037 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00038 #include CORBA_SERVER_HEADER(SMESH_Pattern)
00039 
00040 class SMESHGUI_PatternWidget;
00041 class SALOMEDSClient_SObject;
00042 
00043 class QLineEdit;
00044 class QRadioButton;
00045 class QCheckBox;
00046 class QButtonGroup;
00047 class SVTK_Selector;
00048 class LightApp_SelectionMgr;
00049 class SMESHGUI;
00050 
00056 class SMESHGUI_EXPORT SMESHGUI_CreatePatternDlg : public QDialog
00057 {
00058   Q_OBJECT
00059 
00060 public:
00061   enum { Type_2d, Type_3d };
00062 
00063 public:
00064   SMESHGUI_CreatePatternDlg( SMESHGUI*, const int );
00065   virtual ~SMESHGUI_CreatePatternDlg();
00066 
00067   void                     Init( const int );
00068   QString                  GetPatternName() const;
00069   SMESH::SMESH_Pattern_ptr GetPattern();
00070   void                     SetMesh( SMESH::SMESH_Mesh_ptr );
00071 
00072 signals:
00073   void                     NewPattern();
00074   void                     Close();
00075 
00076 private:
00077   void                     closeEvent( QCloseEvent* );
00078   void                     enterEvent( QEvent* );
00079   void                     keyPressEvent( QKeyEvent* );
00080  
00081 private slots:
00082   void                     onOk();
00083   void                     onSave();
00084   void                     onClose();
00085   void                     onHelp();
00086 
00087   void                     onDeactivate();
00088 
00089   void                     onSelectionDone();
00090   void                     onTypeChanged( int );
00091   void                     onProject( bool );
00092   void                     onSelBtnClicked();
00093 
00094 private:
00095   QWidget*                 createButtonFrame( QWidget* );
00096   QWidget*                 createMainFrame( QWidget* );
00097   void                     displayPreview();
00098   void                     erasePreview();
00099   void                     activateSelection();
00100   QString                  autoExtension( const QString& ) const;
00101   bool                     isValid();
00102   bool                     loadFromObject( const bool = true );
00103   QString                  getDefaultName() const;
00104   GEOM::GEOM_Object_ptr    getGeom( SALOMEDSClient_SObject* ) const;
00105 
00106 private:
00107   QButtonGroup*            myTypeGrp;
00108   QRadioButton*            mySwitch2d;
00109   QRadioButton*            mySwitch3d;
00110 
00111   QLineEdit*               myMeshEdit;
00112   QLineEdit*               myName;
00113 
00114   SMESHGUI_PatternWidget*  myPicture2d;
00115 
00116   QCheckBox*               myProjectChk;
00117 
00118   SMESHGUI*                mySMESHGUI;
00119   SVTK_Selector*           mySelector;
00120   LightApp_SelectionMgr*   mySelectionMgr;
00121   int                      myType;
00122 
00123   SMESH::SMESH_Mesh_var    myMesh;
00124   SMESH::SMESH_subMesh_var mySubMesh;
00125   GEOM::GEOM_Object_var    myGeomObj;
00126 
00127   SMESH::SMESH_Pattern_var myPattern;
00128   bool                     myIsLoaded;
00129 
00130   QString                  myHelpFileName;
00131 };
00132 
00133 #endif // SMESHGUI_CREATEPATTERNDLG_H