]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce desired update rate management for VTK viewes
authorapo <apo@opencascade.com>
Fri, 21 Apr 2006 13:47:39 +0000 (13:47 +0000)
committerapo <apo@opencascade.com>
Fri, 21 Apr 2006 13:47:39 +0000 (13:47 +0000)
src/OBJECT/VISU_MeshAct.cxx
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_PickingDlg.cxx
src/VVTK/VVTK_PickingDlg.h
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_SegmentationCursorDlg.cxx
src/VVTK/VVTK_SegmentationCursorDlg.h
src/VVTK/VVTK_ViewManager.cxx
src/VVTK/VVTK_ViewManager.h

index 549e6a0b2a8a5ded5b14dac35e2c79a296164e9b..f93f9c6b9273fc2744877c179769998fc202c6e7 100644 (file)
@@ -225,17 +225,23 @@ VISU_MeshAct
   using namespace SVTK::Representation;
   switch(GetRepresentation()){
   case Points : 
+    myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     myNodeActor->RenderOpaqueGeometry(ren);
     break;
   case Wireframe : 
   case Insideframe : 
+    myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
   case Surface : 
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderOpaqueGeometry(ren);
     break;
   case Surfaceframe : 
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     mySurfaceActor->RenderOpaqueGeometry(ren);
+
+    myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
   }
@@ -253,17 +259,23 @@ VISU_MeshAct
   using namespace SVTK::Representation;
   switch(GetRepresentation()){
   case Points : 
+    myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     myNodeActor->RenderTranslucentGeometry(ren);
     break;
   case Wireframe : 
   case Insideframe : 
+    myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     myEdgeActor->RenderTranslucentGeometry(ren);
     break;
   case Surface : 
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderTranslucentGeometry(ren);
     break;
   case Surfaceframe : 
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderTranslucentGeometry(ren);
+
+    myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderTranslucentGeometry(ren);
     break;
   }
index 1b3e755d51d08fc73d4a3cfc2becd806077d2050..9b2e2df08b9ebf3676c56abea380177b583c4710 100644 (file)
@@ -172,7 +172,7 @@ void VVTK_MainWindow::onDumpView()
     fmt = "JPEG";
 
   QApplication::setOverrideCursor( Qt::waitCursor );
-  bool res = img.save( fileName, fmt.latin1() );
+  img.save( fileName, fmt.latin1() );
   QApplication::restoreOverrideCursor();
 }
 
@@ -301,8 +301,7 @@ VVTK_MainWindow1
   myPickingAction->addTo( myPtsToolBar );
   connect(myPickingAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool)));
 
-  myPickingDlg = new VVTK_PickingDlg( this, "PickingDlg" );
-  myPickingDlg->SetAction( myPickingAction );
+  myPickingDlg = new VVTK_PickingDlg( myPickingAction, this, "PickingDlg" );
 
   // Plane/Sphere Segmentation
   aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH"));
index ad1f525b0e3b95b316942f3c34d6418c3d7fb7e2..fe8e28715175c55cec27b3c913754c646b0d2124 100644 (file)
@@ -17,6 +17,7 @@
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
 
+#include "SVTK_MainWindow.h"
 #include "SVTK_RenderWindowInteractor.h"
 
 #include <vtkActorCollection.h>
 
 using namespace std;
 
-VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name )
-  :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
-   myEventCallbackCommand( vtkCallbackCommand::New() ),
-   myPickingSettings( VISU_PickingSettings::New() )
+VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction,
+                                SVTK_MainWindow* theParent,
+                                const char* theName):
+  SVTK_DialogBase(theAction,
+                 theParent, 
+                 theName),
+  myEventCallbackCommand( vtkCallbackCommand::New() ),
+  myPickingSettings( VISU_PickingSettings::New() )
 {
   myPriority = 0.0;
   myEventCallbackCommand->Delete();
@@ -366,7 +371,6 @@ void VVTK_PickingDlg::onClickApply()
 
 void VVTK_PickingDlg::onClickClose()
 {
-  myAction->setOn( false );
   reject();
 }
 
@@ -384,12 +388,6 @@ void VVTK_PickingDlg::onClickHelp()
   }
 }
 
-void VVTK_PickingDlg::done( int r )
-{
-  myAction->setOn( false );
-  QDialog::done( r );
-}
-
 void VVTK_PickingDlg::onColorButtonPressed()
 {
   QColor aColor = QColorDialog::getColor( mySelectionColorButton->paletteBackgroundColor(), this );
index a2099bb4df86de1ec302c8e13959ee4aacd6ed56..ccff0cea97aa527c179550a83144abdd3e514479 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef VVTK_PICKINGDLG_H
 #define VVTK_PICKINGDLG_H
 
-#include <qdialog.h>
+#include "SVTK_DialogBase.h"
 
 #include <vtkObject.h>
 #include <vtkSmartPointer.h>
@@ -32,6 +32,7 @@ class QtxIntSpinBox;
 class VISU_GaussPtsAct;
 class VISU_PickingSettings;
 
+class SVTK_MainWindow;
 class SVTK_RenderWindowInteractor;
 
 //! Picking Dialog.
@@ -39,16 +40,16 @@ class SVTK_RenderWindowInteractor;
  * Uses for set up picking preferenses and apply
  * them to all actors in the current renderer.
  */
-class VVTK_PickingDlg : public QDialog
+class VVTK_PickingDlg : public SVTK_DialogBase
 {
   Q_OBJECT
 
 public:
-  VVTK_PickingDlg( QWidget* parent = 0, const char* name = 0 );
-  ~VVTK_PickingDlg();
+  VVTK_PickingDlg(QtxAction* theAction,
+                 SVTK_MainWindow* theParent,
+                 const char* theName);
 
-  //! Used to switch toggle state of the Picking action.
-  void             SetAction( QtxAction* theAction ) { myAction = theAction; }
+  ~VVTK_PickingDlg();
 
   //! Make an actor to listen the event of Update Picking Settings event.
   void             AddActor( VISU_GaussPtsAct* );
@@ -62,8 +63,6 @@ public:
   void             SetInteractor( SVTK_RenderWindowInteractor* );
 
 protected slots:
-  virtual void     done( int );
-
   void             onClickApply();
   void             onClickClose();
   void             onClickHelp();
index 8a1719860a52a815f4bfc9a8e37245ed1b21cc7a..a67a386ebcb50014a00524e8c63bc27725ac6cad 100644 (file)
@@ -125,7 +125,7 @@ VISU_FPSActor
       }
       std::ostringstream aStr;
       float aFPS = 1.0 / aLastRenderTimeInSeconds;
-      aStr<<"FPS: "<<aFPS<<"; NumberOfCells: "<<aNumberOfCells;
+      aStr<<"FPS: "<<aFPS<<"\n NumberOfCells: "<<aNumberOfCells;
       std::string anInput = aStr.str();
       SetInput(anInput.c_str());
       return Superclass::RenderOpaqueGeometry(theViewport);
@@ -164,7 +164,7 @@ VVTK_Renderer
   myFPSActor->SetMapper(aTextMapper);
   aTextMapper->Delete();
 
-  GetDevice()->AddActor2D(myFPSActor.GetPointer());
+  //GetDevice()->AddActor2D(myFPSActor.GetPointer());
 
   myGaussPointPicker->Delete();
 
index 8ea2c36e36141e78ff3e4023e51f3a56bef17973..30eab72378282cf2ca33dea35e5939983e49f687 100644 (file)
@@ -390,6 +390,9 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c
   connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
   connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) );
   connect( buttonHelp,  SIGNAL( clicked() ), this, SLOT( onClickHelp() ) );
+
+  connect(parent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+  connect(parent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
 }
 
 VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg()
@@ -831,6 +834,19 @@ void VVTK_SegmentationCursorDlg::done( int r )
   QDialog::done( r );
 }
 
+void VVTK_SegmentationCursorDlg::onParentShow()
+{
+  if(myPlaneAction->isOn() || mySphereAction->isOn())
+    show();
+  else
+    hide();
+}
+
+void VVTK_SegmentationCursorDlg::onParentHide()
+{
+  hide();
+}
+
 bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces()
 {
   if( !myInteractor )
index 3ca4a19538ce6a2f6fec921be75968dad1724ad3..087f60b60bb41ef7cae98c82c2fc2fb84ca085a2 100644 (file)
@@ -113,6 +113,8 @@ private:
 
 protected slots:
   virtual void     done( int );
+  void             onParentShow();
+  void             onParentHide();
 
   void             onClickApply();
   void             onClickClose();
index 8c3cb03be3fe4d380f773b654668b86be76ed90d..701d71cd7e928ad4a2fe8a8761dac4981964d12e 100644 (file)
@@ -7,7 +7,7 @@ int VVTK_ViewManager::_VVTKViewMgr_Id = 0;
 VVTK_ViewManager
 ::VVTK_ViewManager( SUIT_Study* study, 
                    SUIT_Desktop* theDesktop ) 
-: SUIT_ViewManager( study, theDesktop )
+: SVTK_ViewManager( study, theDesktop )
 {
   myId = ++_VVTKViewMgr_Id;
   setViewModel( new VVTK_Viewer() );
index 101fa583c4ce08922420fae5ecd0f3d46c1d7243..d0457229bfc6c760ce1db256ad42bd6525113d2c 100644 (file)
@@ -1,13 +1,13 @@
 #ifndef VVTK_VIEWMANAGER_H
 #define VVTK_VIEWMANAGER_H
 
-#include "SUIT_ViewManager.h"
+#include "SVTK_ViewManager.h"
 #include "VVTK.h"
 
 class SUIT_Desktop;
 
 //! Extend SUIT_ViewManager to deal with VVTK_Viewer
-class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager
+class VVTK_EXPORT VVTK_ViewManager : public SVTK_ViewManager
 {
   Q_OBJECT;
 public: