Salome HOME
Merge branch 'MessagesGroups' of newgeom:newgeom into MessagesGroups
authornds <natalia.donis@opencascade.com>
Thu, 22 May 2014 12:01:47 +0000 (16:01 +0400)
committernds <natalia.donis@opencascade.com>
Thu, 22 May 2014 12:01:47 +0000 (16:01 +0400)
Conflicts:
src/SketchSolver/SketchSolver_ConstraintManager.cpp

1  2 
src/SketchSolver/SketchSolver_ConstraintManager.cpp

index ab6786fa77582acd003b0c1b4bd9493b2e1e9c0d,dba0d550c36942d1b7a8bb3e304db6a255347016..7e9292037c4192003ad5a1cb68f0c05658ec1462
@@@ -72,31 -75,44 +75,44 @@@ SketchSolver_ConstraintManager::~Sketch
  void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessage)
  {
    if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED) ||
-       theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED))
+       theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED) || 
 -      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_MOVED))
++      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED))
    {
-     const Model_FeatureUpdatedMessage* aUpdateMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+     const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+     std::set< boost::shared_ptr<ModelAPI_Feature> > aFeatures = anUpdateMsg->features();
  
-     // Only sketches and constraints can be added by Create event
-     const std::string& aFeatureKind = aUpdateMsg->feature()->getKind();
-     if (aFeatureKind.compare("Sketch") == 0)
 -    bool isModifiedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_MOVED);
++    bool isModifiedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED);
+     if (!isModifiedEvt)
      {
-       boost::shared_ptr<SketchPlugin_Feature> aSketch =
-         boost::dynamic_pointer_cast<SketchPlugin_Feature>(aUpdateMsg->feature());
-       changeWorkplane(aSketch);
-       return ;
-     }
-     boost::shared_ptr<SketchPlugin_Constraint> aConstraint =
-       boost::dynamic_pointer_cast<SketchPlugin_Constraint>(aUpdateMsg->feature());
-     if (aConstraint)
-       changeConstraint(aConstraint);
-     else
-     {
-       // Sketch plugin features can be only updated
-       boost::shared_ptr<SketchPlugin_Feature> aFeature =
-         boost::dynamic_pointer_cast<SketchPlugin_Feature>(aUpdateMsg->feature());
-       if (aFeature)
-         updateEntity(aFeature);
+       std::set< boost::shared_ptr<ModelAPI_Feature> >::iterator aFeatIter;
+       for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++)
+       {
+         // Only sketches and constraints can be added by Create event
+         const std::string& aFeatureKind = (*aFeatIter)->getKind();
+         if (aFeatureKind.compare("Sketch") == 0)
+         {
+           boost::shared_ptr<SketchPlugin_Feature> aSketch =
+             boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
+           changeWorkplane(aSketch);
+           return ;
+         }
+         boost::shared_ptr<SketchPlugin_Constraint> aConstraint =
+           boost::dynamic_pointer_cast<SketchPlugin_Constraint>(*aFeatIter);
+         if (aConstraint)
+           changeConstraint(aConstraint);
+         else
+         {
+           // Sketch plugin features can be only updated
+           boost::shared_ptr<SketchPlugin_Feature> aFeature =
+             boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
+           if (aFeature)
+             updateEntity(aFeature);
+         }
+       }
      }
+     // Solve the set of constraints
+     resolveConstraints(isModifiedEvt);
    }
    else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_DELETED))
    {