]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update "mutli" constraints
authorazv <azv@opencascade.com>
Fri, 19 Feb 2016 12:00:18 +0000 (15:00 +0300)
committerazv <azv@opencascade.com>
Fri, 19 Feb 2016 13:07:03 +0000 (16:07 +0300)
src/SketchSolver/SketchSolver_Constraint.h
src/SketchSolver/SketchSolver_ConstraintMirror.cpp
src/SketchSolver/SketchSolver_ConstraintMulti.cpp
src/SketchSolver/SketchSolver_ConstraintMulti.h
src/SketchSolver/SketchSolver_Group.cpp

index 817afa58db9fd35af2aa59165f586e9bb930d9a0..3f6e0f281ff300455c1dd650d3f4c46d3002ca54 100644 (file)
@@ -58,9 +58,9 @@ public:
   { return myType; }
 
   /// \brief Verify the feature or any its attribute is used by constraint
-  bool isUsed(FeaturePtr theFeature) const;
+  virtual bool isUsed(FeaturePtr theFeature) const;
   /// \brief Verify the attribute is used by constraint
-  bool isUsed(AttributePtr theAttribute) const;
+  virtual bool isUsed(AttributePtr theAttribute) const;
 
   /// \brief Shows error message
   const std::string& error() const
index f271d1817f665dbe9cb4f2b23a0becf61266b3dc..977060d6fc1eb18024b3f87b0a549b2f06a519c0 100644 (file)
@@ -119,7 +119,7 @@ void SketchSolver_ConstraintMirror::update()
     process();
     return;
   }
-  SketchSolver_Constraint::update();
+  //SketchSolver_Constraint::update();
 }
 
 void SketchSolver_ConstraintMirror::adjustConstraint()
index d9e246cc97424df86aa4cf5dd650385743d82197..6f05e9a53ad43150f4543638dc83e808fbf35264 100644 (file)
@@ -101,8 +101,7 @@ void SketchSolver_ConstraintMulti::update(bool isForce)
   updateLocal();
   if (isForce)
     myAdjusted = false;
-  // update parent object
-  SketchSolver_Constraint::update();
+  adjustConstraint();
 }
 
 void SketchSolver_ConstraintMulti::adjustConstraint()
@@ -185,3 +184,9 @@ void SketchSolver_ConstraintMulti::adjustConstraint()
 
   myAdjusted = true;
 }
+
+bool SketchSolver_ConstraintMulti::isUsed(FeaturePtr theFeature) const
+{
+  return myFeatures.find(theFeature) != myFeatures.end() ||
+         SketchSolver_Constraint::isUsed(theFeature);
+}
index 03f0a69235a546db0358e4fb3d7ab546973778aa..a5aea85fa7042c27796410f77590616821117930 100644 (file)
@@ -36,6 +36,9 @@ public:
   /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
   virtual bool remove();
 
+  /// \brief Check the feature is a source or a copy of Multi-constraint
+  virtual bool isUsed(FeaturePtr theFeature) const;
+
 protected:
   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
   virtual void process()
index 204410560c943f4996ea32b18f7441457456eb9a..c2034c1576d3f703cda07d094aedd0db8721c458 100644 (file)
@@ -126,7 +126,13 @@ bool SketchSolver_Group::isInteract(FeaturePtr theFeature) const
   if (isEmpty())
     return true;
   // Check interaction with the storage
-  return myStorage->isInteract(theFeature);
+  bool isInteracted = myStorage->isInteract(theFeature);
+  ConstraintConstraintMap::const_iterator anIt = myConstraints.begin();
+  for (; !isInteracted && anIt != myConstraints.end(); ++anIt)
+    if (anIt->first->getKind() == SketchPlugin_MultiRotation::ID() ||
+        anIt->first->getKind() == SketchPlugin_MultiTranslation::ID())
+      isInteracted = anIt->second->isUsed(theFeature);
+  return isInteracted;
 }
 
 // ============================================================================