Salome HOME
Changes concerning to Radius constraint
authorazv <azv@opencascade.com>
Tue, 24 Jun 2014 04:21:42 +0000 (08:21 +0400)
committerazv <azv@opencascade.com>
Tue, 24 Jun 2014 04:21:42 +0000 (08:21 +0400)
src/SketchSolver/SketchSolver_ConstraintGroup.cpp

index 1b7a78639a2562a34bec81cfb17af10c007b3e41..5aa275391c5ff3366deca2f4d8dcd81c3e982bd0 100644 (file)
@@ -167,14 +167,14 @@ bool SketchSolver_ConstraintGroup::changeConstraint(
   if (aDistAttr)
   {
     aDistance = aDistAttr->value();
+    // SketchPlugin circle defined by its radius, but SolveSpace uses constraint for diameter
+    if (aConstrType == SLVS_C_DIAMETER)
+      aDistance *= 2.0;
     if (aConstrMapIter != myConstraintMap.end() && fabs(aConstrIter->valA - aDistance) > tolerance)
     {
       myNeedToSolve = true;
       aConstrIter->valA = aDistance;
     }
-    // SketchPlugin circle defined by its radius, but SolveSpace uses constraint for diameter
-    if (aConstrType == SLVS_C_DIAMETER)
-      aDistance *= 2.0;
   }
 
   Slvs_hEntity aConstrEnt[CONSTRAINT_ATTR_SIZE]; // parameters of the constraint
@@ -327,7 +327,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
   const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end());
 
   // SketchPlugin features
-  boost::shared_ptr<SketchPlugin_Feature> aFeature;
+  boost::shared_ptr<SketchPlugin_Feature> aFeature =
     boost::dynamic_pointer_cast<SketchPlugin_Feature>(theEntity);
   if (aFeature)
   { // Verify the feature by its kind
@@ -1103,7 +1103,7 @@ int Search(const uint32_t& theEntityID, const std::vector<T>& theEntities)
   int aVecSize = theEntities.size();
   while (aResIndex >= 0 && theEntities[aResIndex].h > theEntityID)
     aResIndex--;
-  while (aResIndex < aVecSize && theEntities[aResIndex].h < theEntityID)
+  while (aResIndex < aVecSize && aResIndex >= 0 && theEntities[aResIndex].h < theEntityID)
     aResIndex++;
   if (aResIndex == -1)
     aResIndex = aVecSize;