From 9bac292a8b1759eacdfe621f7a31c69c5a609b0c Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 16 Dec 2008 10:53:02 +0000 Subject: [PATCH] 0019819: EDF 643 VISU : Scalar bar ergonomics Scalar bar ergonomics is updated. Two Parameters ?Title width (%)? and ?Title height (%)? is replaced with one parameter ?Title size (%)?. Two Parameters ?Labels width (%)? and ?Labels height (%)? is replaced with one parameter ?Labels size (%)?. --- src/PIPELINE/VISU_ScalarBarActor.cxx | 60 +++++++++------------------- src/PIPELINE/VISU_ScalarBarActor.hxx | 10 ++--- 2 files changed, 21 insertions(+), 49 deletions(-) diff --git a/src/PIPELINE/VISU_ScalarBarActor.cxx b/src/PIPELINE/VISU_ScalarBarActor.cxx index eba252be..08dbfdd3 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.cxx +++ b/src/PIPELINE/VISU_ScalarBarActor.cxx @@ -105,11 +105,9 @@ VISU_ScalarBarActor::VISU_ScalarBarActor() this->LastSize[0] = 0; this->LastSize[1] = 0; - this->TitleRatioWidth = 0; + this->TitleRatioSize = 0; this->LabelRatioWidth = 0; this->BarRatioWidth = 0; - this->TitleRatioHeight = 0; - this->LabelRatioHeight = 0; this->BarRatioHeight = 0; // RKV : Begin @@ -653,13 +651,10 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, else targetWidth = (int)(0.01*LabelRatioWidth*size[0]); - if(LabelRatioHeight == 0) - if ( this->Orientation == VTK_ORIENT_VERTICAL ) - targetHeight = (int)(0.86*size[1]/this->NumberOfLabels); - else - targetHeight = (int)(0.25*size[1]); + if ( this->Orientation == VTK_ORIENT_VERTICAL ) + targetHeight = (int)(0.86*size[1]/this->NumberOfLabels); else - targetHeight = (int)(0.01*LabelRatioHeight*size[1]); + targetHeight = (int)(0.25*size[1]); vtkTextMapper::SetMultipleConstrainedFontSize(viewport, targetWidth, @@ -682,18 +677,15 @@ void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size, int targetWidth, targetHeight; - if(TitleRatioWidth == 0) + if(TitleRatioSize == 0) targetWidth = size[0]; else - targetWidth = (int)(0.01*TitleRatioWidth*size[0]); + targetWidth = (int)(0.01*TitleRatioSize*size[0]); - if(TitleRatioHeight == 0) - if ( this->Orientation == VTK_ORIENT_VERTICAL ) - targetHeight = (int)(0.1*size[1]); - else - targetHeight = (int)(0.25*size[1]); + if ( this->Orientation == VTK_ORIENT_VERTICAL ) + targetHeight = (int)(0.1*size[1]); else - targetHeight = (int)(0.01*TitleRatioHeight*size[1]); + targetHeight = (int)(0.25*size[1]); this->TitleMapper->SetConstrainedFontSize( viewport, targetWidth, targetHeight); @@ -753,21 +745,14 @@ void VISU_ScalarBarActor::DebugOff() { } // RKV : End -void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, +void VISU_ScalarBarActor::SetRatios(int titleRatioSize, int labelRatioWidth, int barRatioWidth, int barRatioHeight) { - TitleRatioWidth=titleRatioWidth; - if(TitleRatioWidth>100) - TitleRatioWidth=100; - else if(TitleRatioWidth<0) - TitleRatioWidth=0; - - TitleRatioHeight=titleRatioHeight; - if(TitleRatioHeight>100) - TitleRatioHeight=100; - else if(TitleRatioHeight<0) - TitleRatioHeight=0; + TitleRatioSize=titleRatioSize; + if(TitleRatioSize>100) + TitleRatioSize=100; + else if(TitleRatioSize<0) + TitleRatioSize=0; LabelRatioWidth=labelRatioWidth; if(LabelRatioWidth>100) @@ -775,12 +760,6 @@ void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, else if(LabelRatioWidth<0) LabelRatioWidth=0; - LabelRatioHeight=labelRatioHeight; - if(LabelRatioHeight>100) - LabelRatioHeight=100; - else if(LabelRatioHeight<0) - LabelRatioHeight=0; - BarRatioWidth=barRatioWidth; if(BarRatioWidth>100) BarRatioWidth=100; @@ -794,14 +773,11 @@ void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, BarRatioHeight=0; } -void VISU_ScalarBarActor::GetRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, - int& barRatioWidth, int& barRatioHeight) +void VISU_ScalarBarActor::GetRatios(int& titleRatioSize, int& labelRatioWidth, + int& barRatioWidth, int& barRatioHeight) { - titleRatioWidth=TitleRatioWidth; - titleRatioHeight=TitleRatioHeight; + titleRatioSize=TitleRatioSize; labelRatioWidth=LabelRatioWidth; - labelRatioHeight=LabelRatioHeight; barRatioWidth=BarRatioWidth; barRatioHeight=BarRatioHeight; } diff --git a/src/PIPELINE/VISU_ScalarBarActor.hxx b/src/PIPELINE/VISU_ScalarBarActor.hxx index 7f217381..24c1e862 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.hxx +++ b/src/PIPELINE/VISU_ScalarBarActor.hxx @@ -130,11 +130,9 @@ public: // Description: // Set/Get the scalar bar dimention properties in persents. // 0 <= ration <= 100 - void SetRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, + void SetRatios(int titleRatioSize,int labelRatioWidth, int barRatioWidth, int barRatioHeight); - void GetRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, + void GetRatios(int& titleRatioSize, int& labelRatioWidth, int& barRatioWidth, int& barRatioHeight); // Description: @@ -173,11 +171,9 @@ protected: int Orientation; char *Title; char *LabelFormat; - int TitleRatioWidth; + int TitleRatioSize; int LabelRatioWidth; int BarRatioWidth; - int TitleRatioHeight; - int LabelRatioHeight; int BarRatioHeight; vtkTextMapper **TextMappers; -- 2.39.2