+ // restore selection in the attribute. Indeed there is only one stored object
+ int aCountAppened = aSelectionListAttr->size() - mySelectionCount;
+ for (int i = 0; i < aCountAppened; i++)
+ aSelectionListAttr->removeLast();
+ }
+ else if (aType == ModelAPI_AttributeRefList::typeId()) {
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ // restore objects in the attribute. Indeed there is only one stored object
+ int aCountAppened = aRefListAttr->size() - mySelectionCount;
+ for (int i = 0; i < aCountAppened; i++)
+ aRefListAttr->removeLast();
+ }
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::clearAttribute()
+{
+ AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+ std::string aType = anAttribute->attributeType();
+ if (aType == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ aSelectionListAttr->clear();
+ }
+ else if (aType == ModelAPI_AttributeRefList::typeId()) {
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ aRefListAttr->clear();
+ }
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject,
+ GeomShapePtr theShape)
+{
+ AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+ std::string aType = anAttribute->attributeType();
+ if (aType == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theSelectedObject);
+ aSelectionListAttr->append(aResult, theShape, myIsInValidate);
+ }
+ else if (aType == ModelAPI_AttributeRefList::typeId()) {
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ aRefListAttr->append(theSelectedObject);
+ }
+}
+
+//********************************************************************
+bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+ const bool theToValidate)
+{
+ QList<ModuleBase_ViewerPrs> aSkippedValues;
+
+ QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+ bool isDone = false;
+ for (; anIt != aLast; anIt++) {
+ ModuleBase_ViewerPrs aValue = *anIt;
+ bool aProcessed = false;
+ if (!theToValidate || isValidInFilters(aValue)) {
+ aProcessed = setSelectionCustom(aValue);