#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintMirror.h>
#include <SketchPlugin_ConstraintRigid.h>
+#include <SketchPlugin_ConstraintTangent.h>
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Arc.h>
continue;
aConstraint->setGroup(this);
aConstraint->setStorage(myStorage);
- myTempConstraints.insert(aConstraint);
+ setTemporary(aConstraint);
}
}
// Fix base features for mirror
return;
aConstraint->setGroup(this);
aConstraint->setStorage(myStorage);
- myTempConstraints.insert(aConstraint);
+ setTemporary(aConstraint);
}
// ============================================================================
continue;
aConstraint->setGroup(this);
aConstraint->setStorage(myStorage);
- myTempConstraints.insert(aConstraint);
+ setTemporary(aConstraint);
}
}
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);
}
// ============================================================================
void SketchSolver_Group::removeTemporaryConstraints()
{
myTempConstraints.clear();
+ myStorage->removeTemporaryConstraints();
// Clean lists of removed entities in the storage
std::set<Slvs_hParam> aRemPar;
std::set<Slvs_hEntity> aRemEnt;
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();
+}
+
+// ============================================================================
+// Function: setTemporary
+// Class: SketchSolver_Group
+// Purpose: append given constraint to th group of temporary constraints
+// ============================================================================
+void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint)
+{
+ theConstraint->makeTemporary();
+ myTempConstraints.insert(theConstraint);
+}
+