Salome HOME
Restore selection in the viewer by multi selector widget activation.
[modules/shaper.git] / src / Model / Model_Data.cpp
index 53444bb6d45845a17f5d46e7d783fec7fa0bb36f..e2ef4c7477e1357cfae8ae05164661d08040f092 100644 (file)
@@ -29,6 +29,7 @@
 #include <Events_Error.h>
 
 #include <TDataStd_Name.hxx>
+#include <TDataStd_AsciiString.hxx>
 #include <TDF_AttributeIterator.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDF_RelocationTable.hxx>
@@ -239,10 +240,22 @@ ModelAPI_ExecState Model_Data::execState()
   return ModelAPI_StateMustBeUpdated; // default value
 }
 
-void Model_Data::setError(const std::string& theError)
+void Model_Data::setError(const std::string& theError, bool theSend)
 {
   execState(ModelAPI_StateExecFailed);
-  Events_Error::send(theError);
+  if (theSend) {
+    Events_Error::send(theError);
+  }
+  TDataStd_AsciiString::Set(myLab, theError.c_str());
+}
+
+std::string Model_Data::error() const
+{
+  Handle(TDataStd_AsciiString) anErrorAttr;
+  if (myLab.FindAttribute(TDataStd_AsciiString::GetID(), anErrorAttr)) {
+    return std::string(anErrorAttr->Get().ToCString());
+  }
+  return std::string();
 }
 
 int Model_Data::featureId() const
@@ -266,11 +279,6 @@ void Model_Data::removeBackReference(FeaturePtr theFeature, std::string theAttrI
     return;
 
   myRefsToMe.erase(anAttribute);
-  // TODO: check whether the concealed should be thrown down to the false value
-  std::shared_ptr<ModelAPI_Result> aRes = 
-    std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
-  if (aRes)
-    aRes->setIsConcealed(false);
 }
 
 void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID,