Salome HOME
Issue #1664 In the Sketcher, add the function Split a segment - correction for arc...
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintAngle.cpp
1 #include <SketchSolver_ConstraintAngle.h>
2 #include <SketchSolver_Manager.h>
3
4 #include <GeomAPI_Dir2d.h>
5 #include <GeomAPI_Lin2d.h>
6 #include <GeomAPI_Pnt2d.h>
7 #include <GeomAPI_XY.h>
8
9 #include <cmath>
10
11 void SketchSolver_ConstraintAngle::getAttributes(
12     double& theValue, std::vector<EntityWrapperPtr>& theAttributes)
13 {
14   SketchSolver_Constraint::getAttributes(theValue, theAttributes);
15
16   myAngle = theValue;
17 }
18
19
20 void SketchSolver_ConstraintAngle::adjustConstraint()
21 {
22   static const double aTol = 1000. * tolerance;
23   BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
24
25   ConstraintWrapperPtr aConstraint = myStorage->constraint(myBaseConstraint).front();
26   //if (fabs(myAngle - aConstraint->value()) < aTol)
27   //  return;
28   myAngle = aConstraint->value();
29   aBuilder->adjustConstraint(aConstraint);
30   myStorage->addConstraint(myBaseConstraint, aConstraint);
31 }