From: azv Date: Mon, 14 Sep 2015 12:09:00 +0000 (+0300) Subject: Avoid duplicating entities placed in temporary constraints. X-Git-Tag: V_1.4.0~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4619c9af2c14a7309ccfd4d4cb81c5878a3389e5;p=modules%2Fshaper.git Avoid duplicating entities placed in temporary constraints. --- diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 0e4093ffa..8b4026ef2 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -147,11 +147,12 @@ Slvs_hEntity SketchSolver_Group::getFeatureId(FeaturePtr theFeature) const Slvs_hEntity aResult = SLVS_E_UNKNOWN; if (!myFeatureStorage) return aResult; + // Obtain regular constraints interacting with the feature and find its ID std::set aConstraints = myFeatureStorage->getConstraints(theFeature); if (aConstraints.empty()) return aResult; std::set::iterator aConstrIter = aConstraints.begin(); - for (; aConstrIter != aConstraints.end(); aConstrIter++) { + for (; aConstrIter != aConstraints.end(); ++aConstrIter) { ConstraintConstraintMap::const_iterator aCIter = myConstraints.find(*aConstrIter); if (aCIter == myConstraints.end()) continue; @@ -159,7 +160,11 @@ Slvs_hEntity SketchSolver_Group::getFeatureId(FeaturePtr theFeature) const if (aResult != SLVS_E_UNKNOWN) return aResult; } - return SLVS_E_UNKNOWN; + // The feature is not found, check it in the temporary constraints + std::set::iterator aTmpCIter = myTempConstraints.begin(); + for (; aTmpCIter != myTempConstraints.end() && aResult == SLVS_E_UNKNOWN; ++aTmpCIter) + aResult = (*aTmpCIter)->getId(theFeature); + return aResult; } // ============================================================================ @@ -172,6 +177,7 @@ Slvs_hEntity SketchSolver_Group::getAttributeId(AttributePtr theAttribute) const Slvs_hEntity aResult = SLVS_E_UNKNOWN; if (!myFeatureStorage) return aResult; + // Obtain regular constraints interacting with the attribute and find its ID std::set aConstraints = myFeatureStorage->getConstraints(theAttribute); if (aConstraints.empty()) return aResult; @@ -184,7 +190,11 @@ Slvs_hEntity SketchSolver_Group::getAttributeId(AttributePtr theAttribute) const if (aResult != SLVS_E_UNKNOWN) return aResult; } - return SLVS_E_UNKNOWN; + // The attribute is not found, check it in the temporary constraints + std::set::iterator aTmpCIter = myTempConstraints.begin(); + for (; aTmpCIter != myTempConstraints.end() && aResult == SLVS_E_UNKNOWN; ++aTmpCIter) + aResult = (*aTmpCIter)->getId(theAttribute); + return aResult; } // ============================================================================