- // Copy constraints excluding the fixed one
- std::vector<Slvs_Constraint> aConstraints = myConstraints;
- if (myFixed != SLVS_E_UNKNOWN) {
- Slvs_hEntity aFixedPoint = SLVS_E_UNKNOWN;
- std::vector<Slvs_Constraint>::iterator anIt = aConstraints.begin();
- for (; anIt != aConstraints.end(); anIt++)
- if (anIt->h == myFixed) {
- aFixedPoint = anIt->ptA;
- aConstraints.erase(anIt);
- break;
- }
- // set dragged parameters
- int aPos = Search(aFixedPoint, myEntities);
- theSolver.setDraggedParameters(myEntities[aPos].param);
- }
- theSolver.setConstraints(aConstraints.data(), (int)aConstraints.size());
-}
-
-void SketchSolver_Storage::addCoincidentPoints(
- const Slvs_hEntity& thePoint1, const Slvs_hEntity& thePoint2)
-{
- std::vector< std::set<Slvs_hEntity> >::iterator aCIter = myCoincidentPoints.begin();
- std::vector< std::set<Slvs_hEntity> >::iterator aFoundIter = myCoincidentPoints.end(); // already found coincidence
- bool isFound = false;
- for (; aCIter != myCoincidentPoints.end(); aCIter++) {
- bool isFirstFound = aCIter->find(thePoint1) != aCIter->end();
- bool isSecondFound = aCIter->find(thePoint2) != aCIter->end();
- isFound = isFound || isFirstFound || isSecondFound;
- if (isFirstFound && isSecondFound)
- break; // already coincident
- else if (isFirstFound || isSecondFound) {
- if (aFoundIter != myCoincidentPoints.end()) {
- // merge two sets
- aFoundIter->insert(aCIter->begin(), aCIter->end());
- myCoincidentPoints.erase(aCIter);
- break;
- }
- aCIter->insert(thePoint1);
- aCIter->insert(thePoint2);
+ std::list<AttributePtr> anAttrList = theFeature->data()->attributes(std::string());
+ std::list<AttributePtr>::const_iterator anIt = anAttrList.begin();
+ for (; anIt != anAttrList.end(); ++anIt)
+ if (isInteract(*anIt))
+ return true;
+
+ return false;
+}
+
+bool SketchSolver_Storage::isInteract(const AttributePtr& theAttribute) const
+{
+ if (!theAttribute)
+ return false;
+
+ AttributeRefListPtr aRefList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
+ if (aRefList) {
+ std::list<ObjectPtr> anObjects = aRefList->list();
+ std::list<ObjectPtr>::iterator anObjIt = anObjects.begin();
+ for (; anObjIt != anObjects.end(); ++anObjIt) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt);
+ if (isInteract(aFeature))
+ return true;