Check consistency of "Multi" constraints (Mirror, Rotation, Translation) when removing entity from the sketch.
// ============================================================================
void SketchSolver_Group::repairConsistency()
{
- if (!myStorage->isConsistent()) {
+ if (!areConstraintsValid() || !myStorage->areFeaturesValid()) {
// remove invalid constraints
std::set<ConstraintPtr> anInvalidConstraints;
ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
anIt->second->update();
}
}
+
+bool SketchSolver_Group::areConstraintsValid() const
+{
+ // Check the constraints are valid
+ ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin();
+ for (; aCIter != myConstraints.end(); ++aCIter)
+ if (!aCIter->first->data() || !aCIter->first->data()->isValid())
+ return false;
+ return true;
+}
void blockEvents(bool isBlocked);
private:
+ /// \biref Verify constraints have not been removed
+ bool areConstraintsValid() const;
+
/** \brief Removes constraints from the group
* \param[in] theConstraint constraint to be removed
*/
}
-bool SketchSolver_Storage::isConsistent() const
+bool SketchSolver_Storage::areFeaturesValid() const
{
- // Check the constraints are valid
- std::map<ConstraintPtr, ConstraintWrapperPtr>::const_iterator
- aCIter = myConstraintMap.begin();
- for (; aCIter != myConstraintMap.end(); ++aCIter)
- if (!aCIter->first->data() || !aCIter->first->data()->isValid())
- return false;
// Check the features are valid
std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIter = myFeatureMap.begin();
for (; aFIter != myFeatureMap.end(); aFIter++)
/// \brief Remove all features became invalid
virtual void removeInvalidEntities() = 0;
- /// \brief Check the features is not removed
- bool isConsistent() const;
+ /// \brief Check the features have not been removed
+ bool areFeaturesValid() const;
/// \brief Check the storage has constraints
virtual bool isEmpty() const