From: Eduardo DAVILA Date: Fri, 11 Dec 2020 12:50:22 +0000 (+0100) Subject: Opacity Text in 2D viewers X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d6df8c63f6b0f9b6b6eebcb778c379f2dd002644;p=creaMaracasVisu.git Opacity Text in 2D viewers --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.cxx index 02e73d2..6663263 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.cxx @@ -25,6 +25,7 @@ #include "vtkInfoTextImage.h" +#include "vtkProperty2D.h" #include "vtkTextProperty.h" #include //------------------------------------------------------------------- @@ -60,6 +61,29 @@ void vtkInfoTextImage::Configure() } // if vtkText_WindowLevel } +void vtkInfoTextImage::SetOpacity(double opacity) +{ + if (_vtkText_WindowLevel!=NULL) + { + _vtkText_WindowLevel->GetProperty()->SetOpacity( opacity ); + } + if (_vtkText_ColorLevel!=NULL) + { + _vtkText_ColorLevel->GetProperty()->SetOpacity( opacity ); + } + if (_vtkText_position!=NULL) + { + _vtkText_position->GetProperty()->SetOpacity( opacity ); + } + if (_vtkText_pixelIntensity!=NULL) + { + _vtkText_pixelIntensity->GetProperty()->SetOpacity( opacity ); + } + if (_vtkText_plane!=NULL) + { + _vtkText_plane->GetProperty()->SetOpacity( opacity ); + } +} //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.h index e0a761d..7997714 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImage.h @@ -41,6 +41,7 @@ public: void PutColorLevel(); void PutWindowLevel(); void PutPlane(); + void SetOpacity(double opacity); protected: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index 5337c80..70310e6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -426,3 +426,13 @@ int wxVtk2DBaseView::GetDirection() // virtual return 2; } +//------------------------------------------------------------------- +void wxVtk2DBaseView::SetOpacityText(double opacity) +{ + if (_vtkIinfoTextImage!=NULL) + { + _vtkIinfoTextImage->SetOpacity( opacity ); + } +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h index 93e3eee..784f2e6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h @@ -69,6 +69,7 @@ public: //EED 05juin2019 void UpdateCameraParallelScale(); + void SetOpacityText(double opacity); private: vtkInfoTextImage *_vtkIinfoTextImage; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index 517ca87..bd0582e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -389,6 +389,10 @@ void wxVtkMPR2DView::Refresh() } // if GetFixAxis2D _lineAActor->GetProperty()->SetOpacity( opacityAxis ); _lineBActor->GetProperty()->SetOpacity( opacityAxis ); + + SetOpacityText( opacityAxis ); + + _backX = xx; _backY = yy; _backZ = zz;