<parameter name="scalar_bar_horizontal_width" value="0.5" />
<parameter name="scalar_bar_horizontal_x" value="0.01"/>
<parameter name="scalar_bar_horizontal_y" value="0.01"/>
+ <parameter name="scalar_bar_horizontal_title_height" value="0"/>
+ <parameter name="scalar_bar_horizontal_title_width" value="0"/>
+ <parameter name="scalar_bar_horizontal_label_height" value="0"/>
+ <parameter name="scalar_bar_horizontal_label_width" value="0"/>
+ <parameter name="scalar_bar_horizontal_bar_height" value="0"/>
+ <parameter name="scalar_bar_horizontal_bar_width" value="0"/>
<parameter name="scalar_bar_label_color" value="255, 255, 255"/>
<parameter name="scalar_bar_label_font" value="Arial,Bold,Italic,Underline,12"/>
+ <parameter name="scalar_bar_label_format" value="%-#6.3g" />
<parameter name="scalar_bar_logarithmic" value="false"/>
<parameter name="scalar_bar_mode" value="0" />
<parameter name="scalar_bar_num_colors" value="64"/>
<parameter name="scalar_bar_orientation" value="0" />
<parameter name="scalar_bar_title_color" value="255, 255, 255"/>
<parameter name="scalar_bar_title_font" value="Arial,Bold,Italic,Underline,12"/>
+ <parameter name="scalar_bar_display_units" value="true"/>
<parameter name="scalar_bar_vertical_height" value="0.5" />
<parameter name="scalar_bar_vertical_width" value="0.05"/>
<parameter name="scalar_bar_vertical_x" value="0.01"/>
<parameter name="scalar_bar_vertical_y" value="0.01"/>
+ <parameter name="scalar_bar_vertical_title_height" value="0"/>
+ <parameter name="scalar_bar_vertical_title_width" value="0"/>
+ <parameter name="scalar_bar_vertical_label_height" value="0"/>
+ <parameter name="scalar_bar_vertical_label_width" value="0"/>
+ <parameter name="scalar_bar_vertical_bar_height" value="0"/>
+ <parameter name="scalar_bar_vertical_bar_width" value="0"/>
<parameter name="scalar_range_max" value="0"/>
<parameter name="scalar_range_min" value="0"/>
<parameter name="scalar_range_type" value="0"/>
#include <vtkRenderer.h>
#include <vtkPointPicker.h>
#include <vtkScalarBarWidget.h>
-#include <vtkScalarBarActor.h>
#include <vtkTextMapper.h>
#include <vtkTextProperty.h>
this->LastOrigin[1] = 0;
this->LastSize[0] = 0;
this->LastSize[1] = 0;
+
+ this->TitleRatioWidth = 0;
+ this->LabelRatioWidth = 0;
+ this->BarRatioWidth = 0;
+ this->TitleRatioHeight = 0;
+ this->LabelRatioHeight = 0;
+ this->BarRatioHeight = 0;
}
void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win)
// find the best size for the ticks
int labelSize[2];
- this->AllocateAndSizeLabels(labelSize, size, viewport,range);
+ this->AllocateAndSizeLabels(labelSize, size, viewport, range);
this->NumberOfLabelsBuilt = this->NumberOfLabels;
+ this->SizeBar(barWidth, barHeight, size, viewport, range);
+
// generate points
vtkFloatingPointType x[3]; x[2] = 0.0;
vtkFloatingPointType delta, val;
if ( this->Orientation == VTK_ORIENT_VERTICAL )
{
- barWidth = size[0] - 4 - labelSize[0];
- barHeight = (int)(0.86*size[1]);
delta=(vtkFloatingPointType)barHeight/numColors;
for (i=0; i<numPts/2; i++)
{
}
else
{
- barWidth = size[0];
- barHeight = (int)(0.4*size[1]);
delta=(vtkFloatingPointType)barWidth/numColors;
for (i=0; i<numPts/2; i++)
{
{
int targetWidth, targetHeight;
- if ( this->Orientation == VTK_ORIENT_VERTICAL )
- {
- targetWidth = (int)(0.6*size[0]);
- targetHeight = (int)(0.86*size[1]/this->NumberOfLabels);
- }
+ if(LabelRatioWidth == 0)
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ targetWidth = (int)(0.6*size[0]);
+ else
+ targetWidth = (int)(size[0]*0.8/this->NumberOfLabels);
else
- {
- targetWidth = (int)(size[0]*0.8/this->NumberOfLabels);
- targetHeight = (int)(0.25*size[1]);
- }
+ 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]);
+ else
+ targetHeight = (int)(0.01*LabelRatioHeight*size[1]);
vtkTextMapper::SetMultipleConstrainedFontSize(viewport,
targetWidth,
int targetWidth, targetHeight;
- targetWidth = size[0];
- if ( this->Orientation == VTK_ORIENT_VERTICAL )
- {
- targetHeight = (int)(0.1*size[1]);
- }
+ if(TitleRatioWidth == 0)
+ targetWidth = size[0];
else
- {
- targetHeight = (int)(0.25*size[1]);
- }
+ targetWidth = (int)(0.01*TitleRatioWidth*size[0]);
+
+ if(TitleRatioHeight == 0)
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ targetHeight = (int)(0.1*size[1]);
+ else
+ targetHeight = (int)(0.25*size[1]);
+ else
+ targetHeight = (int)(0.01*TitleRatioHeight*size[1]);
this->TitleMapper->SetConstrainedFontSize(
viewport, targetWidth, targetHeight);
this->TitleMapper->GetSize(viewport, titleSize);
}
+
+void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight,
+ int labelRatioWidth, int labelRatioHeight,
+ 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;
+
+ LabelRatioWidth=labelRatioWidth;
+ if(LabelRatioWidth>100)
+ LabelRatioWidth=100;
+ 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;
+ else if(BarRatioWidth<0)
+ BarRatioWidth=0;
+
+ BarRatioHeight=barRatioHeight;
+ if(BarRatioHeight>100)
+ BarRatioHeight=100;
+ else if(BarRatioHeight<0)
+ BarRatioHeight=0;
+}
+
+void VISU_ScalarBarActor::GetRatios(int& titleRatioWidth, int& titleRatioHeight,
+ int& labelRatioWidth, int& labelRatioHeight,
+ int& barRatioWidth, int& barRatioHeight)
+{
+ titleRatioWidth=TitleRatioWidth;
+ titleRatioHeight=TitleRatioHeight;
+ labelRatioWidth=LabelRatioWidth;
+ labelRatioHeight=LabelRatioHeight;
+ barRatioWidth=BarRatioWidth;
+ barRatioHeight=BarRatioHeight;
+}
+
+void VISU_ScalarBarActor::SizeBar(int& barSizeWidth, int& barSizeHeight, int *size,
+ vtkViewport *viewport, vtkFloatingPointType *range)
+{
+ if(BarRatioWidth == 0)
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ {
+ int labelSize[2];
+ this->AllocateAndSizeLabels(labelSize, size, viewport,range);
+ barSizeWidth = size[0] - 4 - labelSize[0];
+ } else
+ barSizeWidth = size[0];
+ else
+ barSizeWidth = (int)(0.01*BarRatioWidth*size[0]);
+
+ if(BarRatioHeight == 0)
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ barSizeHeight = (int)(0.86*size[1]);
+ else
+ barSizeHeight = (int)(0.4*size[1]);
+ else
+ barSizeHeight = (int)(0.01*BarRatioHeight*size[1]);
+}
virtual void SetLabelTextProperty(vtkTextProperty *p);
vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
+ // Description:
+ // Set/Get the scalar bar dimention properties in persents.
+ // 0 <= ration <= 100
+ void SetRatios(int titleRatioWidth, int titleRatioHeight,
+ int labelRatioWidth, int labelRatioHeight,
+ int barRatioWidth, int barRatioHeight);
+ void GetRatios(int& titleRatioWidth, int& titleRatioHeight,
+ int& labelRatioWidth, int& labelRatioHeight,
+ int& barRatioWidth, int& barRatioHeight);
+
// Description:
// Set/Get the format with which to print the labels on the scalar
// bar.
int Orientation;
char *Title;
char *LabelFormat;
+ int TitleRatioWidth;
+ int LabelRatioWidth;
+ int BarRatioWidth;
+ int TitleRatioHeight;
+ int LabelRatioHeight;
+ int BarRatioHeight;
vtkTextMapper **TextMappers;
virtual void AllocateAndSizeLabels(int *labelSize, int *size,
void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
+ void SizeBar(int& barSizeWidth, int& barSizeHeight, int *size,
+ vtkViewport *viewport, vtkFloatingPointType *range);
+
private:
VISU_ScalarBarActor(const VISU_ScalarBarActor&); // Not implemented.
void operator=(const VISU_ScalarBarActor&); // Not implemented.
// Module : VISU
#include "VISU_ScalarBarCtrl.hxx"
+#include <VISU_LookupTable.hxx>
+#include <VISU_ScalarBarActor.hxx>
#include <vtkObjectFactory.h>
#include <vtkActor2D.h>
#include <vtkCoordinate.h>
#include <vtkRenderer.h>
#include <vtkScalarsToColors.h>
-#include <vtkLookupTable.h>
#include <vtkTextProperty.h>
-#include <vtkScalarBarActor.h>
#include <vtkType.h>
#include <string.h>
{
inline
void
- MarkValueByColor(vtkLookupTable* theTable,
+ MarkValueByColor(VISU_LookupTable* theTable,
vtkFloatingPointType theValue,
unsigned char* theColor)
{
}
void
- FillByColor(vtkLookupTable* theTable,
+ FillByColor(VISU_LookupTable* theTable,
unsigned char* theColor)
{
vtkIdType aNbColors = theTable->GetNumberOfColors();
}
void
- MakeBiColor(vtkLookupTable* theTable)
+ MakeBiColor(VISU_LookupTable* theTable)
{
unsigned char aRedPtr[3] = {255, 0, 0};
unsigned char aBluePtr[3] = {0, 0, 255};
SetMode(eSimple);
// Initilize global scalar bar
- myGlobalLookupTable = vtkLookupTable::New();
+ myGlobalLookupTable = VISU_LookupTable::New();
myGlobalLookupTable->SetHueRange(0.667,0.0);
- myGlobalScalarBar = vtkScalarBarActor::New();
+ myGlobalScalarBar = VISU_ScalarBarActor::New();
myGlobalScalarBar->SetLookupTable(myGlobalLookupTable);
myGlobalLookupTable->Delete();
// Initilize local scalar bar
- myLocalLookupTable = vtkLookupTable::New();
+ myLocalLookupTable = VISU_LookupTable::New();
myLocalLookupTable->SetHueRange(0.667,0.0);
- myLocalScalarBar = vtkScalarBarActor::New();
+ myLocalScalarBar = VISU_ScalarBarActor::New();
myLocalScalarBar->SetLookupTable(myLocalLookupTable);
myLocalLookupTable->Delete();
//----------------------------------------------------------------------------
-vtkScalarBarActor*
+VISU_ScalarBarActor*
VISU_ScalarBarCtrl
::GetLocalBar()
{
return myLocalScalarBar;
}
-vtkScalarBarActor*
+VISU_ScalarBarActor*
VISU_ScalarBarCtrl
::GetGlobalBar()
{
//----------------------------------------------------------------------------
-vtkLookupTable*
+VISU_LookupTable*
VISU_ScalarBarCtrl
::GetLocalTable()
{
return myLocalLookupTable;
}
-vtkLookupTable*
+VISU_LookupTable*
VISU_ScalarBarCtrl
::GetGlobalTable()
{
//----------------------------------------------------------------------------
void
VISU_ScalarBarCtrl
-::PrepareTables(vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable *theLookupTable,
+::PrepareTables(VISU_ScalarBarActor* theScalarBarActor,
+ VISU_LookupTable *theLookupTable,
vtkIdType theId)
{
vtkCoordinate * aCoordinate = theScalarBarActor->GetPositionCoordinate();
#include "VTKViewer.h"
class vtkRenderer;
-class vtkLookupTable;
-class vtkScalarBarActor;
+class VISU_LookupTable;
+class VISU_ScalarBarActor;
class VISU_PIPELINE_EXPORT VISU_ScalarBarCtrl : public vtkObject
{
SetRangeLocal(vtkFloatingPointType *theRange);
// Selectors
- vtkScalarBarActor*
+ VISU_ScalarBarActor*
GetLocalBar();
- vtkLookupTable*
+ VISU_LookupTable*
GetLocalTable();
- vtkScalarBarActor*
+ VISU_ScalarBarActor*
GetGlobalBar();
- vtkLookupTable*
+ VISU_LookupTable*
GetGlobalTable();
//
// Renderer
PrepareTables();
void
- PrepareTables(vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable *theLookupTable,
+ PrepareTables(VISU_ScalarBarActor* theScalarBarActor,
+ VISU_LookupTable *theLookupTable,
vtkIdType theId);
protected:
bool myMarked;
vtkFloatingPointType myMarkedValue;
//
- vtkScalarBarActor *myGlobalScalarBar;
- vtkLookupTable *myGlobalLookupTable;
+ VISU_ScalarBarActor *myGlobalScalarBar;
+ VISU_LookupTable *myGlobalLookupTable;
- vtkScalarBarActor *myLocalScalarBar;
- vtkLookupTable *myLocalLookupTable;
+ VISU_ScalarBarActor *myLocalScalarBar;
+ VISU_LookupTable *myLocalLookupTable;
};
#endif
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
-"PO-Revision-Date: 2005-06-27 12:38+0400\n"
+"PO-Revision-Date: 2007-12-11 17:26+0300\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
msgid "VISU_NB_COLORS"
msgstr "Nb. of colors"
+msgid "VISU_IS_UNITS"
+msgstr "Display units in title"
+
msgid "VISU_NB_LABELS"
msgstr "Nb. of labels"
+msgid "VISU_LABELS_FORMAT"
+msgstr "Labels format"
+
msgid "VISU_ORIENTATION"
msgstr "Orientation"
msgid "VISU_HEIGHT"
msgstr "Height:"
+msgid "VISU_TITLE_WIDTH"
+msgstr "Title width (%):"
+
+msgid "VISU_TITLE_HEIGHT"
+msgstr "Title height (%):"
+
+msgid "VISU_LABEL_WIDTH"
+msgstr "Label width (%):"
+
+msgid "VISU_LABEL_HEIGHT"
+msgstr "Label height (%):"
+
+msgid "VISU_BAR_WIDTH"
+msgstr "Bar width (%):"
+
+msgid "VISU_BAR_HEIGHT"
+msgstr "Bar height (%):"
+
msgid "VISU_PREF_SECOND_TAB"
msgstr "Scalar range, Sweep, MED import, Shading"
msgid "VisuGUI_TextPrefDlg::LBL_LABELS"
msgstr "Labels"
+msgid "VisuGUI_BarPrefDlg::&OK"
+msgstr ""
+
+msgid "VisuGUI_BarPrefDlg::&Cancel"
+msgstr ""
+
+msgid "VisuGUI_BarPrefDlg::TIT_BAR_PREF"
+msgstr "Bar property"
+
+msgid "VisuGUI_BarPrefDlg::LBL_TITLE_W"
+msgstr "Title width (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_TITLE_H"
+msgstr "Title height (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_LABEL_W"
+msgstr "Label width (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_LABEL_H"
+msgstr "Label height (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_BAR_W"
+msgstr "Bar width (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_BAR_H"
+msgstr "Bar height (%)"
+
+msgid "VisuGUI_BarPrefDlg::LBL_SHOW_UNITS"
+msgstr "Display units"
+
+msgid "VisuGUI_BarPrefDlg::LBL_UNITS_FORMAT"
+msgstr "Format:"
+
+msgid "VisuGUI_BarPrefDlg::MSG_LABEL_FORMAT"
+msgstr "Labels format is invalid."
+
+msgid "VisuGUI_BarPrefDlg::AUTO"
+msgstr "auto"
+
#: VisuGUI_StreamLinesDlg.cxx
setPreferenceProperty( numcol, "min", 2 );
setPreferenceProperty( numcol, "max", 256 );
+ addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
+ LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
+
int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
setPreferenceProperty( numlab, "min", 2 );
setPreferenceProperty( numlab, "max", 65 );
+ addPreference( tr( "VISU_LABELS_FORMAT" ), colorsLabelsGr,
+ LightApp_Preferences::String, "VISU", "scalar_bar_label_format" );
+
// group: "Orientation"
int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
// group: "Origin & Size Vertical"
int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
+ setPreferenceProperty( posVSizeGr, "columns", 5 );
int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
- int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
- LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
+ int twv = addPreference( tr( "VISU_TITLE_WIDTH" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_width" );
+ int lwv = addPreference( tr( "VISU_LABEL_WIDTH" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_width" );
+ int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
+
+ int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
+ int thv = addPreference( tr( "VISU_TITLE_HEIGHT" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_height" );
+ int lhv = addPreference( tr( "VISU_LABEL_HEIGHT" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_height" );
+ int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
setPreferenceProperty( xv, "step", 0.1 );
setPreferenceProperty( yv, "step", 0.1 );
setPreferenceProperty( wv, "step", 0.1 );
setPreferenceProperty( yv, "min", 0.0 );
setPreferenceProperty( wv, "min", 0.0 );
setPreferenceProperty( hv, "min", 0.0 );
+ setPreferenceProperty( twv, "min", 0 );
+ setPreferenceProperty( twv, "special", "auto" );
+ setPreferenceProperty( thv, "min", 0 );
+ setPreferenceProperty( thv, "special", "auto" );
+ setPreferenceProperty( lwv, "min", 0 );
+ setPreferenceProperty( lwv, "special", "auto" );
+ setPreferenceProperty( lhv, "min", 0 );
+ setPreferenceProperty( lhv, "special", "auto" );
+ setPreferenceProperty( bwv, "min", 0 );
+ setPreferenceProperty( bwv, "special", "auto" );
+ setPreferenceProperty( bhv, "min", 0 );
+ setPreferenceProperty( bhv, "special", "auto" );
setPreferenceProperty( xv, "max", 1.0 );
setPreferenceProperty( yv, "max", 1.0 );
setPreferenceProperty( wv, "max", 1.0 );
setPreferenceProperty( hv, "max", 1.0 );
+ setPreferenceProperty( twv, "max", 100 );
+ setPreferenceProperty( thv, "max", 100 );
+ setPreferenceProperty( lwv, "max", 100 );
+ setPreferenceProperty( lhv, "max", 100 );
+ setPreferenceProperty( bwv, "max", 100 );
+ setPreferenceProperty( bhv, "max", 100 );
// group: "Origin & Size Horizontal"
int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
+ setPreferenceProperty( posHSizeGr, "columns", 5 );
int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
- int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
- LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
+ int twh = addPreference( tr( "Title width (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_width" );
+ int lwh = addPreference( tr( "Label width (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_width" );
+ int bwh = addPreference( tr( "Bar width (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
+
+ int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
+ int thh = addPreference( tr( "Title height (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_height" );
+ int lhh = addPreference( tr( "Label height (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_height" );
+ int bhh = addPreference( tr( "Bar height (%)" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
setPreferenceProperty( xh, "step", 0.1 );
setPreferenceProperty( yh, "step", 0.1 );
setPreferenceProperty( wh, "step", 0.1 );
setPreferenceProperty( yh, "min", 0.0 );
setPreferenceProperty( wh, "min", 0.0 );
setPreferenceProperty( hh, "min", 0.0 );
+ setPreferenceProperty( twh, "min", 0 );
+ setPreferenceProperty( twh, "special", "auto" );
+ setPreferenceProperty( thh, "min", 0 );
+ setPreferenceProperty( thh, "special", "auto" );
+ setPreferenceProperty( lwh, "min", 0 );
+ setPreferenceProperty( lwh, "special", "auto" );
+ setPreferenceProperty( lhh, "min", 0 );
+ setPreferenceProperty( lhh, "special", "auto" );
+ setPreferenceProperty( bwh, "min", 0 );
+ setPreferenceProperty( bwh, "special", "auto" );
+ setPreferenceProperty( bhh, "min", 0 );
+ setPreferenceProperty( bhh, "special", "auto" );
setPreferenceProperty( xh, "max", 1.0 );
setPreferenceProperty( yh, "max", 1.0 );
setPreferenceProperty( wh, "max", 1.0 );
setPreferenceProperty( hh, "max", 1.0 );
+ setPreferenceProperty( twh, "max", 100 );
+ setPreferenceProperty( thh, "max", 100 );
+ setPreferenceProperty( lwh, "max", 100 );
+ setPreferenceProperty( lhh, "max", 100 );
+ setPreferenceProperty( bwh, "max", 100 );
+ setPreferenceProperty( bhh, "max", 100 );
// group: "Scalar bars default position"
int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
}
+ } else if(b == QString("scalar_bar_labels_format")) {
+ QString dVal;
+ dVal.sprintf(aResourceMgr->stringValue("VISU", "scalar_bar_label_format",dVal), 1.1);
+ if(dVal.toDouble() == 0.) {
+ aWarning = "Label format is incorrect ";
+ aWarning += dVal.latin1();
+ aWarning += "\n";
+ dVal="%-#6.3g";
+ aResourceMgr->setValue("VISU", "scalar_bar_labels_format", dVal);
+ }
}
if (aWarning.size() != 0){
aWarning += "The default values are applied instead.";
{
myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80;
myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12;
+ myVerTW = myVerTH = myVerLW = myVerLH = myVerBW = myVerBH = 0;
+ myHorTW = myHorTH = myHorLW = myHorLH = myHorBW = myHorBH = 0;
Imin = 0.0; Imax = 0.0;
myRangeMode = -1;
QHBox* aSaveBox = new QHBox(this);
myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myBarBtn = new QPushButton("Bar properties...", aSaveBox);
myTextDlg = new VisuGUI_TextPrefDlg(this);
myTextDlg->setTitleVisible(true);
+ myBarDlg = new VisuGUI_BarPrefDlg(this);
// signals and slots connections ===========================================
connect( RBFieldRange, SIGNAL( clicked() ), this, SLOT( fieldRangeClicked() ) );
connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+ connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
changeDefaults( 0 );
myIsStoreTextProp = false;
thePrs->GetHeight(),
thePrs->GetBarOrientation());
+ if(RBvert->isChecked()) {
+ myVerTW = thePrs->GetTitleWidth();
+ myVerTH = thePrs->GetTitleHeight();
+ myVerLW = thePrs->GetLabelWidth();
+ myVerLH = thePrs->GetLabelHeight();
+ myVerBW = thePrs->GetBarWidth();
+ myVerBH = thePrs->GetBarHeight();
+ } else {
+ myHorTW = thePrs->GetTitleWidth();
+ myHorTH = thePrs->GetTitleHeight();
+ myHorLW = thePrs->GetLabelWidth();
+ myHorLH = thePrs->GetLabelHeight();
+ myHorBW = thePrs->GetBarWidth();
+ myHorBH = thePrs->GetBarHeight();
+ }
+
+ myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
+
SpacingSpin->setValue(thePrs->GetSpacing());
myRBLocal->setChecked( activeLocal );
vtkFloatingPointType R, G, B;
thePrs->GetTitleColor(&R, &G, &B);
+ myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
+
myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
thePrs->GetTitFontType(),
thePrs->IsBoldTitle(),
thePrs->SetNbColors(ColorSpin->value());
thePrs->SetLabels(LabelSpin->value());
+ if(RBvert->isChecked()) {
+ thePrs->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ } else {
+ thePrs->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+
+ thePrs->SetLabelsFormat(myBarDlg->getLabelsFormat());
+ thePrs->SetUnitsVisible(myBarDlg->isUnitsVisible());
+
if (myIsStoreTextProp) {
// "Title"
thePrs->SetTitle(myTextDlg->getTitleText().latin1());
myIsStoreTextProp = myTextDlg->exec();
}
+void VisuGUI_GaussScalarBarPane::onBarPref()
+{
+ if(RBvert->isChecked())
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ if(myBarDlg->exec()) {
+ if(RBvert->isChecked())
+ myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+}
/*!
* Constructor
QLabel* myModeLbl;
QComboBox* myModeCombo;
QPushButton* myTextBtn;
+ QPushButton* myBarBtn;
VisuGUI_TextPrefDlg* myTextDlg;
+ VisuGUI_BarPrefDlg* myBarDlg;
QRadioButton* myRBLocal;
QRadioButton* myRBGlobal;
QCheckBox* myCBDisplayed;
double Imin, Imax;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
+ int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
+ int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
int myRangeMode;
bool myIsStoreTextProp;
void changeDefaults( int );
void XYChanged( double );
void onTextPref();
+ void onBarPref();
};
//! Create Gauss Points Presentation Dialog.
}
}
+//-----------------------------------------------------------------------
+// Scalar Bar Preferences Dialog
+//-----------------------------------------------------------------------
+/*!
+ Constructor
+*/
+VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg (QWidget* parent)
+ : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ setName("VisuGUI_BarPrefDlg");
+ setCaption(tr("TIT_BAR_PREF"));
+ setSizeGripEnabled(TRUE);
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ QString propertyName;
+ propertyName = QString("scalar_bar_vertical_");
+
+ myTitleWidth = myTitleHeight = myLabelWidth = myLabelHeight = myBarWidth = myBarHeight = 0;
+ myUnits = true;
+ myUnitsFormat = "%-#6.3g";
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QGroupBox* WidthHeightGroup = new QGroupBox (tr(""), this, "WidthHeightGroup");
+ WidthHeightGroup->setColumnLayout(0, Qt::Vertical );
+ WidthHeightGroup->layout()->setSpacing( 0 );
+ WidthHeightGroup->layout()->setMargin( 0 );
+ QGridLayout* WidthHeightGroupLayout = new QGridLayout( WidthHeightGroup->layout() );
+ WidthHeightGroupLayout->setAlignment( Qt::AlignTop );
+ WidthHeightGroupLayout->setSpacing( 6 );
+ WidthHeightGroupLayout->setMargin( 11 );
+
+ QLabel* LabelTitleWidth = new QLabel (tr("LBL_TITLE_W"), WidthHeightGroup, "LabelTitleWidth");
+ TitleWidthSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ TitleWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ TitleWidthSpin->setMinimumWidth( 70 );
+ TitleWidthSpin->setValue( 0 );
+ TitleWidthSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelTitleWidth, 0, 0, 0, 0);
+ WidthHeightGroupLayout->addMultiCellWidget( TitleWidthSpin, 0, 0, 1, 1);
+
+ QLabel* LabelTitleHeight = new QLabel (tr("LBL_TITLE_H"), WidthHeightGroup, "LabelTitleHeight");
+ TitleHeightSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ TitleHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ TitleHeightSpin->setMinimumWidth( 70 );
+ TitleHeightSpin->setValue( 0 );
+ TitleHeightSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelTitleHeight, 0, 0, 2, 2);
+ WidthHeightGroupLayout->addMultiCellWidget( TitleHeightSpin, 0, 0, 3, 3);
+
+ CBUnits = new QCheckBox (tr("LBL_SHOW_UNITS"), WidthHeightGroup);
+ CBUnits->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ WidthHeightGroupLayout->addMultiCellWidget( CBUnits, 0, 0, 4, 5);
+
+ QLabel* LabelLabelWidth = new QLabel (tr("LBL_LABEL_W"), WidthHeightGroup, "LabelLabelWidth");
+ LabelWidthSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ LabelWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ LabelWidthSpin->setMinimumWidth( 70 );
+ LabelWidthSpin->setValue( 0 );
+ LabelWidthSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelLabelWidth, 1, 1, 0, 0);
+ WidthHeightGroupLayout->addMultiCellWidget( LabelWidthSpin, 1, 1, 1, 1);
+
+ QLabel* LabelLabelHeight = new QLabel (tr("LBL_LABEL_H"), WidthHeightGroup, "LabelLabelHeight");
+ LabelHeightSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ LabelHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ LabelHeightSpin->setMinimumWidth( 70 );
+ LabelHeightSpin->setValue( 0 );
+ LabelHeightSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelLabelHeight, 1, 1, 2, 2);
+ WidthHeightGroupLayout->addMultiCellWidget( LabelHeightSpin, 1, 1, 3, 3);
+
+ UnitsEdit = new QLineEdit(WidthHeightGroup , "UnirsEdit" );
+ UnitsEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ UnitsEdit->setMinimumWidth( 35 );
+ UnitsEdit->setText( myUnitsFormat );
+ QLabel* UnitsLabel = new QLabel (tr("LBL_UNITS_FORMAT"), WidthHeightGroup, "UnitsLabel");
+ UnitsLabel->setBuddy(UnitsEdit);
+ WidthHeightGroupLayout->addMultiCellWidget( UnitsLabel, 1, 1, 4, 4);
+ WidthHeightGroupLayout->addMultiCellWidget( UnitsEdit, 1, 1, 5, 5);
+
+ QLabel* LabelBarWidth = new QLabel (tr("LBL_BAR_W"), WidthHeightGroup, "LabelBarWidth");
+ BarWidthSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ BarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ BarWidthSpin->setMinimumWidth( 70 );
+ BarWidthSpin->setValue( 0 );
+ BarWidthSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelBarWidth, 2, 2, 0, 0);
+ WidthHeightGroupLayout->addMultiCellWidget( BarWidthSpin, 2, 2, 1, 1);
+
+ QLabel* LabelBarHeight = new QLabel (tr("LBL_BAR_H"), WidthHeightGroup, "LabelBarHeight");
+ BarHeightSpin = new QSpinBox( 0, 100, 1, WidthHeightGroup );
+ BarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ BarHeightSpin->setMinimumWidth( 70 );
+ BarHeightSpin->setValue( 0 );
+ BarHeightSpin->setSpecialValueText( tr("AUTO") );
+ WidthHeightGroupLayout->addMultiCellWidget( LabelBarHeight, 2, 2, 2, 2);
+ WidthHeightGroupLayout->addMultiCellWidget( BarHeightSpin, 2, 2, 3, 3);
+
+ TopLayout->addWidget( WidthHeightGroup );
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
+ buttonHelp->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+ connect(TitleWidthSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(TitleHeightSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(LabelWidthSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(LabelHeightSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(BarWidthSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(BarHeightSpin, SIGNAL(valueChanged( int )), this, SIGNAL(updatePreview()));
+ connect(CBUnits, SIGNAL( toggled( bool )), this, SIGNAL(updatePreview()));
+ connect(UnitsEdit, SIGNAL( lostFocus() ), this, SIGNAL(updatePreview()));
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_BarPrefDlg::setRatios(int titleRatioWidth, int titleRatioHeight,
+ int labelRatioWidth, int labelRatioHeight,
+ int barRatioWidth, int barRatioHeight)
+{
+ TitleWidthSpin->setValue( myTitleWidth=titleRatioWidth );
+ TitleHeightSpin->setValue( myTitleHeight=titleRatioHeight );
+ LabelWidthSpin->setValue( myLabelWidth=labelRatioWidth );
+ LabelHeightSpin->setValue( myLabelHeight=labelRatioHeight );
+ BarWidthSpin->setValue( myBarWidth=barRatioWidth );
+ BarHeightSpin->setValue( myBarHeight=barRatioHeight );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_BarPrefDlg::getRatios(int& titleRatioWidth, int& titleRatioHeight,
+ int& labelRatioWidth, int& labelRatioHeight,
+ int& barRatioWidth, int& barRatioHeight)
+{
+ titleRatioWidth=TitleWidthSpin->value();
+ titleRatioHeight=TitleHeightSpin->value();
+ labelRatioWidth=LabelWidthSpin->value();
+ labelRatioHeight=LabelHeightSpin->value();
+ barRatioWidth=BarWidthSpin->value();
+ barRatioHeight=BarHeightSpin->value();
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_BarPrefDlg::setLabelsFormat(QString format)
+{
+ UnitsEdit->setText(myUnitsFormat=format);
+}
+
+
+//----------------------------------------------------------------------------
+QString VisuGUI_BarPrefDlg::getLabelsFormat()
+{
+ return UnitsEdit->text();
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_BarPrefDlg::onHelp()
+{
+ QString aHelpFileName = "scalar_map_page.html";
+ LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+ app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+ }
+ else {
+ SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+ QObject::tr("BUT_OK"));
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_BarPrefDlg::setUnitsVisible(bool isVisible)
+{
+ CBUnits->setChecked(myUnits=isVisible);
+}
+
+
+//----------------------------------------------------------------------------
+bool VisuGUI_BarPrefDlg::isUnitsVisible()
+{
+ return CBUnits->isChecked();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+ Called when <Cancel> button is clicked, restore begin values
+*/
+void VisuGUI_BarPrefDlg::reject()
+{
+ TitleWidthSpin->setValue( myTitleWidth );
+ TitleHeightSpin->setValue( myTitleHeight );
+ LabelWidthSpin->setValue( myLabelWidth );
+ LabelHeightSpin->setValue( myLabelHeight );
+ BarWidthSpin->setValue( myBarWidth );
+ BarHeightSpin->setValue( myBarHeight );
+ CBUnits->setChecked(myUnits);
+ UnitsEdit->setText(myUnitsFormat);
+ QDialog::reject();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+ Called when <Ok> button is clicked, store begin values
+*/
+void VisuGUI_BarPrefDlg::accept()
+{
+ QString dVal;
+ dVal.sprintf(UnitsEdit->text(),1.1);
+ if(dVal.toDouble() == 0.) {
+ SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+ tr("MSG_LABEL_FORMAT"),
+ tr("BUT_OK"));
+ } else {
+ QDialog::accept();
+ }
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+ Provides help on F1 button click
+*/
+void VisuGUI_BarPrefDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Key_F1 )
+ {
+ e->accept();
+ onHelp();
+ }
+}
+
//-----------------------------------------------------------------------
// Scalar Bar Pane
//-----------------------------------------------------------------------
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
QString propertyName;
propertyName = QString("scalar_bar_vertical_");
- myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
- myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
- myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
- myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myVerTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
+ myVerTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
+ myVerLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
+ myVerLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
+ myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
propertyName = QString("scalar_bar_horizontal_");
- myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
- myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
- myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
- myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+ myHorTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
+ myHorTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
+ myHorLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
+ myHorLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
+ myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
setSpacing(6);
//setMargin(11);
// Save check box ===========================================================
QHBox* aSaveBox = new QHBox(this);
myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myBarBtn = new QPushButton("Bar properties...", aSaveBox);
myTextDlg = new VisuGUI_TextPrefDlg(this);
myTextDlg->setTitleVisible(TRUE);
+ myBarDlg = new VisuGUI_BarPrefDlg(this);
QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
CheckGroup->setColumnLayout(0, Qt::Vertical );
myPreviewCheck->setChecked(false);
CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
+ if(RBvert->isChecked()) {
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ } else {
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+
+ myBarDlg->setLabelsFormat(aResourceMgr->stringValue("VISU", propertyName + "label_format", "%-#6.3g"));
+ myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true));
+
// signals and slots connections ===========================================
connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+ connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
connect( HeightSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
connect( CBLog, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
+ connect( myBarDlg, SIGNAL( updatePreview() ), this, SLOT( updatePreview() ));
changeDefaults( 0 );
myIsStoreTextProp = false;
myBusy = false;
myScalarMap->GetHeight(),
myScalarMap->GetBarOrientation());
+ if(RBvert->isChecked()) {
+ myVerTW = myScalarMap->GetTitleWidth();
+ myVerTH = myScalarMap->GetTitleHeight();
+ myVerLW = myScalarMap->GetLabelWidth();
+ myVerLH = myScalarMap->GetLabelHeight();
+ myVerBW = myScalarMap->GetBarWidth();
+ myVerBH = myScalarMap->GetBarHeight();
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ } else {
+ myHorTW = myScalarMap->GetTitleWidth();
+ myHorTH = myScalarMap->GetTitleHeight();
+ myHorLW = myScalarMap->GetLabelWidth();
+ myHorLH = myScalarMap->GetLabelHeight();
+ myHorBW = myScalarMap->GetBarWidth();
+ myHorBH = myScalarMap->GetBarHeight();
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+
+ myBarDlg->setLabelsFormat(myScalarMap->GetLabelsFormat());
+ myBarDlg->setUnitsVisible(myScalarMap->IsUnitsVisible());
+
myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
myScalarMap->GetTitFontType(),
myScalarMap->IsBoldTitle(),
else
myScalarMapPL->SetScaling(VISU::LINEAR);
vtkFloatingPointType theRange[2];
- theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
- theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+ if(RBFrange->isChecked()) {
+ theRange[0] = myScalarMap->GetSourceMin();
+ theRange[1] = myScalarMap->GetSourceMax();
+ } else {
+ theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
+ theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+ }
myScalarMapPL->SetScalarRange(theRange);
myScalarMapPL->SetNbColors(sbCol);
aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
- if (myTextDlg->getTitleText().latin1() != "")
- aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
+ if (myTextDlg->getTitleText().latin1() != "") {
+ VISU::PValForTime aValForTime;
+ const VISU::PField& aField = myScalarMap->GetScalarField();
+ const VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_iterator anIter = aValField.find(myScalarMap->GetScalarTimeStampNumber());
+ if (anIter != aValField.end())
+ aValForTime = anIter->second;
+
+ if (aValForTime) {
+ std::strstream aStream;
+ const VISU::TTime& aTime = aValForTime->myTime;
+ aStream<< myTextDlg->getTitleText() <<" ";
+ if(myBarDlg->isUnitsVisible())
+ aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+ else {
+ QString aName;
+ aName.sprintf("%g", aTime.first);
+ aStream << aName << std::ends;
+ }
+ std::string aScalarBarTitle = aStream.str();
+ aScalarBarActor->SetTitle(aScalarBarTitle.c_str());
+ } else {
+ aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
+ }
+ }
else
aScalarBarActor->SetTitle(myTitle.c_str());
aScalarBarActor->SetOrientation(getOrientation());
(isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
(isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+ int VerTW, VerTH, VerLW, VerLH, VerBW, VerBH;
+ myBarDlg->getRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
+ aScalarBarActor->SetRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
+
+ aScalarBarActor->SetLabelFormat(myBarDlg->getLabelsFormat());
+
aScalarBarActor->Modified();
VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
myScalarMap->SetScalarMode(myModeCombo->currentItem());
myScalarMap->SetPosition(XSpin->value(), YSpin->value());
myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
+ if(RBvert->isChecked()) {
+ myScalarMap->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ } else {
+ myScalarMap->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ }
+
+ myScalarMap->SetLabelsFormat(myBarDlg->getLabelsFormat());
+ myScalarMap->SetUnitsVisible(myBarDlg->isUnitsVisible());
+
myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3d::VERTICAL : VISU::ColoredPrs3d::HORIZONTAL);
if(isLogarithmic())
myScalarMap->SetScaling(VISU::LOGARITHMIC);
}
+//----------------------------------------------------------------------------
+void VisuGUI_ScalarBarPane::onBarPref()
+{
+ if(RBvert->isChecked())
+ myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ if(myBarDlg->exec()) {
+ if(RBvert->isChecked())
+ myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ else
+ myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ updatePreview();
+ }
+}
+
+
//----------------------------------------------------------------------------
void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
{
};
+//----------------------------------------------------------------------------
+class VisuGUI_BarPrefDlg: public QDialog
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_BarPrefDlg (QWidget* parent);
+ ~VisuGUI_BarPrefDlg() {};
+
+ void setRatios(int titleRatioWidth, int titleRatioHeight,
+ int labelRatioWidth, int labelRatioHeight,
+ int barRatioWidth, int barRatioHeight);
+ void getRatios(int& titleRatioWidth, int& titleRatioHeight,
+ int& labelRatioWidth, int& labelRatioHeight,
+ int& barRatioWidth, int& barRatioHeight);
+
+ void setUnitsVisible(bool isVisible);
+ bool isUnitsVisible();
+
+ void setLabelsFormat(QString format);
+ QString getLabelsFormat();
+
+ private:
+ void keyPressEvent( QKeyEvent* e );
+
+ signals:
+ void updatePreview();
+
+ protected slots:
+ void accept();
+ void reject();
+ void onHelp();
+
+ protected:
+ QSpinBox* TitleWidthSpin;
+ QSpinBox* TitleHeightSpin;
+ QSpinBox* LabelWidthSpin;
+ QSpinBox* LabelHeightSpin;
+ QSpinBox* BarWidthSpin;
+ QSpinBox* BarHeightSpin;
+ QCheckBox* CBUnits;
+ QLineEdit* UnitsEdit;
+
+ int myTitleWidth;
+ int myTitleHeight;
+ int myLabelWidth;
+ int myLabelHeight;
+ int myBarWidth;
+ int myBarHeight;
+ bool myUnits;
+ QString myUnitsFormat;
+};
+
+
//----------------------------------------------------------------------------
class VisuGUI_ScalarBarPane : public QVBox
{
QLabel* myModeLbl;
QComboBox* myModeCombo;
QPushButton* myTextBtn;
+ QPushButton* myBarBtn;
VisuGUI_TextPrefDlg* myTextDlg;
+ VisuGUI_BarPrefDlg* myBarDlg;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
+ int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
+ int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
bool myIsStoreTextProp;
private slots:
void XYChanged( double );
void changeScalarMode( int );
void onTextPref();
+ void onBarPref();
void onPreviewCheck(bool thePreview);
void updatePreview();
SetScalarMode(anOrigin->GetScalarMode());
SetNbColors(anOrigin->GetNbColors());
+
+ SetUnitsVisible(anOrigin->IsUnitsVisible());
+ SetLabelsFormat(anOrigin->GetLabelsFormat());
+
SetBarOrientation(anOrigin->GetBarOrientation());
SetMinMaxController(anOrigin->GetMinMaxController());
SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
+ SetRatios(anOrigin->GetTitleWidth(), anOrigin->GetTitleHeight(),
+ anOrigin->GetLabelWidth(), anOrigin->GetLabelHeight(),
+ anOrigin->GetBarWidth(), anOrigin->GetBarHeight());
SetLabels(anOrigin->GetLabels());
SetTitle(anOrigin->GetTitle());
return myHeight;
}
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
+ if(anIsSameValue)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myTitleWidth = theTitleWidth;
+ myTitleHeight = theTitleHeight;
+ myLabelWidth = theLabelWidth;
+ myLabelHeight = theLabelHeight;
+ myBarWidth = theBarWidth;
+ myBarHeight = theBarHeight;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTitleWidth()
+{
+ return myTitleWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTitleHeight()
+{
+ return myTitleHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetLabelWidth()
+{
+ return myLabelWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetLabelHeight()
+{
+ return myLabelHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetBarWidth()
+{
+ return myBarWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetBarHeight()
+{
+ return myBarHeight;
+}
+
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
return myNumberOfLabels;
}
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetLabelsFormat(const char* theFormat)
+{
+ if( myLabelsFormat != theFormat ){
+ VISU::TSetModified aModified(this);
+ myLabelsFormat = theFormat;
+ myParamsTime.Modified();
+ }
+}
+
+
+//----------------------------------------------------------------------------
+char*
+VISU::ColoredPrs3d_i
+::GetLabelsFormat()
+{
+ return CORBA::string_dup(myLabelsFormat.c_str());
+}
+
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
if (aValForTime) {
std::strstream aStream;
const VISU::TTime& aTime = aValForTime->myTime;
- aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+ aStream<<theTitle<<" ";
+ if(IsUnitsVisible()) {
+ aStream << VISU_Convertor::GenerateName(aTime);
+ } else {
+ QString aName;
+ aName.sprintf("%g", aTime.first);
+ aStream << aName;
+ }
+ aStream <<std::ends;
std::string aScalarBarTitle = aStream.str();
if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
VISU::TSetModified aModified(this);
return CORBA::string_dup(myTitle.c_str());
}
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetUnitsVisible(CORBA::Boolean isVisible)
+{
+ if( myIsUnits != isVisible ){
+ VISU::TSetModified aModified(this);
+ myIsUnits = isVisible;
+ myParamsTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::IsUnitsVisible()
+{
+ return myIsUnits;
+}
+
//----------------------------------------------------------------------------
std::string
VISU::ColoredPrs3d_i
int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
SetNbColors(aNumberOfColors);
+ bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
+ SetUnitsVisible(isUnits);
+
+ QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
+ const char *lf=aLabelsFormat.latin1();
+ SetLabelsFormat(lf);
+
// Orientation
int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
if(anOrientation == 1)
myHeight = (myOrientation == VISU::ColoredPrs3d::VERTICAL)? 0.8:0.12;
myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
+ myTitleWidth = 0;
+ myTitleWidth = aResourceMgr->integerValue("VISU", propertyName + "title_width", myTitleWidth);
+
+ myTitleHeight = 0;
+ myTitleHeight = aResourceMgr->integerValue("VISU", propertyName + "title_height", myTitleHeight);
+
+ myLabelWidth = 0;
+ myLabelWidth = aResourceMgr->integerValue("VISU", propertyName + "label_width", myLabelWidth);
+
+ myLabelHeight = 0;
+ myLabelHeight = aResourceMgr->integerValue("VISU", propertyName + "label_height", myLabelHeight);
+
+ myBarWidth = 0;
+ myBarWidth = aResourceMgr->integerValue("VISU", propertyName + "bar_width", myBarWidth);
+
+ myBarHeight = 0;
+ myBarHeight = aResourceMgr->integerValue("VISU", propertyName + "bar_height", myBarHeight);
+
// scalar bar default position
bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
int aPlace = 1;
UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
+ SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
+ SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g"));
SetBarOrientation((VISU::ColoredPrs3d::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
SetTitle(VISU::Storable::FindValue(theMap,"myTitle").latin1());
myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+ myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt();
+ myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt();
+ myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt();
+ myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt();
+ myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
+ myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
Storable::DataToStream( theStr, "myOrientation", myOrientation );
Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
+ Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits );
Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+ Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() );
Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
Storable::DataToStream( theStr, "myWidth", myWidth );
Storable::DataToStream( theStr, "myHeight", myHeight );
+ Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth );
+ Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight );
+ Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth );
+ Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight );
+ Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
+ Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
void
SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
+ virtual
+ void
+ SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight);
+
virtual
CORBA::Double
GetWidth();
CORBA::Double
GetHeight();
+ virtual
+ CORBA::Long
+ GetTitleWidth();
+
+ virtual
+ CORBA::Long
+ GetTitleHeight();
+
+ virtual
+ CORBA::Long
+ GetLabelWidth();
+
+ virtual
+ CORBA::Long
+ GetLabelHeight();
+
+ virtual
+ CORBA::Long
+ GetBarWidth();
+
+ virtual
+ CORBA::Long
+ GetBarHeight();
+
virtual
void
SetLabels(CORBA::Long theNbLabels);
CORBA::Long
GetLabels();
+ virtual
+ void
+ SetLabelsFormat(const char* theFormat);
+
+ virtual
+ char*
+ GetLabelsFormat();
+
virtual
void
SetTitle(const char* theTitle);
std::string
GetCTitle();
+ virtual
+ void
+ SetUnitsVisible(CORBA::Boolean isVisible);
+
+ virtual
+ CORBA::Boolean
+ IsUnitsVisible();
+
//----------------------------------------------------------------------------
//! Gets memory size actually used by the presentation (Mb).
virtual
std::string myTitle;
std::string myScalarBarTitle;
+ bool myIsUnits;
int myNumberOfLabels;
+ std::string myLabelsFormat;
VISU::ColoredPrs3d::Orientation myOrientation;
- vtkFloatingPointType myPosition[2], myWidth, myHeight;
+ vtkFloatingPointType myPosition[2],
+ myWidth, myHeight,
+ myTitleWidth, myTitleHeight,
+ myLabelWidth, myLabelHeight,
+ myBarWidth, myBarHeight;
//Font management
bool myIsBoldTitle;
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_ScalarBarCtrl.hxx"
+#include <VISU_ScalarBarActor.hxx>
#include "VISU_LookupTable.hxx"
#include "VISU_Convertor.hxx"
#include <vtkImageData.h>
#include <vtkXMLImageDataReader.h>
-#include <vtkScalarBarActor.h>
#include <vtkTextProperty.h>
#include <vtkProperty.h>
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::UpdateScalarBar(vtkScalarBarActor *theScalarBar,
- vtkLookupTable* theLookupTable)
+::UpdateScalarBar(VISU_ScalarBarActor *theScalarBar,
+ VISU_LookupTable* theLookupTable)
{
theScalarBar->SetTitle(GetScalarBarTitle().c_str());
theScalarBar->SetOrientation(GetBarOrientation());
theScalarBar->SetNumberOfLabels(GetLabels());
+ theScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(),
+ GetLabelWidth(), GetLabelHeight(),
+ GetBarWidth(), GetBarHeight());
+ theScalarBar->SetLabelFormat(GetLabelsFormat());
- vtkLookupTable* aLookupTable = GetSpecificPL()->GetBarTable();
+ VISU_LookupTable* aLookupTable = GetSpecificPL()->GetBarTable();
theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors());
theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors());
#include "VISU_ColoredPrs3d_i.hh"
#include "VISU_GaussPtsActorFactory.h"
-class vtkLookupTable;
-class vtkScalarBarActor;
+class VISU_LookupTable;
+class VISU_ScalarBarActor;
class VISU_GaussPointsPL;
OnCreateActor2();
void
- UpdateScalarBar(vtkScalarBarActor *theScalarBar,
- vtkLookupTable* theLookupTable);
+ UpdateScalarBar(VISU_ScalarBarActor *theScalarBar,
+ VISU_LookupTable* theLookupTable);
protected:
VISU_GaussPointsPL *myGaussPointsPL;
aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
aScalarBar->SetWidth(GetWidth());
aScalarBar->SetHeight(GetHeight());
+ aScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(),
+ GetLabelWidth(), GetLabelHeight(),
+ GetBarWidth(), GetBarHeight());
aScalarBar->SetNumberOfLabels(GetLabels());
+ aScalarBar->SetLabelFormat(GetLabelsFormat());
vtkFloatingPointType anRGB[3];