Salome HOME
Task 2.1. Management of result names
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Selection.cpp
index 0eb6c78c27b23106dae089b83f34bd8220b8569c..ec6201600f530f5f3ef4a4c4071115b15af0e8cf 100644 (file)
@@ -131,6 +131,16 @@ void ModelHighAPI_Selection::setName(const std::string& theName)
   }
 }
 
+std::string ModelHighAPI_Selection::name() const
+{
+  if (myVariantType == VT_ResultSubShapePair) {
+    std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
+    if (aResult.get())
+      return aResult->data()->name();
+  }
+  return std::string();
+}
+
 void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue)
 {
   if (myVariantType != VT_ResultSubShapePair || !myResultSubShapePair.first.get())