]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix the problem removing multi-coincidence between points (issue #1123)
authorazv <azv@opencascade.com>
Tue, 22 Dec 2015 08:04:22 +0000 (11:04 +0300)
committerazv <azv@opencascade.com>
Tue, 22 Dec 2015 08:05:02 +0000 (11:05 +0300)
src/SketchSolver/SketchSolver_ConstraintFixed.cpp
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index e5c24158c5ac46b7ed2b6671b7391a1ce7fb27c3..5ce8df01451b11df3fb24310dccea6d5b1a68dce 100644 (file)
@@ -94,12 +94,14 @@ bool SketchSolver_ConstraintFixed::remove()
   cleanErrorMsg();
   // Move fixed entities back to the current group
   FeaturePtr aFeature = myBaseFeature;
-  if (myBaseConstraint && myFixedAttribute && myFixedAttribute->isObject())
-    aFeature = ModelAPI_Feature::feature(myFixedAttribute->object());
+  if (myBaseConstraint && myFixedAttribute) {
+    if (myFixedAttribute->isObject())
+      aFeature = ModelAPI_Feature::feature(myFixedAttribute->object());
+    else
+      myStorage->update(AttributePtr(myFixedAttribute), myGroupID);
+  }
   if (aFeature)
     myStorage->update(aFeature, myGroupID);
-  else if (myFixedAttribute)
-    myStorage->update(AttributePtr(myFixedAttribute), myGroupID);
 
   // Remove constraint or base feature
   if (myBaseConstraint) {
index 67b346579ab8d7ef0fa051730da6909090c93981..742ef54bdda3aff1ce1650389a118d8a13b23ab4 100644 (file)
@@ -335,13 +335,10 @@ bool SketchSolver_Storage::removeEntity(FeaturePtr theFeature)
   EntityWrapperPtr anEntity = aFound->second;
   myFeatureMap.erase(aFound);
 
-  // Check the feature is not used by constraints
-  if (isUsed(theFeature))
-    return false; // the feature is used, don't remove it
-
-  // Remove feature
-  if (remove(anEntity))
+  // Check if the feature is not used by constraints, remove it
+  if (!isUsed(theFeature) && remove(anEntity))
     return true;
+
   // feature is not removed, revert operation
   myFeatureMap[theFeature] = anEntity;
   update(anEntity);
@@ -357,18 +354,10 @@ bool SketchSolver_Storage::removeEntity(AttributePtr theAttribute)
   EntityWrapperPtr anEntity = aFound->second;
   myAttributeMap.erase(aFound);
 
-  // Check the attribute is not used by constraints
-  if (isUsed(theAttribute))
-    return false; // the attribute is used, don't remove it
-  // Check the attribute is not used by other features
-  std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIt = myFeatureMap.begin();
-  for (; aFIt != myFeatureMap.end(); ++aFIt)
-    if (::isUsed(aFIt->second, theAttribute)) // the attribute is used, don't remove it
-      return false;
-
-  // Remove attribute
-  if (remove(anEntity))
+  // Check if the attribute is not used by constraints and features, remove it
+  if (!isUsed(theAttribute) && remove(anEntity))
     return true;
+
   // attribute is not removed, revert operation
   myAttributeMap[theAttribute] = anEntity;
   update(anEntity);
index 999f43eefc46a7e7451a83382f998de382839106..6d7400ddf2d9902a8e0a6498ba3cc3678ac3a641 100644 (file)
@@ -1552,8 +1552,8 @@ bool SolveSpaceSolver_Storage::removeCoincidence(ConstraintWrapperPtr theConstra
       std::set<EntityWrapperPtr> aSlaves = aPtPtIt->second;
       EntityWrapperPtr aNewMaster = *aSlaves.begin();
       aSlaves.erase(aSlaves.begin());
-      myCoincidentPoints[aNewMaster] = aSlaves;
       myCoincidentPoints.erase(aPtPtIt);
+      myCoincidentPoints[aNewMaster] = aSlaves;
       aPtPtIt = myCoincidentPoints.find(aNewMaster);
     } else
       aPtPtIt->second.erase(aNotCIt->first);