From: azv Date: Fri, 19 Feb 2016 12:00:18 +0000 (+0300) Subject: Update "mutli" constraints X-Git-Tag: V_2.2.0~90 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ca7211a274ba4dc99bd469ca44dd072fcb517dee;p=modules%2Fshaper.git Update "mutli" constraints --- diff --git a/src/SketchSolver/SketchSolver_Constraint.h b/src/SketchSolver/SketchSolver_Constraint.h index 817afa58d..3f6e0f281 100644 --- a/src/SketchSolver/SketchSolver_Constraint.h +++ b/src/SketchSolver/SketchSolver_Constraint.h @@ -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 diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp index f271d1817..977060d6f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp @@ -119,7 +119,7 @@ void SketchSolver_ConstraintMirror::update() process(); return; } - SketchSolver_Constraint::update(); + //SketchSolver_Constraint::update(); } void SketchSolver_ConstraintMirror::adjustConstraint() diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index d9e246cc9..6f05e9a53 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -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); +} diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index 03f0a6923..a5aea85fa 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -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() diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 204410560..c2034c157 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -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; } // ============================================================================