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