-////// ============================================================================
-////// Function: changeRigidConstraint
-////// Class: SketchSolver_Group
-////// Purpose: create/update the "Rigid" constraint in the group
-////// ============================================================================
-////bool SketchSolver_Group::changeRigidConstraint(
-//// std::shared_ptr<SketchPlugin_Constraint> theConstraint)
-////{
-//// // Search this constraint in the current group to update it
-//// ConstraintMap::const_iterator aConstrMapIter = myConstraintMap.find(theConstraint);
-//// std::vector<Slvs_Constraint>::iterator aConstrIter;
-//// if (aConstrMapIter != myConstraintMap.end()) {
-//// int aConstrPos = Search(aConstrMapIter->second.front(), myConstraints);
-//// aConstrIter = myConstraints.begin() + aConstrPos;
-//// }
-////
-//// // Get constraint type and verify the constraint parameters are correct
-//// SketchSolver_Constraint aConstraint(theConstraint);
-//// int aConstrType = aConstraint.getType();
-//// if (aConstrType == SLVS_C_UNKNOWN
-//// || (aConstrMapIter != myConstraintMap.end() && aConstrIter->type != aConstrType))
-//// return false;
-//// const std::vector<std::string>& aConstraintAttributes = aConstraint.getAttributes();
-////
-//// Slvs_hEntity aConstrEnt = SLVS_E_UNKNOWN;
-//// std::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = std::dynamic_pointer_cast<
-//// ModelAPI_AttributeRefAttr>(
-//// theConstraint->data()->attribute(aConstraintAttributes[0]));
-//// if (!aConstrAttr)
-//// return false;
-////
-//// // Convert the object of the attribute to the feature
-//// FeaturePtr aFeature;
-//// if (aConstrAttr->isObject() && aConstrAttr->object()) {
-//// ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
-//// aConstrAttr->object());
-//// if (!aRC)
-//// return false;
-//// std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
-//// aFeature = aDoc->feature(aRC);
-//// }
-////
-//// aConstrEnt = aConstrAttr->isObject() ? changeEntityFeature(aFeature) : changeEntity(aConstrAttr->attr());
-////
-//// if (aConstrMapIter == myConstraintMap.end()) { // Add new constraint
-//// // Check the fixed entity is not a point.
-//// std::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = std::dynamic_pointer_cast<
-//// ModelAPI_AttributeRefAttr>(theConstraint->data()->attribute(aConstraintAttributes[0]));
-//// std::shared_ptr<GeomDataAPI_Point> aPoint =
-//// std::dynamic_pointer_cast<GeomDataAPI_Point>(aConstrAttr->attr());
-//// std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
-//// std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aConstrAttr->attr());
-//// if (aPoint || aPoint2D) {
-//// // Create SolveSpace constraint structure
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
-//// aConstrEnt, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint] = std::vector<Slvs_hEntity>(1, aConstraint.h);
-//// int aConstrPos = Search(aConstraint.h, myConstraints);
-//// aConstrIter = myConstraints.begin() + aConstrPos;
-//// myNeedToSolve = true;
-//// } else {
-//// myConstraintMap[theConstraint] = std::vector<Slvs_hConstraint>();
-////
-//// // To avoid SolveSpace problems:
-//// // * if the circle is rigid, we will fix its center and radius;
-//// // * if the arc is rigid, we will fix its start and end points and radius.
-//// double aRadius = 0.0;
-//// bool isArc = false;
-//// bool isCircle = false;
-//// if (aFeature) {
-//// if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
-//// std::shared_ptr<GeomDataAPI_Point2D> aCenter =
-//// std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-//// aFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
-//// std::shared_ptr<GeomDataAPI_Point2D> aStart =
-//// std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-//// aFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
-//// aRadius = aStart->pnt()->distance(aCenter->pnt());
-//// isArc = true;
-//// } else if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
-//// aRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-//// aFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()))->value();
-//// isCircle = true;
-//// }
-//// }
-////
-//// // Get list of already fixed points
-//// std::set<Slvs_hEntity> anAlreadyFixed;
-//// std::vector<Slvs_Constraint>::const_iterator aCIter = myConstraints.begin();
-//// for (; aCIter != myConstraints.end(); aCIter++)
-//// if (aCIter->type == SLVS_C_WHERE_DRAGGED)
-//// anAlreadyFixed.insert(aCIter->ptA);
-////
-//// // Create constraints to fix the parameters of the entity
-//// int aEntPos = Search(aConstrEnt, myEntities);
-//// Slvs_hEntity* aPointsPtr = myEntities[aEntPos].point;
-//// if (isArc) aPointsPtr++; // avoid to fix center of arc
-//// while (*aPointsPtr != 0) {
-//// // Avoid to create additional "Rigid" constraints for coincident points
-//// bool isCoincAlreadyFixed = false;
-//// if (!anAlreadyFixed.empty()) {
-//// if (anAlreadyFixed.find(*aPointsPtr) != anAlreadyFixed.end())
-//// isCoincAlreadyFixed = true;
-////
-//// std::vector<std::set<Slvs_hEntity> >::const_iterator aCoincIter =
-//// myCoincidentPoints.begin();
-//// for (; !isCoincAlreadyFixed && aCoincIter != myCoincidentPoints.end(); aCoincIter++) {
-//// if (aCoincIter->find(*aPointsPtr) == aCoincIter->end())
-//// continue;
-//// std::set<Slvs_hEntity>::const_iterator anIter = anAlreadyFixed.begin();
-//// for (; !isCoincAlreadyFixed && anIter != anAlreadyFixed.end(); anIter++)
-//// if (aCoincIter->find(*anIter) != aCoincIter->end())
-//// isCoincAlreadyFixed = true;
-//// }
-//// }
-////
-//// if (!isCoincAlreadyFixed) {
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
-//// *aPointsPtr, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// }
-//// aPointsPtr++;
-//// }
-////
-//// if (isArc || isCircle) { // add radius constraint
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_DIAMETER, myWorkplane.h, 2.0 * aRadius,
-//// SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aConstrEnt, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// }
-////
-//// // The object is already rigid, so there is no constraints added
-//// if (myConstraintMap[theConstraint].empty()) {
-//// myConstraintMap.erase(theConstraint);
-//// myNeedToSolve = false;
-//// }
-//// else
-//// myNeedToSolve = true;
-//// }
-//// }
-//// return true;
-////}
-////
-////// ============================================================================
-////// Function: changeMirrorConstraint
-////// Class: SketchSolver_Group
-////// Purpose: create/update the "Mirror" constraint in the group
-////// ============================================================================
-////bool SketchSolver_Group::changeMirrorConstraint(
-//// std::shared_ptr<SketchPlugin_Constraint> theConstraint)
-////{
-//// DataPtr aConstrData = theConstraint->data();
-////
-//// // Search this constraint in the current group to update it
-//// ConstraintMap::const_iterator aConstrMapIter = myConstraintMap.find(theConstraint);
-//// std::vector<Slvs_Constraint>::iterator aConstrIter;
-//// if (aConstrMapIter != myConstraintMap.end()) {
-//// int aConstrPos = Search(aConstrMapIter->second.front(), myConstraints);
-//// aConstrIter = myConstraints.begin() + aConstrPos;
-//// }
-////
-//// // Get constraint type and verify the constraint parameters are correct
-//// SketchSolver_Constraint aConstraint(theConstraint);
-//// int aConstrType = aConstraint.getType();
-//// if (aConstrType == SLVS_C_UNKNOWN
-//// || (aConstrMapIter != myConstraintMap.end() && aConstrIter->type != aConstrType))
-//// return false;
-//// const std::vector<std::string>& aConstraintAttributes = aConstraint.getAttributes();
-////
-//// Slvs_hEntity aMirrorLineEnt = SLVS_E_UNKNOWN;
-//// AttributeRefAttrPtr aConstrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-//// aConstrData->attribute(aConstraintAttributes[0]));
-//// if (!aConstrAttr)
-//// return false;
-////
-//// // Convert the object of the attribute to the feature
-//// FeaturePtr aMirrorLineFeat;
-//// if (aConstrAttr->isObject() && aConstrAttr->object()) {
-//// ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
-//// aConstrAttr->object());
-//// if (!aRC)
-//// return false;
-//// std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
-//// aMirrorLineFeat = aDoc->feature(aRC);
-//// }
-//// aMirrorLineEnt = aConstrAttr->isObject() ?
-//// changeEntityFeature(aMirrorLineFeat) : changeEntity(aConstrAttr->attr());
-////
-//// if (aConstrMapIter == myConstraintMap.end()) { // Add new constraint
-//// // Append symmetric constraint for each point of mirroring features
-//// AttributeRefListPtr aBaseRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
-//// aConstrData->attribute(aConstraintAttributes[1]));
-//// AttributeRefListPtr aMirroredRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
-//// aConstrData->attribute(aConstraintAttributes[2]));
-//// if (!aBaseRefList || !aMirroredRefList)
-//// return false;
-////
-//// std::list<ObjectPtr> aBaseList = aBaseRefList->list();
-//// std::list<ObjectPtr> aMirroredList = aMirroredRefList->list();
-//// if (aBaseList.size() != aMirroredList.size())
-//// return false;
-////
-//// myConstraintMap[theConstraint] = std::vector<Slvs_hConstraint>();
-////
-//// FeaturePtr aBaseFeature, aMirrorFeature;
-//// ResultConstructionPtr aRC;
-//// std::list<ObjectPtr>::iterator aBaseIter = aBaseList.begin();
-//// std::list<ObjectPtr>::iterator aMirIter = aMirroredList.begin();
-//// for ( ; aBaseIter != aBaseList.end(); aBaseIter++, aMirIter++) {
-//// aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aBaseIter);
-//// aBaseFeature = aRC ? aRC->document()->feature(aRC) :
-//// std::dynamic_pointer_cast<SketchPlugin_Feature>(*aBaseIter);
-//// aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aMirIter);
-//// aMirrorFeature = aRC ? aRC->document()->feature(aRC) :
-//// std::dynamic_pointer_cast<SketchPlugin_Feature>(*aMirIter);
-////
-//// if (!aBaseFeature || !aMirrorFeature ||
-//// aBaseFeature->getKind() != aMirrorFeature->getKind())
-//// return false;
-//// Slvs_hEntity aBaseEnt = changeEntityFeature(aBaseFeature);
-//// Slvs_hEntity aMirrorEnt = changeEntityFeature(aMirrorFeature);
-//// // Make aMirrorEnt parameters to be symmetric with aBaseEnt
-//// makeMirrorEntity(aBaseEnt, aMirrorEnt, aMirrorLineEnt);
-////
-//// if (aBaseFeature->getKind() == SketchPlugin_Point::ID()) {
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(++myConstrMaxID, myID, aConstrType,
-//// myWorkplane.h, 0.0, aBaseEnt, aMirrorEnt, aMirrorLineEnt, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// } else {
-//// int aBasePos = Search(aBaseEnt, myEntities);
-//// int aMirrorPos = Search(aMirrorEnt, myEntities);
-//// if (aBaseFeature->getKind() == SketchPlugin_Line::ID()) {
-//// for (int ind = 0; ind < 2; ind++) {
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
-//// myEntities[aBasePos].point[ind], myEntities[aMirrorPos].point[ind],
-//// aMirrorLineEnt, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// }
-//// } else if (aBaseFeature->getKind() == SketchPlugin_Circle::ID()) {
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
-//// myEntities[aBasePos].point[0], myEntities[aMirrorPos].point[0],
-//// aMirrorLineEnt, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// // Additional constraint for equal radii
-//// Slvs_Constraint anEqRadConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_EQUAL_RADIUS, myWorkplane.h, 0.0,
-//// SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aBaseEnt, aMirrorEnt);
-//// myConstraints.push_back(anEqRadConstr);
-//// myConstraintMap[theConstraint].push_back(anEqRadConstr.h);
-//// } else if (aBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
-//// // Workaround to avoid problems in SolveSpace.
-//// // The symmetry of two arcs will be done using symmetry of three points on these arcs:
-//// // start point, end point, and any other point on the arc
-//// Slvs_hEntity aBaseArcPoints[3] = {
-//// myEntities[aBasePos].point[1],
-//// myEntities[aBasePos].point[2],
-//// SLVS_E_UNKNOWN};
-//// Slvs_hEntity aMirrorArcPoints[3] = { // indices of points of arc, center corresponds center, first point corresponds last point
-//// myEntities[aMirrorPos].point[2],
-//// myEntities[aMirrorPos].point[1],
-//// SLVS_E_UNKNOWN};
-//// Slvs_hEntity aBothArcs[2] = {aBaseEnt, aMirrorEnt};
-//// Slvs_hEntity aBothMiddlePoints[2];
-//// for (int i = 0; i < 2; i++) {
-//// double x, y;
-//// calculateMiddlePoint(aBothArcs[i], x, y);
-//// std::vector<Slvs_Param>::iterator aParamIter = myParams.end();
-//// Slvs_hParam u = changeParameter(x, aParamIter);
-//// Slvs_hParam v = changeParameter(y, aParamIter);
-//// Slvs_Entity aPoint = Slvs_MakePoint2d(++myEntityMaxID, myID, myWorkplane.h, u, v);
-//// myEntities.push_back(aPoint);
-//// aBothMiddlePoints[i] = aPoint.h;
-//// // additional constraint point-on-curve
-//// Slvs_Constraint aPonCircConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_PT_ON_CIRCLE, myWorkplane.h, 0.0,
-//// aPoint.h, SLVS_E_UNKNOWN, aBothArcs[i], SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aPonCircConstr);
-//// myConstraintMap[theConstraint].push_back(aPonCircConstr.h);
-//// }
-////
-//// aBaseArcPoints[2] = aBothMiddlePoints[0];
-//// aMirrorArcPoints[2] = aBothMiddlePoints[1];
-//// for (int ind = 0; ind < 3; ind++) {
-//// Slvs_Constraint aConstraint = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
-//// aBaseArcPoints[ind], aMirrorArcPoints[ind], aMirrorLineEnt, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aConstraint);
-//// myConstraintMap[theConstraint].push_back(aConstraint.h);
-//// }
-//// }
-//// }
-//// }
-////
-//// // Set the mirror line unchanged during constraint recalculation
-//// int aMirrorLinePos = Search(aMirrorLineEnt, myEntities);
-//// Slvs_Constraint aRigidStart = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, myWorkplane.h, 0,
-//// myEntities[aMirrorLinePos].point[0], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aRigidStart);
-//// myConstraintMap[theConstraint].push_back(aRigidStart.h);
-//// Slvs_Constraint aRigidEnd = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, myWorkplane.h, 0,
-//// myEntities[aMirrorLinePos].point[1], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aRigidEnd);
-//// myConstraintMap[theConstraint].push_back(aRigidEnd.h);
-////
-//// // Add temporary constraints for initial objects to be unchanged
-//// for (aBaseIter = aBaseList.begin(); aBaseIter != aBaseList.end(); aBaseIter++) {
-//// aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aBaseIter);
-//// aBaseFeature = aRC ? aRC->document()->feature(aRC) :
-//// std::dynamic_pointer_cast<SketchPlugin_Feature>(*aBaseIter);
-//// if (!aBaseFeature) continue;
-//// std::list<AttributePtr> aPoints = aBaseFeature->data()->attributes(GeomDataAPI_Point2D::type());
-//// std::list<AttributePtr>::iterator anIt = aPoints.begin();
-//// for ( ; anIt != aPoints.end(); anIt++) {
-//// // Arcs are fixed by center and start points only (to avoid solving errors in SolveSpace)
-//// if (aBaseFeature->getKind() == SketchPlugin_Arc::ID() &&
-//// (*anIt)->id() == SketchPlugin_Arc::END_ID())
-//// continue;
-//// addTemporaryConstraintWhereDragged(*anIt);
-//// }
-//// }
-//// }
-//// return true;
-////}
-////
-////// ============================================================================
-////// Function: changeFilletConstraint
-////// Class: SketchSolver_Group
-////// Purpose: create/update the "Fillet" constraint in the group
-////// ============================================================================
-////bool SketchSolver_Group::changeFilletConstraint(
-//// std::shared_ptr<SketchPlugin_Constraint> theConstraint)
-////{
-//// DataPtr aConstrData = theConstraint->data();
-////
-//// // Search this constraint in the current group to update it
-//// ConstraintMap::const_iterator aConstrMapIter = myConstraintMap.find(theConstraint);
-//// std::vector<Slvs_Constraint>::iterator aConstrIter;
-//// if (aConstrMapIter != myConstraintMap.end()) {
-//// int aConstrPos = Search(aConstrMapIter->second.front(), myConstraints);
-//// aConstrIter = myConstraints.begin() + aConstrPos;
-//// }
-////
-//// // Get constraint type and verify the constraint parameters are correct
-//// SketchSolver_Constraint aConstraint(theConstraint);
-//// int aConstrType = aConstraint.getType();
-//// if (aConstrType == SLVS_C_UNKNOWN)
-//// return false;
-//// const std::vector<std::string>& aConstraintAttributes = aConstraint.getAttributes();
-////
-//// // Obtain hEntity for basic objects of fillet
-//// Slvs_hEntity aBaseObject[2];
-//// FeaturePtr aBaseFeature[2];
-//// for (unsigned int indAttr = 0; indAttr < 2; indAttr++) {
-//// AttributeRefAttrPtr aConstrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-//// aConstrData->attribute(aConstraintAttributes[indAttr]));
-//// if (!aConstrAttr)
-//// return false;
-//// if (aConstrAttr->isObject() && aConstrAttr->object()) {
-//// ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
-//// aConstrAttr->object());
-//// if (!aRC)
-//// return false;
-//// std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
-//// aBaseFeature[indAttr] = aDoc->feature(aRC);
-//// }
-//// aBaseObject[indAttr] = aConstrAttr->isObject() ?
-//// changeEntityFeature(aBaseFeature[indAttr]) : changeEntity(aConstrAttr->attr());
-//// }
-//// // Check the base entities have a coincident point
-//// int aBaseObjInd[2] = {
-//// Search(aBaseObject[0], myEntities),
-//// Search(aBaseObject[1], myEntities)
-//// };
-//// int aShift[2] = { // shift for calculating correct start and end points for different types of objects
-//// myEntities[aBaseObjInd[0]].type == SLVS_E_ARC_OF_CIRCLE ? 1 : 0,
-//// myEntities[aBaseObjInd[1]].type == SLVS_E_ARC_OF_CIRCLE ? 1 : 0,
-//// };
-//// Slvs_hEntity aFirstObjPoints[2] = { // indices of start and end point of first object
-//// myEntities[aBaseObjInd[0]].point[aShift[0]],
-//// myEntities[aBaseObjInd[0]].point[1+aShift[0]]
-//// };
-//// Slvs_hEntity aSecondObjPoints[2] = { // indices of start and end point of second object
-//// myEntities[aBaseObjInd[1]].point[aShift[1]],
-//// myEntities[aBaseObjInd[1]].point[1+aShift[1]]
-//// };
-//// bool isCoincidentFound = false;
-//// int aBaseCoincInd[2] = {0, 0}; // indices in aFirstObjPoint and aSecondObjPoint identifying coincident points
-//// std::vector<std::set<Slvs_hEntity> >::iterator aCPIter = myCoincidentPoints.begin();
-//// for ( ; aCPIter != myCoincidentPoints.end() && !isCoincidentFound; aCPIter++)
-//// for (int ind1 = 0; ind1 < 2 && !isCoincidentFound; ind1++)
-//// for (int ind2 = 0; ind2 < 2 && !isCoincidentFound; ind2++)
-//// if (aCPIter->find(aFirstObjPoints[ind1]) != aCPIter->end() &&
-//// aCPIter->find(aSecondObjPoints[ind2]) != aCPIter->end()) {
-//// aBaseCoincInd[0] = ind1;
-//// aBaseCoincInd[1] = ind2;
-//// isCoincidentFound = true;
-//// }
-//// if (!isCoincidentFound) {
-//// // There is no coincident points between objects. Generate error message
-//// Events_Error::send(SketchSolver_Error::NO_COINCIDENT_POINTS(), this);
-//// return false;
-//// }
-////
-//// // Create fillet entities
-//// // - first object is placed on the first base
-//// // - second object is on the second base
-//// // - third object is a filleting arc
-//// static const int aNbFilletEnt = 3;
-//// Slvs_hEntity aFilletEnt[aNbFilletEnt];
-//// int aFilletObjInd[aNbFilletEnt];
-//// AttributeRefListPtr aFilletRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
-//// aConstrData->attribute(aConstraintAttributes[2]));
-//// if (!aFilletRefList)
-//// return false;
-//// std::list<ObjectPtr> aFilletList = aFilletRefList->list();
-//// if (aFilletList.size() < aNbFilletEnt)
-//// return false;
-//// FeaturePtr aFilletFeature;
-//// ResultConstructionPtr aRC;
-//// std::list<ObjectPtr>::iterator aFilIter = aFilletList.begin();
-//// for (int indEnt = 0; aFilIter != aFilletList.end(); aFilIter++, indEnt++) {
-//// aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aFilIter);
-//// aFilletFeature = aRC ? aRC->document()->feature(aRC) :
-//// std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFilIter);
-//// if (!aFilletFeature)
-//// return false;
-//// aFilletEnt[indEnt] = changeEntityFeature(aFilletFeature);
-//// aFilletObjInd[indEnt] = Search(aFilletEnt[indEnt], myEntities);
-//// }
-//// // At first time, for correct result, move floating points of fillet on the middle points of base objects
-//// if (myConstraintMap.find(theConstraint) == myConstraintMap.end()) {
-//// double anArcPoints[6];
-//// for (int indEnt = 0; indEnt < aNbFilletEnt - 1; indEnt++) {
-//// int anIndShift = myEntities[aFilletObjInd[indEnt]].type == SLVS_E_ARC_OF_CIRCLE ? 1 : 0;
-//// int aPointsPos[2] = {
-//// Search(myEntities[aFilletObjInd[indEnt]].point[anIndShift], myEntities),
-//// Search(myEntities[aFilletObjInd[indEnt]].point[1+anIndShift], myEntities)
-//// };
-//// int aParamPos[2] = {
-//// Search(myEntities[aPointsPos[0]].param[0], myParams),
-//// Search(myEntities[aPointsPos[1]].param[0], myParams)
-//// };
-//// int anIndex = aParamPos[aBaseCoincInd[indEnt]];
-//// if (anIndShift == 0) {
-//// myParams[anIndex].val =
-//// 0.5 * (myParams[aParamPos[0]].val + myParams[aParamPos[1]].val);
-//// myParams[1 + anIndex].val =
-//// 0.5 * (myParams[1 + aParamPos[0]].val + myParams[1 + aParamPos[1]].val);
-//// } else { // place the changed point on the arc
-//// double x = 0, y = 0;
-//// calculateMiddlePoint(aFilletEnt[indEnt], x, y);
-//// myParams[anIndex].val = x;
-//// myParams[1 + anIndex].val = y;
-//// }
-//// anArcPoints[indEnt*2+2] = myParams[anIndex].val;
-//// anArcPoints[indEnt*2+3] = myParams[1 + anIndex].val;
-//// }
-//// anArcPoints[0] = 0.5 * (anArcPoints[2] + anArcPoints[4]);
-//// anArcPoints[1] = 0.5 * (anArcPoints[3] + anArcPoints[5]);
-//// for (int indArcPt = 0; indArcPt < 3; indArcPt++) {
-//// int aPtPos = Search(myEntities[aFilletObjInd[2]].point[indArcPt], myEntities);
-//// int aParamPos = Search(myEntities[aPtPos].param[0], myParams);
-//// myParams[aParamPos].val = anArcPoints[indArcPt * 2];
-//// myParams[aParamPos + 1].val = anArcPoints[indArcPt * 2 + 1];
-//// }
-//// }
-////
-//// // Check the fillet arc which point to be connected to
-//// bool isArcInversed = false; // indicates that start and end points of arc should be connected to second and first object respectively
-//// Slvs_hEntity hEnt = myEntities[aFilletObjInd[2]].point[1];
-//// int aPos = Search(hEnt, myEntities);
-//// Slvs_hParam anArcStartPoint = myEntities[aPos].param[0];
-//// aPos = Search(anArcStartPoint, myParams);
-//// double anArcPtCoord[2] = {myParams[aPos].val, myParams[aPos+1].val};
-//// double aSqDistances[2];
-//// int aPtInd;
-//// for (int indEnt = 0; indEnt < aNbFilletEnt - 1; indEnt++) {
-//// aPtInd = aBaseCoincInd[indEnt]+aShift[indEnt];
-//// hEnt = myEntities[aFilletObjInd[indEnt]].point[aPtInd];
-//// aPos = Search(hEnt, myEntities);
-//// Slvs_hParam anObjectPoint = myEntities[aPos].param[0];
-//// aPos = Search(anObjectPoint, myParams);
-//// double aPtCoord[2] = {myParams[aPos].val, myParams[aPos+1].val};
-//// aSqDistances[indEnt] =
-//// (anArcPtCoord[0] - aPtCoord[0]) * (anArcPtCoord[0] - aPtCoord[0]) +
-//// (anArcPtCoord[1] - aPtCoord[1]) * (anArcPtCoord[1] - aPtCoord[1]);
-//// }
-//// if (aSqDistances[1] < aSqDistances[0])
-//// isArcInversed = true;
-////
-//// // Create list of constraints to generate fillet
-//// std::vector<Slvs_hConstraint> aConstrList;
-//// bool isExists = myConstraintMap.find(theConstraint) != myConstraintMap.end(); // constraint already exists
-//// std::vector<Slvs_hConstraint>::iterator aCMapIter =
-//// isExists ? myConstraintMap[theConstraint].begin() : aConstrList.begin();
-//// int aCurConstrPos = isExists ? Search(*aCMapIter, myConstraints) : 0;
-//// for (int indEnt = 0; indEnt < aNbFilletEnt - 1; indEnt++) {
-//// // one point of fillet object should be coincident with the point on base, non-coincident with another base object
-//// aPtInd = 1-aBaseCoincInd[indEnt]+aShift[indEnt]; // (1-aBaseCoincInd[indEnt]) = index of non-coincident point, aShift is used to process all types of shapes
-//// Slvs_hEntity aPtBase = myEntities[aBaseObjInd[indEnt]].point[aPtInd];
-//// Slvs_hEntity aPtFillet = myEntities[aFilletObjInd[indEnt]].point[aPtInd];
-//// if (isExists) {
-//// myConstraints[aCurConstrPos].ptA = aPtBase;
-//// myConstraints[aCurConstrPos].ptB = aPtFillet;
-//// aCMapIter++;
-//// aCurConstrPos = Search(*aCMapIter, myConstraints);
-//// } else {
-//// Slvs_Constraint aCoincConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_POINTS_COINCIDENT, myWorkplane.h,
-//// 0, aPtBase, aPtFillet, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aCoincConstr);
-//// aConstrList.push_back(aCoincConstr.h);
-//// }
-////
-//// // another point of fillet object should be placed on the base object
-//// Slvs_Constraint aPonCurveConstr;
-//// int aTangentType;
-//// if (myEntities[aFilletObjInd[indEnt]].type == SLVS_E_ARC_OF_CIRCLE) {
-//// // centers of arcs should be coincident
-//// aPtBase = myEntities[aBaseObjInd[indEnt]].point[0];
-//// aPtFillet = myEntities[aFilletObjInd[indEnt]].point[0];
-//// if (isExists) {
-//// myConstraints[aCurConstrPos].ptA = aPtBase;
-//// myConstraints[aCurConstrPos].ptB = aPtFillet;
-//// aCMapIter++;
-//// aCurConstrPos = Search(*aCMapIter, myConstraints);
-//// } else {
-//// aPonCurveConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_POINTS_COINCIDENT, myWorkplane.h,
-//// 0, aPtBase, aPtFillet, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// }
-//// aPtFillet = myEntities[aFilletObjInd[indEnt]].point[1+aBaseCoincInd[indEnt]]; // !!! will be used below
-//// aTangentType = SLVS_C_CURVE_CURVE_TANGENT;
-//// } else {
-//// aPtInd = aBaseCoincInd[indEnt];
-//// aPtFillet = myEntities[aFilletObjInd[indEnt]].point[aPtInd];
-//// if (isExists) {
-//// myConstraints[aCurConstrPos].ptA = aPtFillet;
-//// aCMapIter++;
-//// aCurConstrPos = Search(*aCMapIter, myConstraints);
-//// } else {
-//// aPonCurveConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_PT_ON_LINE, myWorkplane.h,
-//// 0, aPtFillet, SLVS_E_UNKNOWN, aBaseObject[indEnt], SLVS_E_UNKNOWN);
-//// }
-//// aTangentType = SLVS_C_ARC_LINE_TANGENT;
-//// }
-//// if (!isExists) {
-//// myConstraints.push_back(aPonCurveConstr);
-//// aConstrList.push_back(aPonCurveConstr.h);
-//// }
-////
-//// // Bound point of fillet arc should be tangently coincident with a bound point of fillet object
-//// aPtInd = 1 + (isArcInversed ? 1-indEnt : indEnt);
-//// Slvs_hEntity aPtArc = myEntities[aFilletObjInd[2]].point[aPtInd];
-//// if (isExists) {
-//// myConstraints[aCurConstrPos].ptA = aPtArc;
-//// myConstraints[aCurConstrPos].ptB = aPtFillet;
-//// aCMapIter++;
-//// aCurConstrPos = Search(*aCMapIter, myConstraints);
-//// myConstraints[aCurConstrPos].entityA = aFilletEnt[2];
-//// myConstraints[aCurConstrPos].entityB = aFilletEnt[indEnt];
-//// myConstraints[aCurConstrPos].other = (isArcInversed ? 1-indEnt : indEnt);
-//// aCMapIter++;
-//// aCurConstrPos = Search(*aCMapIter, myConstraints);
-//// } else {
-//// Slvs_Constraint aCoincConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_POINTS_COINCIDENT, myWorkplane.h,
-//// 0, aPtArc, aPtFillet, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aCoincConstr);
-//// aConstrList.push_back(aCoincConstr.h);
-//// Slvs_Constraint aTangency = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, aTangentType, myWorkplane.h,
-//// 0, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aFilletEnt[2], aFilletEnt[indEnt]);
-//// aTangency.other = (isArcInversed ? 1-indEnt : indEnt);
-//// aTangency.other2 = aTangentType == SLVS_C_CURVE_CURVE_TANGENT ? aBaseCoincInd[indEnt] : 0;
-//// myConstraints.push_back(aTangency);
-//// aConstrList.push_back(aTangency.h);
-//// }
-//// }
-////
-//// // Additional constraint for fillet diameter
-//// double aRadius = 0.0; // scalar value of the constraint
-//// AttributeDoublePtr aDistAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-//// aConstrData->attribute(SketchPlugin_Constraint::VALUE()));
-//// aRadius = aDistAttr->value();
-//// if (isExists) {
-//// myConstraints[aCurConstrPos].entityA = aFilletEnt[2];
-//// myConstraints[aCurConstrPos].valA = aRadius * 2.0;
-//// aCMapIter++;
-//// } else {
-//// Slvs_Constraint aDiamConstr = Slvs_MakeConstraint(
-//// ++myConstrMaxID, myID, SLVS_C_DIAMETER, myWorkplane.h, aRadius * 2.0,
-//// SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, aFilletEnt[2], SLVS_E_UNKNOWN);
-//// myConstraints.push_back(aDiamConstr);
-//// aConstrList.push_back(aDiamConstr.h);
-////
-//// myConstraintMap[theConstraint] = aConstrList;
-//// }
-////
-//// // Additional temporary constraints for base objects to be fixed
-//// for (unsigned int indAttr = 0; indAttr < 2; indAttr++) {
-//// if (!aBaseFeature[indAttr]) {
-//// AttributeRefAttrPtr aConstrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-//// aConstrData->attribute(aConstraintAttributes[indAttr]));
-//// addTemporaryConstraintWhereDragged(aConstrAttr->attr());
-//// continue;
-//// }
-//// std::list<AttributePtr> anAttributes =
-//// aBaseFeature[indAttr]->data()->attributes(GeomDataAPI_Point2D::type());
-//// std::list<AttributePtr>::iterator anIt = anAttributes.begin();
-//// for ( ; anIt != anAttributes.end(); anIt++) {
-//// // Arc should be fixed by center and start points only (to avoid "conflicting constraints" message)
-//// if (aBaseFeature[indAttr]->getKind() == SketchPlugin_Arc::ID() &&
-//// (*anIt)->id() == SketchPlugin_Arc::END_ID())
-//// continue;
-//// addTemporaryConstraintWhereDragged(*anIt);
-//// }
-//// }
-//// return true;
-////}
-////
-////// ============================================================================
-////// Function: changeEntity
-////// Class: SketchSolver_Group
-////// Purpose: create/update the element affected by any constraint
-////// ============================================================================
-////Slvs_hEntity SketchSolver_Group::changeEntity(
-//// std::shared_ptr<ModelAPI_Attribute> theEntity)
-////{
-//// // If the entity is already in the group, try to find it
-//// std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
-//// myEntityAttrMap.find(theEntity);
-//// int aEntPos;
-//// std::vector<Slvs_Param>::const_iterator aParamIter; // looks at first parameter of already existent entity or at the end of vector otherwise
-//// if (aEntIter == myEntityAttrMap.end()) // no such entity => should be created
-//// aParamIter = myParams.end();
-//// else { // the entity already exists
-//// aEntPos = Search(aEntIter->second, myEntities);
-//// int aParamPos = Search(myEntities[aEntPos].param[0], myParams);
-//// aParamIter = myParams.begin() + aParamPos;
-//// }
-//// const bool isEntExists = (aEntIter != myEntityAttrMap.end()); // defines that the entity already exists
-//// const bool isNeedToSolve = myNeedToSolve;
-//// myNeedToSolve = false;
-////
-//// if (isEntExists) {
-//// // Verify that the entity is not used by "Rigid" constraint.
-//// // If it is used, the object should not move.
-//// std::vector<std::set<Slvs_hEntity> >::iterator aCoincIter = myCoincidentPoints.begin();
-//// for (; aCoincIter != myCoincidentPoints.end(); aCoincIter++)
-//// if (aCoincIter->find(aEntIter->second) != aCoincIter->end())
-//// break;
-//// std::set<Slvs_hEntity> aCoincident;
-//// if (aCoincIter != myCoincidentPoints.end()) {
-//// aCoincident = *aCoincIter;
-//// aCoincident.erase(aEntIter->second);
-////
-//// std::vector<Slvs_Constraint>::const_iterator aConstrIter = myConstraints.begin();
-//// for (; aConstrIter != myConstraints.end(); aConstrIter++)
-//// if (aConstrIter->type == SLVS_C_WHERE_DRAGGED &&
-//// aCoincident.find(aConstrIter->ptA) != aCoincident.end()) {
-//// myNeedToSolve = true;
-//// return aEntIter->second;
-//// }
-//// }
-//// }
-////
-//// // Look over supported types of entities
-//// Slvs_Entity aNewEntity;
-//// aNewEntity.h = SLVS_E_UNKNOWN;
-////
-//// // Point in 3D
-//// std::shared_ptr<GeomDataAPI_Point> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point>(
-//// theEntity);
-//// if (aPoint) {
-//// Slvs_hParam aX = changeParameter(aPoint->x(), aParamIter);
-//// Slvs_hParam aY = changeParameter(aPoint->y(), aParamIter);
-//// Slvs_hParam aZ = changeParameter(aPoint->z(), aParamIter);
-//// if (!isEntExists) // New entity
-//// aNewEntity = Slvs_MakePoint3d(++myEntityMaxID, myID, aX, aY, aZ);
-//// } else {
-//// // All entities except 3D points are created on workplane. So, if there is no workplane yet, then error
-//// if (myWorkplane.h == SLVS_E_UNKNOWN)
-//// return SLVS_E_UNKNOWN;
-////
-//// // Point in 2D
-//// std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
-//// std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
-//// if (aPoint2D) {
-//// Slvs_hParam aU = changeParameter(aPoint2D->x(), aParamIter);
-//// Slvs_hParam aV = changeParameter(aPoint2D->y(), aParamIter);
-//// if (!isEntExists) // New entity
-//// aNewEntity = Slvs_MakePoint2d(++myEntityMaxID, myID, myWorkplane.h, aU, aV);
-//// } else {
-//// // Scalar value (used for the distance entities)
-//// AttributeDoublePtr aScalar = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theEntity);
-//// if (aScalar) {
-//// Slvs_hParam aValue = changeParameter(aScalar->value(), aParamIter);
-//// if (!isEntExists) // New entity
-//// aNewEntity = Slvs_MakeDistance(++myEntityMaxID, myID, myWorkplane.h, aValue);
-//// }
-//// }
-//// }
-//// /// \todo Other types of entities
-////
-//// Slvs_hEntity aResult = SLVS_E_UNKNOWN; // Unsupported or wrong entity type
-////
-//// if (isEntExists) {
-//// myNeedToSolve = myNeedToSolve || isNeedToSolve;
-//// aResult = aEntIter->second;
-//// } else if (aNewEntity.h != SLVS_E_UNKNOWN) {
-//// myEntities.push_back(aNewEntity);
-//// myEntOfConstr.push_back(false);
-//// myEntityAttrMap[theEntity] = aNewEntity.h;
-//// aResult = aNewEntity.h;
-//// }
-////
-//// // If the attribute was changed by the user, we need to fix it before solving
-//// if (myNeedToSolve && theEntity->isImmutable())
-//// addTemporaryConstraintWhereDragged(theEntity, false);
-////
-//// return aResult;
-////}
-////
-////// ============================================================================
-////// Function: changeEntity
-////// Class: SketchSolver_Group
-////// Purpose: create/update the element defined by the feature affected by any constraint
-////// ============================================================================
-////Slvs_hEntity SketchSolver_Group::changeEntityFeature(FeaturePtr theEntity)
-////{
-//// if (!theEntity->data()->isValid())
-//// return SLVS_E_UNKNOWN;
-//// // If the entity is already in the group, try to find it
-//// std::map<FeaturePtr, Slvs_hEntity>::const_iterator aEntIter = myEntityFeatMap.find(theEntity);
-//// // defines that the entity already exists
-//// const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end());
-////
-//// Slvs_Entity aNewEntity;
-//// aNewEntity.h = SLVS_E_UNKNOWN;
-////
-//// // SketchPlugin features
-//// std::shared_ptr<SketchPlugin_Feature> aFeature = std::dynamic_pointer_cast<
-//// SketchPlugin_Feature>(theEntity);
-//// if (aFeature) { // Verify the feature by its kind
-//// const std::string& aFeatureKind = aFeature->getKind();
-//// AttributePtr anAttribute;
-////
-//// // Line
-//// if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0) {
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Line::START_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aStart = changeEntity(anAttribute);
-////
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Line::END_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aEnd = changeEntity(anAttribute);
-////
-//// if (!isEntExists) // New entity
-//// aNewEntity = Slvs_MakeLineSegment(++myEntityMaxID, myID, myWorkplane.h, aStart, aEnd);
-//// }
-//// // Circle
-//// else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0) {
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aCenter = changeEntity(anAttribute);
-////
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aRadius = changeEntity(anAttribute);
-////
-//// if (!isEntExists) // New entity
-//// aNewEntity = Slvs_MakeCircle(++myEntityMaxID, myID, myWorkplane.h, aCenter,
-//// myWorkplane.normal, aRadius);
-//// }
-//// // Arc
-//// else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0) {
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aCenter = changeEntity(anAttribute);
-////
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Arc::START_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aStart = changeEntity(anAttribute);
-////
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Arc::END_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aEnd = changeEntity(anAttribute);
-////
-//// if (!isEntExists)
-//// aNewEntity = Slvs_MakeArcOfCircle(++myEntityMaxID, myID, myWorkplane.h,
-//// myWorkplane.normal, aCenter, aStart, aEnd);
-//// }
-//// // Point (it has low probability to be an attribute of constraint, so it is checked at the end)
-//// else if (aFeatureKind.compare(SketchPlugin_Point::ID()) == 0) {
-//// anAttribute = aFeature->data()->attribute(SketchPlugin_Point::COORD_ID());
-//// if (!anAttribute->isInitialized()) return SLVS_E_UNKNOWN;
-//// Slvs_hEntity aPoint = changeEntity(anAttribute);
-////
-//// if (isEntExists)
-//// return aEntIter->second;
-////
-//// // Both the sketch point and its attribute (coordinates) link to the same SolveSpace point identifier
-//// myEntityFeatMap[theEntity] = aPoint;
-//// myNeedToSolve = true;
-//// return aPoint;
-//// }
-//// }
-//// /// \todo Other types of features
-////
-//// if (isEntExists)
-//// return aEntIter->second;
-////
-//// if (aNewEntity.h != SLVS_E_UNKNOWN) {
-//// myEntities.push_back(aNewEntity);
-//// myEntOfConstr.push_back(false);
-//// myEntityFeatMap[theEntity] = aNewEntity.h;
-//// myNeedToSolve = true;
-//// return aNewEntity.h;
-//// }
-////
-//// // Unsupported or wrong entity type
-//// return SLVS_E_UNKNOWN;
-////}