Salome HOME
e5aee67e6950878433a009c7270a5d57ff748abd
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Rotation.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Rotation.h
4 // Created:     12 May 2015
5 // Author:      Dmitry Bobylev
6 //
7 // Modified by Clarisse Genrault (CEA) : 03 Mar 2017
8
9 #ifndef GeomAlgoAPI_Rotation_H_
10 #define GeomAlgoAPI_Rotation_H_
11
12 #include <GeomAlgoAPI.h>
13 #include <GeomAlgoAPI_MakeShape.h>
14
15 #include <GeomAPI_Ax1.h>
16 #include <GeomAPI_Shape.h>
17
18 /// \class GeomAlgoAPI_Rotation
19 /// \ingroup DataAlgo
20 /// \brief Creates a copy of the object by rotating it around the axis.
21 class GeomAlgoAPI_Rotation : public GeomAlgoAPI_MakeShape
22 {
23 public:
24   /// Type of rotation operation
25   enum MethodType {
26     BY_ANGLE, ///< Rotation by axis and an angle
27     BY_POINTS ///< Rotation by a center and two points
28   };
29
30   /// \brief Creates an object which is obtained from current object by rotating it around the axis
31   ///        with the angle.
32   /// \param[in] theSourceShape  a shape to be rotated.
33   /// \param[in] theAxis         rotation axis.
34   /// \param[in] theAngle        rotation angle(in degree).
35   GEOMALGOAPI_EXPORT GeomAlgoAPI_Rotation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
36                                           std::shared_ptr<GeomAPI_Ax1>   theAxis,
37                                           double                         theAngle);
38
39   /// \brief Creates an object which is obtained from current object by rotating it around the axis
40   ///        withe angle using the center and two points.
41   /// \param[in] theSourceShape  a shape to be rotated.
42   /// \param[in] theCenterPoint  center point.
43   /// \param[in] theStartPoint   start point.
44   /// \param[in] theEndPoint     end point.
45   GEOMALGOAPI_EXPORT GeomAlgoAPI_Rotation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
46                                           std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
47                                           std::shared_ptr<GeomAPI_Pnt>   theStartPoint,
48                                           std::shared_ptr<GeomAPI_Pnt>   theEndPoint);
49
50   /// Checks if data for the translation execution is OK.
51   GEOMALGOAPI_EXPORT bool check();
52
53   /// Execute the translation.
54   GEOMALGOAPI_EXPORT void build();
55
56 private:
57   MethodType myMethodType; /// Type of method used.
58   std::shared_ptr<GeomAPI_Shape> mySourceShape; /// Shape to be rotated.
59   std::shared_ptr<GeomAPI_Ax1> myAxis; /// Rotation axis.
60   double myAngle; /// Rotation angle.
61   std::shared_ptr<GeomAPI_Pnt> myCenterPoint; /// Rotation center point.
62   std::shared_ptr<GeomAPI_Pnt> myStartPoint; /// Rotation start point.
63   std::shared_ptr<GeomAPI_Pnt> myEndPoint; /// Rotation end point.
64 };
65
66 #endif