#include <ModuleBase_Tools.h>
#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_IModule.h>
#include <ModuleBase_ISelection.h>
#include <ModuleBase_IPropertyPanel.h>
}
//**********************************************************************************
-void CollectionPlugin_WidgetField::onSelectionChanged()
+bool CollectionPlugin_WidgetField::
+ setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues, const bool theToValidate)
{
- //if (isEditingMode())
- // return;
-
if (myActivation) {
myActivation = false;
- return;
+ return false;
}
// Ignore selection for Parts mode
if (myShapeTypeCombo->currentIndex() == 5)
- return;
-
- QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
-
+ return false;
+
+ QList<ModuleBase_ViewerPrsPtr> aSelected;
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt;
+ for (anIt = theValues.begin(); anIt != theValues.end(); anIt++) {
+ ModuleBase_ViewerPrsPtr aValue = *anIt;
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aValue->object());
+ if (theToValidate && aRes.get() && acceptSubShape(aValue->shape(), aRes))
+ aSelected.append(aValue);
+ }
AttributeSelectionListPtr aSelList =
myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
aSelList->setSelectionType(getSelectionType(myShapeTypeCombo->currentIndex()));
}
}
}
- emit valuesChanged();
+ return true;
}
//**********************************************************************************
/// The methiod called when widget is deactivated
virtual void deactivate();
+ /// Set the given wrapped value to the current widget
+ /// This value should be processed in the widget according to the needs
+ /// \param theValues the wrapped selection values
+ /// \param theToValidate a validation of the values flag
+ virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ const bool theToValidate);
+
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
/// a shape. If the attribute do not uses the shape, it is empty
virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
-protected slots:
- /// Slot which is called on selection event
- virtual void onSelectionChanged();
-
private slots:
/// Slot called on number of component changed
/// \param theVal - a new components number