Salome HOME
Correction for reentrant tangent arc
[modules/shaper.git] / src / ModuleBase / ModuleBase_OperationFeature.cpp
index 6066fa00aad09503d83ac9e08e6a51ab03402075..450e52399e20a9af5b0c8a22471538df6adeb997 100755 (executable)
@@ -448,30 +448,30 @@ FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature()
   return myPreviousCurrentFeature;
 }
 
-void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelection,
-                                         ModuleBase_IViewer* theViewer)
+void ModuleBase_OperationFeature::initSelection(const QList<ModuleBase_ViewerPrsPtr>& thePreSelected)
 {
-  QList<ModuleBase_ViewerPrsPtr> aPreSelected;
+  QObjectPtrList aCurrentFeatureResults;
+
   // Check that the selected result are not results of operation feature
   FeaturePtr aFeature = feature();
   if (aFeature) {
-    QList<ModuleBase_ViewerPrsPtr> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
-
     std::list<ResultPtr> aResults;
     ModelAPI_Tools::allResults(aFeature, aResults);
-    QObjectPtrList aResList;
     std::list<ResultPtr>::const_iterator aIt;
     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
-      aResList.append(*aIt);
-
-    foreach (ModuleBase_ViewerPrsPtr aPrs, aSelected) {
-      if ((!aResList.contains(aPrs->object())) && (aPrs->object() != aFeature))
+      aCurrentFeatureResults.append(*aIt);
+  }
+  
+  if (aCurrentFeatureResults.empty()) /// filtering of selection is not necessary
+    setPreselection(thePreSelected);
+  else { // create preselection list without results of current feature
+    QList<ModuleBase_ViewerPrsPtr> aPreSelected;
+    foreach (ModuleBase_ViewerPrsPtr aPrs, thePreSelected) {
+      if ((!aCurrentFeatureResults.contains(aPrs->object())) && (aPrs->object() != aFeature))
         aPreSelected.append(aPrs);
     }
-  } else
-    aPreSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
-
-  setPreselection(aPreSelected);
+    setPreselection(aPreSelected);
+  }
 }
 
 void ModuleBase_OperationFeature::setPreselection(const QList<ModuleBase_ViewerPrsPtr>& theValues)
@@ -497,6 +497,7 @@ void ModuleBase_OperationFeature::setPropertyPanel(ModuleBase_IPropertyPanel* th
     for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
       ModuleBase_ModelWidget* aWgt = (*aWIt);
       connect(aWgt, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged()));
+      connect(aWgt, SIGNAL(valueStateChanged(int)), this, SLOT(onValueStateChanged(int)));
     }
   }