+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator
+ aFound = myConstraintMap.find(theConstraint);
+ if (aFound == myConstraintMap.end() || !isEqual(aFound->second, theSolverConstraints))
+ setNeedToResolve(true);
+
+ if (theSolverConstraints.empty()) {
+ // constraint links to the empty list, add its attributes linked to the empty entities
+ std::list<AttributePtr> aRefAttrs =
+ theConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
+ std::list<AttributePtr>::const_iterator anAttrIt = aRefAttrs.begin();
+ for (; anAttrIt != aRefAttrs.end(); ++anAttrIt) {
+ AttributeRefAttrPtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIt);
+ if (aRef->isObject()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
+ if (aFeature) addEntity(aFeature, EntityWrapperPtr());
+ } else
+ addEntity(aRef->attr(), EntityWrapperPtr());
+ }
+ std::list<AttributePtr> aRefLists =
+ theConstraint->data()->attributes(ModelAPI_AttributeRefList::typeId());
+ for (anAttrIt = aRefLists.begin(); anAttrIt != aRefLists.end(); ++anAttrIt) {
+ AttributeRefListPtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anAttrIt);
+ std::list<ObjectPtr> anObj = aRef->list();
+ std::list<ObjectPtr>::iterator anIt = anObj.begin();
+ for (; anIt != anObj.end(); ++anIt) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+ if (aFeature) addEntity(aFeature, EntityWrapperPtr());
+ }
+ }
+ }
+ else if (theSolverConstraints.front()->type() != CONSTRAINT_PT_PT_COINCIDENT) {
+ // Do not add point-point coincidence, because it is already made by setting
+ // the same parameters for both points
+ std::list<ConstraintWrapperPtr>::iterator aCIt = theSolverConstraints.begin();
+ for (; aCIt != theSolverConstraints.end(); ++aCIt)
+ update(*aCIt);
+ }
+
+ if (!theSolverConstraints.empty() || aFound == myConstraintMap.end())
+ myConstraintMap[theConstraint] = theSolverConstraints;
+ // block events if necessary
+ if (myEventsBlocked && theConstraint && theConstraint->data() && theConstraint->data()->isValid())
+ theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
+}
+
+static std::list<AttributePtr> pointAttributes(FeaturePtr theFeature)
+{
+ std::list<AttributePtr> aPoints;
+ if (!theFeature->data() || !theFeature->data()->isValid())
+ return aPoints;
+ if (theFeature->getKind() == SketchPlugin_Arc::ID()) {
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::START_ID()));
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::END_ID()));
+ }
+ else if (theFeature->getKind() == SketchPlugin_Circle::ID())
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Circle::CENTER_ID()));
+ else if (theFeature->getKind() == SketchPlugin_Line::ID()) {
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Line::START_ID()));
+ aPoints.push_back(theFeature->attribute(SketchPlugin_Line::END_ID()));