X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_FeatureStorage.cpp;h=34d07b2bfe01066f3c8ad9ad76a3ae1d5271b771;hb=d3883990177d27a12b8a2278cdbb82250ff19b79;hp=d647d075b6f1cca79b74cf3d17e4dd20bd5e21b2;hpb=27395bd5e5213d1c479d87191379515e2e60912c;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_FeatureStorage.cpp b/src/SketchSolver/SketchSolver_FeatureStorage.cpp index d647d075b..34d07b2bf 100644 --- a/src/SketchSolver/SketchSolver_FeatureStorage.cpp +++ b/src/SketchSolver/SketchSolver_FeatureStorage.cpp @@ -9,6 +9,7 @@ #include #include #include +#include void SketchSolver_FeatureStorage::changeConstraint(ConstraintPtr theConstraint) { @@ -248,6 +249,8 @@ bool SketchSolver_FeatureStorage::isInteract(FeaturePtr theFeature) const { if (myFeatures.find(theFeature) != myFeatures.end()) return true; + if (!theFeature->data() || !theFeature->data()->isValid()) + return false; std::list anAttributes = theFeature->data()->attributes(std::string()); std::list::iterator anIter = anAttributes.begin(); @@ -303,6 +306,24 @@ void SketchSolver_FeatureStorage::removeAttribute(AttributePtr theAttribute, Fea return; // no such attribute anAttrIter->second.erase(theFeature); + if (!anAttrIter->second.empty()) + return; + + // Check there is no features containing such attribute + MapFeatureConstraint::iterator aFeatIter = myFeatures.begin(); + for (; aFeatIter != myFeatures.end(); aFeatIter++) { + DataPtr aData = aFeatIter->first->data(); + if (!aData || !aData->isValid()) + continue; + std::list anAttrList = aData->attributes(GeomDataAPI_Point2D::typeId()); + std::list::iterator anAtIt = anAttrList.begin(); + for (; anAtIt != anAttrList.end(); anAtIt++) { + std::shared_ptr aPoint = + std::dynamic_pointer_cast(*anAtIt); + if (aPoint == theAttribute) + anAttrIter->second.insert(aFeatIter->first); + } + } if (anAttrIter->second.empty()) myAttributes.erase(anAttrIter); }