]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
Salome HOME
Add check box "Add elements that share the same topology"
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
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);
+  }
+}