Salome HOME
7079c52a9c81447bda76531e38ae9c7c356a0564
[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_Module.h"
8 #include "PVGUI_ProcessModuleHelper.h"
9 #include "PVGUI_OutputWindowAdapter.h"
10
11 #include <CAM_Application.h>
12 #include <CAM_Module.h>
13 #include <SUIT_Session.h>
14
15 #include <vtkObjectFactory.h>
16 #include <vtkOutputWindow.h>
17 #include <vtkSmartPointer.h>
18
19 vtkStandardNewMacro(PVGUI_ProcessModuleHelper);
20 vtkCxxRevisionMacro(PVGUI_ProcessModuleHelper, "$Revision$");
21
22 class PVGUI_ProcessModuleHelper::pqImplementation
23 {
24 public:
25   pqImplementation() :
26     OutputWindowAdapter(vtkSmartPointer<PVGUI_OutputWindowAdapter>::New())
27   {}
28
29   ~pqImplementation()
30   {}
31
32   //! Displays VTK debug output in SALOME log window
33   vtkSmartPointer<PVGUI_OutputWindowAdapter> OutputWindowAdapter;
34 };
35
36 //-----------------------------------------------------------------------------
37 PVGUI_ProcessModuleHelper::PVGUI_ProcessModuleHelper()
38   : Implementation(new pqImplementation())
39 {
40 }
41
42 //-----------------------------------------------------------------------------
43 PVGUI_ProcessModuleHelper::~PVGUI_ProcessModuleHelper()
44 {
45 }
46
47 //-----------------------------------------------------------------------------
48 void PVGUI_ProcessModuleHelper::PrintSelf(ostream& os, vtkIndent indent)
49 {
50   this->Superclass::PrintSelf(os, indent);
51 }
52
53 //-----------------------------------------------------------------------------
54 bool PVGUI_ProcessModuleHelper::compareView(const QString& ReferenceImage,
55   double Threshold, ostream& Output, const QString& TempDirectory)
56 {
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 );
60   
61   return false;
62 }
63
64 //-----------------------------------------------------------------------------
65 void PVGUI_ProcessModuleHelper::showOutputWindow()
66 {
67   // Do nothing here
68 }
69
70 //-----------------------------------------------------------------------------
71 void PVGUI_ProcessModuleHelper::showWindow()
72 {
73 }
74
75 //-----------------------------------------------------------------------------
76 void PVGUI_ProcessModuleHelper::hideWindow()
77 {
78 }
79
80 //-----------------------------------------------------------------------------
81 int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
82 {
83   if ( pqProcessModuleGUIHelper::InitializeApplication( argc, argv ) ){
84     // Redirect VTK debug output to SALOME GUI message console 
85     vtkOutputWindow::SetInstance(Implementation->OutputWindowAdapter);
86   }
87
88   return 1;
89 }
90
91 //-----------------------------------------------------------------------------
92 int PVGUI_ProcessModuleHelper::appExec()
93 {
94   return 0;
95 }
96
97 //-----------------------------------------------------------------------------
98 int PVGUI_ProcessModuleHelper::postAppExec()
99 {
100   return 0;
101 }
102
103 //-----------------------------------------------------------------------------
104 QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
105 {
106   return 0;
107 }
108
109 //-----------------------------------------------------------------------------
110 void PVGUI_ProcessModuleHelper::ExitApplication()
111 {
112   // Cannot exit here, so do nothing
113 }