]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug Bug IPAL11510: OCC_development_generic_2006 mergeto_trunk_07Feb06
authorenk <enk@opencascade.com>
Tue, 7 Feb 2006 13:17:03 +0000 (13:17 +0000)
committerenk <enk@opencascade.com>
Tue, 7 Feb 2006 13:17:03 +0000 (13:17 +0000)
Hangup or SIGSEGV at attempt to create "ScalarDef.Shape" presentation.

src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h

index 95e131915dd4d58c8c7270569c8169292d05e068..ccb1c5737824a1ab136e4e6811ed7e57ab10e5f0 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
 #include "VisuGUI_Tools.h"
+#include "VISU_Result_i.hh"
 #include "VISU_ScalarMapOnDeformedShape_i.hh"
 #include "VISU_ScalarMapOnDeformedShapePL.hxx"
 #include "SalomeApp_Module.h"
@@ -153,7 +154,10 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDe
   myTimeStampsCombo->setDisabled(isAnim);
   
   QString aFieldName(thePrs->GetScalarFieldName());
-  float aIterFloat = GetFloatValueOfTimeStamp(thePrs->GetScalarIteration());
+  float aIterFloat = GetFloatValueOfTimeStamp(thePrs->GetMeshName().c_str(),
+                                             thePrs->GetScalarFieldName().c_str(),
+                                             thePrs->GetScalarIteration(),
+                                             thePrs->GetScalarEntity());
   QString aIteration(QString("%1").arg(aIterFloat));
   
   if (myMeshFieldsTimes.size() == 0)
@@ -213,7 +217,11 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDe
                  }
                  TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
                  TFE aKey(aFieldName.latin1(),anEntity);
-                 aFieldsMap[aKey][aTimeIter.toInt()] = GetFloatValueOfTimeStamp(aTimeIter.toInt());
+                 aFieldsMap[aKey][aTimeIter.toInt()] = 
+                   GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
+                                            aFieldName.latin1(),
+                                            aTimeIter.toInt(),
+                                            anEntity);
                }
              }
            }
@@ -369,12 +377,28 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
   myScalarPane->setRange(aDoubleRange[0],aDoubleRange[1],myScalarPane->isIRange());
 }
 
-float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(int theIter){
+float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(const char* theMeshName,
+                                                                   const char* theFieldName,
+                                                                   const int   theIter,
+                                                                   const VISU::TEntity  theEntity){
   float ret=1;
-  VISU::PField aField = myPrs->GetField();
+  VISU::Result_i* theResult = myPrs->GetResult();
+  VISU::PField aField = theResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
+  if(!aField) return ret;
   VISU::TValField& aValField = aField->myValField;
-  VISU::PValForTime aValForTime = aValField.find(theIter)->second;
-  if(aValForTime)
+  VISU::TValField::const_iterator aIter = aValField.find(theIter);
+  if(aIter != aValField.end()){
+    VISU::PValForTime aValForTime = aIter->second;
     ret = float(aValForTime->myTime.first);
+  } else {
+    if(MYDEBUG){
+      cout << "Where are no aValForTime with iteration:"<<theIter<<endl;
+      cout << "\tThe possible interations is aValField.keys():";
+      VISU::TValField::const_iterator aTmp = aValField.begin();
+      for(;aTmp != aValField.end(); aTmp++)
+       cout << aTmp->first << ",";
+      cout << endl;
+    }
+  }
   return ret;
 }
index c49a3de178e1e6779f2c6c63fd64ae227e70da5a..bf588c9e429e2f62e9f3c7e40261a65ae30ffdb5 100644 (file)
@@ -102,7 +102,10 @@ protected:
  void SetScalarField();
  void AddAllFieldNames();
  void AddAllTimes(const QString& theFieldName);
- float GetFloatValueOfTimeStamp(int iteration);
+ float GetFloatValueOfTimeStamp(const char* theMeshName,
+                               const char* theFieldName,
+                               const int   theIteration,
+                               const VISU::TEntity  theEntity);
 };
 
 #endif // VISUGUI_DEFORMEDSHAPEDLS_H