+ // Store selection in the attribute
+ int aSize = mySelection.size();
+ foreach (GeomSelection aSelec, mySelection) {
+ setObject(aSelec.first, aSelec.second);
+ }
+}
+
+//********************************************************************
+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);
+ }
+ else
+ aSkippedValues.append(aValue);
+ // if there is at least one set, the result is true
+ isDone = isDone || aProcessed;
+ }
+ // updateObject - to update/redisplay feature
+ // it is commented in order to perfom it outside the method
+ //if (isDone) {
+ //updateObject(myFeature);
+ // this emit is necessary to call store/restore method an restore type of selection
+ //emit valuesChanged();
+ //}
+ theValues.clear();
+ if (!aSkippedValues.empty())
+ theValues.append(aSkippedValues);
+
+ return isDone;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+{
+ bool aValid = ModuleBase_WidgetSelector::isValidSelectionCustom(thePrs);
+ if (aValid) {
+ ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
+ aValid = aResult.get() != NULL;
+ if (aValid) {
+ if (myFeature) {
+ // We can not select a result of our feature
+ const std::list<ResultPtr>& aResList = myFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ bool isSkipSelf = false;
+ for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) {
+ if ((*aIt) == aResult) {
+ isSkipSelf = true;
+ break;
+ }
+ }
+ if (isSkipSelf)
+ aValid = false;
+ }
+ }
+ }
+ return aValid;