From: mpv Date: Mon, 17 Aug 2015 07:49:11 +0000 (+0300) Subject: Support the temporary compatibility with old saved files to be able to check the... X-Git-Tag: V_1.4.0_beta4~372 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c4fdb35d274c6205676a78e58edc196c28e7c4f;p=modules%2Fshaper.git Support the temporary compatibility with old saved files to be able to check the currently opened issues. Will be removed later. --- diff --git a/src/Model/Model_Expression.cpp b/src/Model/Model_Expression.cpp index 1529d3bc0..d87020b64 100644 --- a/src/Model/Model_Expression.cpp +++ b/src/Model/Model_Expression.cpp @@ -11,13 +11,12 @@ #include #include +#include +#include + Model_Expression::Model_Expression(TDF_Label& theLabel) { myIsInitialized = true; - if (!theLabel.FindAttribute(TDataStd_Real::GetID(), myReal)) { - myReal = TDataStd_Real::Set(theLabel, 0.); - myIsInitialized = false; - } if (!theLabel.FindAttribute(TDataStd_Name::GetID(), myText)) { myText = TDataStd_Name::Set(theLabel, TCollection_ExtendedString()); myIsInitialized = false; @@ -30,6 +29,31 @@ Model_Expression::Model_Expression(TDF_Label& theLabel) myUsedParameters = TDataStd_ExtStringList::Set(theLabel); myIsInitialized = false; } + if (!theLabel.FindAttribute(TDataStd_Real::GetID(), myReal)) { + myReal = TDataStd_Real::Set(theLabel, 0.); + myIsInitialized = false; + // MPV: temporarily to support the previously saved files (to check and resolve bugs), to be removed + Handle(TDataStd_RealArray) anOldArray; + if (theLabel.Father().FindAttribute(TDataStd_RealArray::GetID(), anOldArray) == Standard_True) { + myReal->Set(anOldArray->Value(theLabel.Tag() - 1)); + myIsInitialized = true; + Handle(TDataStd_ExtStringArray) anOldExp; + if (theLabel.Father().FindAttribute(TDataStd_ExtStringArray::GetID(), anOldExp) == Standard_True) { + myText->Set(anOldExp->Value(theLabel.Tag() - 1)); + } + } else { + Handle(TDataStd_Real) anOldReal; + if (theLabel.Father().FindAttribute(TDataStd_Real::GetID(), anOldReal)) { + myIsInitialized = true; + myReal->Set(anOldReal->Get()); + Handle(TDataStd_Name) aText; + if (theLabel.Father().FindAttribute(TDataStd_Name::GetID(), aText)) { + myText->Set(aText->Get()); + } + } + } + + } } void Model_Expression::setValue(const double theValue)