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 //-----------------------------------------------------------------------------
54 bool PVGUI_ProcessModuleHelper::compareView(const QString& ReferenceImage,
55 double Threshold, ostream& Output, const QString& TempDirectory)
57 if ( CAM_Application* anApp = dynamic_cast<CAM_Application*>( SUIT_Session::session()->activeApplication() ) )
58 if ( PVGUI_Module* aPVM = dynamic_cast<PVGUI_Module*>( anApp->module("ParaVis") ) )
59 return aPVM->compareView( ReferenceImage, Threshold, Output, TempDirectory );
64 //-----------------------------------------------------------------------------
65 void PVGUI_ProcessModuleHelper::showOutputWindow()
70 //-----------------------------------------------------------------------------
71 void PVGUI_ProcessModuleHelper::showWindow()
75 //-----------------------------------------------------------------------------
76 void PVGUI_ProcessModuleHelper::hideWindow()
80 //-----------------------------------------------------------------------------
81 int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
83 if ( pqProcessModuleGUIHelper::InitializeApplication( argc, argv ) ){
84 // Redirect VTK debug output to SALOME GUI message console
85 vtkOutputWindow::SetInstance(Implementation->OutputWindowAdapter);
91 //-----------------------------------------------------------------------------
92 int PVGUI_ProcessModuleHelper::appExec()
97 //-----------------------------------------------------------------------------
98 int PVGUI_ProcessModuleHelper::postAppExec()
103 //-----------------------------------------------------------------------------
104 QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
109 //-----------------------------------------------------------------------------
110 void PVGUI_ProcessModuleHelper::ExitApplication()
112 // Cannot exit here, so do nothing