From: mpv Date: Tue, 10 Sep 2019 07:25:47 +0000 (+0300) Subject: Task #3005 : To be able to create a group on a whole result. Initial ability from... X-Git-Tag: V9_4_0a2~4^2~121 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5c5f84231a62cf183b4bdbcc3030003a0ac6bdc5;p=modules%2Fshaper.git Task #3005 : To be able to create a group on a whole result. Initial ability from the data model. --- diff --git a/src/CollectionPlugin/CollectionPlugin_Group.cpp b/src/CollectionPlugin/CollectionPlugin_Group.cpp index cd5ef4108..82926ab21 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Group.cpp @@ -32,8 +32,9 @@ CollectionPlugin_Group::CollectionPlugin_Group() void CollectionPlugin_Group::initAttributes() { - data()->addAttribute(CollectionPlugin_Group::LIST_ID(), - ModelAPI_AttributeSelectionList::typeId()); + AttributeSelectionListPtr aList = std::dynamic_pointer_cast( + data()->addAttribute(LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + aList->setWholeResultAllowed(true); // allow to select the whole result } void CollectionPlugin_Group::execute() diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 50b04d3c3..56ce94f9d 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -398,7 +398,7 @@ bool Model_AttributeSelectionList::isInitialized() } Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel) -: myLab(theLabel) +: ModelAPI_AttributeSelectionList(), myLab(theLabel) { reinit(); } diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp index 820d33baf..d7d7a4435 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp @@ -27,7 +27,3 @@ std::string ModelAPI_AttributeSelectionList::attributeType() ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() { } - -MODELAPI_EXPORT ModelAPI_AttributeSelectionList::ModelAPI_AttributeSelectionList() -{ -} diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.h b/src/ModelAPI/ModelAPI_AttributeSelectionList.h index 4280f613a..a88017e34 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.h +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.h @@ -35,6 +35,10 @@ class GeomAPI_Shape; class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute { + /// Flag that indicates that the whole result selection is allowed while the selection type + /// may be sub-objects, so, it is the same as all sub-shapes are selected (#3005). It is "false" + /// by default. + bool myIsWholeResultAllowed; public: /// Adds the new reference to the end of the list /// \param theContext object where the sub-shape was selected @@ -121,9 +125,20 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute /// Sets a selection filters feature if it is defined for this selection list MODELAPI_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature) = 0; + /// Returns true if the whole result selection corresponds to selection of all sub-shapes. + MODELAPI_EXPORT virtual const bool isWholeResultAllowed() const { + return myIsWholeResultAllowed; + } + + /// Sets whether the whole result selection corresponds to selection of all sub-shapes. + MODELAPI_EXPORT virtual void setWholeResultAllowed(const bool theFlag) { + myIsWholeResultAllowed = theFlag; + } + protected: - /// Objects are created for features automatically - MODELAPI_EXPORT ModelAPI_AttributeSelectionList(); + /// Default constructor + MODELAPI_EXPORT ModelAPI_AttributeSelectionList() : ModelAPI_Attribute() + {myIsWholeResultAllowed = false;} };