X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Data.cpp;h=e3020d992e929c8f6d9d7577cf804bedec53809f;hb=refs%2Ftags%2FV_1.2.1;hp=e2ef4c7477e1357cfae8ae05164661d08040f092;hpb=b900918cef83bb82217e7221c7ff0ad9d8a6dbe9;p=modules%2Fshaper.git diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index e2ef4c747..e3020d992 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -39,6 +39,14 @@ // myLab contains: // TDataStd_Name - name of the object // TDataStd_Integer - state of the object execution +// TDataStd_BooleanArray - array of flags of this data: +// 0 - is in history or not +static const int kFlagInHistory = 0; +// 1 - is displayed or not +static const int kFlagDisplayed = 1; + +// invalid data +const static std::shared_ptr kInvalid(new Model_Data()); Model_Data::Model_Data() : mySendAttributeUpdated(true) { @@ -47,6 +55,13 @@ Model_Data::Model_Data() : mySendAttributeUpdated(true) void Model_Data::setLabel(TDF_Label theLab) { myLab = theLab; + // set or get the default flags + if (!myLab.FindAttribute(TDataStd_BooleanArray::GetID(), myFlags)) { + // set default values if not found + 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 + } } std::string Model_Data::name() @@ -294,7 +309,10 @@ void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID, ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) { std::shared_ptr aRes = std::dynamic_pointer_cast(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); } } @@ -369,3 +387,39 @@ void Model_Data::copyTo(std::shared_ptr theTarget) } } } + +bool Model_Data::isInHistory() +{ + return myFlags->Value(kFlagInHistory) == Standard_True; +} + +void Model_Data::setIsInHistory(const bool theFlag) +{ + return myFlags->SetValue(kFlagInHistory, theFlag); +} + +bool Model_Data::isDisplayed() +{ + return myFlags->Value(kFlagDisplayed) == Standard_True; +} + +void Model_Data::setDisplayed(const bool theDisplay) +{ + if (theDisplay != isDisplayed()) { + myFlags->SetValue(kFlagDisplayed, theDisplay); + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + aECreator->sendUpdated(myObject, EVENT_DISP); + } +} + +std::shared_ptr Model_Data::invalidPtr() +{ + return kInvalid; +} + +std::shared_ptr Model_Data::invalidData() +{ + return kInvalid; +}