Salome HOME
Sketcher: Remove obsolete interfaces. Code cleanup.
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMultiRotation.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintMultiRotation.h
4 // Created: 1 Apr 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintMultiRotation_H_
8 #define SketchSolver_ConstraintMultiRotation_H_
9
10 #include <SketchSolver_ConstraintMulti.h>
11
12 #include "GeomDataAPI_Point2D.h"
13
14 /** \class   SketchSolver_ConstraintMultiRotation
15  *  \ingroup Plugins
16  *  \brief   Convert rotated features to the list of SolveSpace constraints
17  */
18 class SketchSolver_ConstraintMultiRotation : public SketchSolver_ConstraintMulti
19 {
20 public:
21   /// Constructor based on SketchPlugin constraint
22   SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) :
23       SketchSolver_ConstraintMulti(theConstraint)
24   {}
25
26 protected:
27   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
28   virtual void process();
29
30   /// \brief Generate list of rotated entities
31   /// \param[out] theCenter   central point of rotation
32   /// \param[out] theAngle    rotation angle
33   /// \param[out] theFullValue  applying translation using the disstance as a full or single value
34   /// \param[out] theEntities list of base entities
35   void getAttributes(EntityWrapperPtr&            theCenter,
36                      EntityWrapperPtr&            theAngle,
37                      bool&                        theFullValue,
38                      std::list<EntityWrapperPtr>& theEntities);
39
40   /// \brief This method is used in derived objects to check consistence of constraint.
41   virtual void adjustConstraint();
42
43   /// \brief Update parameters (called from base class)
44   virtual void updateLocal();
45
46 private:
47   /// \brief Convert absolute coordinates to relative coordinates
48   virtual void getRelative(double theAbsX, double theAbsY,
49                            double& theRelX, double& theRelY);
50   /// \brief Convert relative coordinates to absolute coordinates
51   virtual void getAbsolute(double theRelX, double theRelY,
52                            double& theAbsX, double& theAbsY);
53   /// \brief Apply transformation for relative coordinates
54   virtual void transformRelative(double& theX, double& theY);
55
56   /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
57   virtual const std::string& nameNbObjects();
58
59 private:
60   AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation
61   double              myAngle;           ///< angle of rotation
62
63   double myCenterCoord[2]; ///< coordinates of rotation center
64   double myRotationVal[2]; ///< sinus and cosine of rotation angle
65 };
66
67 #endif