Salome HOME
Access to pqMainWindowCore::compareView() from PVGUI_ProcessModuleHelper.
authormkr <mkr@opencascade.com>
Tue, 9 Dec 2008 12:26:44 +0000 (12:26 +0000)
committermkr <mkr@opencascade.com>
Tue, 9 Dec 2008 12:26:44 +0000 (12:26 +0000)
src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module.h
src/PVGUI/PVGUI_ProcessModuleHelper.cxx

index 28cc1c4af99b2f48da9065a43e6b602a8cb668b0..9551b0b747bb363d73f4fb663df360c346290161 100644 (file)
@@ -721,6 +721,18 @@ bool PVGUI_Module::deactivateModule( SUIT_Study* study )
   return LightApp_Module::deactivateModule( study );
 }
 
+/*!
+  \brief Compares the contents of the window with the given reference image,
+  returns true if they "match" within some tolerance.
+*/
+bool PVGUI_Module::compareView( const QString& ReferenceImage, double Threshold,
+                               ostream& Output, const QString& TempDirectory )
+{
+  if ( Implementation )
+    return Implementation->Core.compareView( ReferenceImage, Threshold, Output, TempDirectory );
+  return false;
+}
+
 /*!
   \fn CAM_Module* createModule();
   \brief Export module instance (factory function).
index 4af2b001d4eafa6c467536909634ab7a5240971e..5afdb556bf2dd48f77a0fa298531ef0c066225d4 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <LightApp_Module.h>
 
+#include <ostream.h>
+
 class QMenu;
 class QDockWidget;
 class LightApp_Selection;
@@ -174,6 +176,10 @@ public:
 
   virtual bool           eventFilter( QObject*, QEvent* );
 
+  //! Compares the contents of the window with the given reference image, returns true if they "match" within some tolerance
+  bool                   compareView( const QString& ReferenceImage, double Threshold,
+                                     ostream& Output, const QString& TempDirectory );
+
 protected:
   //virtual CAM_DataModel* createDataModel();
 
index 213bdab6318da6bbe296eb062971a9e6d6f211a1..7079c52a9c81447bda76531e38ae9c7c356a0564 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>
@@ -49,11 +54,9 @@ void PVGUI_ProcessModuleHelper::PrintSelf(ostream& os, vtkIndent indent)
 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;
 }