1 // File: PVGUI_ProcessModuleHelper.cxx
2 // Created: Tue Nov 11 13:03:19 2008
3 // Author: Sergey ANIKIN
4 // <san@portrex.nnov.opencascade.com>
7 #include "PVGUI_Module.h"
8 #include "PVGUI_ProcessModuleHelper.h"
9 #include "PVGUI_OutputWindowAdapter.h"
11 #include <CAM_Application.h>
12 #include <CAM_Module.h>
13 #include <SUIT_Session.h>
15 #include <vtkObjectFactory.h>
16 #include <vtkOutputWindow.h>
17 #include <vtkSmartPointer.h>
19 vtkStandardNewMacro(PVGUI_ProcessModuleHelper);
20 vtkCxxRevisionMacro(PVGUI_ProcessModuleHelper, "$Revision$");
22 class PVGUI_ProcessModuleHelper::pqImplementation
26 OutputWindowAdapter(vtkSmartPointer<PVGUI_OutputWindowAdapter>::New())
32 //! Displays VTK debug output in SALOME log window
33 vtkSmartPointer<PVGUI_OutputWindowAdapter> OutputWindowAdapter;
36 //-----------------------------------------------------------------------------
37 PVGUI_ProcessModuleHelper::PVGUI_ProcessModuleHelper()
38 : Implementation(new pqImplementation())
42 //-----------------------------------------------------------------------------
43 PVGUI_ProcessModuleHelper::~PVGUI_ProcessModuleHelper()
47 //-----------------------------------------------------------------------------
48 void PVGUI_ProcessModuleHelper::PrintSelf(ostream& os, vtkIndent indent)
50 this->Superclass::PrintSelf(os, indent);
53 //-----------------------------------------------------------------------------
55 \brief Used by ParaView testing capabilities, not usable in SALOME.
57 bool PVGUI_ProcessModuleHelper::compareView(const QString& ReferenceImage,
58 double Threshold, ostream& Output, const QString& TempDirectory)
60 if ( CAM_Application* anApp = dynamic_cast<CAM_Application*>( SUIT_Session::session()->activeApplication() ) )
61 if ( PVGUI_Module* aPVM = dynamic_cast<PVGUI_Module*>( anApp->module("ParaVis") ) )
62 return aPVM->compareView( ReferenceImage, Threshold, Output, TempDirectory );
67 //-----------------------------------------------------------------------------
69 \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
71 void PVGUI_ProcessModuleHelper::showOutputWindow()
76 //-----------------------------------------------------------------------------
78 \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
80 void PVGUI_ProcessModuleHelper::showWindow()
84 //-----------------------------------------------------------------------------
86 \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
88 void PVGUI_ProcessModuleHelper::hideWindow()
92 //-----------------------------------------------------------------------------
94 \brief Finalize application in order to save server settings.
96 void PVGUI_ProcessModuleHelper::finalize()
98 this->FinalizeApplication();
101 //-----------------------------------------------------------------------------
103 \brief Calls the base implementation and redirects ParaView output to PVGUI_OutputWindowAdapter instance.
104 \sa PVGUI_OutputWindowAdapter
106 int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
108 if ( pqProcessModuleGUIHelper::InitializeApplication( argc, argv ) ){
109 // Redirect VTK debug output to SALOME GUI message console
110 vtkOutputWindow::SetInstance(Implementation->OutputWindowAdapter);
116 //-----------------------------------------------------------------------------
118 \brief Reimplemented to suppress default ParaView client behavior and not to run Qt event loop. Does nothing.
120 int PVGUI_ProcessModuleHelper::appExec()
126 \brief Reimplemented to suppress default ParaView client behavior and not to exit after the client initalization. Does nothing.
128 //-----------------------------------------------------------------------------
129 int PVGUI_ProcessModuleHelper::postAppExec()
135 \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
137 //-----------------------------------------------------------------------------
138 QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
143 //-----------------------------------------------------------------------------
145 \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
147 void PVGUI_ProcessModuleHelper::ExitApplication()
149 // Cannot exit here, so do nothing