#include "VISU_GaussPoints_i.hh"
#include "VISU_GaussPointsPL.hxx"
-#include "VISU_ScalarMapPL.hxx"
#include "VISU_Convertor.hxx"
#include "SalomeApp_Application.h"
BarTypeGroup->layout()->setMargin( 0 );
myRBLocal = new QRadioButton( tr( "LOCAL" ), BarTypeGroup );
- myRBLocal->setChecked( true );
- QRadioButton* GlobalButton = new QRadioButton( tr( "GLOBAL" ), BarTypeGroup );
+ myRBGlobal = new QRadioButton( tr( "GLOBAL" ), BarTypeGroup );
myCBDisplayed = new QCheckBox( tr( "DISPLAYED" ), ActiveBarGroup );
- myCBDisplayed->setChecked( true );
- myCBDisplayed->setEnabled( false );
+ //myCBDisplayed->setChecked( true );
+ //myCBDisplayed->setEnabled( false );
ActiveBarGroupLayout->addMultiCellWidget( BarTypeGroup, 0, 1, 0, 0);
ActiveBarGroupLayout->addWidget( myCBDisplayed, 1, 1);
myTextDlg->setTitleVisible(!SetPref);
// signals and slots connections ===========================================
- connect( GlobalButton, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
+ connect( myRBGlobal, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorLabel, SLOT( setEnabled( bool ) ) );
connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorSpin, SLOT( setEnabled( bool ) ) );
connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelLabel, SLOT( setEnabled( bool ) ) );
myIsStoreTextProp = false;
}
-
-/**
- * Initializes dialog box values from resources
- */
-void VisuGUI_GaussScalarBarPane::initFromResources() {
- int sbCol=64,sbLab=5,orient=0;
- float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
- float sbVmin=0., sbVmax=0.;
- QString aString;
-
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
- int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
- myModeCombo->setCurrentItem(aScalarMode);
-
- orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
- if(orient != 0){
- orient=1;
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
-
- QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
- sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
- sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
-
- sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
- sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
-
- sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
- sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
-
- int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-
- if((sbX1 < 0.) || (sbY1 < 0.) ||
- ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 0) {
- sbX1=0.01;
- sbY1=0.1;
- sbW=0.1;
- sbH=0.8;
- } else {
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
- }
- if(sbCol < 2) sbCol=2;
- if(sbCol > 64) sbCol=64;
- if(sbLab < 2) sbLab=2;
- if(sbLab > 65) sbLab=65;
-
- if(sbVmin > sbVmax) {
- sbVmin=0.;
- sbVmax=0.;
- }
-
- setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
- setScalarBarData( sbCol, sbLab );
-
- // "Title"
- bool isBold = false, isItalic = false, isShadow = false;
- int aFontFamily = VTK_ARIAL;
-
- if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
- {
- QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
-
- if ( f.family() == "Arial" )
- aFontFamily = VTK_ARIAL;
- else if ( f.family() == "Courier" )
- aFontFamily = VTK_COURIER;
- else if ( f.family() == "Times" )
- aFontFamily = VTK_TIMES;
-
- isBold = f.bold();
- isItalic = f.italic();
- isShadow = f.underline();
- }
-
- QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
-
- myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-
- // "Labels"
- isBold = isItalic = isShadow = false;
- aFontFamily = VTK_ARIAL;
-
- if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
- {
- QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
-
- if ( f.family() == "Arial" )
- aFontFamily = VTK_ARIAL;
- else if ( f.family() == "Courier" )
- aFontFamily = VTK_COURIER;
- else if ( f.family() == "Times" )
- aFontFamily = VTK_TIMES;
-
- isBold = f.bold();
- isItalic = f.italic();
- isShadow = f.underline();
- }
-
- aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
-
- myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-}
-
-/**
- * Stores dialog values to resources
- */
-void VisuGUI_GaussScalarBarPane::storeToResources() {
- int orient = (RBvert->isChecked())? 0 : 1;
- float sbX1 = XSpin->value();
- float sbY1 = YSpin->value();
- float sbW = WidthSpin->value();
- float sbH = HeightSpin->value();
- int sbCol = ColorSpin->value();
- int sbLab = LabelSpin->value();
-
- if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 0) {
- sbX1=0.01;
- sbY1=0.1;
- sbW=0.17;
- sbH=0.8;
- } else {
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
- }
-
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
- aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
-
- QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
- aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
- aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
- aResourceMgr->setValue("VISU", propertyName + "width", sbW);
- aResourceMgr->setValue("VISU", propertyName + "height", sbH);
-
- aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
- aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
-
- aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-
- ////
-
- if (myIsStoreTextProp) {
- // "Title"
- QColor aTitleColor (255, 255, 255);
- int aTitleFontFamily = VTK_ARIAL;
- bool isTitleBold = false;
- bool isTitleItalic = false;
- bool isTitleShadow = false;
-
- myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
- isTitleBold, isTitleItalic, isTitleShadow);
-
- QFont aTitleFont;
-
- aTitleFont.setBold(isTitleBold);
- aTitleFont.setItalic(isTitleItalic);
- aTitleFont.setUnderline(isTitleShadow);
-
- QString titleFontFamily;
- switch (aTitleFontFamily) {
- case VTK_ARIAL:
- titleFontFamily = "Arial";
- break;
- case VTK_COURIER:
- titleFontFamily = "Courier";
- break;
- case VTK_TIMES:
- titleFontFamily = "Times";
- break;
- }
- aTitleFont.setFamily(titleFontFamily);
-
- aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-
- aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-
- // "Label"
- QColor aLabelColor (255, 255, 255);
- int aLabelFontFamily = VTK_ARIAL;
- bool isLabelBold = false;
- bool isLabelItalic = false;
- bool isLabelShadow = false;
-
- myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
- isLabelBold, isLabelItalic, isLabelShadow);
-
-
- QFont aLabelFont;
-
- aLabelFont.setBold(isLabelBold);
- aLabelFont.setItalic(isLabelItalic);
- aLabelFont.setUnderline(isLabelShadow);
-
- QString labelFontFamily;
- switch (aLabelFontFamily) {
- case VTK_ARIAL:
- labelFontFamily = "Arial";
- break;
- case VTK_COURIER:
- labelFontFamily = "Courier";
- break;
- case VTK_TIMES:
- labelFontFamily = "Times";
- break;
- }
-
- aLabelFont.setFamily(labelFontFamily);
-
- aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
-
- aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
- }
-}
-
/**
* Initialise dialog box from presentation object
*/
void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) {
- initFromResources();
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->GetHeight(),
thePrs->GetScalarBarOrientation());
+ SpacingSpin->setValue(thePrs->GetSpacing());
+
+ bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
+ myRBLocal->setChecked( activeLocal );
+ myRBGlobal->setChecked( !activeLocal );
+ myCBDisplayed->setEnabled( !activeLocal );
+ myCBDisplayed->setChecked( thePrs->GetIsDispGlobalScalarBar() );
+
bool bicolor = thePrs->GetGaussPointsPL()->GetBicolor();
BicolorButton->setChecked( bicolor );
RainbowButton->setChecked( !bicolor );
thePrs->SetScalarMode(myModeCombo->currentItem());
thePrs->SetPosition(XSpin->value(), YSpin->value());
thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
+ thePrs->SetSpacing(SpacingSpin->value());
thePrs->SetScalarBarOrientation((RBvert->isChecked())? VISU::ColoredPrd3d::VERTICAL : VISU::ColoredPrd3d::HORIZONTAL);
thePrs->SetIsActiveLocalScalarBar(myRBLocal->isChecked());
thePrs->SetIsDispGlobalScalarBar(myCBDisplayed->isChecked());
thePrs->GetGaussPointsPL()->SetBicolor(BicolorButton->isChecked());
- if (isToSave()) storeToResources();
+ //if (isToSave()) storeToResources();
if (myIsStoreTextProp) {
// "Title"
// Color
- QGroupBox* ColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), aBox, "ColorGroup" );
- ColorGroup->setColumnLayout(0, Qt::Vertical );
- ColorGroup->layout()->setSpacing( 0 );
- ColorGroup->layout()->setMargin( 0 );
+ myColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), aBox, "ColorGroup" );
+ myColorGroup->setColumnLayout(0, Qt::Vertical );
+ myColorGroup->layout()->setSpacing( 0 );
+ myColorGroup->layout()->setMargin( 0 );
- QGridLayout* ColorGroupLayout = new QGridLayout (ColorGroup->layout());
+ QGridLayout* ColorGroupLayout = new QGridLayout (myColorGroup->layout());
ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
ColorGroupLayout->setSpacing(6);
ColorGroupLayout->setMargin(11);
- myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup );
- myColorButton = new QPushButton( ColorGroup );
+ QLabel* ColorLabel = new QLabel( tr( "COLOR" ), myColorGroup );
+ myColorButton = new QPushButton( myColorGroup );
- ColorGroupLayout->addWidget( myColorLabel, 0, 0 );
+ ColorGroupLayout->addWidget( ColorLabel, 0, 0 );
ColorGroupLayout->addWidget( myColorButton, 0, 1 );
connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
- connect( myGeometryButton, SIGNAL( toggled( bool ) ), ColorGroup, SLOT( setEnabled( bool ) ) );
+ connect( myGeometryButton, SIGNAL( toggled( bool ) ), myColorGroup, SLOT( setEnabled( bool ) ) );
connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeLabel, SLOT( setEnabled( bool ) ) );
connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeSpinBox, SLOT( setEnabled( bool ) ) );
connect( myResultsButton, SIGNAL( toggled( bool ) ), myMinSizeLabel, SLOT( setEnabled( bool ) ) );
myResultsButton->setChecked( isResults );
myGeometryButton->setChecked( !isResults );
- myColorLabel->setEnabled( !isResults );
- myColorButton->setEnabled( !isResults );
+ myColorGroup->setEnabled( !isResults );
mySizeLabel->setEnabled( !isResults );
mySizeSpinBox->setEnabled( !isResults );
myMinSizeLabel->setEnabled( isResults );
bool isResults = myResultsButton->isChecked();
if( isResults )
{
+ thePrs->SetIsColored( true );
thePrs->SetMinSize( myMinSizeSpinBox->value() );
thePrs->SetMaxSize( myMaxSizeSpinBox->value() );
}
else
{
- thePrs->SetConstSize( mySizeSpinBox->value() );
+ thePrs->SetIsColored( false );
thePrs->SetColor( myColorButton->paletteBackgroundColor() );
+ thePrs->SetConstSize( mySizeSpinBox->value() );
}
- thePrs->SetIsColored( isResults );
thePrs->SetMagnification( myMagnificationSpinBox->value() );
thePrs->SetMagnificationIncrement( myIncrementSpinBox->value() );
VisuGUI::createPreferences();
createGaussPointsPreferences();
+ createScalarBarPreferences();
+ createOutsideCursorPreferences();
createSpaceMousePreferences();
}
VisuGUI_Module
::createGaussPointsPreferences()
{
- int resultsTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
- int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), resultsTab );
+ int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
+ int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
setPreferenceProperty( primitiveGr, "columns", 1 );
int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
- int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), resultsTab );
+ int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
setPreferenceProperty( sizeGr, "columns", 2 );
int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_increment" );
setPreferenceProperty( incrementPref, "min", 1 );
setPreferenceProperty( incrementPref, "max", 100 );
+
+ int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
+ setPreferenceProperty( geomGr, "columns", 1 );
+
+ int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
+ SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
+ setPreferenceProperty( sizePref, "min", 1 );
+ setPreferenceProperty( sizePref, "max", 100 );
+
+ int colorPref = addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
+ SalomeApp_Preferences::Color, "VISU", "point_sprite_color" );
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::createScalarBarPreferences()
+{
+ int scalarBarTab = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL" ) );
+ int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), scalarBarTab );
+ setPreferenceProperty( scalarBarGr, "columns", 1 );
+
+ int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
+ SalomeApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
+
+ QStringList values;
+ values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
+ values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
+ QValueList<QVariant> indices;
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( activeBarPref, "strings", values );
+ setPreferenceProperty( activeBarPref, "indexes", indices );
+
+ int diplayGlobalPref = addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
+ SalomeApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
+
+ int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
+ SalomeApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
+
+ values.clear();
+ values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
+ values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( colorPref, "strings", values );
+ setPreferenceProperty( colorPref, "indexes", indices );
+
+ int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
+ SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
+ setPreferenceProperty( spacingPref, "min", 0.01 );
+ setPreferenceProperty( spacingPref, "max", 1.0 );
+ setPreferenceProperty( spacingPref, "step", 0.01 );
+
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::createOutsideCursorPreferences()
+{
+ int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
}