From 86bea4b3da85a7679797936566663f0da9ff8116 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 7 Dec 2007 08:02:28 +0000 Subject: [PATCH] Integration of development done in the MERGE_MULTIPR_EVOLUTION CVS branch --- src/VISUGUI/VisuGUI_FieldFilter.cxx | 5 ++ src/VISUGUI/VisuGUI_InputPane.cxx | 8 ++ src/VISUGUI/VisuGUI_Slider.cxx | 4 + src/VISU_I/VISU_ColoredPrs3d_i.cc | 118 ++++++++++++++++++++++------ src/VISU_I/VISU_GaussPoints_i.cc | 88 ++++++++++++++++----- src/VISU_I/VISU_MultiResult_i.cc | 39 ++++++--- src/VISU_I/VISU_Result_i.cc | 22 +++++- 7 files changed, 229 insertions(+), 55 deletions(-) diff --git a/src/VISUGUI/VisuGUI_FieldFilter.cxx b/src/VISUGUI/VisuGUI_FieldFilter.cxx index c2a0ca79..807d2157 100644 --- a/src/VISUGUI/VisuGUI_FieldFilter.cxx +++ b/src/VISUGUI/VisuGUI_FieldFilter.cxx @@ -96,7 +96,12 @@ bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const anInput.myFieldName = CORBA::string_dup( aFieldName.latin1() ); anInput.myTimeStampNumber = 1; + QApplication::setOverrideCursor(Qt::waitCursor); + size_t isOk = VISU::CheckIsPossible( myType, anInput, true ); + + QApplication::restoreOverrideCursor(); + return isOk > 0; } } diff --git a/src/VISUGUI/VisuGUI_InputPane.cxx b/src/VISUGUI/VisuGUI_InputPane.cxx index 3b90cc17..6b1a68f8 100644 --- a/src/VISUGUI/VisuGUI_InputPane.cxx +++ b/src/VISUGUI/VisuGUI_InputPane.cxx @@ -409,6 +409,8 @@ void VisuGUI_InputPane::onSelectionChanged() if( myReInit->isChecked() && myPrs ) { + QApplication::setOverrideCursor(Qt::waitCursor); + myPrs->SetResultObject( myResult ); myPrs->SetMeshName( aMeshName.latin1() ); myPrs->SetEntity( VISU::Entity( myEntity ) ); @@ -417,6 +419,8 @@ void VisuGUI_InputPane::onSelectionChanged() myPrs->Apply( true ); myDialog->initFromPrsObject( myPrs, false ); + + QApplication::restoreOverrideCursor(); } } } @@ -425,9 +429,13 @@ void VisuGUI_InputPane::onSelectionChanged() //--------------------------------------------------------------- void VisuGUI_InputPane::changeTimeStamp( int theTimeStamp ) { + QApplication::setOverrideCursor(Qt::waitCursor); + myPrs->SetTimeStampNumber( myPrs->GetTimeStampNumberByIndex( theTimeStamp ) ); myPrs->Apply( true ); myDialog->initFromPrsObject( myPrs, false ); + + QApplication::restoreOverrideCursor(); } diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index fe6cf3eb..2e6c8c0e 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -436,7 +436,11 @@ void VisuGUI_Slider::onValueChanged( int value ) VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput(); anInput->myTimeStampNumber = aNumber; + QApplication::setOverrideCursor(Qt::waitCursor); + aHolder->Apply( aPrs3d, anInput, myView3D ); + + QApplication::restoreOverrideCursor(); } updateMemoryState(); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 118e2272..56160927 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -191,10 +191,11 @@ void VISU::ColoredPrs3d_i ::RemoveFromStudy() { - struct TRemoveFromStudy: public SALOME_Event + struct TEvent: public SALOME_Event { VISU::ColoredPrs3d_i* myRemovable; - TRemoveFromStudy(VISU::ColoredPrs3d_i* theRemovable): + + TEvent(VISU::ColoredPrs3d_i* theRemovable): myRemovable(theRemovable) {} @@ -203,13 +204,15 @@ VISU::ColoredPrs3d_i Execute() { SALOMEDS::SObject_var aSObject = myRemovable->GetSObject(); + if(!CORBA::is_nil(aSObject.in())) VISU::RemoveFromStudy(aSObject,false); + myRemovable->TSuperClass::RemoveFromStudy(); } }; - ProcessVoidEvent(new TRemoveFromStudy(this)); + ProcessVoidEvent(new TEvent(this)); } @@ -218,16 +221,31 @@ void VISU::ColoredPrs3d_i ::UpdateFromResult(Result_i* theResult) { - try{ - if(theResult == GetCResult()){ - DoSetInput(false, false); - UpdateActors(); + struct TEvent: public SALOME_Event + { + VISU::ColoredPrs3d_i* myColoredPrs3d; + + TEvent(VISU::ColoredPrs3d_i* theColoredPrs3d): + myColoredPrs3d(theColoredPrs3d) + {} + + virtual + void + Execute() + { + try{ + myColoredPrs3d->DoSetInput(false, false); + myColoredPrs3d->UpdateActors(); + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<ConnectObserver(this, myResultConnection); + if(GetPublishInStudyMode() != EDoNotPublish) + GetCResult()->ConnectObserver(this, myResultConnection); myPreviousEntity = myEntity; myPreviousFieldName = myFieldName; @@ -780,28 +799,81 @@ VISU::ColoredPrs3d_i return GetComponentMax(GetScalarMode()); } + +//---------------------------------------------------------------------------- +struct TGetComponentMin: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMin( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + myResult = aTMinMax.first; + } + } +}; + + //---------------------------------------------------------------------------- vtkFloatingPointType VISU::ColoredPrs3d_i ::GetComponentMin(vtkIdType theCompID) { - if(PMinMaxController aMinMaxController = GetMinMaxController()) - return aMinMaxController->GetComponentMin(theCompID); - - TMinMax aTMinMax = GetMinMax(GetCResult(), GetField(), theCompID); - return aTMinMax.first; + return ProcessEvent( new TGetComponentMin( this, theCompID ) ); } +//---------------------------------------------------------------------------- +struct TGetComponentMax: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMax( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + myResult = aTMinMax.second; + } + } +}; + + //---------------------------------------------------------------------------- vtkFloatingPointType VISU::ColoredPrs3d_i ::GetComponentMax(vtkIdType theCompID) { - if(PMinMaxController aMinMaxController = GetMinMaxController()) - return aMinMaxController->GetComponentMax(theCompID); - - TMinMax aTMinMax = GetMinMax(GetCResult(), GetField(), theCompID); - return aTMinMax.second; + return ProcessEvent( new TGetComponentMax( this, theCompID ) ); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 7d9a4152..ede97ab9 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -929,11 +929,11 @@ VISU::GaussPoints_i aScalarBarCtrl->SetRangeLocal(aRange); } - TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT); bool anIsMinMaxDone = IsGlobalRangeDefined(); - if(anIsMinMaxDone) - aTMinMax = GetField()->GetMinMax(GetScalarMode()); aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone); + + TMinMax aTMinMax( GetComponentMin( GetScalarMode() ), + GetComponentMax( GetScalarMode() )); aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); VISU_ScalarBarCtrl::EMode aScalarBarMode = VISU_ScalarBarCtrl::eGlobal; @@ -1044,6 +1044,10 @@ VISU::GaussPoints_i VISU::TSetModified aModified(this); myIsActiveLocalScalarBar = theIsActiveLocalScalarBar; + + if ( !theIsActiveLocalScalarBar || !IsRangeFixed() ) + SetSourceRange(); + myParamsTime.Modified(); } @@ -1088,32 +1092,78 @@ VISU::GaussPoints_i UseFixedRange(false); } + +//---------------------------------------------------------------------------- +struct TGetSourceMin: public SALOME_Event +{ + VISU::GaussPoints_i* myColoredPrs3d; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetSourceMin( VISU::GaussPoints_i* theColoredPrs3d ): + myColoredPrs3d( theColoredPrs3d ) + {} + + virtual + void + Execute() + { + if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) { + vtkFloatingPointType aRange[2]; + myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); + myResult = aRange[0]; + }else{ + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + myResult = aTMinMax.first; + } + } +}; + + +//---------------------------------------------------------------------------- CORBA::Double VISU::GaussPoints_i ::GetSourceMin() { - if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[0]; - }else{ - TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); - return aTMinMax.first; - } + return ProcessEvent( new TGetSourceMin( this ) ); } + +//---------------------------------------------------------------------------- +struct TGetSourceMax: public SALOME_Event +{ + VISU::GaussPoints_i* myColoredPrs3d; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetSourceMax( VISU::GaussPoints_i* theColoredPrs3d ): + myColoredPrs3d( theColoredPrs3d ) + {} + + virtual + void + Execute() + { + if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) { + vtkFloatingPointType aRange[2]; + myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); + myResult = aRange[1]; + }else{ + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + myResult = aTMinMax.second; + } + } +}; + + +//---------------------------------------------------------------------------- CORBA::Double VISU::GaussPoints_i ::GetSourceMax() { - if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[1]; - }else{ - TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); - return aTMinMax.second; - } + return ProcessEvent( new TGetSourceMax( this ) ); } diff --git a/src/VISU_I/VISU_MultiResult_i.cc b/src/VISU_I/VISU_MultiResult_i.cc index 8894cb93..f99d8ffd 100644 --- a/src/VISU_I/VISU_MultiResult_i.cc +++ b/src/VISU_I/VISU_MultiResult_i.cc @@ -284,6 +284,7 @@ namespace VISU if(!theIsBuild || *theIsDone) return; + INITMSG(MYDEBUG, "BuildParts\n"); TTimerLog aTimerLog(MYTIMEDEBUG, "BuildParts"); TResultManager aResultManager(theResult); TTransactionManager aTransactionManager(theStudy); @@ -295,6 +296,7 @@ namespace VISU const VISU::PMesh& aMesh = aMeshMapIter->second; MultiResult_i::TPartNames aPartNames = aMultiprObj.getParts(); + BEGMSG(MYDEBUG, "aPartNames.size() = "<GetMeshMap(); - //VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(theMeshName); + //VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(theMeshName); // To ignore theMeshName input parameter VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.begin(); if(aMeshIter == aMeshMap.end()) return; @@ -926,6 +942,9 @@ VISU::MultiResult_i else aFatherEntry = Result_i::GetEntry(aRestoringMap); + if ( aFatherEntry == "" ) + return; + std::string anIconName = "ICON_MULTIPR_VIEW_HIDE"; if(theResolution == VISU::Result::FULL) anIconName = "ICON_MULTIPR_VIEW_FULL"; diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 775d3e48..c6edea98 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -236,7 +236,23 @@ void VISU::Result_i ::UpdateObservers() { - myUpdateObserverSignal(); + struct TEvent: public SALOME_Event + { + VISU::Result_i::TUpdateObserverSignal& myUpdateObserverSignal; + + TEvent(VISU::Result_i::TUpdateObserverSignal& theUpdateObserverSignal): + myUpdateObserverSignal(theUpdateObserverSignal) + {} + + virtual + void + Execute() + { + myUpdateObserverSignal(); + } + }; + + ProcessVoidEvent(new TEvent(myUpdateObserverSignal)); } @@ -533,9 +549,9 @@ VISU::Result_i return this; } }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<