]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
0019819: EDF 643 VISU : Scalar bar ergonomics
authorsln <sln@opencascade.com>
Tue, 16 Dec 2008 10:53:02 +0000 (10:53 +0000)
committersln <sln@opencascade.com>
Tue, 16 Dec 2008 10:53:02 +0000 (10:53 +0000)
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
src/PIPELINE/VISU_ScalarBarActor.hxx

index eba252be9d0f55e4597d4f898f9e3680679431e1..08dbfdd3ee35281f257f9cde9de67a2a83373bd5 100644 (file)
@@ -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;
 }
index 7f21738100ccb3004cb54c9aca48b2335a6d5db1..24c1e8621646dfb68e257232ffa8e98c4315657c 100644 (file)
@@ -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;