]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug NPAL18277 V4_1_0rc3
authorapo <apo@opencascade.com>
Wed, 12 Dec 2007 15:11:55 +0000 (15:11 +0000)
committerapo <apo@opencascade.com>
Wed, 12 Dec 2007 15:11:55 +0000 (15:11 +0000)
   EDF 629 VISU : 3.2.9 and 4.1 Regression

src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_TimeAnimation.cxx

index 5b2e881eb8f5a125002b8be0bbb5dc4ad18bed6f..98dcd686ccb6c1fad297a587dd8f1eb4f559bd26 100644 (file)
@@ -339,6 +339,8 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
                 QString theFieldName, 
                 const bool save_scalar_pane )
 {
+  QApplication::setOverrideCursor(Qt::waitCursor);
+
   if( save_scalar_pane )
     GetScalarPane()->storeToPrsObject(myPrsCopy);
 
@@ -357,6 +359,8 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
   
   if( save_scalar_pane )
     UpdateScalarField();
+
+  QApplication::restoreOverrideCursor();
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::accept()
index 7df71bef4453c50b3c7e988aa04c8f292c50efac..664b8162b01653d353bcaae53a2902edd2b08f2d 100644 (file)
@@ -90,6 +90,13 @@ namespace VISU
     return theField->GetMinMax(theCompID);
   }
 
+  //---------------------------------------------------------------
+  void
+  TMinMaxController
+  ::UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d)
+  {}
+
+
   //---------------------------------------------------------------
   vtkFloatingPointType
   TMinMaxController
@@ -112,19 +119,22 @@ namespace VISU
   struct TSimpleMinMaxController: virtual TVTKMinMaxController
   {
     VISU::Result_i* myResult;
-    VISU::PField myField;
+    VISU::ColoredPrs3d_i* myColoredPrs3d;
     
     TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d):
       myResult(theColoredPrs3d->GetCResult()),
-      myField(theColoredPrs3d->GetField())
+      myColoredPrs3d(theColoredPrs3d)
     {}
     
+    ~TSimpleMinMaxController()
+    {}
+
     virtual
     vtkFloatingPointType
     GetComponentMin(vtkIdType theCompID)
     {
-      if(myField){
-       TMinMax aMinMax = GetMinMax(myResult, myField, theCompID);
+      if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
+       TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
        return aMinMax.first;
       }
       return TMinMaxController::GetComponentMin(theCompID);
@@ -134,8 +144,8 @@ namespace VISU
     vtkFloatingPointType
     GetComponentMax(vtkIdType theCompID)
     {
-      if(myField){
-       TMinMax aMinMax = GetMinMax(myResult, myField, theCompID);
+      if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
+       TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
        return aMinMax.second;
       }
       return TMinMaxController::GetComponentMax(theCompID);
@@ -493,7 +503,7 @@ VISU::ColoredPrs3d_i
 //----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetMinMaxController(const VISU::PMinMaxController& theController)
+::SetMinMaxController( const VISU::PMinMaxController& theController )
 {
   myMinMaxController = theController;
 
@@ -502,6 +512,18 @@ VISU::ColoredPrs3d_i
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMinMaxController( VISU::ColoredPrs3d_i* theOrigin )
+{
+  VISU::PMinMaxController aController = theOrigin->GetMinMaxController();
+  aController->UpdateReference( theOrigin, this );
+  
+  SetMinMaxController( aController );
+}
+
+
 //----------------------------------------------------------------------------
 CORBA::Long
 VISU::ColoredPrs3d_i
@@ -652,8 +674,8 @@ VISU::ColoredPrs3d_i
     
     TSuperClass::SameAs(theOrigin);
     
-    CORBA::Long aNbComp = GetField()->myNbComp;
-    CORBA::Long anOriginNbComp = anOrigin->GetField()->myNbComp;
+    CORBA::Long aNbComp = GetScalarField()->myNbComp;
+    CORBA::Long anOriginNbComp = anOrigin->GetScalarField()->myNbComp;
     if(anOriginNbComp < aNbComp)
       SetScalarMode(0);
     else
@@ -666,7 +688,7 @@ VISU::ColoredPrs3d_i
 
     SetBarOrientation(anOrigin->GetBarOrientation());
     
-    SetMinMaxController(anOrigin->GetMinMaxController());
+    SetMinMaxController( anOrigin );
 
     if(anOrigin->IsRangeFixed())
       SetRange(anOrigin->GetMin(), anOrigin->GetMax());
@@ -718,7 +740,7 @@ void
 VISU::ColoredPrs3d_i
 ::SetScalarMode(CORBA::Long theScalarMode) 
 {
-  CORBA::Long aNbComp = GetField()->myNbComp;
+  CORBA::Long aNbComp = GetScalarField()->myNbComp;
   if(aNbComp == 1)
     theScalarMode = 1;
   else if(theScalarMode > aNbComp)
@@ -830,7 +852,7 @@ struct TGetComponentMin: public SALOME_Event
     if ( aMinMaxController ) {
       myResult = aMinMaxController->GetComponentMin( myCompID );
     } else {
-      VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID );
+      VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID );
       myResult = aTMinMax.first;
     }
   }
@@ -868,7 +890,7 @@ struct TGetComponentMax: public SALOME_Event
     if ( aMinMaxController ) {
       myResult = aMinMaxController->GetComponentMax( myCompID );
     } else {
-      VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID );
+      VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID );
       myResult = aTMinMax.second;
     }
   }
@@ -1822,7 +1844,7 @@ VISU::ColoredPrs3d_i
       aRestoringMap["myEntityId"] = QString::number(GetEntity());
       aRestoringMap["myFieldName"] = GetCFieldName();
       aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber());
-      aRestoringMap["myNumComponent"] = QString::number(GetField()->myNbComp);
+      aRestoringMap["myNumComponent"] = QString::number(GetScalarField()->myNbComp);
       std::string anEntry = GetCResult()->GetEntry(aRestoringMap);
       if(anEntry == "") 
        throw std::runtime_error("There is no Entry for binding the presentation !!!");
@@ -1832,7 +1854,7 @@ VISU::ColoredPrs3d_i
                       GetEntity(),
                       GetCFieldName().c_str(),
                       GetTimeStampNumber(),
-                      GetField()->myNbComp);
+                      GetScalarField()->myNbComp);
       CORBA::String_var anIOR = GetID();
       CreateAttributes(GetStudyDocument(),
                       anEntry,
index 9b1c3ecb520cce5cb10762f923eb031847adfeed..cb22f72dd1a218e66299e48f31e30c030d4d148a 100644 (file)
@@ -38,9 +38,15 @@ class VISU_ColoredPL;
 
 namespace VISU
 {
+  class ColoredPrs3d_i;
+
   //----------------------------------------------------------------------------
   struct TMinMaxController
   {
+    virtual
+    void
+    UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d);
+
     virtual
     vtkFloatingPointType
     GetComponentMin(vtkIdType theCompID);
@@ -81,8 +87,6 @@ namespace VISU
 
 
   //----------------------------------------------------------------------------
-  class ColoredPrs3d_i;
-
   PMinMaxController
   CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d);
   
@@ -180,7 +184,10 @@ namespace VISU
     GetMinMaxController();
 
     void
-    SetMinMaxController(const VISU::PMinMaxController& theController);
+    SetMinMaxController( const VISU::PMinMaxController& theController );
+
+    void
+    SetMinMaxController( ColoredPrs3d_i* theOrigin );
 
     virtual
     CORBA::Long
index 365d28e16d278c02ee56b93c28fc06e3cd284e3c..ac6a83226a9d476afc8f2bdf1f6f3d0d9af22db4 100644 (file)
@@ -360,6 +360,7 @@ VISU::ScalarMapOnDeformedShape_i
   myScalarTimeStampNumber = theTimeStampNumber;
 
   SetTitle(theFieldName);
+  SetScalarMode(GetScalarMode());
   if(!IsRangeFixed() && IsPipeLineExists())
     SetSourceRange();
 
index 6152e6fb969146b71715b469de1c976dc6e813a4..6d82f2673c4217b68ee895c4d684602446183029 100644 (file)
@@ -114,13 +114,26 @@ namespace VISU
   //------------------------------------------------------------------------
   struct TCompositeMinMaxController : virtual TVTKMinMaxController
   {
-    typedef std::vector<VISU::PMinMaxController> TMinMaxContainer;
+    typedef ColoredPrs3d_i* TKey;
+    typedef std::map< TKey, VISU::PMinMaxController > TMinMaxContainer;
     TMinMaxContainer myMinMaxContainer;    
 
     void
-    AddController(VISU::PMinMaxController theMinMaxController)
+    AddController(ColoredPrs3d_i* theReference, 
+                 VISU::PMinMaxController theMinMaxController)
     {
-      myMinMaxContainer.push_back(theMinMaxController);
+      myMinMaxContainer[ TKey( theReference ) ] = theMinMaxController;
+    }
+
+    virtual
+    void
+    UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d)
+    {
+      TMinMaxContainer::iterator anIter = myMinMaxContainer.find( TKey( theFromPrs3 ) );
+      if ( anIter != myMinMaxContainer.end() ) {
+       myMinMaxContainer.erase( anIter );
+       myMinMaxContainer[ TKey( theToPrs3d ) ] = VISU::CreateDefaultMinMaxController( theToPrs3d );      
+      }
     }
 
     virtual
@@ -128,9 +141,10 @@ namespace VISU
     GetComponentMin(vtkIdType theCompID)
     {
       vtkFloatingPointType aMin = TMinMaxController::GetComponentMin(theCompID);
-      if(!myMinMaxContainer.empty()){
-       for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
-         VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+      if ( !myMinMaxContainer.empty() ) {
+       TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
+       for(; anIter != myMinMaxContainer.end(); anIter++){
+         VISU::PMinMaxController aMinMaxController = anIter->second;
          aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID));
        }
       }
@@ -142,9 +156,10 @@ namespace VISU
     GetComponentMax(vtkIdType theCompID)
     {
       vtkFloatingPointType aMax = TMinMaxController::GetComponentMax(theCompID);
-      if(!myMinMaxContainer.empty()){
-       for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
-         VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+      if ( !myMinMaxContainer.empty() ) {
+       TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
+       for(; anIter != myMinMaxContainer.end(); anIter++){
+         VISU::PMinMaxController aMinMaxController = anIter->second;
          aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID));
        }
       }
@@ -609,12 +624,12 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
        if ( myAnimationMode == VISU::Animation::PARALLEL ) {
          FieldData& aFieldData = getFieldData(theFieldNum);
          VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
-         aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
+         aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
        } else {
          for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
            FieldData& aFieldData = getFieldData(aFieldId);
            VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
-           aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
+           aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
          }
        }