X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Interface.cpp;h=37223231d0d9f12435f0a7bea4f242d25b4b7d89;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=d5b6332a3edac800c39907303082f5b461df9548;hpb=75e77d680594278a2da06c25fb6dbbad178e9fcd;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index d5b6332a3..37223231d 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ModelHighAPI_Interface.h" @@ -27,6 +26,7 @@ #include #include #include +#include #include "ModelHighAPI_Selection.h" //-------------------------------------------------------------------------------------- @@ -82,25 +82,30 @@ void ModelHighAPI_Interface::execute(bool isForce) 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 "<data()->name(); } ModelHighAPI_Selection ModelHighAPI_Interface::result() const { - const_cast(this)->execute(); - - return ModelHighAPI_Selection(feature()->firstResult()); + std::list aResults = results(); + if (aResults.empty()) + return ModelHighAPI_Selection(std::shared_ptr()); + return aResults.front(); } std::list ModelHighAPI_Interface::results() const @@ -109,9 +114,12 @@ std::list ModelHighAPI_Interface::results() const std::list aSelectionList; - std::list > aResults = feature()->results(); - for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) { - aSelectionList.push_back(ModelHighAPI_Selection(*it)); + if (feature().get()) { + std::list > 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;