Salome HOME
Add check box "Add elements that share the same topology"
authorvsv <vsv@opencascade.com>
Mon, 24 Sep 2018 16:25:02 +0000 (19:25 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/CollectionPlugin/group_widget.xml
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h

index 4696d9e790ce3ce22d81dcecab882b42034414e5..f892893bb12d716c006e748d865c5da21740bf13 100644 (file)
@@ -29,7 +29,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     type_choice="Vertices Edges Faces Solids"
     use_choice="true"
     clear_in_neutral_point="false"
-    filter_points="false" >
+    filter_points="false"
+    same_topology="true">
     <validator id="GeomValidators_BodyShapes"/>
   </multi_selector>
 </source>
\ No newline at end of file
index d81556ac18bbdd20b80d2ec258f5de0cf3632ecc..6af9a7a9d51d9823dcc65f549a30b7cb3524d0e1 100755 (executable)
@@ -62,6 +62,7 @@
 #include <QClipboard>
 #include <QTimer>
 #include <QMainWindow>
+#include <QCheckBox>
 
 #include <memory>
 #include <string>
@@ -164,6 +165,15 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   //this->setLayout(aMainLay);
   connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
 
+  bool aSameTop = theData->getBooleanAttribute("same_topology", false);
+  if (aSameTop) {
+    myGeomCheck = new QCheckBox(tr("Add elements that share the same topology"), this);
+    aMainLay->addWidget(myGeomCheck);
+    connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool)));
+  }
+  else
+    myGeomCheck = 0;
+
   myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
   if (myShapeTypes.size() > 1 || myIsUseChoice) {
     if (defaultValues.contains(myFeatureId + attributeID())) {
@@ -1040,4 +1050,15 @@ void ModuleBase_WidgetMultiSelector::onListActivated()
 {
   //focusTo();
   emitFocusInWidget();
-}
\ No newline at end of file
+}
+
+void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn)
+{
+  AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+  std::string aType = anAttribute->attributeType();
+  if (aType == ModelAPI_AttributeSelectionList::typeId()) {
+    AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+    //TODO: set same topology flag
+    updateObject(myFeature);
+  }
+}
index 1a40c13039cbd13a795a93da7441f84a470dd3db..4c2898107e52197f3cc3f1a899462ff0514ae699 100755 (executable)
@@ -37,6 +37,7 @@
 #include <QMap>
 
 class QWidget;
+class QCheckBox;
 //class QComboBox;
 class ModuleBase_ListView;
 class ModuleBase_IWorkshop;
@@ -132,6 +133,8 @@ protected slots:
 
   void onListActivated();
 
+  void onSameTopology(bool theOn);
+
 protected:
   /// Returns true if the event is processed. The default implementation is empty, returns false.
   virtual bool processDelete();
@@ -247,6 +250,8 @@ protected:
 
   bool myIsFirst;
   std::string myDefMode;
+
+  QCheckBox* myGeomCheck;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */