Salome HOME
Prepare version 1.2.1: quick fix for iteration 2 release
[modules/shaper.git] / src / Model / Model_Data.cpp
index 608aedc7a131025393bc97779f4865107edc5427..e3020d992e929c8f6d9d7577cf804bedec53809f 100644 (file)
@@ -45,6 +45,9 @@ static const int kFlagInHistory = 0;
 //                             1 - is displayed or not
 static const int kFlagDisplayed = 1;
 
+// invalid data
+const static std::shared_ptr<ModelAPI_Data> kInvalid(new Model_Data());
+
 Model_Data::Model_Data() : mySendAttributeUpdated(true)
 {
 }
@@ -55,7 +58,7 @@ void Model_Data::setLabel(TDF_Label theLab)
   // set or get the default flags
   if (!myLab.FindAttribute(TDataStd_BooleanArray::GetID(), myFlags)) {
     // set default values if not found
-    Handle(TDataStd_BooleanArray) myFlags = TDataStd_BooleanArray::Set(myLab, 0, 1);
+    myFlags = TDataStd_BooleanArray::Set(myLab, 0, 1);
     myFlags->SetValue(kFlagInHistory, Standard_True); // is in history by default is true
     myFlags->SetValue(kFlagDisplayed, Standard_True); // is displayed by default is true
   }
@@ -306,7 +309,10 @@ void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID,
       ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {
     std::shared_ptr<ModelAPI_Result> aRes = 
       std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
-    if (aRes) {
+    // the second condition is for history upper than concealment causer, so the feature result may
+    // be displayed and previewed; also for avoiding of quick show/hide on history
+    // moving deep down
+    if (aRes && !theFeature->isDisabled()) {
       aRes->setIsConcealed(true);
     }
   }
@@ -407,3 +413,13 @@ void Model_Data::setDisplayed(const bool theDisplay)
     aECreator->sendUpdated(myObject, EVENT_DISP);
   }
 }
+
+std::shared_ptr<ModelAPI_Data> Model_Data::invalidPtr()
+{
+  return kInvalid;
+}
+
+std::shared_ptr<ModelAPI_Data> Model_Data::invalidData()
+{
+  return kInvalid;
+}