From: nds Date: Thu, 28 Apr 2016 09:46:42 +0000 (+0300) Subject: Issue #1037 Time performance on a big model: validating is performed before the attri... X-Git-Tag: V_2.3.0~84 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=103163b0b106d348a17516658f5364a49a9b2344;p=modules%2Fshaper.git Issue #1037 Time performance on a big model: validating is performed before the attribute selection list is filled to avoid checking already checked elements(ShapeType validator checks all elements of attribute selection list) --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index a4dc15377..ab940f015 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -220,22 +220,27 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom() bool ModuleBase_WidgetMultiSelector::setSelection(QList& theValues, const bool theToValidate) { - QList aSkippedValues; - /// remove unused objects from the model attribute. /// It should be performed before new attributes append. removeUnusedAttributeObjects(theValues); + QList anInvalidValues; QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); - bool isDone = false; for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aValue = *anIt; bool aProcessed = false; - if (!theToValidate || isValidInFilters(aValue)) { - aProcessed = setSelectionCustom(aValue); - } - else - aSkippedValues.append(aValue); + if (theToValidate && !isValidInFilters(aValue)) + anInvalidValues.append(aValue); + } + bool aHasInvalidValues = anInvalidValues.size() > 0; + + bool isDone = false; + for (anIt = theValues.begin(); anIt != aLast; anIt++) { + ModuleBase_ViewerPrsPtr aValue = *anIt; + bool aProcessed = false; + if (aHasInvalidValues && anInvalidValues.contains(aValue)) + continue; + aProcessed = setSelectionCustom(aValue); // if there is at least one set, the result is true isDone = isDone || aProcessed; } @@ -248,8 +253,8 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList //} theValues.clear(); - if (!aSkippedValues.empty()) - theValues.append(aSkippedValues); + if (!anInvalidValues.empty()) + theValues.append(anInvalidValues); return isDone; }