addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
- addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
myBuildFieldsButton->setPaletteBackgroundColor( Qt::red );
connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
- myBuildMinMaxCheckBox = new QCheckBox( tr( "BUILD_MINMAX" ), myProgressBox );
- myBuildMinMaxCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_min_max", true ) );
- myBuildMinMaxButton = new QPushButton( myProgressBox );
- myBuildMinMaxButton->setEnabled( false );
- myBuildMinMaxButton->setFixedSize( 30, 30 );
- myBuildMinMaxButton->setPaletteBackgroundColor( Qt::red );
- connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
-
myBuildGroupsCheckBox = new QCheckBox( tr( "BUILD_GROUPS" ), myProgressBox );
myBuildGroupsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_groups", true ) );
myBuildGroupsButton = new QPushButton( myProgressBox );
aProgressLayout->addWidget( myBuildEntitiesButton, 0, 1 );
aProgressLayout->addWidget( myBuildFieldsCheckBox, 1, 0 );
aProgressLayout->addWidget( myBuildFieldsButton, 1, 1 );
- aProgressLayout->addWidget( myBuildMinMaxCheckBox, 2, 0 );
- aProgressLayout->addWidget( myBuildMinMaxButton, 2, 1 );
- aProgressLayout->addWidget( myBuildGroupsCheckBox, 3, 0 );
- aProgressLayout->addWidget( myBuildGroupsButton, 3, 1 );
+ aProgressLayout->addWidget( myBuildGroupsCheckBox, 2, 0 );
+ aProgressLayout->addWidget( myBuildGroupsButton, 2, 1 );
// Time
myTimeBox = new QGroupBox( tr( "IMPORT_TIME" ), this );
tr("BUT_OK"));
onClose();
}else{
- myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() );
+ myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), true );
myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() );
//setModal( false );
bool isGroupsDone = myResult->IsGroupsDone();
updateButton( myBuildEntitiesButton, isEntitiesDone );
- updateButton( myBuildFieldsButton, isFieldsDone );
- updateButton( myBuildMinMaxButton, isMinMaxDone );
+ updateButton( myBuildFieldsButton, isFieldsDone && isMinMaxDone);
updateButton( myBuildGroupsButton, isGroupsDone );
}
else if( aCheckBox == myBuildFieldsCheckBox )
{
myBuildFieldsButton->setPaletteBackgroundColor( aColor );
- if( !anIsChecked && myBuildMinMaxCheckBox->isChecked() )
- myBuildMinMaxCheckBox->animateClick();
- }
- else if( aCheckBox == myBuildMinMaxCheckBox )
- {
- myBuildMinMaxButton->setPaletteBackgroundColor( aColor );
- if( anIsChecked && !myBuildFieldsCheckBox->isChecked() )
- myBuildFieldsCheckBox->animateClick();
}
else if( aCheckBox == myBuildGroupsCheckBox )
myBuildGroupsButton->setPaletteBackgroundColor( aColor );
QCheckBox* myBuildFieldsCheckBox;
QPushButton* myBuildFieldsButton;
- QCheckBox* myBuildMinMaxCheckBox;
- QPushButton* myBuildMinMaxButton;
-
QCheckBox* myBuildGroupsCheckBox;
QPushButton* myBuildGroupsButton;
VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
- QVBox(parent), myPreviewActor(0)
+ QVBox(parent),
+ myPreviewActor(0),
+ myScalarMap(NULL),
+ myScalarMapPL(NULL)
{
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
QString propertyName;
myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
- Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
- myRangeMode = -1;
-
setSpacing(6);
//setMargin(11);
myOnGroupsCB->setChecked(true);
}
- //
- myTitle = thePrs->GetTitle();
- setPosAndSize( thePrs->GetPosX(),
- thePrs->GetPosY(),
- thePrs->GetWidth(),
- thePrs->GetHeight(),
- thePrs->GetBarOrientation());
- switch(thePrs->GetScaling()){
- case VISU::LOGARITHMIC :
- setLogarithmic(true);
- break;
- default:
- setLogarithmic(false);
- }
- vtkFloatingPointType aRange[2];
- thePrs->GetPrsMergerPL()->GetSourceRange(aRange);
- Rmin = aRange[0]; Rmax = aRange[1];
- setRange( thePrs->GetMin(), thePrs->GetMax(),
- /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
- setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
-
// Update myModeCombo
int aNbComp = thePrs->GetField()->myNbComp;
bool isScalarMode = (aNbComp > 1);
myModeCombo->insertItem(aComponent);
}
+
//
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
- if (aNbComp==1){
+ if (aNbComp == 1)
myModeCombo->setCurrentItem(1);
- }
+
//
myModeLbl->setEnabled(isScalarMode);
myModeCombo->setEnabled(isScalarMode);
+ switch(thePrs->GetScaling()){
+ case VISU::LOGARITHMIC :
+ setLogarithmic(true);
+ break;
+ default:
+ setLogarithmic(false);
+ }
+
+ setRange( thePrs->GetMin(), thePrs->GetMax(), thePrs->IsRangeFixed() );
+
+ setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
+
+ //
+ myTitle = thePrs->GetTitle();
+ setPosAndSize( thePrs->GetPosX(),
+ thePrs->GetPosY(),
+ thePrs->GetWidth(),
+ thePrs->GetHeight(),
+ thePrs->GetBarOrientation());
+
// "Title"
myTextDlg->setTitleText(QString(thePrs->GetTitle()));
*/
void VisuGUI_ScalarBarPane::changeRange( int )
{
- int mode = -1;
- if ( RBFrange->isChecked() )
- mode = 0;
- if ( RBIrange->isChecked() )
- mode = 1;
- if ( myRangeMode == mode )
- return;
- //MinSpin->setMaxValue( Fmin );
- //MaxSpin->setMinValue( Fmax );
if ( RBFrange->isChecked() ) {
- //MinLabel->setEnabled( false );
MinEdit->setEnabled( false );
- //MaxLabel->setEnabled( false );
MaxEdit->setEnabled( false );
- if ( mode != -1 ) {
- Imin = MinEdit->text().toDouble();
- Imax = MaxEdit->text().toDouble();
- }
- MinEdit->setText( QString::number( Rmin ) );
- MaxEdit->setText( QString::number( Rmax ) );
- }
- else {
- //MinLabel->setEnabled( true );
+ } else {
MinEdit->setEnabled( true );
- //MaxLabel->setEnabled( true );
MaxEdit->setEnabled( true );
- MinEdit->setText( QString::number( Imin ) );
- MaxEdit->setText( QString::number( Imax ) );
}
- myRangeMode = mode;
- updatePreview();
+
+ changeScalarMode(myModeCombo->currentItem());
}
/*!
{
if ( myScalarMap ) {
if ( RBFrange->isChecked() ) {
- vtkFloatingPointType aRange[2];
int aMode = myScalarMap->GetScalarMode();
myScalarMap->SetScalarMode(theMode);
- myScalarMap->GetPrsMergerPL()->GetSourceRange(aRange);
- MinEdit->setText( QString::number( aRange[0] ) );
- MaxEdit->setText( QString::number( aRange[1] ) );
+ MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
+ MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
myScalarMap->SetScalarMode(aMode);
}
}
*/
void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
{
- Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
- if ( RBIrange->isChecked() ) {
- MinEdit->setText( QString::number( Imin ) );
- MaxEdit->setText( QString::number( Imax ) );
- }
- else {
- MinEdit->setText( QString::number( Rmin ) );
- MaxEdit->setText( QString::number( Rmax ) );
- }
- myRangeMode = -1;
+ MinEdit->setText( QString::number( imin ) );
+ MaxEdit->setText( QString::number( imax ) );
+
if( sbRange )
RBIrange->setChecked( true );
else
RBFrange->setChecked( true );
- changeRange( 0 );
-}
-/*!
- Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
- Rmin = imin;
- Rmax = imax;
+ changeRange( 0 );
}
/*!
}
// check if logarithmic mode is on and check imposed range to not contain negative values
if ( CBLog->isChecked() ) {
- if ( RBIrange->isChecked() ) {
- if ( (minVal > 0) && (maxVal > 0) ) {
- // nothing to do
- }
- else {
+ if ( minVal <= 0.0 || maxVal <= 0.0 ) {
+ if ( RBIrange->isChecked() ) {
SUIT_MessageBox::warn1( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_RANGE"),
- tr("BUT_OK"));
- return false;
- }
- }
- else {
- if ( Rmin > 0 && Rmax > 0 ) {
- // nothing to do
- }
- else {
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE"),
+ tr("BUT_OK"));
+ } else {
SUIT_MessageBox::warn1( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_FIELD_RANGE"),
- tr("BUT_OK"));
- RBIrange->setChecked(1);
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+ tr("BUT_OK"));
+ RBIrange->setChecked(true);
changeRange(1);
- //MinEdit->setText( QString::number( Rmin ) );
- //MaxEdit->setText( QString::number( Rmax ) );
- return false;
}
+ return false;
}
}
return true;
QPushButton* myTextBtn;
VisuGUI_TextPrefDlg* myTextDlg;
- double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myRangeMode;
bool myIsStoreTextProp;
private slots:
return myField;
}
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::IsTimeStampFixed()
+{
+ SALOMEDS::SObject_var aSObject = GetSObject();
+ return !CORBA::is_nil(aSObject);
+}
+
const std::string&
VISU::ColoredPrs3d_i
::GetMeshName() const
virtual const VISU::PField&
GetField() const;
+ virtual
+ CORBA::Boolean
+ IsTimeStampFixed();
+
const std::string&
GetMeshName() const;
myScalarMapPL->SetMapScale(theMapScale);
}
+//----------------------------------------------------------------------------
bool
VISU::ScalarMap_i
::IsRangeFixed()
return myIsFixedRange;
}
+//----------------------------------------------------------------------------
void
VISU::ScalarMap_i
::SetSourceRange()
{
- myScalarMapPL->SetSourceRange();
+ if(IsTimeStampFixed()){
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_ScalarMapPL>
+ (myScalarMapPL, &VISU_ScalarMapPL::SetSourceRange));
+ }else{
+ TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+ vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, vtkFloatingPointType*>
+ (myScalarMapPL, &VISU_ScalarMapPL::SetScalarRange, aScalarRange));
+ }
+
myIsFixedRange = false;
}
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ScalarMap_i
+::GetSourceMin()
+{
+ if(IsTimeStampFixed()){
+ vtkFloatingPointType aRange[2];
+ myScalarMapPL->GetSourceRange(aRange);
+ return aRange[0];
+ }else{
+ TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+ return aTMinMax.first;
+ }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ScalarMap_i
+::GetSourceMax()
+{
+ if(IsTimeStampFixed()){
+ vtkFloatingPointType aRange[2];
+ myScalarMapPL->GetSourceRange(aRange);
+ return aRange[1];
+ }else{
+ TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+ return aTMinMax.second;
+ }
+}
+
//----------------------------------------------------------------------------
VISU_Actor*
VISU::ScalarMap_i
void
SetSourceRange();
+ virtual
+ CORBA::Double
+ GetSourceMin();
+
+ virtual
+ CORBA::Double
+ GetSourceMax();
+
virtual
void
SameAs(const Prs3d_i* theOrigin);
aPresent->_remove_ref();
}
theData.myNbFrames = aFrameId;
-
+ /*
if (theData.myPrsType != VISU::TGAUSSPOINTS){
int aRangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0);
if( aRangeType != 1 ){
if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(theData.myPrs[aFrameId]))
aPrs->SetSubRange(aMin, aMax);
}
+ */
}
}
for (int i = 0; i < getNbFields(); i++) {
FieldData& aData = myFieldsLst[i];
- if ( aData.myPrs.front() ) {
+ if (aData.myPrs.empty())
+ generatePresentations(i);
+ if ( !aData.myPrs.empty() ) {
_PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject);
aStudyBuilder->Addreference(newObj, aData.myField);
- if (aData.myPrs.empty()) {
- generatePresentations(i);
- }
ostringstream strOut;
aData.myPrs[0]->ToStream(strOut);
string aPrsComment = strOut.str();