From: nds Date: Fri, 26 Feb 2016 14:38:43 +0000 (+0300) Subject: #1330 Multiply selection when Create fillet using Shift button X-Git-Tag: V_2.2.0~57 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1a59f21be05badd17bcac9ce82b2857b961f1d2e;p=modules%2Fshaper.git #1330 Multiply selection when Create fillet using Shift button --- diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index b44767750..a049b9123 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -141,6 +141,13 @@ int Model_AttributeSelectionList::size() return mySize->Get(); } +bool Model_AttributeSelectionList::isInList(const ResultPtr& theContext, + const std::shared_ptr& theSubShape, + const bool theTemporarily) +{ + return false; +} + const std::string Model_AttributeSelectionList::selectionType() const { return TCollection_AsciiString(mySelectionType->Get()).ToCString(); diff --git a/src/Model/Model_AttributeSelectionList.h b/src/Model/Model_AttributeSelectionList.h index a69635c4b..d28798dda 100644 --- a/src/Model/Model_AttributeSelectionList.h +++ b/src/Model/Model_AttributeSelectionList.h @@ -49,6 +49,14 @@ public: /// Returns the number ofselection attributes in the list MODEL_EXPORT virtual int size(); + /// Returns true if the object with the shape are in list + /// \param theContext object where the sub-shape was selected + /// \param theSubShape selected sub-shape (if null, the whole context is selected) + /// \returns true if the pair is found in the attirbute + MODEL_EXPORT virtual bool isInList( + const ResultPtr& theContext, const std::shared_ptr& theSubShape, + const bool theTemporarily = false); + /// The type of all elements selection /// \returns the index of the OCCT enumeration of the type of shape MODEL_EXPORT virtual const std::string selectionType() const; diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.h b/src/ModelAPI/ModelAPI_AttributeSelectionList.h index 0c875c336..b5d1ff466 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.h +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.h @@ -42,6 +42,14 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute /// Returns the number of selection attributes in the list virtual int size() = 0; + /// Returns true if the object with the shape are in list + /// \param theContext object where the sub-shape was selected + /// \param theSubShape selected sub-shape (if null, the whole context is selected) + /// \returns true if the pair is found in the attirbute + virtual bool isInList( + const ResultPtr& theContext, const std::shared_ptr& theSubShape, + const bool theTemporarily = false) = 0; + /// The type of all elements selection /// \returns the index of the enumeration of the type of shape virtual const std::string selectionType() const = 0; diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 2a999aeb2..92caad3a6 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -281,12 +281,12 @@ void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject, if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); ResultPtr aResult = std::dynamic_pointer_cast(theSelectedObject); - //if (!aSelectionListAttr->isInList(aResult, theShape, myIsInValidate)) + if (!aSelectionListAttr->isInList(aResult, theShape, myIsInValidate)) aSelectionListAttr->append(aResult, theShape, myIsInValidate); } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); - //if (!aRefListAttr->isInList(theSelectedObject)) + if (!aRefListAttr->isInList(theSelectedObject)) aRefListAttr->append(theSelectedObject); } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { @@ -294,11 +294,11 @@ void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject, AttributePtr anAttribute = myWorkshop->module()->findAttribute(theSelectedObject, theShape); if (anAttribute.get()) { - //if (!aRefAttrListAttr->isInList(anAttribute)) + if (!aRefAttrListAttr->isInList(anAttribute)) aRefAttrListAttr->append(anAttribute); } else { - //if (!aRefAttrListAttr->isInList(theSelectedObject)) + if (!aRefAttrListAttr->isInList(theSelectedObject)) aRefAttrListAttr->append(theSelectedObject); } }