]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To show FPS for both main and segmented views
authorapo <apo@opencascade.com>
Mon, 3 Oct 2005 06:27:39 +0000 (06:27 +0000)
committerapo <apo@opencascade.com>
Mon, 3 Oct 2005 06:27:39 +0000 (06:27 +0000)
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_Renderer.h

index 6b075ff5a04d40d094e5a95f09255c23e4591265..0cad2ffc37bb4199b926d03f4b233aab19d6f4fe 100644 (file)
@@ -126,14 +126,48 @@ VISU_FPSActor
   return 1;
 }
 
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer
+::VVTK_Renderer():
+  myFPSActor(VISU_FPSActor::New())
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer() - "<<this);
+
+  myFPSActor->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() - "<<this);
+}
+
+
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VVTK_Renderer1);
 
 //----------------------------------------------------------------------------
 VVTK_Renderer1
 ::VVTK_Renderer1():
-  myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New()),
-  myTextActor(VISU_FPSActor::New())
+  myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New())
 {
   if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
 
@@ -144,22 +178,6 @@ VVTK_Renderer1
   aPlaneProperty->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();
 }
 
index 5b0bce8c86f17e6eef2c053f8f640fef58cae924..28eff415f9c6978c0c4a1a5ac2b59bf4fc19e667 100644 (file)
@@ -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<VISU_FPSActor> 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);