]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added geometrical selection flag to attribute selection list.
authordbv <dbv@opencascade.com>
Tue, 6 Nov 2018 13:48:32 +0000 (16:48 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelectionList.cpp
src/Model/Model_AttributeSelectionList.h
src/ModelAPI/ModelAPI_AttributeSelectionList.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp

index 4b9b6e97f4d187cbd19c069e23b7767c38e905ab..7bb436eeead70794300a36aa0ef3e848113eb885 100644 (file)
@@ -447,7 +447,8 @@ bool Model_AttributeSelection::isInitialized()
 }
 
 Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel)
-  : myRef(theLabel)
+: myRef(theLabel),
+  myIsGeometricalSelection(false)
 {
   myIsInitialized = myRef.isInitialized();
   myParent = NULL;
@@ -458,9 +459,12 @@ void Model_AttributeSelection::setID(const std::string theID)
   myRef.setID(theID);
   ModelAPI_AttributeSelection::setID(theID);
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-  // TODO: check if parent list have geometrical selection flag.
-  myIsGeometricalSelection =
-    ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+  if (myParent) {
+    myIsGeometricalSelection = myParent->isGeometricalSelection();
+  } else {
+    myIsGeometricalSelection =
+      ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+  }
 }
 
 ResultPtr Model_AttributeSelection::context()
index c231bfd0e2ef088a356ed57a4b5628b3223d8366..f32fbcf6396c0b6b8cd01a24cd9a6a819d99c203 100644 (file)
@@ -371,8 +371,9 @@ bool Model_AttributeSelectionList::isInitialized()
 }
 
 Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
+: myLab(theLabel),
+  myIsGeometricalSelection(false)
 {
-  myLab = theLabel;
   reinit();
 }
 
@@ -402,3 +403,11 @@ void Model_AttributeSelectionList::cashValues(const bool theEnabled)
     }
   }
 }
+
+void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeometricalSelection)
+{
+  myIsGeometricalSelection = theIsGeometricalSelection;
+  // TODO: update list accodring to the flag:
+  // false - all objects with same geometry must be splited in separate.
+  // true - all objets with same geometry must be combined into single.
+}
index ef33f6b165b97a8cd6a76ce2c6b18b90c3961901..1870d95d4a677971d1bc9f26c6e2ca0edb0076da 100644 (file)
@@ -113,6 +113,13 @@ public:
   /// during non-modification operations with this attribute)
   MODEL_EXPORT virtual void cashValues(const bool theEnabled);
 
+  MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
+
+  /// Returns true if is geometrical selection.
+  MODEL_EXPORT virtual bool isGeometricalSelection() const override {
+    return myIsGeometricalSelection;
+  };
+
 protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
index fe432944a2f7efe47803c52b3320300c797e8077..6f2cafb187c924e9893c15211c4bd1c02cb7ba4b 100644 (file)
@@ -98,6 +98,11 @@ class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute
   /// during non-modification operations with this attribute)
   virtual void cashValues(const bool theEnabled) = 0;
 
+  virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
+
+  /// Returns true if is geometrical selection.
+  virtual bool isGeometricalSelection() const = 0;
+
   /// Returns the type of this class of attributes
   static std::string typeId()
   {
index 6af9a7a9d51d9823dcc65f549a30b7cb3524d0e1..9a2007cd9f97174a00c3c898e953887035b85b6f 100755 (executable)
@@ -1059,6 +1059,7 @@ void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn)
   if (aType == ModelAPI_AttributeSelectionList::typeId()) {
     AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
     //TODO: set same topology flag
+    aSelectionListAttr->setGeometricalSelection(theOn);
     updateObject(myFeature);
   }
 }