Salome HOME
Task 2.5 Show where the remaining degrees of freedom are (issue #2997)
[modules/shaper.git] / src / SketchSolver / SketchSolver_Manager.cpp
index 6f000ec6c8d91a46d443836ae7d4a8a231172ee9..a9d47533e95b12fb5cb18ad2dc632add3e8c13a5 100644 (file)
@@ -231,8 +231,8 @@ void SketchSolver_Manager::processEvent(
     if (aObjects.size() == 1) {
       std::set<ObjectPtr>::const_iterator aIt;
       for (aIt = aObjects.cbegin(); aIt != aObjects.cend(); aIt++) {
-        std::shared_ptr<SketchPlugin_Feature> aFeature =
-          std::dynamic_pointer_cast<SketchPlugin_Feature>(*aIt);
+        CompositeFeaturePtr aFeature =
+            std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aIt);
         if (aFeature) {
           SketchGroupPtr aGroup = findGroup(aFeature);
 
@@ -245,7 +245,7 @@ void SketchSolver_Manager::processEvent(
             aFeatures.push_back(*aIt);
           }
 
-          // TODO: send features to GUI
+          // send features to GUI
           static const Events_ID anEvent = Events_Loop::eventByName(EVENT_DOF_OBJECTS);
           ModelAPI_EventCreator::get()->sendUpdated(aFeatures, anEvent);
           Events_Loop::loop()->flush(anEvent);
@@ -382,7 +382,7 @@ bool SketchSolver_Manager::moveAttribute(
 //  Purpose:  search groups of entities interacting with given feature
 // ============================================================================
 SketchGroupPtr SketchSolver_Manager::findGroup(
-    std::shared_ptr<SketchPlugin_Feature> theFeature)
+  std::shared_ptr<SketchPlugin_Feature> theFeature)
 {
   if (!isFeatureValid(theFeature))
     return SketchGroupPtr(); // do not process wrong features
@@ -398,17 +398,21 @@ SketchGroupPtr SketchSolver_Manager::findGroup(
       break;
     }
   }
+  return findGroup(aSketch);
+}
 
-  if (!aSketch)
+SketchGroupPtr SketchSolver_Manager::findGroup(CompositeFeaturePtr theSketch)
+{
+  if (!theSketch)
     return SketchGroupPtr(); // not a sketch's feature
 
   std::list<SketchGroupPtr>::const_iterator aGroupIt;
   for (aGroupIt = myGroups.begin(); aGroupIt != myGroups.end(); ++aGroupIt)
-    if ((*aGroupIt)->getWorkplane() == aSketch)
+    if ((*aGroupIt)->getWorkplane() == theSketch)
       return *aGroupIt;
 
   // group for the sketch does not created yet
-  SketchGroupPtr aNewGroup = SketchGroupPtr(new SketchSolver_Group(aSketch));
+  SketchGroupPtr aNewGroup = SketchGroupPtr(new SketchSolver_Group(theSketch));
   myGroups.push_back(aNewGroup);
   return aNewGroup;
 }