Salome HOME
New feature "Placement" was implemented
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Placement.h
1 // File:        GeomAlgoAPI_Placement.h
2 // Created:     2 Dec 2014
3 // Author:      Artem ZHIDKOV
4
5 #ifndef GeomAlgoAPI_Placement_H_
6 #define GeomAlgoAPI_Placement_H_
7
8 #include <GeomAlgoAPI.h>
9 #include <GeomAPI_Shape.h>
10 #include <GeomAPI_Dir.h>
11 #include <GeomAPI_Pln.h>
12 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
14 #include <memory>
15
16 /**\class GeomAlgoAPI_Placement
17  * \ingroup DataAlgo
18  * \brief Creates the copied object which face is placed on the given plane
19  */
20 class GeomAlgoAPI_Placement : public GeomAPI_Interface
21 {
22 public:
23   /** \brief Creates an object which is obtained from current object by transformation calculated
24    *         as a movement of the source plane to be coincident with the destination plane
25    *  \param[in] theAttractiveShape shape to be moved
26    *  \param[in] theSourcePlane     plane on the shape to be made coincident with destination plane
27    *  \param[in] theDestPlane       destination plane
28    */
29   GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(std::shared_ptr<GeomAPI_Shape> theAttractiveShape,
30                                            std::shared_ptr<GeomAPI_Pln> theSourcePlane,
31                                            std::shared_ptr<GeomAPI_Pln> theDestPlane);
32
33   /// Returns True if algorithm succeed
34   GEOMALGOAPI_EXPORT const bool isDone() const
35   { return myDone; }
36
37   ///  Returns True if resulting shape is valid
38   GEOMALGOAPI_EXPORT const bool isValid() const;
39
40   /// Returns True if resulting shape has volume
41   GEOMALGOAPI_EXPORT const bool hasVolume() const;
42
43   /// Returns result of the Placement algorithm which may be a Solid or a Face
44   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
45
46   /// Returns map of sub-shapes of the result. To be used for History keeping
47   GEOMALGOAPI_EXPORT void  mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
48
49   /// Return interface for for History processing
50   GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape () const;
51
52   /// Destructor
53   GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Placement();
54
55 private:
56   /// builds resulting shape
57   void build(const std::shared_ptr<GeomAPI_Shape>& theAttractiveShape,
58              const std::shared_ptr<GeomAPI_Pln>& theSourcePlane,
59              const std::shared_ptr<GeomAPI_Pln>& theDestPlane);
60
61   /// fields
62   bool myDone;
63   std::shared_ptr<GeomAPI_Shape> myShape;
64   GeomAPI_DataMapOfShapeShape myMap;
65   GeomAlgoAPI_MakeShape * myMkShape;
66 };
67
68 #endif