From: ouv Date: Tue, 10 Nov 2009 11:44:46 +0000 (+0000) Subject: Bug IPAL21429 - TC5.1.3: Not all required surfaces of “Iso Surface Definition â... X-Git-Tag: V5_1_3rc2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=22153559feab5fc63cb241ac0ea7c02d77dd6769;p=modules%2Fvisu.git Bug IPAL21429 - TC5.1.3: Not all required surfaces of “Iso Surface Definition ” are shown currently (5.1.3 current13.10.2009) in compare with previous version of application 5.1.2 current02.07.2009 --- diff --git a/doc/salome/gui/VISU/images/isosurfaces.png b/doc/salome/gui/VISU/images/isosurfaces.png index 358dc906..7b13173a 100644 Binary files a/doc/salome/gui/VISU/images/isosurfaces.png and b/doc/salome/gui/VISU/images/isosurfaces.png differ diff --git a/doc/salome/gui/VISU/input/iso_surfaces.doc b/doc/salome/gui/VISU/input/iso_surfaces.doc index a06f907e..2810f218 100644 --- a/doc/salome/gui/VISU/input/iso_surfaces.doc +++ b/doc/salome/gui/VISU/input/iso_surfaces.doc @@ -27,13 +27,15 @@ Surfaces, or click "Iso surfaces" icon in the
  • Iso Surface tab allows to set additional parameters of the Iso Surfaces presentation:
  • Scalar Bar tab allows to define the parameters of the scalar bar displayed with this presentation (\ref scalar_map_page "see also").
  • diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index 25abb517..47554dc0 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -32,6 +32,7 @@ #include +#define GAP_COEFFICIENT 0.0001 //---------------------------------------------------------------------------- @@ -91,6 +92,7 @@ VISU_IsoSurfacesPL SetNbParts(aPipeLine->GetNbParts()); vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()}; SetRange(aRange); + SetRangeFixed(aPipeLine->IsRangeFixed()); } } @@ -134,15 +136,20 @@ VISU_IsoSurfacesPL //---------------------------------------------------------------------------- void VISU_IsoSurfacesPL -::SetRange(vtkFloatingPointType theRange[2]) +::SetRange(vtkFloatingPointType theRange[2], bool theIsForced) { - if(VISU::CheckIsSameRange(myRange, theRange)) + if(VISU::CheckIsSameRange(myRange, theRange) && !theIsForced) return; if(theRange[0] <= theRange[1]){ myRange[0] = theRange[0]; myRange[1] = theRange[1]; vtkFloatingPointType aRange[2] = {theRange[0], theRange[1]}; + if( IsRangeFixed() ) { + double aDelta = fabs( aRange[1] - aRange[0] ) * GAP_COEFFICIENT; + aRange[0] += aDelta; + aRange[1] -= aDelta; + } if(GetScaling() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(theRange, aRange); myContourFilter->GenerateValues(GetNbParts(), aRange); @@ -168,6 +175,25 @@ VISU_IsoSurfacesPL } +//---------------------------------------------------------------------------- +void +VISU_IsoSurfacesPL +::SetRangeFixed(bool theIsFixed) +{ + myIsRangeFixed = theIsFixed; + SetRange( myRange, true ); +} + + +//---------------------------------------------------------------------------- +bool +VISU_IsoSurfacesPL +::IsRangeFixed() +{ + return myIsRangeFixed; +} + + void //---------------------------------------------------------------------------- VISU_IsoSurfacesPL @@ -180,6 +206,8 @@ VISU_IsoSurfacesPL vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); SetRange(aScalarRange); + + SetRangeFixed(true); } //---------------------------------------------------------------------------- @@ -233,6 +261,11 @@ VISU_IsoSurfacesPL vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()}; vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]}; + if( IsRangeFixed() ) { + double aDelta = fabs( aNewRange[1] - aNewRange[0] ) * GAP_COEFFICIENT; + aNewRange[0] += aDelta; + aNewRange[1] -= aDelta; + } if(GetScaling() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aNewRange); myContourFilter->GenerateValues(GetNbParts(), aNewRange); diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.hxx b/src/PIPELINE/VISU_IsoSurfacesPL.hxx index 9c8b8a80..1fb16590 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.hxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.hxx @@ -65,7 +65,7 @@ public: virtual void - SetRange(vtkFloatingPointType theRange[2]); + SetRange(vtkFloatingPointType theRange[2], bool theIsForced = false); virtual vtkFloatingPointType @@ -74,6 +74,14 @@ public: virtual vtkFloatingPointType GetMax(); + + virtual + void + SetRangeFixed(bool theIsFixed); + + virtual + bool + IsRangeFixed(); public: virtual @@ -110,6 +118,7 @@ protected: int myNbParts; vtkFloatingPointType myRange[2]; + bool myIsRangeFixed; vtkCellDataToPointData* myCellDataToPointData; vtkContourFilter *myContourFilter; diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index f8fddcb9..196b8f91 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -2403,6 +2403,18 @@ Please, provide non-empty resulting presentation. SHOW_VALUES_CHK Show values (nb per surface) + + RANGE + Range + + + USE_SCALAR_BAR_RANGE + Use scalar bar range + + + USE_CUSTOM_RANGE + Use custom range + VisuGUI_IsoSurfacesDlg diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx index 76e48c21..fcf2963c 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -54,6 +54,8 @@ #include #include #include +#include +#include using namespace std; @@ -74,59 +76,79 @@ VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent, TopGroupLayout->setSpacing( 6 ); TopGroupLayout->setMargin( 11 ); + QGroupBox* aRangeBox = new QGroupBox( tr( "RANGE" ), this ); + QRadioButton* aUseScalarBarRange = new QRadioButton( tr( "USE_SCALAR_BAR_RANGE" ), aRangeBox ); + QRadioButton* aUseCustomRange = new QRadioButton( tr( "USE_CUSTOM_RANGE" ), aRangeBox ); + + myRangeGrp = new QButtonGroup( aRangeBox ); + myRangeGrp->addButton( aUseScalarBarRange, ScalarBarRange ); + myRangeGrp->addButton( aUseCustomRange, CustomRange ); + aUseScalarBarRange->setChecked( true ); + + connect( myRangeGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onRangeButtonClicked( int ) ) ); + + QLabel* LabelMin = new QLabel( tr( "MIN_VALUE" ), aRangeBox ); + MinIso = new QLineEdit( aRangeBox ); + MinIso->setValidator( new QDoubleValidator( aRangeBox ) ); + MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + MinIso->setMinimumSize( 70, 0 ); + LabelMin->setBuddy( MinIso ); + + QLabel* LabelMax = new QLabel( tr( "MAX_VALUE" ), aRangeBox ); + MaxIso = new QLineEdit( aRangeBox ); + MaxIso->setValidator( new QDoubleValidator( aRangeBox ) ); + MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + MaxIso->setMinimumSize( 70, 0 ); + LabelMax->setBuddy( MaxIso ); + + QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", aRangeBox ); + aUpdateBtn->setEnabled( false ); + connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) ); + connect( aUseCustomRange, SIGNAL( toggled( bool ) ), aUpdateBtn, SLOT( setEnabled( bool ) ) ); + + QGridLayout* aRangeLayout = new QGridLayout( aRangeBox ); + aRangeLayout->setSpacing( 6 ); + aRangeLayout->setMargin( 11 ); + aRangeLayout->addWidget( aUseScalarBarRange, 0, 0 ); + aRangeLayout->addWidget( aUseCustomRange, 0, 1 ); + aRangeLayout->addWidget( LabelMin, 1, 0 ); + aRangeLayout->addWidget( MinIso, 1, 1 ); + aRangeLayout->addWidget( LabelMax, 2, 0 ); + aRangeLayout->addWidget( MaxIso, 2, 1 ); + aRangeLayout->addWidget( aUpdateBtn, 3, 0, 1, 2 ); + + TopGroupLayout->addWidget( aRangeBox, 0, 0, 1, 2 ); + QLabel* LabelNbr = new QLabel (tr("NB_SURFACES"), TopGroup); - TopGroupLayout->addWidget( LabelNbr, 0, 0 ); + TopGroupLayout->addWidget( LabelNbr, 1, 0 ); NbrIso = new QSpinBox( TopGroup ); NbrIso->setMaximum( 100 ); NbrIso->setMinimum( 1 ); NbrIso->setSingleStep( 1 ); NbrIso->setValue( 1 ); - TopGroupLayout->addWidget( NbrIso, 0, 1 ); - - QLabel* LabelMin = new QLabel (tr("MIN_VALUE"), TopGroup ); - TopGroupLayout->addWidget(LabelMin, 1, 0); - //MinIso = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 0.1, TopGroup ); - MinIso = new QLineEdit( TopGroup ); - MinIso->setValidator( new QDoubleValidator(TopGroup) ); - MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MinIso->setMinimumSize( 70, 0 ); - LabelMin->setBuddy(MinIso); - TopGroupLayout->addWidget( MinIso, 1, 1 ); - - QLabel* LabelMax = new QLabel (tr("MAX_VALUE"), TopGroup ); - TopGroupLayout->addWidget( LabelMax, 2, 0 ); - //MaxIso = new QtxSpinBoxDbl( -DBL_MAX, DBL_MAX, 0.1, TopGroup ); - MaxIso = new QLineEdit( TopGroup ); - MaxIso->setValidator( new QDoubleValidator(TopGroup) ); - MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MaxIso->setMinimumSize( 70, 0 ); - LabelMax->setBuddy(MaxIso); - TopGroupLayout->addWidget( MaxIso, 2, 1 ); + TopGroupLayout->addWidget( NbrIso, 1, 1 ); myUseMagnitude = new QCheckBox(tr("MAGNITUDE_COLORING_CHK"), TopGroup); myUseMagnitude->setChecked(true); - TopGroupLayout->addWidget( myUseMagnitude, 3, 0 ); + TopGroupLayout->addWidget( myUseMagnitude, 2, 0 ); mySelColor = new QtxColorButton( TopGroup ); mySelColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - TopGroupLayout->addWidget( mySelColor, 3, 1 ); + TopGroupLayout->addWidget( mySelColor, 2, 1 ); //connect( mySelColor, SIGNAL( clicked() ), this, SLOT( setColor() ) ); connect( myUseMagnitude, SIGNAL( toggled(bool) ), mySelColor, SLOT( setDisabled(bool) ) ); myUseLabels = new QCheckBox(tr("SHOW_VALUES_CHK"), TopGroup); myUseLabels->setChecked(false); - TopGroupLayout->addWidget( myUseLabels, 4, 0 ); + TopGroupLayout->addWidget( myUseLabels, 3, 0 ); myNbLabels = new QSpinBox( TopGroup ); myNbLabels->setMinimum(1); myNbLabels->setMaximum(100); myNbLabels->setSingleStep(1); myNbLabels->setEnabled(false); - TopGroupLayout->addWidget( myNbLabels, 4, 1 ); + TopGroupLayout->addWidget( myNbLabels, 3, 1 ); connect( myUseLabels, SIGNAL( toggled(bool) ), myNbLabels, SLOT( setEnabled(bool) ) ); - QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup); - TopGroupLayout->addWidget( aUpdateBtn, 5, 0, 1, 2); - connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) ); mySelColor->setEnabled( !myUseMagnitude->isChecked() ); } @@ -135,6 +157,12 @@ void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs) NbrIso->setValue(thePrs->GetNbSurfaces()); MinIso->setText(QString::number(thePrs->GetSubMin())); MaxIso->setText(QString::number(thePrs->GetSubMax())); + + int anId = thePrs->IsSubRangeFixed() ? ScalarBarRange : CustomRange; + bool anIsSubRangeFixed = thePrs->IsSubRangeFixed(); + myRangeGrp->button( anId )->setChecked( true ); + onRangeButtonClicked( anId ); + myUseMagnitude->setChecked(thePrs->IsColored()); SALOMEDS::Color anOldColor = thePrs->GetColor(); QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B)); @@ -148,7 +176,18 @@ void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs) int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs) { thePrs->SetNbSurfaces(NbrIso->value()); - thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble()); + + if( myRangeGrp->checkedId() == ScalarBarRange ) + { + thePrs->SetSubRange( myScalarPane->getMin(), myScalarPane->getMax() ); + thePrs->SetSubRangeFixed( true ); + } + else // CustomRange + { + thePrs->SetSubRange( MinIso->text().toDouble(), MaxIso->text().toDouble() ); + thePrs->SetSubRangeFixed( false ); + } + thePrs->ShowLabels(myUseLabels->isChecked(), myNbLabels->value()); thePrs->ShowColored(myUseMagnitude->isChecked()); if(!thePrs->IsColored()){ @@ -162,6 +201,13 @@ int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs) return 1; } +void VisuGUI_IsoSurfPane::onRangeButtonClicked( int theId ) +{ + bool isCustomRange = theId == 1; + MinIso->setEnabled( isCustomRange ); + MaxIso->setEnabled( isCustomRange ); +} + void VisuGUI_IsoSurfPane::onCBUpdate() { myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true); diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h index fd7b234b..a57ccbcd 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h @@ -33,6 +33,7 @@ class QTabWidget; class QLineEdit; class QSpinBox; +class QButtonGroup; class QtxColorButton; namespace VISU @@ -47,6 +48,9 @@ class VisuGUI_IsoSurfPane : public QWidget { Q_OBJECT; +public: + enum { ScalarBarRange = 0, CustomRange }; + public: VisuGUI_IsoSurfPane (QWidget* parent, VisuGUI_ScalarBarPane* theScalarPane); @@ -61,10 +65,12 @@ public: QColor color() const; protected slots: + void onRangeButtonClicked( int ); void onCBUpdate(); void setColor(); private: + QButtonGroup* myRangeGrp; QLineEdit* MinIso; QLineEdit* MaxIso; QSpinBox* NbrIso; diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 1e60235e..906aef86 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -138,6 +138,8 @@ VISU::IsoSurfaces_i myNbLabels = VISU::Storable::FindValue(theMap,"myNbLabels").toInt(); myIsLabeled = VISU::Storable::FindValue(theMap,"myIsLabeled").toInt(); SetSubRange(aMin,aMax); + + SetSubRangeFixed(VISU::Storable::FindValue(theMap,"myIsRangeFixed").toInt()); return this; } @@ -155,6 +157,7 @@ VISU::IsoSurfaces_i Storable::DataToStream( theStr, "myRange[1]", GetSubMax() ); Storable::DataToStream( theStr, "myNbLabels", myNbLabels ); Storable::DataToStream( theStr, "myIsLabeled", myIsLabeled ); + Storable::DataToStream( theStr, "myIsRangeFixed", IsSubRangeFixed() ); } //--------------------------------------------------------------- @@ -204,10 +207,11 @@ VISU::IsoSurfaces_i ::SetSubRange(CORBA::Double theMin, CORBA::Double theMax) { VISU::TSetModified aModified(this); - + + bool isForced = false; vtkFloatingPointType aRange[2] = {theMin, theMax}; - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_IsoSurfacesPL::SetRange, aRange)); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_IsoSurfacesPL::SetRange, aRange, isForced)); } //--------------------------------------------------------------- @@ -226,6 +230,25 @@ VISU::IsoSurfaces_i return myIsoSurfacesPL->GetMax(); } +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::SetSubRangeFixed(CORBA::Boolean theIsFixed) +{ + VISU::TSetModified aModified(this); + + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_IsoSurfacesPL::SetRangeFixed, theIsFixed)); +} + +//--------------------------------------------------------------- +CORBA::Boolean +VISU::IsoSurfaces_i +::IsSubRangeFixed() +{ + return myIsoSurfacesPL->IsRangeFixed(); +} + //--------------------------------------------------------------- void diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 86833c53..b8e245c5 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -82,6 +82,14 @@ namespace VISU CORBA::Double GetSubMax(); + virtual + void + SetSubRangeFixed(CORBA::Boolean theIsFixed); + + virtual + CORBA::Boolean + IsSubRangeFixed(); + VISU_IsoSurfacesPL* GetSpecificPL() const {