]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Use pre-selection for shape selector
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 25 Sep 2014 11:10:30 +0000 (15:10 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 25 Sep 2014 11:10:30 +0000 (15:10 +0400)
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp

index d4294aa2bc02cc58e80a2f4ad7d7c617b5ca14f8..c4832dd8f70b7cb361e0a870d750b715004caaa6 100644 (file)
@@ -167,6 +167,15 @@ void ModuleBase_WidgetShapeSelector::onSelectionChanged()
 bool ModuleBase_WidgetShapeSelector::isAccepted(const ObjectPtr theResult) const
 {
   ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theResult);
+  if (myFeature) {
+    // We can not select a result of our feature
+    const std::list<boost::shared_ptr<ModelAPI_Result>>& aRes = myFeature->results();
+    std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aIt;
+    for (aIt = aRes.cbegin(); aIt != aRes.cend(); ++aIt) {
+      if ((*aIt) == aResult)
+        return false;
+    }
+  }
   boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
   if (!aShapePtr)
     return false;
@@ -227,6 +236,9 @@ void ModuleBase_WidgetShapeSelector::activateSelection(bool toActivate)
     connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
   else
     disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+
+  if (myWorkshop->selectedObjects().size() > 0)
+    onSelectionChanged();
 }
 
 //********************************************************************