]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
An arc moving correction for dragging it by the center point.
authornds <natalia.donis@opencascade.com>
Mon, 29 Dec 2014 10:06:50 +0000 (13:06 +0300)
committernds <natalia.donis@opencascade.com>
Mon, 29 Dec 2014 10:06:50 +0000 (13:06 +0300)
src/SketchPlugin/SketchPlugin_Arc.cpp

index d6a6facfae37ceaa3eeaef964b49e10d53eedbaf..3acdb0e3196ccb9818cf2974a3bb803d75dde1ee 100644 (file)
@@ -237,5 +237,14 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
     if (aProjection && aStartAttr->pnt()->distance(aProjection) > tolerance)
       aStartAttr->setValue(aProjection);
     myStartUpdate = false;
+  } else if (theID == CENTER_ID() && !myEndUpdate) {
+    myEndUpdate = true;
+    // compute and change the arc end point
+    std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
+        new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
+    std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
+    if (aProjection && anEndAttr->pnt()->distance(aProjection) > tolerance)
+      anEndAttr->setValue(aProjection);
+    myEndUpdate = false;
   }
 }