From: nds Date: Wed, 19 Aug 2015 11:48:39 +0000 (+0300) Subject: Issue #478 Problem of performance with selection: using a flag about temprary append... X-Git-Tag: V_1.4.0_beta4~345 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=27f5d437794160b0c09e3dc6bb500c100e220245;p=modules%2Fshaper.git Issue #478 Problem of performance with selection: using a flag about temprary append selection when validating highligh. --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 362d3d8a3..242b05c8c 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -36,10 +36,6 @@ #include #include -//#define DEBUG_ATTRIBUTE_SELECTION - -//#define DEBUG_SHAPE_VALIDATION_PREVIOUS - class CustomListWidget : public QListWidget { public: @@ -68,7 +64,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen const Config_WidgetAPI* theData, const std::string& theParentId) : ModuleBase_WidgetSelector(theParent, theWorkshop, theData, theParentId), - mySelectionCount(0) + mySelectionCount(0), myIsInValidate(false) { QGridLayout* aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); @@ -152,8 +148,6 @@ bool ModuleBase_WidgetMultiSelector::storeValueCustom() const //******************************************************************** bool ModuleBase_WidgetMultiSelector::restoreValueCustom() { - myIsInValidate = false; - // A rare case when plugin was not loaded. if(!myFeature) return false; @@ -182,17 +176,7 @@ void ModuleBase_WidgetMultiSelector::storeAttributeValue() return; mySelectionType = aSelectionListAttr->selectionType(); - -#ifdef DEBUG_ATTRIBUTE_SELECTION - mySelection.clear(); - int aSize = aSelectionListAttr->size(); - for (int i = 0; i < aSelectionListAttr->size(); i++) { - AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); - mySelection.append(GeomSelection(aSelectAttr->context(), aSelectAttr->value())); - } -#else mySelectionCount = aSelectionListAttr->size(); -#endif } //******************************************************************** @@ -214,26 +198,14 @@ void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject, int aSelCount = aSelectionListAttr->size(); ResultPtr aResult = std::dynamic_pointer_cast(theSelectedObject); - aSelectionListAttr->append(aResult, theShape/*, myIsInValidate*/); + aSelectionListAttr->append(aResult, theShape, myIsInValidate); } //******************************************************************** void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/) { -#ifdef DEBUG_ATTRIBUTE_SELECTION - clearAttribute(); - - // Store shape type - DataPtr aData = myFeature->data(); - AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(aData->attribute(attributeID())); - aSelectionListAttr->setSelectionType(mySelectionType); + myIsInValidate = false; - // Store selection in the attribute - foreach (GeomSelection aSelec, mySelection) { - setObject(aSelec.first, aSelec.second); - } -#else // Store shape type DataPtr aData = myFeature->data(); AttributeSelectionListPtr aSelectionListAttr = @@ -244,7 +216,6 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/) int aCountAppened = aSelectionListAttr->size() - mySelectionCount; for ( int i = 0; i < aCountAppened; i++) aSelectionListAttr->removeLast(); -#endif } //******************************************************************** diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 03e075882..5a86bdfa3 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -162,7 +162,6 @@ protected: std::string mySelectionType; /// Variable of GeomSelection - QList mySelection; int mySelectionCount; // number of elements in the attribute selection list when store bool myIsInValidate; // the widget is in validation mode: store is performed, restore is not