]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2073: Fatal error when mirror
authorazv <azv@opencascade.com>
Fri, 31 Mar 2017 08:38:03 +0000 (11:38 +0300)
committerazv <azv@opencascade.com>
Fri, 31 Mar 2017 08:38:03 +0000 (11:38 +0300)
Check consistency of "Multi" constraints (Mirror, Rotation, Translation) when removing entity from the sketch.

src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SketchSolver_Group.h
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SketchSolver_Storage.h

index fa98e284e79c2d4482bd83a15b4cf2e545e65647..4f40f1d9c6376e551c8e7af1b18fad4f9120c1e0 100644 (file)
@@ -274,7 +274,7 @@ void SketchSolver_Group::computeDoF()
 // ============================================================================
 void SketchSolver_Group::repairConsistency()
 {
-  if (!myStorage->isConsistent()) {
+  if (!areConstraintsValid() || !myStorage->areFeaturesValid()) {
     // remove invalid constraints
     std::set<ConstraintPtr> 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;
+}
index 4db35d4fe7a483dd0c7eb5210e7c1422562a1bf6..53c881c7067cc0717268d2c1b89c4bdfabbe5771 100644 (file)
@@ -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
    */
index 61694df946786d635621b5e299a9efa96421edaa..895edeb58321c0daf337aff135703098e204791f 100644 (file)
@@ -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<ConstraintPtr, ConstraintWrapperPtr>::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<FeaturePtr, EntityWrapperPtr>::const_iterator aFIter = myFeatureMap.begin();
   for (; aFIter != myFeatureMap.end(); aFIter++)
index 7753d6433395ea7cdae71ffdaf5b8dc57d915c8b..6ef8d08b57ca9a464199bd836bc572b755be2258 100644 (file)
@@ -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