std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
if (!aFeature)
continue;
- if (aFeature->getKind() == SketchPlugin_ConstraintFillet::ID() ||
- aFeature->getKind() == SketchPlugin_ConstraintMirror::ID() ||
- aFeature->getKind() == SketchPlugin_ConstraintTangent::ID()) {
+ if (SketchSolver_Group::isComplexConstraint(aFeature)) {
aComplexConstraints.insert(aFeature);
continue;
}
#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintMirror.h>
#include <SketchPlugin_ConstraintRigid.h>
+#include <SketchPlugin_ConstraintTangent.h>
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Arc.h>
if (!myFeatureStorage)
myFeatureStorage = FeatureStoragePtr(new SketchSolver_FeatureStorage);
+ std::vector<ConstraintPtr> aComplexConstraints;
ConstraintConstraintMap::const_iterator aConstrIter = theGroup.myConstraints.begin();
+ // append simple constraints
for (; aConstrIter != theGroup.myConstraints.end(); aConstrIter++)
- changeConstraint(aConstrIter->first);
+ if (isComplexConstraint(aConstrIter->first))
+ aComplexConstraints.push_back(aConstrIter->first);
+ else
+ changeConstraint(aConstrIter->first);
+ // append complex constraints
+ std::vector<ConstraintPtr>::iterator aComplexIter = aComplexConstraints.begin();
+ for (; aComplexIter != aComplexConstraints.end(); aComplexIter++)
+ changeConstraint(*aComplexIter);
}
// ============================================================================
if (aCIter != myConstraints.end())
myConstraints.erase(aCIter);
}
+
+// ============================================================================
+// Function: isComplexConstraint
+// Class: SketchSolver_Group
+// Purpose: verifies the constraint is complex, i.e. it needs another constraints to be created before
+// ============================================================================
+bool SketchSolver_Group::isComplexConstraint(FeaturePtr theConstraint)
+{
+ return theConstraint->getKind() == SketchPlugin_ConstraintFillet::ID() ||
+ theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID() ||
+ theConstraint->getKind() == SketchPlugin_ConstraintTangent::ID();
+}
+
return mySketch->data() && mySketch->data()->isValid();
}
+ /// \brief Verifies the constraint is complex, i.e. it needs another constraints to be created before
+ static bool isComplexConstraint(FeaturePtr theConstraint);
+
/** \brief Adds or updates a constraint in the group
* \param[in] theConstraint constraint to be changed
* \return \c true if the constraint added or updated successfully