From: Eduardo DAVILA Date: Fri, 4 Jun 2021 21:49:01 +0000 (+0200) Subject: #3464 Bug ColorLayerView Bar Position X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=20a2d8dc394ae3fcbe859917c7d72cb6c3e1fb0d;p=creaMaracasVisu.git #3464 Bug ColorLayerView Bar Position --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index b40f815..f942447 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -326,13 +326,27 @@ void LayerImageBase::GetDimensionBase(int *dim) dim[2] = _dimBase[2]; } - //------------------------------------------------------------------------------ void LayerImageBase::SetColorBarPosition(std::vector &colorbarposition) { _colorBarPosition=colorbarposition; + UpdateColorBarPosition(); } +//------------------------------------------------------------------------------ +void LayerImageBase::UpdateColorBarPosition() +{ + if ( _scalarbarActor!=NULL) + { + if (_colorBarPosition.size()==2) + { + _scalarbarActor->SetDisplayPosition( _colorBarPosition[0] , _colorBarPosition[1] ); + } else { + _scalarbarActor->SetDisplayPosition(0,0); + } + } // if +}// + //------------------------------------------------------------------------------ void LayerImageBase::SetRangeForColorBar(std::vector &range) { @@ -420,7 +434,6 @@ void LayerImageBase::CleanXYZ(double &x, double &y, double &z) { z = maxSize; } - } //---------------------------------------------------------------------------- @@ -464,18 +477,11 @@ void LayerImageBase::onThreshold() { _thresholdActor = vtkImageActor::New( ); _scalarbarActor = vtkScalarBarActor::New(); - if (_colorBarPosition.size()==2) - { - _scalarbarActor->SetDisplayPosition(_colorBarPosition[0],_colorBarPosition[1]); - } else { - _scalarbarActor->SetDisplayPosition(0,0); - } + UpdateColorBarPosition(); _scalarbarActor->SetHeight(0.4); //default 0.8 - _scalarbarActor->SetWidth(0.08); //default 0.17 - + _scalarbarActor->SetWidth(0.10); //default 0.17 _thresholdActor->SetOpacity( 1 ); _thresholdActor->InterpolateOn( ); - if (directionViewer==0) { _thresholdActor->SetPosition( 900-1,0,0 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index f5abbb6..482b6fa 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -92,6 +92,7 @@ class LayerImageBase void SetRangeForColorBar(std::vector &range); void GetRangeForColorBar(double &minRange, double &maxRange); void SetColorBarPosition(std::vector &colorbarposition); + void UpdateColorBarPosition(); void SetwxVtkBaseView(wxVtkBaseView *baseview); void onThreshold();