Salome HOME
Translation and Rotation code clean up
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Translation.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Translation.h
4 // Created:     8 June 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef GeomAlgoAPI_Translation_H_
8 #define GeomAlgoAPI_Translation_H_
9
10 #include <GeomAlgoAPI.h>
11 #include <GeomAlgoAPI_MakeShape.h>
12 #include <GeomAPI_Ax1.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
14 #include <GeomAPI_Shape.h>
15 #include <GeomAPI_Trsf.h>
16
17 /** \class GeomAlgoAPI_Translation
18  *  \ingroup DataAlgo
19  *  \brief Creates a copy of the object by moving it along the axis.
20  */
21 class GeomAlgoAPI_Translation : public GeomAPI_Interface
22 {
23 public:
24   /** \brief Creates an object which is obtained from current object by moving it along the axis.
25    *  \param[in] theSourceShape  a shape to be moved.
26    *  \param[in] theAxis         movement axis.
27    *  \param[in] theDistance     movement distance.
28    */
29   GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
30                                              std::shared_ptr<GeomAPI_Ax1>   theAxis,
31                                              double                         theDistance);
32
33   /// \return true if algorithm succeed.
34   GEOMALGOAPI_EXPORT const bool isDone() const
35   { return myDone; }
36
37   /// \return true if resulting shape is valid.
38   GEOMALGOAPI_EXPORT const bool isValid() const;
39
40   /// \return true if resulting shape has volume.
41   GEOMALGOAPI_EXPORT const bool hasVolume() const;
42
43   /// \return result of the movement algorithm.
44   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
45
46   /// \return map of sub-shapes of the result. To be used for History keeping.
47   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
48
49   /// \return interface for for History processing.
50   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
51
52   /// Returns the simple transformation
53   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Trsf> transformation() const;
54
55 private:
56   /// Builds resulting shape.
57   void build(std::shared_ptr<GeomAPI_Shape> theSourceShape,
58              std::shared_ptr<GeomAPI_Ax1>   theAxis,
59              double                         theDistance);
60
61 private:
62   /// Fields.
63   bool myDone;
64   std::shared_ptr<GeomAPI_Shape> myShape;
65   std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
66   std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
67   std::shared_ptr<GeomAPI_Trsf> myTrsf;
68 };
69
70 #endif