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_PreviewDlg.cxx 00025 // Author : Roman NIKOLAEV, Open CASCADE S.A.S. 00026 // SMESH includes 00027 // 00028 00029 //SMESH includes 00030 #include "SMESHGUI.h" 00031 #include "SMESHGUI_PreviewDlg.h" 00032 #include "SMESHGUI_MeshEditPreview.h" 00033 #include "SMESHGUI_VTKUtils.h" 00034 #include "SMESHGUI_Utils.h" 00035 00036 //GUI includes 00037 #include <SUIT_Desktop.h> 00038 00039 //QT includes 00040 #include <QCheckBox> 00041 00042 00043 //================================================================================= 00044 // class : SMESHGUI_SMESHGUI_PreviewDlg() 00045 // purpose : 00046 //================================================================================= 00047 SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) : 00048 mySMESHGUI(theModule), 00049 QDialog(SMESH::GetDesktop( theModule )), 00050 myIsApplyAndClose( false ) 00051 { 00052 mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); 00053 } 00054 00055 //================================================================================= 00056 // function : ~SMESHGUI_PreviewDlg() 00057 // purpose : Destroys the object and frees any allocated resources 00058 //================================================================================= 00059 SMESHGUI_PreviewDlg::~SMESHGUI_PreviewDlg() 00060 { 00061 delete mySimulation; 00062 } 00063 00064 //================================================================================= 00065 // function : showPreview 00066 // purpose : Show preview in the viewer 00067 //================================================================================= 00068 void SMESHGUI_PreviewDlg::showPreview(){ 00069 if(mySimulation) 00070 mySimulation->SetVisibility(true); 00071 } 00072 00073 //================================================================================= 00074 // function : hidePreview 00075 // purpose : Hide preview in the viewer 00076 //================================================================================= 00077 void SMESHGUI_PreviewDlg::hidePreview(){ 00078 if(mySimulation) 00079 mySimulation->SetVisibility(false); 00080 } 00081 00082 //================================================================================= 00083 // function : connectPreviewControl 00084 // purpose : Connect the preview check box 00085 //================================================================================= 00086 void SMESHGUI_PreviewDlg::connectPreviewControl(){ 00087 connect(myPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool))); 00088 } 00089 00090 00091 //================================================================================= 00092 // function : toDisplaySimulation 00093 // purpose : 00094 //================================================================================= 00095 void SMESHGUI_PreviewDlg::toDisplaySimulation() { 00096 onDisplaySimulation(true); 00097 } 00098 00099 //================================================================================= 00100 // function : onDisplaySimulation 00101 // purpose : 00102 //================================================================================= 00103 void SMESHGUI_PreviewDlg::onDisplaySimulation(bool toDisplayPreview) { 00104 //Empty implementation here 00105 } 00106 00107 //================================================================ 00108 // Function : setIsApplyAndClose 00109 // Purpose : Set value of the flag indicating that the dialog is 00110 // accepted by Apply & Close button 00111 //================================================================ 00112 void SMESHGUI_PreviewDlg::setIsApplyAndClose( const bool theFlag ) 00113 { 00114 myIsApplyAndClose = theFlag; 00115 } 00116 00117 //================================================================ 00118 // Function : isApplyAndClose 00119 // Purpose : Get value of the flag indicating that the dialog is 00120 // accepted by Apply & Close button 00121 //================================================================ 00122 bool SMESHGUI_PreviewDlg::isApplyAndClose() const 00123 { 00124 return myIsApplyAndClose; 00125 }