]> Creatis software - creaMaracasVisu.git/commitdiff
#3464 Bug ColorLayerView Bar Position
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 4 Jun 2021 21:49:01 +0000 (23:49 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 4 Jun 2021 21:49:01 +0000 (23:49 +0200)
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h

index b40f8156795ef949d6792c07a24d58430e3cf3c8..f942447f82177f11e714cc0313aa57db4fd3ab1b 100644 (file)
@@ -326,13 +326,27 @@ void LayerImageBase::GetDimensionBase(int *dim)
        dim[2] = _dimBase[2];
 }
 
-
 //------------------------------------------------------------------------------
 void LayerImageBase::SetColorBarPosition(std::vector<int> &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<double> &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 );
index f5abbb6b61cc6add81fd915486288db483203e15..482b6fa725531671a3966a176781136b4ad862df 100644 (file)
@@ -92,6 +92,7 @@ class LayerImageBase
                void                    SetRangeForColorBar(std::vector<double> &range);
                void                    GetRangeForColorBar(double &minRange, double &maxRange);
                void                    SetColorBarPosition(std::vector<int> &colorbarposition);
+               void                    UpdateColorBarPosition();
                void                    SetwxVtkBaseView(wxVtkBaseView *baseview);
 
                void onThreshold();