X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=170190ef66879e1e44f82e71e4be35340ea4f2ca;hb=a77dbd7613ee788b69415a11c06542387f38371b;hp=56ce94f9db49b46460f7c23248770696f04cd80a;hpb=5c5f84231a62cf183b4bdbcc3030003a0ac6bdc5;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 56ce94f9d..170190ef6 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -293,17 +293,19 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, const std::shared_ptr& theSubShape, const bool theTemporarily) { - ResultPtr aResCont = std::dynamic_pointer_cast(theContext); if (myIsCashed) { // the cashing is active - if (aResCont.get()) { - std::map > >::iterator aContext = - myCash.find(aResCont); + if (theContext.get()) { + std::map > >::iterator aContext = + myCash.find(theContext); if (aContext != myCash.end()) { // iterate shapes because "isSame" method must be called for each shape std::list >::iterator aShapes = aContext->second.begin(); for(; aShapes != aContext->second.end(); aShapes++) { if (!theSubShape.get()) { - if (!aShapes->get() || (*aShapes)->isSame(aContext->first->shape())) + if (!aShapes->get()) + return true; + ResultPtr aRes = std::dynamic_pointer_cast(aContext->first); + if (aRes.get() && (*aShapes)->isSame(aRes->shape())) return true; } else { // we need to call here isSame instead of isEqual to do not check shapes orientation @@ -316,15 +318,21 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, } } // no-cash method + bool isFeature = std::dynamic_pointer_cast(theContext).get() != NULL; + ResultPtr aRes; + if (!isFeature) + aRes = std::dynamic_pointer_cast(theContext); for(int anIndex = size() - 1; anIndex >= 0; anIndex--) { AttributeSelectionPtr anAttr = value(anIndex); if (anAttr.get()) { - if (anAttr->context() == theContext) { // contexts are equal, so, check that values are also + if (isFeature && anAttr->contextFeature() == theContext) + return true; // for the feature value should not be compared + if (!isFeature && anAttr->context() == theContext) { + // contexts are equal, so, check that values are also std::shared_ptr aValue = anAttr->value(); if (!theSubShape.get()) { - if (!aValue.get() || (aResCont.get() && aValue->isSame(aResCont->shape()))) {// both null + if (!aValue.get() || (aRes.get() && aValue->isSame(aRes->shape()))) return true; - } } else { // we need to call here isSame instead of isEqual to do not check shapes orientation if (isIn(aValue, theSubShape)) // shapes are equal