X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=3b67df9eb0a9063e23a7874fde696432fdaa9857;hb=2e39226506e4b82f6ae5dcc26e776571801b1555;hp=000ba2b0d5565b4a9e11c06097c124e26a7f6529;hpb=b04995d04df6376eb662cd2ce52b64f59573a334;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 000ba2b0d..3b67df9eb 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -13,11 +13,24 @@ #include #include +#include +#include +#include +#include + using namespace std; void Model_AttributeSelectionList::append( const ResultPtr& theContext, const std::shared_ptr& theSubShape) { + // do not use the degenerated edge as a shape, a list is not incremented in this case + if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { + const TopoDS_Shape& aSubShape = theSubShape->impl(); + if (aSubShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) { + return; + } + } + int aNewTag = mySize->Get() + 1; TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); @@ -26,6 +39,7 @@ void Model_AttributeSelectionList::append( if (owner()) { aNewAttr->setObject(owner()); } + aNewAttr->setID(id()); mySize->Set(aNewTag); aNewAttr->setValue(theContext, theSubShape); owner()->data()->sendAttributeUpdated(this); @@ -88,6 +102,14 @@ void Model_AttributeSelectionList::clear() } } +bool Model_AttributeSelectionList::isInitialized() +{ + if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo + return false; + } + return ModelAPI_AttributeSelectionList::isInitialized(); +} + Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel) { myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), mySize) == Standard_True;