From: enk Date: Tue, 7 Feb 2006 13:17:03 +0000 (+0000) Subject: Fix for Bug Bug IPAL11510: X-Git-Tag: mergeto_trunk_07Feb06 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=71b393bcaf0fd0095e874af60d40825d3d8ffe18;p=modules%2Fvisu.git Fix for Bug Bug IPAL11510: Hangup or SIGSEGV at attempt to create "ScalarDef.Shape" presentation. --- diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index 95e13191..ccb1c573 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -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:"<first << ","; + cout << endl; + } + } return ret; } diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h index c49a3de1..bf588c9e 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h @@ -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