Salome HOME
Fix error in test case for issue #1779
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Interface.cpp
index 636f9019061ca5b44ff91dd3076fceef2e26d6a5..8e35b13be1b88f0fec6a144d58b11d7bcdf38f82 100644 (file)
@@ -14,7 +14,8 @@
 // License along with this library; if not, write to the Free Software
 // 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<mailto:webmaster.salome@opencascade.com>
 //
 
 #include "ModelHighAPI_Interface.h"
@@ -26,6 +27,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Result.h>
 
 #include "ModelHighAPI_Selection.h"
 //--------------------------------------------------------------------------------------
@@ -90,11 +92,17 @@ void ModelHighAPI_Interface::setName(const std::string& theName)
   feature()->data()->setName(theName);
 }
 
-ModelHighAPI_Selection ModelHighAPI_Interface::result() const
+std::string ModelHighAPI_Interface::name() const
 {
-  const_cast<ModelHighAPI_Interface*>(this)->execute();
+  return feature()->data()->name();
+}
 
-  return ModelHighAPI_Selection(feature()->firstResult());
+ModelHighAPI_Selection ModelHighAPI_Interface::result() const
+{
+  std::list<ModelHighAPI_Selection> aResults = results();
+  if (aResults.empty())
+    return ModelHighAPI_Selection(std::shared_ptr<ModelAPI_Result>());
+  return aResults.front();
 }
 
 std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::results() const
@@ -105,7 +113,8 @@ std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::results() const
 
   std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
   for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
-    aSelectionList.push_back(ModelHighAPI_Selection(*it));
+    if (!(*it)->isDisabled())
+      aSelectionList.push_back(ModelHighAPI_Selection(*it));
   }
 
   return aSelectionList;