From: azv Date: Fri, 31 Mar 2017 08:38:03 +0000 (+0300) Subject: Issue #2073: Fatal error when mirror X-Git-Tag: V_2.7.0~117 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1b7956c2807a6b4f19edbfdf9e6a7872b9ab5302;p=modules%2Fshaper.git Issue #2073: Fatal error when mirror Check consistency of "Multi" constraints (Mirror, Rotation, Translation) when removing entity from the sketch. --- diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index fa98e284e..4f40f1d9c 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -274,7 +274,7 @@ void SketchSolver_Group::computeDoF() // ============================================================================ void SketchSolver_Group::repairConsistency() { - if (!myStorage->isConsistent()) { + if (!areConstraintsValid() || !myStorage->areFeaturesValid()) { // remove invalid constraints std::set anInvalidConstraints; ConstraintConstraintMap::iterator aCIter = myConstraints.begin(); @@ -381,3 +381,13 @@ void SketchSolver_Group::updateMultiConstraints() anIt->second->update(); } } + +bool SketchSolver_Group::areConstraintsValid() const +{ + // Check the constraints are valid + ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin(); + for (; aCIter != myConstraints.end(); ++aCIter) + if (!aCIter->first->data() || !aCIter->first->data()->isValid()) + return false; + return true; +} diff --git a/src/SketchSolver/SketchSolver_Group.h b/src/SketchSolver/SketchSolver_Group.h index 4db35d4fe..53c881c70 100644 --- a/src/SketchSolver/SketchSolver_Group.h +++ b/src/SketchSolver/SketchSolver_Group.h @@ -84,6 +84,9 @@ class SketchSolver_Group void blockEvents(bool isBlocked); private: + /// \biref Verify constraints have not been removed + bool areConstraintsValid() const; + /** \brief Removes constraints from the group * \param[in] theConstraint constraint to be removed */ diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index 61694df94..895edeb58 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -200,14 +200,8 @@ void SketchSolver_Storage::removeAttribute(AttributePtr theAttribute) } -bool SketchSolver_Storage::isConsistent() const +bool SketchSolver_Storage::areFeaturesValid() const { - // Check the constraints are valid - std::map::const_iterator - aCIter = myConstraintMap.begin(); - for (; aCIter != myConstraintMap.end(); ++aCIter) - if (!aCIter->first->data() || !aCIter->first->data()->isValid()) - return false; // Check the features are valid std::map::const_iterator aFIter = myFeatureMap.begin(); for (; aFIter != myFeatureMap.end(); aFIter++) diff --git a/src/SketchSolver/SketchSolver_Storage.h b/src/SketchSolver/SketchSolver_Storage.h index 7753d6433..6ef8d08b5 100644 --- a/src/SketchSolver/SketchSolver_Storage.h +++ b/src/SketchSolver/SketchSolver_Storage.h @@ -93,8 +93,8 @@ public: /// \brief Remove all features became invalid virtual void removeInvalidEntities() = 0; - /// \brief Check the features is not removed - bool isConsistent() const; + /// \brief Check the features have not been removed + bool areFeaturesValid() const; /// \brief Check the storage has constraints virtual bool isEmpty() const