Salome HOME
Redirecting diagnostic VTK output to SALOME log window
[modules/paravis.git] / src / PVGUI / PVGUI_ProcessModuleHelper.cxx
1 // File:        PVGUI_ProcessModuleHelper.cxx
2 // Created:     Tue Nov 11 13:03:19 2008
3 // Author:      Sergey ANIKIN
4 //              <san@portrex.nnov.opencascade.com>
5
6
7 #include "PVGUI_ProcessModuleHelper.h"
8 #include "PVGUI_OutputWindowAdapter.h"
9
10 #include <vtkObjectFactory.h>
11 #include <vtkOutputWindow.h>
12 #include <vtkSmartPointer.h>
13
14 vtkStandardNewMacro(PVGUI_ProcessModuleHelper);
15 vtkCxxRevisionMacro(PVGUI_ProcessModuleHelper, "$Revision$");
16
17 class PVGUI_ProcessModuleHelper::pqImplementation
18 {
19 public:
20   pqImplementation() :
21     OutputWindowAdapter(vtkSmartPointer<PVGUI_OutputWindowAdapter>::New())
22   {}
23
24   ~pqImplementation()
25   {}
26
27   //! Displays VTK debug output in SALOME log window
28   vtkSmartPointer<PVGUI_OutputWindowAdapter> OutputWindowAdapter;
29 };
30
31 //-----------------------------------------------------------------------------
32 PVGUI_ProcessModuleHelper::PVGUI_ProcessModuleHelper()
33   : Implementation(new pqImplementation())
34 {
35 }
36
37 //-----------------------------------------------------------------------------
38 PVGUI_ProcessModuleHelper::~PVGUI_ProcessModuleHelper()
39 {
40 }
41
42 //-----------------------------------------------------------------------------
43 void PVGUI_ProcessModuleHelper::PrintSelf(ostream& os, vtkIndent indent)
44 {
45   this->Superclass::PrintSelf(os, indent);
46 }
47
48 //-----------------------------------------------------------------------------
49 bool PVGUI_ProcessModuleHelper::compareView(const QString& ReferenceImage,
50   double Threshold, ostream& Output, const QString& TempDirectory)
51 {
52   // TODO: to be implemented...
53   //if(MainWindow* const main_window = qobject_cast<MainWindow*>(this->GetMainWindow()))
54   //{
55   //  return main_window->compareView(ReferenceImage, Threshold, Output, TempDirectory);
56   //}
57   
58   return false;
59 }
60
61 //-----------------------------------------------------------------------------
62 void PVGUI_ProcessModuleHelper::showOutputWindow()
63 {
64   // Do nothing here
65 }
66
67 //-----------------------------------------------------------------------------
68 void PVGUI_ProcessModuleHelper::showWindow()
69 {
70 }
71
72 //-----------------------------------------------------------------------------
73 void PVGUI_ProcessModuleHelper::hideWindow()
74 {
75 }
76
77 //-----------------------------------------------------------------------------
78 int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
79 {
80   if ( pqProcessModuleGUIHelper::InitializeApplication( argc, argv ) ){
81     // Redirect VTK debug output to SALOME GUI message console 
82     vtkOutputWindow::SetInstance(Implementation->OutputWindowAdapter);
83   }
84
85   return 1;
86 }
87
88 //-----------------------------------------------------------------------------
89 int PVGUI_ProcessModuleHelper::appExec()
90 {
91   return 0;
92 }
93
94 //-----------------------------------------------------------------------------
95 int PVGUI_ProcessModuleHelper::postAppExec()
96 {
97   return 0;
98 }
99
100 //-----------------------------------------------------------------------------
101 QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
102 {
103   return 0;
104 }
105
106 //-----------------------------------------------------------------------------
107 void PVGUI_ProcessModuleHelper::ExitApplication()
108 {
109   // Cannot exit here, so do nothing
110 }