From 7f3b072e9efe914e385ec08e364c0a9161c8c9e9 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 3 Oct 2005 06:27:39 +0000 Subject: [PATCH] To show FPS for both main and segmented views --- src/VVTK/VVTK_Renderer.cxx | 55 +++++++++++++++++++++++++------------- src/VVTK/VVTK_Renderer.h | 19 +++++++++++-- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 6b075ff5..0cad2ffc 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -126,14 +126,48 @@ VISU_FPSActor return 1; } +//---------------------------------------------------------------------------- +vtkStandardNewMacro(VVTK_Renderer); + +//---------------------------------------------------------------------------- +VVTK_Renderer +::VVTK_Renderer(): + myFPSActor(VISU_FPSActor::New()) +{ + if(MYDEBUG) INFOS("VVTK_Renderer() - "<Delete(); + + vtkTextMapper* aTextMapper = vtkTextMapper::New(); + vtkTextProperty *aTextProperty = aTextMapper->GetTextProperty(); + aTextProperty->SetJustificationToRight(); + aTextProperty->SetVerticalJustificationToTop(); + aTextProperty->SetFontSize(10); + + myFPSActor->SetPickable(false); + myFPSActor->ScaledTextOff(); + myFPSActor->SetAlignmentPoint(8); + myFPSActor->SetPosition2 (1., 1.); + myFPSActor->SetMapper(aTextMapper); + aTextMapper->Delete(); + + GetDevice()->AddActor2D(myFPSActor.GetPointer()); +} + +VVTK_Renderer +::~VVTK_Renderer() +{ + if(MYDEBUG) INFOS("~VVTK_Renderer() - "<SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5); myImplicitFunctionWidget->Delete(); - myTextActor->Delete(); - - vtkTextMapper* aTextMapper = vtkTextMapper::New(); - vtkTextProperty *aTextProperty = aTextMapper->GetTextProperty(); - aTextProperty->SetJustificationToRight(); - aTextProperty->SetVerticalJustificationToTop(); - aTextProperty->SetFontSize(10); - - myTextActor->SetPickable(false); - myTextActor->ScaledTextOff(); - myTextActor->SetAlignmentPoint(8); - myTextActor->SetPosition2 (1., 1.); - myTextActor->SetMapper(aTextMapper); - aTextMapper->Delete(); - - GetDevice()->AddActor2D(myTextActor.GetPointer()); } VVTK_Renderer1 @@ -285,6 +303,7 @@ void VVTK_Renderer2 ::OnEndInteractionEvent() { + AdjustActors(); myInteractor->Render(); } diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 5b0bce8c..28eff415 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -39,7 +39,22 @@ class VISU_FPSActor; class vtkImplicitFunction; //---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_Renderer1 : public SVTK_Renderer +class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer +{ + public: + vtkTypeMacro(VVTK_Renderer,SVTK_Renderer); + static VVTK_Renderer* New(); + + protected: + VVTK_Renderer(); + ~VVTK_Renderer(); + + vtkSmartPointer myFPSActor; +}; + + +//---------------------------------------------------------------------------- +class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer { public: vtkTypeMacro(VVTK_Renderer1,SVTK_Renderer); @@ -74,7 +89,7 @@ class VVTK_EXPORT VVTK_Renderer1 : public SVTK_Renderer //---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_Renderer2 : public SVTK_Renderer +class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer { public: vtkTypeMacro(VVTK_Renderer2,SVTK_Renderer); -- 2.39.2