From: nge Date: Tue, 22 Dec 2009 14:15:26 +0000 (+0000) Subject: Fixed bad Save/Load of GHS3D hypothesis in hdf file X-Git-Tag: V6_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_FSH_DEV;p=plugins%2Fghs3dplugin.git Fixed bad Save/Load of GHS3D hypothesis in hdf file --- diff --git a/src/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin_Hypothesis.cxx index 04644bc..6ab56c6 100644 --- a/src/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin_Hypothesis.cxx @@ -540,9 +540,11 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) save << (int)myToUseBoundaryRecoveryVersion << " "; save << (int)myToUseFemCorrection << " "; save << (int)myToRemoveCentralPoint << " "; - save << "__OPTIONS_BEGIN__ "; - save << myTextOption << " "; - save << " __OPTIONS_END__ "; + if (!myTextOption.empty()) { + save << "__OPTIONS_BEGIN__ "; + save << myTextOption << " "; + save << "__OPTIONS_END__ "; + } TEnforcedVertexValues::iterator it = myEnforcedVertices.begin(); @@ -645,20 +647,6 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) else load.clear(ios::badbit | load.rdstate()); -// isOK = (load >> myTextOption); -// while (isOK) { -// std::string txt; -// if (load >> txt) { -// myTextOption += " "; -// myTextOption += txt; -// } -// else -// isOK = false; -// } -// // else -// // load.clear(ios::badbit | load.rdstate()); - - std::string separator; bool hasOptions = false; bool hasEnforcedVertices = false; @@ -669,25 +657,23 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) hasOptions = true; else if (separator == "__ENFORCED_VERTICES_BEGIN__") hasEnforcedVertices = true; - + if (hasOptions) { std::string txt; - isOK = (load >> myTextOption); while (isOK) { - if (myTextOption == "__OPTIONS_END__") { - isOK = false; - break; - } - if (load >> txt) { + isOK = (load >> txt); + if (isOK) { if (txt == "__OPTIONS_END__") { + if (!myTextOption.empty()) { + // Remove last space + myTextOption.erase(myTextOption.end()-1); + } isOK = false; break; } - myTextOption += " "; myTextOption += txt; + myTextOption += " "; } - else - isOK = false; } }