1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_PreviewDlg.cxx
25 // Author : Roman NIKOLAEV, Open CASCADE S.A.S.
31 #include "SMESHGUI_PreviewDlg.h"
32 #include "SMESHGUI_MeshEditPreview.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_Utils.h"
37 #include <SUIT_Desktop.h>
43 //=================================================================================
44 // class : SMESHGUI_SMESHGUI_PreviewDlg()
46 //=================================================================================
47 SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) :
48 mySMESHGUI(theModule),
49 QDialog(SMESH::GetDesktop( theModule )),
50 myIsApplyAndClose( false )
52 mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
55 //=================================================================================
56 // function : ~SMESHGUI_PreviewDlg()
57 // purpose : Destroys the object and frees any allocated resources
58 //=================================================================================
59 SMESHGUI_PreviewDlg::~SMESHGUI_PreviewDlg()
64 //=================================================================================
65 // function : showPreview
66 // purpose : Show preview in the viewer
67 //=================================================================================
68 void SMESHGUI_PreviewDlg::showPreview(){
70 mySimulation->SetVisibility(true);
73 //=================================================================================
74 // function : hidePreview
75 // purpose : Hide preview in the viewer
76 //=================================================================================
77 void SMESHGUI_PreviewDlg::hidePreview(){
79 mySimulation->SetVisibility(false);
82 //=================================================================================
83 // function : connectPreviewControl
84 // purpose : Connect the preview check box
85 //=================================================================================
86 void SMESHGUI_PreviewDlg::connectPreviewControl(){
87 connect(myPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
91 //=================================================================================
92 // function : toDisplaySimulation
94 //=================================================================================
95 void SMESHGUI_PreviewDlg::toDisplaySimulation() {
96 onDisplaySimulation(true);
99 //=================================================================================
100 // function : onDisplaySimulation
102 //=================================================================================
103 void SMESHGUI_PreviewDlg::onDisplaySimulation(bool toDisplayPreview) {
104 //Empty implementation here
107 //================================================================
108 // Function : setIsApplyAndClose
109 // Purpose : Set value of the flag indicating that the dialog is
110 // accepted by Apply & Close button
111 //================================================================
112 void SMESHGUI_PreviewDlg::setIsApplyAndClose( const bool theFlag )
114 myIsApplyAndClose = theFlag;
117 //================================================================
118 // Function : isApplyAndClose
119 // Purpose : Get value of the flag indicating that the dialog is
120 // accepted by Apply & Close button
121 //================================================================
122 bool SMESHGUI_PreviewDlg::isApplyAndClose() const
124 return myIsApplyAndClose;