X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=07e62e2bcf45bcad212b5e9c1995413d16e13bf7;hb=283433d9c2f39fbd332d6eba691b6a0cd875e29d;hp=8191553d15d588e3f0c1262a0aab7e07863e1b3b;hpb=56b43fa7eef0b09ec2e4c12532cf21e2021ca534;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 8191553d1..07e62e2bc 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -21,7 +21,8 @@ using namespace std; void Model_AttributeSelectionList::append( - const ResultPtr& theContext, const std::shared_ptr& theSubShape) + const ResultPtr& theContext, const std::shared_ptr& theSubShape, + const bool theTemporarily) { // do not use the degenerated edge as a shape, a list is not incremented in this case if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { @@ -41,7 +42,11 @@ void Model_AttributeSelectionList::append( } aNewAttr->setID(id()); mySize->Set(aNewTag); - aNewAttr->setValue(theContext, theSubShape); + aNewAttr->setValue(theContext, theSubShape, theTemporarily); + if (theTemporarily) + myTmpAttr = aNewAttr; + else + myTmpAttr.reset(); owner()->data()->sendAttributeUpdated(this); } @@ -71,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); } } @@ -93,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 @@ -109,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();