process();
}
+void SketchSolver_Constraint::addFeature(FeaturePtr theFeature)
+{
+ int aType;
+ changeEntity(theFeature, aType);
+}
+
void SketchSolver_Constraint::process()
{
}
if (fabs(aPoint2D->x() - aXY[0]) > tolerance ||
fabs(aPoint2D->y() - aXY[1]) > tolerance)
- aPoint2D->setValue(aXY[0], aXY[1]);
+ aPoint2D->setValue(aXY[0], aXY[1]);
} else {
// Scalar value (used for the distance entities)
AttributeDoublePtr aScalar =
/// \brief Return identifier of SolveSpace entity relating to the attribute
Slvs_hEntity getId(AttributePtr theAttribute) const;
+ /// \brief Adds a feature to constraint and create its analogue in SolveSpace
+ void addFeature(FeaturePtr theFeature);
+
/// \brief Shows error message
const std::string& error() const
{ return myErrorMsg; }
bool SketchSolver_ConstraintCoincidence::isCoincide(
std::shared_ptr<SketchSolver_ConstraintCoincidence> theConstraint) const
{
- std::map<FeaturePtr, Slvs_hEntity>::const_iterator aFeatIter = myFeatureMap.begin();
- for (; aFeatIter != myFeatureMap.end(); aFeatIter++)
- if (theConstraint->myFeatureMap.find(aFeatIter->first) != theConstraint->myFeatureMap.end())
- return true;
- std::map<AttributePtr, Slvs_hEntity>::const_iterator anAttrIter = myAttributeMap.begin();
- for (; anAttrIter != myAttributeMap.end(); anAttrIter++)
- if (theConstraint->myAttributeMap.find(anAttrIter->first) != theConstraint->myAttributeMap.end())
+ std::set<AttributePtr>::const_iterator anAttrIter = theConstraint->myCoincidentPoints.begin();
+ for (; anAttrIter != theConstraint->myCoincidentPoints.end(); anAttrIter++)
+ if (myCoincidentPoints.find(*anAttrIter) != myCoincidentPoints.end())
return true;
return false;
}
if (anEntityID == SLVS_E_UNKNOWN)
anEntityID = changeEntity(aRefAttr->attr(), aType);
anEntities.push_back(anEntityID);
+ myCoincidentPoints.insert(aRefAttr->attr());
}
Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front());
while (anAttrIter != myAttributeMap.end()) {
if (anEntRemoved.find(anAttrIter->second) != anEntRemoved.end()) {
std::map<AttributePtr, Slvs_hEntity>::iterator aTempIt = anAttrIter++;
+ myCoincidentPoints.erase(aTempIt->first);
myAttributeMap.erase(aTempIt);
continue;
}
std::set<ConstraintPtr>::iterator aCIter = aConstraints.begin();
for (; aCIter != aConstraints.end(); aCIter++) {
ConstraintConstraintMap::iterator aSolConIter = myConstraints.find(*aCIter);
+ if (aSolConIter == myConstraints.end())
+ continue;
+ myFeatureStorage->changeFeature(theFeature, aSolConIter->first);
+ aSolConIter->second->addFeature(theFeature);
aSolConIter->second->update();
}
return true;