*/
long GetScalarMode();
+ /*!
+ * Sets scalar range - min and max boundaries of the scalar bar.
+ * \param theMin Min boundary of the scalar bar.
+ * \param theMax Max boundary of the scalar bar.
+ */
+ void SetRange(in double theMin, in double theMax);
+
/*!
* Gets the min boundary of the scalar bar.
*/
*/
double GetMax();
+ /*!
+ * Sets scalar range that corresponds to the source data.
+ */
+ void SetSourceRange();
+
/*!
* Gets the min boundary of the scalar bar from source data.
*/
*/
Scaling GetScaling();
- /*!
- * Sets scalar range - min and max boundaries of the scalar bar.
- * \param theMin Min boundary of the scalar bar.
- * \param theMax Max boundary of the scalar bar.
- */
- void SetRange(in double theMin, in double theMax);
-
- /*!
- * Sets scalar range that corresponds to the source data.
- */
- void SetSourceRange();
-
/*!
* Add group as geometry of presentation.
* \param theMeshName - mesh name
RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
RangeGroupLayout->addWidget( myModeCombo, 0, 1 );
- //TopLayout->addWidget( RangeGroup );
+ RBFieldRange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFieldRange");
+ RBImposedRange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBImposedRange");
+ RBFieldRange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+ MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+ MinLabel->setBuddy(MinEdit);
+
+ MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+ MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+ MaxLabel->setBuddy(MaxEdit);
+
+ RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
+ RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
+ RangeGroupLayout->addMultiCellWidget( RBFieldRange, 1, 1, 0, 1);
+ RangeGroupLayout->addMultiCellWidget( RBImposedRange, 1, 1, 2, 3);
+ RangeGroupLayout->addWidget( MinLabel, 2, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 2, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 2, 3 );
// Colors and Labels ========================================================
QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
myTextDlg->setTitleVisible(!SetPref);
// signals and slots connections ===========================================
- connect( myRBLocal, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
- connect( myRBGlobal, SIGNAL( clicked() ), this, SLOT( onSetDisplayGlobal() ) );
+ connect( RBFieldRange, SIGNAL( clicked() ), this, SLOT( fieldRangeClicked() ) );
+ connect( RBImposedRange, SIGNAL( clicked() ), this, SLOT( imposedRangeClicked() ) );
+
+ connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
+
+ connect( myRBLocal, SIGNAL( clicked() ), this, SLOT( onLocalScalarBar() ) );
+ connect( myRBGlobal, SIGNAL( clicked() ), this, SLOT( onGlobalScalarBar() ) );
+
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;
}
-void VisuGUI_GaussScalarBarPane::onSetDisplayGlobal()
+void VisuGUI_GaussScalarBarPane::onGlobalScalarBar()
{
myCBDisplayed->setChecked( true );
+
+ RBImposedRange->setEnabled( false );
+ RBFieldRange->setEnabled( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+}
+
+
+void VisuGUI_GaussScalarBarPane::onLocalScalarBar()
+{
+ myCBDisplayed->setEnabled( true );
+
+ RBImposedRange->setEnabled( true );
+ RBFieldRange->setEnabled( true );
+
+ if ( RBImposedRange->isChecked() ) {
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ }
+}
+
+
+/*!
+ Called when Range mode is changed to FieldRange
+*/
+void VisuGUI_GaussScalarBarPane::fieldRangeClicked()
+{
+ RBImposedRange->setChecked( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+
+ MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
+ MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
+
+ myPrsCopy->SetSourceRange();
+}
+
+
+/*!
+ Called when Range mode is changed to FieldRange
+*/
+void VisuGUI_GaussScalarBarPane::imposedRangeClicked()
+{
+ RBFieldRange->setChecked( false );
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+
+ myPrsCopy->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
}
+/*!
+ Called when scalar mode is changed
+*/
+void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode )
+{
+ myPrsCopy->SetScalarMode( theMode );
+ if ( RBFieldRange->isChecked() ) {
+ CORBA::Double aRange[2] = {myPrsCopy->GetSourceMin(), myPrsCopy->GetSourceMax()};
+ MinEdit->setText( QString::number( aRange[0] ) );
+ MaxEdit->setText( QString::number( aRange[1] ) );
+ }
+}
+
/**
* Initialise dialog box from presentation object
*/
void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) {
+ myPrsCopy = thePrs;
+
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+
+ bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
+ if ( activeLocal ) {
+ if ( thePrs->IsRangeFixed() ) {
+ RBImposedRange->setChecked( true );
+ RBFieldRange->setChecked( false );
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ } else {
+ RBImposedRange->setChecked( false );
+ RBFieldRange->setChecked( true );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ }
+ } else {
+ RBImposedRange->setEnabled( false );
+ RBFieldRange->setEnabled( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ }
+
+ if ( RBFieldRange->isChecked() ) {
+ MinEdit->setText( QString::number( thePrs->GetSourceMin() ) );
+ MaxEdit->setText( QString::number( thePrs->GetSourceMax() ) );
+ } else {
+ MinEdit->setText( QString::number( thePrs->GetMin() ) );
+ MaxEdit->setText( QString::number( thePrs->GetMax() ) );
+ }
+
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->GetWidth(),
SpacingSpin->setValue(thePrs->GetSpacing());
- bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
myRBLocal->setChecked( activeLocal );
myRBGlobal->setChecked( !activeLocal );
*/
int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
thePrs->SetScalarMode(myModeCombo->currentItem());
+
+ if (RBFieldRange->isChecked()) {
+ thePrs->SetSourceRange();
+ } else {
+ thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ }
+
thePrs->SetPosition(XSpin->value(), YSpin->value());
thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
thePrs->SetSpacing(SpacingSpin->value());
#define VISUGUI_GAUSSPOINTSDLS_H
#include "VisuGUI_Prs3dDlg.h"
+#include "VISU_GaussPoints_i.hh"
#include <qvbox.h>
class VisuGUI_TextPrefDlg;
class VisuGUI_InputPane;
-namespace VISU
-{
- class GaussPoints_i;
-}
//! Specific Scalar Bar tab.
/*! Uses for set up Gauss Points Scalar Bars preferenses. */
protected:
QButtonGroup* RangeGroup;
+ QRadioButton* RBFieldRange;
+ QRadioButton* RBImposedRange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+ SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
QRadioButton* RBhori;
QRadioButton* RBvert;
bool myIsStoreTextProp;
private slots:
+ void onGlobalScalarBar();
+ void onLocalScalarBar();
+
+ void fieldRangeClicked();
+ void imposedRangeClicked();
+ void changeScalarMode( int );
+
void changeDefaults( int );
-//VSR: 08/06/06: void changeRange( int );
void XYChanged( double );
void onTextPref();
- void onSetDisplayGlobal();
};
//! Create Gauss Points Presentation Dialog.
}
}
+ connect( myTimeStamps, SIGNAL( activated( int ) ), this, SLOT( changeTimeStamp( int ) ) );
connect( myReInit, SIGNAL( toggled( bool ) ), SLOT( onReInitialize( bool ) ) );
+
connect( myUseGroupsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( onTypeChanged() ) );
connect( myAllGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
connect( mySelectedGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
}
+//---------------------------------------------------------------
+void VisuGUI_InputPane::changeTimeStamp( int theTimeStamp )
+{
+ myPrs->SetTimeStampNumber( myPrs->GetTimeStampNumberByIndex( theTimeStamp ) );
+ myPrs->Apply( true );
+ myDialog->initFromPrsObject( myPrs, false );
+}
+
+
//---------------------------------------------------------------
void VisuGUI_InputPane::onReInitialize( bool on )
{
public slots:
virtual void onSelectionChanged();
virtual void onReInitialize( bool );
+ virtual void changeTimeStamp( int );
private slots:
void onTypeChanged();
try{
DoSetInput(anIsCreatNew, theReInit);
+
+ if(anIsCreatNew)
+ GetSpecificPL()->Init();
+
+ // To update scalar range according to the new input
+ if(!IsTimeStampFixed() && !IsRangeFixed() || theReInit)
+ SetSourceRange();
+
+ GetCResult()->ConnectObserver(this, myResultConnection);
+
myPreviousEntity = myEntity;
myPreviousFieldName = myFieldName;
myPreviousTimeStampNumber = myTimeStampNumber;
- GetCResult()->ConnectObserver(this, myResultConnection);
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
OnRestoreInput();
SetNbColors(anOrigin->GetNbColors());
SetBarOrientation(anOrigin->GetBarOrientation());
+ SetRange(anOrigin->GetMin(), anOrigin->GetMax());
+ UseFixedRange(anOrigin->IsRangeFixed());
+
SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
SetLabels(anOrigin->GetLabels());
int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
SetScalarMode(aScalarMode);
+ // Scalar Range
+ int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+ UseFixedRange(aRangeType == 1);
+
+ if(IsRangeFixed()){
+ float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
+ float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
+ SetRange(aMin, aMax);
+ }
+
int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
SetNbColors(aNumberOfColors);
Build(ERestore);
SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
+ float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
+ float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
+ SetRange(aMin, aMax);
+
+ UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
+
SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
SetBarOrientation((VISU::ColoredPrs3d::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) );
+ Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
+ Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
+ Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
+
Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
Storable::DataToStream( theStr, "myOrientation", myOrientation );
theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
+
return thePrefix;
}
break;
}
theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
- theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
const VISU::ScalarMap_i::TGroupNames aGroupNames = theServant->GetGroupNames();
VISU::ScalarMap_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
if(const GaussPoints_i* aPrs3d = dynamic_cast<const GaussPoints_i*>(theOrigin)){
GaussPoints_i* anOrigin = const_cast<GaussPoints_i*>(aPrs3d);
- // To restore the range after shallow copy of the pipeline mapper
- // in the parent class
- SetSourceRange();
SetIsActiveLocalScalarBar(anOrigin->GetIsActiveLocalScalarBar());
SetIsDispGlobalScalarBar(anOrigin->GetIsDispGlobalScalarBar());
throw std::runtime_error("There is no TimeStamp with the parameters !!!");
GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper);
- if(theIsInitilizePipe){
- GetSpecificPL()->Init();
- }
-
- // To update scalar range according to the new input
- if(!IsTimeStampFixed() || theReInit)
- SetSourceRange();
}
anActor->SetBarVisibility(true);
GetPipeLine()->GetMapper()->SetScalarVisibility(1);
- vtkFloatingPointType aRange[2];
- GetSpecificPL()->GetSourceRange(aRange);
+ vtkFloatingPointType* aRange = GetSpecificPL()->GetScalarRange();
aScalarBarCtrl->SetRangeLocal(aRange);
TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT);
::SetSourceRange()
{
if(IsTimeStampFixed() || GetIsActiveLocalScalarBar())
- GetSpecificPL()->SetSourceRange();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
+ (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
else{
TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
- GetSpecificPL()->SetScalarRange(aScalarRange);
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
+ (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
}
+ UseFixedRange(false);
}
CORBA::Double
if(const ScalarMap_i* aPrs3d = dynamic_cast<const ScalarMap_i*>(theOrigin)){
ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
- SetRange(anOrigin->GetMin(), anOrigin->GetMax());
- UseFixedRange(anOrigin->IsRangeFixed());
-
SetScaling(anOrigin->GetScaling());
myGroupNames = anOrigin->GetGroupNames();
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- // Scalar Range
- int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
- if(aRangeType == 1){
- float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
- float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
- SetRange(aMin,aMax);
- }
-
- UseFixedRange((aRangeType == 1) ? true : false);
- bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
-
- if( isLog )
+ if( aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false) )
SetScaling(VISU::LOGARITHMIC);
else
SetScaling(VISU::LINEAR);
SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
- float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
- float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
- SetRange(aMin,aMax);
-
- UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt());
-
bool anIsExists;
QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
if(anIsExists){
{
TSuperClass::ToStream(theStr);
- Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
- Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
- Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
Storable::DataToStream( theStr, "myScaling", GetScaling() );
std::ostringstream aGeomNameList;
(GetSpecificPL(), &VISU_ColoredPL::SetScaling, theScaling));
}
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetRange(CORBA::Double theMin, CORBA::Double theMax)
-{
- TSuperClass::SetRange(theMin, theMax);
-}
-
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetSourceRange()
-{
- TSuperClass::SetSourceRange();
-}
-
//----------------------------------------------------------------------------
const VISU::ScalarMap_i::TGroupNames&
VISU::ScalarMap_i
throw std::runtime_error("There is no TimeStamp with the parameters !!!");
GetSpecificPL()->SetUnstructuredGridIDMapper(anIDMapper);
- if(theIsInitilizePipe){
- GetSpecificPL()->Init();
- }
-
- // To update scalar range according to the new input
- if(!IsTimeStampFixed() && !IsRangeFixed() || theReInit)
- SetSourceRange();
}
void
SetScaling(VISU::Scaling theScaling);
- virtual
- void
- SetRange(CORBA::Double theMin, CORBA::Double theMax);
-
- virtual
- void
- SetSourceRange();
-
//----------------------------------------------------------------------------
//! Sets initial source geometry
virtual