X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintManager.cpp;h=ef725b5633fe6ddc5eb464c7313c3b84b018b737;hb=61cd0845b41710ad4e7eae07cc6106904be67b9f;hp=79616858f5a292c628dc9dbe717d8fad6785bc96;hpb=0d245288551534bd4327b2be5709a46e7debd28d;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 79616858f..ef725b563 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -82,6 +82,9 @@ void SketchSolver_ConstraintManager::processEvent( std::dynamic_pointer_cast(theMessage); std::set aFeatures = anUpdateMsg->objects(); + // Shows the message has at least one feature applicable for solver + bool hasProperFeature = false; + bool isMovedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED); if (isMovedEvt) { @@ -89,8 +92,10 @@ void SketchSolver_ConstraintManager::processEvent( for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) { std::shared_ptr aSFeature = std::dynamic_pointer_cast(*aFeatIter); - if (aSFeature) + if (aSFeature) { moveEntity(aSFeature); + hasProperFeature = true; + } } } else { std::set::iterator aFeatIter; @@ -103,7 +108,7 @@ void SketchSolver_ConstraintManager::processEvent( if (aFeatureKind.compare(SketchPlugin_Sketch::ID()) == 0) { std::shared_ptr aSketch = std::dynamic_pointer_cast< ModelAPI_CompositeFeature>(aFeature); - changeWorkplane(aSketch); + hasProperFeature = changeWorkplane(aSketch) || hasProperFeature; } } // then get anything but not the sketch @@ -118,7 +123,7 @@ void SketchSolver_ConstraintManager::processEvent( aComplexConstraints.insert(aFeature); continue; } - changeConstraintOrEntity(aFeature); + hasProperFeature = changeConstraintOrEntity(aFeature) || hasProperFeature; } // processing remain constraints aFeatIter = aComplexConstraints.begin(); @@ -127,12 +132,13 @@ void SketchSolver_ConstraintManager::processEvent( std::dynamic_pointer_cast(*aFeatIter); if (!aFeature) continue; - changeConstraintOrEntity(aFeature); + hasProperFeature = changeConstraintOrEntity(aFeature) || hasProperFeature; } } // Solve the set of constraints - resolveConstraints(isMovedEvt); // send update for movement in any case + if (hasProperFeature) + resolveConstraints(isMovedEvt); // send update for movement in any case } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) { std::shared_ptr aDeleteMsg = std::dynamic_pointer_cast(theMessage); @@ -335,7 +341,7 @@ std::shared_ptr SketchSolver_ConstraintManager continue; DataPtr aData = aWP->data(); - if (aData) { + if (aData->isValid()) { std::shared_ptr aWPFeatures = std::dynamic_pointer_cast< ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID())); std::list aFeaturesList = aWPFeatures->list();