Salome HOME
Add tools
[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_Face.h>
14 #include <GeomAPI_Trsf.h>
15 #include <GeomAlgoAPI_MakeShape.h>
16 #include <GeomAPI_DataMapOfShapeShape.h>
17 #include <memory>
18
19 /**\class GeomAlgoAPI_Placement
20  * \ingroup DataAlgo
21  * \brief Creates the copied object which sub-element is placed on the given element
22  */
23 class GeomAlgoAPI_Placement : public GeomAPI_Interface
24 {
25 public:
26   /** \brief Creates an object which is obtained from current object by transformation calculated
27    *         as a movement of the source object to be coincident with the destination object
28    *  \param[in] theSourceSolid  a shape to be moved
29    *  \param[in] theDestSolid    invariant shape
30    *  \param[in] theSourceShape  a shape on the solid to be made coincident with destination object
31    *  \param[in] theDestShape    destination object
32    *  \param[in] theIsReverse    indicates that the solid materials should be on the same side against the destination plane
33    *  \param[in] theIsCentering  indicates the planes should be centered
34    *  \param[in] theSimpleTransform makes just transformation of shape without changing of topology or geometry
35    */
36   GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(std::shared_ptr<GeomAPI_Shape> theSourceSolid,
37                                            std::shared_ptr<GeomAPI_Shape> theDestSolid,
38                                            std::shared_ptr<GeomAPI_Shape> theSourceShape,
39                                            std::shared_ptr<GeomAPI_Shape> theDestShape,
40                                            bool theIsReverse = false,
41                                            bool theIsCentering = false,
42                                            bool theSimpleTransform = false);
43
44   /// Returns True if algorithm succeed
45   GEOMALGOAPI_EXPORT const bool isDone() const
46   { return myDone; }
47
48   ///  Returns True if resulting shape is valid
49   GEOMALGOAPI_EXPORT const bool isValid() const;
50
51   /// Returns True if resulting shape has volume
52   GEOMALGOAPI_EXPORT const bool hasVolume() const;
53
54   /// Returns result of the Placement algorithm which may be a Solid or a Face
55   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
56
57   /// Returns map of sub-shapes of the result. To be used for History keeping
58   GEOMALGOAPI_EXPORT void  mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
59
60   /// Return interface for for History processing
61   GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape () const;
62
63   /// Returns the simple transformation
64   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Trsf> transformation() const;
65
66   /// Destructor
67   GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Placement();
68
69 private:
70   /// builds resulting shape
71   void build(const std::shared_ptr<GeomAPI_Shape>& theSourceSolid,
72              const std::shared_ptr<GeomAPI_Shape>& theDestSolid,
73              const std::shared_ptr<GeomAPI_Shape>& theSourceShape,
74              const std::shared_ptr<GeomAPI_Shape>& theDestShape,
75              bool theIsReverse,
76              bool theIsCentering,
77              bool theSimpleTransform);
78
79   /// fields
80   bool myDone;
81   std::shared_ptr<GeomAPI_Shape> myShape;
82   GeomAPI_DataMapOfShapeShape myMap;
83   GeomAlgoAPI_MakeShape * myMkShape;
84   std::shared_ptr<GeomAPI_Trsf> myTrsf; ///< transformation of the shape in case theSimpleTransform
85 };
86
87 #endif