From 9f11a35572f9d5ad90fee25422a51073039b4bd6 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 24 Sep 2018 19:25:02 +0300 Subject: [PATCH] Add check box "Add elements that share the same topology" --- src/CollectionPlugin/group_widget.xml | 3 ++- .../ModuleBase_WidgetMultiSelector.cpp | 23 ++++++++++++++++++- .../ModuleBase_WidgetMultiSelector.h | 5 ++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/CollectionPlugin/group_widget.xml b/src/CollectionPlugin/group_widget.xml index 4696d9e79..f892893bb 100644 --- a/src/CollectionPlugin/group_widget.xml +++ b/src/CollectionPlugin/group_widget.xml @@ -29,7 +29,8 @@ email : webmaster.salome@opencascade.com + filter_points="false" + same_topology="true"> \ No newline at end of file diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index d81556ac1..6af9a7a9d 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -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); + } +} diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 1a40c1303..4c2898107 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -37,6 +37,7 @@ #include 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_ */ -- 2.39.2