X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelection.cpp;h=f610b3dbefb7161ab8e292fcfac57b0dfd7e6539;hb=ecec337d46d54cb79cbca6233fb93449513603af;hp=f418c7b776d61e0ab9c38747e1977d9a634c4d9e;hpb=1584eaee10630d284f2f5226e99dea810f2b736e;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index f418c7b77..f610b3dbe 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -76,7 +76,7 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext, else if (theContext->groupName() == ModelAPI_ResultConstruction::group()) selectConstruction(theContext, theSubShape); - std::string aSelName = buildSubShapeName(theSubShape, theContext); + std::string aSelName = namingName(); if(!aSelName.empty()) TDataStd_Name::Set(selectionLabel(), aSelName.c_str()); //set name @@ -501,14 +501,18 @@ bool isTrivial (const TopTools_ListOfShape& theAncestors, TopTools_IndexedMapOfS if(aNumber > 1) return false; return true; } -std::string Model_AttributeSelection::buildSubShapeName(std::shared_ptr theSubShape, - const ResultPtr& theContext) +std::string Model_AttributeSelection::namingName()//std::shared_ptr theSubShape, + // const ResultPtr& theContext) { + std::shared_ptr aSubSh = value(); + ResultPtr aCont = context(); std::string aName; - if(theSubShape->isNull() || theContext->shape()->isNull()) return aName; - TopoDS_Shape aSubShape = theSubShape->impl(); - TopoDS_Shape aContext = theContext->shape()->impl(); - std::shared_ptr aDoc = std::dynamic_pointer_cast(theContext->document()); + if(!aSubSh.get() || aSubSh->isNull() || !aCont.get() || aCont->shape()->isNull()) + return aName; + TopoDS_Shape aSubShape = aSubSh->impl(); + TopoDS_Shape aContext = aCont->shape()->impl(); + std::shared_ptr aDoc = + std::dynamic_pointer_cast(aCont->document()); // check if the subShape is already in DF aName = GetShapeName(aDoc, aSubShape, selectionLabel()); @@ -611,7 +615,8 @@ std::string Model_AttributeSelection::buildSubShapeName(std::shared_ptraddNamingName(selectionLabel(), aName); + // aDoc->addNamingName(selectionLabel(), aName); + // the selected sub-shape will not be shared and as result it will not require registration } return aName; }