From: mpv Date: Wed, 19 Aug 2015 12:53:46 +0000 (+0300) Subject: Fix for working with temporary selection attribute X-Git-Tag: V_1.4.0_beta4~339 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b010cb80fdec65b26fb76284fbfe9bfb8edc006e;p=modules%2Fshaper.git Fix for working with temporary selection attribute --- diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 1d4725c22..07e62e2bc 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -43,6 +43,10 @@ void Model_AttributeSelectionList::append( aNewAttr->setID(id()); mySize->Set(aNewTag); aNewAttr->setValue(theContext, theSubShape, theTemporarily); + if (theTemporarily) + myTmpAttr = aNewAttr; + else + myTmpAttr.reset(); owner()->data()->sendAttributeUpdated(this); } @@ -72,6 +76,7 @@ void Model_AttributeSelectionList::removeLast() aOldAttr->setObject(owner()); REMOVE_BACK_REF(aOldAttr->context()); aLab.ForgetAllAttributes(Standard_True); + myTmpAttr.reset(); owner()->data()->sendAttributeUpdated(this); } } @@ -94,6 +99,9 @@ void Model_AttributeSelectionList::setSelectionType(const std::string& theType) std::shared_ptr Model_AttributeSelectionList::value(const int theIndex) { + if (myTmpAttr.get() && theIndex == size() - 1) { + return myTmpAttr; + } TDF_Label aLabel = mySize->Label().FindChild(theIndex + 1); // create a new attribute each time, by demand // supporting of old attributes is too slow (synch each time) and buggy on redo @@ -110,6 +118,7 @@ void Model_AttributeSelectionList::clear() { if (mySize->Get() != 0) { mySize->Set(0); + myTmpAttr.reset(); TDF_ChildIterator aSubIter(mySize->Label()); for(; aSubIter.More(); aSubIter.Next()) { TDF_Label aLab = aSubIter.Value(); diff --git a/src/Model/Model_AttributeSelectionList.h b/src/Model/Model_AttributeSelectionList.h index 676737116..55dad109f 100644 --- a/src/Model/Model_AttributeSelectionList.h +++ b/src/Model/Model_AttributeSelectionList.h @@ -24,6 +24,7 @@ class Model_AttributeSelectionList : public ModelAPI_AttributeSelectionList { Handle(TDataStd_Integer) mySize; ///< Contains size of this list Handle(TDataStd_Comment) mySelectionType; ///< Contains current type name (same as selection attribute) + std::shared_ptr myTmpAttr; ///< temporary attribute (the last one) public: /// Adds the new reference to the end of the list /// \param theContext object where the sub-shape was selected