From: azv Date: Mon, 9 Sep 2019 13:38:03 +0000 (+0300) Subject: Task 2.11. Ability to impose a midpoint on an arc (refers issue #3002) X-Git-Tag: V9_4_0a2~4^2~124 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd3fb1611dd176786f1e021d93008bf1a506f30f;p=modules%2Fshaper.git Task 2.11. Ability to impose a midpoint on an arc (refers issue #3002) Revert more code related to arc processing in SketchSolver plugin. --- diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index 9f23cf6c5..6a41efc0d 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -223,6 +223,30 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) if (sendNotify && isUpdated) notify(theFeature); + // update arc + if (aRelated && aRelated->type() == ENTITY_ARC) { + /// TODO: this code should be shared with FeatureBuilder somehow + + std::shared_ptr anEntity = + std::dynamic_pointer_cast(aRelated); + std::shared_ptr anArc = std::dynamic_pointer_cast(anEntity->entity()); + + static std::shared_ptr OX(new GeomAPI_Dir2d(1.0, 0.0)); + std::shared_ptr aCenter( + new GeomAPI_Pnt2d(*anArc->center.x, *anArc->center.y)); + std::shared_ptr aStart( + new GeomAPI_Pnt2d(*anArc->start.x, *anArc->start.y)); + + *anArc->rad = aStart->distance(aCenter); + + std::shared_ptr aDir(new GeomAPI_Dir2d(aStart->xy()->decreased(aCenter->xy()))); + *anArc->startAngle = OX->angle(aDir); + + aDir = std::shared_ptr( + new GeomAPI_Dir2d((*anArc->end.x) - aCenter->x(), (*anArc->end.y) - aCenter->y())); + *anArc->endAngle = OX->angle(aDir); + } + return isUpdated; }