Explorar o código

vtkLightBoxRendererManager - Maintain Annotation text when layout changes

The text was lost when the layout was updated.
Jean-Christophe Fillion-Robin %!s(int64=14) %!d(string=hai) anos
pai
achega
ccd490508d
Modificáronse 1 ficheiros con 11 adicións e 5 borrados
  1. 11 5
      Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

+ 11 - 5
Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

@@ -180,6 +180,7 @@ public:
   int                                           RendererLayer;
   int                                           RendererLayer;
   vtkWeakPointer<vtkRenderWindowInteractor>     CurrentInteractor;
   vtkWeakPointer<vtkRenderWindowInteractor>     CurrentInteractor;
   vtkSmartPointer<vtkCornerAnnotation>          CornerAnnotation;
   vtkSmartPointer<vtkCornerAnnotation>          CornerAnnotation;
+  std::string                                   CornerAnnotationText;
 
 
   vtkWeakPointer<vtkImageData>                  ImageData;
   vtkWeakPointer<vtkImageData>                  ImageData;
   double                                        ColorWindow;
   double                                        ColorWindow;
@@ -242,12 +243,15 @@ void vtkLightBoxRendererManager::vtkInternal::SetupCornerAnnotation()
     if (!(*it)->Renderer->HasViewProp(this->CornerAnnotation))
     if (!(*it)->Renderer->HasViewProp(this->CornerAnnotation))
       {
       {
       (*it)->Renderer->AddViewProp(this->CornerAnnotation);
       (*it)->Renderer->AddViewProp(this->CornerAnnotation);
-      this->CornerAnnotation->SetMaximumLineHeight(0.07);
-      vtkTextProperty *tprop = this->CornerAnnotation->GetTextProperty();
-      tprop->ShadowOn();
       }
       }
-    this->CornerAnnotation->ClearAllTexts();
     }
     }
+
+  this->CornerAnnotation->SetMaximumLineHeight(0.07);
+  vtkTextProperty *tprop = this->CornerAnnotation->GetTextProperty();
+  tprop->ShadowOn();
+
+  this->CornerAnnotation->ClearAllTexts();
+  this->CornerAnnotation->SetText(2, this->CornerAnnotationText.c_str());
 }
 }
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
@@ -718,7 +722,7 @@ void vtkLightBoxRendererManager::SetCornerAnnotationText(const std::string& text
                   "vtkLightBoxRendererManager is NOT initialized");
                   "vtkLightBoxRendererManager is NOT initialized");
     return;
     return;
     }
     }
-  if (text.compare(this->Internal->CornerAnnotation->GetText(2)) == 0)
+  if (text.compare(this->Internal->CornerAnnotationText) == 0)
     {
     {
     return;
     return;
     }
     }
@@ -726,6 +730,8 @@ void vtkLightBoxRendererManager::SetCornerAnnotationText(const std::string& text
   this->Internal->CornerAnnotation->ClearAllTexts();
   this->Internal->CornerAnnotation->ClearAllTexts();
   this->Internal->CornerAnnotation->SetText(2, text.c_str());
   this->Internal->CornerAnnotation->SetText(2, text.c_str());
 
 
+  this->Internal->CornerAnnotationText = text;
+
   this->Modified();
   this->Modified();
 }
 }