Salome HOME
PARAVIS HTML docs
[modules/paravis.git] / src / PVGUI / PVGUI_ProcessModuleHelper.cxx
index 213bdab6318da6bbe296eb062971a9e6d6f211a1..642c46acfed130222723bbf5ae53dfa062a65872 100644 (file)
@@ -4,9 +4,14 @@
 //             <san@portrex.nnov.opencascade.com>
 
 
+#include "PVGUI_Module.h"
 #include "PVGUI_ProcessModuleHelper.h"
 #include "PVGUI_OutputWindowAdapter.h"
 
+#include <CAM_Application.h>
+#include <CAM_Module.h>
+#include <SUIT_Session.h>
+
 #include <vtkObjectFactory.h>
 #include <vtkOutputWindow.h>
 #include <vtkSmartPointer.h>
@@ -46,35 +51,49 @@ void PVGUI_ProcessModuleHelper::PrintSelf(ostream& os, vtkIndent indent)
 }
 
 //-----------------------------------------------------------------------------
+/*!
+  \brief Used by ParaView testing capabilities, not usable in SALOME.
+ */
 bool PVGUI_ProcessModuleHelper::compareView(const QString& ReferenceImage,
   double Threshold, ostream& Output, const QString& TempDirectory)
 {
-  // TODO: to be implemented...
-  //if(MainWindow* const main_window = qobject_cast<MainWindow*>(this->GetMainWindow()))
-  //{
-  //  return main_window->compareView(ReferenceImage, Threshold, Output, TempDirectory);
-  //}
+  if ( CAM_Application* anApp = dynamic_cast<CAM_Application*>( SUIT_Session::session()->activeApplication() ) )
+    if ( PVGUI_Module* aPVM = dynamic_cast<PVGUI_Module*>( anApp->module("ParaVis") ) )
+      return aPVM->compareView( ReferenceImage, Threshold, Output, TempDirectory );
   
   return false;
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
+*/
 void PVGUI_ProcessModuleHelper::showOutputWindow()
 {
   // Do nothing here
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
+*/
 void PVGUI_ProcessModuleHelper::showWindow()
 {
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
+*/
 void PVGUI_ProcessModuleHelper::hideWindow()
 {
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Calls the base implementation and redirects ParaView output to PVGUI_OutputWindowAdapter instance.
+  \sa PVGUI_OutputWindowAdapter
+*/
 int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
 {
   if ( pqProcessModuleGUIHelper::InitializeApplication( argc, argv ) ){
@@ -86,17 +105,26 @@ int PVGUI_ProcessModuleHelper::InitializeApplication(int argc, char** argv)
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior and not to run Qt event loop. Does nothing.
+*/
 int PVGUI_ProcessModuleHelper::appExec()
 {
   return 0;
 }
 
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior and not to exit after the client initalization. Does nothing.
+*/
 //-----------------------------------------------------------------------------
 int PVGUI_ProcessModuleHelper::postAppExec()
 {
   return 0;
 }
 
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
+*/
 //-----------------------------------------------------------------------------
 QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
 {
@@ -104,6 +132,9 @@ QWidget* PVGUI_ProcessModuleHelper::CreateMainWindow()
 }
 
 //-----------------------------------------------------------------------------
+/*! 
+  \brief Reimplemented to suppress default ParaView client behavior. Does nothing.
+*/
 void PVGUI_ProcessModuleHelper::ExitApplication()
 {
   // Cannot exit here, so do nothing