From: apo Date: Fri, 21 Apr 2006 13:47:39 +0000 (+0000) Subject: To introduce desired update rate management for VTK viewes X-Git-Tag: T3_2_0b1_pre1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e135dedfdf073221a83d02a9b9f61cb33cace0f4;p=modules%2Fvisu.git To introduce desired update rate management for VTK viewes --- diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index 549e6a0b..f93f9c6b 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -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; } diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 1b3e755d..9b2e2df0 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -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")); diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index ad1f525b..fe8e2871 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -17,6 +17,7 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" +#include "SVTK_MainWindow.h" #include "SVTK_RenderWindowInteractor.h" #include @@ -45,10 +46,14 @@ 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 ); diff --git a/src/VVTK/VVTK_PickingDlg.h b/src/VVTK/VVTK_PickingDlg.h index a2099bb4..ccff0cea 100644 --- a/src/VVTK/VVTK_PickingDlg.h +++ b/src/VVTK/VVTK_PickingDlg.h @@ -11,7 +11,7 @@ #ifndef VVTK_PICKINGDLG_H #define VVTK_PICKINGDLG_H -#include +#include "SVTK_DialogBase.h" #include #include @@ -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(); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 8a171986..a67a386e 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -125,7 +125,7 @@ VISU_FPSActor } std::ostringstream aStr; float aFPS = 1.0 / aLastRenderTimeInSeconds; - aStr<<"FPS: "<SetMapper(aTextMapper); aTextMapper->Delete(); - GetDevice()->AddActor2D(myFPSActor.GetPointer()); + //GetDevice()->AddActor2D(myFPSActor.GetPointer()); myGaussPointPicker->Delete(); diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 8ea2c36e..30eab723 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -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 ) diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index 3ca4a195..087f60b6 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -113,6 +113,8 @@ private: protected slots: virtual void done( int ); + void onParentShow(); + void onParentHide(); void onClickApply(); void onClickClose(); diff --git a/src/VVTK/VVTK_ViewManager.cxx b/src/VVTK/VVTK_ViewManager.cxx index 8c3cb03b..701d71cd 100644 --- a/src/VVTK/VVTK_ViewManager.cxx +++ b/src/VVTK/VVTK_ViewManager.cxx @@ -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() ); diff --git a/src/VVTK/VVTK_ViewManager.h b/src/VVTK/VVTK_ViewManager.h index 101fa583..d0457229 100644 --- a/src/VVTK/VVTK_ViewManager.h +++ b/src/VVTK/VVTK_ViewManager.h @@ -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: