- if ( mySelection ) {
- // Scalar Bar properties
- if ( !myActor )
- return false;
- vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
-
- vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
- QColor aTColor = myTitleColorBtn->paletteBackgroundColor();
- aTitleTextPrp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
- if ( myTitleFontCombo->currentItem() == 0 )
- aTitleTextPrp->SetFontFamilyToArial();
- else if ( myTitleFontCombo->currentItem() == 1 )
- aTitleTextPrp->SetFontFamilyToCourier();
- else
- aTitleTextPrp->SetFontFamilyToTimes();
- aTitleTextPrp->SetBold( myTitleBoldCheck->isChecked() );
- aTitleTextPrp->SetItalic( myTitleItalicCheck->isChecked() );
- aTitleTextPrp->SetShadow( myTitleShadowCheck->isChecked() );
- myScalarBarActor->SetTitleTextProperty( aTitleTextPrp );
-
- vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
- QColor aLColor = myLabelsColorBtn->paletteBackgroundColor();
- aLabelsTextPrp->SetColor( aLColor.red()/255., aLColor.green()/255., aLColor.blue()/255. );
- if ( myLabelsFontCombo->currentItem() == 0 )
- aLabelsTextPrp->SetFontFamilyToArial();
- else if ( myLabelsFontCombo->currentItem() == 1 )
- aLabelsTextPrp->SetFontFamilyToCourier();
- else
- aLabelsTextPrp->SetFontFamilyToTimes();
- aLabelsTextPrp->SetBold( myLabelsBoldCheck->isChecked() );
- aLabelsTextPrp->SetItalic( myLabelsItalicCheck->isChecked() );
- aLabelsTextPrp->SetShadow( myLabelsShadowCheck->isChecked() );
- myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp );
-
- myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() );
- myScalarBarActor->SetMaximumNumberOfColors( myColorsSpin->value() );
-
- if ( myHorizRadioBtn->isChecked() )
- myScalarBarActor->SetOrientationToHorizontal();
- else
- myScalarBarActor->SetOrientationToVertical();
-
- myScalarBarActor->SetPosition( myXSpin->value(), myYSpin->value() );
- myScalarBarActor->SetWidth( myWidthSpin->value() );
- myScalarBarActor->SetHeight( myHeightSpin->value() );
-
- double aMin = myMinEdit->text().toDouble();
- double aMax = myMaxEdit->text().toDouble();
- myScalarBarActor->GetLookupTable()->SetRange( aMin, aMax );
- SMESHGUI::GetSMESHGUI()->UpdateView();
- }
- else {
- // Scalar Bar preferences
- QColor titleColor = myTitleColorBtn->paletteBackgroundColor();
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleColor", QString().sprintf( "%d:%d:%d", titleColor.red(), titleColor.green(), titleColor.blue() ) );
- if ( myTitleFontCombo->currentItem() == 0 )
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Arial" );
- else if ( myTitleFontCombo->currentItem() == 1 )
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Courier" );
- else
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Times" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleBold", myTitleBoldCheck->isChecked() ? "true" : "false" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleItalic", myTitleItalicCheck->isChecked() ? "true" : "false" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleShadow", myTitleShadowCheck->isChecked() ? "true" : "false" );
-
- QColor labelColor = myLabelsColorBtn->paletteBackgroundColor();
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelColor", QString().sprintf( "%d:%d:%d", labelColor.red(), labelColor.green(),labelColor. blue() ) );
- if ( myLabelsFontCombo->currentItem() == 0 )
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Arial" );
- else if ( myLabelsFontCombo->currentItem() == 1 )
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Courier" );
- else
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Times" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelBold", myLabelsBoldCheck->isChecked() ? "true" : "false" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelItalic", myLabelsItalicCheck->isChecked() ? "true" : "false" );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelShadow", myLabelsShadowCheck->isChecked() ? "true" : "false" );
-
- QAD_CONFIG->addSetting( "SMESH:ScalarBarNbOfColors", myColorsSpin->value() );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarNbOfLabels", myLabelsSpin->value() );
-
- QAD_CONFIG->addSetting( "SMESH:ScalarBarOrientation", myHorizRadioBtn->isChecked() ? "Horizontal" : "Vertical" );
-
- QAD_CONFIG->addSetting( "SMESH:ScalarBarXPosition", myXSpin->value() );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarYPosition", myYSpin->value() );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarWidth", myWidthSpin->value() );
- QAD_CONFIG->addSetting( "SMESH:ScalarBarHeight", myHeightSpin->value() );
+ // Scalar Bar properties
+ if (!myActor)
+ return false;
+ SMESH_ScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
+
+ vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
+ QColor aTColor = myTitleColorBtn->color();
+ aTitleTextPrp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
+ if ( myTitleFontCombo->currentIndex() == 0 )
+ aTitleTextPrp->SetFontFamilyToArial();
+ else if ( myTitleFontCombo->currentIndex() == 1 )
+ aTitleTextPrp->SetFontFamilyToCourier();
+ else
+ aTitleTextPrp->SetFontFamilyToTimes();
+ aTitleTextPrp->SetBold( myTitleBoldCheck->isChecked() );
+ aTitleTextPrp->SetItalic( myTitleItalicCheck->isChecked() );
+ aTitleTextPrp->SetShadow( myTitleShadowCheck->isChecked() );
+ myScalarBarActor->SetTitleTextProperty( aTitleTextPrp );
+
+ vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
+ QColor aLColor = myLabelsColorBtn->color();
+ aLabelsTextPrp->SetColor( aLColor.red()/255., aLColor.green()/255., aLColor.blue()/255. );
+ if ( myLabelsFontCombo->currentIndex() == 0 )
+ aLabelsTextPrp->SetFontFamilyToArial();
+ else if ( myLabelsFontCombo->currentIndex() == 1 )
+ aLabelsTextPrp->SetFontFamilyToCourier();
+ else
+ aLabelsTextPrp->SetFontFamilyToTimes();
+ aLabelsTextPrp->SetBold( myLabelsBoldCheck->isChecked() );
+ aLabelsTextPrp->SetItalic( myLabelsItalicCheck->isChecked() );
+ aLabelsTextPrp->SetShadow( myLabelsShadowCheck->isChecked() );
+ myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp );
+
+ myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() );
+
+ if ( myHorizRadioBtn->isChecked() )
+ myScalarBarActor->SetOrientationToHorizontal();
+ else
+ myScalarBarActor->SetOrientationToVertical();
+
+ myScalarBarActor->SetPosition( myXSpin->value(), myYSpin->value() );
+ myScalarBarActor->SetWidth( myWidthSpin->value() );
+ myScalarBarActor->SetHeight( myHeightSpin->value() );
+
+ // Distribution
+ bool distributionTypeChanged = false, colorChanged=false;
+ myScalarBarActor->SetDistributionVisibility((int)myDistributionGrp->isChecked());
+ if( myDistributionGrp->isChecked() ) {
+ int ColoringType = myDMultiColor->isChecked() ? SMESH_MULTICOLOR_TYPE : SMESH_MONOCOLOR_TYPE;
+ distributionTypeChanged = (ColoringType != myScalarBarActor->GetDistributionColoringType());
+ if (distributionTypeChanged)
+ myScalarBarActor->SetDistributionColoringType(ColoringType);
+
+ if( !myDMultiColor->isChecked() ) {
+ QColor aTColor = myMonoColorBtn->color();
+ double rgb[3], oldRgb[3];;
+ rgb [0] = aTColor.red()/255.;
+ rgb [1] = aTColor.green()/255.;
+ rgb [2] = aTColor.blue()/255.;
+ myScalarBarActor->GetDistributionColor(oldRgb);
+ colorChanged = (rgb[0] != oldRgb[0] || rgb[1] != oldRgb[1] || rgb[2] != oldRgb[2]);
+ if(colorChanged)
+ myScalarBarActor->SetDistributionColor(rgb);
+ }