+ else if (aFeature->getKind() == SketchPlugin_ConstraintMiddle::ID()) {
+ AttributePtr aPoint;
+ FeaturePtr aLine;
+ for (int j = 0; j < 2; ++j) {
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aFeature->attribute(SketchPlugin_Constraint::ATTRIBUTE(j)));
+ if (!aRefAttr)
+ continue;
+ if (aRefAttr->isObject())
+ aLine = ModelAPI_Feature::feature(aRefAttr->object());
+ else
+ aPoint = aRefAttr->attr();
+ }
+ if (aPoint && aLine) {
+ // if the point is already on the line, decrease 1 DoF, instead decrease 2 DoF
+ std::map<AttributePtr, std::set<FeaturePtr> >::iterator
+ aPtFound = aPointOnLine.find(aPoint);
+ if (aPtFound != aPointOnLine.end() &&
+ aPtFound->second.find(aLine) != aPtFound->second.end())
+ aDoF -= 1;
+ else {
+ aDoF -= 2;
+ aPointOnLine[aPoint].insert(aLine);
+ }
+ }
+ }