|
@@ -68,7 +68,7 @@ RenderWindowItem::RenderWindowItem(const double rendererBackgroundColor[3],
|
|
|
const double highlightedBoxColor[3],
|
|
|
double colorWindow, double colorLevel)
|
|
|
{
|
|
|
- // Instanciate a renderer
|
|
|
+ // Instantiate a renderer
|
|
|
this->Renderer = vtkSmartPointer<vtkRenderer>::New();
|
|
|
this->Renderer->SetBackground(rendererBackgroundColor[0],
|
|
|
rendererBackgroundColor[1],
|
|
@@ -92,7 +92,7 @@ void RenderWindowItem::SetupImageMapperActor(double colorWindow, double colorLev
|
|
|
assert(this->Renderer);
|
|
|
assert(!this->ImageMapper);
|
|
|
|
|
|
- // Instanciate an image mapper
|
|
|
+ // Instantiate an image mapper
|
|
|
this->ImageMapper = vtkSmartPointer<vtkImageMapper>::New();
|
|
|
this->ImageMapper->SetColorWindow(colorWindow);
|
|
|
this->ImageMapper->SetColorLevel(colorLevel);
|
|
@@ -177,8 +177,10 @@ public:
|
|
|
int RenderWindowColumnCount;
|
|
|
int RenderWindowLayoutType;
|
|
|
double HighlightedBoxColor[3];
|
|
|
+ int RendererLayer;
|
|
|
vtkWeakPointer<vtkRenderWindowInteractor> CurrentInteractor;
|
|
|
vtkSmartPointer<vtkCornerAnnotation> CornerAnnotation;
|
|
|
+ std::string CornerAnnotationText;
|
|
|
|
|
|
vtkWeakPointer<vtkImageData> ImageData;
|
|
|
double ColorWindow;
|
|
@@ -208,6 +210,7 @@ vtkLightBoxRendererManager::vtkInternal::vtkInternal(vtkLightBoxRendererManager*
|
|
|
this->RenderWindowLayoutType = vtkLightBoxRendererManager::LeftRightTopBottom;
|
|
|
this->ColorWindow = 255;
|
|
|
this->ColorLevel = 127.5;
|
|
|
+ this->RendererLayer = 0;
|
|
|
// Default background color: black
|
|
|
this->RendererBackgroundColor[0] = 0.0;
|
|
|
this->RendererBackgroundColor[1] = 0.0;
|
|
@@ -240,12 +243,15 @@ void vtkLightBoxRendererManager::vtkInternal::SetupCornerAnnotation()
|
|
|
if (!(*it)->Renderer->HasViewProp(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());
|
|
|
}
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
@@ -253,7 +259,13 @@ void vtkLightBoxRendererManager::vtkInternal::setupRendering()
|
|
|
{
|
|
|
assert(this->RenderWindow);
|
|
|
|
|
|
- this->RenderWindow->GetRenderers()->RemoveAllItems();
|
|
|
+ // Remove only renderers managed by this light box
|
|
|
+ for(RenderWindowItemListIt it = this->RenderWindowItemList.begin();
|
|
|
+ it != this->RenderWindowItemList.end();
|
|
|
+ ++it)
|
|
|
+ {
|
|
|
+ this->RenderWindow->GetRenderers()->RemoveItem((*it)->Renderer);
|
|
|
+ }
|
|
|
|
|
|
// Compute the width and height of each RenderWindowItem
|
|
|
double viewportWidth = 1.0 / static_cast<double>(this->RenderWindowColumnCount);
|
|
@@ -335,6 +347,25 @@ void vtkLightBoxRendererManager::PrintSelf(ostream& os, vtkIndent indent)
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
+void vtkLightBoxRendererManager::SetRendererLayer(int newLayer)
|
|
|
+{
|
|
|
+ if (this->IsInitialized())
|
|
|
+ {
|
|
|
+ vtkErrorMacro(<< "SetRendererLayer failed - vtkLightBoxRendererManager is initialized");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (newLayer == this->Internal->RendererLayer)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this->Internal->RendererLayer = newLayer;
|
|
|
+
|
|
|
+ this->Modified();
|
|
|
+}
|
|
|
+
|
|
|
+//----------------------------------------------------------------------------
|
|
|
vtkRenderWindow* vtkLightBoxRendererManager::GetRenderWindow()
|
|
|
{
|
|
|
return this->Internal->RenderWindow;
|
|
@@ -538,6 +569,7 @@ void vtkLightBoxRendererManager::SetRenderWindowLayout(int rowCount, int columnC
|
|
|
new RenderWindowItem(this->Internal->RendererBackgroundColor,
|
|
|
this->Internal->HighlightedBoxColor,
|
|
|
this->Internal->ColorWindow, this->Internal->ColorLevel);
|
|
|
+ item->Renderer->SetLayer(this->Internal->RendererLayer);
|
|
|
item->ImageMapper->SetInput(this->Internal->ImageData);
|
|
|
this->Internal->RenderWindowItemList.push_back(item);
|
|
|
--extraItem;
|
|
@@ -690,7 +722,7 @@ void vtkLightBoxRendererManager::SetCornerAnnotationText(const std::string& text
|
|
|
"vtkLightBoxRendererManager is NOT initialized");
|
|
|
return;
|
|
|
}
|
|
|
- if (text.compare(this->Internal->CornerAnnotation->GetText(2)) == 0)
|
|
|
+ if (text.compare(this->Internal->CornerAnnotationText) == 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -698,6 +730,8 @@ void vtkLightBoxRendererManager::SetCornerAnnotationText(const std::string& text
|
|
|
this->Internal->CornerAnnotation->ClearAllTexts();
|
|
|
this->Internal->CornerAnnotation->SetText(2, text.c_str());
|
|
|
|
|
|
+ this->Internal->CornerAnnotationText = text;
|
|
|
+
|
|
|
this->Modified();
|
|
|
}
|
|
|
|
|
@@ -709,6 +743,12 @@ const std::string vtkLightBoxRendererManager::GetCornerAnnotationText() const
|
|
|
}
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
+vtkCornerAnnotation * vtkLightBoxRendererManager::GetCornerAnnotation() const
|
|
|
+{
|
|
|
+ return this->Internal->CornerAnnotation;
|
|
|
+}
|
|
|
+
|
|
|
+// --------------------------------------------------------------------------
|
|
|
void vtkLightBoxRendererManager::SetBackgroundColor(const double newBackgroundColor[3])
|
|
|
{
|
|
|
if (!this->IsInitialized())
|