Salome HOME
Task #3005 : To be able to create a group on a whole result. Initial ability from...
authormpv <mpv@opencascade.com>
Tue, 10 Sep 2019 07:25:47 +0000 (10:25 +0300)
committermpv <mpv@opencascade.com>
Wed, 11 Sep 2019 06:58:44 +0000 (09:58 +0300)
src/CollectionPlugin/CollectionPlugin_Group.cpp
src/Model/Model_AttributeSelectionList.cpp
src/ModelAPI/ModelAPI_AttributeSelectionList.cpp
src/ModelAPI/ModelAPI_AttributeSelectionList.h

index cd5ef4108a6b27548f44d1dde74f2c319c8e0d81..82926ab21921946ac76ac567b84f900ec9eb16bb 100644 (file)
@@ -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<ModelAPI_AttributeSelectionList>(
+    data()->addAttribute(LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+  aList->setWholeResultAllowed(true); // allow to select the whole result
 }
 
 void CollectionPlugin_Group::execute()
index 50b04d3c35d967dd388f9b8637f60d340a5aa19f..56ce94f9db49b46460f7c23248770696f04cd80a 100644 (file)
@@ -398,7 +398,7 @@ bool Model_AttributeSelectionList::isInitialized()
 }
 
 Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
-: myLab(theLabel)
+: ModelAPI_AttributeSelectionList(), myLab(theLabel)
 {
   reinit();
 }
index 820d33baf99953578c573a0e04fa2fea909549a0..d7d7a4435b1dbba2da353b6674bab73d28bd1b49 100644 (file)
@@ -27,7 +27,3 @@ std::string ModelAPI_AttributeSelectionList::attributeType()
 ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList()
 {
 }
-
-MODELAPI_EXPORT ModelAPI_AttributeSelectionList::ModelAPI_AttributeSelectionList()
-{
-}
index 4280f613aa118f2cbc460041243d799bd41bc5d1..a88017e3412403701017112c1a31277e6e17f0f8 100644 (file)
@@ -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;}
 
 };