- // 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(SketchPlugin_Point::ID()) == 0)
- anAttrList.push_back(SketchPlugin_Point::COORD_ID());
- // Line
- else if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0) {
- anAttrList.push_back(SketchPlugin_Line::START_ID());
- anAttrList.push_back(SketchPlugin_Line::END_ID());
- }
- // Circle
- else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0) {
- anAttrList.push_back(SketchPlugin_Circle::CENTER_ID());
- anAttrList.push_back(SketchPlugin_Circle::RADIUS_ID());
- }
- // Arc
- else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0) {
- anAttrList.push_back(SketchPlugin_Arc::CENTER_ID());
- anAttrList.push_back(SketchPlugin_Arc::START_ID());
- anAttrList.push_back(SketchPlugin_Arc::END_ID());
- }
- /// \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;
- std::shared_ptr<ModelAPI_Attribute> anAttribute = std::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);