- // Create list of attributes depending on type of the feature
- std::vector<std::string> anAttrList;
- const std::string& aFeatureKind = theFeature->getKind();
- // Point
- if (aFeatureKind.compare(SKETCH_POINT_KIND) == 0)
- anAttrList.push_back(POINT_ATTR_COORD);
- // Line
- else if (aFeatureKind.compare(SKETCH_LINE_KIND) == 0)
- {
- anAttrList.push_back(LINE_ATTR_START);
- anAttrList.push_back(LINE_ATTR_END);
- }
- // Circle
- else if (aFeatureKind.compare(SKETCH_CIRCLE_KIND) == 0)
- {
- anAttrList.push_back(CIRCLE_ATTR_CENTER);
- anAttrList.push_back(CIRCLE_ATTR_RADIUS);
- }
- // Arc
- else if (aFeatureKind.compare(SKETCH_ARC_KIND) == 0)
- {
- anAttrList.push_back(ARC_ATTR_CENTER);
- anAttrList.push_back(ARC_ATTR_START);
- anAttrList.push_back(ARC_ATTR_END);
- }
- /// \todo Other types of features should be implemented
-
- // Check changing of feature's attributes (go through the groups and search usage of the attributes)
- std::vector<std::string>::const_iterator anAttrIter;
- for (anAttrIter = anAttrList.begin(); anAttrIter != anAttrList.end(); anAttrIter++)
- {
- std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
- for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
- {
- if ((*aGroupIter)->isEmpty())
- continue;
- boost::shared_ptr<ModelAPI_Attribute> anAttribute =
- boost::dynamic_pointer_cast<ModelAPI_Attribute>(theFeature->data()->attribute(*anAttrIter));
- (*aGroupIter)->updateEntityIfPossible(anAttribute);
- }
- }
-
- std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
- for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
- if (!(*aGroupIter)->isEmpty())
- (*aGroupIter)->updateRelatedConstraints(theFeature);