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