-// 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>
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)) {
{
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;
}