From: apo Date: Thu, 22 Sep 2005 07:51:06 +0000 (+0000) Subject: To improve field components naming X-Git-Tag: BR-D5-38-2003_D2005-12-10~164 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9fed4c80f52781a437cc2dcc7a8296f23c2987d6;p=modules%2Fvisu.git To improve field components naming --- diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 65945aa6..3344117b 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -105,10 +105,6 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool S myModeLbl = new QLabel("Scalar Mode", RangeGroup); myModeCombo = new QComboBox(RangeGroup); - myModeCombo->insertItem("Modulus"); - myModeCombo->insertItem("Component 1"); - myModeCombo->insertItem("Component 2"); - myModeCombo->insertItem("Component 3"); RangeGroupLayout->addWidget( myModeLbl, 0, 0 ); RangeGroupLayout->addWidget( myModeCombo, 0, 1 ); @@ -515,12 +511,37 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) LabelLabel->setEnabled( !bicolor ); LabelSpin->setEnabled( !bicolor ); - float aRange[2]; thePrs->GetGaussPointsPL()->GetSourceRange(aRange); Rmin = aRange[0]; Rmax = aRange[1]; setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() ); - bool isScalarMode = (thePrs->GetField()->myNbComp > 1); + + // Update myModeCombo + int aNbComp = thePrs->GetField()->myNbComp; + bool isScalarMode = (aNbComp > 1); + myModeCombo->clear(); + myModeCombo->insertItem(""); + const VISU::PField& aField = thePrs->GetField(); + const VISU::TNames& aCompNames = aField->myCompNames; + const VISU::TNames& aUnitNames = aField->myUnitNames; + for(int i = 0; i < aNbComp; i++){ + QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace(); + if(aComponent.isNull() || aComponent == "") + aComponent = "Component " + QString::number(i+1); + else + aComponent = "[" + QString::number(i+1) + "] " + aComponent; + + QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace(); + if(anUnit.isNull() || anUnit == "") + anUnit = "-"; + + aComponent = aComponent + ", " + anUnit; + + myModeCombo->insertItem(aComponent); + } + // + myModeCombo->setCurrentItem(thePrs->GetScalarMode()); + // myModeLbl->setEnabled(isScalarMode); myModeCombo->setEnabled(isScalarMode); diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index a145b62a..41ecd389 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -520,11 +520,10 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { setRange( thePrs->GetMin(), thePrs->GetMax(), /*0.0, 0.0,*/ thePrs->IsRangeFixed() ); setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() ); - // - int aNbComp=thePrs->GetField()->myNbComp; + + // Update myModeCombo + int aNbComp = thePrs->GetField()->myNbComp; bool isScalarMode = (aNbComp > 1); - // - // update myModeCombo myModeCombo->clear(); myModeCombo->insertItem(""); const VISU::PField& aField = thePrs->GetField();