The properties of scalar bar actor now are read from resource manager under correct names

This commit is contained in:
asl 2005-07-21 12:26:13 +00:00
parent d9cc1f52dd
commit 59f97a60c5

View File

@ -282,106 +282,110 @@ SMESH_ActorDef::SMESH_ActorDef()
if( !mgr )
return;
QColor aTColor = mgr->colorValue( "SMESH", "ScalarBarTitleColor", QColor( 255, 255, 255 ) );
QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
aScalarBarTitleProp->SetFontFamilyToArial();
if ( mgr->hasValue( "SMESH", "ScalarBarTitleFont" ) )
if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
{
QString str = mgr->stringValue( "SMESH", "ScalarBarTitleFont" );
if ( str == "Arial" )
QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
if ( f.family() == "Arial" )
aScalarBarTitleProp->SetFontFamilyToArial();
else if ( str == "Courier" )
else if ( f.family() == "Courier" )
aScalarBarTitleProp->SetFontFamilyToCourier();
else if ( str == "Times" )
else if ( f.family() == "Times" )
aScalarBarTitleProp->SetFontFamilyToTimes();
if ( f.bold() )
aScalarBarTitleProp->BoldOn();
else
aScalarBarTitleProp->BoldOff();
if ( f.italic() )
aScalarBarTitleProp->ItalicOn();
else
aScalarBarTitleProp->ItalicOff();
if ( f.underline() )
aScalarBarTitleProp->ShadowOn();
else
aScalarBarTitleProp->ShadowOff();
}
if ( mgr->booleanValue( "SMESH", "ScalarBarTitleBold" ) )
aScalarBarTitleProp->BoldOn();
else
aScalarBarTitleProp->BoldOff();
if ( mgr->booleanValue( "SMESH", "ScalarBarTitleItalic" ) )
aScalarBarTitleProp->ItalicOn();
else
aScalarBarTitleProp->ItalicOff();
if ( mgr->booleanValue( "SMESH", "ScalarBarTitleShadow" ) )
aScalarBarTitleProp->ShadowOn();
else
aScalarBarTitleProp->ShadowOff();
myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
aScalarBarTitleProp->Delete();
vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
aTColor = mgr->colorValue( "SMESH", "ScalarBarLabelColor", QColor( 255, 255, 255 ) );
aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
aScalarBarLabelProp->SetFontFamilyToArial();
if( mgr->hasValue( "SMESH", "ScalarBarLabelFont" ) )
if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
{
QString str = mgr->stringValue( "SMESH", "ScalarBarLabelFont" );
if( str == "Arial" )
QFont f = mgr->stringValue( "SMESH", "scalar_bar_label_font" );
if( f.family() == "Arial" )
aScalarBarLabelProp->SetFontFamilyToArial();
else if( str == "Courier" )
else if( f.family() == "Courier" )
aScalarBarLabelProp->SetFontFamilyToCourier();
else if( str == "Times" )
else if( f.family() == "Times" )
aScalarBarLabelProp->SetFontFamilyToTimes();
if ( f.bold() )
aScalarBarLabelProp->BoldOn();
else
aScalarBarLabelProp->BoldOff();
if ( f.italic() )
aScalarBarLabelProp->ItalicOn();
else
aScalarBarLabelProp->ItalicOff();
if( f.underline() )
aScalarBarLabelProp->ShadowOn();
else
aScalarBarLabelProp->ShadowOff();
}
if ( mgr->booleanValue( "SMESH", "ScalarBarLabelBold" ) )
aScalarBarLabelProp->BoldOn();
else
aScalarBarLabelProp->BoldOff();
if ( mgr->booleanValue( "SMESH", "ScalarBarLabelItalic" ) )
aScalarBarLabelProp->ItalicOn();
else
aScalarBarLabelProp->ItalicOff();
if( mgr->booleanValue( "SMESH", "ScalarBarLabelShadow" ) )
aScalarBarLabelProp->ShadowOn();
else
aScalarBarLabelProp->ShadowOff();
myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
aScalarBarLabelProp->Delete();
if( mgr->stringValue( "SMESH", "ScalarBarOrientation" ) == "Horizontal" )
bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
if( horiz )
myScalarBarActor->SetOrientationToHorizontal();
else
myScalarBarActor->SetOrientationToVertical();
float aXVal = mgr->stringValue( "SMESH", "ScalarBarOrientation" ) == "Horizontal" ? 0.20 : 0.01;
if( mgr->hasValue( "SMESH", "ScalarBarXPosition" ) )
aXVal = mgr->doubleValue( "SMESH", "ScalarBarXPosition", aXVal );
float aYVal = mgr->stringValue( "SMESH", "ScalarBarOrientation" ) == "Horizontal" ? 0.01 : 0.1;
if( mgr->hasValue( "SMESH", "ScalarBarYPosition" ) )
aYVal = mgr->doubleValue( "SMESH", "ScalarBarYPosition", aYVal );
float aXVal = horiz ? 0.20 : 0.01;
if( mgr->hasValue( "SMESH", name + "x" ) )
aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
float aYVal = horiz ? 0.01 : 0.1;
if( mgr->hasValue( "SMESH", name + "y" ) )
aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
myScalarBarActor->SetPosition( aXVal, aYVal );
float aWVal = mgr->stringValue( "SMESH", "ScalarBarOrientation" ) == "Horizontal" ? 0.60 : 0.10;
if( mgr->hasValue( "SMESH", "ScalarBarWidth" ) )
aWVal = mgr->doubleValue( "SMESH", "ScalarBarWidth", aWVal );
float aWVal = horiz ? 0.60 : 0.10;
if( mgr->hasValue( "SMESH", name + "width" ) )
aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
myScalarBarActor->SetWidth( aWVal );
float aHVal = mgr->stringValue( "SMESH", "ScalarBarOrientation" ) == "Horizontal" ? 0.12 : 0.80;
if( mgr->hasValue( "SMESH", "ScalarBarHeight" ) )
aHVal = mgr->doubleValue( "SMESH", "ScalarBarHeight", aHVal );
float aHVal = horiz ? 0.12 : 0.80;
if( mgr->hasValue( "SMESH", name + "height" ) )
aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
myScalarBarActor->SetHeight( aHVal );
int anIntVal = 5;
if( mgr->hasValue( "SMESH", "ScalarBarNbOfLabels" ) )
anIntVal = mgr->integerValue( "SMESH", "ScalarBarNbOfLabels", anIntVal );
if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
anIntVal = 64;
if( mgr->hasValue( "SMESH", "ScalarBarNbOfColors" ) )
anIntVal = mgr->integerValue( "SMESH", "ScalarBarNbOfColors", anIntVal );
if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );