-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022 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 "ModelHighAPI_Interface.h"
Events_Loop* aLoop = Events_Loop::loop();
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
- //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
//aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
}
-void ModelHighAPI_Interface::setName(const std::string& theName)
+void ModelHighAPI_Interface::setName(const std::wstring& theName)
{
- feature()->data()->setName(theName);
+ if (feature().get() && feature()->data()->isValid())
+ feature()->data()->setName(theName);
+ else {
+ std::cout<<"Error: set name "<<theName.c_str()<<" for an invalid feature"<<std::endl;
+ }
}
-std::string ModelHighAPI_Interface::name() const
+std::wstring ModelHighAPI_Interface::name() const
{
return feature()->data()->name();
}
std::list<ModelHighAPI_Selection> aSelectionList;
- std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
- for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
- if (!(*it)->isDisabled())
- aSelectionList.push_back(ModelHighAPI_Selection(*it));
+ if (feature().get()) {
+ std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
+ for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
+ if (!(*it)->isDisabled())
+ aSelectionList.push_back(ModelHighAPI_Selection(*it));
+ }
}
return aSelectionList;