- if (theParam.h > 0 && theParam.h <= myParamMaxID) {
- // parameter is already used, rewrite it
- return updateParameter(theParam);
- }
-
- Slvs_Param aParam = theParam;
- if (aParam.h > myParamMaxID)
- myParamMaxID = aParam.h;
- else
- aParam.h = ++myParamMaxID;
- myParameters.push_back(aParam);
- myNeedToResolve = true;
- return aParam.h;
-}
-
-Slvs_hParam SketchSolver_Storage::updateParameter(const Slvs_Param& theParam)
-{
- if (theParam.h > 0 && theParam.h <= myParamMaxID) {
- // parameter already used, rewrite it
- int aPos = Search(theParam.h, myParameters);
- if (aPos >= 0 && aPos < (int)myParameters.size()) {
- myNeedToResolve = myNeedToResolve || IsNotEqual(myParameters[aPos], theParam);
- myParameters[aPos] = theParam;
- return theParam.h;
+ 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());
+ }