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