Salome HOME
Issue #2535: Intersection - Include into sketch result does not work
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMovement.cpp
index 94c6d7af10066fa33f4489933acae9427abbdb76..bbaf6ac24a33074bf48e4a4917683609b8b2761e 100644 (file)
@@ -78,12 +78,14 @@ void SketchSolver_ConstraintMovement::process()
 static bool isSimpleMove(FeaturePtr theMovedFeature, AttributePtr theDraggedPoint)
 {
   bool isSimple = true;
+#ifdef CHANGE_RADIUS_WHILE_MOVE
   if (theMovedFeature->getKind() == SketchPlugin_Circle::ID())
     isSimple = (theDraggedPoint.get() != 0);
   else if (theMovedFeature->getKind() == SketchPlugin_Arc::ID()) {
     isSimple = (theDraggedPoint.get() != 0 &&
                 theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID());
   }
+#endif
   return isSimple;
 }
 
@@ -210,10 +212,17 @@ void SketchSolver_ConstraintMovement::startPoint(
 void SketchSolver_ConstraintMovement::moveTo(
     const std::shared_ptr<GeomAPI_Pnt2d>& theDestinationPoint)
 {
+  if (!myMovedFeature)
+    return; // nothing to move
+
   double aDelta[2] = { theDestinationPoint->x() - myStartPoint->x(),
                        theDestinationPoint->y() - myStartPoint->y() };
 
+#ifdef CHANGE_RADIUS_WHILE_MOVE
   int aMaxSize = mySimpleMove ? (int)myFixedValues.size() : 2;
+#else
+  int aMaxSize = myMovedFeature->getKind() == SketchPlugin_Line::ID() && !myDraggedPoint ? 4 : 2;
+#endif
   for (int i = 0; i < aMaxSize; ++i)
     myFixedValues[i] += aDelta[i % 2];
 }