Salome HOME
Debug.
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Translation.h
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Translation.h
4 // Created:     8 June 2015
5 // Author:      Dmitry Bobylev
6 //
7 // Modified by Clarisse Genrault (CEA) : 17 Nov 2016
8
9 #ifndef GeomAlgoAPI_Translation_H_
10 #define GeomAlgoAPI_Translation_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_Translation
19 /// \ingroup DataAlgo
20 /// \brief Creates a copy of the object by moving it along the axis.
21 class GeomAlgoAPI_Translation : public GeomAlgoAPI_MakeShape
22 {
23 public:
24   /// Type of translation operation
25   enum MethodType {
26     BY_DISTANCE, ///< Translation by axis and distance
27     BY_DIM,      ///< Translation by dimensions in X, Y and Z
28     BY_POINTS    ///< Translation by two points
29   };
30
31   /// \brief Creates an object which is obtained from current object by moving it along the axis.
32   /// \param[in] theSourceShape  a shape to be moved.
33   /// \param[in] theAxis         movement axis.
34   /// \param[in] theDistance     movement distance.
35   GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
36                                              std::shared_ptr<GeomAPI_Ax1>   theAxis,
37                                              double                         theDistance);
38
39   /// \brief Creates an object which is obtained from current object by moving it along a vector
40   ///        defined by its dimensions in X, Y and Z.
41   /// \param[in] theSourceShape  the shape to be moved.
42   /// \param[in] theDX           the movement dimension in X.
43   /// \param[in] theDY           the movement dimension in Y.
44   /// \param[in] theDZ           the movement dimension in Z.
45   GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
46                                              double                         theDx,
47                                              double                         theDy,
48                                              double                         theDz);
49
50   /// \brief Creates an object which is obtained from current object by moving it along a vector
51   ///        defined by two points.
52   /// \param[in] theSourceShape  the shape to be moved.
53   /// \param[in] theStartPoint   the movement start point.
54   /// \param[in] theEndPoint     the movement end point.
55   GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
56                                              std::shared_ptr<GeomAPI_Pnt>   theStartPoint,
57                                              std::shared_ptr<GeomAPI_Pnt>   theEndPoint);
58
59   /// Checks if data for the translation execution is OK.
60   GEOMALGOAPI_EXPORT bool check();
61
62   /// Execute the translation.
63   GEOMALGOAPI_EXPORT void build();
64
65 private:
66   MethodType myMethodType; /// Type of method used.
67   std::shared_ptr<GeomAPI_Shape> mySourceShape; /// Shape to be moved.
68   std::shared_ptr<GeomAPI_Ax1> myAxis; /// Movement axis.
69   double myDistance; /// Movement distance.
70   double myDx; /// Movement dimension on X.
71   double myDy; /// Movement dimension on Y.
72   double myDz; /// Movement dimension on Z.
73   std::shared_ptr<GeomAPI_Pnt> myStartPoint; /// Movement start point.
74   std::shared_ptr<GeomAPI_Pnt> myEndPoint; /// Movement end point.
75 };
76
77 #endif