]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #478 Problem of performance with selection: using a flag about temprary append...
authornds <natalia.donis@opencascade.com>
Wed, 19 Aug 2015 11:48:39 +0000 (14:48 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 19 Aug 2015 11:49:25 +0000 (14:49 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h

index 362d3d8a35f086054a58e39d25a2a830e90c36bf..242b05c8c6be8b711988556a9ea64e470021a0cc 100644 (file)
 #include <memory>
 #include <string>
 
-//#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<ModelAPI_Result>(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<ModelAPI_AttributeSelectionList>(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
 }
 
 //********************************************************************
index 03e07588280b8c813be2872da1a872a59c3d6dff..5a86bdfa3354115c97ab4a070a24f5f4da2a669a 100644 (file)
@@ -162,7 +162,6 @@ protected:
   std::string mySelectionType;
 
   /// Variable of GeomSelection
-  QList<GeomSelection> 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