]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Selector/Selector_Primitive.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / Selector / Selector_Primitive.cpp
index 15c617da0734bbda9e304a804a6874a3ad7caf3c..4594988e732f2befd005af5fe7be7c17c39019e7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <Selector_Primitive.h>
 
 #include <Selector_NameGenerator.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_NamedShape.hxx>
 #include <TDataStd_Name.hxx>
 
@@ -48,8 +49,8 @@ bool Selector_Primitive::restore()
   return restoreBaseArray(anEmptyRefList, myFinal);
 }
 
-TDF_Label Selector_Primitive::restoreByName(std::string theName,
-  const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+TDF_Label Selector_Primitive::restoreByName(std::wstring theName,
+  const TopAbs_ShapeEnum /*theShapeType*/, Selector_NameGenerator* theNameGenerator)
 {
   TDF_Label aContext;
   if (theNameGenerator->restoreContext(theName, aContext, myFinal)) {
@@ -63,19 +64,25 @@ bool Selector_Primitive::solve(const TopoDS_Shape& theContext)
 {
   Handle(TNaming_NamedShape) aNS;
   if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-    Selector_Algo::store(aNS->Get());
+    TopoDS_Shape aResult = aNS->Get();
+    // if shape was modified and not exists in the context anymore, check evolution of this shape
+    // issue 2254 and similar (document CEA parametric first issue description)
+    findNewVersion(theContext, aResult);
+    Selector_Algo::store(aResult);
     return true;
   }
   return false;
 }
 
-std::string Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
 {
   Handle(TDataStd_Name) aName;
   if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
-    return "";
-  std::string aResult = theNameGenerator->contextName(myFinal);
-  if (!aResult.empty())
-    aResult += "/" + std::string(TCollection_AsciiString(aName->Get()).ToCString());
+    return L"";
+  std::wstring aResult = theNameGenerator->contextName(myFinal);
+  if (!aResult.empty()) {
+    aResult += L"/";
+    aResult += Locale::Convert::toWString(aName->Get().ToExtString());
+  }
   return aResult;
 }