From: azv Date: Tue, 23 May 2017 09:54:12 +0000 (+0300) Subject: Fix the problem of the updating of "multi" constraints X-Git-Tag: V_2.7.1.1~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=964b0f06ffd962d7d79b844b7f9f0c57d0c5ad9f;p=modules%2Fshaper.git Fix the problem of the updating of "multi" constraints --- diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index 9c270943f..82feccdf4 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -60,13 +60,13 @@ void SketchSolver_ConstraintMulti::getEntities(std::list& theE if (!myStorage->update(aFeature)) myStorage->update(aFeature, true); theEntities.push_back(myStorage->entity(aFeature)); - myFeatures.insert(aFeature); + myOriginalFeatures.insert(aFeature); for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); ++i, ++anObjIt) { // just add copied features into the list of objects aFeature = ModelAPI_Feature::feature(*anObjIt); if (aFeature) { createCopiedEntity(aFeature, myStorage); - myFeatures.insert(aFeature); + myCopiedFeatures.insert(aFeature); } } } @@ -78,8 +78,8 @@ bool SketchSolver_ConstraintMulti::remove() // "Multi" constraint has been removed, thus all copy features become non-copied, // add them once again to be a common feature - std::set::iterator anIt = myFeatures.begin(); - for (; anIt != myFeatures.end(); ++anIt) { + std::set::iterator anIt = myCopiedFeatures.begin(); + for (; anIt != myCopiedFeatures.end(); ++anIt) { EntityWrapperPtr anEntity = myStorage->entity(*anIt); if (anEntity) { std::shared_ptr aSketchFeature = @@ -90,7 +90,8 @@ bool SketchSolver_ConstraintMulti::remove() myStorage->update(*anIt, true); } - myFeatures.clear(); + myOriginalFeatures.clear(); + myCopiedFeatures.clear(); return SketchSolver_Constraint::remove(); } @@ -114,7 +115,8 @@ void SketchSolver_ConstraintMulti::update() std::list::iterator anObjIt = anObjectList.begin(); for (; anObjIt != anObjectList.end(); ++anObjIt) { aFeature = ModelAPI_Feature::feature(*anObjIt); - if (aFeature && myFeatures.find(aFeature) == myFeatures.end()) { + if (aFeature && myOriginalFeatures.find(aFeature) == myOriginalFeatures.end() && + myCopiedFeatures.find(aFeature) == myCopiedFeatures.end()) { isUpdated = true; break; } @@ -208,7 +210,8 @@ void SketchSolver_ConstraintMulti::adjustConstraint() void SketchSolver_ConstraintMulti::notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*) { - if (myFeatures.find(theFeature) == myFeatures.end()) + if (myOriginalFeatures.find(theFeature) == myOriginalFeatures.end() && + myCopiedFeatures.find(theFeature) == myCopiedFeatures.end()) return; // the feature is not used by constraint => nothing to update // update derivative object @@ -221,8 +224,10 @@ void SketchSolver_ConstraintMulti::blockEvents(bool isBlocked) { myIsEventsBlocked = isBlocked; - std::set::iterator anIt = myFeatures.begin(); - for (; anIt != myFeatures.end(); ++anIt) + std::set::iterator anIt = myOriginalFeatures.begin(); + for (; anIt != myOriginalFeatures.end(); ++anIt) + (*anIt)->data()->blockSendAttributeUpdated(isBlocked); + for (anIt = myCopiedFeatures.begin(); anIt != myCopiedFeatures.end(); ++anIt) (*anIt)->data()->blockSendAttributeUpdated(isBlocked); SketchSolver_Constraint::blockEvents(isBlocked); diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index 969b4ae0d..976a4f369 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -78,8 +78,9 @@ protected: bool myAdjusted; ///< the constraint is already adjusted (to not do it several times) - /// list of features and their copies to find whether some of them are disappeared - std::set myFeatures; + /// lists of original features and their copies to find whether some of them are disappeared + std::set myOriginalFeatures; + std::set myCopiedFeatures; bool myIsEventsBlocked; }; diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp index 59a095d71..16a3eaebd 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp @@ -46,7 +46,7 @@ void SketchSolver_ConstraintMultiRotation::getAttributes( // add owner of central point of Multi-Rotation to the list of monitored features FeaturePtr anOwner = ModelAPI_Feature::feature(aCenterAttr->attr()->owner()); if (anOwner) - myFeatures.insert(anOwner); + myOriginalFeatures.insert(anOwner); } void SketchSolver_ConstraintMultiRotation::process() diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp index 7bbd8c18f..c954c5b06 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp @@ -42,10 +42,10 @@ void SketchSolver_ConstraintMultiTranslation::getAttributes( // add owner of start and end points of Multi-Translation to the list of monitored features FeaturePtr anOwner = ModelAPI_Feature::feature(aStartPointAttr->attr()->owner()); if (anOwner) - myFeatures.insert(anOwner); + myOriginalFeatures.insert(anOwner); anOwner = ModelAPI_Feature::feature(aEndPointAttr->attr()->owner()); if (anOwner) - myFeatures.insert(anOwner); + myOriginalFeatures.insert(anOwner); } void SketchSolver_ConstraintMultiTranslation::process()