X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelection.cpp;h=232ff61b558ead55e47049e9d23208513d06c975;hb=a83e22046c5fb877969fa8879e42491d4054f198;hp=7bc7217dcfca8e0ca54dd9925cdd4771e066e29f;hpb=fe99ede03e3a112947a8964650b427b8b8988427;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 7bc7217dc..232ff61b5 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -200,7 +200,6 @@ std::shared_ptr Model_AttributeSelection::value() return aResult; // empty result } if (aSelLab.IsAttribute(kPART_REF_ID)) { - /* TODO: implement used text here ResultPartPtr aPart = std::dynamic_pointer_cast(context()); if (!aPart.get() || !aPart->isActivated()) return std::shared_ptr(); // postponed naming needed @@ -208,11 +207,12 @@ std::shared_ptr Model_AttributeSelection::value() if (selectionLabel().FindAttribute(TDataStd_Integer::GetID(), anIndex)) { return aPart->selectionValue(anIndex->Get()); } + /* Handle(TDataStd_Name) aName; if (!selectionLabel().FindAttribute(TDataStd_Name::GetID(), aName)) { return std::shared_ptr(); // something is wrong } - return aPart->shapeInPart(TCollection_AsciiString(aName).ToCString()); + return aPart->shapeInPart(TCollection_AsciiString(aName->Get()).ToCString()); */ } @@ -873,6 +873,24 @@ void Model_AttributeSelection::selectSubShape( { if(theSubShapeName.empty() || theType.empty()) return; + // check this is Part-name: 2 delimiters in the name + std::size_t aPartEnd = theSubShapeName.find('/'); + if (aPartEnd != string::npos && aPartEnd != theSubShapeName.rfind('/')) { + std::string aPartName = theSubShapeName.substr(0, aPartEnd); + ObjectPtr aFound = owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName); + if (aFound.get()) { // found such part, so asking it for the name + ResultPartPtr aPart = std::dynamic_pointer_cast(aFound); + string aNameInPart = theSubShapeName.substr(aPartEnd + 1); + int anIndex; + std::shared_ptr aSelected = aPart->shapeInPart(aNameInPart, theType, anIndex); + if (aSelected.get()) { + setValue(aPart, aSelected); + TDataStd_Integer::Set(selectionLabel(), anIndex); + return; + } + } + } + Model_SelectionNaming aSelNaming(selectionLabel()); std::shared_ptr aDoc = std::dynamic_pointer_cast(owner()->document());